最近突然对纯文本编辑比较感兴趣,Google了一下,没有发现什么好的Win下可用的纯文本编辑器支持直接的表格编辑
于是想到了Vim
下面的就是用Vim编辑的一个示范例子
=============================================================================== Name Description Remark AA Test OK BB Good Great ——————————————————————————– |
为了简便快速的编辑这个表格,需要编辑一下我们的_vimrc文件或其子配置文件
下面的代码摘自我的配置文件
map map! ” function: NextField ” Args: fieldsep,minlensep,padstr,offset ” ” NextField checks the line above for field separators and moves the cursor on ” the current line to the next field. The default field separator is two or more ” spaces. NextField also needs the minimum length of the field separator, ” which is two in this case. If NextField is called on the first line or on a ” line that does not have any field separators above it the function echoes an ” error message and does nothing.func! NextField(fieldsep,minlensep,padstr,offset) let curposn = col(“.”) let linenum = line(“.”) let prevline = getline(linenum-1) let curline = getline(linenum) let nextposn = matchend(prevline,a:fieldsep,curposn-a:minlensep)+1 let padding = “”</p>
if nextposn > strlen(prevline) || linenum == 1 || nextposn == 0 echo “”
if nextposn > strlen(curline) 现在这个简单的表格的编辑过程如下所列:
1. 80i=
2. Name Description Remark
3. AA
4. BB
5. 80i-
上面的配置文件参考这里:http://www.vim.org/tips/tip.php?tip_id=547
|