码迷,mamicode.com
首页 > 系统相关 > 详细

gvim配置文件参考

时间:2016-05-08 20:01:30      阅读:223      评论:0      收藏:0      [点我收藏+]

标签:配置文件 vim

 set nu!
 set autoindent
set cindent

     colorscheme desert
     syntax enable
     syntax on
set tags=tags;   
set autochdir
let Tlist_Ctags_Cmd=‘ctags.exe‘
let Tlist_Show_One_File=1
let Tlist_OnlyWindow=1
let Tlist_Use_Right_Window=0
let Tlist_Sort_Type=‘name‘
let Tlist_Exit_OnlyWindow=1
let Tlist_Show_Menu=1
let Tlist_Max_Submenu_Items=10
let Tlist_Max_Tag_length=20
let Tlist_Use_SingleClick=0
let Tlist_Auto_Open=0
let Tlist_Close_On_Select=0
let Tlist_File_Fold_Auto_Close=1
let Tlist_GainFocus_On_ToggleOpen=0
let Tlist_Process_File_Always=1
let Tlist_WinHeight=10
let Tlist_WinWidth=18
let Tlist_Use_Horiz_Window=0 
let g:persistentBehaviour=0     
let g:winManagerWidth=20
let g:defaultExplorer=1
nmap <silent> <leader>fir :FirstExplorerWindow<cr>
nmap <silent> <leader>bot :BottomExplorerWindow<cr>
nmap <silent> <leader>wm :WMToggle<cr>
let g:winManagerWindowLayout=‘FileExplorer|TagList‘
set fileencodings=utf-8,chinese,latin-1
 set termencoding=utf-8
 set encoding=utf-8
language messages zh_CN.utf-8
if has("gui_running")
 au GUIEnter * simalt ~x " 窗口启动时自动最大化
 set guioptions-=m " 隐藏菜单栏
 set guioptions-=T " 隐藏工具栏
 set guioptions-=L " 隐藏左侧滚动条
 set guioptions-=r " 隐藏右侧滚动条
 set guioptions-=b " 隐藏底部滚动条
 set showtabline=0 " 隐藏Tab栏
endif



"<!--括号引号补全代码{{{-->
" 括号引号补全
inoremap ( ()<Esc>i
inoremap [ []<Esc>i
inoremap { {<CR>}<Esc>O
inoremap ) <c-r>=ClosePair(‘)‘)<CR>
inoremap ] <c-r>=ClosePair(‘]‘)<CR>
inoremap } <c-r>=CloseBracket()<CR>
inoremap " <c-r>=QuoteDelim(‘"‘)<CR>
inoremap ‘ <c-r>=QuoteDelim("‘")<CR>


function ClosePair(char)
 if getline(‘.‘)[col(‘.‘) - 1] == a:char
  return "\<Right>"
 else
  return a:char
 endif


function CloseBracket()
 if match(getline(line(‘.‘) + 1), ‘\s*}‘) < 0
  return "\<CR>}"
 else
  return "\<Esc>j0f}a"
 endif


function QuoteDelim(char)
 let line = getline(‘.‘)
 let col = col(‘.‘)
 if line[col - 2] == "\\"
  "Inserting a quoted quotation mark into the string
  return a:char
 elseif line[col - 1] == a:char
  "Escaping out of the string
  return "\<Right>"
 else
  "Starting a string
  return a:char.a:char."\<Esc>i"
 endif



"<!--html标签自动补全{{{-->
" html自动补全
autocmd BufNewFile *  setlocal filetype=html
function! InsertHtmlTag()
 let pat = ‘\c<\w\+\s*\(\s\+\w\+\s*=\s*[‘‘#$;,()."a-z0-9]\+\)*\s*>‘
 normal! a>
 let save_cursor = getpos(‘.‘)
 let result = matchstr(getline(save_cursor[1]), pat)
 "if (search(pat, ‘b‘, save_cursor[1]) && searchpair(‘<‘,‘‘,‘>‘,‘bn‘,0,  getline(‘.‘)) > 0)
 if (search(pat, ‘b‘, save_cursor[1]))
  normal! lyiwf>
  normal! a</
  normal! p
  normal! a>
 endif
 :call cursor(save_cursor[1], save_cursor[2], save_cursor[3])
endfunction
inoremap > <ESC>:call InsertHtmlTag()<CR>a<CR><Esc>O


yo

本文出自 “如何消灭蚊子” 博客,请务必保留此出处http://xiaoganghu.blog.51cto.com/10840734/1771221

gvim配置文件参考

标签:配置文件 vim

原文地址:http://xiaoganghu.blog.51cto.com/10840734/1771221

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!