Vim static word wrap interactive 'smart' rebuilding -
am long time kate
user switching vim
.
wonder whether vim
has activable option (or has been coded plugin) 'smartly' apply static word wrap large strings when coding major languages: c/c++, java, python, php, (more follow).
not while writing while applying indentation modification visual text block, or (un)?commenting it. let have pseudo-java situation like:
1 string loremipsum = "lorem ipsum dolor sit amet, consectetur adipi" + 2 "sicing elit, sed eiusmod tempor incididunt ut " + 3 "labore et dolore magna aliqua. ut enim ad minim v" + 4 "eniam, quis nostrud exercitation ullamco laboris " + 5 "nisi ut aliquip ex ea commodo consequat. duis aut" + 6 "e irure dolor in reprehenderit in voluptate velit" + 7 " esse cillum dolore eu fugiat nulla pariatur. exc" + 8 "epteur sint occaecat cupidatat non proident, sunt" + 9 " in culpa qui officia deserunt mollit anim id est" + 10 " laborum."; ~
at point want add or remove indentation levels, relying in editor rebuild whole language provisioned string our static word wrap rules. suppose reason desirable remove 2 spaces of indentation, desired output be:
1 string loremipsum = "lorem ipsum dolor sit amet, consectetur adipisi" + 2 "cing elit, sed eiusmod tempor incididunt ut labo" + 3 "re et dolore magna aliqua. ut enim ad minim veniam," + 4 " quis nostrud exercitation ullamco laboris nisi ut " + 5 "aliquip ex ea commodo consequat. duis aute irure do" + 6 "lor in reprehenderit in voluptate velit esse cillum" + 7 " dolore eu fugiat nulla pariatur. excepteur sint oc" + 8 "caeact cupidatat non proident, sunt in culpa qui of" + 9 "ficia deserunt mollit anim id est laborum."; ~
which tool constructed vim
?
with vim, gq
command reformats lines; can done as-you-type :set formatoptions+=a
.
unfortunately, vim's built-in capabilities limited basic stuff (see :help fo-table
); elaborate , language-specific formatters meant provided external programs ('formatprg'
), or vimscript ('formatexpr'
), latter 1 haven't seen used yet.
so, if you're lucky you'll find external code formatter program can integrated, or you'll have write such thing yourself.
Comments
Post a Comment