vim - Justify text in visual block -
is there way in vim justify text within visual block?
p.e. partial example of file:
text text |5 sm 23 | text text |1274 hc a4| text text | 33 rnd bc| text text | 28 yz 22 | text text |9808 yz 56|
expected output:
text text 5 sm 23 text text 1274 hc a4 text text 33 rnd bc text text 28 yz 22 text text 9808 yz 56
i enabled virtualedit: :set virtualedit=all
.
added column spaces (at right |
in example) in order create 2 spaces after "23" , 1 space after "22".
selected visual block , executed command :'<,'>ce
without expected output.
what describe commonly called justify (to left , right margins adding inner whitespace); whereas center adds whitespace left , right have equal amounts.
there 2 plugins justifying entire lines:
$vimruntime/macros/justify.vim
ships vim- justify plugin provides simple implementation
as want applied blockwise selection, have delete blockwise selection, put them separate lines / scratch buffer, justify (to original width of selection), yank , insert block again. (for those, unconditionalpaste plugin provides handy glp
, gbp
mappings.) depending on how need this, either apply manually, or try automate via custom mapping.
Comments
Post a Comment