"Turn" Ubuntu 12.04 under the Vim plugin Youcompleteme installation

Source: Internet
Author: User
Tags eol function prototype imap python script git clone



Original URL: http://www.cnblogs.com/jostree/p/4137402.html



Jostree Reprint Please specify the source http://www.cnblogs.com/jostree/p/4137402.html



1. You need to ensure that the version of Vim is greater than 7.3.584, otherwise you need to update vim



Can be updated by third-party sources:



Enter the following code in the terminal:


$ sudo add-apt-repository ppa:fcwu-tw/ppa$ sudo apt-get update$ sudo apt-get install vim


Upgrade to get vim7.4






2. Need to have more than clang3.2 library



Can be downloaded here: http://llvm.org/releases/download.html



You can download the clang3.4 that have been compiled and note the operating system version






3. Installing the Vundle Plugin


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


and configure the. VIMRC


set nocompatible "is inconsistent with vi
filetype off
set rtp + = ~ / .vim / bundle / vundle / "Load specific directory
"set rtp + = $ HOME / .vim / bundle / vundle /" Windows
call vundle # rc ()
"plugin
"Just fill in the name of the project under vimscripts account
Bundle ‘snipMate’
"Other required user / resource name
Bundle ‘gmarik / vundle’
"Non-github resources
Bundle ‘git: //git.wincent.com/command-t.git’
"indent
Bundle ‘php.vim-html-enhanced’
"color
Bundle ‘Lucius’
filetype plugin indent on





4. Install the Youcompleteme and syntastic plugins using the Vundle plugin:



Add in. vimrc


Bundle ' https://github.com/Valloric/YouCompleteMe.git ' bundle ' https://github.com/scrooloose/syntastic.git '


Then execute in vim: Vundle install!



You can install the two plug-ins, install the Youcompleteme process is very long



Can be executed directly under the ~/.vim/bundle/directory:


sudo git clone https://github.com/Valloric/YouCompleteMe.gitsudo git submodule update--init--recursive


can also get the same effect. The second line is to recursively update the contents of the subfolder.






5. Compiling the Youcompleteme plugin



First you need to install CMake


sudo apt-get install CMake





Then create a Ycm_build folder in the home directory


CD ~mkdir YCM_BUILDCD Ycm_build


Then Cmke uses the CMake command to generate the makefile file:


Cmake-g "Unix makefiles"-dpath_to_llvm_root=~/ycm_temp/llvm_root_dir. ~/.vim/bundle/youcompleteme/third_party/ycmd/cpp


Note here that you need to modify the dpath_to_llvm_root=~/ycm_temp/llvm_root_dir so that it is equal to the path of clang3.4.



Then make compiles


Make Ycm_support_libs


To generate the compiled library file.



Finally, go back to the Youcompleteme directory:



Perform




can be completed.



6. Configure the auto-complete Python script:



In the. ycm_extra_conf.py file under the ~/.vim/bundle/youcompleteme/third_party/ycmd/cpp/ycm/path



Delete. ycm_extra_conf.py in the



# note:this is just for youcompleteme; It ' s highly likely that your project
# does not need to remove the STDLIB flag. Do not use the this in YOUR
# ycm_extra_conf IF you ' RE not 100% your need IT.
Try
Final_flags.remove ('-stdlib=libc++ ')
Except ValueError:
Pass



YCM will not complete the contents of the C + + standard library until it is deleted.



and add



'/usr/include ',
'-isystem ',
'/usr/include/c++/'



To the flags list so that it can complement the header files in the C + + library.



7. Finally change the ~/.VIMRC configuration file:


set nocompatible "be iMproved
filetype off "required!
 
set rtp + = ~ / .vim / bundle / vundle /
call vundle # rc ()
 
"let Vundle manage Vundle
"required!
Bundle ‘gmarik / vundle’
 
"My Bundles here:
"
"original repos on github

Bundle ‘tpope / vim-fugitive’
Bundle ‘Lokaltog / vim-easymotion’
Bundle ‘rstacruz / sparkup’, {‘rtp’: ‘vim /‘}
Bundle ‘tpope / vim-rails.git’
"vim-scripts repos
Bundle ‘L9’
Bundle ‘FuzzyFinder’
"non github repos
Bundle ‘git: //git.wincent.com/command-t.git’
"My plugin
Bundle ‘perl-support.vim’
Bundle ‘ctags.vim’
Bundle ‘taglist.vim’
Bundle ‘https://github.com/Lokaltog/vim-powerline.git’
Bundle ‘LaTeX-Suite-aka-Vim-LaTeX’
Bundle ‘Simple-R-Omni-Completion’
"Bundle‘ Pydiction ’
Bundle ‘The-NERD-tree’
Bundle ‘Tagbar’
Bundle ‘asins / vimcdoc’
Bundle ‘cpp.vim’
Bundle ‘c.vim’
Bundle ‘code_complete’
Bundle ‘autoproto.vim’
Bundle ‘a.vim’
Bundle ‘pyflakes.vim’
Bundle ‘Conque-Shell’
Bundle ‘python.vim’
Bundle ‘multvals.vim’
Bundle ‘gdbvim’
Bundle ‘glib.vim’
Bundle ‘VimIM’
Bundle ‘OmniCppComplete’
Bundle ‘echofunc.vim’
"Bundle‘ clang-complete ’
"Bundle‘ pythoncomplete ’
Bundle ‘minibufexpl.vim’
Bundle ‘https://github.com/Valloric/YouCompleteMe.git’
Bundle ‘https://github.com/scrooloose/syntastic.git’
"Bundle‘ https://github.com/Valloric/ListToggle.git ’


"Bundle‘ Valloric / YouCompleteMe ’

"Bundle‘ qiushibaike ’
filetype plugin indent on "required!

"
"Brief help-here are the commands used by vundle
": BundleList-list configured bundles
": BundleInstall (!)-Install (update) bundles
": BundleSearch (!) Foo-search (or refresh cache first) for foo
": BundleClean (!)-Confirm (or auto-approve) removal of unused bundles
"
"see: h vundle for more details or wiki for FAQ
"NOTE: comments after Bundle command are not allowed ..
"
"

set nocompatible "Remove the annoying vi consistency mode and avoid some bugs and limitations of previous versions
set showmatch
set matchtime = 1
set autowrite
set ruler "Turn on the status bar ruler
set cursorline "highlight the current line
nnoremap <F2>: g / ^ \ s * $ / d <CR>
set laststatus = 1 "Enable to display the status line (1), always display the status line (2)
set foldenable "allow folding
"set foldmethod = indent" manual folding
set nu
set fileencodings = utf-8, ucd-bom, gb18030, gbk, gb2312, cp936
set tabstop = 4
set sts = 4
set expandtab
set softtabstop = 4
set shiftwidth = 4
set autoindent
set cindent
set cinoptions = (0,1s, t0, n-2, p2s, (03s, =. 5s,> 1s, = 1s,: 1s
colorscheme desert
set nobackup
set textwidth = 100
map <F5>:! / usr / bin / python%
map <F6>: call CompileRunGpp () <CR>


"" "" "" "" "syntastic" "" "" "" "" "" "
let g: syntastic_check_on_open = 1
let g: syntastic_cpp_include_dirs = [‘/ usr / include /‘]
let g: syntastic_cpp_remove_include_errors = 1
let g: syntastic_cpp_check_header = 1
let g: syntastic_cpp_compiler = ‘clang ++’
let g: syntastic_cpp_compiler_options = ‘-std = c ++ 11 -stdlib = libstdc ++’
"set error or warning signs
let g: syntastic_error_symbol = "?"
let g: syntastic_warning_symbol = "?"
"whether to show balloons
let g: syntastic_enable_balloons = 1
let g: syntastic_always_populate_loc_list = 1

nnoremap <silent> <C-d>: lclose <CR>: bdelete <CR>
cabbrev <silent> bd lclose \ | bdelete

"" "" "" "" "" "YCM" "" "" "" "" "" "" "" "" "" "
let g: ycm_global_ycm_extra_conf = ‘~ / .vim / bundle / YouCompleteMe / third_party / ycmd / cpp / ycm / .ycm_extra_conf.py’
let g: ycm_collect_identifiers_from_tags_files = 1
let g: ycm_seed_identifiers_with_syntax = 1
let g: ycm_confirm_extra_conf = 0
let g: ycm_always_populate_location_list = 1
let g: ycm_min_num_of_chars_for_completion = 2
let g: ycm_complete_in_comments = 1

nnoremap <leader> jd: YcmCompleter GoToDefinitionElseDeclaration <CR>
nnoremap <leader> lo: lopen <CR>


"minibufexpl
"{
let g: miniBufExplMapCTabSwitchBufs = 1
let g: miniBufExplMapWindowNavVim = 1
"}
"
"pydiction
"{
"filetype plugin on
"let g: pydiction_location =‘ ~ / .vim / bundle / Pydiction / complete-dict ’
"}
"" OmniCppComplete
"" {
""-omnicppcomplete setting-
"" Press F3 to complete the code automatically. Note that there can be no other characters after the mapping statement, including tab; otherwise, pressing F3 will automatically complete some garbled characters.
"imap <F3> <C-X> <C-O>
"" Press F2 to complete based on keywords in the header file
"imap <F2> <C-X> <C-I>
   "set completeopt = menu, menuone" close the preview window during smart completion
"let OmniCpp_MayCompleteDot = 1" autocomplete with.
"let OmniCpp_MayCompleteArrow = 1" autocomplete with->
"let OmniCpp_MayCompleteScope = 1" autocomplete with ::
"let OmniCpp_SelectFirstItem = 2" select first item (but do n‘t insert)
"let OmniCpp_NamespaceSearch = 2" search namespaces in this and included files
"let OmniCpp_ShowPrototypeInAbbr = 1" show function prototype in popup window
"let OmniCpp_GlobalScopeSearch = 1" enable the global scope search
"let OmniCpp_DisplayMode = 1" Class scope completion mode: always show all members
    "let OmniCpp_DefaultNamespaces = [" std "]
"let OmniCpp_ShowScopeInAbbr = 1" show scope in abbreviation and remove the last column
"let OmniCpp_ShowAccess = 1
"set tags + = / usr / include / c ++ / tags" need to ctags -R --c ++-kinds = + p --fields = + iaS --extra = + q
"}
"echofunc.vim
"{
"}
"vimIM
"{
let g: vimim_cloud = ‘sogou’
let g: vimim_map = ‘tab_as_onekey’
let g: vimim_map = ‘no-gi’
let g: vimim_map_extra = ‘ctrl_h_as_ctrl_bslash’
"let g: vimim_stati
c_input_style = 1
let g: vimim_toggle = ‘pinyin, sogou, baidu’
let g: vimim_plugin = ‘/home/liuyi/.vim/bundle/VimIM/plugin’
"}
"
"" Bundle ‘clang-complete’
"" {
"let g: clang_auto_select = 1
"let g: clang_complete_copen = 1
"let g: clang_periodic_quickfix = 1
"let g: clang_snippets = 1
"let g: clang_snippets_engine =‘ clang_complete ’
"let g: clang_close_preview = 1
"let g: clang_use_library = 1
"let g: clang_user_options =‘-stdlib = libc ++ -std = c ++ 11 -IIncludePath ’
"let g: neocomplcache_enable_at_startup = 1
""}
"pyflakes python parsing
"{
"filetype plugin indent on
"}
"python_complete
"{
set ofu = syntaxcomplete
autocmd FileType python
set omnifunc = pythoncomplete
"autocmd FileType python runtime! autoload / pythoncomplete.vim
"}
"
"tagbar
"{
"nmap <Leader> tb: TagbarToggle <CR>
map <F8>: TagbarToggle <CR>
imap <F8> <ESC>: NERDTreeToggle <CR>
let g: tagbar_ctags_bin = ‘/ usr / bin / ctags’
let g: tagbar_width = 30
autocmd BufReadPost * .cpp, * .c, * .h, * .hpp, * .cc, * .cxx call tagbar # autoopen ()
"}

"omni-completion
"{
"autocmd FileType python set omnifunc = pythoncomplete # Complete
"let g: pydiction_location =‘ ~ / .vim / bundle / Pydiction / complete-dict ’
filetype plugin on
"}

"taglist
"{
let Tlist_Auto_Highlight_Tag = 1
"let Tlist_Auto_Open = 1
let Tlist_Auto_Update = 1
let Tlist_Display_Tag_Scope = 1
let Tlist_Exit_OnlyWindow = 1
let Tlist_Enable_Dold_Column = 1
"let Tlist_File_Fold_Auto_Close = 1
let Tlist_Show_One_File = 1
let Tlist_Use_Right_Window = 1
let Tlist_Use_SingleClick = 1
"nnoremap <Leader> tl: TlistToggle <CR>
"Set F8 to taglist switch
"}

"Nerd-tree
"{
map <F7>: NERDTreeToggle <CR>
imap <F7> <ESC>: NERDTreeToggle <CR>
"}

"WinManager
"{
let g: winManagerWindowLayout = ‘FileExplorer | BufExplorer’ “Here you can set multiple windows, such as‘ FileExplorer | BufExplorer | TagList ’
let g: persistentBehaviour = 0 "When there is only one window left, exit vim.
let g: winManagerWidth = 20
let g: defaultExplorer = 1
nmap <leader> fir: FirstExplorerWindow <cr>
nmap <leader> bot: BottomExplorerWindow <cr>
nmap <leader> wm: WMToggle <cr>
"}
"
runtime! ftplugin / man.vim

set hlsearch
set autoindent "copy indent from current line
set autoread "read open files again when changed outside Vim
set autowrite "write a modified buffer on each: next, ...
set backspace = indent, eol, start "backspacing over everything in insert mode
"set backup" keep a backup file
set browsedir = current "which directory to use for the file browser
set complete + = k "scan the files given with the‘ dictionary ’option
set history = 50 "keep 50 lines of command line history
set hlsearch "highlightthe last used search pattern
set incsearch "do incremental searching
set listchars = tab:>., eol: \ $ "strings to use in‘ list ’mode
set mouse = a "enable the use of the mouse
set wrap "wrap lines
set popt = left: 8pc, right: 3pc "print options
set ruler "show the cursor position all the time
"set shiftwidth = 2" number of spaces to use for each step of indent
set showcmd "display incomplete commands
set smartindent "smart autoindenting when starting a new line
"set tabstop = 2" number of spaces that a <Tab> counts for
set visualbell "visual bell instead of beeping
set wildignore = *. bak, *. o, *. e, * ~ "wildmenu: ignore these extensions
set wildmenu "command-line completion in an enhanced mode
set formatoptions = tcrqn
"
"------------------------------------------------- ------------------------------
"highlight paired brackets
"------------------------------------------------- ------------------------------
highlight MatchParen ctermbg = blue guibg = lightyellow

inoremap,, <Space>
"
"------------------------------------------------- ------------------------------
"autocomplete parenthesis, (brackets) and braces
"------------------------------------------------- ------------------------------
inoremap (() <Left>
inoremap [[] <Left>
inoremap {{} <Left>
"
vnoremap (s () <Esc> P <Right>%
vnoremap [s [] <Esc> P <Right>%
vnoremap {s {} <Esc> P <Right>%
"
"surround content with additional spaces
"
vnoremap) s () <Esc> <Left> P <Right> <Right>%
vnoremap] s [] <Esc> <Left> P <Right> <Right>%
vnoremap} s {} <Esc> <Left> P <Right> <Right>%
set vb t_vb = "
"vim-powerline
set laststatus = 2
set t_Co = 256
let g: Powerline_symbols = ‘unicode’
set encoding = utf8

"vimcdoc
"{
set helplang = cn
"}

"shift tab page
"{
 map <S-Left>: tabp <CR>
 map <S-Right>: tabn <CR>
"} 





"Turn" Ubuntu 12.04 under the Vim plugin Youcompleteme installation


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.