summaryrefslogtreecommitdiffstats
path: root/autoload/polyglot/detect.vim
diff options
context:
space:
mode:
authorAdam Stankiewicz <sheerun@sher.pl>2020-10-02 03:42:03 +0200
committerAdam Stankiewicz <sheerun@sher.pl>2020-10-02 03:42:03 +0200
commit94ec9c38e744241e48fb8d75ae6e8811bc73fc59 (patch)
tree03940b00ce5d9a494253af5d2976d095a11a5d2f /autoload/polyglot/detect.vim
parentbff55a54fa8a70e664ebe8a614681dd0d92d66b6 (diff)
downloadvim-polyglot-94ec9c38e744241e48fb8d75ae6e8811bc73fc59.tar.gz
vim-polyglot-94ec9c38e744241e48fb8d75ae6e8811bc73fc59.zip
Do not use ++once to support older vims, fixes #7056
Diffstat (limited to 'autoload/polyglot/detect.vim')
-rw-r--r--autoload/polyglot/detect.vim25
1 files changed, 21 insertions, 4 deletions
diff --git a/autoload/polyglot/detect.vim b/autoload/polyglot/detect.vim
index af143865..86783cb3 100644
--- a/autoload/polyglot/detect.vim
+++ b/autoload/polyglot/detect.vim
@@ -1,3 +1,11 @@
+" Line continuation is used here, remove 'C' from 'cpoptions'
+let s:cpo_save = &cpo
+set cpo&vim
+
+func! s:WritePostOnce(fn)
+ exe 'au! filetypedetect BufWritePost <buffer> ++once ' . a:fn
+endfunc
+
" DO NOT EDIT CODE BELOW, IT IS GENERATED WITH MAKEFILE
func! polyglot#detect#Inp()
@@ -185,7 +193,8 @@ func! polyglot#detect#Pm()
let &ft = g:filetype_pm | return
endif
if polyglot#shebang#Detect() | return | endif
- set ft=perl | au BufWritePost <buffer> ++once call polyglot#detect#Pm()
+ setf perl
+ call s:WritePostOnce('call polyglot#detect#Pm()')
return
endfunc
@@ -207,7 +216,8 @@ func! polyglot#detect#Pl()
let &ft = g:filetype_pl | return
endif
if polyglot#shebang#Detect() | return | endif
- set ft=perl | au BufWritePost <buffer> ++once call polyglot#detect#Pl()
+ setf perl
+ call s:WritePostOnce('call polyglot#detect#Pl()')
return
endfunc
@@ -231,7 +241,8 @@ func! polyglot#detect#T()
let &ft = g:filetype_t | return
endif
if polyglot#shebang#Detect() | return | endif
- set ft=perl | au BufWritePost <buffer> ++once call polyglot#detect#T()
+ setf perl
+ call s:WritePostOnce('call polyglot#detect#T()')
return
endfunc
@@ -259,6 +270,12 @@ func! polyglot#detect#Html()
set ft=xhtml | return
endif
endfor
- set ft=html | au BufWritePost <buffer> ++once call polyglot#detect#Html()
+ setf html
+ call s:WritePostOnce('call polyglot#detect#Html()')
return
endfunc
+
+" DO NOT EDIT CODE ABOVE, IT IS GENERATED WITH MAKEFILE
+
+let &cpo = s:cpo_save
+unlet s:cpo_save