关闭

vim 配置文件

标签: vim编辑器
123人阅读 评论(0) 收藏 举报
分类:

vim 配置

个人的配置文件如下:

"set autoindent
"set cindent

set encoding=utf-8
setglobal fileencodings=utf-8,gb18030
set termencoding=utf-8
set ambiwidth=double

" All system-wide defaults are set in $VIMRUNTIME/debian.vim (usually just
" /usr/share/vim/vimcurrent/debian.vim) and sourced by the call to :runtime
" you can find below.  If you wish to change any of those settings, you should
" do it in this file (/etc/vim/vimrc), since debian.vim will be overwritten
" everytime an upgrade of the vim packages is performed.  It is recommended to
" make changes after sourcing debian.vim since it alters the value of the
" 'compatible' option.

" This line should not be removed as it ensures that various options are
" properly set to work with the Vim-related packages available in Debian.
"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 compatible

" Vim5 and later versions support syntax highlighting. Uncommenting the next
" line enables syntax highlighting by default.
syntax enable
syntax 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("'\"") > 0 && line("'\"") <= line("$")
\| exe "normal g'\"" | endif
endif

" Uncomment the following to have Vim load indentation rules according to the
" detected filetype. Per default Debian Vim only load filetype specific
" plugins.
if has("autocmd")
filetype 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 showcmd             " Show (partial) command in status line.
set showmatch           " Show matching brackets.
"set ignorecase          " Do case insensitive matching
set smartcase           " Do smart case matching
set incsearch           " Incremental search
set autowrite           " Automatically save before commands like :next and :make
set hidden             " Hide buffers when they are abandoned
""set mouse=a            " Enable mouse usage (all modes) in terminals
"set mouse=            " Enable mouse usage (all modes) in terminals

" Source a global configuration file if available
" XXX Deprecated, please move your changes here in /etc/vim/vimrc
"if filereadable("/etc/vim/vimrc.local")
"source /etc/vim/vimrc.local
"endif

"set color scheme ,as you like
"color darkblue
color desert
"replace tab with spaces
set et
"line will wrap when len>78
"set tw=250
"tab space is 4
set ts=4
"when you type < or >, shift width is 4
set sw=4
"set format options, (more info: type help fo-table)
set fo+=tcroq
"line number
set nu
"a horizontal line under current cursor
"set cursorline 

let Tlist_Show_One_File=1
let Tlist_Exit_OnlyWindow=1

let g:winManagerWindowLayout='FileExplorer|TagList'
nmap wm :WMToggle<cr>

:set cscopequickfix=s-,c-,d-,i-,t-,e-

nmap <C-_>s :cs find s <C-R>=expand("<cword>")<CR><CR>
nmap <C-_>g :cs find g <C-R>=expand("<cword>")<CR><CR>
nmap <C-_>c :cs find c <C-R>=expand("<cword>")<CR><CR>
nmap <C-_>t :cs find t <C-R>=expand("<cword>")<CR><CR>
nmap <C-_>e :cs find e <C-R>=expand("<cword>")<CR><CR>
nmap <C-_>f :cs find f <C-R>=expand("<cfile>")<CR><CR>
nmap <C-_>i :cs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
"nmap <C-_>i :cs find i <C-R>=expand("<cfile>")<CR><CR>
nmap <C-_>d :cs find d <C-R>=expand("<cword>")<CR><CR>
vmap <F5> :s=^\(//\)*=//=g<cr>:noh<cr>
nmap <F5> :s=^\(//\)*=//=g<cr>:noh<cr>
nmap <F6> :s=^\(//\)*==g<cr>:noh<cr>
vmap <F6> :s=^\(//\)*==g<cr>:noh<cr>

"set makeprg=/root/qfang/bin/scons/scons.py\ -u\ \.

"miniBuf is sooooo sucks
"noremap <Tab> <C-W>w:cd%:p:h<CR>:<CR>
"let g:miniBufExplMapCTabSwitchBufs = 1
"let g:miniBufExplMapWindowNavVim = 1
"let g:miniBufExplMapWindowNavArrows = 1

set completeopt=longest,menu
set nocp
filetype plugin on

map <C-F12> :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<CR>

"set tags+=/usr/include/tags
set tags+=/home/admin/qiang.fangq/main_richtext_extractor/tags
set tags+=/home/admin/qiang.fangq/awrapper/tags
set tags+=/home/admin/qiang.fangq/usr_tags

set backspace=indent,eol,start
set hlsearch

""""""""""""""""""""""""""""""
" vimgdb setting
""""""""""""""""""""""""""""""
"run macros/gdb_mappings.vim 

"pydiction 1.2 python auto complete
let g:pydiction_location = '~/.vim/tools/pydiction/complete-dict'
let g:pydiction_menu_height = 20

let g:SuperTabRetainCompletionType=2
let g:SuperTabDefaultCompletionType="<C-X><C-N>"

map<F5> <ESC><F5>
map<f5> :call AddComment()<cr>
func AddComment()
    if matchstr(getline('.'), '[^ ]') == '/' 
        normal ^xx 
    else
        normal ^i//
    endif
endfunc
imap <F6> <ESC><F6>
noremap <f6> =a{ 
imap <F7> <ESC><F7>
map<F7> :w<cr>:A<cr>
imap <cr> <cr><left><right>
map o o<left><right>
map wm :NERDTree<cr>
map <tab> gt
autocmd BufNewFile,BufRead *.json set ft=javascript

配置步骤见网上教程

快捷键待更新:

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:22283次
    • 积分:386
    • 等级:
    • 排名:千里之外
    • 原创:16篇
    • 转载:10篇
    • 译文:0篇
    • 评论:1条
    最新评论