跟之前在vs2008里面写的那个格式化插件一样的功能。
效果:
格式化之前
格式化之后
vim脚本代码:
" copy this code in your "vimrc" file
" use visual mode to select the code snippets and press 'f', that's all!
vmap f <ESC>: call FormatDefine()<CR>
function! FormatDefine()
let [lnum1, col1] = getpos("'<")[1:2]
let [lnum2, col2] = getpos("'>")[1:2]
let lines = getline(lnum1, lnum2)
if (1 == col2)
let lnum2 -= 1
endif
let array = []
let max_len_part1 =......
阅读全文