vim 配置文件

原创 2016年05月31日 17:06:21

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

" 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

" 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

"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/\ -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 
        normal ^i//
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





花了很长时间整理的,感觉用起来很方便,共享一下。 我的vim配置主要有以下优点: 1.按F5可以直接编译并执行C、C++、java代码以及执行shell脚本,按“F8”可进行C、C++代码的调试 ...
  • u010871058
  • u010871058
  • 2017年01月09日 00:07
  • 9296


vim简介 Vim(Vi Improved) 是一个类似于vi 的文本编辑器,在Vi的基础上增加了很多新的特性和功能。Vim以其强大的功能和可定制能力,成为Linux/Unix环境下开源...
  • zhaoxiaoqiang10
  • zhaoxiaoqiang10
  • 2014年04月23日 16:05
  • 1696


Linux下vim的主配置文件是/etc/vimrc,但是不建议修改这个文件。可以再自己的家目录下建立一个.vimrc文件,来保存自己的配置,还可以不影响其他用户的配置。 Windows下的vim配...
  • simmerlee
  • simmerlee
  • 2016年01月17日 11:27
  • 837


  • Anooyman
  • Anooyman
  • 2016年03月09日 20:04
  • 602


参考 文章《vim 配置文件 ,高亮+自动缩进+行号+折叠+优化》 1. 首先备份原配置文件: sudo cp /etc/vim/vimrc /etc/vim/vimrc.bk 2. 编辑vimrc,...
  • luzhenrong45
  • luzhenrong45
  • 2016年09月07日 22:58
  • 2445

  • pipisorry
  • pipisorry
  • 2014年05月05日 15:59
  • 2668

我的VIM配置文件 vimrc (for c/c++)

runtime! debian.vim "设置编码 set encoding=utf-8 set fencs=utf-8,ucs-bom,shift-jis,gb18030,gbk,gb2312,cp...
  • zxasqwedc
  • zxasqwedc
  • 2014年03月13日 15:12
  • 4293


ubuntu12.04中使用的vim的版本不支持像语法高亮和文件类型检测等配置 #sudo apt-get install vim vim默认的配置使用起来还不能让人满意,还需要自己配置 默认配...
  • anjiashuai521
  • anjiashuai521
  • 2014年01月10日 19:12
  • 1686


vim的配置文件在哪? 分类: linux开发2012-11-08 15:18 2438人阅读 评论(0) 收藏 举报   vim的配置文件在哪? 配置文件在哪里  当我...
  • jacobywu
  • jacobywu
  • 2014年04月14日 11:38
  • 1139


  • bendanban
  • bendanban
  • 2013年09月11日 13:08
  • 5640
您举报文章:vim 配置文件