forked from aniani/vim
patch 8.2.4907: some users do not want a line comment always inserted
Problem: Some users do not want a line comment always inserted.
Solution: Add the '/' flag to 'formatoptions' to not repeat the comment
leader after a statement when using "o".
This commit is contained in:
@@ -278,6 +278,18 @@ func Test_format_c_comment()
|
||||
//
|
||||
END
|
||||
call assert_equal(expected, getline(1, '$'))
|
||||
3delete
|
||||
|
||||
" No comment repeated with a slash in 'formatoptions'
|
||||
set fo+=/
|
||||
normal 2Gox
|
||||
let expected =<< trim END
|
||||
nop;
|
||||
val = val; // This is a comment
|
||||
x
|
||||
END
|
||||
call assert_equal(expected, getline(1, '$'))
|
||||
set fo-=/
|
||||
|
||||
" using 'indentexpr' instead of 'cindent' does not repeat a comment
|
||||
setl nocindent indentexpr=2
|
||||
|
||||
Reference in New Issue
Block a user