Saturday, 15 August 2015

Swap a word in vim with adjacent quoted word -



Swap a word in vim with adjacent quoted word -

i'm dealing markdown text right having swap current word adjacent word surrounded in backticks common:

for example:

from bundle `net/http`

becomes:

from `net/http` package

how switch current word adjacent word in backticks?

with cursor anywhere on line type following: 0f`da`bhp

you can save mapping using :nnoremap <leader>s 0f`da`bhp, phone call using <leader>s

or, create mapping using qs0f`da`bhpq, phone call using @s

0 go start of line f` go next ` da` delete around `. deleted text in " register b go backwards start of previous word h go on space right (to maintain spacing) p paste test in " register before cursor

vim

No comments:

Post a Comment