基于Ubuntu 16.04 配置 Vim IDE(4)

    变量的值为字符串,当在其中有空格时需要用\进行转义,同样如果想输入\也要进行转义。
    注意:在vim运行时通过命令行设置的变量值均是临时的,即当退出vim环境时,该变量值会恢复为配置文件中的值或者默认值。
   
   

    常用的quickfix命令为:

    :cc     显示详细错误信息

    :cp     跳到上一个错误

    :cn     跳到下一个错误

    :cl      列出所有错误

    :cw     如果有错误列表,则打开quickfix窗口,没有则什么也不错

3. 附录 3.1 vimrc设置

下面是我的vimrc配置,这个文件放在目录/home/user/下。

runtime! debian.vim

" Uncomment the next line to make Vim more Vi-compatible
" NOTE: debian.vim sets 'nocompatible'. Setting 'compatible' changes numerous
" options, so any other options should be set AFTER setting 'compatible'.
set nocompatible

" Vim5 and later versions support syntax highlighting. Uncommenting the
" following enables syntax highlighting by default.
if has("syntax")
   syntax on
endif
colorscheme ron  

" detect file type
filetype on
filetype plugin on

" If using a dark background within the editing area and syntax highlighting
" turn on this option as well
set background=dark

" 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
   filetype plugin indent on
endif

" The following are commented out as they cause vim to behave a lot
" differently from regular Vi. They are highly recommended though.

"set ignorecase
"set smartcase       
set autowrite       
set autoindent       
"set smartindent     
set tabstop=4       
set softtabstop=4  
set shiftwidth=4  
set cindent     
set cinoptions={0,1s,t0,n-2,p2s,(03s,=.5s,>1s,=1s,:1s     
"set backspace=2   
set showmatch     
set linebreak     
set whichwrap=b,s,<,>,[,]
"set hidden " Hide buffers when they are abandoned
set mouse=a           
set number           
"set previewwindow   
set history=50     


set laststatus=2
set ruler           

set showcmd   
set showmode

"--find setting--
set incsearch       
set hlsearch   


"--ctags setting--
map <F5> :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<CR><CR> :TlistUpdate<CR>
imap <F5> <ESC>:!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<CR><CR> :TlistUpdate<CR>
set tags=tags
set tags+=./tags "add current directory's generated tags file
"set tags+=~/test/tags


"-- omnicppcomplete setting --
imap <F3> <C-X><C-O>
imap <F2> <C-X><C-I>
set completeopt=menu,menuone
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 don'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


"-- Taglist setting --
let Tlist_Ctags_Cmd='ctags'
let Tlist_Use_Right_Window=1
let Tlist_Show_One_File=0
let Tlist_File_Fold_Auto_Close=1
let Tlist_Exit_OnlyWindow=1
let Tlist_Process_File_Always=1
let Tlist_Inc_Winwidth=0



"-- WinManager setting --
let g:winManagerWindowLayout='FileExplorer|TagList'
"let g:persistentBehaviour=0
nmap wm :WMToggle<cr>


" -- MiniBufferExplorer --
let g:miniBufExplMapWindowNavVim = 1
let g:miniBufExplMapWindowNavArrows = 1
let g:miniBufExplMapCTabSwitchBufs = 1
let g:miniBufExplModSelTarget = 1   


"--fold setting--
set foldmethod=syntax
set foldlevel=100
set foldcolumn=5


"-- QuickFix setting --
map <F6> :make clean<CR><CR><CR>
map <F7> :make<CR><CR><CR> :copen<CR><CR>
map <F8> :cp<CR>
map <F9> :cn<CR>
imap <F6> <ESC>:make clean<CR><CR><CR>
imap <F7> <ESC>:make<CR><CR><CR> :copen<CR><CR>
imap <F8> <ESC>:cp<CR>
imap <F9> <ESC>:cn<CR>


3.2 cscope配置文件

cscope配置文件位于目录(/home/user/.vim/plugin)名叫cscope_map.vim,内容为

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/13102.html