akiyosi / goneovim

A GUI frontend for neovim.
MIT License
2.35k stars 60 forks source link

Current working directory #538

Open tahseenjamal opened 3 weeks ago

tahseenjamal commented 3 weeks ago

When I start goneovim from my coding folder and open Neotree or even Nvimtree, it always shows me the root folder

Whereas if I open neovim from my coding folder and open Neotree or Nvimtree, it shows my current working directory

How can I make goneovim work using the working directory when I start it from the command shell ?

akiyosi commented 3 weeks ago

@tahseenjamal Try the --nofork option in geneovim, or better yet, explicitly set CWD in the neovim configuration.

To ensure that Neovim uses the current working directory (CWD) when it is started, you can add the following settings to your init.vim (or init.lua). This will explicitly set Neovim's CWD to the runtime CWD.

vimrc:

" Set the CWD of Neovim to the runtime CWD on startup
autocmd VimEnter * silent! lcd %:p:h

lua: -- Set the CWD of Neovim to the runtime CWD on startup

vim.api.nvim_create_autocmd("VimEnter", {
    callback = function()
        vim.cmd("silent! lcd " .. vim.fn.expand("%:p:h"))
    end
})