top | item 8462291

Ask HN: Bash vi readline mode, incremental search in line

1 points| aabajian | 11 years ago

Hi all,

I've been playing around with Vi mode in Bash, see:

http://www.catonmat.net/download/bash-vi-editing-mode-cheat-sheet.pdf

What I really want to do is put the cursor on a substring within my current line. So for example, if I have a long command like:

cat words | grep '100.00' | grep '111' | sort[]

where [] is the cursor position. I want to move the cursor to the 1 in '100.00'. My options are:

1. Press the back arrow 30 times. 2. Using Vi readline mode, press ESC then 'b' 11 times. 3. Using Vi readline mode, press ESC, then 'F1' four times (the F1 commands moves backward to the next occurrence of 1).

Within Vi I could search for the 100 by doing /100 but to my surprise this causes Bash to search the history, not the current line. How can I get an incremental search of the current line?

discuss

order

No comments yet.