Mac vim“裝逼”配置


 

配置c++ 等編程語言補全等

from blog http://www.cnblogs.com/xiaobo-Linux/p/8909402.html

1. 安裝 macvim

brew install macvim

將vim替換為mvim

alias vim='mvim -v'

 

2.安裝Vundle

git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim

輸入 vim

shift + : 

輸入

:PluginInstall

自動安裝 YouCompleteMe

3.安裝cmake

brew install CMake

4.配置YouCompleteMe

cd ~/.vim/bundle/YouCompleteMe
安裝所有編程語言支持
./install.py  --all

5. vim .vimrc

" Set vundle settings here
" git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
set nocompatible              " be iMproved, required
filetype off                  " required

" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')

" let Vundle manage Vundle, required
"Plugin 'VundleVim/Vundle.vim'        "https://github.com/VundleVim/Vundle.vim
Bundle 'Valloric/YouCompleteMe'
Plugin 'gmarik/Vundle.vim'
" Custom plugins
Plugin 'scrooloose/nerdtree'         "https://github.com/scrooloose/nerdtree
Plugin 'MattesGroeger/vim-bookmarks' "https://github.com/MattesGroeger/vim-bookmarks
Plugin 'maciakl/vim-neatstatus'      "https://github.com/maciakl/vim-neatstatus

" All of your Plugins must be added before the following line
call vundle#end()            " required
filetype plugin indent on    " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList       - lists configured plugins
" :PluginInstall    - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean      - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line


" Vim5 and later versions support syntax highlighting. Uncommenting the
" following enables syntax highlighting by default.
if has("syntax")
    syntax on   " 語法高亮
endif
" Uncomment the following to have Vim jump to the last position when
" reopening a file
if has("autocmd")
    au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
"have Vim load indentation rules and plugins according to the detected
"filetype on
"filetype plugin indent on
endif

set number
set autoindent
set softtabstop=4    " 設置軟制表符的寬度
set shiftwidth=4     " (自動) 縮進使用的4個空格
set tabstop=4        " 設置制表符(tab鍵)的寬度
set expandtab        " 行首tab轉換為4個空格
set cindent          " 使用 C/C++ 語言的自動縮進方式
set cinoptions={0,1s,t0,n-2,p2s,(03s,=.5s,>1s,=1s,:1s     "設置C/C++語言的具體縮進方式
set showmatch        " 設置匹配模式,顯示匹配的括號
set linebreak        " 整詞換行
set whichwrap=b,s,<,>,[,] " 光標從行首和行末時可以跳到另一行去
set ruler            " 標尺,用於顯示光標位置的行號和列號,逗號分隔。每個窗口都有自己的標尺。如果窗口有狀態行,標尺在那里顯示。否則,它顯示在屏幕的最后一行上
set showcmd          " 命令行顯示輸入的命令
set showmode         " 命令行顯示vim當前模式
set incsearch        " 輸入字符串就顯示匹配點
set enc=utf-8        " 文件編碼
set cursorline
highlight CursorLine   cterm=NONE ctermbg=blue ctermfg=white guibg=NONE guifg=NONE
" highlight CursorColumn cterm=NONE ctermbg=green ctermfg=NONE guibg=NONE guifg=NONE

" NERDTree settings
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif

" vim-bookmarks settings
let g:bookmark_auto_close = 1
let g:bookmark_save_per_working_dir = 1
let g:bookmark_highlight_lines = 1
let g:bookmark_center = 1
let g:bookmark_location_list = 1

" key mapping
:inoremap { {}<ESC>i
:map <f2> :NERDTreeToggle<CR>

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM