[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master ef78fb6 032/399: Add environment variable completion to co
From: |
Oleh Krehel |
Subject: |
[elpa] master ef78fb6 032/399: Add environment variable completion to counsel-find-file |
Date: |
Sat, 20 Jul 2019 14:56:43 -0400 (EDT) |
branch: master
commit ef78fb6dd0d89a51c2e3de7cf3610ff2a854e5df
Author: CeleritasCelery <address@hidden>
Commit: CeleritasCelery <address@hidden>
Add environment variable completion to counsel-find-file
---
counsel.el | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/counsel.el b/counsel.el
index fa214c4..557b531 100644
--- a/counsel.el
+++ b/counsel.el
@@ -1748,6 +1748,7 @@ currently checked out."
(define-key map (kbd "C-DEL") 'counsel-up-directory)
(define-key map (kbd "C-<backspace>") 'counsel-up-directory)
(define-key map (kbd "C-M-y") 'counsel-yank-directory)
+ (define-key map "$" 'counsel-read-env)
map))
(defun counsel-yank-directory ()
@@ -1892,6 +1893,32 @@ Skip some dotfiles unless `ivy-text' requires them."
(defvar counsel-find-file-speedup-remote t
"Speed up opening remote files by disabling `find-file-hook' for them.")
+(defun counsel-read-env ()
+ "Read a file path environment variable and insert it into the
+minibuffer."
+ (interactive)
+ (if (equal ivy-text "")
+ (let ((enable-recursive-minibuffers t)
+ (old-last ivy-last))
+ (ivy-read "Env: "
+ (cl-loop for pair in process-environment
+ for (var val) = (split-string pair "=" t)
+ if (and val (not (equal "" val)))
+ if (file-exists-p
+ (if (file-name-absolute-p val)
+ val
+ (setq val
+ (expand-file-name val ivy--directory))))
+ collect (cons var val))
+ :action (lambda (x)
+ (ivy--reset-state (setq ivy-last old-last))
+ (let ((path (cdr x)))
+ (when (file-accessible-directory-p path)
+ (setq path (file-name-as-directory path)))
+ (insert (abbreviate-file-name path)))
+ (ivy--cd-maybe))))
+ (insert last-input-event)))
+
(defun counsel-find-file-action (x)
"Find file X."
(with-ivy-window
- [elpa] master 48c7087 028/399: ivy.el (ivy-reverse-i-search): Don't bind ivy-recursive-restore to nil, (continued)
- [elpa] master 48c7087 028/399: ivy.el (ivy-reverse-i-search): Don't bind ivy-recursive-restore to nil, Oleh Krehel, 2019/07/20
- [elpa] master 6853290 031/399: counsel-switch-buffer: Add support for ivy-use-virtual-buffers., Oleh Krehel, 2019/07/20
- [elpa] master b0c0371 038/399: Enable counsel-read-env to properly handle directories, Oleh Krehel, 2019/07/20
- [elpa] master 47c8c3d 034/399: counsel.el (counsel-read-env): Simplify, Oleh Krehel, 2019/07/20
- [elpa] master 4ca721c 022/399: swiper.el (swiper-avy): If the input is 1 char, re-highlight, Oleh Krehel, 2019/07/20
- [elpa] master ffffc21 024/399: swiper.el (swiper-mc): Update doc, Oleh Krehel, 2019/07/20
- [elpa] master b01108e 027/399: ivy.el (ivy-call): Call action with whole marked list if it has a second arg, Oleh Krehel, 2019/07/20
- [elpa] master 3216d40 026/399: swiper.el (swiper-avy): Warn if no input, Oleh Krehel, 2019/07/20
- [elpa] master dfeaec0 029/399: swiper.el (swiper--update-input-ivy): Don't rely on window-start in terminal, Oleh Krehel, 2019/07/20
- [elpa] master 9718962 030/399: Add a simple initial counsel-switch-buffer, Oleh Krehel, 2019/07/20
- [elpa] master ef78fb6 032/399: Add environment variable completion to counsel-find-file,
Oleh Krehel <=
- [elpa] master 22fca55 035/399: counsel.el (counsel-file-jump-args): Remove extra backslash, Oleh Krehel, 2019/07/20
- [elpa] master 16367fc 033/399: ivy.el (ivy-call): Call ivy-recursive-restore even if no action, Oleh Krehel, 2019/07/20
- [elpa] master a664943 043/399: BSDs should default to locate not using regular expressions, Oleh Krehel, 2019/07/20
- [elpa] master bedeb02 040/399: Move counsel-read-env to ivy mode, Oleh Krehel, 2019/07/20
- [elpa] master 2a02343 036/399: counsel.el (counsel-file-jump): Fix file expansion, Oleh Krehel, 2019/07/20
- [elpa] master f0b2bc6 037/399: Update ivy-help.org, Oleh Krehel, 2019/07/20
- [elpa] master da9d937 041/399: ivy.el (ivy-call): Allow ivy-inhibit-action to be a function, Oleh Krehel, 2019/07/20
- [elpa] master c38daa3 039/399: Enable counsel-read-env to work in read-file-name, Oleh Krehel, 2019/07/20
- [elpa] master e88c7d6 044/399: counsel.el (counsel-locate-cmd): Simplify, Oleh Krehel, 2019/07/20
- [elpa] master 51c5874 042/399: counsel.el (counsel-find-file-map): Bind "`" to bookmarks, Oleh Krehel, 2019/07/20