Mercurial > vim
annotate runtime/plugin/vimballPlugin.vim @ 33010:fcd65e5d277a v9.0.1797
patch 9.0.1797: Vimball/Visual Basic filetype detection conflict
Commit: https://github.com/vim/vim/commit/f97f6bbf56408c0c97b4ddbe81fba858d7455b0d
Author: Doug Kearns <dougkearns@gmail.com>
Date: Sun Aug 27 18:44:09 2023 +0200
patch 9.0.1797: Vimball/Visual Basic filetype detection conflict
Problem: Vimball/Visual Basic filetype detection conflict
Solution: runtime(vb): Improve Vimball and Visual Basic detection logic
Only run Vimball Archiver's BufEnter autocommand on Vimball archives.
Fixes #2694.
closes: #12899
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 27 Aug 2023 19:00:04 +0200 |
parents | 47f17f66da3d |
children | 02bd0fe77c68 |
rev | line source |
---|---|
1121 | 1 " vimballPlugin : construct a file containing both paths and files |
8876
47f17f66da3d
commit https://github.com/vim/vim/commit/03413f44167c4b5cd0012def9bb331e2518c83cf
Christian Brabandt <cb@256bit.org>
parents:
3281
diff
changeset
|
2 " Author: Charles E. Campbell |
47f17f66da3d
commit https://github.com/vim/vim/commit/03413f44167c4b5cd0012def9bb331e2518c83cf
Christian Brabandt <cb@256bit.org>
parents:
3281
diff
changeset
|
3 " Copyright: (c) 2004-2014 by Charles E. Campbell |
792 | 4 " The VIM LICENSE applies to Vimball.vim, and Vimball.txt |
5 " (see |copyright|) except use "Vimball" instead of "Vim". | |
6 " No warranty, express or implied. | |
7 " *** *** Use At-Your-Own-Risk! *** *** | |
1121 | 8 " |
9 " (Rom 2:1 WEB) Therefore you are without excuse, O man, whoever you are who | |
10 " judge. For in that which you judge another, you condemn yourself. For | |
11 " you who judge practice the same things. | |
12 " GetLatestVimScripts: 1502 1 :AutoInstall: vimball.vim | |
792 | 13 |
14 " --------------------------------------------------------------------- | |
15 " Load Once: {{{1 | |
1121 | 16 if &cp || exists("g:loaded_vimballPlugin") |
792 | 17 finish |
18 endif | |
8876
47f17f66da3d
commit https://github.com/vim/vim/commit/03413f44167c4b5cd0012def9bb331e2518c83cf
Christian Brabandt <cb@256bit.org>
parents:
3281
diff
changeset
|
19 let g:loaded_vimballPlugin = "v37" |
1121 | 20 let s:keepcpo = &cpo |
792 | 21 set cpo&vim |
22 | |
23 " ------------------------------------------------------------------------------ | |
24 " Public Interface: {{{1 | |
8876
47f17f66da3d
commit https://github.com/vim/vim/commit/03413f44167c4b5cd0012def9bb331e2518c83cf
Christian Brabandt <cb@256bit.org>
parents:
3281
diff
changeset
|
25 com! -range -complete=file -nargs=+ -bang MkVimball call vimball#MkVimball(<line1>,<line2>,<bang>0,<f-args>) |
47f17f66da3d
commit https://github.com/vim/vim/commit/03413f44167c4b5cd0012def9bb331e2518c83cf
Christian Brabandt <cb@256bit.org>
parents:
3281
diff
changeset
|
26 com! -nargs=? -complete=dir UseVimball call vimball#Vimball(1,<f-args>) |
47f17f66da3d
commit https://github.com/vim/vim/commit/03413f44167c4b5cd0012def9bb331e2518c83cf
Christian Brabandt <cb@256bit.org>
parents:
3281
diff
changeset
|
27 com! -nargs=0 VimballList call vimball#Vimball(0) |
47f17f66da3d
commit https://github.com/vim/vim/commit/03413f44167c4b5cd0012def9bb331e2518c83cf
Christian Brabandt <cb@256bit.org>
parents:
3281
diff
changeset
|
28 com! -nargs=* -complete=dir RmVimball call vimball#SaveSettings()|call vimball#RmVimball(<f-args>)|call vimball#RestoreSettings() |
47f17f66da3d
commit https://github.com/vim/vim/commit/03413f44167c4b5cd0012def9bb331e2518c83cf
Christian Brabandt <cb@256bit.org>
parents:
3281
diff
changeset
|
29 augroup Vimball |
47f17f66da3d
commit https://github.com/vim/vim/commit/03413f44167c4b5cd0012def9bb331e2518c83cf
Christian Brabandt <cb@256bit.org>
parents:
3281
diff
changeset
|
30 au! |
33010
fcd65e5d277a
patch 9.0.1797: Vimball/Visual Basic filetype detection conflict
Christian Brabandt <cb@256bit.org>
parents:
8876
diff
changeset
|
31 au BufEnter *.vba,*.vba.gz,*.vba.bz2,*.vba.zip,*.vba.xz |
fcd65e5d277a
patch 9.0.1797: Vimball/Visual Basic filetype detection conflict
Christian Brabandt <cb@256bit.org>
parents:
8876
diff
changeset
|
32 \ if getline(1) =~ '^" Vimball Archiver' | |
fcd65e5d277a
patch 9.0.1797: Vimball/Visual Basic filetype detection conflict
Christian Brabandt <cb@256bit.org>
parents:
8876
diff
changeset
|
33 \ setlocal bt=nofile fmr=[[[,]]] fdm=marker|if &ff != 'unix'|setlocal ma ff=unix noma|endif|if line('$') > 1|call vimball#ShowMesg(0, "Source this file to extract it! (:so %)")|endif | |
fcd65e5d277a
patch 9.0.1797: Vimball/Visual Basic filetype detection conflict
Christian Brabandt <cb@256bit.org>
parents:
8876
diff
changeset
|
34 \ endif |
8876
47f17f66da3d
commit https://github.com/vim/vim/commit/03413f44167c4b5cd0012def9bb331e2518c83cf
Christian Brabandt <cb@256bit.org>
parents:
3281
diff
changeset
|
35 au SourceCmd *.vba.gz,*.vba.bz2,*.vba.zip,*.vba.xz let s:origfile=expand("%")|if expand("%")!=expand("<afile>") | exe "1sp" fnameescape(expand("<afile>"))|endif|call vimball#Decompress(expand("<amatch>"))|so %|if s:origfile!=expand("<afile>")|close|endif |
47f17f66da3d
commit https://github.com/vim/vim/commit/03413f44167c4b5cd0012def9bb331e2518c83cf
Christian Brabandt <cb@256bit.org>
parents:
3281
diff
changeset
|
36 au SourceCmd *.vba if expand("%")!=expand("<afile>") | exe "1sp" fnameescape(expand("<afile>"))|call vimball#Vimball(1)|close|else|call vimball#Vimball(1)|endif |
33010
fcd65e5d277a
patch 9.0.1797: Vimball/Visual Basic filetype detection conflict
Christian Brabandt <cb@256bit.org>
parents:
8876
diff
changeset
|
37 au BufEnter *.vmb,*.vmb.gz,*.vmb.bz2,*.vmb.zip,*.vmb.xz |
fcd65e5d277a
patch 9.0.1797: Vimball/Visual Basic filetype detection conflict
Christian Brabandt <cb@256bit.org>
parents:
8876
diff
changeset
|
38 \ if getline(1) =~ '^" Vimball Archiver' | |
fcd65e5d277a
patch 9.0.1797: Vimball/Visual Basic filetype detection conflict
Christian Brabandt <cb@256bit.org>
parents:
8876
diff
changeset
|
39 \ setlocal bt=nofile fmr=[[[,]]] fdm=marker|if &ff != 'unix'|setlocal ma ff=unix noma|endif|if line('$') > 1|call vimball#ShowMesg(0,"Source this file to extract it! (:so %)")|endif | |
fcd65e5d277a
patch 9.0.1797: Vimball/Visual Basic filetype detection conflict
Christian Brabandt <cb@256bit.org>
parents:
8876
diff
changeset
|
40 \ endif |
8876
47f17f66da3d
commit https://github.com/vim/vim/commit/03413f44167c4b5cd0012def9bb331e2518c83cf
Christian Brabandt <cb@256bit.org>
parents:
3281
diff
changeset
|
41 au SourceCmd *.vmb.gz,*.vmb.bz2,*.vmb.zip,*.vmb.xz let s:origfile=expand("%")|if expand("%")!=expand("<afile>") | exe "1sp" fnameescape(expand("<afile>"))|endif|call vimball#Decompress(expand("<amatch>"))|so %|if s:origfile!=expand("<afile>")|close|endif |
47f17f66da3d
commit https://github.com/vim/vim/commit/03413f44167c4b5cd0012def9bb331e2518c83cf
Christian Brabandt <cb@256bit.org>
parents:
3281
diff
changeset
|
42 au SourceCmd *.vmb if expand("%")!=expand("<afile>") | exe "1sp" fnameescape(expand("<afile>"))|call vimball#Vimball(1)|close|else|call vimball#Vimball(1)|endif |
47f17f66da3d
commit https://github.com/vim/vim/commit/03413f44167c4b5cd0012def9bb331e2518c83cf
Christian Brabandt <cb@256bit.org>
parents:
3281
diff
changeset
|
43 augroup END |
792 | 44 |
1121 | 45 " ===================================================================== |
46 " Restoration And Modelines: {{{1 | |
47 " vim: fdm=marker | |
792 | 48 let &cpo= s:keepcpo |
49 unlet s:keepcpo | |
33010
fcd65e5d277a
patch 9.0.1797: Vimball/Visual Basic filetype detection conflict
Christian Brabandt <cb@256bit.org>
parents:
8876
diff
changeset
|
50 |
fcd65e5d277a
patch 9.0.1797: Vimball/Visual Basic filetype detection conflict
Christian Brabandt <cb@256bit.org>
parents:
8876
diff
changeset
|
51 " vim: ts=4: |