linux - Vim - automatic open close braces and move cursor -
i'm new vim , right need simple thing:
(1)public class foo <open brace><hit enter> or (2)public class foo <hit enter><open brace><hit enter> to this
(1)public class foo{ |cursor here } or
(2)public class foo { |cursor here } my .vimrc is:
set smartindent set shiftwidth=4 set number inoremap { {<cr>}<left> appreciate help, thanks!
there many ways want: "smart" plugins autoclose or delimitmate or simpler custom mappings. here 1 way #1 1 find many alternatives (i've had few in ~/.vimrc):
inoremap {<cr> {<cr>}<c-o>==<c-o>o and here variation #2:
inoremap {{ <cr>{<cr>}<c-o>==<c-o>o but i'd suggest, if didn't already, try snipmate or ultisnips. both allow expand snippets , very useful when writing lots of boilerplate. example,
cla<tab> could become:
public class foo { | } think keypresses you'd save!
Comments
Post a Comment