mirror of
https://github.com/Ascyii/telekasten.nvim.git
synced 2026-01-01 06:14:23 -05:00
cleanup
This commit is contained in:
@@ -59,6 +59,7 @@ local function file_exists(fname)
|
|||||||
if f~=nil then io.close(f) return true else return false end
|
if f~=nil then io.close(f) return true else return false end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local function daysuffix(day)
|
local function daysuffix(day)
|
||||||
if((day == '1') or (day == '21') or (day == '31')) then return 'st' end
|
if((day == '1') or (day == '21') or (day == '31')) then return 'st' end
|
||||||
if((day == '2') or (day == '22')) then return 'nd' end
|
if((day == '2') or (day == '22')) then return 'nd' end
|
||||||
@@ -66,6 +67,7 @@ local function daysuffix(day)
|
|||||||
return 'th'
|
return 'th'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local function linesubst(line, title)
|
local function linesubst(line, title)
|
||||||
local substs = {
|
local substs = {
|
||||||
date = os.date('%Y-%m-%d'),
|
date = os.date('%Y-%m-%d'),
|
||||||
@@ -81,6 +83,7 @@ local function linesubst(line, title)
|
|||||||
return line
|
return line
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local create_note_from_template = function (title, filepath, templatefn)
|
local create_note_from_template = function (title, filepath, templatefn)
|
||||||
-- first, read the template file
|
-- first, read the template file
|
||||||
local lines = {}
|
local lines = {}
|
||||||
@@ -98,21 +101,6 @@ local create_note_from_template = function (title, filepath, templatefn)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- InstallDailyFinder:
|
|
||||||
-- -------------------
|
|
||||||
--
|
|
||||||
-- downloads the daily finder scripts to the configured `my_bin` directory
|
|
||||||
-- and makes it executable
|
|
||||||
--
|
|
||||||
InstallDailyFinder = function()
|
|
||||||
local destpath = ZkCfg.my_bin .. '/' .. ZkCfg.daily_finder
|
|
||||||
local cmd = downloader2cmd[ZkCfg.downloader]
|
|
||||||
vim.api.nvim_command('!'.. cmd .. ' ' .. destpath .. ' https://raw.githubusercontent.com/renerocksai/telekasten.nvim/main/ext_commands/daily_finder.sh')
|
|
||||||
vim.api.nvim_command('!chmod +x ' .. destpath)
|
|
||||||
end
|
|
||||||
|
|
||||||
local path_to_linkname = function(p)
|
local path_to_linkname = function(p)
|
||||||
local fn = vim.split(p, "/")
|
local fn = vim.split(p, "/")
|
||||||
fn = fn[#fn]
|
fn = fn[#fn]
|
||||||
@@ -121,6 +109,7 @@ local path_to_linkname = function(p)
|
|||||||
return fn
|
return fn
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local zk_entry_maker = function(entry)
|
local zk_entry_maker = function(entry)
|
||||||
return {
|
return {
|
||||||
value = entry,
|
value = entry,
|
||||||
@@ -137,6 +126,21 @@ local check_local_finder = function()
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- InstallDailyFinder:
|
||||||
|
-- -------------------
|
||||||
|
--
|
||||||
|
-- downloads the daily finder scripts to the configured `my_bin` directory
|
||||||
|
-- and makes it executable
|
||||||
|
--
|
||||||
|
InstallDailyFinder = function()
|
||||||
|
local destpath = ZkCfg.my_bin .. '/' .. ZkCfg.daily_finder
|
||||||
|
local cmd = downloader2cmd[ZkCfg.downloader]
|
||||||
|
vim.api.nvim_command('!'.. cmd .. ' ' .. destpath .. ' https://raw.githubusercontent.com/renerocksai/telekasten.nvim/main/ext_commands/daily_finder.sh')
|
||||||
|
vim.api.nvim_command('!chmod +x ' .. destpath)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- FindDailyNotes:
|
-- FindDailyNotes:
|
||||||
|
|||||||
Reference in New Issue
Block a user