Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

is there any way to move between lines by first letter in vim as we usually did by using the "f+letter" in the current line, Example:

 din          (tuple_hash_ack_data),       
 wr_en        (tuple_hash_ack_wr),        
 dout         (ack_fifo_data),       
 rd_en        (ack_fifo_rd),       
 empty        (ack_fifo_empty),        
 data_count   (tuple_hash_count),      
 almost_full  (tuple_hash_almost_full)  

At first the cursor is stop at the first line:

   din          (tuple_hash_ack_data),  

I want to jump to the line:

   almost_full  (tuple_hash_almost_full)   

I want to type something like "fa", is it possible?

share|improve this question

migrated from stackoverflow.com Jan 15 '13 at 10:09

This question came from our site for professional and enthusiast programmers.

2  
What's wrong with /^a? –  adamdunson Jan 15 '13 at 3:51
    
I am not sure if this is an answer or comment, so I just put it here. I suggest you try the plugin easyMotion. With this plugin you could move to any letter/character or word on your screen very fast. –  Kent Jan 15 '13 at 9:45
add comment

3 Answers

/^a will get you to the next line starting with "a"- in regular expression syntax, ^ matches the start of a line, so /^a searches for the start of a line, immediately followed by a.

share|improve this answer
add comment

Especially with :set relativenumber, navigating to the start of a nearby line can be done via [count]_ (down) and [count]- (up). Note that commands like j and k can be prefixed with a [count], too.

share|improve this answer
add comment

When it comes to moving in the window you should give the plugin preciseJump a chance. I use it with the mappings:

nnoremap ,f :call PreciseJumpF(-1, -1, 0)<CR>
vnoremap ,f <ESC>:call PreciseJumpF(-1, -1, 1)<CR>
onoremap ,f :call PreciseJumpF(-1, -1, 0)<CR>

so I type ,f followed by a char and all occurrences of that char are highlighted. I just type the corresponding char and the cursor jumps there.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.