Wiki

by yszheda

View project onGitHub

Tip 49: Find by Character

Return to the top: <<Practical Vim>>

References

# If you open the file in vim,
# then you can \"ayy@a the next line to execute the vim command: 
:h f

References

# If you open the file in vim,
# then you can \"ayy@a the next line to execute the vim command: 
:h ;

References

# If you open the file in vim,
# then you can \"ayy@a the next line to execute the vim command: 
:h ;

Don't Throw Away the Reverse Character Search Command

noremap <Leader>n nzz
noremap <leader>N Nzz

References

# If you open the file in vim,
# then you can \"ayy@a the next line to execute the vim command: 
:h zz

The default leader key is \.

Character Searches Can Include or Exclude the Target

Command Effect
f{char} Forward to the next occurrence of {char}
F{char} Backward to the previous occurrence of {char}
t{char} Forward to the character before the next occurrence of {char}
T{char} Backward to the character before the previous occurrence of {char}
; Repeat the last character-search command
, Reverse the last character-search command

Preference:

  • f/F in Normal mode
  • t/T in Operator-Pending mode