Skip to content

关于 Vim 中的搜索和替换

 {作用范围}s/{目标}/{替换}/{替换标志}
 %s/foo/bar/g 
 %是全局范围, g是全部替换
 :%s/foo/bar/gc
 回车后Vim会将光标移动到每一次"foo"出现的位置,并提示
  • 搜索当前词
    /foo\c

put the below in ~/.vimrc

” highlight
set hlsearch
” 设置默认进行大小写不敏感查找
set ignorecase
” 如果有一个大写字母,则切换到大小写敏感查找
set smartcase

Leave a Reply

Your email address will not be published.