diff --git a/ftdetect/ps1.vim b/ftdetect/ps1.vim new file mode 100644 index 0000000..0a965d3 --- /dev/null +++ b/ftdetect/ps1.vim @@ -0,0 +1 @@ +autocmd BufNewFile,BufRead *.ps*1 setfiletype ps1 diff --git a/plugin/coc-powershell.vim b/ftplugin/ps1.vim similarity index 88% rename from plugin/coc-powershell.vim rename to ftplugin/ps1.vim index 6aca473..53a384f 100644 --- a/plugin/coc-powershell.vim +++ b/ftplugin/ps1.vim @@ -1,3 +1,7 @@ +if exists('s:loaded_ftplugin') + finish +endif +let s:loaded_ftplugin = 1 let s:vimscript_dir = expand(':p:h') function! s:PSESSetup () let g:pses_dir = resolve(expand(s:vimscript_dir . '/../PowerShellEditorServices/PowerShellEditorServices')) @@ -42,10 +46,4 @@ function! s:PSESSetup () \) endfunction -" Set the file type to ps1 for ps1, psm1, and psd1 -" 'ps1' is what vim-polyglot uses for styling -if(&filetype == "") - autocmd BufNewFile,BufRead *.ps*1 set filetype=ps1 -endif - -autocmd FileType ps1,psd1,psm1 call s:PSESSetup() +call s:PSESSetup()