我在这上面找到了一些线索,但它们是三年前的。有没有人推荐Vim的插件,这样当我输入{时,它就可以了:
{
::cursor here::
}另一件有帮助的事情是
if(::cursor here::)在键入if之后。
发布于 2010-01-27 02:31:22
查看snipMate插件。它是非常可定制的。有一个很好的screen-cast展示了插件的实际操作。
例如,在C中使用snipMate插件。
if<Tab>
would produce:
if (::cursor:1::) {
::cursor:2::
}第一个会将光标放在:: cursor :1::,第二个会将您带到::cursor:2::。
对于snipMate中的bash脚本,应该有一些类似的东西,如果没有,添加一个非常简单。
发布于 2010-01-27 01:50:30
我使用delimiteMate.vim。它以一种可配置且不烦人的方式处理此问题。
发布于 2010-01-27 01:35:30
我使用以下代码(php-template):
function! EatChar()
let l:char=getchar(0)
return ''
endfunction
inoreabbrev function_ function <ESC>maa()<CR>{<CR><CR>}<ESC>`aa<C-O>:call EatChar()<CR>
inoreabbrev if_ if (<ESC>maa)<CR>{<CR><CR>}<ESC>`aa<C-O>:call EatChar()<CR>
inoreabbrev ifelse_ if (<ESC>maa)<CR>{<CR><CR>}<CR>else<CR>{<CR><CR>}<ESC>`aa<C-O>:call EatChar()<CR>
inoreabbrev for_ for (<ESC>maa; ; )<CR>{<CR><CR>}<ESC>`aa<C-O>:call EatChar()<CR>
inoreabbrev foreach_ foreach (<ESC>maa as $key=>$value)<CR>{<CR><CR>}<ESC>`aa<C-O>:call EatChar()<CR>
inoreabbrev while_ while (<ESC>maa)<CR>{<CR><CR>}<ESC>`aa<C-O>:call EatChar()<CR>
inoreabbrev <? <?php <ESC>maa ?><ESC>`aa<C-O>:call EatChar()<CR>https://stackoverflow.com/questions/2141012
复制相似问题