10

I recently started using Helm with the configuration below

(require 'helm-config)
(helm-mode 1)
(define-key global-map [remap occur] 'helm-occur)
(define-key global-map [remap list-buffers] 'helm-buffers-list)
(define-key global-map [remap dabbrev-expand] 'helm-dabbrev)
(global-set-key (kbd "M-x") 'helm-M-x)
(setq helm-M-x-fuzzy-match t)

Today I figured out that Tramp mode doesn't work anymore. When I try to open a file with C-x C-f and enter /sudo:root@TAB nothing happens. Usually I'd expect that localhost is substituted and tramp asks for a password.

How can I have a still functional tramp mode plus a working Helm?

3
  • 1
    Isn't root and localhost default for /sudo? I think /sudo:: should work.
    – PythonNut
    Commented Feb 3, 2016 at 5:25
  • 1
    Yeah, but this doesn't work either. Commented Feb 3, 2016 at 7:53
  • Good, question. I'm going through this right now on 2020.
    – MarkSkayff
    Commented Apr 3, 2020 at 20:59

2 Answers 2

5

the way it works for me is the following:

  1. call helm-find-files (usually C-xC-f)
  2. write /scp:
  3. if you have used tramp before you get a list with previous locations which you can select with C-j (or type a new remote by hand), pressing now C-j a second time or typing a : will connect you to the remote server
  4. now helm completion on the remote starts, type / if you want to be located in the root directory or ~, if you want to access your home directory
1
  • 1
    This does not work for me. Even more when I have a specific port on my virtual machine.
    – MarkSkayff
    Commented Apr 3, 2020 at 21:22
1

Ok, this is an issue and it's odd Helm doesn't recognize the /ssh: as usual Emacs does with Tramp.

The way I worked around this is as follows.

With Helm you rewrite the C-x C-f command to use helm-find-files. What I did then is to remap this to another keybinding, one that is not in use. For instance, in my .emacs I did:

(global-set-key (kbd "C-x C-h") #'helm-find-files)`

I bound helm-find-files to C-x c-h whenever I want to use the helm files finder. Then with the usual C-x C-f I keep connecting with the remote servers or vm's using Tramp.

And the nice thing about this is that after you connect with Tramp, then using the helm-find-files works ok with the ssh remote connection.

Edit (another option):

Another option, and it's one I ended up doing is to remap the Emacs Elisp function find-file, usually bound to C-x C-f to a different keybinding, like this:

(global-set-key (kbd "C-x C-h") 'find-file)

And then the C-x C-f can be used by Helm with helm-find-file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.