emacs.d/binds.el

82 lines
3.1 KiB
EmacsLisp

;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; binds.el ;;;;
;;;; Defines keybinds ;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;
;;;; Global ;;;;
;;;;;;;;;;;;;;;;
;; Evil
(setq evil-respect-visual-line-mode t)
(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)
(evil-set-initial-state 'Custom-mode 'normal)
(evil-set-initial-state 'vterm-mode 'insert)
;; 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 ()
(if (not (or (eq major-mode 'latex-mode)
(eq major-mode 'org-mode)))
(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)
(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)))
(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)))
(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)))
(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)
(evil-define-key '(normal insert visual replace operator motion emacs) 'global (kbd "C-<return>") nil)
(global-set-key (kbd "C-<return>") 'multi-vterm)
(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)
(require 'org)
(define-key org-mode-map (kbd "C-<return>") nil)
(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)