-
Notifications
You must be signed in to change notification settings - Fork 0
/
ftplugin.diff
51 lines (46 loc) · 1.54 KB
/
ftplugin.diff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
commit a69764dff62e2e07c7f214f1b3c69e753979cdaf
Author: Kevin Ballard <[email protected]>
Date: Tue Aug 5 18:03:36 2014 -0700
Tweak the ftplugin
Update the ftplugin to behave better. This means use b:did_ftplugin,
toggle cpo as appropriate, and define a b:undo_ftplugin.
diff --git a/ftplugin/snippets.vim b/ftplugin/snippets.vim
index 3191444..8479a45 100644
--- a/ftplugin/snippets.vim
+++ b/ftplugin/snippets.vim
@@ -1,5 +1,13 @@
" Set some sane defaults for snippet files
+if exists('b:did_ftplugin')
+ finish
+endif
+let b:did_ftplugin = 1
+
+let s:save_cpo = &cpo
+set cpo&vim
+
" Fold by syntax, but open all folds by default
setlocal foldmethod=syntax
setlocal foldlevel=99
@@ -14,6 +22,7 @@ setlocal autoindent nosmartindent nocindent
if exists("loaded_matchit") && !exists("b:match_words")
let b:match_ignorecase = 0
let b:match_words = '^snippet\>:^endsnippet\>,^global\>:^endglobal\>,\${:}'
+ let s:set_match_words = 1
endif
" Add TagBar support
@@ -24,3 +33,15 @@ let g:tagbar_type_snippets = {
\ ],
\ 'deffile': expand('<sfile>:p:h:h') . '/ctags/UltiSnips.cnf',
\ }
+
+" don't unset g:tagbar_type_snippets, it serves no purpose
+let b:undo_ftplugin = "
+ \ setlocal foldmethod< foldlevel< commentstring<
+ \|setlocal expandtab< autoindent< smartindent< cindent<
+ \|if get(s:, 'set_match_words')
+ \|unlet! b:match_ignorecase b:match_words s:set_match_words
+ \|endif
+ \"
+
+let &cpo = s:save_cpo
+unlet s:save_cpo