aboutsummaryrefslogtreecommitdiff
path: root/Emacs/.config/emacs/config.org
diff options
context:
space:
mode:
authorAryadev Chavali <aryadev@aryadevchavali.com>2024-10-01 14:25:07 +0100
committerAryadev Chavali <aryadev@aryadevchavali.com>2024-10-01 16:24:42 +0100
commitb06202b882b0226e9348805838b01997da17eec2 (patch)
tree4161aad817457351a841c03ac042ccf14425f12e /Emacs/.config/emacs/config.org
parent1bd01d419dbe72c560e46798c22eb5fc40fd7770 (diff)
downloaddotfiles-b06202b882b0226e9348805838b01997da17eec2.tar.gz
dotfiles-b06202b882b0226e9348805838b01997da17eec2.tar.bz2
dotfiles-b06202b882b0226e9348805838b01997da17eec2.zip
(Emacs/config)~Ivy + Counsel -> IComplete + Consult
Decided to use vanilla packages a bit more, and got a bit bored of Ivy + Counsel.
Diffstat (limited to 'Emacs/.config/emacs/config.org')
-rw-r--r--Emacs/.config/emacs/config.org169
1 files changed, 89 insertions, 80 deletions
diff --git a/Emacs/.config/emacs/config.org b/Emacs/.config/emacs/config.org
index 5297f2c..352f0e5 100644
--- a/Emacs/.config/emacs/config.org
+++ b/Emacs/.config/emacs/config.org
@@ -779,7 +779,10 @@ searched and selected. We can take this further though!
Ivy and Helm provide more modern interfaces, though Helm is quite
heavy. Ivy, on the other hand, provides an interface similar to Ido
with less clutter and better customisation options.
-*** Ivy
+*** WAIT Ivy
+:PROPERTIES:
+:header-args:emacs-lisp: :tangle no :results none
+:END:
Setup for ivy, in preparation for counsel. Turn on ivy-mode just
after init.
@@ -828,7 +831,10 @@ selection list).
:config
(ivy-mode 1))
#+end_src
-*** Counsel
+*** WAIT Counsel
+:PROPERTIES:
+:header-args:emacs-lisp: :tangle no :results none
+:END:
Setup for counsel. Load as late as possible, after ivy force requires
it.
@@ -857,6 +863,77 @@ it.
(t . ivy--regex-ignore-order)))
(counsel-mode 1))
#+end_src
+*** Completions-list
+In case I ever use the completions list, some basic commands to look
+around.
+
+#+begin_src emacs-lisp
+(use-package simple
+ :after evil
+ :general
+ (nmmap
+ :keymaps 'completion-list-mode-map
+ "l" #'next-completion
+ "h" #'previous-completion
+ "q" #'quit-window
+ "RET" #'choose-completion
+ "<backtab>" #'switch-to-minibuffer)
+ :config
+ (evil-set-initial-state 'completion-list-mode 'normal))
+#+end_src
+*** Minibuffer
+#+begin_src emacs-lisp
+(use-package minibuffer
+ :demand t
+ :general
+ (general-def
+ :states '(normal insert)
+ :keymaps 'minibuffer-local-map
+ "<backtab>" #'switch-to-completions
+ "C-j" #'next-line-or-history-element
+ "C-k" #'previous-line-or-history-element))
+#+end_src
+**** Save minibuffer history
+Save any minibuffer usage in a history file, which allows reuse in
+later instances.
+
+#+begin_src emacs-lisp
+(use-package savehist
+ :defer t
+ :config
+ (savehist-mode t))
+#+end_src
+*** IComplete
+#+begin_src emacs-lisp
+(use-package icomplete
+ :demand t
+ :general
+ (general-def
+ :state '(normal insert)
+ :keymaps '(icomplete-fido-mode-map icomplete-minibuffer-map)
+ "<backtab>" #'switch-to-completions
+ "M-j" #'icomplete-forward-completions
+ "M-k" #'icomplete-backward-completions
+ "RET" #'icomplete-force-complete-and-exit
+ "TAB" #'minibuffer-complete-word
+ "SPC" #'self-insert-command)
+ :init
+ (setq icomplete-compute-delay 0.01
+ icomplete-delay-completions-threshold 2500)
+ :config
+ (icomplete-vertical-mode))
+#+end_src
+*** Consult
+#+begin_src emacs-lisp
+(use-package consult
+ :straight t
+ :general
+ (general-def
+ :keymaps 'override
+ [remap imenu] #'consult-imenu)
+ (search-leader
+ "s" #'consult-line))
+#+end_src
*** Amx
Amx is a fork of Smex that works to enhance the
execute-extended-command interface. It also provides support for ido
@@ -882,31 +959,13 @@ things ever.
#+begin_src emacs-lisp
(use-package orderless
:straight t
- :after (ivy ido)
+ :after icomplete
:config
- (setq completion-styles '(orderless basic)
+ (setq completion-styles '(substring orderless basic)
completion-category-defaults nil
- completion-category-overrides '((file (styles partial-completion))))
- (setf (alist-get t ivy-re-builders-alist) 'orderless-ivy-re-builder))
-#+end_src
-*** Completions-list
-In case I ever use the completions list, some basic commands to look
-around.
-
-#+begin_src emacs-lisp
-(use-package simple
- :defer t
- :general
- (nmmap
- :keymaps 'completion-list-mode-map
- "l" #'next-completion
- "h" #'previous-completion
- "ESC" #'delete-completion-window
- "q" #'quit-window
- "RET" #'choose-completion)
- :config
- (with-eval-after-load "evil"
- (evil-set-initial-state 'completions-list-mode 'normal)))
+ completion-category-overrides '((file (styles initials substring partial-completion))))
+ (with-eval-after-load "ivy"
+ (setf (alist-get t ivy-re-builders-alist) 'orderless-ivy-re-builder)))
#+end_src
*** Company
Company is the auto complete system I use. I don't like having heavy
@@ -1504,16 +1563,6 @@ eating up memory.
(leader
"qm" #'memory-report))
#+end_src
-** Save minibuffer history
-Save any minibuffer usage in a history file, which allows reuse in
-later instances.
-
-#+begin_src emacs-lisp
-(use-package savehist
- :defer t
- :config
- (savehist-mode t))
-#+end_src
** Drag Stuff
Drag stuff around, like my favourite russian programmer (Tsoding).
Useful mechanism which works better than any vim motion.
@@ -2866,6 +2915,11 @@ write the code.
#+begin_src emacs-lisp
(use-package org
:defer t
+ :config
+ (with-eval-after-load "consult"
+ (general-def
+ :keymaps 'org-mode-map
+ [remap imenu] #'consult-outline))
:general
(file-leader
"l" #'org-store-link
@@ -2905,51 +2959,6 @@ write the code.
"e" #'org-table-calc-current-TBLFM
"E" #'org-table-eval-formula))
#+end_src
-** Searching org files
-The default ~imenu~ support for Org-mode is god-awful. ~Imenu~ for
-org-mode should show me a list of headings and provide a
-completing-read interface to search them.
-
-[[*Counsel][Counsel]] has me covered for this as I can just provide it
-a regex as an initial prompt to narrow the candidates down to just the
-headings then let the user go from there. I use ~swiper~ when
-considering just the local file (a la ~imenu~) and ~counsel-rg~ to
-search multiple org-files.
-
-The cherry on top is ~+org/search-config-headings~ which searches the
-org files in ~user-emacs-directory~ and provides the headings for
-them. This allows me to search my configuration pretty quickly.
-
-#+begin_src emacs-lisp
-(use-package counsel
- :defer t
- :commands (+org/swiper-goto
- +org/search-headings-dir)
- :general
- (file-leader
- "P" (proc (interactive)
- (+org/search-headings-dir (file-name-directory user-emacs-directory)
- "--max-depth=1"))
- "T" (proc (interactive)
- (+org/search-headings-dir (file-name-directory org-directory)
- "--max-depth=2")))
- (search-leader
- :keymaps 'org-mode-map
- "I" #'+org/search-headings)
- (nmmap
- :keymaps 'org-mode-map
- [remap imenu] #'+org/swiper-goto)
- :config
- (defvar +org/heading-regexp "^[\\*]+[ ] ")
-
- (defun +org/swiper-goto ()
- (interactive)
- (counsel-grep-or-swiper +org/heading-regexp))
-
- (defun +org/search-headings-dir (directory &optional rg-args)
- "Searches DIRECTORY for org headings via counsel-rg."
- (counsel-rg +org/heading-regexp directory rg-args)))
-#+end_src
** Org Agenda
Org agenda provides a nice viewing for schedules. With org mode it's
a very tidy way to manage your time.