How to add powershell autocomplete like POSH Git

git, posh-git, powershell

Solution

There is no such thing as "git handler". The only thing that posh-git shell is doing is replacing default TabExpansion function with own implementation.

You need to modify their implementation to get behavior you want.

If you want to modify it, just run this command within posh-git shell:

notepad (Get-Command TabExpansion).ScriptBlock.File

You can replace notepad with your editor of choice.

EDIT

There are few ways you can do it in this particular case. With all the complexity in this implementation though I would not invest too much time, I would just try to convince tab function that you actually used 'git checkout':

function TabExpansion($line, $lastWord) {
   $line = $line -replace '^gco ', 'git checkout '
   # rest of the function as it is...

BTW: there is no way to create alias like that in PowerShell: aliases in PowerShell can replace command, not command + arguments (for latter you will need to define function).

Problem

I'm using POSH git for powershell and can do for example ``` git checkout mini<tab> ``` and I get ``` git checkout minidisk ``` I'd like to create a alias gco for git checkout to do ``` gco mini<tab> ``` to get ``` gco minidisk ``` Is it possible to forward the tab completion to the POSH git handler?

Original source