Skip to content

Using vi-mode "right" bind skips the leading slash when completing paths in OhMyZsh #830

@niranjankartha

Description

@niranjankartha

Describe the bug

When an autosuggestion for a path is showing, and a trailing slash is suggested by zsh, using the "right" bind in vim to accept the autosuggestion from the plugin, removes the slash suggested by zsh. This does not happen when the "right" arrow key is used.

To Reproduce

Steps to reproduce the behavior:

  1. Enable vim mode in .zshrc. For reference, I am pasting my whole plugins variable from my .zshrc (from OhMyZsh):
plugins=(git vi-mode fzf zsh-autosuggestions)
  1. Ensure that you have completion as an autosuggestion strategy:
ZSH_AUTOSUGGEST_STRATEGY=(completion)
  1. Create the following file structure:
$ tree       
.
└── hello
    └── world

2 directories, 1 file
  1. In insert mode, type file he<tab>. Now, the command line should show:
$ file hello/[world]

where [world] is an autosuggestion from the plugin.

  1. Press <esc> to enter normal mode, and then press l to accept the plugin. The command now goes to:
$ file helloworld

Expected behavior

The completion should include the slash at the end:

$ file hello/world

Screenshots

Autosuggestion for file hello/[world]:
Image

Autocompletion to file helloworld after accepting:
Image

Desktop

  • OS + distribution: Arch Linux 6.14.9-arch1-1
  • Zsh version: 5.9
  • Plugin version: commit hash 0e810e5afa27acbd074398eefbe28d13005dbc15

Additional context

This appears to be caused because the ending slash after hello is suggested by zsh, which gets deleted when zsh-autosuggest completes the suggestion.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions