Add start message and update :wq :q <3

This commit is contained in:
Rawley Fowler 2022-05-28 18:17:33 -06:00 committed by GitHub
parent b0515ebf2a
commit 023ef43379
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,8 +2,19 @@
;; I was a long time Vim user. But emacs stole my heart. ;; I was a long time Vim user. But emacs stole my heart.
;;; Code: ;;; Code:
(setq inhibit-startup-message t) ;; Borrowed this from https://github.com/aaronbieber/dotfiles/blob/master/configs/emacs.d/init.el
(setq initial-scratch-message nil) (setq initial-scratch-message
(concat
";; This buffer is for text that is not saved, and for Lisp evaluation.\n"
";; To create a file, visit it with C-x C-f and enter text in its buffer.\n"
";;\n"
";; __ __ _ \n"
";; \\ \\ / / | | \n"
";; \\ \\ /\\ / /__| | ___ ___ _ __ ___ ___ \n"
";; \\ \\/ \\/ / _ \\ |/ __/ _ \\| '_ ` _ \\ / _ \\ \n"
";; \\ /\\ / __/ | (_| (_) | | | | | | __/_ \n"
";; \\/ \\/ \\___|_|\\___\\___/|_| |_| |_|\\___(_)\n"))
(when (version<= "26.0.50" emacs-version) (when (version<= "26.0.50" emacs-version)
(global-display-line-numbers-mode)) ;; Line numbers (global-display-line-numbers-mode)) ;; Line numbers
(defalias 'yes-or-no-p 'y-or-n-p) (defalias 'yes-or-no-p 'y-or-n-p)
@ -62,16 +73,23 @@
(setq evil-split-window-below t) (setq evil-split-window-below t)
(evil-mode)) (evil-mode))
(defun selective-window-kill ()
(when (< 2 (count-windows))
(delete-window)))
(defun save-and-kill-buffer () ;; Saves and kills a buffer, vim style (defun save-and-kill-buffer () ;; Saves and kills a buffer, vim style
(interactive) (interactive)
(save-buffer) (save-buffer)
(kill-buffer)) (kill-buffer)
(defun kill-buffer-evil () (selective-window-kill))
(defun kill-buffer-and-window ()
(interactive) (interactive)
(kill-buffer)) (kill-buffer)
(selective-window-kill))
(evil-ex-define-cmd "wq" 'save-and-kill-buffer) (evil-ex-define-cmd "wq" 'save-and-kill-buffer)
(evil-ex-define-cmd "q" 'kill-buffer-evil) (evil-ex-define-cmd "q" 'kill-buffer-and-window)
(use-package evil-collection (use-package evil-collection
:after evil :after evil