Open matys1 opened 1 year ago
The suggestions you are seeing as you type, are not provided by posh-git but by PowerShell PSReadLine module. These work in all directories, not only inside git repositories.
When you press tab
key, you are getting posh-git autocompletion. When you press right arrow, you'll get PSReadLine autocompletion.
If this is confusing, you can turn off PSReadLine inline suggestions. Maybe sometimes in the future posh-git will have a auto-completion plugin that is compatible with PSReadLine.
@mrkaarel Thank you very much, you've given me enough information to make the changes I needed. I ended up moving PSReadLine's AcceptSuggestion
to Tab
and AcceptNextSuggestionWord
to RightArrow
in effect overriding posh-git's tab completion completely as my preference was to use PSReadLine. Not sure if there's a proper way to disable posh-git's tab completion via ps1 profile settings though? Either way this works for me now.
@matys1 , Be aware, though, that PSReadLine's suggestions comes from your history, not from the current context. So while it will suggest co
to be commit
, it will not be able to suggest what file to add based on your modified files. I'll also question how useful history based auto suggestion is for 'git commit' - how often do you reuse the same commit message?
The suggestions you are seeing as you type, are not provided by posh-git but by PowerShell PSReadLine module. These work in all directories, not only inside git repositories.
When you press
tab
key, you are getting posh-git autocompletion. When you press right arrow, you'll get PSReadLine autocompletion.If this is confusing, you can turn off PSReadLine inline suggestions. Maybe sometimes in the future posh-git will have a auto-completion plugin that is compatible with PSReadLine.
how can we change the inline suggestion from arrow right to tab?
Take a look at the readme for PSReadLine:
To view the current key bindings:
Get-PSReadLineKeyHandler
To set your own custom keybindings, use the cmdlet Set-PSReadLineKeyHandler. For example, for a better history experience, try:
Set-PSReadLineKeyHandler -Key UpArrow -Function HistorySearchBackward
Set-PSReadLineKeyHandler -Key DownArrow -Function HistorySearchForward
If you combinde that with @matys1 reply a little further up, I'm sure you'll reach your goal :-)
System Details
Issue Description
I'm confused by the behavior of pressing
tab
key for tab completion. Two examples:First: I type in
git st
and the autocomplete suggestion isgit status
. I press tab and it completes it asgit stash
. I then have to press tab again to cycle and getgit status
, the command that was initially suggested and the one that I needed.Two: I type in
git co
and the autocomplete suggestion isgit commit -am "amended docs"
based on my historic commits. I press tab as I want to repeat the same command again and it completes togit checkout
.However, in both examples, if I were to press right arrow instead of tab, it would complete the suggested command in full as suggested and as expected. What's the logic behind the tab command? How can I configure so the tab functions like the right arrow?