diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2018-06-05 02:20:38 -0400 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2018-06-05 08:20:38 +0200 |
commit | b2633bba732a4ddd8f847b2bd445e53f93fa5d60 (patch) | |
tree | ef6d8e02b508887288bf031bb15cba7326801a15 | |
parent | cf92a76285f7bc3823ea45c4ced9085a4fe8e362 (diff) | |
download | rneovim-b2633bba732a4ddd8f847b2bd445e53f93fa5d60.tar.gz rneovim-b2633bba732a4ddd8f847b2bd445e53f93fa5d60.tar.bz2 rneovim-b2633bba732a4ddd8f847b2bd445e53f93fa5d60.zip |
vim-patch:8.0.0851: 'smartindent' is used even when 'indentexpr' is set (#8481)
Problem: 'smartindent' is used even when 'indentexpr' is set.
Solution: Ignore 'smartindent' when 'indentexpr' is set. (Hirohito Higashi)
https://github.com/vim/vim/commit/69a76feda9e9d308be6b5fc2185286a061dfecd6
---
This also fixes "delfunction!" which was not merged fully in a185ab70fd2eb8d55 (vim-patch:8.0.0655)
-rw-r--r-- | src/nvim/ex_cmds.lua | 2 | ||||
-rw-r--r-- | src/nvim/misc1.c | 3 | ||||
-rw-r--r-- | src/nvim/testdir/test_smartindent.vim | 27 |
3 files changed, 30 insertions, 2 deletions
diff --git a/src/nvim/ex_cmds.lua b/src/nvim/ex_cmds.lua index ce02808ad3..4e46c5ce45 100644 --- a/src/nvim/ex_cmds.lua +++ b/src/nvim/ex_cmds.lua @@ -698,7 +698,7 @@ return { }, { command='delfunction', - flags=bit.bor(NEEDARG, WORD1, CMDWIN), + flags=bit.bor(BANG, NEEDARG, WORD1, CMDWIN), addr_type=ADDR_LINES, func='ex_delfunction', }, diff --git a/src/nvim/misc1.c b/src/nvim/misc1.c index 28455f0ba9..dc59aa1281 100644 --- a/src/nvim/misc1.c +++ b/src/nvim/misc1.c @@ -106,7 +106,8 @@ open_line ( char_u *p; char_u saved_char = NUL; // init for GCC pos_T *pos; - bool do_si = (!p_paste && curbuf->b_p_si && !curbuf->b_p_cin); + bool do_si = (!p_paste && curbuf->b_p_si && !curbuf->b_p_cin + && *curbuf->b_p_inde == NUL); bool no_si = false; // reset did_si afterwards int first_char = NUL; // init for GCC int vreplace_mode; diff --git a/src/nvim/testdir/test_smartindent.vim b/src/nvim/testdir/test_smartindent.vim index d00eac9798..9e93a55eb0 100644 --- a/src/nvim/testdir/test_smartindent.vim +++ b/src/nvim/testdir/test_smartindent.vim @@ -1,3 +1,4 @@ +" Tests for smartindent " Tests for not doing smart indenting when it isn't set. function! Test_nosmartindent() @@ -12,3 +13,29 @@ function! Test_nosmartindent() call assert_equal(" #test", getline(1)) enew! | close endfunction + +function MyIndent() +endfunction + +" When 'indentexpr' is set, setting 'si' has no effect. +function Test_smartindent_has_no_effect() + new + exe "normal! i\<Tab>one\<Esc>" + set noautoindent + set smartindent + set indentexpr= + exe "normal! Gotwo\<Esc>" + call assert_equal("\ttwo", getline("$")) + + set indentexpr=MyIndent + exe "normal! Gothree\<Esc>" + call assert_equal("three", getline("$")) + + delfunction! MyIndent + set autoindent& + set smartindent& + set indentexpr& + bwipe! +endfunction + +" vim: shiftwidth=2 sts=2 expandtab |