nixos/config/emacs/init.el

193 lines
4.9 KiB
EmacsLisp
Raw Normal View History

2023-09-05 13:41:34 +04:00
;; Ui/UX
2023-09-04 13:36:15 +04:00
(setq inhibit-startup-message t)
2023-09-04 18:36:14 +04:00
;; make it look like neovim a little
2023-09-04 13:36:15 +04:00
(scroll-bar-mode -1)
(tool-bar-mode -1)
2023-09-04 19:56:05 +04:00
(tooltip-mode -1)
2023-09-04 13:36:15 +04:00
(set-fringe-mode 10)
(menu-bar-mode -1)
;; Line Numbers
(column-number-mode)
(global-display-line-numbers-mode t)
(dolist (mode '(org-mode-hook
term-mode-hook
eshell-mode-hook))
(add-hook mode (lambda () (display-line-numbers-mode 0))))
2023-09-04 18:36:14 +04:00
;; Bell
2023-09-04 13:36:15 +04:00
(setq visible-bell t)
2023-09-04 13:43:15 +04:00
2023-09-04 18:36:14 +04:00
;; Font
2023-09-05 16:32:27 +04:00
(set-face-attribute `default nil :font "JetBrains Mono" :height 150)
2023-09-04 13:54:56 +04:00
2023-09-04 18:36:14 +04:00
;; Keymaps
2023-09-05 13:53:59 +04:00
(global-set-key (kbd "C-M-j") 'counsel-switch-buffer)
2023-09-04 18:36:14 +04:00
;; Make ESC quit prompts
(global-set-key (kbd "<escape>") 'keyboard-escape-quit)
2023-09-04 19:56:05 +04:00
;; Package related stuqff
2023-09-04 17:05:22 +04:00
(require `package)
(setq package-archives `(("mepla" . "https://melpa.org/packages/")
("org" . "https://orgemode.org/elpa/")
("elpa" . "https://elpa.gnu.org/packages/")))
(package-initialize)
(unless package-archive-contents
(package-refresh-contents))
;; Init package for non-linux
(unless (package-installed-p `use-package)
(package-install `use-package))
(require 'use-package)
2023-09-04 17:19:21 +04:00
(setq use-package-always-ensure t)
2023-09-04 19:56:05 +04:00
;; for showing commands
2023-09-04 18:11:22 +04:00
(use-package command-log-mode)
2023-09-04 18:36:14 +04:00
2023-09-04 19:56:05 +04:00
;; better search
(use-package swiper)
;; better commands
(use-package counsel)
;; autocompletion on commands (?)
2023-09-04 18:36:14 +04:00
(use-package ivy
:diminish
:bind (("C-s" . swiper)
:map ivy-minibuffer-map
("TAB" . ivy-alt-done)
("C-l" . ivy-alt-done)
("C-j" . ivy-next-line)
("C-k" . ivy-previous-line)
:map ivy-switch-buffer-map
("C-k" . ivy-previous-line)
("C-l" . ivy-done)
("C-d" . ivy-switch-buffer-kill)
:map ivy-reverse-i-search-map
("C-k" . ivy-previous-line)
2023-09-04 19:56:05 +04:00
("C-d" . ivy-reverse-i-search-kill))
:demand
2023-09-04 18:36:14 +04:00
:config
(ivy-mode 1))
2023-09-04 22:27:24 +04:00
;; better ivy autocompletion
(use-package ivy-rich
:init
(ivy-rich-mode 1))
;; counsel M+X
(use-package counsel
:bind (("M-x" . counsel-M-x)
("C-x b" . counsel-ibuffer)
("C-x C-f" . counsel-find-file)
:map minibuffer-local-map
("C-r" . 'counsel-minibuffer-history))
:config
(setq ivy-inital-inputs-alist nil))
2023-09-05 09:44:04 +04:00
;; doom themes
2023-09-05 13:41:34 +04:00
2023-09-05 12:16:33 +04:00
(use-package doom-themes
:ensure t
:config
;; Global settings (defaults)
(setq doom-themes-enable-bold t ; if nil, bold is universally disabled
doom-themes-enable-italic t) ; if nil, italics is universally disabled
2023-09-05 13:41:34 +04:00
;; load the theme
2023-09-05 12:16:33 +04:00
(load-theme 'doom-monokai-pro t)
;; Enable flashing mode-line on errors
2023-09-05 13:41:34 +04:00
(doom-themes-visual-bell-config))
2023-09-05 12:16:33 +04:00
;; Enable custom neotree theme (all-the-icons must be installed!)
;;(doom-themes-neotree-config)
;; or for treemacs users
;;(setq doom-themes-treemacs-theme "doom-atom") ; use "doom-colors" for less minimal icon theme
;;(doom-themes-treemacs-config)
;; Corrects (and improves) org-mode's native fontification.
;;(doom-themes-org-config))
2023-09-04 22:27:24 +04:00
2023-09-04 19:56:05 +04:00
;; better statusbar
(use-package doom-modeline
:ensure t
2023-09-04 21:57:55 +04:00
:init (doom-modeline-mode 1)
2023-09-05 09:44:04 +04:00
:custom ((doom-modeline-height 35)))
2023-09-04 19:56:05 +04:00
2023-09-05 13:41:34 +04:00
;; all the icons
2023-09-05 17:54:55 +04:00
(use-package all-the-icons)
2023-09-05 13:41:34 +04:00
2023-09-04 19:56:05 +04:00
;; continue configuring from here
;; https://youtu.be/74zOY-vgkyw?t=3125
;; rainbow delimiters for lisp (TODO find this for javascript, c++ etc)
(use-package rainbow-delimiters
:hook (prog-mode . rainbow-delimiters-mode))
;; which-key because i dont know what emacs is
(use-package which-key
:init (which-key-mode)
:diminish which-key-mode
:config
2023-09-04 22:23:23 +04:00
(setq which-key-idle-delay 0))
2023-09-04 22:29:15 +04:00
2023-09-05 09:44:04 +04:00
;; better help menu
2023-09-05 07:47:59 +04:00
(use-package helpful
:ensure t
:custom
(counsel-describe-function-function #'helpful-callable)
(counsel-describe-variable-function #'helpful-variable)
:bind
([remap describe-function ] . counsel-describe-function)
2023-09-05 09:44:04 +04:00
([remap describe-command] . helpful-command)
([remap describe-variable] . counsel-describe-variable)
([remap describe-key] . helpful-key))
2023-09-05 07:47:59 +04:00
2023-09-05 13:53:59 +04:00
;; general emacs
2023-09-05 16:12:36 +04:00
(use-package general
:config
(general-create-definer sakomacs/leader-keys
:keymaps `(normal insert visual emacs)
:prefix "SPC"
:global-prefix "C-SPC")
(sakomacs/leader-keys
"t" `(:ignore t :which-key "toggles")
"tt" `(counsel-load-theme :which-key "choose theme")))
;; EVIL !!!! ITS EVIL I TELL YOU !!!!!!!!!!!!
;; vim like because nothing beats vim keybindings
(use-package evil
:init
(setq evil-want-integration t)
(setq evil-want-keybinding nil)
(setq evil-want-C-u-scroll t)
(setq evil-want-C-i-jump nil)
2023-09-05 20:34:01 +04:00
(evil-mode 1)
:hook (evil-mode . sakomacs.evil-hook)
:ensure t)
2023-09-05 16:12:36 +04:00
2023-09-05 20:34:01 +04:00
(define-key evil-insert-state-map (kbd "C-g") 'evil-normal-state)
(evil-global-set-key 'motion "j" 'evil-next-visual-line)
(evil-global-set-key 'motion "k" 'evil-previous-visual-line)
2023-09-05 16:12:36 +04:00
;; list thing with function
;; idk i dont know lisp im actually sane
;; most of these are copy pasted so i dont know what they do
(defun sakomacs/evil-hook ()
(dolist (mode `(custom-mode
eshell-mode
git-rebase-mode
erc-mode
circe-server-mode
circe-chat-mode
circe-query-mode
sauron-mode
term-mode))
(add-to-list `evil-emacs-state-modes mode)))
2023-09-05 13:53:59 +04:00
2023-09-04 22:29:15 +04:00
;; video
2023-09-05 20:34:01 +04:00
;; https://youtu.be/xaZMwNELaJY?t=1707