Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix C-w in ido-read-directory-name

  • Loading branch information...
commit f34be4628cab040dae4f309c2042e21c07146c37 1 parent 5934da0
@magnars magnars authored
Showing with 25 additions and 21 deletions.
  1. +21 −17 setup-ido.el
  2. +4 −4 setup-rgrep.el
View
38 setup-ido.el
@@ -12,7 +12,6 @@
;; Try out flx-ido for better flex matching between words
(require 'flx-ido)
-(ido-everywhere 1)
(flx-ido-mode 1)
;; disable ido faces to see flx highlights.
(setq ido-use-faces nil)
@@ -27,23 +26,28 @@
(define-key ido-completion-map (kbd "C-p") 'ido-prev-match)
(define-key ido-completion-map (kbd "<up>") 'ido-prev-match))
-(add-hook
- 'ido-setup-hook
- (lambda ()
- ;; Go straight home
- (define-key ido-file-completion-map
- (kbd "~")
- (lambda ()
- (interactive)
- (cond
- ((looking-back "~/") (insert "projects/"))
- ((looking-back "/") (insert "~/"))
- (:else (call-interactively 'self-insert-command)))))
+(require 'dash)
- ;; Use C-w to go back up a dir to better match normal usage of C-w
- ;; - insert current file name with C-x C-w instead.
- (define-key ido-file-completion-map (kbd "C-w") 'ido-delete-backward-updir)
- (define-key ido-file-completion-map (kbd "C-x C-w") 'ido-copy-current-file-name)))
+(defun my/setup-ido ()
+ ;; Go straight home
+ (define-key ido-file-completion-map
+ (kbd "~")
+ (lambda ()
+ (interactive)
+ (cond
+ ((looking-back "~/") (insert "projects/"))
+ ((looking-back "/") (insert "~/"))
+ (:else (call-interactively 'self-insert-command)))))
+
+ ;; Use C-w to go back up a dir to better match normal usage of C-w
+ ;; - insert current file name with C-x C-w instead.
+ (define-key ido-file-completion-map (kbd "C-w") 'ido-delete-backward-updir)
+ (define-key ido-file-completion-map (kbd "C-x C-w") 'ido-copy-current-file-name)
+
+ (define-key ido-file-dir-completion-map (kbd "C-w") 'ido-delete-backward-updir)
+ (define-key ido-file-dir-completion-map (kbd "C-x C-w") 'ido-copy-current-file-name))
+
+(add-hook 'ido-setup-hook 'my/setup-ido)
;; Always rescan buffer for imenu
(set-default 'imenu-auto-rescan t)
View
8 setup-rgrep.el
@@ -13,8 +13,8 @@
(error "grep.el: No `grep-find-template' available"))
(t (let* ((regexp (grep-read-regexp))
(files (grep-read-files regexp))
- (dir (read-directory-name "Base directory: "
- nil default-directory t))
+ (dir (ido-read-directory-name "Base directory: "
+ nil default-directory t))
(confirm (equal current-prefix-arg '(4))))
(list regexp files dir confirm))))))
(window-configuration-to-register ?$)
@@ -43,8 +43,8 @@
(let* ((regexp (grep-read-regexp))
(files (grep-read-files regexp))
(files (if (string= "* .*" files) "*" files))
- (dir (read-directory-name "Base directory: "
- nil default-directory t))
+ (dir (ido-read-directory-name "Base directory: "
+ nil default-directory t))
(confirm (equal current-prefix-arg '(4))))
(list regexp files dir confirm)))
(let ((command (format "cd %s && git --no-pager grep %s %s -e %S -- '%s' "
Please sign in to comment.
Something went wrong with that request. Please try again.