Skip to content

Commit

Permalink
Merge pull request #62 from alker0/windows_autocmd_pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
alker0 authored Jul 7, 2023
2 parents 062717b + b97ab7e commit 902c407
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion filetype.vim
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,17 @@ else
let g:chezmoi#source_dir_path = trim(s:fix_path_delims(g:chezmoi#source_dir_path), '/', 2)
endif

if has('unix')
let s:source_dir_pattern = '\V' . escape(g:chezmoi#source_dir_path, ' \') . '/\*'
else
" `\V` mode makes slash(/) not work as path delimiter on Windows
let s:source_dir_pattern = '\c' . escape(g:chezmoi#source_dir_path, '.~$[ \') . '/*'
endif

augroup chezmoi_filetypedetect
autocmd!

execute 'autocmd BufNewFile,BufRead \V'. escape(g:chezmoi#source_dir_path, ' \') . '/\* call chezmoi#filetype#handle_chezmoi_filetype()'
execute 'autocmd BufNewFile,BufRead '. s:source_dir_pattern . ' call chezmoi#filetype#handle_chezmoi_filetype()'
augroup END

if has('unix')
Expand Down

0 comments on commit 902c407

Please sign in to comment.