more emacs configurations

Added general, evil config
This commit is contained in:
Dibyashanu Pati 2025-02-11 17:35:33 +05:30
parent f4d3ddd875
commit 7d190ba093
8 changed files with 286 additions and 25 deletions

20
AVY.org
View file

@ -3,26 +3,35 @@
:END:
#+title: AVY
AVY is a powerful Emacs library that allows you to jump to any visible character in a buffer with efficient tree searches.
[[https://github.com/abo-abo/avy][AVY]] is a powerful Emacs library that allows you to jump to any visible character in a buffer with efficient tree searches.
The core idea that makes Avy a powerful tool is [[id:65391d4b-e2b4-4a71-9d98-100cbc9772b4][the filter - select - act paradigm]].
*Usage :*
1. call avy-goto-char-time - I have bound it to SPC a a
Usage :*
1. call avy-goto-char-time - I have bound it to /SPC a/
2. /filter/ by typing the characters of stings you want to go to
3. A decision tree appears at all matching points in the frame
4. Now before typing the decision /select/ the action
default (do nothing) - will go to position
? - display all possible actions, runs avy-show-dispatch-help
5. /act/ by entering your decision
#+begin_src elisp
(use-package avy
:config
(setq avy-timeout-seconds 0.3)
;; the time in seconds after which the decision tree appears when you stop typing
(setq avy-timeout-seconds 0.3)
;; Bind avy-goto-char-timer to SPC a using General
(leader-keys
"a" '(avy-goto-char-timer :wk "avy goto char")
)
;; decision characters to do actions other than going to a match
(setq avy-keys '(?q ?e ?r ?y ?u ?o ?p
?a ?s ?d ?f ?g ?h ?j
?k ?l ?' ?x ?c ?v ?b
@ -121,6 +130,7 @@ The core idea that makes Avy a powerful tool is [[id:65391d4b-e2b4-4a71-9d98-100
)
#+end_src
** References
+ https://karthinks.com/software/avy-can-do-anything/index.html
+ https://github.com/abo-abo/avy

View file

@ -1,14 +0,0 @@
:PROPERTIES:
:ID: 020c5410-998b-46fb-8c5e-59013dd30db4
:END:
#+title: Index
#+hugo_section: ./
These are my thoughts.
I use org-roam to manage these thoughts and ox-hugo along with quartz to publish them.
For more details see
* Topics
Here are some topics I think about
** [[id:0a87430b-6616-4f92-8ecc-22ceeebf43c6][Emacs]]

View file

@ -1,10 +1,12 @@
:PROPERTIES:
:ID: 43f5a7d2-4e8c-4d61-b333-8993d2aefbf6
:END:
#+title: My_Emacs_Config
#+title: My Emacs Config
Here is my emacs config with commentary.
TODO This is a work in progress - I am adding packages one by one after cleaning some of the code and fixing bugs
* [[id:d9246843-e229-4f53-b75d-0cac546f353b][AVY]]
* [[id:fd5aaf93-1573-491a-baad-4ea3b08ae2ef][GENERAL]]
* [[id:3b7e762e-cb8c-4d89-9147-6a50f921e9d3][EVIL]]

View file

@ -1 +1,7 @@
:PROPERTIES:
:ID: 241c5206-ffbc-4c20-9ad5-df21db4d3ae1
:END:
#+title: README
These are my thoughts in the form of a [[https://www.orgroam.com/][org roam]] database.

41
evil.org Normal file
View file

@ -0,0 +1,41 @@
:PROPERTIES:
:ID: 3b7e762e-cb8c-4d89-9147-6a50f921e9d3
:END:
#+title: EVIL
[[https://github.com/emacs-evil/evil][Evil]] is an extensible vi/vim layer for [[id:0a87430b-6616-4f92-8ecc-22ceeebf43c6][Emacs]]. Because... let's face it. The Vim keybindings are just plain better.
#+begin_src elisp
(use-package evil
: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.
evil-want-keybinding nil
evil-vsplit-window-right t
evil-split-window-below t
evil-undo-system 'undo-redo) ;; Adds vim-like C-r redo functionality
(evil-mode))
(use-package evil-collection
: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)
;; 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
* References
+ https://github.com/emacs-evil/evil

215
general.org Normal file
View file

@ -0,0 +1,215 @@
:PROPERTIES:
:ID: fd5aaf93-1573-491a-baad-4ea3b08ae2ef
:END:
#+title: GENERAL
[[https://github.com/noctuid/general.el][General]] is an [[id:0a87430b-6616-4f92-8ecc-22ceeebf43c6][Emacs]] package to conveniently set keybindings.
#+begin_src elisp
(use-package general
:config
(general-evil-setup)
;; set up 'SPC' as the global leader key
(general-create-definer leader-keys
:states '(normal insert visual emacs)
:keymaps 'override
:prefix "SPC" ;; set leader
:global-prefix "s-SPC") ;; access leader in insert mode
(leader-keys
"SPC" '(counsel-M-x :wk "Counsel M-x")
"." '(find-file :wk "Find file")
"=" '(perspective-map :wk "Perspective") ;; Lists all the perspective keybindings
"TAB TAB" '(comment-line :wk "Comment lines")
"u" '(universal-argument :wk "Universal argument")
"M-$" '(jinx-correct :wk "correct word")
)
(leader-keys
"b" '(:ignore t :wk "Bookmarks/Buffers")
"b b" '(switch-to-buffer :wk "Switch to buffer")
"b c" '(clone-indirect-buffer :wk "Create indirect buffer copy in a split")
"b C" '(clone-indirect-buffer-other-window :wk "Clone indirect buffer in new window")
"b d" '(bookmark-delete :wk "Delete bookmark")
"b i" '(ibuffer :wk "Ibuffer")
"b k" '(kill-current-buffer :wk "Kill current buffer")
"b K" '(kill-some-buffers :wk "Kill multiple buffers")
"b l" '(list-bookmarks :wk "List bookmarks")
"b m" '(bookmark-set :wk "Set bookmark")
"b n" '(next-buffer :wk "Next buffer")
"b p" '(previous-buffer :wk "Previous buffer")
"b r" '(revert-buffer :wk "Reload buffer")
"b R" '(rename-buffer :wk "Rename buffer")
"b s" '(basic-save-buffer :wk "Save buffer")
"b S" '(save-some-buffers :wk "Save multiple buffers")
"b x" '(scratch-buffer :wk "scratch buffer")
"b w" '(bookmark-save :wk "Save current bookmarks to bookmark file"))
(leader-keys
"e" '(:ignore t :wk "Eshell/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 h" '(counsel-esh-history :which-key "Eshell history")
"e l" '(eval-last-sexp :wk "Evaluate elisp expression before point")
"e r" '(eval-region :wk "Evaluate elisp in region")
"e R" '(eww-reload :which-key "Reload current page in EWW")
"e s" '(eshell :which-key "Eshell")
"e w" '(eww :which-key "EWW emacs web wowser"))
(leader-keys
"f" '(:ignore t :wk "Files")
"f c" '((lambda () (interactive)
(find-file "~/exocortex/20240715135903-emacs_config_from_scratch.org"))
:wk "Open emacs config.org")
"f e" '((lambda () (interactive)
(dired "~/emacs/"))
:wk "Open user-emacs-directory in dired")
"f d" '(find-grep-dired :wk "Search for string in files in DIR")
"f g" '(counsel-grep-or-swiper :wk "Search for string current file")
"f i" '((lambda () (interactive)
(find-file "~/emacs/init.el"))
:wk "Open emacs init.el")
"f j" '(counsel-file-jump :wk "Jump to a file below current directory")
"f l" '(counsel-locate :wk "Locate a file")
"f r" '(counsel-recentf :wk "Find recent files")
"f u" '(sudo-edit-find-file :wk "Sudo find file")
"f U" '(sudo-edit :wk "Sudo edit file"))
(leader-keys
"h" '(:ignore t :wk "Help")
"h a" '(counsel-apropos :wk "Apropos")
"h b" '(describe-bindings :wk "Describe bindings")
"h c" '(describe-char :wk "Describe character under cursor")
"h d" '(:ignore t :wk "Emacs documentation")
"h d a" '(about-emacs :wk "About Emacs")
"h d d" '(view-emacs-debugging :wk "View Emacs debugging")
"h d f" '(view-emacs-FAQ :wk "View Emacs FAQ")
"h d m" '(info-emacs-manual :wk "The Emacs manual")
"h d n" '(view-emacs-news :wk "View Emacs news")
"h d o" '(describe-distribution :wk "How to obtain Emacs")
"h d p" '(view-emacs-problems :wk "View Emacs problems")
"h d t" '(view-emacs-todo :wk "View Emacs todo")
"h d w" '(describe-no-warranty :wk "Describe no warranty")
"h e" '(view-echo-area-messages :wk "View echo area messages")
"h f" '(describe-function :wk "Describe function")
"h F" '(describe-face :wk "Describe face")
"h g" '(describe-gnu-project :wk "Describe GNU Project")
"h i" '(info :wk "Info")
"h I" '(describe-input-method :wk "Describe input method")
"h k" '(describe-key :wk "Describe key")
"h l" '(view-lossage :wk "Display recent keystrokes and the commands run")
"h L" '(describe-language-environment :wk "Describe language environment")
"h m" '(describe-mode :wk "Describe mode")
"h r" '(:ignore t :wk "Reload")
"h r r" '((lambda () (interactive)
(load-file "~/emacs/init.el")
(ignore (elpaca-process-queues)))
:wk "Reload emacs config")
"h t" '(load-theme :wk "Load theme")
"h v" '(describe-variable :wk "Describe variable")
"h w" '(where-is :wk "Prints keybinding for command if set")
"h x" '(describe-command :wk "Display full documentation for command"))
(leader-keys
"m l" '(:ignore t :wk "Insert")
"m l l" '(org-insert-link-global :wk "Insert link")
"m @" '(org-cite-insert :wk "Insert bibliography references"))
(leader-keys
"o" '(:ignore t :wk "Open")
"o d" '(dashboard-open :wk "Dashboard")
"o e" '(elfeed :wk "Elfeed RSS")
"o f" '(make-frame :wk "Open buffer in new frame")
"o F" '(select-frame-by-name :wk "Select frame by name"))
;; projectile-command-map already has a ton of bindings
;; set for us, so no need to specify each individually.
(leader-keys
"p" '(projectile-command-map :wk "Projectile"))
(leader-keys
"s" '(:ignore t :wk "Search")
"s m" '(man :wk "Man pages")
"s t" '(tldr :wk "Lookup TLDR docs for a command")
"s w" '(woman :wk "Similar to man but doesn't require man"))
(leader-keys
"t" '(:ignore t :wk "Toggle")
"t e" '(eshell-toggle :wk "Toggle eshell")
"t f" '(flycheck-mode :wk "Toggle flycheck")
"t l" '(display-line-numbers-mode :wk "Toggle line numbers")
"t n" '(neotree-toggle :wk "Toggle neotree file viewer")
"t o" '(org-mode :wk "Toggle org mode")
"t r" '(rainbow-mode :wk "Toggle rainbow mode")
"t t" '(visual-line-mode :wk "Toggle truncated lines")
"t v" '(vterm-toggle :wk "Toggle vterm")
"t i" '(imenu-list-smart-toggle :wk "Toggle imenu shown in a sidebar"))
(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")
;; Maximize buffer
"w m m" '(doom/window-maximize-buffer :wk "Maximize buffer")
)
(leader-keys
"s" '(:ignore t :wk "search")
"s b" '(+default/search-buffer :wk "search current buffer"))
(leader-keys
"i" '(:ignore t :wk "insert")
"i a" '(my/insert-auto-tangle-tag :wk "insert autotangle")
"i l" '(orb-insert-link :wk "insert reference"))
(leader-keys
"t" '(:ignore t :wk "toggle")
"t l" '(doom/toggle-line-numbers :wk "toggle line number style")
"t d" '(org-decrypt-entry :wk "decrypt current heading")
"t e" '(org-encrypt-entry :wk "encrypt current heading"))
(leader-keys
"n r" '(:ignore t :wk "org roam")
"n r s" '(org-roam-db-sync :wk "Sync roam database")
"n r f" '(org-roam-node-find :wk "Find node")
"n r i" '(org-roam-node-insert :wk "insert node link")
"n r a" '(org-roam-node-random :wk "random node")
"n r r" '(org-roam-buffer-toggle :wk "roam buffer toggle")
"n r d" '(:ignore t :wk "org roam dailes")
"n r d d" '(org-roam-dailies-goto-date :wk "goto date")
"n r d t" '(org-roam-dailies-goto-today :wk "goto date")
"n r d n" '(org-roam-dailies-goto-next-note :wk "goto date")
"n r d p" '(org-roam-dailies-goto-previous-note :wk "goto date")
"n r d T" '(org-roam-dailies-goto-tomorrow :wk "goto date"))
(leader-keys
"i" '(:ignore t :wk "insert")
"i a" '(my/insert-auto-tangle-tag :wk "insert autotangle")
"i l" '(orb-insert-link :wk "insert reference"))
)
#+end_src
** References
+ https://gitlab.com/dwt1/dotfiles/-/blob/master/.config/emacs/config.el

View file

@ -1,14 +1,15 @@
:PROPERTIES:
:ID: 020c5410-998b-46fb-8c5e-59013dd30db4
:END:
#+title: index
#+title: Index
#+hugo_section: ./
These are my thoughts.
I use org-roam to manage these thoughts and ox-hugo along with quartz to publish them.
I use [[https://www.orgroam.com/][org-roam]] to manage these thoughts and [[https://github.com/kaushalmodi/ox-hugo/tree/main][ox-hugo]] along with [[https://github.com/jackyzha0/quartz][Quartz]] to publish them.
The source code of this thought garden in the form of an [[https://www.orgroam.com/][org-roam]] directory can be found [[https://cosmicflow.space:3030/DibyashanuPati/thought_garden][here]].
For more details see
* Topics
Here are some topics I think about
Here are some things I think about
** [[id:0a87430b-6616-4f92-8ecc-22ceeebf43c6][Emacs]]

View file

@ -1,7 +1,7 @@
:PROPERTIES:
:ID: 65391d4b-e2b4-4a71-9d98-100cbc9772b4
:END:
#+title: the_filter-select-act_paradigm
#+title: the filter-select-act paradigm
The filter - select - act paradigm/pattern is powerful abstraction used in [[id:0a87430b-6616-4f92-8ecc-22ceeebf43c6][Emacs]] and many of its packages like [[id:d9246843-e229-4f53-b75d-0cac546f353b][AVY]].