From 0cb91c18c6e26dcad4e78016bfc6b326547284e1 Mon Sep 17 00:00:00 2001 From: yuzu-eva Date: Wed, 22 Nov 2023 18:27:21 +0100 Subject: Removed Dashboard, added rel line numbers, changed some keybinds --- config.org | 69 ++++++++++++++++++++++++++++++++++---------------------------- init.el | 2 ++ 2 files changed, 40 insertions(+), 31 deletions(-) diff --git a/config.org b/config.org index 1fd94e3..785735b 100644 --- a/config.org +++ b/config.org @@ -65,12 +65,14 @@ Some quality-of-life improvements *** Enable line number -Certain modes will break with line-numbers-mode (e.g. ansi-term) so I'm only enabling it -on some major modes rather than globally +Certain modes will break with line-numbers-mode (e.g. ansi-term) +so I'm only enabling it on some major modes rather than globally. +Also using relative line numbers. #+begin_src emacs-lisp (add-hook 'prog-mode-hook 'display-line-numbers-mode) (add-hook 'text-mode-hook 'display-line-numbers-mode) + (setq display-line-numbers 'relative) #+end_src *** Enable column number @@ -102,11 +104,6 @@ on some major modes rather than globally (show-paren-mode 1) #+end_src -*** Highlight current line -#+begin_src emacs-lisp - (global-hl-line-mode t) -#+end_src - *** Enable conservative scrolling #+begin_src emacs-lisp (setq scroll-conservatively 100) @@ -343,7 +340,7 @@ Function to toggle transparency (defun config-reload () (interactive) (org-babel-load-file (expand-file-name "~/.emacs.d/config.org"))) - (global-set-key (kbd "C-c r") 'config-reload) + (global-set-key (kbd "C-c l") 'config-reload) #+end_src ** Kill all buffers @@ -431,44 +428,48 @@ Taken from [[http://xahlee.info][Xah Lee]]. Inserts a newline above or below, like O and o in vim #+begin_src emacs-lisp - (defun newline-above () + (defun newline-above-and-move () "Inserts a new line above current line and moves cursor to that position" (interactive) (beginning-of-line) (newline-and-indent) (previous-line)) - (global-set-key (kbd "M-O") 'newline-above) + (global-set-key (kbd "M-O") 'newline-above-and-move) - (defun newline-below () + (defun newline-below-and-move () "Inserts a new line below current line and moves cursor to that position" (interactive) (end-of-line) (newline-and-indent)) - (global-set-key (kbd "M-o") 'newline-below) + (global-set-key (kbd "M-o") 'newline-below-and-move) #+end_src -* Use-Package section - -** Initialize =dashboard= +** Duplicate line -Configure a custom starting buffer. Nothing useful, basically just a picture. +Duplicates the current line #+begin_src emacs-lisp - (use-package dashboard - :ensure t - :defer nil - :config - (dashboard-setup-startup-hook) - (setq dashboard-items '((recents . 5))) - (setq dashboard-banner-logo-title "haaaiiii :3") - (setq dashboard-startup-banner "~/.emacs.d/cirno.png") - (setq dashboard-center-content t) - (setq dashboard-show-shortcuts nil) - (setq dashboard-set-init-info t) - (setq dashboard-init-info (format "%d packages loaded in %s" - (length package-activated-list) (emacs-init-time))) - (setq dashboard-set-footer nil)) -#+End_src + ;; duplicate current line + (defun duplicate-current-line (&optional n) + "duplicate current line, make more than 1 copy given a numeric argument" + (interactive "p") + (save-mark-and-excursion + (let ((nb (or n 1)) + (current-line (thing-at-point 'line))) + ;; when on last line, insert a newline first + (when (or (= 1 (forward-line 1)) (eq (point) (point-max))) + (insert "\n")) + + ;; now insert as many time as requested + (while (> n 0) + (insert current-line) + (decf n))))) + + (global-set-key (kbd "C-S-d") 'duplicate-current-line) +#+end_src + +* Use-Package section + ** Initialize =diminish= Hides minor modes to prevent cluttering modeline @@ -708,3 +709,9 @@ Some keybinds to make life easier #+begin_src emacs-lisp (global-set-key (kbd "C-c c") 'comment-line) #+end_src + +** Bind compile command to C-c r + +#+begin_src emacs-lisp + (global-set-key (kbd "C-c r") 'compile) +#+end_src diff --git a/init.el b/init.el index 123c374..fbf11ef 100644 --- a/init.el +++ b/init.el @@ -42,3 +42,5 @@ (setq custom-file (locate-user-emacs-file "custom-vars.el")) (load custom-file 'noerror 'nomessage) +(put 'upcase-region 'disabled nil) +(put 'downcase-region 'disabled nil) -- cgit v1.2.3