Vim map for C/C++ case statements -


i want create mapping in vim following scenario:

case blah: -->

hit enter -->

case blah:{  }break; 

i tried this:

inoremap case<space><expression>:<cr> case<space><expression>:{<cr>}break;<esc>ko 

but don't know put "expression". put there? more complicated this? thanks!

you may want have @ switch , case snippets mu-template/lh-cpp, , switch generator enum. either case automatically filled enum, or use placeholder can jump to.

otherwise, ideal (simple) solution map enter , detect context case\s\+\s\+:\s*. in case insert {\n}\nbreak;\<up>\<up>\<c-f>. mapping may have recognize enter within pair of {} , on.


Comments

Popular posts from this blog

html - Styling progress bar with inline style -

java - Oracle Sql developer error: could not install some modules -

How to use autoclose brackets in Jupyter notebook? -