On Tuesday, July 31, 2012 1:58:55 PM UTC-5, Daan wrote:
> I've been learning Vim for a while, and one situation has been coming up a lot for me:
>
> 1) I'm scrolling through a sourcefile, and see an interesting word I'd like to edit or yank.
> 2) I look left at the line number of the word, and type [line number]G
> 3) I keep pressing w/W/b/B until I reach the word, (except if the word happens to be the first or last word of the line, or located near a unique symbol)
>
> However, this feels inefficient (especially step 2), and I'm hoping to find a better solution.
>
> Some things I think might be possible, but have no experience with:
> - Use H/M/L to move roughly to the line, then 0/gm/$ to move roughly to the column, then using small motions to get to the final spot.
> - Learn to guess [number]j/h/k/l way better (perhaps with relative line numbers) to do something like "7j33l".
> - Use / and type characters until it matches, then press enter.
> - Use the easy motion plugin.
>
> Please comment on the above or share your method. :)
I almost always have relative line numbering turned on, which as you mentions allows me to very quickly do 7j or 12k or whatever to get to the right line.
Then I will usually use f, F, t, or T, or a / search, or w/W/b/B to get to the correct column, possibly with an initial _ or g_ to position the cursor at the beginning or end of the line (or ^ and $, but I use Dvorak making _ and g_ much faster to reach).
Using f/F/t/T is nice because I can follow it up with ; or , if I didn't supply the right count, and I have a mapping which will highlight all the matching characters within the line so I can quickly get the count right on my second try if needed.
I keep forgetting about gm, I should start using that one more.
--
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
No comments:
Post a Comment