-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy path.emacs
82 lines (67 loc) · 2 KB
/
.emacs
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
;; RELATIVE Line Numbers
(global-display-line-numbers-mode)
(menu-bar-display-line-numbers-mode 'relative)
;; Don't ask me to follow symlinks
(setq vc-follow-symlinks t)
(global-set-key (kbd "C-s") 'save-buffer)
;; Package Installs
(require 'package)
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/"))
(package-initialize)
;; (package-refresh-contents) ;; Run this now and again, slow on boot (1-2s)
(defun install(package)
(unless (package-installed-p package)
(package-install package))
)
(install 'evil)
(evil-mode 1)
(install 'evil-commentary)
(evil-commentary-mode)
(install 'evil-escape)
(evil-escape-mode)
(setq-default evil-escape-key-sequence "jk")
(install 'evil-goggles)
(evil-goggles-mode)
(install 'fzf)
(define-key evil-normal-state-map "\C-p" 'fzf-git-files)
(install 'wakatime-mode)
(global-wakatime-mode)
;; vim-tmux-navigator stolen from https://github.com/keith/evil-tmux-navigator
(global-unset-key (kbd "C-h"))
(when (fboundp 'windmove-default-keybindings)
(windmove-default-keybindings))
(defun tmux-navigate (direction)
(let
((cmd (concat "windmove-" direction)))
(condition-case nil
(funcall (read cmd))
(error
(tmux-command direction)))))
(defun tmux-command (direction)
(shell-command-to-string
(concat "tmux select-pane -"
(tmux-direction direction))))
(defun tmux-direction (direction)
(upcase
(substring direction 0 1)))
(define-key evil-normal-state-map
(kbd "C-h")
(lambda ()
(interactive)
(tmux-navigate "left")))
(define-key evil-normal-state-map
(kbd "C-j")
(lambda ()
(interactive)
(tmux-navigate "down")))
(define-key evil-normal-state-map
(kbd "C-k")
(lambda ()
(interactive)
(tmux-navigate "up")))
(define-key evil-normal-state-map
(kbd "C-l")
(lambda ()
(interactive)
(tmux-navigate "right")))