mirror of
https://github.com/Ascyii/telekasten.nvim.git
synced 2026-01-01 14:14:24 -05:00
fixed shell script and stuff
This commit is contained in:
@@ -6,20 +6,20 @@
|
|||||||
# - sorted by date
|
# - sorted by date
|
||||||
# - creates today's note if not present, with hardcoded template
|
# - creates today's note if not present, with hardcoded template
|
||||||
|
|
||||||
|
if [ "$1" == "check" ] ; then
|
||||||
|
echo OK
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
# if called by the plugin, no args are provided, and the current working
|
# if called by the plugin, no args are provided, and the current working
|
||||||
# directory is set instead
|
# directory is set instead
|
||||||
if [ $1 = ""] ; then
|
if [ "$1" == "" ] ; then
|
||||||
the_dir=$(pwd)
|
the_dir=$(pwd)
|
||||||
else
|
else
|
||||||
the_dir=$1
|
the_dir=$1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $1 = "check" ] ; then
|
|
||||||
echo OK
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# function DaySuffix:
|
# function DaySuffix:
|
||||||
# little helper to give us st, nd, th for 1st, 2nd, 3rd, 4th, ...
|
# little helper to give us st, nd, th for 1st, 2nd, 3rd, 4th, ...
|
||||||
DaySuffix() {
|
DaySuffix() {
|
||||||
@@ -45,10 +45,10 @@ CreateDaily() {
|
|||||||
echo --- >> $dailyfile
|
echo --- >> $dailyfile
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ $(basename $the_dir) = daily ] ; then
|
if [ "$(basename $the_dir)" == "daily" ] ; then
|
||||||
if [ ! -f $dailyfile ] ; then
|
if [ ! -f $dailyfile ] ; then
|
||||||
$(CreateDaily)
|
$(CreateDaily)
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
find $the_dir | sort -rn
|
find $the_dir -type f| sort -rn
|
||||||
|
|||||||
@@ -10,14 +10,14 @@ local action_state = require "telescope.actions.state"
|
|||||||
|
|
||||||
-- DEFAULT CONFIG
|
-- DEFAULT CONFIG
|
||||||
zkcfg = {
|
zkcfg = {
|
||||||
home = "~/zettelkasten",
|
home = vim.fn.expand("~/zettelkasten"),
|
||||||
dailies = "~/zettelkasten/daily",
|
dailies = vim.fn.expand("~/zettelkasten/daily"),
|
||||||
extension = ".md",
|
extension = ".md",
|
||||||
daily_finder = "daily_finder.sh",
|
daily_finder = "daily_finder.sh",
|
||||||
|
|
||||||
-- where to install the daily_finder,
|
-- where to install the daily_finder,
|
||||||
-- (must be a dir in your PATH)
|
-- (must be a dir in your PATH)
|
||||||
my_bin = '~/bin',
|
my_bin = vim.fn.expand('~/bin'),
|
||||||
|
|
||||||
-- download tool for daily_finder installation: curl or wget
|
-- download tool for daily_finder installation: curl or wget
|
||||||
downloader = 'curl',
|
downloader = 'curl',
|
||||||
@@ -57,6 +57,11 @@ local zk_entry_maker = function(entry)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local check_local_finder = function()
|
||||||
|
local ret = vim.fn.system(zkcfg.daily_finder .. ' check')
|
||||||
|
return ret == "OK\n"
|
||||||
|
-- return vim.fn.executable(zkcfg.daily_finder) == 1
|
||||||
|
end
|
||||||
|
|
||||||
--
|
--
|
||||||
-- find_daily_notes:
|
-- find_daily_notes:
|
||||||
@@ -64,16 +69,18 @@ end
|
|||||||
-- Select from daily notes
|
-- Select from daily notes
|
||||||
--
|
--
|
||||||
find_daily_notes = function(opts)
|
find_daily_notes = function(opts)
|
||||||
builtin.find_files({
|
if (check_local_finder() == true) then
|
||||||
prompt_title = "Find daily note",
|
print(zkcfg.dailies)
|
||||||
cwd = zkcfg.dailies,
|
builtin.find_files({
|
||||||
find_command = { zkcfg.daily_finder },
|
prompt_title = "Find daily note",
|
||||||
entry_maker = zk_entry_maker,
|
cwd = zkcfg.dailies,
|
||||||
})
|
find_command = { zkcfg.daily_finder },
|
||||||
|
entry_maker = zk_entry_maker,
|
||||||
|
})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- insert_link:
|
-- insert_link:
|
||||||
--
|
--
|
||||||
@@ -113,9 +120,11 @@ end
|
|||||||
--
|
--
|
||||||
-- find_notes:
|
-- find_notes:
|
||||||
--
|
--
|
||||||
-- Select from daily notes
|
-- Select from notes
|
||||||
--
|
--
|
||||||
local find_notes = function(opts)
|
find_notes = function(opts)
|
||||||
|
opts = {} or opts
|
||||||
|
|
||||||
local find_command = opts.find_command
|
local find_command = opts.find_command
|
||||||
local hidden = opts.hidden
|
local hidden = opts.hidden
|
||||||
local no_ignore = opts.no_ignore
|
local no_ignore = opts.no_ignore
|
||||||
@@ -284,6 +293,7 @@ end
|
|||||||
|
|
||||||
local M = {
|
local M = {
|
||||||
zkcfg = zkcfg,
|
zkcfg = zkcfg,
|
||||||
|
find_notes = find_notes,
|
||||||
find_daily_notes = find_daily_notes,
|
find_daily_notes = find_daily_notes,
|
||||||
insert_link = insert_link,
|
insert_link = insert_link,
|
||||||
follow_link = follow_link,
|
follow_link = follow_link,
|
||||||
|
|||||||
Reference in New Issue
Block a user