-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: Move plugin to ftdetect,ftplugin #15
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
autocmd BufNewFile,BufRead *.ps*1 setfiletype ps1 | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
if exists('s:loaded_ftplugin') | ||
finish | ||
endif | ||
let s:loaded_ftplugin = 1 | ||
let s:vimscript_dir = expand('<sfile>: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() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this run every time the user opens a powershell file? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no, only the first time, so if ftdetect is done properly we just need to fire it once. 👍 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if exists('s:loaded_ftplugin')
finish
endif
let s:loaded_ftplugin = 1
call s:PSESetup() Treat it like a plugin then with a guard? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yup. that will do. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I use https://github.com/PProvost/vim-ps1 so I used
setfiletype
here instead ofset filetype
. Vim doesn't detect*.ps*1
files by default so this should be fine.