把vim變成IDE
Vundle 是一個可以自動下載、安裝與管理 Vim plugins 的工具,讓 Vim 的使用者可以很方便的使用各種 plugins。 通常一個大型的 programming IDE,核心也是從文字編輯器開始,延伸其他的功能,合併成一個完整的 IDE。
vim --version
由於 Vundle 需要 git(用於下載 plugin)與 curl(用於搜尋 plugin)工具,所以在安裝 Vundle 之前要先安裝這兩個工具,若在 Ubuntu Linux 中可以使用 apt 安裝:
sudo apt-get install git curl
mkdir -p ~/.vim/autoload ~/.vim/bundle
curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim
安裝 Vundle:
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle
基本 ~/.vimrc
"自動縮排
set autoindent
"語法高亮
syntax on
"自動檢測文件類型並加載相關設置
filetype plugin indent on
"不自動換行
set nowrap
"智能對齊方式
set smartindent
"一個tab是4個byte
set tabstop=4
"按一次tab前進4個byte
set softtabstop=4
"顯示行號
set number
"預設不產生備份文件
set nobackup
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'nvie/vim-flake8'
Plugin 'valloric/youcompleteme'
call vundle#end() " required
sudo apt install cmake
cd ~/.vim/bundle/youcompleteme
./install.py --clang-completer
最後,打開vim:
vim
並鍵入以下內容以安裝插件。
:PluginInstall
.vimrc 進一步
"自動縮排
set autoindent
"語法高亮
syntax on
"自動檢測文件類型並加載相關設置
filetype plugin indent on
"不自動換行
set nowrap
"智能對齊方式
set smartindent
"一個tab是4個byte
set tabstop=2
"按一次tab前進4個byte
set softtabstop=2
"顯示行號
set number
"預設不產生備份文件
set nobackup
set completeopt-=preview
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'nvie/vim-flake8'
" Python autocompletion, go to definition.
Plugin 'davidhalter/jedi-vim'
" Better autocompletion
Plugin 'Shougo/neocomplcache.vim'
" Automatically sort python imports
Plugin 'fisadev/vim-isort'
Plugin 't9md/vim-choosewin'
" Python and other languages code checker
Plugin 'scrooloose/syntastic'
" Paint css colors with the real color
Plugin 'lilydjwg/colorizer'
" Ack code search (requires ack installed in the system)
Plugin 'mileszs/ack.vim'
if has('python')
" YAPF formatter for Python
Plugin 'pignacio/vim-yapf-format'
endif
" XML/HTML tags navigation
Plugin 'vim-scripts/matchit.zip'
" Gvim colorscheme
Plugin 'vim-scripts/Wombat'
" Yank history navigation
Plugin 'vim-scripts/YankRing.vim'
"nodejs
Plugin 'myhere/vim-nodejs-complete'
call vundle#end() " required
" most of them not documented because I'm not sure how they work
" (docs aren't good, had to do a lot of trial and error to make
" it play nice)
let g:neocomplcache_enable_at_startup = 1
let g:neocomplcache_enable_ignore_case = 1
let g:neocomplcache_enable_smart_case = 1
let g:neocomplcache_enable_auto_select = 1
let g:neocomplcache_enable_fuzzy_completion = 1
let g:neocomplcache_enable_camel_case_completion = 1
let g:neocomplcache_enable_underbar_completion = 1
let g:neocomplcache_fuzzy_completion_start_length = 1
let g:neocomplcache_auto_completion_start_length = 1
let g:neocomplcache_manual_completion_start_length = 1
let g:neocomplcache_min_keyword_length = 1
let g:neocomplcache_min_syntax_length = 1
" complete with workds from any opened file
let g:neocomplcache_same_filetype_lists = {}
let g:neocomplcache_same_filetype_lists._ = '_'
一行指令完成
vim +PluginInstall +qall
Vundle
Or use Vundle:
:BundleInstall moll/vim-node
:BundleInstall 'nikvdp/ejs-syntax'
建立以下的.vimrc
syntax on
set nocompatible
set smartindent
set shiftwidth=4
set backspace=indent,eol,start
set ruler
set number
set showcmd
set incsearch
set hlsearch
set hls
set ic
set pastetoggle=<F12>
set enc=utf8
set mouse=a
filetype off
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/vundle
"-------------- PLUGINS STARTS -----------------
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'altercation/vim-colors-solarized'
Plugin 'scrooloose/nerdtree'
Plugin 'jistr/vim-nerdtree-tabs'
Plugin 'scrooloose/syntastic'
Plugin 'xolox/vim-misc'
Plugin 'xolox/vim-easytags'
Plugin 'majutsushi/tagbar'
Plugin 'ctrlpvim/ctrlp.vim'
Plugin 'vim-scripts/a.vim'
Plugin 'airblade/vim-gitgutter'
Plugin 'tpope/vim-fugitive'
Plugin 'Raimondi/delimitMate'
Plugin 'christoomey/vim-tmux-navigator'
Plugin 'jez/vim-c0'
Plugin 'jez/vim-ispc'
Plugin 'kchmck/vim-coffee-script'
Plugin 'flazz/vim-colorschemes'
call vundle#end()
"-------------- PLUGINS END --------------------
filetype plugin indent on
"----- GENERAL SETTINGS-------
set laststatus=2
let g:airline_powerline_fonts = 1
let g:airline_detect_paste=1
let g:airline#extensions#tabline#enabled = 1
let g:airline_theme='solarized'
set background=dark
let g:solarized_termcolors=256
colorscheme solarized
"---------NERD-TREE SETTINGS----------
nmap <silent> <leader>t :NERDTreeTabsToggle<CR>
let g:nerdtree_tabs_open_on_console_startup = 1
"-------- SYNTASTIC SETTINGS---------
let g:syntastic_error_symbol = '✘'
let g:syntastic_warning_symbol = "▲"
augroup mySyntastic
au!
au FileType tex let b:syntastic_mode = "passive"
augroup END
"-------- TAGS SETTINGS --------------------------------
let g:easytags_events = ['BufReadPost', 'BufWritePost']
let g:easytags_async = 1
let g:easytags_dynamic_files = 2
let g:easytags_resolve_links = 1
let g:easytags_suppress_ctags_warning = 1
let g:tagbar_autoclose=2
nmap <silent> <leader>b :TagbarToggle<CR>
"autocmd BufEnter * nested :call tagbar#autoopen(0)
"---------GIT SETTINGS--------------
hi clear SignColumn
let g:airline#extensions#hunks#non_zero_only = 1
"----------DELIMITEMATE SETTINGS-----------------
let delimitMate_expand_cr = 1
augroup mydelimitMate
au!
au FileType markdown let b:delimitMate_nesting_quotes = ["`"]
au FileType tex let b:delimitMate_quotes = ""
au FileType tex let b:delimitMate_matchpairs = "(:),[:],{:},`:'"
au FileType python let b:delimitMate_nesting_quotes = ['"', "'"]
augroup END
"-----------TMUX SETTINGS--------------
let g:tmux_navigator_save_on_switch = 2
sudo apt-get install exuberant-ctags
安裝 color solarized
cd ~/.vim/bundle
git clone git://github.com/altercation/vim-colors-solarized.git
vim +PluginInstall +qall
python
nodejs
Last updated