0

I connect to various locations, for example:

/ssh:hostname|sudo:hostname:/
/ssh:hostname|sudo:hostname|docker:container:/

and want to have some kind of short aliases for these long paths. Something like this:

/su-hn:/
/dk-hn:/

How can I get it?

0

Just use environment variables for the tramp paths.

For an example you could add the following line to your init file (with the right substitution for hostname):

(setenv "suHn" "/ssh:hostname|sudo:hostname:")

Those variables are resolved if you use them like $suHn/ at the prompt of find-file.

Note however that I am not sure about the pipe-character | in your tramp path. I never used such syntax for tramp and it is also not mentioned in tramp's file name conventions.

1
  • Thank you, it is the most useful approach at the moment. – artscan Apr 15 '19 at 5:50
0

Read the Tramp Manual, chapter Frequently Asked Questions (https://www.gnu.org/software/tramp/#Frequently-Asked-Questions). It explains in length several approaches to shorten remote file names. These approaches are valid also for multi-hop file names.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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