New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'indentexpr' が設定されているのに 'smartindent' を設定すると挙動が変わる #1062

Closed
h-east opened this Issue Aug 2, 2017 · 4 comments

Comments

Projects
None yet
2 participants
@h-east
Member

h-east commented Aug 2, 2017

質問・報告の内容

発端
teratail: Vimのオートインデントがコメントアウトで無効になる

Vim起動

$ cat aaa.py
def hoge()
    print('Hello world.')
$ vim --clean aaa.py

Vimの設定を確認

:verbose set indentexpr
  indentexpr=GetPythonIndent(v:lnum)
        Last set from ~/product/github/vim/runtime/indent/python.vim
:set si?
nosmartindent

以下のコマンドを実行

Go#<Esc>

結果 (期待通り)

def hoge()
    print('Hello world.')
    #

設定変更

set smartindent

以下のコマンドを実行

Go#<Esc>

結果 (期待と異なる)

def hoge()
    print('Hello world.')
    #
#                          ← 何で?

期待値

def hoge()
    print('Hello world.')
    #
    #

根拠

:h 'si
			     *'smartindent'* *'si'* *'nosmartindent'* *'nosi'*
'smartindent' 'si'	切替	(既定ではオフ)
	~
	'cindent' がオンか 'indentexpr' が設定されているときは  'si' をオンにし
	ても効果はない。

Vimのバージョン

8.0.0839

@h-east h-east self-assigned this Aug 2, 2017

@h-east

This comment has been minimized.

Show comment
Hide comment
@h-east

h-east Aug 2, 2017

Member

patch
https://gist.github.com/h-east/aa38a9e1da23a7ccc69417bc174177e4

make testはALL DONEです。
test足さなきゃ。。

Member

h-east commented Aug 2, 2017

patch
https://gist.github.com/h-east/aa38a9e1da23a7ccc69417bc174177e4

make testはALL DONEです。
test足さなきゃ。。

@k-takata

This comment has been minimized.

Show comment
Hide comment
@k-takata

k-takata Aug 2, 2017

Member

'cindent' か 'indentexpr' がオンのときは 'si' をオンにしても効果はない。

訳がおかしかったので修正しておきました。 vim-jp/vimdoc-ja-working@0d87d4f

Member

k-takata commented Aug 2, 2017

'cindent' か 'indentexpr' がオンのときは 'si' をオンにしても効果はない。

訳がおかしかったので修正しておきました。 vim-jp/vimdoc-ja-working@0d87d4f

@h-east

This comment has been minimized.

Show comment
Hide comment
@h-east
Member

h-east commented Aug 3, 2017

test追加してvim_devに送付。
https://groups.google.com/d/msg/vim_dev/i9DXyGKjrzI/CLoWxJs-BgAJ

@k-takata

This comment has been minimized.

Show comment
Hide comment

@k-takata k-takata closed this Aug 3, 2017

@k-takata k-takata added the xlose/fixed label Aug 3, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment