Make vim-plugin "Tagbar" to support Powershell¶
To make Tagbar supports PowerShell, do the followings
- Add
g:tagbar_type_ps1
to.vimrc
- Add PowerShell language definition to ctags config file
For 1, add the following code to .vimrc
let g:tagbar_type_ps1 = {
\ 'ctagstype' : 'powershell',
\ 'kinds' : [
\ 'f:function',
\ 'i:filter',
\ 'a:alias'
\ ]
\ }
For 2, the path to the ctags config file varies dependent on which ctags is used:
- For Exuberant-ctags:
$HOME/.ctags
Create the ctags config fileĀ powershell.ctags
and add the following code to the file:
--langdef=powershell
--langmap=powershell:.ps1.psm1
--regex-powershell=/^[Ff]unction[\t ]*([a-zA-Z0-9_-]+)/\1/f,function/
--regex-powershell=/^[Ff]ilter[\t ]*([a-zA-Z0-9_-]+)/\1/i,filter/
--regex-powershell=/^[sS]et-[Aa]lias[\t ]*([a-zA-Z0-9_-]+)/\1/a,alias/
REFERENCE