branch: master
commit fdd2178cdcc91e8fb9631282f97afcc66ee7d721
Author: Oleh Krehel <[email protected]>
Commit: Oleh Krehel <[email protected]>
ivy.el (ivy--magic-tilde-directory): Use "~~" to move to local home
Doing "/ RET ~" still works, but is too cumbersome.
---
doc/ivy.org | 4 ++++
doc/ivy.texi | 6 ++++++
ivy.el | 3 ++-
3 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/doc/ivy.org b/doc/ivy.org
index 3258669..3fe9bd2 100644
--- a/doc/ivy.org
+++ b/doc/ivy.org
@@ -1038,6 +1038,10 @@ bindings that work here:
- ~/ C-j~ ::
Move the the local root directory.
+- ~~~~ ::
+ Move to the local home directory.
+
+
From any directory, with the empty input, inputting =/ssh:= and pressing
~C-j~ (or ~RET~, which is the same thing) completes for host and user
names.
diff --git a/doc/ivy.texi b/doc/ivy.texi
index 89ae86f..315f655 100644
--- a/doc/ivy.texi
+++ b/doc/ivy.texi
@@ -1379,6 +1379,12 @@ or @code{scpx}.
@indentedblock
Move the the local root directory.
@end indentedblock
+@subsubheading @kbd{~~}
+@kindex ~~
+@indentedblock
+Move to the local home directory.
+@end indentedblock
+
From any directory, with the empty input, inputting @code{/ssh:} and pressing
@kbd{C-j} (or @kbd{RET}, which is the same thing) completes for host and user
diff --git a/ivy.el b/ivy.el
index 8ca0ae3..ccea8d2 100644
--- a/ivy.el
+++ b/ivy.el
@@ -3042,7 +3042,8 @@ Should be run via minibuffer `post-command-hook'."
"Return an appropriate directory for when ~ or ~/ are entered."
(expand-file-name
(let (remote)
- (if (setq remote (file-remote-p ivy--directory))
+ (if (and (setq remote (file-remote-p ivy--directory))
+ (not (string-match-p "/home/\\([^/]+\\)/\\'" (file-local-name
ivy--directory))))
(concat remote "~/")
"~/"))))