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

vim 脚本之快速打印log

时间:2016-04-01 06:29:37      阅读:168      评论:0      收藏:0      [点我收藏+]

标签:

" 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

标签:

原文地址:http://www.cnblogs.com/zhangshuli-1989/p/zsl_2016_04_010233.html

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