stuff? ?!
This commit is contained in:
		
							parent
							
								
									8b9ae374ea
								
							
						
					
					
						commit
						c26662171d
					
				
							
								
								
									
										203
									
								
								init.org
									
									
									
									
									
								
							
							
						
						
									
										203
									
								
								init.org
									
									
									
									
									
								
							| 
						 | 
				
			
			@ -531,6 +531,7 @@ Used by Spacemacs as well.
 | 
			
		|||
  (setq evil-want-C-u-scroll t)
 | 
			
		||||
  (setq evil-want-keybinding nil)
 | 
			
		||||
  (setq evil-want-integration t)
 | 
			
		||||
  (setq evil-undo-system 'undo-fu)
 | 
			
		||||
  :config
 | 
			
		||||
  (evil-mode 1)
 | 
			
		||||
#+end_src
 | 
			
		||||
| 
						 | 
				
			
			@ -789,6 +790,12 @@ End =:config=
 | 
			
		|||
)
 | 
			
		||||
#+end_src
 | 
			
		||||
 | 
			
		||||
Install various export packages:
 | 
			
		||||
#+begin_src emacs-lisp
 | 
			
		||||
(use-package ox-epub
 | 
			
		||||
  :straight t)
 | 
			
		||||
#+end_src
 | 
			
		||||
 | 
			
		||||
Use org-bullets for fancy headline markers
 | 
			
		||||
#+begin_src emacs-lisp :tangle no
 | 
			
		||||
(use-package org-bullets
 | 
			
		||||
| 
						 | 
				
			
			@ -940,6 +947,8 @@ Use the =move-text= package to move the current line or selection up or down wit
 | 
			
		|||
  :defer t
 | 
			
		||||
  ;; hijack projectile prefix because they fit together
 | 
			
		||||
  :bind (("C-x p t" . treemacs-select-window))
 | 
			
		||||
  :config
 | 
			
		||||
  (setq treemacs-width 25)
 | 
			
		||||
  )
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1014,6 +1023,23 @@ Use =consult-xref= for =lsp-xref= and =xref-find-references=.
 | 
			
		|||
  ())
 | 
			
		||||
#+end_src
 | 
			
		||||
 | 
			
		||||
#+begin_src emacs-lisp
 | 
			
		||||
(defun my-consult-line-wrapper ()
 | 
			
		||||
  (interactive)
 | 
			
		||||
  (vertico-posframe-mode -1)
 | 
			
		||||
  (consult-line)
 | 
			
		||||
  (vertico-posframe-mode 1))
 | 
			
		||||
 | 
			
		||||
(defun my-consult-ripgrep-wrapper ()
 | 
			
		||||
  (interactive)
 | 
			
		||||
  (vertico-posframe-mode -1)
 | 
			
		||||
  (consult-ripgrep)
 | 
			
		||||
  (vertico-posframe-mode 1))
 | 
			
		||||
 | 
			
		||||
(bind-key "C-s"   'consult-line custom-bindings-map)
 | 
			
		||||
(bind-key "C-M-s" 'consult-ripgrep custom-bindings-map)
 | 
			
		||||
#+end_src
 | 
			
		||||
 | 
			
		||||
[[https://github.com/minad/marginalia][=marginalia=]] adds marginalia into the mini-buffer, for example key-binds in =M-x=
 | 
			
		||||
#+begin_src emacs-lisp
 | 
			
		||||
(use-package marginalia
 | 
			
		||||
| 
						 | 
				
			
			@ -1022,6 +1048,38 @@ Use =consult-xref= for =lsp-xref= and =xref-find-references=.
 | 
			
		|||
  (marginalia-mode 1))
 | 
			
		||||
#+end_src
 | 
			
		||||
 | 
			
		||||
#+begin_src emacs-lisp :tangle no
 | 
			
		||||
(use-package vertico-prescient
 | 
			
		||||
  :straight t
 | 
			
		||||
  :after vertico
 | 
			
		||||
  :init
 | 
			
		||||
  (vertico-prescient-mode 1)
 | 
			
		||||
  )
 | 
			
		||||
#+end_src
 | 
			
		||||
 | 
			
		||||
** Company - Auto-Completion
 | 
			
		||||
#+begin_src emacs-lisp
 | 
			
		||||
(use-package company
 | 
			
		||||
  :straight t
 | 
			
		||||
  :defer t
 | 
			
		||||
  :hook (after-init . company-mode)
 | 
			
		||||
  :hook (prog-mode . company-mode)
 | 
			
		||||
  :config
 | 
			
		||||
  (setq
 | 
			
		||||
   company-minimum-prefix-length 1
 | 
			
		||||
   company-idle-delay 0.0))
 | 
			
		||||
#+end_src
 | 
			
		||||
 | 
			
		||||
Use =ispell= with company mode for completion in text-modes
 | 
			
		||||
#+begin_src emacs-lisp 
 | 
			
		||||
(use-package ispell
 | 
			
		||||
  :straight t
 | 
			
		||||
  :defer t
 | 
			
		||||
  :config
 | 
			
		||||
  (setq ispell-dictionary "en_GB"))
 | 
			
		||||
#+end_src
 | 
			
		||||
 | 
			
		||||
** COMMENT Corfu - Auto-Completion
 | 
			
		||||
Auto-completion using =corfu=:
 | 
			
		||||
#+begin_src emacs-lisp
 | 
			
		||||
(use-package corfu
 | 
			
		||||
| 
						 | 
				
			
			@ -1040,7 +1098,7 @@ Auto-completion using =corfu=:
 | 
			
		|||
  ;; Preselect the first suggestion
 | 
			
		||||
  (corfu-preselect 'first)
 | 
			
		||||
  (corfu-on-exact-match nil)
 | 
			
		||||
  :init
 | 
			
		||||
  :config
 | 
			
		||||
  (global-corfu-mode))
 | 
			
		||||
 | 
			
		||||
(use-package corfu-terminal
 | 
			
		||||
| 
						 | 
				
			
			@ -1053,13 +1111,13 @@ Auto-completion using =corfu=:
 | 
			
		|||
  )
 | 
			
		||||
 | 
			
		||||
(use-package emacs
 | 
			
		||||
  :custom
 | 
			
		||||
  ;; :custom
 | 
			
		||||
  ;; TODO
 | 
			
		||||
  (enable-recursive-minibuffers t)
 | 
			
		||||
  :init
 | 
			
		||||
  ;; TAB cycle if there are only few candidates
 | 
			
		||||
  (setq completion-cycle-threshold 3)
 | 
			
		||||
  ;; (setq completion-cycle-threshold 3)
 | 
			
		||||
 | 
			
		||||
  (setq enable-recursive-minibuffers t)
 | 
			
		||||
  ;; Hide commands in M-x which do not apply to the current mode.  Corfu
 | 
			
		||||
  ;; commands are hidden, since they are not supposed to be used via M-x.
 | 
			
		||||
  (setq read-extended-command-predicate
 | 
			
		||||
| 
						 | 
				
			
			@ -1120,19 +1178,8 @@ This package seems to slow down search quite a bit in common buffers like find-f
 | 
			
		|||
  )
 | 
			
		||||
#+end_src
 | 
			
		||||
 | 
			
		||||
Fuzzy and out-of-order completion matching using =orderless=:
 | 
			
		||||
#+begin_src emacs-lisp
 | 
			
		||||
(use-package orderless
 | 
			
		||||
  :straight t
 | 
			
		||||
  :config
 | 
			
		||||
  (setq completion-styles '(prescient orderless basic partial-completion)
 | 
			
		||||
        orderless-matching-styles '(orderless-flex)
 | 
			
		||||
        completion-category-overrides '((file (styles basic partial-completion)))
 | 
			
		||||
        orderless-component-separator "[ |]"))
 | 
			
		||||
#+end_src
 | 
			
		||||
 | 
			
		||||
Use =embark= for in-mini-buffer actions:
 | 
			
		||||
#+begin_src emacs-lisp
 | 
			
		||||
#+begin_src emacs-lisp :tangle no
 | 
			
		||||
(use-package embark
 | 
			
		||||
  :straight t
 | 
			
		||||
  :defer t
 | 
			
		||||
| 
						 | 
				
			
			@ -1146,49 +1193,45 @@ Use =embark= for in-mini-buffer actions:
 | 
			
		|||
  :hook (embark-collect-mode . consult-preview-at-point-mode))
 | 
			
		||||
#+end_src
 | 
			
		||||
 | 
			
		||||
Use =prescient= to sort completion candidates:
 | 
			
		||||
Use =corfu-prescient= to sort completion candidates:
 | 
			
		||||
#+begin_src emacs-lisp 
 | 
			
		||||
(use-package corfu-prescient
 | 
			
		||||
  :straight t
 | 
			
		||||
  :after prescient
 | 
			
		||||
  :after corfu
 | 
			
		||||
  ;; :hook (corfu-mode . corfu-prescient-mode)
 | 
			
		||||
  ;; :hook (text-mode . corfu-prescient-mode)
 | 
			
		||||
  :config
 | 
			
		||||
  (setq corfu-prescient-completion-styles '(prescient orderless basic partial-completion))
 | 
			
		||||
  (corfu-prescient-mode 1)
 | 
			
		||||
  )
 | 
			
		||||
 | 
			
		||||
(defun nemo/reset-corfu-prescient ()
 | 
			
		||||
  (interactive)
 | 
			
		||||
  (corfu-prescient-mode -1)
 | 
			
		||||
  (corfu-prescient-mode 1)
 | 
			
		||||
  )
 | 
			
		||||
#+end_src
 | 
			
		||||
 | 
			
		||||
** Orderless & Prescient
 | 
			
		||||
Install =prescient= package:
 | 
			
		||||
#+begin_src emacs-lisp 
 | 
			
		||||
(use-package prescient
 | 
			
		||||
  :straight t
 | 
			
		||||
  :after corfu
 | 
			
		||||
  :defer t
 | 
			
		||||
  :config
 | 
			
		||||
  (add-to-list 'completion-styles 'prescient)
 | 
			
		||||
  (add-to-list 'prescient-filter-method 'fuzzy))
 | 
			
		||||
#+end_src
 | 
			
		||||
 | 
			
		||||
(use-package corfu-prescient
 | 
			
		||||
  :straight t
 | 
			
		||||
  :after corfu
 | 
			
		||||
Fuzzy and out-of-order completion matching using =orderless=:
 | 
			
		||||
#+begin_src emacs-lisp
 | 
			
		||||
(use-package orderless
 | 
			
		||||
  :straight t
 | 
			
		||||
  :config
 | 
			
		||||
  (setq corfu-prescient-completion-styles '(prescient orderless basic partial-completion))
 | 
			
		||||
  (corfu-prescient-mode 1))
 | 
			
		||||
#+end_src
 | 
			
		||||
 | 
			
		||||
After loading =orderless= and =prescient=, configure the =completion-styles= list:
 | 
			
		||||
#+begin_src emacs-lisp
 | 
			
		||||
(setq completion-styles '(prescient orderless basic partial-completion))
 | 
			
		||||
#+end_src
 | 
			
		||||
 | 
			
		||||
#+begin_src emacs-lisp
 | 
			
		||||
(defun my-consult-line-wrapper ()
 | 
			
		||||
  (interactive)
 | 
			
		||||
  (vertico-posframe-mode -1)
 | 
			
		||||
  (consult-line)
 | 
			
		||||
  (vertico-posframe-mode 1))
 | 
			
		||||
 | 
			
		||||
(defun my-consult-ripgrep-wrapper ()
 | 
			
		||||
  (interactive)
 | 
			
		||||
  (vertico-posframe-mode -1)
 | 
			
		||||
  (consult-ripgrep)
 | 
			
		||||
  (vertico-posframe-mode 1))
 | 
			
		||||
 | 
			
		||||
(bind-key "C-s"   'consult-line custom-bindings-map)
 | 
			
		||||
(bind-key "C-M-s" 'consult-ripgrep custom-bindings-map)
 | 
			
		||||
 | 
			
		||||
                                        ; Ensure posframe is always restored when exiting a minibuffer
 | 
			
		||||
(add-hook 'minibuffer-exit-hook
 | 
			
		||||
          (lambda ()
 | 
			
		||||
            (vertico-posframe-mode 1)))
 | 
			
		||||
  (add-to-list 'completion-styles 'orderless)
 | 
			
		||||
  (setq orderless-matching-styles '(orderless-flex)
 | 
			
		||||
        completion-category-overrides '((file (styles basic partial-completion)))
 | 
			
		||||
        orderless-component-separator "[ |]"))
 | 
			
		||||
#+end_src
 | 
			
		||||
 | 
			
		||||
* Programming
 | 
			
		||||
| 
						 | 
				
			
			@ -1197,6 +1240,17 @@ Enable =hs-minor-mode= in =prog-mode= to allow for folding away comments and mod
 | 
			
		|||
(add-hook 'prog-mode-hook 'hs-minor-mode)
 | 
			
		||||
#+end_src
 | 
			
		||||
 | 
			
		||||
** hl-todo
 | 
			
		||||
#+begin_src emacs-lisp
 | 
			
		||||
(use-package hl-todo
 | 
			
		||||
  :straight t
 | 
			
		||||
  :hook ((prog-mode) . hl-todo-mode)
 | 
			
		||||
  :config
 | 
			
		||||
  (setq hl-todo-keyword-faces
 | 
			
		||||
        '(("TODO" . "#e78a4e")))
 | 
			
		||||
  )
 | 
			
		||||
#+end_src
 | 
			
		||||
 | 
			
		||||
** smart-parens
 | 
			
		||||
#+begin_src emacs-lisp
 | 
			
		||||
(use-package smartparens
 | 
			
		||||
| 
						 | 
				
			
			@ -1207,28 +1261,6 @@ Enable =hs-minor-mode= in =prog-mode= to allow for folding away comments and mod
 | 
			
		|||
  (require 'smartparens-config))
 | 
			
		||||
#+end_src
 | 
			
		||||
 | 
			
		||||
** Company
 | 
			
		||||
#+begin_src emacs-lisp :tangle no
 | 
			
		||||
(use-package company
 | 
			
		||||
  :straight t
 | 
			
		||||
  :defer t
 | 
			
		||||
  :hook (after-init . company-mode)
 | 
			
		||||
  :hook (prog-mode . company-mode)
 | 
			
		||||
  :config
 | 
			
		||||
  (setq
 | 
			
		||||
   company-minimum-prefix-length 1
 | 
			
		||||
   company-idle-delay 0.0))
 | 
			
		||||
#+end_src
 | 
			
		||||
 | 
			
		||||
Use =ispell= with company mode for completion in text-modes
 | 
			
		||||
#+begin_src emacs-lisp
 | 
			
		||||
(use-package ispell
 | 
			
		||||
  :straight t
 | 
			
		||||
  :defer t
 | 
			
		||||
  :config
 | 
			
		||||
  (setq ispell-dictionary "en_GB"))
 | 
			
		||||
#+end_src
 | 
			
		||||
 | 
			
		||||
** Flycheck
 | 
			
		||||
#+begin_src emacs-lisp
 | 
			
		||||
(use-package flycheck
 | 
			
		||||
| 
						 | 
				
			
			@ -1410,7 +1442,30 @@ Use =zls= automatically with lsp, and =zig-mode=:
 | 
			
		|||
  :config
 | 
			
		||||
  (add-to-list 'auto-mode-alist '("\\.zig\\'" . zig-mode))
 | 
			
		||||
  (setq lsp-zig-enable-build-on-save t
 | 
			
		||||
        lsp-zig-build-on-save-step "build"))
 | 
			
		||||
        lsp-zig-enable-inlay-hints nil
 | 
			
		||||
        lsp-zig-build-on-save-step "check"))
 | 
			
		||||
#+end_src
 | 
			
		||||
 | 
			
		||||
* User Functions
 | 
			
		||||
=PascalCase= to =snake_case=:
 | 
			
		||||
#+begin_src emacs-lisp
 | 
			
		||||
(defun snake-case ()
 | 
			
		||||
  "convert region from PascalCase into snake_case"
 | 
			
		||||
  (interactive)
 | 
			
		||||
       (save-excursion
 | 
			
		||||
         (let ((bounds (bounds-of-thing-at-point 'symbol)))
 | 
			
		||||
           (replace-regexp "\\([A-Z]\\)" "_\\1" nil (1+ (car bounds)) (cdr bounds))
 | 
			
		||||
           (downcase-region (car bounds) (cdr (bounds-of-thing-at-point 'word)))))
 | 
			
		||||
       )
 | 
			
		||||
#+end_src
 | 
			
		||||
 | 
			
		||||
Shortcut for opening this file:
 | 
			
		||||
#+begin_src emacs-lisp
 | 
			
		||||
(defun nemo/edit-init-org ()
 | 
			
		||||
  "Open the init.org file."
 | 
			
		||||
  (interactive)
 | 
			
		||||
  (find-file (concat user-emacs-directory "/init.org"))
 | 
			
		||||
  )
 | 
			
		||||
#+end_src
 | 
			
		||||
 | 
			
		||||
* Keybinds
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue