garbas / vim-snipmate

snipMate.vim aims to be a concise vim script that implements some of TextMate's snippets features in Vim.
www.vim.org/scripts/script.php?script_id=2540
2.01k stars 181 forks source link

Folds inserted by a snippet are left closed #276

Closed tomushkin closed 4 years ago

tomushkin commented 4 years ago

The code responsible for opening folds doesn't do anything currently.

I believe just foldopen! on the snippet line is correct.

diff --git a/autoload/snipMate.vim b/autoload/snipMate.vim
index 4952879..366ba6f 100644
--- a/autoload/snipMate.vim
+++ b/autoload/snipMate.vim
@@ -42,7 +42,7 @@ function! snipMate#expandSnip(snip, version, col) abort

    " Open any folds snippet expands into
    if &foldenable
-       silent! exec lnum . ',' . (lnum + len(snipLines) - 1) . 'foldopen'
+       silent! exec lnum . 'foldopen!'
    endif

    aug snipmate_changes
ajzafar commented 4 years ago

Thanks for the contribution! It's merged in master!