-
Notifications
You must be signed in to change notification settings - Fork 2
/
navigation.el
83 lines (65 loc) · 2.74 KB
/
navigation.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
;;; navigation.el --- Navigation
;;; Commentary:
;; These customizations make it easier for you to navigate files,
;; switch buffers, and choose options from the minibuffer.
;; "When several buffers visit identically-named files,
;; Emacs must give the buffers distinct names.
;; The usual method for making buffer names unique adds ‘<2>’, ‘<3>’, etc to the end
;; of the buffer names (all but one of them).
;; The forward naming method includes part of the file's directory
;; name at the beginning of the buffer name
;; https://www.gnu.org/software/emacs/manual/html_node/emacs/Uniquify.html
;;; Code:
(require 'uniquify)
(require 'recentf)
(require 'projectile)
(setq uniquify-buffer-name-style 'forward)
;; Turn on recent file mode so that you can more easily switch to
;; recently edited files when you first start emacs
(setq recentf-save-file (concat user-emacs-directory ".recentf"))
(recentf-mode 1)
(setq recentf-max-menu-items 40)
;; Shows a list of buffers
(global-set-key (kbd "C-x C-b") 'ibuffer)
(defun setup-ido ()
"Setup ido mode."
;; ido-mode allows you to more easily navigate choices. For example,
;; when you want to switch buffers, ido presents you with a list
;; of buffers in the the mini-buffer. As you start to type a buffer's
;; name, ido will narrow down the list of buffers to match the text
;; you've typed in
;; http://www.emacswiki.org/emacs/InteractivelyDoThings
(ido-mode t)
;; This allows partial matches, e.g. "tl" will match "Tyrion Lannister"
(setq ido-enable-flex-matching t)
;; Turn this behavior off because it's annoying
(setq ido-use-filename-at-point nil)
;; Don't try to match file across all "work" directories; only match files
;; in the current directory displayed in the minibuffer
(setq ido-auto-merge-work-directories-length -1)
;; Includes buffer names of recently open files, even if they're not
;; open now
(setq ido-use-virtual-buffers t)
;; This enables ido in all contexts where it could be useful, not just
;; for selecting buffer and file names
(ido-ubiquitous-mode t)
(ido-everywhere t)
)
(defun setup-navigation ()
"Setup navigation."
;; Enhances M-x to allow easier execution of commands. Provides
;; a filterable list of possible commands in the minibuffer
;; http://www.emacswiki.org/emacs/Smex
(setq smex-save-file (concat user-emacs-directory ".smex-items"))
(smex-initialize)
(global-set-key (kbd "M-x") 'smex)
(define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map)
(projectile-mode +1)
;; jump to definition
(dumb-jump-mode)
(add-hook 'xref-backend-functions #'dumb-jump-xref-activate)
)
(add-hook 'after-init-hook #'setup-ido)
(add-hook 'after-init-hook #'setup-navigation)
(provide 'navigation)
;;; navigation.el ends here