Mac vim "pretend" configuration

 

Configure programming language completions such as c++, etc.

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

1. Install macvim

brew install macvim

replace vim with mvim

alias vim = ' mvim -v '

 

2. Install Vundle

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

enter vim

shift + : 

enter

:PluginInstall

Automatically install YouCompleteMe

3. Install cmake

brew install CMake

4. Configure YouCompleteMe

cd ~/.vim/bundle/YouCompleteMe
Install all programming language support
./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 the width of the soft tabs 
set shiftwidth= 4      " (automatic) 4 spaces used for indentation 
set tabstop= 4         " Set the width of the tabs (tab key) 
set expandtab         " The first tab of the line is converted to 4 spaces 
set cindent           " Use the automatic indentation method of C/C++ language 
set cinoptions={ 0 ,1s,t0,n- 2 ,p2s,(03s,=.5s,>1s,=1s,:1s      " Set C / The specific indentation method of the C++ language 
set showmatch         " Set the matching mode to display the matching brackets 
set linebreak         " Whole word wrap 
set whichwrap=b,s,<,>,[,] "The cursor can jump to the beginning and end of the line Another line to 
set ruler            " ruler, used to show the line and column numbers of the cursor position, separated by commas. Each window has its own ruler. If the window has a status line, the ruler is shown there. Otherwise, it is shown on the last line of the screen 
set showcmd           "The command line displays the entered command 
set showmode          "The command line displays the current mode of vim 
set incsearch         "The input string will display the matching point 
set enc=utf- 8         "The file encoding 
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>

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324739149&siteId=291194637