From 9acb10c41560bed47f67005375cc5fed61aeed1a Mon Sep 17 00:00:00 2001 From: Julian T Date: Sat, 11 Sep 2021 01:26:46 +0200 Subject: Alter emacs keybindings This commit replaces splitting, so they cursor is moved to the new frame. Also swaps C-h and C-x because h is a lot easier to hit. --- emacs/.emacs | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/emacs/.emacs b/emacs/.emacs index f051328..232b2e5 100644 --- a/emacs/.emacs +++ b/emacs/.emacs @@ -10,8 +10,8 @@ 'geiser-racket 'company 'nix-mode - 'lsp-mode - 'magit + 'lsp-mode + 'magit )) (mapc (lambda (pack) @@ -21,6 +21,7 @@ (require 'use-package) (require 'nix-mode) +(require 'magit) (use-package evil :ensure t @@ -43,10 +44,26 @@ (global-hl-line-mode) (global-display-line-numbers-mode) (setq display-line-numbers-type 'relative) - (tool-bar-mode -1) (toggle-scroll-bar -1) +;; Keyboard bindings +(defun split-and-follow-horizontal () + (interactive) + (split-window-below) + (balance-windows) + (other-window 1)) +(global-set-key(kbd "C-x 2") 'split-and-follow-horizontal) +(defun split-and-follow-vertical () + (interactive) + (split-window-right) + (balance-windows) + (other-window 1)) +(global-set-key(kbd "C-x 3") 'split-and-follow-vertical) + +(keyboard-translate ?\C-h ?\C-x) +(keyboard-translate ?\C-x ?\C-h) + ;; Completion (require 'lsp-mode) -- cgit v1.2.3