#completion #tabs #power-shell #nu #blazing #platform #environment

bin+lib posh-tabcomplete

Blazing fast tab completion for powershell

9 releases

0.2.1 Mar 6, 2024
0.2.0 Dec 10, 2023
0.1.6 Sep 16, 2023
0.1.4 Apr 11, 2023
0.1.2 Mar 13, 2023

#7 in #blazing

Download history 106/week @ 2024-02-23 139/week @ 2024-03-01 40/week @ 2024-03-08 28/week @ 2024-03-15 12/week @ 2024-03-29

106 downloads per month

MIT/Apache and maybe CC-PDDC

135KB
2.5K SLoC

Nushell 2K SLoC // 0.1% comments Rust 195 SLoC // 0.0% comments PowerShell 181 SLoC // 0.0% comments

posh-tabcomplete

Crates.io Build Status

Blazing fast tab completion for powershell and pwsh.

demo

This video is using the MenuComplete binding in code $PROFILE:

Set-PSReadLineKeyHandler -Key Tab MenuComplete

Features:

  • Fast startup and execution using nushell/nu-engine
  • Extendable using .nu files, with built in support for commmon tasks like git and npm run
  • Supports all platforms. Tested on windows, WSL, mac and linux

By default, completions.nu is used. An alternative .nu file can be specified in the TABCOMPLETE_FILE environment variable.

Installation

Step 1. Install binary

There are binaries available in releases, or with one of these commands:

Repository Instructions
crates.io cargo install posh-tabcomplete --locked

Step 2. Setup powershell

Add this line to your profile, you can edit this by typing code $PROFILE in powershell:

Invoke-Expression (&posh-tabcomplete init | Out-String)

Built in completions

The completions packaged with the binary in completions.nu are:

Benchmarks

To run these, run ./benchmark/benchmark_all.ps1

Benchmark Results
benchmark/init - startup time posh-tabcomplete: 45ms, posh-git: 280ms (6.22x faster)
benchmark/complete - tab completion (100 branches) posh-tabcomplete: 104ms, posh-git: 222ms (2.13x faster)

Aliases / Function support

Functions are supported. For example, the completion of gco in the demo is:

function gco() { git checkout $args }

There is no support for alias completions at this time.

Full list of completions

See completions.nu:

  • git
    • branch
    • checkout
    • cherry-pick
    • fetch
    • merge
    • push
    • rebase
    • switch
    • diff
  • npm
    • run

Dependencies

~61–99MB
~2M SLoC