demo.mov
With NeoRoot.lua, you will be able to:
- Before starting NeoVim, first navigate to your project root(can be modified later)
- Run
nvim .
to start your NeoVim. NowNeoRoot
will enterproj-mode
(see below) with the path you runnvim .
as the root - During development, you can temporarily change the
cwd
to your current buffer. - During development, you can temporarily re-define your project root. For example:
~/.config
. (shorthand~
,../
s are supported!- if you want to change back to
../somewhere/MyProj/
, just leave the prompt blank and hit Enter. Simple!
- if you want to change back to
Now you won't have a hard time :cd
to the right place to see more files before executing commands that takes your current working directory into account
(i.e. you need to go up some levels to make tools like rg
/fd
to "see" more files).
You can also change your project root in the runtime, without typing any command, anymore!
- No dependencies
- No requirements
- free
- Light-weight, ~100 lines
- Work with
- glepnir/dashboard-nvim
- numToStr/FTerm.nvim
- kyazdani42/nvim-tree.lua
- ibhagwan/fzf-lua, highly recommended
local NOREF_NOERR_TRUNC = { noremap = true, silent = true, nowait = true }
use {
'nyngwang/NeoRoot.lua',
config = function()
require('neo-root').setup {
CUR_MODE = 2 -- 1 for file/buffer mode, 2 for proj-mode
}
end
}
vim.cmd'au BufEnter * NeoRoot'
vim.keymap.set('n', '<Leader>p', function() vim.cmd('NeoRootSwitchMode') end, NOREF_NOERR_TRUNC)
vim.keymap.set('n', '<Leader>pre', function() vim.cmd('NeoRootChange') end, NOREF_NOERR_TRUNC)
To see your current working directory, simply call NeoRootSwitchMode
twice.
- Add installation guide in README.md
- packer.nvim
- Customizable
- keymappings
- ignore list