相关疑难解决方法(0)

重新格式化Python文件以具有4个空格缩进

我正在编辑一个Python文件,它使用两个空格进行编程缩进 - 我更喜欢4个空格.在我的.vimrc中,我有以下与缩进相关的设置:

set tabstop=4                     "Indentation levels every four columns
set expandtab                     "Convert all tabs typed to spaces
set shiftwidth=4                  "Indent/outdent by four columns
set softtabstop=4
Run Code Online (Sandbox Code Playgroud)

如何让Vim将所有现有的2个空格缩进转换为4个空格缩进?

换一种说法:

if something:
  dothis()
Run Code Online (Sandbox Code Playgroud)

if something:
    dothis()
Run Code Online (Sandbox Code Playgroud)

当我尝试gg = G.

def check():
  for a in list:
    for  b in list2:
      check(a, b)
      while (len > MAX) :
        poll()

  while(len(thelist) > 0) :
    poll()  

  return results
Run Code Online (Sandbox Code Playgroud)

成为

def check():
    for a in list:
    for  b in list2:
    check(a, b)
    while (len > MAX) …
Run Code Online (Sandbox Code Playgroud)

python vim

22
推荐指数
3
解决办法
2万
查看次数

标签 统计

python ×1

vim ×1