syntax on syntax enable syntax sync fromstart set ambiwidth=double set autoindent set autoread set backspace=eol,start,indent set cindent set encoding=utf-8 set history=1024 set incsearch set hlsearch set magic set nu set ruler filetype on filetype indent on filetype plugin on let mapleader = ',' set nocompatible 高级 -------------------------------------------------------------------------- let g:Pydiction_location = '/root/.vim/tools/pydiction-1.2/complete-dict' let g:pydiction_menu_height = 20 " vim 自动补全 Python 代码 if has("autocmd") autocmd FileType python set complete+=k~/.vim/tools/pydiction-1.2/complete -dict iskeyword+=.,( endif " has("autocmd") let g:winManagerWindowLayout='FileExplorer|TagList' nmap wm :WMToggle<cr> set nobackup " 启用鼠标 let g:pcs_hotkey=":pyc" let g:pcs_check_when_saving='true' " File: _vimrc " Date: 2009-09-22 " Author: gashero " NOTE: 配置一份简单的vim配置文件 set nocompatible "非兼容模式 syntax on "开启语法高亮 set background=dark "背景色 color desert set ruler "在左下角显示当前文件所在行 set showcmd "在状态栏显示命令 set showmatch "显示匹配的括号 set ignorecase "大小写无关匹配 set smartcase "只能匹配,即小写全匹配,大小写混合则严格匹配 set hlsearch "搜索时高亮显示 set incsearch "增量搜索 "set nohls "搜索时随着输入立即定位,不知什么原因会关闭结果高亮 set report=0 "显示修改次数 set number "行号 set nobackup "无备份 set cursorline "高亮当前行背景 set fileencodings=ucs-bom,UTF-8,GBK,BIG5,latin1 set fileencoding=UTF-8 set fileformat=unix "换行使用unix方式 set ambiwidth=double set noerrorbells "不显示响铃 set visualbell "可视化铃声 set foldmarker={,} "缩进符号 set foldmethod=indent "缩进作为折叠标识 set foldlevel=100 "不自动折叠 set foldopen-=search "搜索时不打开折叠 set foldopen-=undo "撤销时不打开折叠 set updatecount=0 "不使用交换文件 set magic "使用正则时,除了$ . * ^以外的元字符都要加反斜线 "缩进定义 set shiftwidth=4 set tabstop=4 set softtabstop=4 set expandtab set smarttab set backspace=2 "退格键可以删除任何东西 "显示TAB字符为<+++ "set list "set list listchars=tab:<+ "映射常用操作 map [o :!python -i % <CR> map [t :!rst2html.py % %<.html <CR> " 按F5 启动python测试 map <F5> :!python %<CR> map <F6> :!python % if has("gui_running") set lines=25 set columns=80 set lazyredraw "延迟重绘 set guioptions-=m "不显示菜单 set guioptions-=T "不显示工具栏 set guifont=consolas\ 10 endif set makeprg=/apsarapangu/disk1/apsara-pangu/bin/scons-local/scons.py\ -U\ -j8\ -Q " php settings autocmd FileType php set expandtab autocmd FileType php set ts=2 autocmd FileType php set sw=2 autocmd FileType php set omnifunc=phpcomplete#CompletePHP " java settings autocmd FileType java set ts=4 autocmd FileType java set sw=4 autocmd FileType java set makeprg=ant autocmd FileTYpe java set omnifunc=javacomplete#CompleteJava autocmd FileType java set efm=\ %#[javac]\ %#%f:%l:%c:%*\\d:%*\\d:\ %t%[%^:]%# :%m, \%A\ %#[javac]\ %f:%l:\ %m,%-Z\ %#[javac]\ %p^,%-C%.%# " html/css settings autocmd FileType html set ts=2 sw=2 autocmd FileType css set ts=2 sw=2 " ctags set tags=tags;~/.vim/systags if has("autocmd") "回到上次文件打开所在行 au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") \| exe "normal g'\"" | endif "自动检测文件类型,并载入相关的规则文件 "filetype plugin on filetype indent on "智能缩进,使用4空格,使用全局的了 "autocmd FileType python setlocal et | setlocal sta | setlocal sw=4 "autocmd FileType c setlocal et | setlocal sta | setlocal sw=4 "autocmd FileType h setlocal et | setlocal sta | setlocal sw=4 endif " 打开当前目录文件列表 map <F3> :e .<CR> " Taglist let Tlist_File_Fold_Auto_Close=1 set updatetime=1000 map <F4> :Tlist<CR> " 按 F8 智能补全 inoremap <F8> <C-x><C-o> " 按F11注释选中的块 map <F11> :s/^/#/g<CR> " 按F12取消选中块的注释 map <F12> :s/^#//g<CR> let Tlist_Show_One_File=1 let Tlist_Exit_OnlyWindow=1 let g:winManagerWindowLayout='FileExplorer|TagList' nn <c-h> <c-w>h nn <c-j> <c-w>j nn <c-k> <c-w>k nn <c-l> <c-w>l " shortcut keys " F7 -> make nmap <F7> :make<CR>:copen<CR><C-W><C-P> " F3 -> search all subdirectories and files in cwd for word at cursor nmap <F3> :vimgrep /\<<C-R><C-W>\>/ **<CR>:copen<CR><C-W><C-P> "taglist let Tlist_WinWidth = 50 map <F2> :TlistOpen<CR>
.vimrc
最新推荐文章于 2024-11-05 15:28:12 发布