Skip to content

Commit

Permalink
Make method changeable when use tramp multi hop
Browse files Browse the repository at this point in the history
  • Loading branch information
masasam committed Jun 15, 2019
1 parent 066936b commit e9bbf99
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions counsel-tramp.el
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@
"Tramp with ivy interface for ssh, docker, vagrant"
:group 'counsel)

(defcustom counsel-tramp-default-method "ssh"
"Default method when use tramp multi hop."
:group 'counsel-tramp
:type 'string)

(defcustom counsel-tramp-docker-user nil
"If you want to use login user name when `docker-tramp' used, set variable."
:group 'counsel-tramp
Expand Down Expand Up @@ -112,14 +117,14 @@ Kill all remote buffers."
(concat "/" tramp-default-method ":" (car result) ":")
hosts)
(push
(concat "/ssh:" (car result) "|sudo:root@" (car result) ":/")
(concat "/" counsel-tramp-default-method ":" (car result) "|sudo:root@" (car result) ":/")
hosts)
(pop result)))
(push
(concat "/" tramp-default-method ":" host ":")
hosts)
(push
(concat "/ssh:" host "|sudo:root@" host ":/")
(concat "/" counsel-tramp-default-method ":" host "|sudo:root@" host ":/")
hosts))))
(when (string-match "Include +\\(.+\\)$" host)
(setq include-file (match-string 1 host))
Expand Down Expand Up @@ -147,7 +152,7 @@ Kill all remote buffers."
(concat "/" tramp-default-method ":" hostuser "@" hostname "#" port ":")
hosts)
(push
(concat "/ssh:" hostuser "@" hostname "#" port "|sudo:root@" hostname ":/")
(concat "/" counsel-tramp-default-method ":" hostuser "@" hostname "#" port "|sudo:root@" hostname ":/")
hosts))))))
(when (require 'docker-tramp nil t)
(cl-loop for line in (cdr (ignore-errors (apply #'process-lines "docker" (list "ps"))))
Expand Down

0 comments on commit e9bbf99

Please sign in to comment.