-
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
Conversation
@@ -0,0 +1 @@ | |||
autocmd BufNewFile,BufRead *.ps*1 setfiletype ps1 |
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 of set filetype
. Vim doesn't detect *.ps*1
files by default so this should be fine.
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 comment
The 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 comment
The 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 comment
The 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 comment
The reason will be displayed to describe this comment to others. Learn more.
yup. that will do.
thanks @janlazo for the patch! |
@janlazo could you please rebase this on the latest merge? We were working on some improvements on pwsh version selection. |
hmm, perhaps this can be merged directly. |
Optimize startup by delaying filetype-dependent code until the user opens a powershell file.
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.
LGTM
Optimize startup by delaying filetype-dependent code until the user opens a powershell file.