On 07/03/2011 02:18 AM, meino.cra...@gmx.de wrote:
Xiaopan Zhang<zhangxiao...@gmail.com>  [11-07-03 09:08]:
I can use the following key strokes 'd/_variable + 7<CR>', will does
the job precisely, However, one problem is that after the deletion,
'_variable + 7' will be highlighted if it occurs in other places in
the same file, which is undesirable.

I have "another" solution for that problem: Do not search!
(No I am not kidding ... :) 8) ;)

The string is:
new_variable = old_badname_variable + some_other_variable + 7

The cursor is at the beginning of "_badname" (over _)
or at "badname" (over b)

Without entering the commandline with ':' type
ct<space>
for<space>  type a space not the characters of '<space>'
then enter your repacement string
hit escape

While there's not much to add to Meino's suggestion, just for another spin on the t/T/f/F solution, in your scenario, I'd use either

  d2fr
  d3t_

which will delete up to (and including) the 2nd "r" and delete up to (but not including) the 3rd underscore. Usually when I aim to do this, there are only a couple delimiters I need to count (if it goes over about 3, I usually shift to another solution like searching)

map<f5>  :nohlsearch<CR>

Since I don't use it often, I don't map it, but Vim does allow you to be lazy and just type

  :noh

to get the same effect. However, if you regularly want to turn it off temporarily, Meino's mapping will do the trick.

-tim


--
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

Reply via email to