replace - vim: delete all words on line except last -
i'm having trouble coming vim find/replace delete words on line except last one, i.e. in bit of sql, nice generate list of aliases bunch of code
select column_a alias_a, column_b alias_b, column_c alias_c ... i'd generate list
alias_a, alias_b, alias_c so think want delete words aren't followed comma , line ending
option 1:
%s/\v.*\s(\s+)$/\1/ option 2: using macro
qa$t d0jq then x@a x how many lines want apply macro
option 3
turn external command:
:%!awk '$0=$nf' option 4: if have align or similar plugin, align lines right, use c-v block select , remove, leave last column.
Comments
Post a Comment