mirror of
https://github.com/Ascyii/telekasten.nvim.git
synced 2026-01-01 14:14:24 -05:00
fixed bug: when following link: check if target exists in daily, weekly,
too!
This commit is contained in:
@@ -4,6 +4,7 @@
|
|||||||
- maybe choose template in create note
|
- maybe choose template in create note
|
||||||
|
|
||||||
## Dones
|
## Dones
|
||||||
|
- [x] avoid creating new note in home dir when following link to daily or weekly
|
||||||
- [x] get rid of `daily_finder.sh`
|
- [x] get rid of `daily_finder.sh`
|
||||||
- [x] find weekly note
|
- [x] find weekly note
|
||||||
- [x] goto week
|
- [x] goto week
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ local note_type_templates = {
|
|||||||
|
|
||||||
local function file_exists(fname)
|
local function file_exists(fname)
|
||||||
local f=io.open(fname,"r")
|
local f=io.open(fname,"r")
|
||||||
|
print("checking for " .. 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
|
||||||
|
|
||||||
@@ -173,9 +174,13 @@ FollowLink = function(opts)
|
|||||||
vim.cmd('normal yi]')
|
vim.cmd('normal yi]')
|
||||||
local title = vim.fn.getreg('"0')
|
local title = vim.fn.getreg('"0')
|
||||||
|
|
||||||
local fname = ZkCfg.home .. '/' .. title .. ZkCfg.extension
|
-- check if fname exists anywhere
|
||||||
local fexists = file_exists(fname)
|
local fexists = file_exists(ZkCfg.weeklies .. '/' .. title .. ZkCfg.extension)
|
||||||
|
fexists = fexists or file_exists(ZkCfg.dailies .. '/' .. title .. ZkCfg.extension)
|
||||||
|
fexists = fexists or file_exists(ZkCfg.home .. '/' .. title .. ZkCfg.extension)
|
||||||
|
|
||||||
if ((fexists ~= true) and ((opts.follow_creates_nonexisting == true) or ZkCfg.follow_creates_nonexisting == true)) then
|
if ((fexists ~= true) and ((opts.follow_creates_nonexisting == true) or ZkCfg.follow_creates_nonexisting == true)) then
|
||||||
|
local fname = ZkCfg.home .. '/' .. title .. ZkCfg.extension
|
||||||
create_note_from_template(title, fname, note_type_templates.normal)
|
create_note_from_template(title, fname, note_type_templates.normal)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user