Emacs level up
This commit is contained in:
parent
b2c1e8732b
commit
e459041e92
2 changed files with 142 additions and 84 deletions
131
config.org
131
config.org
|
|
@ -11,17 +11,16 @@
|
||||||
- [[#startup-time][Startup Time]]
|
- [[#startup-time][Startup Time]]
|
||||||
- [[#app-launcher][App Launcher]]
|
- [[#app-launcher][App Launcher]]
|
||||||
- [[#standalone-run][Standalone run]]
|
- [[#standalone-run][Standalone run]]
|
||||||
|
- [[#backup-files-tilda-files][Backup files (tilda files)]]
|
||||||
- [[#company][Company]]
|
- [[#company][Company]]
|
||||||
- [[#dashboard][Dashboard]]
|
- [[#dashboard][Dashboard]]
|
||||||
- [[#diminish][Diminish]]
|
- [[#diminish][Diminish]]
|
||||||
- [[#dired-file-manager][DIRED (File manager)]]
|
- [[#dired-file-manager][DIRED (File manager)]]
|
||||||
|
- [[#ediff][EDIFF]]
|
||||||
- [[#flycheck][FLYCHECK]]
|
- [[#flycheck][FLYCHECK]]
|
||||||
- [[#fonts][Fonts]]
|
- [[#fonts][Fonts]]
|
||||||
- [[#zooming-inout][Zooming In/Out]]
|
- [[#zooming-inout][Zooming In/Out]]
|
||||||
- [[#graphical-user-interface-tweaks][GRAPHICAL USER INTERFACE TWEAKS]]
|
- [[#sane-defaults][Sane defaults]]
|
||||||
- [[#disable-menubar-toolbars-and-scrollbars][Disable Menubar, Toolbars and Scrollbars]]
|
|
||||||
- [[#display-line-numbers-and-truncated-lines][Display Line Numbers and Truncated Lines]]
|
|
||||||
- [[#disable-gui-elements][Disable GUI elements]]
|
|
||||||
- [[#battery-info][Battery info]]
|
- [[#battery-info][Battery info]]
|
||||||
- [[#magit][MAGIT]]
|
- [[#magit][MAGIT]]
|
||||||
- [[#minibuffer-escape][Minibuffer escape]]
|
- [[#minibuffer-escape][Minibuffer escape]]
|
||||||
|
|
@ -32,7 +31,6 @@
|
||||||
- [[#org-mode][ORG MODE]]
|
- [[#org-mode][ORG MODE]]
|
||||||
- [[#enabling-table-of-contents][Enabling Table of Contents]]
|
- [[#enabling-table-of-contents][Enabling Table of Contents]]
|
||||||
- [[#enabling-org-bullets][Enabling Org Bullets]]
|
- [[#enabling-org-bullets][Enabling Org Bullets]]
|
||||||
- [[#disable-electric-indent][Disable Electric Indent]]
|
|
||||||
- [[#org-level-headers][Org Level Headers]]
|
- [[#org-level-headers][Org Level Headers]]
|
||||||
- [[#source-code-block-tag-expansion][Source Code Block Tag Expansion]]
|
- [[#source-code-block-tag-expansion][Source Code Block Tag Expansion]]
|
||||||
- [[#org-roam][ORG ROAM]]
|
- [[#org-roam][ORG ROAM]]
|
||||||
|
|
@ -47,13 +45,18 @@
|
||||||
- [[#vterm][Vterm]]
|
- [[#vterm][Vterm]]
|
||||||
- [[#vterm-toggle][Vterm-Toggle]]
|
- [[#vterm-toggle][Vterm-Toggle]]
|
||||||
- [[#sudo-edit][SUDO EDIT]]
|
- [[#sudo-edit][SUDO EDIT]]
|
||||||
|
- [[#language-support][Language support]]
|
||||||
|
- [[#nix][Nix]]
|
||||||
- [[#nerd-icons][Nerd Icons]]
|
- [[#nerd-icons][Nerd Icons]]
|
||||||
- [[#nerd-icons-completion][Nerd Icons Completion]]
|
- [[#nerd-icons-completion][Nerd Icons Completion]]
|
||||||
- [[#buffer-move][Buffer Move]]
|
- [[#buffer-move][Buffer Move]]
|
||||||
- [[#vertico][Vertico]]
|
- [[#vertico][Vertico]]
|
||||||
|
- [[#consult][Consult]]
|
||||||
|
- [[#embark][Embark]]
|
||||||
- [[#descriptions][Descriptions]]
|
- [[#descriptions][Descriptions]]
|
||||||
- [[#theme][Theme]]
|
- [[#theme][Theme]]
|
||||||
- [[#theme-loading][Theme loading]]
|
- [[#theme-loading][Theme loading]]
|
||||||
|
- [[#tldr][TLDR]]
|
||||||
- [[#transparency][Transparency]]
|
- [[#transparency][Transparency]]
|
||||||
- [[#which-key][WHICH-KEY]]
|
- [[#which-key][WHICH-KEY]]
|
||||||
|
|
||||||
|
|
@ -67,12 +70,17 @@
|
||||||
(setq evil-want-keybinding nil)
|
(setq evil-want-keybinding nil)
|
||||||
(setq evil-vsplit-window-right t)
|
(setq evil-vsplit-window-right t)
|
||||||
(setq evil-split-window-below t)
|
(setq evil-split-window-below t)
|
||||||
|
(setq evil-undo-system 'undo-redo) ;; Adds vim-like C-r redo functionality
|
||||||
(evil-mode))
|
(evil-mode))
|
||||||
(use-package evil-collection
|
(use-package evil-collection
|
||||||
:ensure t
|
:ensure t
|
||||||
:after evil
|
:after evil
|
||||||
:config
|
:config
|
||||||
(setq evil-collection-mode-list '(dashboard dired ibuffer))
|
;; 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))
|
(evil-collection-init))
|
||||||
(use-package evil-tutor
|
(use-package evil-tutor
|
||||||
:ensure t)
|
:ensure t)
|
||||||
|
|
@ -107,6 +115,7 @@
|
||||||
(kylekrein/leader-keys
|
(kylekrein/leader-keys
|
||||||
"." '(find-file :wk "Find file")
|
"." '(find-file :wk "Find file")
|
||||||
"f r" '(recentf-open :wk "Open recent 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"))
|
"TAB TAB" '(comment-line :wk "Comment lines"))
|
||||||
(kylekrein/leader-keys
|
(kylekrein/leader-keys
|
||||||
"b" '(:ignore t :wk "buffer")
|
"b" '(:ignore t :wk "buffer")
|
||||||
|
|
@ -118,13 +127,14 @@
|
||||||
"b r" '(revert-buffer :wk "Reload buffer"))
|
"b r" '(revert-buffer :wk "Reload buffer"))
|
||||||
|
|
||||||
(kylekrein/leader-keys
|
(kylekrein/leader-keys
|
||||||
"e" '(:ignore t :wk "Eshell/Evaluate")
|
"e" '(:ignore t :wk "Eshell/Ediff/Evaluate")
|
||||||
"e b" '(eval-buffer :wk "Evaluate elisp in buffer")
|
"e b" '(eval-buffer :wk "Evaluate elisp in buffer")
|
||||||
"e d" '(eval-defun :wk "Evaluate defun containing or after point")
|
"e d" '(eval-defun :wk "Evaluate defun containing or after point")
|
||||||
"e e" '(eval-expression :wk "Evaluate and elisp expression")
|
"e e" '(eval-expression :wk "Evaluate and elisp expression")
|
||||||
"e l" '(eval-last-sexp :wk "Evaluate elisp expression before point")
|
"e l" '(eval-last-sexp :wk "Evaluate elisp expression before point")
|
||||||
"e r" '(eval-region :wk "Evaluate elisp in region")
|
"e r" '(eval-region :wk "Evaluate elisp in region")
|
||||||
"e s" '(eshell :which-key "Eshell"))
|
"e s" '(eshell :which-key "Eshell")
|
||||||
|
"e f" '(ediff-files :wk "Run ediff on a pair of files"))
|
||||||
|
|
||||||
(kylekrein/leader-keys
|
(kylekrein/leader-keys
|
||||||
"h" '(:ignore t :wk "Help")
|
"h" '(:ignore t :wk "Help")
|
||||||
|
|
@ -376,6 +386,11 @@ To use it, create a global keyboard shortcut with the following code
|
||||||
(app-launcher-run-app)
|
(app-launcher-run-app)
|
||||||
(delete-frame))))
|
(delete-frame))))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
* Backup files (tilda files)
|
||||||
|
By default, Emacs creates automatic backups of files in their original directories, such “file.el” and the backup “file.el~”. This leads to a lot of clutter, so let’s tell Emacs to put all backups that it creates in the ~TRASH~ directory.
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(setq backup-directory-alist '((".*" . "~/.local/share/Trash/files")))
|
||||||
|
#+end_src
|
||||||
* Company
|
* Company
|
||||||
[[https://company-mode.github.io/][Company]] is a text completion framework for Emacs. The name stands for “complete anything”. Completion will start automatically after you type a few letters. Use M-n and M-p to select, <return> to complete or <tab> to complete the common part.
|
[[https://company-mode.github.io/][Company]] is a text completion framework for Emacs. The name stands for “complete anything”. Completion will start automatically after you type a few letters. Use M-n and M-p to select, <return> to complete or <tab> to complete the common part.
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
|
|
@ -450,6 +465,19 @@ This package implements hiding or abbreviation of the modeline displays (lighter
|
||||||
|
|
||||||
;;(add-hook 'peep-dired-hook 'evil-normalize-keymaps)
|
;;(add-hook 'peep-dired-hook 'evil-normalize-keymaps)
|
||||||
#+end_src
|
#+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’.
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(setq ediff-split-window-function 'split-window-horizontally
|
||||||
|
ediff-window-setup-function 'ediff-setup-windows-plain)
|
||||||
|
|
||||||
|
(defun dt-ediff-hook ()
|
||||||
|
(ediff-setup-keymap)
|
||||||
|
(define-key ediff-mode-map "j" 'ediff-next-difference)
|
||||||
|
(define-key ediff-mode-map "k" 'ediff-previous-difference))
|
||||||
|
|
||||||
|
(add-hook 'ediff-mode-hook 'dt-ediff-hook)
|
||||||
|
#+end_src
|
||||||
* FLYCHECK
|
* FLYCHECK
|
||||||
Install luacheck from your Linux distro’s repositories for flycheck to work correctly with lua files. Install python-pylint for flycheck to work with python files. Haskell works with flycheck as long as haskell-ghc or haskell-stack-ghc is installed. For more information on language support for flycheck, [[https://www.flycheck.org/en/latest/languages.html][read this]].
|
Install luacheck from your Linux distro’s repositories for flycheck to work correctly with lua files. Install python-pylint for flycheck to work with python files. Haskell works with flycheck as long as haskell-ghc or haskell-stack-ghc is installed. For more information on language support for flycheck, [[https://www.flycheck.org/en/latest/languages.html][read this]].
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
|
|
@ -502,23 +530,25 @@ You can use the bindings CTRL plus =/- for zooming in/out. You can also use CTR
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
|
|
||||||
* GRAPHICAL USER INTERFACE TWEAKS
|
* Sane defaults
|
||||||
Let's make GNU Emacs look a little better.
|
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.
|
||||||
|
|
||||||
** Disable Menubar, Toolbars and Scrollbars
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(menu-bar-mode -1)
|
|
||||||
(tool-bar-mode -1)
|
|
||||||
(scroll-bar-mode -1)
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
** Display Line Numbers and Truncated Lines
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(global-display-line-numbers-mode 1)
|
|
||||||
(global-visual-line-mode t)
|
|
||||||
#+end_src
|
|
||||||
** Disable GUI elements
|
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
|
(delete-selection-mode 1) ;; You can select text and delete it by typing.
|
||||||
|
(electric-indent-mode -1) ;; Turn off the weird indenting that Emacs does by default.
|
||||||
|
(electric-pair-mode 1) ;; Turns on automatic parens pairing
|
||||||
|
;; The following prevents <> from auto-pairing when electric-pair-mode is on.
|
||||||
|
;; Otherwise, org-tempo is broken when you try to <s TAB...
|
||||||
|
(add-hook 'org-mode-hook (lambda ()
|
||||||
|
(setq-local electric-pair-inhibit-predicate
|
||||||
|
`(lambda (c)
|
||||||
|
(if (char-equal c ?<) t (,electric-pair-inhibit-predicate c))))))
|
||||||
|
(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
|
||||||
|
(scroll-bar-mode -1) ;; Disable the scroll 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-file-dialog nil) ;; No file dialog
|
||||||
(setq use-dialog-box nil) ;; No dialog box
|
(setq use-dialog-box nil) ;; No dialog box
|
||||||
(setq pop-up-windows nil) ;; No popup windows
|
(setq pop-up-windows nil) ;; No popup windows
|
||||||
|
|
@ -550,6 +580,7 @@ The modeline is the bottom status bar that appears in Emacs windows. While you
|
||||||
(setq doom-modeline-height 35 ;; sets modeline height
|
(setq doom-modeline-height 35 ;; sets modeline height
|
||||||
doom-modeline-bar-width 5 ;; sets right bar width
|
doom-modeline-bar-width 5 ;; sets right bar width
|
||||||
doom-modeline-persp-name t ;; adds perspective name to modeline
|
doom-modeline-persp-name t ;; adds perspective name to modeline
|
||||||
|
doom-modeline-time t ;; shows time
|
||||||
doom-modeline-persp-icon t)) ;; adds folder icon next to persp name
|
doom-modeline-persp-icon t)) ;; adds folder icon next to persp name
|
||||||
#+end_src
|
#+end_src
|
||||||
* PROJECTILE
|
* PROJECTILE
|
||||||
|
|
@ -607,14 +638,6 @@ Org-bullets gives us attractive bullets rather than asterisks.
|
||||||
(use-package org-bullets :ensure t)
|
(use-package org-bullets :ensure t)
|
||||||
(add-hook 'org-mode-hook (lambda () (org-bullets-mode 1)))
|
(add-hook 'org-mode-hook (lambda () (org-bullets-mode 1)))
|
||||||
#+end_src
|
#+end_src
|
||||||
** Disable Electric Indent
|
|
||||||
Org mode source blocks have some really weird and annoying default indentation behavior. I think this has to do with electric-indent-mode, which is turned on by default in Emacs. So let's turn it OFF!
|
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(electric-indent-mode -1)
|
|
||||||
(setq org-edit-src-content-indentation 0)
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
** Org Level Headers
|
** Org Level Headers
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(custom-set-faces
|
(custom-set-faces
|
||||||
|
|
@ -805,6 +828,23 @@ Vterm is a terminal emulator within Emacs. The 'shell-file-name' setting sets t
|
||||||
"fu" '(sudo-edit-find-file :wk "Sudo find file")
|
"fu" '(sudo-edit-find-file :wk "Sudo find file")
|
||||||
"fU" '(sudo-edit :wk "Sudo edit file")))
|
"fU" '(sudo-edit :wk "Sudo edit file")))
|
||||||
#+end_src
|
#+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.
|
||||||
|
** Nix
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(use-package nix-mode
|
||||||
|
:ensure t
|
||||||
|
:mode ("\\.nix\\'" "\\.nix.in\\'"))
|
||||||
|
(use-package nix-drv-mode
|
||||||
|
:ensure nix-mode
|
||||||
|
:mode "\\.drv\\'")
|
||||||
|
(use-package nix-shell
|
||||||
|
:ensure nix-mode
|
||||||
|
:commands (nix-shell-unpack nix-shell-configure nix-shell-build))
|
||||||
|
(use-package nix-repl
|
||||||
|
:ensure nix-mode
|
||||||
|
:commands (nix-repl))
|
||||||
|
#+end_src
|
||||||
* Nerd Icons
|
* Nerd Icons
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(use-package nerd-icons
|
(use-package nerd-icons
|
||||||
|
|
@ -909,14 +949,19 @@ one, an error is signaled."
|
||||||
;; (vertico-scroll-margin 0) ;; Different scroll margin
|
;; (vertico-scroll-margin 0) ;; Different scroll margin
|
||||||
;; (vertico-count 20) ;; Show more candidates
|
;; (vertico-count 20) ;; Show more candidates
|
||||||
;; (vertico-resize t) ;; Grow and shrink the Vertico minibuffer
|
;; (vertico-resize t) ;; Grow and shrink the Vertico minibuffer
|
||||||
;; (vertico-cycle t) ;; Enable cycling for `vertico-next/previous'
|
(vertico-cycle t) ;; Enable cycling for `vertico-next/previous'
|
||||||
|
:bind (:map vertico-map
|
||||||
|
("C-j" . vertico-next)
|
||||||
|
("C-k" . vertico-previous)
|
||||||
|
:map minibuffer-local-map
|
||||||
|
("C-h" . backward-kill-word)
|
||||||
|
)
|
||||||
:init
|
:init
|
||||||
(vertico-mode))
|
(vertico-mode))
|
||||||
|
|
||||||
(vertico-mode t) ;; enable vertico for all buffers
|
(vertico-mode t) ;; enable vertico for all buffers
|
||||||
;; Persist history over Emacs restarts. Vertico sorts by history position.
|
;; Persist history over Emacs restarts. Vertico sorts by history position.
|
||||||
(use-package savehist
|
(use-package savehist
|
||||||
:ensure -1 ;;package is unavailable in nix
|
|
||||||
:init
|
:init
|
||||||
(savehist-mode))
|
(savehist-mode))
|
||||||
|
|
||||||
|
|
@ -946,8 +991,8 @@ one, an error is signaled."
|
||||||
'(read-only t cursor-intangible t face minibuffer-prompt))
|
'(read-only t cursor-intangible t face minibuffer-prompt))
|
||||||
(add-hook 'minibuffer-setup-hook #'cursor-intangible-mode))
|
(add-hook 'minibuffer-setup-hook #'cursor-intangible-mode))
|
||||||
|
|
||||||
;; Optionally use the `orderless' completion style.
|
;; Optionally use the `orderless' completion style.
|
||||||
(use-package orderless
|
(use-package orderless
|
||||||
:ensure t
|
:ensure t
|
||||||
:custom
|
:custom
|
||||||
;; Configure a custom style dispatcher (see the Consult wiki)
|
;; Configure a custom style dispatcher (see the Consult wiki)
|
||||||
|
|
@ -957,6 +1002,13 @@ one, an error is signaled."
|
||||||
(completion-category-defaults nil)
|
(completion-category-defaults nil)
|
||||||
(completion-category-overrides '((file (styles partial-completion)))))
|
(completion-category-overrides '((file (styles partial-completion)))))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
** Consult
|
||||||
|
A collection of commands (like Counsel for Ivy), which provide additional completions.
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
|
||||||
|
#+end_src
|
||||||
|
** Embark
|
||||||
|
Provides actions for the current selection in Vertico completion list (ex. Remove/Rename file in ~find-file~)
|
||||||
** Descriptions
|
** Descriptions
|
||||||
*** Marginalia
|
*** Marginalia
|
||||||
[[https://github.com/minad/marginalia/]]
|
[[https://github.com/minad/marginalia/]]
|
||||||
|
|
@ -1001,6 +1053,11 @@ Descriptions for completions
|
||||||
;; Corrects (and improves) org-mode's native fontification.
|
;; Corrects (and improves) org-mode's native fontification.
|
||||||
(doom-themes-org-config))
|
(doom-themes-org-config))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
* TLDR
|
||||||
|
Too long didn't read - documentation
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(use-package tldr :ensure t)
|
||||||
|
#+end_src
|
||||||
* Transparency
|
* Transparency
|
||||||
With Emacs version 29, true transparency has been added.
|
With Emacs version 29, true transparency has been added.
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,7 @@
|
||||||
with pkgs; [
|
with pkgs; [
|
||||||
#nerd-fonts.jetbrains-mono
|
#nerd-fonts.jetbrains-mono
|
||||||
#jetbrains-mono
|
#jetbrains-mono
|
||||||
|
unzip
|
||||||
];
|
];
|
||||||
|
|
||||||
# Optionally override derivations.
|
# Optionally override derivations.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue