annotate runtime/ftplugin/ps1.vim @ 24569:e3ec2ec8841a

Update runtime files Commit: https://github.com/vim/vim/commit/4c295027a426986566cd7a76c47a6d3a529727e7 Author: Bram Moolenaar <Bram@vim.org> Date: Sun May 2 17:19:11 2021 +0200 Update runtime files
author Bram Moolenaar <Bram@vim.org>
date Sun, 02 May 2021 17:30:05 +0200
parents 5c98ea5f5d6e
children 8ae680be2a51
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
24387
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1 " Vim filetype plugin file
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2 " Language: Windows PowerShell
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3 " URL: https://github.com/PProvost/vim-ps1
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
4 " Last Change: 2021 Apr 02
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
5
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
6 " Only do this when not done yet for this buffer
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
7 if exists("b:did_ftplugin") | finish | endif
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
8
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
9 " Don't load another plug-in for this buffer
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
10 let b:did_ftplugin = 1
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
11
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
12 let s:cpo_save = &cpo
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
13 set cpo&vim
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
14
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
15 setlocal tw=0
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
16 setlocal commentstring=#%s
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
17 setlocal formatoptions=tcqro
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
18 " Enable autocompletion of hyphenated PowerShell commands,
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
19 " e.g. Get-Content or Get-ADUser
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
20 setlocal iskeyword+=-
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
21
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
22 " Change the browse dialog on Win32 to show mainly PowerShell-related files
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
23 if has("gui_win32")
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
24 let b:browsefilter =
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
25 \ "All PowerShell Files (*.ps1, *.psd1, *.psm1, *.ps1xml)\t*.ps1;*.psd1;*.psm1;*.ps1xml\n" .
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
26 \ "PowerShell Script Files (*.ps1)\t*.ps1\n" .
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
27 \ "PowerShell Module Files (*.psd1, *.psm1)\t*.psd1;*.psm1\n" .
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
28 \ "PowerShell XML Files (*.ps1xml)\t*.ps1xml\n" .
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
29 \ "All Files (*.*)\t*.*\n"
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
30 endif
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
31
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
32 " Look up keywords by Get-Help:
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
33 " check for PowerShell Core in Windows, Linux or MacOS
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
34 if executable('pwsh') | let s:pwsh_cmd = 'pwsh'
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
35 " on Windows Subsystem for Linux, check for PowerShell Core in Windows
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
36 elseif exists('$WSLENV') && executable('pwsh.exe') | let s:pwsh_cmd = 'pwsh.exe'
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
37 " check for PowerShell <= 5.1 in Windows
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
38 elseif executable('powershell.exe') | let s:pwsh_cmd = 'powershell.exe'
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
39 endif
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
40
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
41 if exists('s:pwsh_cmd')
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
42 if !has('gui_running') && executable('less') &&
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
43 \ !(exists('$ConEmuBuild') && &term =~? '^xterm')
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
44 " For exclusion of ConEmu, see https://github.com/Maximus5/ConEmu/issues/2048
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
45 command! -buffer -nargs=1 GetHelp silent exe '!' . s:pwsh_cmd . ' -NoLogo -NoProfile -NonInteractive -ExecutionPolicy RemoteSigned -Command Get-Help -Full "<args>" | ' . (has('unix') ? 'LESS= less' : 'less') | redraw!
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
46 elseif has('terminal')
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
47 command! -buffer -nargs=1 GetHelp silent exe 'term ' . s:pwsh_cmd . ' -NoLogo -NoProfile -NonInteractive -ExecutionPolicy RemoteSigned -Command Get-Help -Full "<args>"' . (executable('less') ? ' | less' : '')
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
48 else
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
49 command! -buffer -nargs=1 GetHelp echo system(s:pwsh_cmd . ' -NoLogo -NoProfile -NonInteractive -ExecutionPolicy RemoteSigned -Command Get-Help -Full <args>')
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
50 endif
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
51 endif
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
52 setlocal keywordprg=:GetHelp
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
53
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
54 " Undo the stuff we changed
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
55 let b:undo_ftplugin = "setlocal tw< cms< fo< iskeyword< keywordprg<" .
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
56 \ " | unlet! b:browsefilter"
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
57
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
58 let &cpo = s:cpo_save
5c98ea5f5d6e Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
59 unlet s:cpo_save