3
我使用AppendModeline功能模式行添加到我的VIM文件:有沒有辦法在vim中獲取布爾選項的字符串表示?
" Append modeline after last line in buffer. " Use substitute() instead of printf() to handle '%%s' modeline in LaTeX " files. function! AppendModeline() let l:modeline = printf(" vim: set ts=%d sw=%d tw=%d :", \ &tabstop, &shiftwidth, &textwidth) let l:modeline = substitute(&commentstring, "%s", l:modeline, "") call append(line("$"), l:modeline) endfunction
但我想擴展它。它應支持添加當前值expandtab。
使用& expandtab,我可以得到當前值的數字表示。但是像set et = 0不支持vim。它必須是設置[no] expandtab。
難道我真的要測試& expandtab和追加expandtab或noexpandtab到升:模式行還是有一種方式來獲得當前值的字符串表示?
set expandtab?顯示[no] expandtab,但我不知道如何在腳本中使用它(或者甚至可能)。