commit 9821562b9925d3c73346cf003a97a94838d6054d
parent 92f1b0756eec212f479729b5aa7d0ce003f7497d
Author: MichaĆ M. Sapka <michal@sapka.me>
Date: Tue, 13 Jun 2023 11:40:32 +0200
Some extra features
Diffstat:
1 file changed, 115 insertions(+), 46 deletions(-)
diff --git a/emacs/.emacs.d/config.org b/emacs/.emacs.d/config.org
@@ -15,15 +15,19 @@
- [[#asdf][ASDF]]
- [[#tree-sitter][Tree sitter]]
- [[#which-key][Which Key]]
+ - [[#tramp][Tramp]]
+ - [[#isearch][Isearch]]
+ - [[#whitespace-cycle][Whitespace cycle]]
- [[#programing][Programing]]
- [[#git][Git]]
- [[#magit][Magit]]
- [[#forge][Forge]]
- [[#git-gutter][Git gutter]]
+ - [[#diff][Diff]]
- [[#flycheck][Flycheck]]
- [[#company-mode][Company mode]]
- [[#indentation][Indentation]]
- - [[#regrep][Regrep]]
+ - [[#ripgrep][Ripgrep]]
- [[#lsp][LSP]]
- [[#ruby][Ruby]]
- [[#using-emacs-as-a-shell][Using Emacs as a shell]]
@@ -52,16 +56,14 @@
;;; -*- lexical-binding: t -*-
#+END_SRC
-#+RESULTS:
-
** Package management
#+BEGIN_SRC emacs-lisp
(require 'package)
(setq package-archives '(("melpa" . "https://melpa.org/packages/")
- ("org" . "https://orgmode.org/elpa/")
- ("elpa" . "https://elpa.gnu.org/packages/")))
+ ("org" . "https://orgmode.org/elpa/")
+ ("elpa" . "https://elpa.gnu.org/packages/")))
(package-initialize)
(unless package-archive-contents (package-refresh-contents))
@@ -71,7 +73,13 @@
(package-install 'use-package))
(require 'use-package)
+ #+end_src
+ #+RESULTS:
+ : use-package
+
+Auto-update packages.
+#+begin_src emacs-lisp
(use-package auto-package-update
:ensure t
:custom
@@ -83,6 +91,9 @@
(auto-package-update-at-time "09:00"))
#+END_SRC
+#+RESULTS:
+: t
+
** Encoding
I want to use UTF-8 everywhere
@@ -93,16 +104,24 @@ I want to use UTF-8 everywhere
(set-language-environment "UTF-8")
#+END_SRC
+#+RESULTS:
+: t
+
** Set look and behavior
+:PROPERTIES:
+:DIR: ~/dotfiles/emacs/.emacs.d/
+:END:
Hide the UI
#+BEGIN_SRC emacs-lisp
(setq require-final-newline t)
(tool-bar-mode -1)
- (setq visible-bell t
+(setq visible-bell nil)
#+END_SRC
+#+RESULTS:
+
Show line numbers in the gutter
#+BEGIN_SRC emacs-lisp
@@ -122,12 +141,15 @@ A lot of those values are taken directly from the theme's documentation.
modus-themes-completions '(opinionated)
modus-themes-completion '((t . (extrabold underline)))
modus-themes-prompts '(italic bold)
-
- modus-themes-bold-constructs t
- modus-themes-italic-constructs t
modus-themes-paren-match '(bold intense))
#+end_src
+Enable bold/italic for content highlight
+#+begin_src emacs-lisp
+ (setq modus-themes-bold-constructs t
+ modus-themes-italic-constructs t)
+#+end_src
+
Make the headings on org-mode more obvious. You need to set =modus-themes-scale-headings= for Modus to scale the themes.
#+begin_src emacs-lisp
@@ -137,9 +159,6 @@ Make the headings on org-mode more obvious. You need to set =modus-themes-scale-
(setq modus-themes-scale-headings t)
#+end_src
-#+RESULTS:
-: t
-
Make source code blocks in Org more visible
#+begin_src emacs-lisp
@@ -152,7 +171,7 @@ And finally, set up the theme.
(load-theme 'modus-operandi t)
#+end_src
-We can use a keyboard key to switch between light and dark theme. Since my window is right behind me when I'm sitting in front of a monitor, a light theme comes handy.
+We can use a keyboard key to switch between light and dark theme. Since my window is right behind me when I'm sitting in front of a monitor, a light theme comes in handy.
#+begin_src emacs-lisp
(define-key global-map (kbd "<f5>") #'modus-themes-toggle)
@@ -234,6 +253,35 @@ Essential package. An automatic cheat sheet for keyboard bindings.
:ensure t)
#+END_SRC
+** Tramp
+
+#+begin_src emacs-lisp
+(require 'tramp-cache)
+(setq tramp-persistency-file-name "~/tmp/tramp.log")
+#+end_src
+
+#+RESULTS:
+: ~/tmp
+
+** Isearch
+
+Treat " " (space) as "match any" when doing isearch, so "pr ou" will match Protesilaos Stavrou, from whom I took this.
+REF: https://www.youtube.com/watch?v=4-ubCJF9htw
+
+#+begin_src emacs-lisp
+ (setq search-whitespace-regexp ".*")
+ (setq isearch-lax-whitespace t)
+ (setq isearch-regexp-lax-whitespace nil)
+#+end_src
+
+** Whitespace cycle
+
+#+begin_src emacs-lisp
+ (global-set-key (kbd "M-SPC") 'cycle-spacing)
+ (global-set-key (kbd "M-o") 'delete-blank-lines)
+#+end_src
+
+
* Programing
I'm a programmer by trade and passion. This part of the config may be the most expansive.
@@ -271,6 +319,22 @@ Show changed lines in the gutter
(setq git-gutter:update-interval 0.02))
#+END_SRC
+*** Diff
+
+#+begin_src emacs-lisp
+(use-package ediff
+ :config
+ (setq ediff-split-window-function 'split-window-horizontally)
+ (setq ediff-window-setup-function 'ediff-setup-windows-plain)
+ (defun my/command-line-diff (switch)
+ (setq initial-buffer-choice nil)
+ (let ((file1 (pop command-line-args-left))
+ (file2 (pop command-line-args-left)))
+ (ediff file1 file2)))
+ ;; show the ediff command buffer in the same frame
+ (add-to-list 'command-switch-alist '("-diff" . my/command-line-diff)))
+#+end_src
+
** Flycheck
#+BEGIN_SRC emacs-lisp
@@ -311,46 +375,46 @@ Yeah, force indentation
:ensure t)
#+END_SRC
-** Regrep
+** Ripgrep
+
+A much faster Grep
#+BEGIN_SRC emacs-lisp
(use-package rg
:ensure t
:config
- (rg-enable-default-bindings)
- )
+ (rg-enable-default-bindings))
#+END_SRC
** LSP
#+BEGIN_SRC emacs-lisp
- (use-package lsp-mode
- :ensure t
- :init
- ;; set prefix for lsp-command-keymap (few alternatives - "C-l", "C-c l")
- (setq lsp-keymap-prefix "C-c l")
- :hook (;; replace XXX-mode with concrete major-mode(e. g. python-mode)
- (typescriptreact-mode . lsp)
- (typescript-moode . lsp)
- (ruby-mode . lsp)
- ;; if you want which-key integration
- )
- :commands lsp)
-
- (use-package lsp-ltex
- :ensure t
- :hook (text-mode . (lambda ()
- (require 'lsp-ltex)
- (lsp))) ; or lsp-deferred
- :init
- (setq lsp-ltex-version "16.0.0"))
-
- ;; optionally
- (use-package lsp-ui
- :ensure t
- :commands lsp-ui-mode)
+ (use-package lsp-mode
+ :ensure t
+ :init
+ ;; set prefix for lsp-command-keymap (few alternatives - "C-l", "C-c l")
+ (setq lsp-keymap-prefix "C-c l")
+ :hook ((ruby-mode . lsp-deferred))
+ :commands lsp
+ :config
+ (lsp-enable-which-key-integration t))
+
+ (use-package lsp-ltex
+ :ensure t
+ :hook (text-mode . (lambda ()
+ (require 'lsp-ltex)
+ (lsp))) ; or lsp-deferred
+ :init
+ (setq lsp-ltex-version "16.0.0"))
+
+ ;; optionally
+ (use-package lsp-ui
+ :ensure t
+ :commands lsp-ui-mode)
#+END_SRC
+#+RESULTS:
+
** Ruby
* Using Emacs as a shell
@@ -366,6 +430,8 @@ Yeah, force indentation
** Mastodon
+You can find me at https://emacs.ch/@ms
+
#+BEGIN_SRC emacs-lisp
(use-package mastodon
:ensure t
@@ -399,9 +465,11 @@ Yeah, force indentation
)
#+END_SRC
-
*** Elfeed-org
+I use literate config for feeds.
+REF: https://michal.sapka.me/2023/elfeed-literate-config/
+
#+BEGIN_SRC emacs-lisp
(use-package elfeed-org
:ensure t
@@ -487,12 +555,13 @@ Level1Techs
** Ebooks reading
+Epub in Emacs? Why not!
+
#+BEGIN_SRC emacs-lisp
(use-package nov
:ensure t
:config
- (add-to-list 'auto-mode-alist '("\\.epub\\'" . nov-mode))
- )
+ (add-to-list 'auto-mode-alist '("\\.epub\\'" . nov-mode)))
#+END_SRC
* Org-mode
@@ -537,7 +606,7 @@ Since it's already baked-in into Org, all I need to do is enable languages I wil
(setq org-confirm-babel-evaluate nil)
#+end_src
-Typing code blocks is tedious, so let's make it easier. Typing =<el<TAB>= will create new block.
+Typing code blocks is tedious, so let's make it easier. Typing =<el<TAB>= will create new elisp block.
#+begin_src emacs-lisp
(require 'org-tempo)
@@ -554,7 +623,7 @@ I'd love to keep bibligraphy in a managable way. Grown ups seem to agree that bi
#+begin_src emacs-lisp
(use-package ebib
- :ensure t)
+ :ensure t)
#+end_src
#+RESULTS: