diff options
author | Brad King <brad.king@kitware.com> | 2020-04-06 16:12:00 -0400 |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2020-06-23 19:07:33 -0400 |
commit | 357c16515c13eac99c5f2bc1ba5ac1ccc8afceec (patch) | |
tree | 08b2ab88415bdb26baf2e1ea9c1449ff3a9d9adf /runtime/lua/vim/lsp/buf.lua | |
parent | ee3605aed450f6ee7fe8fd62ed372e1aa3919c4c (diff) | |
download | rneovim-357c16515c13eac99c5f2bc1ba5ac1ccc8afceec.tar.gz rneovim-357c16515c13eac99c5f2bc1ba5ac1ccc8afceec.tar.bz2 rneovim-357c16515c13eac99c5f2bc1ba5ac1ccc8afceec.zip |
vim-patch:8.2.0865 syntax: Add command to control how foldlevel is computed
Problem: Syntax foldlevel is taken from the start of the line.
Solution: Add ":syn foldlevel" to be able to use the minimal foldlevel in the line.
https://github.com/vim/vim/commit/e35a52aee718c881bdfa69a47a1068df6ab6c60a
With `foldmethod=syntax` the foldlevel of a line is computed based
on syntax items on the line. Previously we always used the level
of the syntax item containing the start of the line. This works
well in cases such as:
if (...) {
...
}
else if (...) {
...
}
else {
...
}
which folds like this:
+--- 3 lines: if (...) {---------------------------
+--- 3 lines: else if (...) {----------------------
+--- 3 lines: else {-------------------------------
However, the code:
if (...) {
...
} else if (...) {
...
} else {
...
}
folds like this:
+--- 7 lines: if (...) {---------------------------
We can make the latter case fold like this:
+--- 2 lines: if (...) {---------------------------
+--- 2 lines: } else if (...) {--------------------
+--- 3 lines: } else {-----------------------------
by choosing on each line the lowest fold level that is followed
by a higher fold level.
Add a syntax command
:syntax foldlevel [start | minimum]
to choose between these two methods of computing the foldlevel of
a line.
Diffstat (limited to 'runtime/lua/vim/lsp/buf.lua')
0 files changed, 0 insertions, 0 deletions