This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
Vim editing magic question. How can I delete a variable amount of space between the two columns of text and repeat that for a very long list, e.g in dot-repeat or macro. Assume all text in the second column starts with different characters or numbers), A small example
DeLaGuardo/setup-clojure 12.5
actions/cache v4.0.2
clj-kondo/clj-kondo 2024.05.24
I am aware I can use E
to jump to the last character of the first column, but then what command can I use to remove all the whitespace up to the next column (except 1 whitespace preferably - although I can use l
to move before deleting the whitespace).
I suspect the answer will be substitution & regex...if you're on the first space after the symbol, something like cw<space>
should delete all of the whitespace until the next word and enter Insert mode and then insert a space.
I had tried dw
and it didnt work, but maybe I had pressed something else before. Now I try again it works (which I thought it should)... no idea why it didnt work before.
cw<space> is nice.
Thanks.
I normally just use a visual block selection in a situation like this definitely curious if someone else has a better (or less "interactive") solution
I suspect the answer will be substitution & regex...Can do :s/ \+/ /
(fixed as Noah suggested)
lol make sure it's +, so it matches at least one
I also used https://github.com/junegunn/vim-easy-align in the past