Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,19 @@ With this plugin you can:
To 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/)


### Custom `Path` Option

`Path` is **not** a valid OpenSSH option — adding it directly to `~/.ssh/config` will fail.
Instead, store it as a comment so SSH ignores it but the plugin can read it:

```sshconfig
Host my-alias
HostName example.com
User myuser
# Path=/home/myuser/projects
```


### 🔔 Callback

You can manage callbacks on events like `on_connect_success` using the following methods:
Expand Down
7 changes: 7 additions & 0 deletions lua/remote-sshfs/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@ M.parse_hosts_from_configs = function(ssh_configs)
local current_config = vim.fn.expand(path)
if vim.fn.filereadable(current_config) == 1 then
for line in io.lines(current_config) do
-- Check for our custom Path comment
local path_value = line:match "^%s*#%s*Path=(.+)$"
if path_value and #current_hosts > 0 then
for _, host in ipairs(current_hosts) do
hosts[host]["Path"] = path_value
end
end
-- Ignore comments and empty lines
if line:sub(1, 1) ~= "#" and line:match "%S" then
-- Check if the line is a Host entry
Expand Down