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 [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/8b436976-3a1d-49d6-b579-f870105dcac6n%40googlegroups.com. |
You can get a powerful solution with a plugin such as surround.vim. If you really want to do it just for this, you could do something like the following (untested code): vnoremap <c-b> <esc> `>a</h1><esc>`<i<h1><esc> I'm on my mobile phone, so can't confirm that this will work at the end of the line, but I think it will. -- Salman On Wed, Jan 6, 2021, 02:12 Pengembara T. <[hidden email]> wrote:
-- 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 [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CANuxnEdXqQ1fMMTfY-Jgq2q2GJ79RseWiNLA_GvROD7AojBQJw%40mail.gmail.com. |
Free forum by Nabble | Edit this page |