2014年7月18日 星期五

vim 顯示行尾空白, 與tab 字元


良好的 coding style 是不允許行尾空白的儘管事後有很多方式可以自動刪除掉但如果可以在編輯的時候就看到行尾空白 也是很不錯的在.vimrc 貼上下列語法即可" High light unwanted spaces in end of linehighlight ExtraWhitespace ctermbg=darkred guibg=darkcyanautocmd BufEnter * if &ft != 'help' | match ExtraWhitespace /\s\+$/ | endifautocmd BufEnter * if &ft == 'help' | match none /\s\+$/ | endif


另一條良好的coding stype
則是用space 取代tab (因為tab 是不固定的字元數目, 容易造成混亂)
但Makefile 又必須使用tab 而不是space
所以還是有顯示tab 的必要

set listchars=tab:>>
set list



沒有留言:

張貼留言