-
Notifications
You must be signed in to change notification settings - Fork 166
Vim Config
Song Zheng edited this page Mar 29, 2025
·
39 revisions
Vim config
- For OSX users:
- Make sure you are using iterm2. This terminal supports true colors, which renders the UI more clearly and is better for your eyes. The default mac terminal does not support true colors.
- Make sure you are using vim version >
8.2. You should see vim version when you open vim. If not, you need to upgrade:sudo add-apt-repository ppa:jonathonf/vimsudo apt updatesudo apt install vim
- Make sure you have the following programs installed:
-
ripgrep - used for fast searching
- Method 1:
sudo apt-get install ripgrep- This installsrgfor all users (YAY!)- Run
lsb_release -ato see what ubuntu version you are on.
- Run
- Method 2: Should install rust first to get the lastest version of ripgrep via
cargo install ripgrep- Also needs
sudo apt install build-essentialto avoidlinker ccerrors during installation. - This only installs
rgin your userspace, so no other users will have this command.
- Also needs
- Method 1:
-
ripgrep - used for fast searching
- Install NodeJS.
- Using NVM: Install nvm then run
nvm i 18(replace 18 with major version) - Ubuntu Direct NodeJS Installation
- Using NVM: Install nvm then run
- Install bat for fzf preview with syntax highlighting.
cargo install --locked bat
- Install vim plug
- Open
~/.vimrcfile, or (~/.config/nvim/init.vim). Set paste mode:set paste - Copy / paste our vimrc config into your
~/.vimrcor (~/.config/nvim/init.vim) file. - Save
:w - Reload your new configs by running
:source ~/.vimrc(alternatively, close and reopen vim). Or paste into~/.config/nvim/init.vim - Run
:PlugInstall - Run
:CocInstall coc-tsserver coc-json coc-html coc-css - Run
:CocInstall coc-eslint coc-prettier - Copy the config below to
~/.vim/coc-settings.json - Close vim and reopen!
- Add
export FZF_DEFAULT_COMMAND="rg --files --hidden"to~/.bashrcor~/.zshrcdepending on which shell you are using (echo $0will tell you).
You want to configurefzfto use ripgrep so it automatically follows your.gitignorefiles.
-
leaderkey is set to,and only usable in normal mode. - Jumping between windows - No need a
CTRL-wprefix. JustCTRL-hto go to left window,jklfor the other directions. - There are no
swpfiles. Make sure youcommityour code frequently (as you should be doing)
- Emmet Plugin
- Type
h1. To autocomplete the tag, typectrl-Y,(control y and then ,).
- Type
-
ctrl-pto open up file search to navigate between files quickly-
ctrl-vto vertical split the search result
-
-
:Gwriteto commit the current file. -
,1to refresh your vimrc and install plugin. No need to open and close!
~/.vim/coc-settings.json or ~/.config/nvim/coc-settings.json
{
"coc.preferences.formatOnSaveFiletypes": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact"
],
"tsserver.formatOnType": true,
"coc.preferences.formatOnType": true,
"javascript.validate.enable": false
}
- Watch this video about fzf in it's entirety!
-
System Setup - Includes
git,bashetc. - VIM Config
- Computer Setup - List of applications that are useful to install