cd ~
git clone https://github.com/zhhp1001/.vim.git
curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
Use
NVM
to manage node version https://github.com/nvm-sh/nvm#installing-and-updating
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
source ~/.bashrc
nvm install node # "node" is an alias for the latest version
$ vim #open vim
$ :PlugInstall # install plugs
uncomment this line in vimrc
(and comment the light version line) for dark version
"set background=dark
sudo apt install clangd
in vim, run :CocInstall coc-clangd
coc-clangd
will try to find clangd
from your $PATH
, if not found, you can run :CocCommand clangd.install
to install the latest release from GitHub
sudo apt install bear
Use bear make
instead of make
The output file called compile_commands.json
is saved in the current directory.
coc-nvim
will use this file to navigate source code.
For cmake projects, add
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
inCMakeList.txt
generate the compile_commands.json file into the current directory. For non-cmake projects, Bear generates the JSON file during the build process.
sudo apt install ctags
-
jj
equivalent toESC
-
Tab for completion
-
Enter
to choose completion item -
gd
to jump to definition -
gr
for references -
gy
for type definition -
Ctrl + o
return to prev page -
K
for documentation -
\rn
for renaming -
Diagnostics:
[g
and]g
to go prev/next in diagnostics
-
Ctrl + n
open directory tree
:LeaderfFile
search files in current directory
:LeaderfBuffer
search current buffer
:LeaderfMru
search most recently used files
:LeaderfLine
search some word in current file
:LeaderfFunction
search function in current file
\cc
comment current line
\cu
uncomment
\ca
change comment style (// and /**/)
sudo apt install figlet
Add this line to vimrc
noremap tx :r !figlet
Press tx and enter your text tx Hello
_ _ _ _
| | | | ___| | | ___
| |_| |/ _ \ | |/ _ \
| _ | __/ | | (_) |
|_| |_|\___|_|_|\___/