编译源码更新VIM First, install all the prerequisite libraries, including Mercurial. For a Debian-like Linux distribution like Ubuntu, that would be the following:
sudo apt-get install libncurses5-dev libgnome2-dev libgnomeui-dev libgtk2.0-dev libatk1.0-dev libbonoboui2-dev \ libcairo2-dev libx11-dev libxpm-dev libxt-dev python-dev ruby-dev mercurial Remove vim if you have it already,
sudo apt-get remove vim vim-runtime gvim #这一步可以不做 On Ubuntu 12.04.2 you probably have to remove these packages as well, sudo apt-get remove vim-tiny vim-common vim-gui-common #同上一条命令,这一步可以不做 Once everything is installed, getting the source is easy. If you’re not using vim 7.3, make sure to set the VIMRUNTIMEDIR variable correctly below (for instance, with vim 7.4a, use /usr/share/vim/vim74a):
cd ~/temp hg clone https://code.google.com/p/vim/ cd vim ./configure –with-features=huge –enable-rubyinterp –enable-pythoninterp –with-python-config-dir=/usr/lib/python2.7-config \ –enable-perlinterp –enable-gui=gtk2 –enable-cscope –prefix=/usr make VIMRUNTIMEDIR=/usr/share/vim/vim74 sudo make install If you wish to support plugins that require Lua, you may also wish to add, –enable-luainterp Set vim as your default editor with update-alternatives,
sudo update-alternatives –install /usr/bin/editor editor /usr/bin/vim 1 sudo update-alternatives –set editor /usr/bin/vim sudo update-alternatives –install /usr/bin/vi vi /usr/bin/vim 1 sudo update-alternatives –set vi /usr/bin/vim Double check that you are in fact running the new Vim binary by looking at the output of vim –version.
"""""""""""""""""""""""""""""" " ycm setting """""""""""""""""""""""""""""" let g:ycm_global_ycm_extra_conf='~/.ycm_extra_conf.py' let g:ycm_collect_identifiers_from_tag_files = 1 let g:ycm_seed_identifiers_with_syntax = 1 let g:ycm_confirm_extra_conf=0 let g:ycm_key_invoke_completion = '<C-/>' nnoremap <F5> :YcmForceCompileAndDiagnostics<CR>
-e 参数 是 脚本遇到 错误 就退出 , 这个 很不好 , 可以 man sh 看下 -e 参数:
1 2 3
>man sh -e errexit If not interactive, exit immediately if any untested command fails. The exit status of a command is considered to be explicitly tested if the command is used to control an if, elif, while, or until; or if the command is the left hand operand of an “&&” or “||” operator.
6,DEMO:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
wxianfeng@ubuntu:~$ cat /etc/rc.local #!/bin/bash # # rc.local # # This script is executed at the end of each multiuser runlevel. # Make sure that the script will "exit 0" on success or any other # value on error. # # In order to enable or disable this script just change the execution # bits. # # By default this script does nothing.