emacs.d/binds.el

82 lines
3.1 KiB
EmacsLisp
Raw Normal View History

2022-11-20 16:56:34 +01:00
;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; binds.el ;;;;
;;;; Defines keybinds ;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;
;;;; Global ;;;;
;;;;;;;;;;;;;;;;
;; Evil
2023-02-28 15:41:35 +01:00
(setq evil-respect-visual-line-mode t)
2022-11-20 16:56:34 +01:00
(require 'evil)
(require 'evil-surround)
(require 'evil-commentary)
(require 'evil-leader)
(global-evil-leader-mode 1)
(evil-mode 1)
(evil-commentary-mode 1)
(global-undo-tree-mode 1)
2023-01-10 19:29:35 +01:00
(evil-set-initial-state 'Custom-mode 'normal)
(evil-set-initial-state 'vterm-mode 'insert)
2022-11-20 16:56:34 +01:00
;; Agda input mode ∀ buffers
(load-file (let ((coding-system-for-read 'utf-8))
(shell-command-to-string "agda-mode locate")))
(require 'agda-input)
(add-hook 'evil-insert-state-entry-hook (lambda ()
2022-11-21 18:33:55 +01:00
(if (not (or (eq major-mode 'latex-mode)
(eq major-mode 'org-mode)))
2022-11-20 16:56:34 +01:00
(set-input-method "Agda"))))
(add-hook 'evil-insert-state-exit-hook (lambda () (set-input-method nil)))
;; Windowing
(define-prefix-command 'create-windows)
(global-set-key (kbd "C-a") 'create-windows)
2022-11-22 23:49:42 +01:00
(define-key create-windows (kbd "h") #'(lambda () (interactive)
(split-window-right)
(evil-window-left 1)))
(define-key create-windows (kbd "j") #'(lambda () (interactive)
(split-window-below)
(evil-window-down 1)))
(define-key create-windows (kbd "k") #'(lambda () (interactive)
(split-window-below)
(evil-window-up 1)))
(define-key create-windows (kbd "l") #'(lambda () (interactive)
(split-window-right)
(evil-window-right 1)))
2022-11-20 16:56:34 +01:00
2022-11-22 23:49:42 +01:00
(global-set-key (kbd "C-h") #'(lambda () (interactive) (evil-window-left 1)))
(global-set-key (kbd "C-j") #'(lambda () (interactive) (evil-window-down 1)))
(global-set-key (kbd "C-k") #'(lambda () (interactive) (evil-window-up 1)))
(global-set-key (kbd "C-l") #'(lambda () (interactive) (evil-window-right 1)))
2022-11-20 16:56:34 +01:00
2022-11-22 23:49:42 +01:00
(global-set-key (kbd "M-h") #'(lambda () (interactive) (evil-window-decrease-width 1)))
(global-set-key (kbd "M-j") #'(lambda () (interactive) (evil-window-decrease-height 1)))
(global-set-key (kbd "M-k") #'(lambda () (interactive) (evil-window-increase-height 1)))
(global-set-key (kbd "M-l") #'(lambda () (interactive) (evil-window-increase-width 1)))
2022-11-20 16:56:34 +01:00
2022-11-20 17:10:38 +01:00
(evil-define-key '(normal insert visual replace operator motion emacs) 'global (kbd "C-t") nil)
(evil-define-key '(normal insert visual replace operator motion emacs) 'global (kbd "C-d") nil)
2022-11-22 23:49:42 +01:00
(evil-define-key '(normal insert visual replace operator motion emacs) 'global (kbd "C-<return>") nil)
2023-01-10 19:29:35 +01:00
(global-set-key (kbd "C-<return>") 'multi-vterm)
2022-11-20 17:10:38 +01:00
(global-set-key (kbd "C-t") 'treemacs)
(global-set-key (kbd "C-d") 'evil-quit)
(require 'vterm)
(define-key vterm-mode-map (kbd "C-a") nil)
(define-key vterm-mode-map (kbd "C-h") nil)
(define-key vterm-mode-map (kbd "C-j") nil)
(define-key vterm-mode-map (kbd "C-k") nil)
(define-key vterm-mode-map (kbd "C-l") nil)
2022-11-20 16:56:34 +01:00
2022-11-21 18:33:55 +01:00
(require 'org)
2022-11-22 23:49:42 +01:00
(define-key org-mode-map (kbd "C-<return>") nil)
2022-11-21 18:33:55 +01:00
(define-key org-mode-map (kbd "C-a") nil)
(define-key org-mode-map (kbd "C-h") nil)
(define-key org-mode-map (kbd "C-j") nil)
(define-key org-mode-map (kbd "C-k") nil)
(define-key org-mode-map (kbd "C-l") nil)
(define-key org-mode-map (kbd "C-d") nil)