es and tab
if (!empty(line))
break
endif
let n = n - 1
endwhile
" Delete all empty lines at the end of file
let start = n+1+a:keep
if (start < lastline)
execute n+1+a:keep . "," . lastline . "d"
endif
" after clean spaces and tabs, jump back
exec "normal " . lnum . "G"
endfunction
"快速查找(插件grep插件,需要grep软件)
"nnoremap :Grep
"给n映射一个快捷键,习惯上喜欢用F3
nmap n
"给n映射一个快捷键,习惯上喜欢用F3
nmap N
"PHP语法检查
"map :!E:/Web/Server/PHP/php.exe -l %
function! CheckPHPSyntax()
setlocal makeprg=E:/Web/Server/PHP/php.exe\ -l\ -n\ -d\ html_errors=off
setlocal shellpipe=>
" Use error format for parsing PHP error output
setlocal errorformat=%m\ in\ %f\ on\ line\ %l
make %
endfunction
" Perform :PHP_CheckSyntax()
map :call CheckPHPSyntax()
"PHP代码美化
"map :!ZendCodeAnalyzer.exe %
"PHP代码通过Zend加密
function! ZendEncodePHP()
let currentfile=fnamemodify(bufname("%"), ":p")
let newfile=fnamemodify(bufname("%"), ":p:h") . "\\" .
fnamemodify(bufname("%"), ":t:r") . ".zend." . fnamemodify(bufname("%"),
":e")
execute "!\"E:\\Web\\Tools\\ZendGuard\\bin\\zendenc.exe\"" . ' ' . currentfile . ' ' . newfile
endfunction
map :call ZendEncodePHP()
"使用IE预览网页
function! BrowseWebPage()
let filepath=substitute(getcwd()."\\".bufname("%"), 'E:\\Web\\htdocs\\', "", "g")
let filepath=substitute(filepath,"\\","\/","g")
silent execute "!\"explorer\""." ".filepath
endfunction
map :call BrowseWebPage()
"F6打开或关闭nerd_tree和taglist
"由于nerd_tree和taglist采用了trinity插件打开
"所以具体的设置以trinity.vim为准
nmap :TrinityToggleTagListAndNERDTree
"F7单独切换打开nerd_tree(nerd_tree插件)
let g:NERDChristmasTree = 1 "色彩显示
let g:NERDTreeShowHidden = 1 "显示隐藏文件
let g:NERDTreeWinPos = 'left' "窗口显示位置
let g:NERDTreeHighlightCursorline = 0 "高亮当前行
nmap :TrinityToggleNERDTree
"netrw设置(自带目录树插件)
let g:netrw_winsize=30
let g:netrw_liststyle=1
let g:netrw_timefmt='%Y-%m-%d %H:%M:%S'
nmap :Sexplore!
"Ctrl + F7打开project插件
nmap :Project
"F8单独切换打开taglist(taglist插件)
if GetSystem() == "windows" "设定Windows系统中ctags程序的位置
let g:Tlist_Ctags_Cmd = $VIMRUNTIME.'\ctags'
else
let g:Tlist_Ctags_Cmd = '/usr/bin/ctags'
endif
"let g:Tlist_Sort_Type = 'name' "以名称顺序排序,默认以位置顺序(order)
let g:Tlist_Show_One_File = 1 "不同时显示多个文件的tag,只显示当前文件的
let g:Tlist_Exit_OnlyWindow = 1 "如果taglist窗口是最后一个窗口,则退出vim
lef g:Tlist_File_Fold_Auto_Close = 1 "当光标不在编辑文件里面的时候全部折叠
let g:Tlist_Use_Right_Window = 1 "在右侧窗口中显示taglist窗口
let g:Tlist_Enable_Fold_Column = 1 "显示折叠边栏
nmap :TrinityToggleTagList
"F11查看打开的文件列表(bufexplorer插件)
let g:bufExplorerDefaultHelp = 1
let g:bufExplorerDetailedHelp = 0
nmap :BufExplorer
"F12生成/更新tags文件
set tags=tags;
set autochdir
function! UpdateTagsFile()
silent !ctags -R --fields=+ianS --extra=+q
endfunction
nmap :call UpdateTagsFile()
"Ctrl + F12删除tags文件
function! DeleteTagsFile()
"Linux下的删除方法
"silent !rm tags
"Windows下的删除方法
silent !del /F /Q tags
endfunction
nmap :call DeleteTagsFile()
"退出VIM之前删除tags文件
"au VimLeavePre * call DeleteTagsFile()
阅读(1423) | 评论(0) | 转发(0) |