vim配置文件
"basic setting:chap1=
set nocompatible
set nu
set background=dark
syntax on
set tabstop=4
set shiftwidth=4
set autoindent
filetype on
filetype plugin on
filetype indent on
"set cursorline
set backspace=2
"禁止生成临时文件
set nobackup
set noswapfile
set autoread
set autowrite
"搜索忽略大小写
set ignorecase
"搜索逐字符高亮
set hlsearch
set incsearch
"编码设置
set enc=utf-8
set fencs=utf-8,ucs-bom,shift-jis,gb18030,gbk,gb2312,cp936
"语言设置
set langmenu=zh_CN.UTF-8
set helplang=cn
"可以在buffer的任何地方使用鼠标(类似office中在公布工作区双击鼠标定位)
"set mouse=a
set selection=exclusive
set selectmode=mouse,key
"通过使用:commands命令,告诉我们文件的哪一行被改变过
set report=0
"在被分割的窗口间显示空白,便于阅读
set fillchars=vert:\ ,stl:\ ,stlnc:\
colorscheme desert
"==chapter2 key mapping=
inoremap jj <Esc>
inoremap [ []<Esc>i
inoremap ] []<Esc>i
inoremap ( ()<Esc>i
inoremap ) ()<Esc>i
inoremap { {<CR>}<Esc>O
inoremap } {<CR>}<Esc>O
inoremap < <><Esc>i
inoremap " ""<Esc>i
inoremap ' ''<Esc>i
"==============================chapter3 plugin manager =============================
- vim-plug: https://github.com/junegunn/vim-plug
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
- vim-airline: https://github.com/vim-airline/vim-airline
- powerline: https://github.com/eugeneching/consolas-powerline-vim
- windows 配置Putty字体
- git clone https://github.com/eugeneching/consolas-powerline-vim.git
- 在.vimrc添加配置
"powerline{
set guifont=PowerlineSymbols\ for\ Powerline
set nocompatible
set t_Co=256
let g:Powerline_symbols = 'fancy'
set encoding=utf8
"}
- 目录里把consolas-powerline-vim下的.ttf文件拷贝到windows系统的C:\Windows\Fonts
- putty设置
Window --> Appearance --> Font settings --> Change... --> Consolas for Powerline
Window --> Translation --> Character set translation --> Remote character set -->UTF-8
- NERDTree: https://github.com/preservim/nerdtree
- ctrlp: https://github.com/ctrlpvim/ctrlp.vim
- tagbar: https://github.com/preservim/tagbar
- 安装CTAGS
sudo apt install ctags - Vim 8 中 C/C++ 符号索引:GTags 篇 https://zhuanlan.zhihu.com/p/36279445
- 安装Global https://ftp.gnu.org/pub/gnu/global/
安装依赖库
sudo apt build-dep global
sudo apt install libncurses5-dev libncursesw5-dev - Global Manual: https://www.gnu.org/software/global/manual/global.html
- 安装pip3:
sudo apt install python3-pip - Tags管理工具 vim-gutentags: https://github.com/ludovicchabant/vim-gutentags
- 安装pygments:
pip3 install pygments - gutentags_plus: https://github.com/skywind3000/gutentags_plus
- 将gtags-cscope.vim复制到插件管理目录
cp /usr/local/share/gtags/gtags-cscope.vim $HOME/.vim/plugin/
.vimrc中添加配置:
set cscopetag " 使用 cscope 作为 tags 命令
set cscopeprg='gtags-cscope' " 使用 gtags-cscope 代替 cscope
- 代码补全: https://github.com/ycm-core/YouCompleteMe
安装依赖:sudo apt install python3-dev

浙公网安备 33010602011771号