gpt4 book ai didi

python - 关于vim的使用,在插入注释符时(eg. #)

转载 作者:太空宇宙 更新时间:2023-11-04 03:34:04 27 4
gpt4 key购买 nike

系统:ubuntu 14.04.2

我用vim7.4写python代码,有时候想插入一个'#'(注释),然后vim把这个'#'放到行首。可能我没有解释清楚。例子:代码:

if 'test' == 'abc':
print 'something'

我想在第二行插入一个'#'。然后会发生这种情况:

if 'test' == 'abc':
# print 'something'

这是自动发生的。

但是我想做的就是这样:

if 'test' == 'abc':
# print 'something'

最佳答案

散列字符 # 的缩进有问题:http://vim.wikia.com/wiki/Restoring_indent_after_typing_hash

Q: Why does Vim place # at the first column?

A: You are using 'smartindent', or you have 0# in your 'cinkeys' or 'indentkeys' options.

Under some circumstances, when you type a '#' character while in insert mode, the indent on the current line will be removed. Also, formatting or otherwise attempting to adjust the indent of a line starting with '#' may not work as you expect.

This tip discusses the issues and how problems can be avoided.

关于python - 关于vim的使用,在插入注释符时(eg. #),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29909230/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com