Skip to content

Commit

Permalink
New defcutom to add manually add connections
Browse files Browse the repository at this point in the history
  • Loading branch information
masasam committed Sep 11, 2018
1 parent 35fd630 commit 5e3345f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,14 @@ If you don't make a backup files and lockfiles at remote server, it will be save

## Misc setting

Besides ~/.ssh/config, you can add connections manually.

(setq counsel-tramp-custom-connections '(/ssh:domain|sudo:user@localhost:/))

Example when adding more than two connections manually.

(setq counsel-tramp-custom-connections '(/ssh:domain|sudo:user@localhost:/ /ssh:domain2|sudo:user@localhost:/))

If the shell of the server is zsh it is recommended to connect with bash.

(eval-after-load 'tramp '(setenv "SHELL" "/bin/bash"))
Expand Down
9 changes: 7 additions & 2 deletions counsel-tramp.el
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

;; Author: Masashı Mıyaura
;; URL: https://github.com/masasam/emacs-counsel-tramp
;; Version: 0.4.2
;; Version: 0.5.2
;; Package-Requires: ((emacs "24.3") (counsel "0.10"))

;; This program is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -62,6 +62,11 @@ The hook is called with one argument that is non-nil."
The hook is called with one argument that is non-nil."
:type 'hook)

(defcustom counsel-tramp-custom-connections '()
"A list to manually add extra connections.
E.g.: '(\"/ssh:domain|sudo:user@localhost:/\")."
:type 'string)

(defun counsel-tramp-quit ()
"Quit counsel-tramp.
Kill all remote buffers."
Expand All @@ -76,7 +81,7 @@ Kill all remote buffers."
(insert-file-contents "~/.ssh/config")
(buffer-string))
"\n"))
(hosts (list)))
(hosts counsel-tramp-custom-connections))
(dolist (host source)
(when (string-match "[H\\|h]ost +\\(.+?\\)$" host)
(setq host (match-string 1 host))
Expand Down

0 comments on commit 5e3345f

Please sign in to comment.