Vim Searching – Advanced Tips

Summary of Commands

# Toggle 'hlsearch' option
:set hls
:set nohls

# Toggle 'ignorecase' option
:set ignorecase
:set noignorecase

# Clear screen of ALL highlighted matches
# with command 'nohls'
:nohls

# Remove "S" from 'shortmess' option
:set shortmess-=S

# Make pattern case-insensitive
# Assumes ':set noignorecase'
/the\c

# Make pattern case-sensitive
# Assumes ':set ignorecase'
/the\C

Leave a comment