From 14a6f49ec548ae0889ca93bc23c602ce62a4d093 Mon Sep 17 00:00:00 2001 From: Garfieldcmix Date: Wed, 13 Aug 2025 12:45:18 +0700 Subject: [PATCH 1/2] feat: Add ability to parse Path from config --- lua/remote-sshfs/utils.lua | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lua/remote-sshfs/utils.lua b/lua/remote-sshfs/utils.lua index da291fe..f066602 100644 --- a/lua/remote-sshfs/utils.lua +++ b/lua/remote-sshfs/utils.lua @@ -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 From 88c244bffa89d8fc36be261f9f3ebee957cfae04 Mon Sep 17 00:00:00 2001 From: Garfieldcmix Date: Wed, 13 Aug 2025 12:50:09 +0700 Subject: [PATCH 2/2] doc: Add custom path config usage in README.md --- README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README.md b/README.md index 66fe411..884a20a 100644 --- a/README.md +++ b/README.md @@ -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: