Skip to content

nc-BobLee/.vim

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 

Repository files navigation

zhhp's Vim configuration

cd ~
git clone https://github.com/zhhp1001/.vim.git

vim plugin

Dependency

Vim-plug

curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim

Nodejs

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

Install plug

$ vim		#open vim
$ :PlugInstall # install plugs

Theme

uncomment this line in vimrc (and comment the light version line) for dark version "set background=dark

clangd (for C/C++)

https://clangd.llvm.org/installation.html

sudo apt install clangd

coc-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

https://github.com/clangd/coc-clangd

bear make generate complie_commands.json

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) in CMakeList.txt generate the compile_commands.json file into the current directory. For non-cmake projects, Bear generates the JSON file during the build process.

https://github.com/rizsotto/Bear

Install ctags to support LeaderF

sudo apt install ctags

Plug-in Usage

Basic

  • jj equivalent to ESC

  • 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

Fuzzy Search

: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

Comment

\cc comment current line

\cu uncomment

\ca change comment style (// and /**/)

https://github.com/preservim/nerdcommenter

Big Word

sudo apt install figlet

Add this line to vimrc

noremap tx :r !figlet

Press tx and enter your text tx Hello

 _   _      _ _
| | | | ___| | | ___
| |_| |/ _ \ | |/ _ \
|  _  |  __/ | | (_) |
|_| |_|\___|_|_|\___/

Reference

https://zhuanlan.zhihu.com/p/145793963

About

zhhp's Vim configuration

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Vim Script 100.0%