Files
nvimdots/autoload/neoformat/formatters/pwsh.vim
T
2026-05-22 10:11:25 +02:00

26 lines
746 B
VimL

function! neoformat#formatters#pwsh#enabled() abort
return ['pwshfmt']
endfunction
function! neoformat#formatters#pwsh#pwshfmt() abort
if has('win32') || has('win64')
let l:args = [
\ '-NoProfile',
\ '-Command',
\ 'Invoke-Formatter',
\ ]
else
let l:args = [
\ '-NoProfile',
\ '-Command',
\ '"Import-Module (Resolve-Path \"/opt/powershell-editor-services/PSScriptAnalyzer/*/PSScriptAnalyzer.psd1\" | Select-Object -ExpandProperty Path); Invoke-Formatter -ScriptDefinition (\$input | Out-String)"'
\ ]
endif
return {
\ 'exe': 'pwsh',
\ 'args': l:args,
\ 'stdin': 1,
\ }
endfunction