summaryrefslogtreecommitdiffstats
path: root/.emacs.d/jd/jd-keys.el
blob: 26a6445f6a0f207b79fb7e52fc7d424e1c27b75e (plain)
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
;;; Dotfiles --- Jakub Dlugosz emacs config
;;; Commentary:

;;; Code:

;; (jd/use-package evil "emacs-evil"
;; 		:init
;; 		(setq evil-want-integration t)
;; 		(setq evil-want-keybinding nil)
;; 		(setq evil-want-C-u-scroll t)
;; 		(setq evil-want-Y-yank-to-eol t) 
;; 		(setq evil-want-C-i-jump nil) 
;; 		(setq evil-undo-system 'undo-tree)
;; 		(setq evil-kill-on-visual-paste nil)
;; 		:config
;; 		(evil-set-initial-state 'exwm-mode 'emacs)
;; 		(evil-mode 1))

(jd/use-package multiple-cursors "emacs-multiple-cursors"
		:config
		(global-set-key (kbd "C-S-c C-S-c") 'mc/edit-lines)
		(global-set-key (kbd "C->") 'mc/mark-next-like-this)
		(global-set-key (kbd "C-<") 'mc/mark-previous-like-this)
		(global-set-key (kbd "C-c C-<") 'mc/mark-all-like-this))

(jd/use-package shackle "emacs-shackle")
(jd/use-package sway "emacs-sway")

(jd/use-package general "emacs-general"
		:config
		(general-create-definer jd/leader-key-def
		  :keymaps '(normal insert visual emacs)
		  :prefix "SPC"
		  :global-prefix "C-z")

		(general-create-definer jd/ctrl-c-keys
		  :prefix "C-c")

		;; (jd/leader-key-def
		;;  "w"  'evil-window-map
		;;  "wr" '(hydra-resize-window/body :which-key "Rezize window")
		;;  "wd" '(evil-window-delete :which-key "Window delete"))
 
		(jd/leader-key-def
		 "ou" '(undo-tree-visualize :which-key "Open"))

		;; remove . key
		;; (define-key evil-normal-state-map (kbd ".") '())
		(jd/leader-key-def
		 "f"  '(:ignore t :which-key "Files")
		 "fs" '(save-buffer :which-key "File save")
		 "." '(find-file :which-key "Find file")
		 "ff" '(find-file :which-key "Find file"))

		(jd/leader-key-def
		 "e"   '(:ignore t :which-key "Eval")
		 "eb"  '(eval-buffer :which-key "Eval buffer")
		 "ee" '(eval-defun :which-key "Eval defun"))

		(jd/leader-key-def
		 :keymaps '(visual)
		 "er" '(eval-region :which-key "Eval region"))

		(defun jd/kill-other-buffers () 
		  (interactive)                                                                   
		  (mapc 'kill-buffer (cdr (buffer-list (current-buffer)))))

		(jd/leader-key-def
		 "bK" '(jd/kill-other-buffers :which-key "Kill other buffers")
		 "bk" '(kill-current-buffer :which-key "Kill buffer")
		 "bB" '(ibuffer :which-key "Open ibuffer")))


(jd/use-package hydra "emacs-hydra"
		;; :defer t
		:config
		(defun jd/text-scale-increase ()
		  (interactive)
		  (let ((old-face-attribute (face-attribute 'default :height)))
		    (set-face-attribute 'default nil :height (+ old-face-attribute 10))))

		(defun jd/text-scale-decrease ()
		  (interactive)
		  (let ((old-face-attribute (face-attribute 'default :height)))
		    (set-face-attribute 'default nil :height (- old-face-attribute 10))))

		;; (defhydra hydra-resize-window (:timeout 4)
		;;   ("h" evil-window-decrease-width "<")
		;;   ("l" evil-window-increase-width ">")
		;;   ("k" evil-window-decrease-height "^")
		;;   ("j" evil-window-increase-height "v")
		;;   ("q" nil "finished" :exit t))

		(defhydra hydra-text-scale-global (:timeout 4)
		  "scale text"
		  ("j" jd/text-scale-increase "in")
		  ("k" jd/text-scale-decrease "out")
		  ("q" nil "finished" :exit t))

		(defhydra hydra-text-scale (:timeout 4)
		  "scale text"
		  ("j" text-scale-increase "in")
		  ("k" text-scale-decrease "out")
		  ("q" nil "finished" :exit t))

		(jd/leader-key-def
		  "tS" '(hydra-text-scale-global/body :which-key "Scale text")
		  "ts" '(hydra-text-scale/body :which-key "Scale text")))


(jd/use-package undo-tree "emacs-undo-tree"
		:diminish
		:config
		(setq undo-tree-auto-save-history nil)
		(global-undo-tree-mode 1))

;; (jd/use-package evil-collection "emacs-evil-collection"
;; 		:after evil
;; 		:config
;; 		(evil-collection-init))


(provide 'jd-keys)

;;; jd-keys.el ends here