Removed bloat

This commit is contained in:
Aleksandr Lebedev 2025-02-01 10:58:18 +01:00
parent 1edb1a0e4e
commit dff0de6a63

View file

@ -5,10 +5,7 @@
* Table of contents :toc:
- [[#important-programs-to-load-first][IMPORTANT PROGRAMS TO LOAD FIRST]]
- [[#evil-mode][Evil Mode]]
- [[#recent-files][Recent Files]]
- [[#general-keybindings][General Keybindings]]
- [[#startup-time][Startup Time]]
- [[#support-functions][Support functions]]
- [[#emacs-function-launcher][Emacs function launcher]]
- [[#copy-to-clipboard][Copy to clipboard]]
@ -25,7 +22,6 @@
- [[#standalone-emoji-picker][Standalone emoji picker]]
- [[#flycheck][FLYCHECK]]
- [[#fonts][Fonts]]
- [[#zooming-inout][Zooming In/Out]]
- [[#sane-defaults][Sane defaults]]
- [[#battery-info][Battery info]]
- [[#epub-support-reader-in-emacs][Epub support (Reader in Emacs)]]
@ -63,154 +59,16 @@
- [[#descriptions][Descriptions]]
- [[#theme][Theme]]
- [[#theme-loading][Theme loading]]
- [[#tldr][TLDR]]
- [[#transparency][Transparency]]
- [[#which-key][WHICH-KEY]]
- [[#emacs-on-android][Emacs on Android]]
* IMPORTANT PROGRAMS TO LOAD FIRST
** Evil Mode
#+begin_src emacs-lisp :lexical t
(use-package evil
:ensure t
:init ;; tweak evil's configuration before loading it
(setq evil-want-integration t) ;; This is optional since it's already set to t by default.
(setq evil-want-keybinding nil)
(setq evil-vsplit-window-right t)
(setq evil-split-window-below t)
(setq evil-undo-system 'undo-redo) ;; Adds vim-like C-r redo functionality
(evil-mode))
(use-package evil-collection
:ensure t
:after evil
:config
;; Do not uncomment this unless you want to specify each and every mode
;; that evil-collection should works with. The following line is here
;; for documentation purposes in case you need it.
;; (setq evil-collection-mode-list '(calendar dashboard dired ediff info magit ibuffer))
(add-to-list 'evil-collection-mode-list 'help) ;; evilify help mode
(evil-collection-init))
(use-package evil-tutor
:ensure t)
;; Using RETURN to follow links in Org/Evil
;; Unmap keys in 'evil-maps if not done, (setq org-return-follows-link t) will not work
(with-eval-after-load 'evil-maps
(define-key evil-motion-state-map (kbd "SPC") nil)
(define-key evil-motion-state-map (kbd "RET") nil)
(define-key evil-motion-state-map (kbd "TAB") nil))
;; Setting RETURN key in org-mode to follow links
(setq org-return-follows-link t)
#+end_src
** Recent Files
#+begin_src emacs-lisp
(recentf-mode t)
#+end_src
** General Keybindings
#+begin_src emacs-lisp
(use-package general
:ensure t
:config
(general-evil-setup)
)
(require 'general) ;; If i do this in :config, it says that function is wrong
;; set up 'SPC' as the global leader key
(general-create-definer kylekrein/leader-keys
:states '(normal insert visual emacs)
:keymaps 'override
:prefix "SPC" ;; set leader
:global-prefix "M-SPC") ;; access leader in insert mode
(kylekrein/leader-keys
"." '(find-file :wk "Find file")
"f r" '(recentf-open :wk "Open recent file")
"f d" '(find-grep-dired :wk "Search for string in files in DIR")
"TAB TAB" '(comment-line :wk "Comment lines"))
(kylekrein/leader-keys
"b" '(:ignore t :wk "buffer")
"b b" '(switch-to-buffer :wk "Switch buffer")
"b i" '(ibuffer :wk "Ibuffer")
"b k" '(kill-current-buffer :wk "Kill current buffer")
"b n" '(next-buffer :wk "Next buffer")
"b p" '(previous-buffer :wk "Previous buffer")
"b r" '(revert-buffer :wk "Reload buffer"))
(kylekrein/leader-keys
"e" '(:ignore t :wk "Eshell/Ediff/Evaluate")
"e b" '(eval-buffer :wk "Evaluate elisp in buffer")
"e d" '(eval-defun :wk "Evaluate defun containing or after point")
"e e" '(eval-expression :wk "Evaluate and elisp expression")
"e l" '(eval-last-sexp :wk "Evaluate elisp expression before point")
"e r" '(eval-region :wk "Evaluate elisp in region")
"e s" '(eshell :which-key "Eshell")
"e f" '(ediff-files :wk "Run ediff on a pair of files"))
(kylekrein/leader-keys
"h" '(:ignore t :wk "Help")
"h f" '(describe-function :wk "Describe function")
"h v" '(describe-variable :wk "Describe variable"))
;;"h r r" '((lambda () (interactive) (load-file "~/.config/emacs/init.el")) :wk "Reload emacs config"))
;;"h r r" '(reload-init-file :wk "Reload emacs config"))
(kylekrein/leader-keys
"t" '(:ignore t :wk "Toggle")
"t l" '(display-line-numbers-mode :wk "Toggle line numbers")
"t t" '(visual-line-mode :wk "Toggle truncated lines")
"t v" '(vterm-toggle :wk "Toggle vterm"))
(kylekrein/leader-keys
"o" '(:ignore t :wk "Open")
"o a" '(org-agenda :wk "Agenda")
)
(kylekrein/leader-keys
"n" '(:ignore t :wk "Notes")
"n r" '(:ignore t :wk "Roam")
"n r f" '(org-roam-node-find :wk "Find and open")
"n r i" '(org-roam-node-insert :wk "Insert link")
"n r l" '(org-roam-buffer-toggle :wk "Show backlinks")
"n r m" '(org-roam-dailies-map :wk "Dailies")
"n r s" '(org-roam-db-sync :wk "Sync Notes DB (After changes on another device)")
)
(kylekrein/leader-keys
"d" '(:ignore t :wk "Dired")
"d d" '(dired :wk "Open dired")
"d j" '(dired-jump :wk "Dired jump to current")
"d n" '(neotree-dir :wk "Open directory in neotree")
"d p" '(peep-dired :wk "Peep-dired"))
(kylekrein/leader-keys
"w" '(:ignore t :wk "Windows")
;; Window splits
"w c" '(evil-window-delete :wk "Close window")
"w n" '(evil-window-new :wk "New window")
"w s" '(evil-window-split :wk "Horizontal split window")
"w v" '(evil-window-vsplit :wk "Vertical split window")
;; Window motions
"w h" '(evil-window-left :wk "Window left")
"w j" '(evil-window-down :wk "Window down")
"w k" '(evil-window-up :wk "Window up")
"w l" '(evil-window-right :wk "Window right")
"w w" '(evil-window-next :wk "Goto next window")
;; Move Windows
"w H" '(buf-move-left :wk "Buffer move left")
"w J" '(buf-move-down :wk "Buffer move down")
"w K" '(buf-move-up :wk "Buffer move up")
"w L" '(buf-move-right :wk "Buffer move right"))
#+end_src
* Startup Time
#+begin_src emacs-lisp
;; Startup time
(defun efs/display-startup-time ()
(message
"Emacs loaded in %s with %d garbage collections."
(format
"%.2f seconds"
(float-time
(time-subtract after-init-time before-init-time)))
gcs-done))
(add-hook 'emacs-startup-hook #'efs/display-startup-time)
#+end_src
* Support functions
** Emacs function launcher
Launches emacs function as a window
@ -489,15 +347,7 @@ This package implements hiding or abbreviation of the modeline displays (lighter
(use-package peep-dired
:ensure t
:after dired
:hook (evil-normalize-keymaps . peep-dired-hook)
:config
(evil-define-key 'normal dired-mode-map (kbd "h") 'dired-up-directory)
(evil-define-key 'normal dired-mode-map (kbd "l") 'dired-open-file) ; use dired-find-file instead if not using dired-open package
(evil-define-key 'normal peep-dired-mode-map (kbd "j") 'peep-dired-next-file)
(evil-define-key 'normal peep-dired-mode-map (kbd "k") 'peep-dired-prev-file)
)
;;(add-hook 'peep-dired-hook 'evil-normalize-keymaps)
#+end_src
* EDIFF
ediff is a diff program that is built into Emacs. By default, ediff splits files vertically and places the help frame in its own window. I have changed this so the two files are split horizontally and the help frame appears as a lower split within the existing window. Also, I create my own dt-ediff-hook where I add j/k for moving to next/prev diffs. By default, this is set to n/p.
@ -582,17 +432,6 @@ Defining the various fonts that Emacs will use.
(setq-default line-spacing 0.12))
#+end_src
** Zooming In/Out
You can use the bindings CTRL plus =/- for zooming in/out. You can also use CTRL plus the mouse wheel for zooming in/out.
#+begin_src emacs-lisp
(global-set-key (kbd "C-=") 'text-scale-increase)
(global-set-key (kbd "C--") 'text-scale-decrease)
(global-set-key (kbd "<C-wheel-up>") 'text-scale-increase)
(global-set-key (kbd "<C-wheel-down>") 'text-scale-decrease)
#+end_src
* Sane defaults
The following settings are simple modes that are enabled (or disabled) so that Emacs functions more like you would expect a proper editor/IDE to function.
#+begin_src emacs-lisp
@ -608,9 +447,9 @@ The following settings are simple modes that are enabled (or disabled) so that E
(global-auto-revert-mode t) ;; Automatically show changes if the file has changed
(global-display-line-numbers-mode 1) ;; Display line numbers
(global-visual-line-mode t) ;; Enable truncated lines
(menu-bar-mode -1) ;; Disable the menu bar
(menu-bar-mode 1) ;; Disable the menu bar
(scroll-bar-mode -1) ;; Disable the scroll bar
(tool-bar-mode -1) ;; Disable the tool bar
(tool-bar-mode 1) ;; Disable the tool bar
(setq org-edit-src-content-indentation 0) ;; Set src block automatic indent to 0 instead of 2.
(setq use-file-dialog nil) ;; No file dialog
(setq use-dialog-box nil) ;; No dialog box
@ -891,11 +730,7 @@ Vterm is a terminal emulator within Emacs. The 'shell-file-name' setting sets t
#+begin_src emacs-lisp
(use-package sudo-edit
:ensure t
:config
(kylekrein/leader-keys
"fu" '(sudo-edit-find-file :wk "Sudo find file")
"fU" '(sudo-edit :wk "Sudo edit file")))
:ensure t)
#+end_src
* Language support
Emacs has built-in programming language modes for Lisp, Scheme, DSSSL, Ada, ASM, AWK, C, C++, Fortran, Icon, IDL (CORBA), IDLWAVE, Java, Javascript, M4, Makefiles, Metafont, Modula2, Object Pascal, Objective-C, Octave, Pascal, Perl, Pike, PostScript, Prolog, Python, Ruby, Simula, SQL, Tcl, Verilog, and VHDL. Other languages will require you to install additional modes.
@ -1122,11 +957,6 @@ Descriptions for completions
;; Corrects (and improves) org-mode's native fontification.
(doom-themes-org-config))
#+end_src
* TLDR
Too long didn't read - documentation
#+begin_src emacs-lisp
(use-package tldr :ensure t)
#+end_src
* Transparency
With Emacs version 29, true transparency has been added.
#+begin_src emacs-lisp
@ -1158,5 +988,12 @@ With Emacs version 29, true transparency has been added.
(when (string-equal system-type "android")
(setq touch-screen-keyboard-function t)
(setq touch-screen-display-keyboard t)
(menu-bar-mode 1) ;; Enable the menu bar
(scroll-bar-mode 1) ;; Enable the scroll bar
(tool-bar-mode 1) ;;Enable the tool bar
(setq use-file-dialog t) ;; file dialog
(setq use-dialog-box t) ;; dialog box
(setq pop-up-windows t) ;; popup windows
)
#+end_src