Wednesday, September 28, 2016

『note』目前的vim

『note』目前的vim

本文僅僅紀錄我用了什麼vim plugin。

首先.vimrc


  • 基本設定

set shiftwidth=4
set expandtab
set softtabstop=4
set laststatus=2
set noshowmode
set number
set modeline
set t_Co=256
set tabstop=2
set fileencodings=utf-8,big5
set cursorline                                                                                                                                    
set mouse=a
syntax on


  • 編譯快捷鍵

autocmd filetype python nnoremap  :w  exec '!python '.shellescape('%')
autocmd filetype c nnoremap  :w  exec '!clear&&gcc '.shellescape('%').' -o '.shellescape('%:r').'&&./'.shellescape('%:r') 
autocmd filetype cpp nnoremap  :w  exec '!clear;echo -n "====================";TEMP=`mktemp`;script $TEMP -e -q -c "g++ '.shellescape('%').' -std=c++11 -Wall -o '.shellescape('%:r').'" > /dev/null 2>&1 ;if [ $? == 0 ] ;then echo -e "\r\033[32m********************\033[0m";./'.shellescape('%:r').';else echo -e "\r\033[31mXXXXXXXXXXXXXXXXX\033[0m";cat $TEMP; fi'                                                                
autocmd filetype c nnoremap  :w  exec '!clear&&gcc '.shellescape('%').' -o '.shellescape('%:r') 
autocmd filetype cpp nnoremap  :w  exec '!clear&&g++ '.shellescape('%').' -std=c++11 -Wall -o '.shellescape('%:r')
nnoremap  :w  exec '!cat '.shellescape('%').'\| xclip -selection clipboard'
nnoremap  :w  exec '!fish'

  • 主題:tomorrow

Bundle
Bundle 'chriskempson/tomorrow-theme', {'rtp': 'vim/'}
設定
color Tomorrow-Night-Bright
colorscheme Tomorrow-Night-Bright

  • neocomplcache

補完插件
Bundle
Bundle 'Shougo/neocomplcache.vim'  
設定
"neocomplcache                                                                                                                                    
let g:neocomplcache_enable_at_startup = 1
let g:neocomplcache_disableautocomplete = 1
let g:neocomplcache_enable_smart_case = 1
" Recommended key-mappings.
" <CR>: close popup and save indent.
let g:neocomplcache_enable_insert_char_pre = 1
  • nerdtree
檔案樹插件
Bundle
Bundle 'scrooloose/nerdtree'
設定
let NERDTreeWinPos='left'
let NERDTreeWinSize=30
map <F2> :NERDTreeToggle<CR>

  • vim-gitgutter

vim git狀態(插入與刪除等)
Bundle


Bundle 'airblade/vim-gitgutter'


  • xterm-color-table.vim

xterm的顏色表
Bundle

Bundle 'guns/xterm-color-table.vim'


  • vim-cuteErrorMarker

語法錯誤標記
Bundle

Bundle 'Twinside/vim-cuteErrorMarker'

  • vim-better-whitespace

行尾空白顯示
Bundle
Bundle 'ntpeters/vim-better-whitespace'
設定
hi ExtraWhitespace ctermbg = 17


  • indentLine

縮排圖示
Bundle
Bundle 'Yggdroot/indentLine'


  • vim-l9

vim script library
Bundle
Bundle 'eparreno/vim-l9'

  • vim-json

vim json syntax highlight
Bundle
Bundle 'elzr/vim-json'

  • syntastic

自動語法檢查
Bundle
Plugin 'scrooloose/syntastic'
設定
set statusline+=%#warningmsg#

set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*

let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 0
let g:syntastic_check_on_wq = 1
let g:syntastic_cpp_compiler = 'g++'
let g:syntastic_cpp_compiler_options = ' -std=c++11 '
let g:syntastic_c_compiler = 'gcc'
let g:syntastic_c_compiler_options = ' -ansi'
let g:syntastic_javascript_checkers = ['standard']
let g:syntastic_javascript_standard_generic = 1
let g:syntastic_javascript_checkers = ['eslint']
let g:syntastic_javascript_eslint_exec = 'eslint'

  • YouCompleteMe

補完工具
Bundle
Bundle 'valloric/YouCompleteMe'
設定
let g:ycm_global_ycm_extra_conf = $HOME/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py'



  • tagbar

C/C++ taglist
Bundle

Bundle 'majutsushi/tagbar'

設定


nmap  :TagbarToggle           
let g:tagbar_ctags_bin='ctags'         
let g:tagbar_width=30                
map  :Tagbar
autocmd BufReadPost *.cpp,*.c,*.h,*.hpp,*.cc,*.cxx call tagbar#autoopen()

No comments:

Post a Comment

精選文章

使用Ardunio Atmega2560 連接 nRF24L01+

使用Ardunio Atmega2560 連接 nRF24L01+ 關於library 目前主流有 https://github.com/maniacbug/RF24 與 https://github.com/TMRh20/RF24 這兩個。 其中TMRh20大大做...