Skip to content

Commit 45edbe1

Browse files
committed
unset options from ftplugin and indent when changing filetype
This should make this plugin play nicer with others by avoiding to leak out options to other filetypes. I've switched the first lines of ftplugin to the long option names in order to make it clearer what they are, but most importantly that they are being cleared out later by undo_ftplugin. Finally, formatexpr gets moved over to ftplugin since it's not only related to indent.
1 parent 78fd3ad commit 45edbe1

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed

ftplugin/puppet.vim

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,18 @@ if (exists("b:did_ftplugin"))
99
endif
1010
let b:did_ftplugin = 1
1111

12-
setl ts=2
13-
setl sts=2
14-
setl sw=2
15-
setl et
16-
setl keywordprg=puppet\ describe\ --providers
17-
setl iskeyword=-,:,@,48-57,_,192-255
18-
setl cms=#\ %s
12+
setlocal tabstop=2
13+
setlocal softtabstop=2
14+
setlocal shiftwidth=2
15+
setlocal expandtab
16+
setlocal keywordprg=puppet\ describe\ --providers
17+
setlocal iskeyword=-,:,@,48-57,_,192-255
18+
setlocal commentstring=#\ %s
19+
20+
setlocal formatexpr=puppet#format#Format()
21+
22+
let b:undo_ftplugin = "
23+
\ setlocal tabstop< tabstop< softtabstop< shiftwidth< expandtab<
24+
\| setlocal keywordprg< iskeyword< commentstring<
25+
\| setlocal formatexpr<
26+
\"

indent/puppet.vim

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ let b:did_indent = 1
1212
setlocal autoindent smartindent
1313
setlocal indentexpr=GetPuppetIndent()
1414
setlocal indentkeys+=0],0)
15-
setlocal formatexpr=puppet#format#Format()
15+
16+
let b:undo_indent = "
17+
\ setlocal autoindent< smartindent< indentexpr< indentkeys<
18+
\"
1619

1720
if exists("*GetPuppetIndent")
1821
finish

0 commit comments

Comments
 (0)