ATTENTION: DON'T USE THIS SETUP IN LAND ACCOUNT!
Add the neovim executable to the PATH environment:
export PATH="/u/land/software/neovim/latest/bin:$PATH"This command needs to be executed every time when you log in to the GSI server.
If you want it to be executed automatically, please add it to your .bashrc (in case you use bash) with:
echo "export PATH=\"/u/land/software/neovim/latest/bin:$PATH\"" >> $HOME/.bashrcIf you want to know whether you have done it correctly, please use:
nvimYou should see the neovim is launched with the command.
Pull this repository inside the folder ~/.config/ as nvim. Or it can be done with:
git clone https://github.com/YanzhaoW/nvimconfig.git $HOME/.config/nvimTo fully utilize clangd, you need to link a file called compile_commands.json to the root folder of R3BRoot with:
cd ${R3BRoot}
ln -s ${Build_Dir}/compile_commands.json ./compile_commands.jsonHere ${R3BRoot} is the root directory path of R3BRoot and ${Build_Dir} is the build directory path of R3BRoot.
Open any C++ files with:
nvim filename.cxxNeovim starts to download multiple plugins and language servers. Once they are finished, restart the neovim and it's ready to go.
Normal mode:
| Mappings | Action |
|---|---|
<Space>ff |
search file with name |
<Space>fg |
grep in whole project |
<Space>fb |
show all buffers |
<Space>oo |
switch between C++ source and header file |
<Ctrl-x> |
toggle file and folder tree on the right |
<Space>e |
show error/warning message |
]d |
go to next error/warning |
[d |
go to previous error/warning |
<Space>xx |
toggle error/warning messages window |
ga |
auto fix the code |
K or <Shift-k> |
show hover information |
<Space>rn |
rename variable/class/function |
gD |
go to declaration |
gd |
go to definition |
<Space>f |
format the whole file |
<Space>tc |
toggle autocompletion |
<Space>ti |
toggle inlay hints |
<Space>bb |
go to last buffer |
<Space>[num] |
go to [num]th buffer |
gcc |
comment the current line |
<Ctrl-l> |
move the window focus right |
<Ctrl-h> |
move the window focus left |
<Ctrl-j> |
move the window focus down |
<Ctrl-k> |
move the window focus up |
Some other keybindings can also be found in keybindings.lua.
For the complete information about the keybindings, please visit the github website of different plugins:
| Commands | Action |
|---|---|
:bp |
go to previous buffer |
:bd |
delete current buffer |
:qa |
quit all windows |
:wa |
write all windows |
:wqa |
write and quite all windows |
:sp |
create a new window below |
:vs |
create a new window on the right |
:%s/foo/boo/gc |
replace 'foo' with 'boo' in this buffer |
If you encounter problems during the usage, please try following steps:
-
Restart neovim
-
Pull the latest configuration
cd $HOME/.config/nvim && git pull origin master
-
Delete the cache files
rm -rf $HOME/.local/share/nvim rm -rf $HOME/.local/state/nvim
and run neovim again.
If you encounter problems when updating the neovim configs, please go to ~/.config folder and do:
rm -rf nvim
git clone https://github.com/YanzhaoW/nvimconfig.git $HOME/.config/nvimIf you still have problems, please create an issue in this github page.