vim 脚本之快速打印log
Posted 蚂蚁穴
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了vim 脚本之快速打印log相关的知识,希望对你有一定的参考价值。
" zsl_log.vim
" Version: 1.0
if exists("g:zsl_loaded_log") || &cp || v:version < 700
finish
endif
let g:zsl_loaded_log = 1
"基础函数
function AddLog()
let zslinde = max([indent(line(".")), indent(line(".")+1)])
let log = ‘android.util.Log.e("zhangshuli|exchange", "");‘
let curfile = expand("%:t:r")
let logline = line(".") + 1
let log = substitute(log, "exchange", curfile."|".logline, ‘‘)
call append(line("."), log)
echo indent(line("."))
echo indent(line(".")+1)
echo zslinde
+1
let col = stridx(log, ";")
call cursor(".", col-1)
call s:SetIndent(zslinde, line("."))
endfunction
"设置缩进
function! s:SetIndent(inde,curline)
if a:inde == 0
left 0
elseif a:inde == 2
left 2
elseif a:inde == 4
left 4
elseif a:inde == 6
left 6
elseif a:inde == 8
left 8
elseif a:inde == 10
left 10
elseif a:inde == 12
left 12
elseif a:inde == 14
left 14
elseif a:inde == 16
left 16
elseif a:inde == 18
left 18
elseif a:inde == 20
left 20
elseif a:inde == 22
left 22
elseif a:inde == 24
left 24
elseif a:inde == 26
left 26
elseif a:inde == 28
left 28
elseif a:inde == 30
left 30
endif
endfunction
以上是关于vim 脚本之快速打印log的主要内容,如果未能解决你的问题,请参考以下文章