mirror of
https://github.com/Ascyii/telekasten.nvim.git
synced 2026-01-01 06:14:23 -05:00
feat: Tab autocompletes with folders in notes home directory (#326)
* refs 293-tab-complete-fix: feat: changing the current working directory when creating a new note to the configured home directory * refs 293-tab-complete-fix: format(telekasten): removing trailing whitespace in comments closes #293 closes #277
This commit is contained in:
@@ -2002,9 +2002,16 @@ local function CreateNoteSelectTemplate(opts)
|
||||
return
|
||||
end
|
||||
|
||||
-- get the current working directory
|
||||
local current_dir = vim.fn.getcwd()
|
||||
-- change the cwd to the configured home directory, so tab completion
|
||||
-- works for the folders in that directory
|
||||
vim.fn.chdir(M.Cfg.home)
|
||||
fileutils.prompt_title(M.Cfg.extension, nil, function(title)
|
||||
on_create_with_template(opts, title)
|
||||
end)
|
||||
-- change back to the original directory
|
||||
vim.fn.chdir(current_dir)
|
||||
end)
|
||||
end
|
||||
|
||||
@@ -2085,9 +2092,16 @@ local function CreateNote(opts)
|
||||
return CreateNoteSelectTemplate(opts)
|
||||
end
|
||||
|
||||
-- get the current working directory
|
||||
local current_dir = vim.fn.getcwd()
|
||||
-- change the cwd to the configured home directory, so tab completion
|
||||
-- works for the folders in that directory
|
||||
vim.fn.chdir(M.Cfg.home)
|
||||
fileutils.prompt_title(M.Cfg.extension, nil, function(title)
|
||||
on_create(opts, title)
|
||||
end)
|
||||
-- change back to the original directory
|
||||
vim.fn.chdir(current_dir)
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user