sponsor Vim development Vim logo Vim Book Ad

setpwsh : A Vim plugin to improve powershell integration.

 script karma  Rating 8/2, Downloaded by 167  Comments, bugs, improvements  Vim wiki

created by
Miguel Barro
 
script type
utility
 
description
This package improves the powershell (core and desktop) integration as vim 'shell' using a set of scripts.

Repo: https://github.com/MiguelBarro/setpwsh

Having powershell core (windows or linux) or desktop available is a prerequisite.

There is only a single command:

    :SetPwsh [Desktop | FtpFromWsl | SshFromWsl]

This command will modify the 'shell' and related options to use the
powershell. It admits the following argument flags that are only meaningful in windows:

+ Desktop     Use powershell desktop instead of powershell core.
+ FtpFromWsl  Sets up netrw global options to rig wsl ftp.
+ SshFromWsl  Sets up netrw global options to rig wsl ssh & scp.

Usage examples:

:read !1..5 | \% { [char]($_+96) }

will fill the current buffer with:

1  a
2  b
3  c
4  d
5  e

Is possible to use filter commands to modify the buffer. The plugin allows creating powershell filters where the buffer input is translated into a powershell pipeline input. The $_ automatic variable will match each input line. For example in the above buffer doing:

:1,5!"-->$_<--"

will turn the buffer into:

1  -->a<--
2  -->b<--
3  -->c<--
2  -->d<--
5  -->e<--
 
install details
> Installation is as easy as sourcing the vimball file:
    :source setpwsh.vba
  so is uninstall:
    :RmVimball setpwsh.vba

> The github repo can be cloned direcly into the $VIMRUNTIME/pack directory as explained in matchit-install. Though using this approach many useless files in this repo will be installed too.

> Use getscript plugin to automatically download an update it. Update the local
  $VIMRUNTIME/GetLatest/GetLatestVimScripts.dat adding a line associated with this plugin.
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
setpwsh.vmb 1.1.0 2024-10-06 8.0 Miguel Barro Solved emoji rendering issue on windows' gVim by forcing powershell binary to use utf8 on stdin/stdout pipes.
An environment variable has been introduced to allow the user to select pipe encoding (defaults to utf8).
setpwsh.vmb 1.0.1 2024-09-08 8.0 Miguel Barro AutoInstall support added.
To install :source the vimball file (setpwsh.vmb).
This simplifies update which is performed automatically whenever :GLVS is called.
setpwsh.vmb 1.0 2024-04-29 8.0 Miguel Barro Initial upload
ip used for rating: 3.237.15.145

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github