摘要:安装:apt-get install cscopeapt-get install ctags10.141.84.119上已经装过,不需要再装了脚本从服务器上拷贝,或者把附件vim.rar解压到自己目录下cp -r /home/h00121290/.vim ~cp /home/h00121290/.vimrc ~生成数据库:在代码目录下,打开VIF7生成tagsF8生成cscope.out脚本没有做好,生成后需要重新打开vi加载数据库,有兴趣的同学可以研究研究.vimrc,自己改下快捷键介绍::cs 可以看到cscope的命令帮助cscope命令可以缩写,比如:
安装:
apt-get install cscope
apt-get install ctags
10.141.84.119上已经装过,不需要再装了
脚本从服务器上拷贝,或者把附件vim.rar解压到自己目录下
cp -r /home/h00121290/.vim ~
cp /home/h00121290/.vimrc ~
生成数据库:
在代码目录下,打开VI
F7 生成tags
F8 生成cscope.out
脚本没有做好,生成后需要重新打开vi加载数据库,有兴趣的同学可以研究研究.vimrc,自己改下
快捷键介绍:
:cs 可以看到cscope的命令帮助
cscope命令可以缩写,比如:打开文件board-k3v2oem1.c,可以输入:cs f f oem,然后选择对应的文件
ctrl+\+'x' 按照“:cs f 'x' 光标所在符号”方式查找,'x'是c|d|e|f|g|i|s|t之一,参阅cscope命令帮助
ctrl+] 跳转到光标所在符号定义
ctrl+t 回跳到跳转前
.vimrc文件内容替换
"==============================================================================
" Filename: vimrc
" Author: zrainx
" Email: [email protected]
" Created: 2008-04-10
"===============================================================================
set fileencodings=utf-8,gbk,gb2312
set guifont=Luxi\ Mono\ 9 " set font,font name,font size
set tabstop=4 " set width of tab
set backspace=2 " set backspace
set nu! " display line number
"set wrap " wrap
set nowrap " no wrap
set linebreak " wrap between whole word
set whichwrap=b,s,<,>,[,] " curser could goto another line when it access the
" the start or end of line
set hidden " hidden the unsave buffer
set scrolloff=5
set nobackup " forbid backup file
"set ff=unix " open file as unix format
"-------------------------------------------------------------------------------
" some additional hot keys
"-------------------------------------------------------------------------------
" F2 - toggle the pastemode
" F3 - toggle line numbers
" F5 - make
" F6 - list all errors
" F7 - cteate tagfile in current directory
" F8 - create scscope.out in current directory
"
"-------------------------------------------------------------------------------
"
map :let &number=1-&number
map :copen
map :!ctags --sort=foldcase -R .
map :!cscope -bRk
imap :let &number=1-&number
imap :copen
imap :!ctags --sort=foldcase -R .
imap :!cscope -b -i -c
"--------------------------------------------------------------------------------
" setting on searching and replace
"--------------------------------------------------------------------------------
set hlsearch " Highlight search results
"set gdefault " replace all the matching words at current line,instead
" of replacing the first matching one
set incsearch " While typing a search command, show immediately where the
" so far typed pattern matches.
set ignorecase " Ignore case in search patterns.
set smartcase " Override the 'ignorecase' option if the search pattern
" contains upper case characters.
"--------------------------------------------------------------------------------
" setting on status bar
"--------------------------------------------------------------------------------
set statusline=[%F]%y%r%m%*%=[Line:%l/%L,Column:%c][%p%%]
set laststatus=2 " always show the status line
set ruler " display the location of cusor at the right bottom of the
" status bar
"--------------------------------------------------------------------------------
" simulate the short cut key of MS Windows
"--------------------------------------------------------------------------------
nmap ggvG$ "select all by input Ctrl-a
"--------------------------------------------------------------------------------
" setting on program
"--------------------------------------------------------------------------------
"set completeopt=longest,menu " switch off the preview window of smart completion
filetype plugin indent on " smart indent according the file type
syntax on " syntax highlighting
set mouse= " disable the use of the mouse.
set showmatch "if you have just typed parens/bracket/comment
"opening/etc,
"makes cursor to jump shortly to its counterpart.
set smartindent " smart indent
set shiftwidth=4 " the length of smart indent eguals to 4 space
set autoindent " auto indent
"set backspace=indent,eol,start " Influences the working of , , CTRL-W
" and CTRL-U in Insert mode. This is a list of items,
" separated by commas. Each item allows a way to backspace
" over something.
colorscheme desert " choose the desert color theme
"colorscheme molokai " choose the molokai color theme
"colorscheme evening " choose the evening color theme
"--------------------------------------------------------------------------------
" folding code
"--------------------------------------------------------------------------------
set tabstop=4
set softtabstop=4
set expandtab
set foldcolumn=1 " Optional
"--------------------------------------------------------------------------------
" short cut key on windows operation
"--------------------------------------------------------------------------------
nmap wv v " splite current window vertically
nmap wc c " close current window
nmap ws s " splite current window horizontally
nmap wx :WinFullScreen " Open and close win_full_screen.vim
"###############################################################################
" The following is the Plugins' setting
"###############################################################################
"--------------------------------------------------------------------------------
" TagList :Tlist
"--------------------------------------------------------------------------------
nmap wt :TlistToggle " Toggle TagList
let Tlist_Show_One_File = 1
let Tlist_Exit_OnlyWindow = 1
"--------------------------------------------------------------------------------
" Source Explorer
"--------------------------------------------------------------------------------
"" The switch of the Source Explorer
nmap we :SrcExplToggle " Toggle SrcExplore
" Set the height of Source Explorer window
let g:SrcExpl_winHeight = 12
" Set 100 ms for refreshing the Source Explorer
let g:SrcExpl_refreshTime = 100
" Set "Enter" key to jump into the exact definition context
"let g:SrcExpl_jumpKey = ""
" Set "Space" key for back from the definition context
"let g:SrcExpl_gobackKey = ""
"--------------------------------------------------------------------------------
" Grep
"--------------------------------------------------------------------------------
"直接按下\g来查找光标所在的字符???
nnoremap g :Rgrep
"--------------------------------------------------------------------------------
" cscope map
"---------------------------------------------------------------------------------
"
nmap s :cs find s =expand("")
nmap g :cs find g =expand("")
nmap c :cs find c =expand("")
nmap t :cs find t =expand("")
nmap e :cs find e =expand("")
nmap f :cs find f =expand("")
nmap i :cs find i ^=expand("")$
nmap d :cs find d =expand("")
"--------------------------------------------------
" CCTree
"--------------------------------------------------
"
let g:CCTreeOrientation = "topright"
"--------------------------------------------------------------------------------
" neocomplcache
"---------------------------------------------------------------------------------
"
nmap :NeoComplCacheToggle " Toggle NeoComplCache
" Disable AutoComplPop.
let g:acp_enableAtStartup = 0
" Use neocomplcache.
let g:neocomplcache_enable_at_startup = 1
" Use smartcase.
let g:neocomplcache_enable_smart_case = 1
" Use camel case completion.
let g:neocomplcache_enable_camel_case_completion = 1
" Use underbar completion.
let g:neocomplcache_enable_underbar_completion = 1
" Set minimum syntax keyword length.
let g:neocomplcache_min_syntax_length = 3
let g:neocomplcache_lock_buffer_name_pattern = '\*ku\*'
" Define dictionary.
let g:neocomplcache_dictionary_filetype_lists = {
\ 'default' : '',
\ 'vimshell' : $HOME.'/.vimshell_hist',
\ 'scheme' : $HOME.'/.gosh_completions'
\ }
" Define keyword.
if !exists('g:neocomplcache_keyword_patterns')
let g:neocomplcache_keyword_patterns = {}
endif
let g:neocomplcache_keyword_patterns['default'] = '\h\w*'
" Plugin key-mappings.
imap (neocomplcache_snippets_expand)
smap (neocomplcache_snippets_expand)
inoremap neocomplcache#undo_completion()
inoremap neocomplcache#complete_common_string()
" SuperTab like snippets behavior.
"imap neocomplcache#sources#snippets_complete#expandable() ?
"\(neocomplcache_snippets_expand)" : pumvisible() ? "\" : "\"
" Recommended key-mappings.
" : close popup and save indent.
inoremap neocomplcache#close_popup() . "\"
" : completion.
inoremap pumvisible() ? "\" : "\"
" , : close popup and delete backword char.
inoremap neocomplcache#smart_close_popup()."\"
inoremap neocomplcache#smart_close_popup()."\"
inoremap neocomplcache#close_popup()
inoremap neocomplcache#cancel_popup()
" For cursor moving in insert mode(Not recommended)
inoremap neocomplcache#close_popup() . "\"
inoremap neocomplcache#close_popup() . "\"
inoremap neocomplcache#close_popup() . "\"
inoremap neocomplcache#close_popup() . "\"
" AutoComplPop like behavior.
"let g:neocomplcache_enable_auto_select = 1
" Shell like behavior(not recommended).
"set completeopt+=longest
"let g:neocomplcache_enable_auto_select = 1
"let g:neocomplcache_disable_auto_complete = 1
"inoremap pumvisible() ? "\" : "\\"
"inoremap neocomplcache#smart_close_popup() . "\"
" Enable omni completion.
autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
autocmd FileType python setlocal omnifunc=pythoncomplete#Complete
autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
" Enable heavy omni completion.
if !exists('g:neocomplcache_omni_patterns')
let g:neocomplcache_omni_patterns = {}
endif
let g:neocomplcache_omni_patterns.ruby = '[^. *\t]\.\h\w*\|\h\w*::'
"autocmd FileType ruby setlocal omnifunc=rubycomplete#Complete
let g:neocomplcache_omni_patterns.php = '[^. \t]->\h\w*\|\h\w*::'
let g:neocomplcache_omni_patterns.c = '\%(\.\|->\)\h\w*'
let g:neocomplcache_omni_patterns.cpp = '\h\w*\%(\.\|->\)\h\w*\|\h\w*::'
" For snippet_complete marker.
if has('conceal')
set conceallevel=2 concealcursor=i
endif