替換檔案中的 tab 為 whitespace
如果有設定好 .vimrc,進入 vim 的命令模式輸入:retab
搜尋並取代
進入命令模式,輸入
:1,$s/hello/hi/g將字串 hello 換成 hi。1,$表示從頭到尾。
:retab
:1,$s/hello/hi/g將字串 hello 換成 hi。1,$表示從頭到尾。
$vim ~/.vimrc2. 輸入以下內容
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab
set smarttab