超强配置的vim

用vim打造理想的IDE

简介

前言

对于一个开发者而言,使用vim可以说是又爱又恨,一个追求高效的开发者决不能容忍一个开发工具不能自动补全,没有目录导航和函数导航,参考 vim实用技巧实用技巧后,我将常用的插件集成到vim,并做好配置,vimplus就运运而生了,如果喜欢的朋友请不要吝啬,给个star,废话不多说,直接上安装步骤:

下面是我配置的vim.
这里写图片描述

安装

Ubuntu x64 Installation(Supported Ubuntu 16.04 LTS)

git clone https://git.oschina.net/phper95/vimplus.git
cd ./vimplus
sudo ./install.sh

现在vimplus支持ubuntu14.04之后的所有ubuntu 64位系列以及centos7 64位,运行install.sh脚本,你就可以一边喝咖啡,一遍看着屏幕刷刷刷的打印就安装部署好了开发环境了,整个过程大约持续40分钟,其中下载编译ycm耗费了大半时间,我有下载好了的YouCompleteMe.tar.gz,省得在github上去下载,很慢的,你懂的,若想要手动安装ycm,需要修改vimplus目录下的.vimrc文件。
Plugin ‘Valloric/MatchTagAlways’

Plugin ‘Valloric/YouCompleteMe’

Plugin ‘docunext/closetag.vim’
将ycm插件那行注释掉,不然还会再去下载ycm,ycm可以最后等vimplus执行完成后再安装~~,接下来需要手动编译ycm。

cd ~
mv ~/vimplus/YouCompleteMe ~/.vim/bundle/
cd ~/.vim/bundle/YouCompleteMe
./install.py --clang-completer

编译安装完成之后取消~/.vimrc中的#Plugin ‘Valloric/YouCompleteMe’行的注释
vimplus将自动安装一些软件,比如说
- vim
- g++
- ctags
- cmake
- python2
- python3

and some plugins below:

Centos x64 的安装

git clone https://git.oschina.net/phper95/vimplus.git
cd ./vimplus
sudo ./install.sh

运行 install.sh 脚本后会自动安装和配置 vim, 安装号是大约 40 minutes, 主要是由于下载和便宜 Valloric/YouCompleteMe 需要很长时间, 请耐心等待,安装完成之后将会安装如下软件:
- vim
- g++
- ctags
- cmake
- python2
- python3

和一些插件:

配置 YouCompleteMe

到这一步,安装已经完成,你会发现~目录有两个文件,一个是vim的配置文件.vimrc,一个是YouCompleteMe的配置文件.ycm_extra_conf.py,一般来说建立一个main.cpp来写C、C++程序来说是没有问题的,都会有语法补全,当你需要写一些项目并涉及到第三方库时,就需要更改.ycm_extra_conf.py了,具体步骤如下。
将.ycm_extra_conf.py拷贝的项目的根目录。

更改.ycm_extra_conf.py里面的flags变量,添加三方库路径和工程子目录路径。

桌面版linux使用vim-devicons插件会出现乱码,需要设置终端字体为Droid Sans Mono for Powerline Nerd Font Complete,使用xshell等工具连接服务器linux的用户就没有必要使用vim-devicons了,可以在插件目录将vim-devicons目录删除,不然会导致NerdTree的缩进有问题。

快捷键


  • Directory tree <F3>
  • Display functions, global variables, macro definitions <F4>
  • Display static code analysis <F5>
  • .h .cpp file quickly switch <F2>
  • Go to declaration <, + u>
  • Go to definition <, + i>
  • Open the include file <, + o>
  • Buffer switch <Ctrl + P/Ctrl + N>
  • Cursor position switch <Ctrl + O/Ctrl + I>
  • Fuzzy Find File <Ctrl + f>
  • Surround <ys{motion or text-object}{char}/cs{orig_char}{dest_char}/ds{char}>
  • Comment code <gcc/gcap/gc/,ca/,cA>
  • DirDiff :DirDiff <dir1> <dir2>
  • Repeat .
  • Change the colorscheme <F10/F9>

特性展示

语法补全

YouCompleteMe传说中最全最好用的补全插件
此处输入图片的描述

Full path fuzzy file, buffer, mru, tag

ctrlp ctrlp提供文件搜索,支持模糊查询。
此处输入图片的描述

vim-airline

提供漂亮的状态栏支持
此处输入图片的描述

vim-surround

Surround a vim text object with a pair of symmetrical chars. We can also remove or change the ones already there.
此处输入图片的描述

vim-commentary

An extremely easy tool to toggle commentary in lines and visual selections. We only need to enter a mapping and a movement to do the action, as simple as that.
此处输入图片的描述

auto-pairs

auto-pairs provides smart auto-completion for delimiters like (), {}, [], “”, ”, “.
此处输入图片的描述

incsearch.vim

此处输入图片的描述

vim-devicons

此处输入图片的描述
此处输入图片的描述
此处输入图片的描述

vim-coloresque

此处输入图片的描述

vim-dirdiff

此处输入图片的描述

vim-startify

此处输入图片的描述

Change the colorscheme

这里写图片描述
兴趣是最好的老师,我的github地址:https://git.oschina.net/phper95/

Warning


  1. If poor network conditions may fail to install, basically Valloric/YouCompleteMe installation fails, after a failed installation will need to rm -rf ~/.vim/bundle/YouCompleteMe, and then re-execute the install.sh can be re-installed, the program will automatically install the plug-in installation fails,or I have YouCompleteMe.tar.gz,download it and then tar -xvf YouCompleteMe.tar.gz -C ~/.vim/bundle/,then cd ~/.vim/bundle/YouCompleteMe and run python ./install.py --clang-completer.
    1.如果网络条件不好可能安装失败,基本上是Valloric/YouCompleteMe安装失败,安装失败后需要将~/.vim/bundle文件夹下的YouCompleteMe目录删除,然后重新执行setup.sh即可,重新安装时,程序将自动安装安装失败的插件。
    2.在ubuntu16.04LTS下安装可能会失败(Valloric/YouCompleteMe安装失败),因为vim默认支持python3进行插件编译,安装失败后,手动进入~/.vim/bundle/YouCompleteMe,然后运行python3 ./install.py –clang-completer即可。
各个插件配置设置单独配置: ls bundle/.configs/ : asyncrun.vim_conf.vim EasyMotion_conf.vim lookupfile_conf.vim supertab_conf.vim vim-markdown-toc_conf.vim bufexplorer_conf.vim eclim_conf.vim maximizer_conf.vim syntastic_conf.vim vim-powerline_conf.vim CCTree_conf.vim errormarker.vim_conf.vim neocomplcache_conf.vim tagbar_conf.vim vimshell.vim_conf.vim CompleteParameter.vim_conf.vim fuzzyfinder_conf.vim neocomplete.vim_conf.vim ultisnips_conf.vim vim-snippets_conf.vim deoplete-jedi_conf.vim grep.vim_conf.vim neosnippet_conf.vim unite.vim_conf.vim ydtrans_conf.vim deoplete.nvim_conf.vim init.vim nerdcommenter_conf.vim vcscommand_conf.vim YouCompleteMe_conf.vim DoxygenToolkit.vim_conf.vim jedi-vim_conf.vim nerdtree_conf.vim VimIM_conf.vim DrawIt_conf.vim jupyter-vim_conf.vim Nvim-R_conf.vim vim-instant-markdown_conf.vimvimrc文件进行基础配置: let mapleader="," let g:mapleader="," autocmd! :mapclear "==========很多插件,可能进行过修改, 若感觉不爽,可以在.vim搜索lidong, 进行还原=================== +-- 11 lines: 插件依赖设置 ---------------------------------------------------------------------------------- source ~/.vim/bundle/.configs/init.vim +--104 lines: F1~F12快捷键映射------------------------------------------------------------------------------- +-- 22 lines: 非F1~F12快捷键--------------------------------------------------------------------------------- +-- 5 lines: 自己定义的命令 -------------------------------------------------------------------------------- +-- 17 lines: 窗口配置--------------------------------------------------------------------------------------- +--229 lines: 简单配置--------------------------------------------------------------------------------------- +-- 55 lines: Gui选项 放到.gvimrc---------------------------------------------------------------------------- +-- 5 lines: 高亮 注释代码的颜色---------------------------------------------------------------------------- +-- 6 lines: 高亮 menu color ------------------------------------------------------------------------------- +-- 7 lines: 高亮 当前行(列)-------------------------------------------------------------------------------- +-- 3 lines: 高亮列----------------------------------------------------------------------------------------- +-- 13 lines: 高亮tab标签------------------------------------------------------------------------------------ +-- 8 lines: 高亮 其他-------------------------------------------------------------------------------------- +-- 10 lines: 字符编码(多字节)------------------------------------------------------------------------------- +-- 12 lines: 设置C/C++语言的具体缩进方式 eg. switch case 缩进----------------------------------------------- +-- 42 lines: vim折叠功能------------------------------------------------------------------------------------ +-- 19 lines: 文件比较--------------------------------------------------------------------------------------- +-- 26 lines: 单词列表匹配-----------------------------------------------------------------------------------
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

少林码僧

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值