mirror of
https://github.com/vim/vim.git
synced 2025-09-28 04:24:06 -04:00
patch 9.0.1632: not all cabal config files are recognized
Problem: Not all cabal config files are recognized. Solution: Add a couple of patterns. (Marcin Szamotulski, closes #12463)
This commit is contained in:
committed by
Bram Moolenaar
parent
4c7cb372c1
commit
166cd7b801
@@ -784,7 +784,7 @@ au BufNewFile,BufRead */.config/git/config setf gitconfig
|
||||
au BufNewFile,BufRead *.git/config.worktree setf gitconfig
|
||||
au BufNewFile,BufRead *.git/worktrees/*/config.worktree setf gitconfig
|
||||
au BufNewFile,BufRead .gitmodules,*.git/modules/*/config setf gitconfig
|
||||
if !empty($XDG_CONFIG_HOME)
|
||||
if exists('$XDG_CONFIG_HOME')
|
||||
au BufNewFile,BufRead $XDG_CONFIG_HOME/git/config setf gitconfig
|
||||
au BufNewFile,BufRead $XDG_CONFIG_HOME/git/attributes setf gitattributes
|
||||
au BufNewFile,BufRead $XDG_CONFIG_HOME/git/ignore setf gitignore
|
||||
@@ -886,6 +886,10 @@ au BufNewFile,BufRead *.lhs setf lhaskell
|
||||
au BufNewFile,BufRead *.chs setf chaskell
|
||||
au BufNewFile,BufRead cabal.project setf cabalproject
|
||||
au BufNewFile,BufRead $HOME/.cabal/config setf cabalconfig
|
||||
if exists('$XDG_CONFIG_HOME')
|
||||
au BufNewFile,BufRead $XDG_CONFIG_HOME/cabal/config setf cabalconfig
|
||||
endif
|
||||
au BufNewFile,BufRead $HOME/.config/cabal/config setf cabalconfig
|
||||
au BufNewFile,BufRead cabal.config setf cabalconfig
|
||||
|
||||
" Haste
|
||||
|
@@ -40,6 +40,30 @@ func Test_other_type()
|
||||
filetype off
|
||||
endfunc
|
||||
|
||||
" If $XDG_CONFIG_HOME is set return "fname" expanded in a list.
|
||||
" Otherwise return an empty list.
|
||||
def s:WhenConfigHome(fname: string): list<string>
|
||||
if exists('$XDG_CONFIG_HOME')
|
||||
return [expand(fname)]
|
||||
endif
|
||||
return []
|
||||
enddef
|
||||
|
||||
" Return the name used for the $XDG_CONFIG_HOME directory.
|
||||
def s:GetConfigHome(): string
|
||||
return getcwd() .. '/Xdg_config_home'
|
||||
enddef
|
||||
|
||||
" saved value of $XDG_CONFIG_HOME
|
||||
let s:saveConfigHome = ''
|
||||
|
||||
def s:SetupConfigHome()
|
||||
if empty(windowsversion())
|
||||
s:saveConfigHome = $XDG_CONFIG_HOME
|
||||
setenv("XDG_CONFIG_HOME", GetConfigHome())
|
||||
endif
|
||||
enddef
|
||||
|
||||
" Filetypes detected just from matching the file name.
|
||||
" First one is checking that these files have no filetype.
|
||||
def s:GetFilenameChecks(): dict<list<string>>
|
||||
@@ -95,7 +119,7 @@ def s:GetFilenameChecks(): dict<list<string>>
|
||||
bzr: ['bzr_log.any', 'bzr_log.file'],
|
||||
c: ['enlightenment/file.cfg', 'file.qc', 'file.c', 'some-enlightenment/file.cfg'],
|
||||
cabal: ['file.cabal'],
|
||||
cabalconfig: ['cabal.config'],
|
||||
cabalconfig: ['cabal.config', expand("$HOME/.config/cabal/config")] + WhenConfigHome('$XDG_CONFIG_HOME/cabal/config'),
|
||||
cabalproject: ['cabal.project', 'cabal.project.local'],
|
||||
cairo: ['file.cairo'],
|
||||
calendar: ['calendar', '/.calendar/file', '/share/calendar/any/calendar.file', '/share/calendar/calendar.file', 'any/share/calendar/any/calendar.file', 'any/share/calendar/calendar.file'],
|
||||
@@ -229,10 +253,10 @@ def s:GetFilenameChecks(): dict<list<string>>
|
||||
gedcom: ['file.ged', 'lltxxxxx.txt', '/tmp/lltmp', '/tmp/lltmp-file', 'any/tmp/lltmp', 'any/tmp/lltmp-file'],
|
||||
gemtext: ['file.gmi', 'file.gemini'],
|
||||
gift: ['file.gift'],
|
||||
gitattributes: ['file.git/info/attributes', '.gitattributes', '/.config/git/attributes', '/etc/gitattributes', '/usr/local/etc/gitattributes', 'some.git/info/attributes'],
|
||||
gitattributes: ['file.git/info/attributes', '.gitattributes', '/.config/git/attributes', '/etc/gitattributes', '/usr/local/etc/gitattributes', 'some.git/info/attributes'] + WhenConfigHome('$XDG_CONFIG_HOME/git/attributes'),
|
||||
gitcommit: ['COMMIT_EDITMSG', 'MERGE_MSG', 'TAG_EDITMSG', 'NOTES_EDITMSG', 'EDIT_DESCRIPTION'],
|
||||
gitconfig: ['file.git/config', 'file.git/config.worktree', 'file.git/worktrees/x/config.worktree', '.gitconfig', '.gitmodules', 'file.git/modules//config', '/.config/git/config', '/etc/gitconfig', '/usr/local/etc/gitconfig', '/etc/gitconfig.d/file', 'any/etc/gitconfig.d/file', '/.gitconfig.d/file', 'any/.config/git/config', 'any/.gitconfig.d/file', 'some.git/config', 'some.git/modules/any/config'],
|
||||
gitignore: ['file.git/info/exclude', '.gitignore', '/.config/git/ignore', 'some.git/info/exclude'],
|
||||
gitconfig: ['file.git/config', 'file.git/config.worktree', 'file.git/worktrees/x/config.worktree', '.gitconfig', '.gitmodules', 'file.git/modules//config', '/.config/git/config', '/etc/gitconfig', '/usr/local/etc/gitconfig', '/etc/gitconfig.d/file', 'any/etc/gitconfig.d/file', '/.gitconfig.d/file', 'any/.config/git/config', 'any/.gitconfig.d/file', 'some.git/config', 'some.git/modules/any/config'] + WhenConfigHome('$XDG_CONFIG_HOME/git/config'),
|
||||
gitignore: ['file.git/info/exclude', '.gitignore', '/.config/git/ignore', 'some.git/info/exclude'] + WhenConfigHome('$XDG_CONFIG_HOME/git/ignore'),
|
||||
gitolite: ['gitolite.conf', '/gitolite-admin/conf/file', 'any/gitolite-admin/conf/file'],
|
||||
gitrebase: ['git-rebase-todo'],
|
||||
gitsendemail: ['.gitsendemail.msg.xxxxxx'],
|
||||
@@ -807,6 +831,12 @@ def s:CheckItems(checks: dict<list<string>>)
|
||||
enddef
|
||||
|
||||
def Test_filetype_detection()
|
||||
SetupConfigHome()
|
||||
if !empty(s:saveConfigHome)
|
||||
defer setenv("XDG_CONFIG_HOME", s:saveConfigHome)
|
||||
endif
|
||||
mkdir(GetConfigHome(), 'R')
|
||||
|
||||
filetype on
|
||||
CheckItems(s:GetFilenameChecks())
|
||||
if has('fname_case')
|
||||
|
@@ -695,6 +695,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
1632,
|
||||
/**/
|
||||
1631,
|
||||
/**/
|
||||
|
Reference in New Issue
Block a user