Giter Site home page Giter Site logo

zsh-ssh's People

Contributors

baprx avatar shourai avatar sunlei avatar thibautplg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

zsh-ssh's Issues

Autocompletion edgecase

@sunlei I found an edge case where autocompletion doesn't work if there is an Include path with wildcards but no matches are found.

My use case is that I have another python tool to create / delete VMs and when created, an ssh_config file is generated per project in the tool's directory, so something like:

Include ~/tools/overlord/projects/*/ssh_configs/*

However, if I have no current projects then I get errors when I try to autocomplete because no matches are found for the above wildcard.

I think I found a fix which is to include the following in _parse_config_file by adding the following:

# disable no match errors for Include with wildcard statements that don't have matches
unsetopt nomatch

This temporarily disables the error message from the attempt at glob expansion and proceeds to auto-complete based on the rest of the SSH config.

I thought it's too trivial to submit a PR so I'm just mentioning it here. On older versions of this plugin (not sure which ones), this wasn't a problem.

Originally posted by @s3nn in #11 (comment)

Plugin won't work if `zsh` is not shipped with `pcre`

Hi and thanks for your very nice zsh plugin.

I had issues insalling it on my 2021 Macbook Pro (M1 Max, Ventura 13.6.2)

After install, Auto complete failed with this error message

❯ ssh _parse_config_file:6: failed to load module `zsh/pcre': dlopen(/usr/lib/zsh/5.9/zsh/pcre.so, 0x0009): tried: '/usr/lib/zsh/5.9/zsh/pcre.so' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/lib/zsh/5.9/zsh/pcre.so' (no such file), '/usr/lib/zsh/5.9/zsh/pcre.so' (no such file, not in dyld cache)
_parse_config_file:6: -pcre-match not available for regex
  ssh

Thanks to some google I was able to find a similar issue / fix: zthxxx/jovial#12

Long story short: System installed zsh (/bin/zsh) does not include pcre

I was able to fix by using zsh from brew. You need to do the following commands

brew reinstall zsh 
brew reinstall pcre pcre2
sudo chsh -s `/opt/homebrew/bin/zsh` $USER
(launch new terminal and you should be good)

still working in 2022?

i using autocomplete plugin and when i try press space after ssh command i have this error:

fzf-complete-ssh:24: command not found: fzf

ssh config.d and include support

Is it possible to have the plugin evaluate ssh host definitions defined in the config.d subdirectory.

[~/.ssh/config file]
include config.d/*

[~/.ssh/config.d file listing]
include1
include2
...

Feature Request: Add scp auto-complete

Hello,

thanks for the plugin works great with SSH, but lately I found myself having to use quiet a lot of SCP and it would be great to have the same autocomplete for SCP.

The issue I see is, that the hostname can be in two places

Hosts not Delimited Breaks Widget

Using nix and home-manager to manage the SSH config file at ~/.ssh/config, which is a symbolic link to a path on a seperate mountpoint, generates a config which does not add a new line between hosts, this seems to break the completion. No widget appears, using a minimal "ssh/config" and "zshrc" andinstalling zsh-ssh manually.

macOS 10.12 ARM
zsh 5.9

Broken `~/.ssh/config

Host test
  Port 22
  User test
  HostName 10.10.10.1
  IdentityFile /some/path
Host test1
  Port 22
  User test1
  HostName 10.10.10.2
  IdentityFile /some/other/path
Host *
  ForwardAgent no
  Compression no
  ServerAliveInterval 0
  ServerAliveCountMax 3
  HashKnownHosts no
  UserKnownHostsFile
  ControlMaster no
  ControlPath
  ControlPersist no

Working ~/.ssh/config

Host test
  Port 22
  User test
  HostName 10.10.10.1
  IdentityFile /some/path

Host test1
  Port 22
  User test1
  HostName 10.10.10.2
  IdentityFile /some/other/path

Host *
  ForwardAgent no
  Compression no
  ServerAliveInterval 0
  ServerAliveCountMax 3
  HashKnownHosts no
  UserKnownHostsFile
  ControlMaster no
  ControlPath
  ControlPersist no

Nested include support

Hello,
First of all, thanks for this plugin.

I've noticed that nested includes aren't supported yet. This is almost a duplicate of this issue: #9 .
To reuse toddeye's example, here is what my config looks like:

[~/.ssh/config file]
include config.d/*

[~/.ssh/config.d file listing]
include1
include2

[~/.ssh/config.d/include1]
include ~/.ssh/config.d/another-directory/*

Isn't a major issue, as copying the include line into an other config file is an easy workaround.

Best regards,

Autocompletion stopped working with commit 2581ff1

Commit 2581ff1 brokes autocompletion (at least for included files).

Here is my patch to fix that issue:

---
 zsh-ssh.zsh | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/zsh-ssh.zsh b/zsh-ssh.zsh
index 342d84d..9a63df8 100644
--- a/zsh-ssh.zsh
+++ b/zsh-ssh.zsh
@@ -8,17 +8,18 @@
 _ssh-host-list() {
   local ssh_config host_list
 
-  ssh_config=$(command awk '
+
+  ssh_config=$(command awk -v PREFIX=$HOME/.ssh/ '
     {
-      if (NF == 2 && tolower($1) == "include")
-        {
-          cmd = "sed -s '\''$G'\'' " $2 " 2> /dev/null"
-          # print cmd
-          while ( (cmd | getline line) > 0 ) {
-            print line
-          }
-          close($2)
+      if (NF == 2 && tolower($1) == "include") {
+        file = PREFIX $2
+        cmd = "sed -s '\''$G'\'' " file " "
+        # print cmd
+        while ( (cmd | getline line) > 0 ) {
+          print line
         }
+        close(file)
+      }
       else {
         print
       }
-- 
2.40.0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.