" 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) execute (line(".")+1)." normal ==" call cursor(".", stridx(getline("."), ";")-1) endfunction
引用的话,只需要在.vimrc中配置如下内容即可
map <silent>lg :call AddLog()<cr>