8

Assume buffer content:

aa bb
yy xx
aa bb

What's the different between /xx and :/xx?

  • I was discussing this with BLayer in another question, he think it's bad to hijack that question, so i open this question. – dedowsdi Nov 20 at 2:57
  • Yeah, I felt bad as it was a first time poster and there was a wall of mostly off-topic comments distracting from the question. Anyways, it looks like you uncovered an extra layer of nuance to this. I'll take a closer look when I get back later. – B Layer Nov 20 at 3:05
9

/xx place cursor at xx, it's a :h / .

:/xx is a :h :[range] , not :h :range , it's a valid ex command by itself, it's behavior is affected by :h 'startofline' .

If 'startofline' is on (default), :/xx place cursor at 1st non-blank of the line that contain xx, it's the leading y in this case.

If 'startofline' is off, :/xx move cursor to the matching line without moving the column if possible (you have to move the column if target line is too short).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.