[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: 推荐一个vim技巧的网址。



vim 不是有自己的邮件列表吗?不用放到 Debian 来吧?




+++ gaochao [17/02/04 10:25 +0800]:
> 这个是我几天前发的,好像没有到邮件列表上去,再发
> 
> vim.org上不了,但是vim.sourceforge.net可以上,看看它的tips,真的非常有用哦。
> 像下面这个,对于编程中成对出现的 "" '' [] {} 等很有用。
> http://vim.sourceforge.net/tips/tip.php?tip_id=153
> 为了防止以后上不了sourceforge,在这儿我也贴上一个。
> 
> inoremap ( ()<ESC>i
> inoremap [ []<ESC>i
> inoremap { {<CR>}<ESC>O
> autocmd Syntax html,vim inoremap < <lt>><ESC>i| inoremap >
> <c-r>=ClosePair('>')<CR>
> inoremap ) <c-r>=ClosePair(')')<CR>
> inoremap ] <c-r>=ClosePair(']')<CR>
> inoremap } <c-r>=CloseBracket()<CR>
> inoremap " <c-r>=QuoteDelim('"')<CR>
> inoremap ' <c-r>=QuoteDelim("'")<CR>
> 
> function ClosePair(char)
> if getline('.')[col('.') - 1] == a:char
> return "\<Right>"
> else
> return a:char
> endif
> endf
> 
> function CloseBracket()
> if match(getline(line('.') + 1), '\s*}') < 0
> return "\<CR>}"
> else
> return "\<ESC>j0f}a"
> endif
> endf
> 
> function QuoteDelim(char)
> let line = getline('.')
> let col = col('.')
> if line[col - 2] == "\\"
> "Inserting a quoted quotation mark into the string
> return a:char
> elseif line[col - 1] == a:char
> "Escaping out of the string
> return "\<Right>"
> else
> "Starting a string
> return a:char.a:char."\<ESC>i"
> endif
> endf
> 
> 
> 
> -- 
> To UNSUBSCRIBE, email to debian-chinese-gb-request@lists.debian.org
> with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
> 
> 



Reply to: