kiwi.nvim icon indicating copy to clipboard operation
kiwi.nvim copied to clipboard

Change directory to wiki as per user's preference

Open serenevoid opened this issue 1 year ago • 3 comments

As suggested by @CatalinPlesu here, the user should be able decide whether to change the directory to the location of the wiki.

serenevoid avatar Jan 15 '25 17:01 serenevoid

@CatalinPlesu Can you please check if this works? I will merge this change after your confirmation or add changes if you have suggestions.

serenevoid avatar Jan 15 '25 17:01 serenevoid

@serenevoid Hi, for me it doesn't work right now, but my setup is a bit different, i don't keep the notes in home dir, but in /home/mnt/catalin/notes/wiki1

I actually encountered a similar problem without looking at your issue, that is why i created this pr

I suggets updating a function like this:

utils.get_wiki_path = function(path)
  if path ~= nil then
    local default_dir = vim.fs.joinpath(vim.loop.os_homedir(), "wiki")
    return default_dir
  end
  if vim.loop.fs_realpath(path) then
    return path
  else
    return vim.fs.joinpath(vim.loop.os_homedir(), path)
  end
end

and on that line to call like this: vim.api.nvim_set_current_dir(utils.get_wiki_path(config.path))

and discard taht pr

CatalinPlesu avatar Jan 18 '25 10:01 CatalinPlesu

Aah, I see. I avoided separate paths to avoid complications. But this seems like a simpler solution. In this case, kiwi won't be able to create the directory for the users. They'll have to create all the necessary directories themselves.

serenevoid avatar Jan 20 '25 12:01 serenevoid