Tuesday, January 5, 2021

how to replace selected text using keyboard shortcut

Dear all,

Sorry if this question is already asked before, but googling does not give enough result, maybe wrong search key.

what i want to do is:
- select text using mouse/trackpad (i'm in wondows).
- press some control-key to replace that text.

example, i have following line in file:
===
one
two
three
===

result:
===
<h1>one</h1>
<h2>two</h2>
three
===

usually what i am doing is:
:%s'one'<h1>one</h1>'
:%s'two'<h2>two</h2>'

can i change with:
1. select 'one' with mouse
2. Press <Ctrl-B> (or some other combination) to convert it to <h1>one</h1>.
So Ctrl-B is associated with <h1> and </h1> tag.
3. select 'two' with mouse
4. press Ctrl-2 (or other combination) to convert to '<h2>two</h2>'.
Ctrl-2 is associated with <h2> and </h2> tag.

thanks.


--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/8b436976-3a1d-49d6-b579-f870105dcac6n%40googlegroups.com.

No comments: