Poor man's vim powershell code formatter.
WRAPPER: Uses https://github.com/PowerShell/PSScriptAnalyzer Invoke-Formatter
function to format buffer.
- Powershell Core : https://github.com/PowerShell/PowerShell#get-powershell
- PSScriptAnalyzer : https://github.com/PowerShell/PSScriptAnalyzer
pwsh -Command Install-Module -Name PSScriptAnalyzer
Plug 'JayDoubleu/vim-pwsh-formatter'
From vim:
:PWSHFORMAT
Or map to key in your .vimrc or init.vim :
autocmd FileType ps1 noremap <F5> :PWSHFORMAT<CR>
This is using default Invoke-Formatter
settings.
Edit plugin/format.ps1#L99-L100 and plugin/format.ps1#L17-L97 to customise.
- vim-polyglot for syntax highlighting
- coc-powershell for Intellisense/Completions, REPL etc.