Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nyngwang/NeoRoot.lua
Yet another light-weight rooter written in Lua
https://github.com/nyngwang/NeoRoot.lua
lua neovim
Last synced: about 2 months ago
JSON representation
Yet another light-weight rooter written in Lua
- Host: GitHub
- URL: https://github.com/nyngwang/NeoRoot.lua
- Owner: nyngwang
- Archived: true
- Created: 2021-12-29T14:49:07.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-02-08T22:33:14.000Z (over 1 year ago)
- Last Synced: 2024-02-17T14:35:45.933Z (7 months ago)
- Topics: lua, neovim
- Language: Lua
- Homepage:
- Size: 26.4 KB
- Stars: 70
- Watchers: 3
- Forks: 4
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
NeoRoot.lua
---## This project is now deprecated
Changing your project root (i.e. global current-directory, see `:h current-directory`)
just for grepping files, showing less files on your file tree is not a good practice.
If you once did this, you misused Vim.
(To achieve the same result, you should always call `:tcd` instead.)Besides this, I will recommend you trying my new project session plugin: https://github.com/nyngwang/suave.lua,
which follows this good practice:> Never touch the global current-directory unless you want to change to another project.
and it's designed to help you restore your project with ease. (Now supports restoring colorscheme, too)
### DEMO
https://user-images.githubusercontent.com/24765272/150794108-890b2ef3-3b4f-4fdb-8b47-0aa7f5d3ccf5.mov
### New Intro. (updated 2022/04/19)
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. Now `NeoRoot` will enter `proj-mode`(see below) with the path you run `nvim .` 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!### Old Promo.
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!### Features
- No dependencies
- No requirements
- free
- Light-weight, ~100 lines### Compatibility
- Work with
- [glepnir/dashboard-nvim](https://github.com/glepnir/dashboard-nvim)
- [numToStr/FTerm.nvim](https://github.com/numtostr/FTerm.nvim)
- [kyazdani42/nvim-tree.lua](https://github.com/kyazdani42/nvim-tree.lua)
- [ibhagwan/fzf-lua](https://github.com/ibhagwan/fzf-lua), __highly recommended__### Setup
#### Packer.nvim
```lua
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', 'p', function() vim.cmd('NeoRootSwitchMode') end, NOREF_NOERR_TRUNC)
vim.keymap.set('n', 'pre', function() vim.cmd('NeoRootChange') end, NOREF_NOERR_TRUNC)
```### Hint
To see your current working directory, simply call `NeoRootSwitchMode` twice.
### TODO list
- [x] Add installation guide in README.md
- [x] packer.nvim
- [x] Customizable
- [x] keymappings
- [ ] ignore list