mirror of
https://github.com/sheerun/vim-polyglot.git
synced 2025-11-08 11:33:52 -05:00
Fix detecting conf filetype, closes #641
This commit is contained in:
2
Makefile
2
Makefile
@@ -7,4 +7,4 @@ test:
|
|||||||
@ scripts/test
|
@ scripts/test
|
||||||
|
|
||||||
dev:
|
dev:
|
||||||
@ find scripts autoload/polyglot ftdetect tests . -type f -maxdepth 1 | DEV=1 entr bash -c 'make && make test'
|
@ find scripts autoload/polyglot ftdetect tests . -type f -maxdepth 1 | DEV=1 entr bash -c 'make'
|
||||||
|
|||||||
@@ -449,6 +449,11 @@ func! polyglot#shebang#VimDetect()
|
|||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if line1 =~ '^# ' || getline(2) =~ '^# ' || getline(3) =~ '^# ' || getline(4) =~ '^# ' || getline(5) =~ '^# '
|
||||||
|
setf FALLBACK conf
|
||||||
|
return 1
|
||||||
|
endif
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
|||||||
@@ -2659,13 +2659,13 @@ func! s:Observe(fn)
|
|||||||
augroup END
|
augroup END
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
au BufNewFile,BufRead,StdinReadPost * if expand("<afile>:e") == "" |
|
au BufNewFile,BufRead,StdinReadPost,BufWritePost * if expand("<afile>:e") == "" |
|
||||||
\ call polyglot#shebang#Detect() | endif
|
\ call polyglot#shebang#Detect() | endif
|
||||||
|
|
||||||
au BufWinEnter * if &ft == "" && expand("<afile>:e") == "" |
|
au BufWinEnter * if &ft == "" && expand("<afile>:e") == "" |
|
||||||
\ call s:Observe('shebang#Detect') | endif
|
\ call s:Observe('shebang#Detect') | endif
|
||||||
|
|
||||||
au FileType * au! polyglot-observer
|
au BufWritePost * au! polyglot-observer
|
||||||
|
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
@@ -3528,7 +3528,6 @@ if exists("did_load_filetypes") && exists("g:polyglot_disabled")
|
|||||||
runtime! extras/filetype.vim
|
runtime! extras/filetype.vim
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
let s:runtime = resolve($VIMRUNTIME)
|
let s:runtime = resolve($VIMRUNTIME)
|
||||||
let s:base = resolve(expand('<sfile>:p:h:h'))
|
let s:base = resolve(expand('<sfile>:p:h:h'))
|
||||||
|
|
||||||
|
|||||||
@@ -113,9 +113,9 @@ def sort_packages(packages)
|
|||||||
each_child = lambda { |n, &b|
|
each_child = lambda { |n, &b|
|
||||||
[
|
[
|
||||||
implicit_dependencies[n] || [],
|
implicit_dependencies[n] || [],
|
||||||
packages[n]["dependencies"] || [],
|
packages[n] ? packages[n]["dependencies"] || [] : [],
|
||||||
packages[n]["after"] || []
|
packages[n] ? packages[n]["after"] || [] : []
|
||||||
].flatten.each(&b)
|
].flatten.each { |e| b.call(e) if packages[e] }
|
||||||
}
|
}
|
||||||
|
|
||||||
TSort.tsort(each_node, each_child).map { |a| packages[a] }
|
TSort.tsort(each_node, each_child).map { |a| packages[a] }
|
||||||
@@ -248,11 +248,11 @@ def load_languages
|
|||||||
end
|
end
|
||||||
|
|
||||||
def load_packages
|
def load_packages
|
||||||
YAML.load_stream(File.read('packages.yaml'))
|
YAML.load_stream(File.read('packages.yaml')) || []
|
||||||
end
|
end
|
||||||
|
|
||||||
def load_heuristics
|
def load_heuristics
|
||||||
YAML.load_stream(File.read('heuristics.yaml'))
|
YAML.load_stream(File.read('heuristics.yaml')) || []
|
||||||
end
|
end
|
||||||
|
|
||||||
def parse_remote(remote)
|
def parse_remote(remote)
|
||||||
@@ -486,6 +486,7 @@ def extract(packages)
|
|||||||
)
|
)
|
||||||
|
|
||||||
FileUtils.rm_rf(all_dirs)
|
FileUtils.rm_rf(all_dirs)
|
||||||
|
Dir.mkdir('extras') unless File.exists?('extras')
|
||||||
|
|
||||||
for dir in Dir.glob("*", base: "autoload")
|
for dir in Dir.glob("*", base: "autoload")
|
||||||
if dir != "polyglot"
|
if dir != "polyglot"
|
||||||
|
|||||||
Reference in New Issue
Block a user