File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -173,6 +173,19 @@ With this plugin you can:
173173To learn more about SSH configs and how to write/style one you can read more [ here] ( https://linuxize.com/post/using-the-ssh-config-file/ )
174174
175175
176+ ### Custom ` Path ` Option
177+
178+ ` Path ` is ** not** a valid OpenSSH option — adding it directly to ` ~/.ssh/config ` will fail.
179+ Instead, store it as a comment so SSH ignores it but the plugin can read it:
180+
181+ ``` sshconfig
182+ Host my-alias
183+ HostName example.com
184+ User myuser
185+ # Path=/home/myuser/projects
186+ ```
187+
188+
176189### 🔔 Callback
177190
178191You can manage callbacks on events like ` on_connect_success ` using the following methods:
Original file line number Diff line number Diff line change @@ -55,6 +55,13 @@ M.parse_hosts_from_configs = function(ssh_configs)
5555 local current_config = vim .fn .expand (path )
5656 if vim .fn .filereadable (current_config ) == 1 then
5757 for line in io.lines (current_config ) do
58+ -- Check for our custom Path comment
59+ local path_value = line :match " ^%s*#%s*Path=(.+)$"
60+ if path_value and # current_hosts > 0 then
61+ for _ , host in ipairs (current_hosts ) do
62+ hosts [host ][" Path" ] = path_value
63+ end
64+ end
5865 -- Ignore comments and empty lines
5966 if line :sub (1 , 1 ) ~= " #" and line :match " %S" then
6067 -- Check if the line is a Host entry
You can’t perform that action at this time.
0 commit comments