如何配置 vim 以便我可以一次删除一个选项卡而不是整个选项卡?当我尝试为 if 语句对齐多个测试时,我经常想这样做。在下面的示例中,condition3 按我的意愿对齐,而 condition2 由于制表符而关闭了一个空格。
if condition1 or \
condition2 or \
condition3:
do something
我在 OSX 10.6.7 上使用 vim 7.2.108,我的代码文件中有以下模式行:
# ex: tabstop=4 softtabstop=1 shiftwidth=4 expandtab:
FWIW,此模式行允许我使用箭头键一次一个空格地浏览选项卡。
更新:这是我对来自 Bram Mooleanar 的示例 vimrc 文件所做的更改:
map z :w<cr>
map q :q!<cr>
map m :make<cr>
set expandtab
set shiftwidth=4
set tabstop=4
set bs=2 " backspace over anything in insert mode
set showmatch " display the matching bracket of the pair
set nowrap " don't wrap line to fit window
set showmatch " show matching paren, bracket, or brace
set ruler " show current cursor position at bottom
set incsearch " show next match as you type in search pattern
set ignorecase
set smartcase
syntax on " enable syntax highlighting
最佳答案
我会说把它放在你的 .vimrc 文件中:
set expandtab
当您按下 Tab 键时,这基本上会将制表符变成空格。
关于python - 一次删除一个空格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5808089/