* [StGit PATCH] contrib/vim: Fix filetype detection in VIM >=7.4
@ 2016-07-15 18:58 Zane Bitter
2016-08-16 8:52 ` Catalin Marinas
0 siblings, 1 reply; 2+ messages in thread
From: Zane Bitter @ 2016-07-15 18:58 UTC (permalink / raw)
To: git; +Cc: catalin.marinas
The command "setfiletype" will not override an existing filetype. This was
never a problem for me previously, but since upgrading from VIM 7.3 to 7.4
the filetype for StGit's files is explicitly set to "text", preventing the
stgit ftdetect plugin overriding it. Use "setlocal filetype=" instead to
ensure that we override any previously detected filetype.
Signed-off-by: Zane Bitter <zbitter@redhat.com>
---
contrib/vim/ftdetect/stg.vim | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/contrib/vim/ftdetect/stg.vim b/contrib/vim/ftdetect/stg.vim
index abd4d9f..adf46dd 100644
--- a/contrib/vim/ftdetect/stg.vim
+++ b/contrib/vim/ftdetect/stg.vim
@@ -6,23 +6,22 @@
if has("autocmd")
" Detect 'stg new' files
- autocmd BufNewFile,BufRead .stgit-new.txt setf stgnew
- autocmd BufNewFile,BufRead .stgitmsg.txt setf stgnew
+ autocmd BufNewFile,BufRead .stgit-new.txt setlocal filetype=stgnew
+ autocmd BufNewFile,BufRead .stgitmsg.txt setlocal filetype=stgnew
" Ignore the modeline so we get type 'stgnew' instead of 'diff'
autocmd BufNewFile,BufRead .stgitmsg.txt setlocal nomodeline
" Detect 'stg edit' files
- autocmd BufNewFile,BufRead .stgit-edit.txt setf stgedit
- " Use set filetype instead of setfiletype to override detection as patch
+ autocmd BufNewFile,BufRead .stgit-edit.txt setlocal filetype=stgedit
autocmd BufNewFile,BufRead .stgit-edit.patch setlocal filetype=stgedit
autocmd BufNewFile,BufRead .stgit-edit.diff setlocal filetype=stgedit
autocmd BufNewFile,BufRead .stgit-failed.patch setlocal filetype=stgedit
" Detect 'stg squash' files
- autocmd BufNewFile,BufRead .stgit-squash.txt setf stgsquash
+ autocmd BufNewFile,BufRead .stgit-squash.txt setlocal filetype=stgsquash
" Detect 'stg mail' files
- autocmd BufNewFile,BufRead .stgitmail.txt setf stgmail
+ autocmd BufNewFile,BufRead .stgitmail.txt setlocal filetype=stgmail
" A modeline in a diff belongs to the diffed file, so ignore it
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [StGit PATCH] contrib/vim: Fix filetype detection in VIM >=7.4
2016-07-15 18:58 [StGit PATCH] contrib/vim: Fix filetype detection in VIM >=7.4 Zane Bitter
@ 2016-08-16 8:52 ` Catalin Marinas
0 siblings, 0 replies; 2+ messages in thread
From: Catalin Marinas @ 2016-08-16 8:52 UTC (permalink / raw)
To: Zane Bitter; +Cc: Git Mailing List
On 15 July 2016 at 19:58, Zane Bitter <zbitter@redhat.com> wrote:
> The command "setfiletype" will not override an existing filetype. This was
> never a problem for me previously, but since upgrading from VIM 7.3 to 7.4
> the filetype for StGit's files is explicitly set to "text", preventing the
> stgit ftdetect plugin overriding it. Use "setlocal filetype=" instead to
> ensure that we override any previously detected filetype.
Applied. Thanks.
Catalin
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-08-16 8:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-15 18:58 [StGit PATCH] contrib/vim: Fix filetype detection in VIM >=7.4 Zane Bitter
2016-08-16 8:52 ` Catalin Marinas
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).