參考:html
pc ----- https://ftp.nluug.nl/pub/vim/pc/gvim81.exe mac ----- https://github.com/macvim-dev/macvim/releases $ brew install vim --with-cscope --with-lua --override-system-vim 安裝spf13-vim見下面linux部分。 若是安裝macvim,將上面的vim替換爲macvim,而後執行 brew linkapps macvim linux ----- https://github.com/vim/vim $ sudo apt-get remove --purge vim $ sudo apt-get autoclean $ sudo apt-get install python-dev python3-dev ruby-dev luajit liblua5.1-dev libluajit-5.1 libperl-dev libncurses5-dev $ sudo rm -rf /usr/local/share/vim $ sudo rm /usr/bin/vim $ sudo mkdir -p /usr/include/lua5.1/include $ sudo cp /usr/include/lua5.1/*.h /usr/include/lua5.1/include/ $ cd ~ $ git clone --depth 1 https://github.com/vim/vim.git $ cd ~/vim/src $ make distclean $ ./configure --with-features=huge \ --enable-largefile \ --enable-multibyte \ --enable-perlinterp \ --enable-rubyinterp \ --enable-luainterp \ --enable-python3interp \ --with-python3-config-dir=/usr/lib/python3.5/config-3.5m-x86_64-linux-gnu \ --with-luajit \ --enable-fail-if-missing \ --with-lua-prefix=/usr/include/lua5.1 \ --enable-cscope \ --enable-gui=auto 注意:python3 和 python 同時給定,優先會使用python --enable-pythoninterp \ --with-python-config-dir=/usr/lib/python2.7/config \ $ make -j8 $ sudo make install $ whereis vim vim: /usr/local/bin/vim /usr/share/man/man1/vim.1 $ vim --version 安裝spf13-vim ----vim-plugs版本---- https://github.com/junegunn/vim-plug/wiki cd ~ pip3 install neovim curl https://raw.githubusercontent.com/StarryLeo/starry-vim/master/bootstrap.sh -L > starry-vim.sh && sh starry-vim.sh 或者 sh <(curl https://raw.githubusercontent.com/StarryLeo/starry-vim/master/bootstrap.sh -L) 添加go-vim插件 echo "Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }" >> ~/.vimrc.plugs.local vim +PlugClean! +PlugInstall +q 查看狀態,清理錯誤的插件後再從新安裝 :PlugStatus :PlugClean :PlugInstall 刪除一個插件 echo UnPlug 'scrooloose/syntastic' >> ~/.vimrc.plugs.local 更新: cd ~/.starry-vim/ git pull vim +PluginClean! +PlugInstall +q ----原始Vundle版本---- $ sudo apt-get install exuberant-ctags $ curl http://j.mp/spf13-vim3 -L -o - | sh 或者 $ curl https://raw.githubusercontent.com/spf13/spf13-vim/3.0/bootstrap.sh -L -o - | sh 會出現amirh/HTML-AutoCloseTag錯誤(提示是登錄github),按Ctrl+w,jj跳過這個錯誤 所有安裝後 $ vim ~/.vimrc.bundles 找到amirh,替換爲okayliao,保存退出後用下面命令從新安裝一遍插件。 $ vim +BundleInstall! +BundleClean +q 快捷鍵: 開啓行號(簡寫nu) :set number 開啓相對行號(簡寫rnu) :set relativenumber 向上移動相對8行:g.8k 向下移動相對8行:g.8j 向下刪除到相對4行:d4j 重複上個命令:. 瀏覽舊文件(簡寫bro old) :browse oldfile 最近編輯過的文件('0~'9) '0 切換TAB [num]gt 切換緩衝(簡寫b<num>) :buffer <num> 打開NERD_Tree目錄樹:C-e或者,e 查找文件打開:C-p 註釋:,cc 跳轉:,,fa ,,b Surround https://github.com/tpope/vim-surround/blob/master/doc/surround.txt Old text Command New text Comment "Hello *world!" ds" Hello world! 刪除雙引號 [123+4*56]/2 cs]) (123+456)/2 改變[]爲(),若是用左括號將使括號內插入空白間隙 "Look ma, I'm *HTML!" cs"<q> <q>Look ma, I'm HTML!</q> 改變雙引號爲html標記,改變回來可用cst" if *x>3 { ysW( if ( x>3 ) { iw是一個文本對象,t是tag,W是空白 my $str = *whee!; vllllS' my $str = 'whee!'; S是選中範圍 支持repeat.vim的命令(.重複命令):ds(刪除)、cs(改變)和yss(整行) 開啓行號、關閉拼寫檢查、自動摺疊、行號顯示、調整字體大小 vim ~/.vimrc.local 內容開始 set number relativenumber set nospell set nofoldenable let g:DisableAutoPHPFolding = 1 if has('gui_running') set guioptions-=T " Remove the toolbar set lines=40 " 40 lines of text instead of 24 if !exists("g:starry_no_big_font") if LINUX() && has("gui_running") set guifont=Consolas-with-Yahei:h12 elseif OSX() && has("gui_running") set guifont=Andale\ Mono\ Regular:h14,Menlo\ Regular:h13,Consolas\ Regular:h14,Courier\ New\ Regular:h16 elseif WINDOWS() && has("gui_running") set guifont=Consolas-with-Yahei:h10.5 endif endif else if &term == 'xterm' || &term == 'screen' set t_Co=256 " Enable 256 colors to stop the CSApprox warning and make xterm vim shine endif "set term=builtin_ansi " Make arrow and other keys work endif 內容結束 備份: TARGET=$HOME/Desktop/vimrc.tar.xz cd ~ && rm -rf $TARGET && tar cvJfp ~/Desktop/vimrc.tar.xz .starry-vim/ .vim/ .vimrc.local .vimrc.plugs.local starry-vim.sh unset TARGET 在桌面生成vimrc.tar.xz文件 恢復: TARGET=$HOME mkdir -p $TARGET tar xvJf ~/Desktop/vimrc.tar.xz -C $TARGET ln -s $TARGET/.starry-vim/.vimrc $TARGET/.vimrc ln -s $TARGET/.starry-vim/.vimrc.before $TARGET/.vimrc.before ln -s $TARGET/.starry-vim/.vimrc.plugs $TARGET/.vimrc.plugs sudo chmod 755 $TARGET/.vimrc{,.before,.plugs} unset TARGET
圖片:python
打印和高清版本,請訪問:http://michael.peopleofhonoronly.com/vim/linux