-
Notifications
You must be signed in to change notification settings - Fork 163
Vim Config
Song Zheng edited this page Oct 7, 2022
·
37 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/vim
sudo apt update
sudo apt install vim
- Make sure you have the following programs installed:
-
ripgrep - used for fast searching
- Method 1:
sudo apt-get install ripgrep
- This installsrg
for all users (YAY!)- Run
lsb_release -a
to 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-essential
to avoidlinker cc
errors during installation. - This only installs
rg
in 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
~/.vimrc
file. Set paste mode:set paste
- Copy / paste our vimrc config into your
~/.vimrc
file. - Save
:w
- Reload your new configs by running
:source ~/.vimrc
(alternatively, close and reopen 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~/.bashrc
or~/.zshrc
depending on which shell you are using (echo $0
will tell you).
You want to configurefzf
to use ripgrep so it automatically follows your.gitignore
files.
-
leader
key is set to,
and only usable in normal mode. - Jumping between windows - No need a
CTRL-w
prefix. JustCTRL-h
to go to left window,jkl
for the other directions. - There are no
swp
files. Make sure youcommit
your code frequently (as you should be doing)
- Emmet Plugin
- Type
h1
. To autocomplete the tag, typectrl-Y,
(control y and then ,).
- Type
-
ctrl-p
to open up file search to navigate between files quickly-
ctrl-v
to vertical split the search result
-
-
:Gwrite
to commit the current file. -
,1
to refresh your vimrc and install plugin. No need to open and close!
~/.vim/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
,bash
etc. - VIM Config
- Computer Setup - List of applications that are useful to install