My nvim configs.
Major credits to https://github.com/ajnassar/nvim
After the first step, the following steps are not in any proven or fully correct order; some steps mayyyy be missing.
git clone
this repo into your should be into your~/.config
, so that you have a~/.config/nvim/init.vim
- figure out what python path and what pip path to use
- on el8 instance, use
let g:python3_host_prog = "/usr/bin/python"
- on mac, if
python3
installed, uselet g:python3_host_prog = "python3"
- use
pip3
which is linked to the python instance, to install the relevant packages
- on el8 instance, use
- install vim-plug
- run
nvim
- run
:PlugInstall
- run
- install fzf
- mac:
brew install fzf
- To install useful key bindings and fuzzy completion:
$(brew --prefix)/opt/fzf/install
- ubuntu:
sudo apt install fzf
- mac:
- install ag
- mac:
brew install the_silver_searcher
- mac:
- install ctags
- mac:
brew install --HEAD universal-ctags/universal-ctags/universal-ctags
- ubuntu:
sudo apt install universal-ctags
- mac:
- install rg
- mac:
brew install ripgrep
- ubuntu:
sudo apt install ripgrep
- mac:
- Every time you modify your
init.vim
, you can run:so
with that file open to reload the configs. Or, just restartnvim
- Run
:checkhealth
to see if nvim is complaining about anything, and to see specific diagnosed problems or steps to solve them
- install flake8
pip install flake8
- install isort
pip install isort
- install pynvim
pip install pynvim
- Follow https://stackoverflow.com/a/46018502 to add the following iTerm mappings:
- add
CMD-s
::w!\n
(saves file) - add
CMD-/
:gcc
(comments out code)
- add
- Install Devicons font
- in OSX terminal: run
cd ~/Library/Fonts && curl -fLo "Droid Sans Mono for Powerline Nerd Font Complete.otf" https://github.com/ryanoasis/nerd-fonts/raw/master/patched-fonts/DroidSansMono/complete/Droid Sans Mono Nerd Font Complete.otf
- in iTerm preferences: go to Profiles -> Text -> Font -> check "Use a different font for non-ASCII text → DroidSansMono Nerd Font"
- in OSX terminal: run
- Make sure go >= 1.19 is installed on your machine
- Make sure
go
and go binaries (e.g.gopls
, after nivm installs it) can be accessed from your PATH.- You can add this to your
.bashrc
for el6:PATH=$PATH:/opt/golang1.19/bin PATH=$PATH:/home/vagrant/go/bin/
- Generally, e.g. for mac, add this to your
.bash_profile
:PATH=$PATH:~/go/bin/
- You can add this to your
- With
nvim
open, run:GoUpdateBinaries
. You may need to restartnvim
to see everything working. If everything was installed correctly, you should be able to see auto-completion and docstrings like these: - If you get this error: "Spawning language server with cmd:
gopls
failed. The language server is either not installed, missing from PATH, or not executable."- Revisit step 2: You'll need to make sure you can access
gopls
from your PATH
- Revisit step 2: You'll need to make sure you can access
- See vim-go cheatsheet
- Also read the vim-go section of the
init.vim
to see custom mappings
This is a list of commands you can use with these configs. Some of these come from base vim, but I threw them in here anyways.
NOTE: C
: ctrl, S
: shift
C-p
fzfC-t
new tabC-v
vertical split during fzfC-x
horizontal split during fzf
C-w-direction:
switch panesspace
-direction: also switch panesspace
1, 2, n to choose tabsC-S-Left
,C-S-Right
to switch tabs left and right:ag
to search for string in project- Using Rg, outdated:
(space-f
to search in project)
- Using Rg, outdated:
gcc
: commentC-r
: redoc-a-"
: change around ", etc.ysiW-"
: add"
around WC-6
go between previous and nextspace-=
,space-minus
: increase pane sizespace-w
: picks nvim window, but doesn't work currently*
highlight occurrences of word cursor is on/ go to next occurenceC-o
show most recently updated? opened? filestab
,S-tab
: indent + un-indent[h
—> previous git hunk]h
—> next git hunkC-n
: multi-selectC-S-Down
: multi-cursor select downC-S-Up
: multi-cursor select upspace-s:
git blame linespace-c:
in visual mode, copy text to OS clipboard- tags:
space-t
: generate tagsC-}
: jump to tag (this is OP... sometimes)
gg=G
: auto-indents the whole file. This works... sometimes