summaryrefslogtreecommitdiff
path: root/settings/setup-ido.el
diff options
context:
space:
mode:
authorbenj <benj@rse8.com>2016-05-15 21:19:51 -0700
committerbenj <benj@rse8.com>2016-05-15 21:19:51 -0700
commit529fb864f0ef8719d477b9f12bc2686b34db7039 (patch)
treea9af49221a217eeeb352b8823e02e7cda81826d4 /settings/setup-ido.el
downloademacs-529fb864f0ef8719d477b9f12bc2686b34db7039.tar
emacs-529fb864f0ef8719d477b9f12bc2686b34db7039.tar.gz
emacs-529fb864f0ef8719d477b9f12bc2686b34db7039.tar.bz2
emacs-529fb864f0ef8719d477b9f12bc2686b34db7039.tar.lz
emacs-529fb864f0ef8719d477b9f12bc2686b34db7039.tar.xz
emacs-529fb864f0ef8719d477b9f12bc2686b34db7039.tar.zst
emacs-529fb864f0ef8719d477b9f12bc2686b34db7039.zip
initial minimal setup
Diffstat (limited to 'settings/setup-ido.el')
-rw-r--r--settings/setup-ido.el48
1 files changed, 48 insertions, 0 deletions
diff --git a/settings/setup-ido.el b/settings/setup-ido.el
new file mode 100644
index 0000000..6805260
--- /dev/null
+++ b/settings/setup-ido.el
@@ -0,0 +1,48 @@
+;; Stolen from magnars
+;; https://github.com/magnars/.emacs.d/blob/master/settings/setup-ido.el
+
+(require 'ido)
+(ido-mode t)
+(setq ido-enable-prefix nil
+ ido-enable-flex-matching t
+ ido-case-fold nil
+ ido-auto-merge-work-directories-length -1
+ ido-create-new-buffer 'always
+ ido-use-filename-at-point nil
+ ido-max-prospects 10)
+
+(require 'ido-vertical-mode)
+(ido-vertical-mode)
+
+;; C-n/p is more intuitive in vertical layout
+(setq ido-vertical-define-keys 'C-n-C-p-up-down-left-right)
+
+(defun my/ido-go-straight-home ()
+ (interactive)
+ (cond
+ ((looking-back "~/") (insert "projects/"))
+ ((looking-back "/") (insert "~/"))
+ (:else (call-interactively 'self-insert-command))))
+
+(defun my/setup-ido ()
+ ;; Go straight home
+ (define-key ido-file-completion-map (kbd "~") 'my/ido-go-straight-home)
+ (define-key ido-file-completion-map (kbd "C-~") 'my/ido-go-straight-home)
+
+ ;; 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)
+
+(add-to-list 'ido-ignore-directories "target")
+(add-to-list 'ido-ignore-directories "node_modules")
+
+(provide 'setup-ido)