1. 11

  2. 3

    This is my first post I hope I did everything right.

    When I wrote this two weeks ago I was surprised that there wasn’t a bash-completion for vim and at the time I wanted to use vim scp:// with remote path/file completion like rsync/scp have. It was a bit more tricky to do than I initial thought but it worked out really great in the end.

    A bit more on the vim scp:// part, the main part of the completion script. You can type vim scp:// to get a list of all hosts which are configured in your ssh_config. Then the script adds two slashes and suggests you paths on the host. Vim is not using the default host:/path format separated by colon which makes it a bit harder to do as bash-completion thinks the host is a path.

    Make sure to use ControlMaster/ControlSocket to make the completions appear in this century.

    1. 3

      Cool! Multiplexing / control sockets is how we do autocomplete through SSH with Fig (https://withfig.com).

      I saw you specify the control path to be: ~/.ssh/sockets/%C

      If the sockets subdirectory doesn’t exist, I believe this doesn’t work (we implemented it a while ago so I could be wrong). I would make clear to users they need to create that sockets subdirectory, you should create it for them, or you should save the sockets in the .ssh folder.

      (This is my first ever post here too 😊)

      1. 2

        You are right. The directory is not created automatically but they are in my dotfiles so I totally forgot.