作者:干杯13ds_198 | 来源:互联网 | 2023-10-11 19:10
setnu!setautoindentsetcindentcolorschemedesertsyntaxenablesyntaxonsettagstags;setautochdir
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_Wingui_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 ( ()i
inoremap [ []i
inoremap { {}O
inoremap ) =ClosePair(‘)‘)
inoremap ] =ClosePair(‘]‘)
inoremap } =CloseBracket()
inoremap " =QuoteDelim(‘"‘)
inoremap ‘ =QuoteDelim("‘")
function ClosePair(char)
if getline(‘.‘)[col(‘.‘) - 1] == a:char
return "\"
else
return a:char
endif
function CloseBracket()
if match(getline(line(‘.‘) + 1), ‘\s*}‘) <0
return "\}"
else
return "\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 "\"
else
"Starting a string
return a:char.a:char."\i"
endif
"
" 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 > :call InsertHtmlTag()aO
yo
本文出自 “如何消灭蚊子” 博客,请务必保留此出处http://xiaoganghu.blog.51cto.com/10840734/1771221
gvim配置文件参考