summaryrefslogtreecommitdiff
path: root/emacs/inits
diff options
context:
space:
mode:
authortslil clingman <>2021-06-29 17:34:31 -0400
committertslil clingman <>2021-06-29 18:28:18 -0400
commit24f196ef4576ab1d8ab205e7378b439f2aa8e9ce (patch)
tree9c1a4329e2f055ad80b7e0d5bd5a6f7843ac789f /emacs/inits
parentd550a210bd05a0019ce3e1757d8ec32731d0f72c (diff)
Switch from Selectrum+CTRLF to vertico+consult+marginalia
In the process, rid myself of company and everything that depended on it (RIP elpy), because i want a uniform interface for capfs, and that's vertico+consult.
Diffstat (limited to 'emacs/inits')
-rw-r--r--emacs/inits/01-basic.el17
-rw-r--r--emacs/inits/11-completion.el136
-rw-r--r--emacs/inits/11-selectrum.el38
-rw-r--r--emacs/inits/12-company.el17
-rw-r--r--emacs/inits/13-ibuffer.el20
-rw-r--r--emacs/inits/20-programming.el42
-rw-r--r--emacs/inits/24-latex.el24
-rw-r--r--emacs/inits/27-gemini.el2
-rw-r--r--emacs/inits/NO-10-ivy.el121
9 files changed, 174 insertions, 243 deletions
diff --git a/emacs/inits/01-basic.el b/emacs/inits/01-basic.el
index 55a8dcb..9493df4 100644
--- a/emacs/inits/01-basic.el
+++ b/emacs/inits/01-basic.el
@@ -1,4 +1,4 @@
-;; Time-stamp: <2021-04-19 09h47 EDT (hobbies)>
+;; Time-stamp: <2021-06-29 17h20 EDT (hobbies)>
;; -----------------------------------------------------------------------------
;; Interface
@@ -33,18 +33,21 @@
(split-window-horizontally)
(enlarge-to-fill)))
-(blink-cursor-mode 0)
-(setq cursor-type 'box)
-(set-cursor-color "black")
-
(add-to-list 'custom-theme-load-path "~/.emacs.d/themes/")
(when (eq 'x (window-system))
- (use-package nord-theme :ensure t)
- (load-theme 'nord t)
+ ;;; Time-based theming
+ ;; (if (<= 20 (nth 2 (decode-time)))
+ ;; (load-theme 'nord t)
+ ;; (load-theme 'solo-jazz t))
+ (load-theme 'solo-jazz t) ;; turns out i just like this one though
(set-face-attribute 'region nil :background "orange")
(set-face-attribute 'default nil :font "Iosevka-18"))
+(blink-cursor-mode 0)
+(setq cursor-type 'box)
+(set-cursor-color "black")
+
(set-fringe-style 0)
;; (set-fringe-mode 128)
diff --git a/emacs/inits/11-completion.el b/emacs/inits/11-completion.el
new file mode 100644
index 0000000..0206324
--- /dev/null
+++ b/emacs/inits/11-completion.el
@@ -0,0 +1,136 @@
+;; Time-stamp: <2021-06-29 17h26 EDT (hobbies)>
+
+;; -----------------------------------------------------------------------------
+;; Vertico
+
+(use-package vertico
+ :ensure t
+ :init
+ (vertico-mode)
+ (setq vertico-cycle t)
+ (setq completion-styles '(substring)))
+
+(use-package orderless
+ :ensure t
+ :init
+ (setq completion-styles '(orderless)
+ completion-category-defaults nil
+ completion-category-overrides '((file (styles . (partial-completion))))))
+
+(use-package savehist
+ :ensure t
+ :init (savehist-mode))
+
+(use-package emacs
+ :init
+ ;; Add prompt indicator to `completing-read-multiple'.
+ (defun crm-indicator (args)
+ (cons (concat "[CRM] " (car args)) (cdr args)))
+ (advice-add #'completing-read-multiple :filter-args #'crm-indicator)
+
+ ;; Grow and shrink minibuffer
+ ;;(setq resize-mini-windows t)
+
+ ;; Do not allow the cursor in the minibuffer prompt
+ (setq minibuffer-prompt-properties
+ '(read-only t cursor-intangible t face minibuffer-prompt))
+ (add-hook 'minibuffer-setup-hook #'cursor-intangible-mode)
+
+ ;; Enable recursive minibuffers
+ (setq enable-recursive-minibuffers t))
+
+;; -----------------------------------------------------------------------------
+;; Consult
+
+(use-package consult
+ :ensure t
+ :bind (;; C-c bindings (mode-specific-map)
+ ("C-c h" . consult-history)
+ ("C-c m" . consult-mode-command)
+ ("C-c b" . consult-bookmark)
+ ("C-c k" . consult-kmacro)
+ ;; C-x bindings (ctl-x-map)
+ ("C-x M-:" . consult-complex-command) ;; orig. repeat-complex-command
+ ("C-x b" . consult-buffer) ;; orig. switch-to-buffer
+ ("C-x 4 b" . consult-buffer-other-window) ;; orig. switch-to-buffer-other-window
+ ("C-x 5 b" . consult-buffer-other-frame) ;; orig. switch-to-buffer-other-frame
+ ;; Custom M-# bindings for fast register access
+ ("M-#" . consult-register-load)
+ ("M-'" . consult-register-store) ;; orig. abbrev-prefix-mark (unrelated)
+ ("C-M-#" . consult-register)
+ ;; Other custom bindings
+ ("M-y" . consult-yank-pop) ;; orig. yank-pop
+ ("<help> a" . consult-apropos) ;; orig. apropos-command
+ ;; M-g bindings (goto-map)
+ ("M-g e" . consult-compile-error)
+ ("M-g f" . consult-flymake) ;; Alternative: consult-flycheck
+ ("M-g g" . consult-line) ;; orig. goto-line
+ ("M-g M-g" . consult-goto-line) ;; orig. goto-line
+ ("M-g o" . consult-outline) ;; Alternative: consult-org-heading
+ ("M-g m" . consult-mark)
+ ("M-g k" . consult-global-mark)
+ ("M-g i" . consult-imenu)
+ ("M-g I" . consult-project-imenu)
+ ;; M-s bindings (search-map)
+ ("M-s f" . consult-find)
+ ("M-s L" . consult-locate)
+ ("C-c g" . consult-ripgrep)
+ ("C-c G" . consult-git-grep)
+ ("M-s l" . consult-line)
+ ("M-s m" . consult-multi-occur)
+ ("M-s k" . consult-keep-lines)
+ ("M-s u" . consult-focus-lines)
+ ;; Isearch integration
+ ("M-s e" . consult-isearch)
+ :map isearch-mode-map
+ ("M-e" . consult-isearch) ;; orig. isearch-edit-string
+ ("M-s e" . consult-isearch) ;; orig. isearch-edit-string
+ ("M-s l" . consult-line)) ;; needed by consult-line to detect isearch
+
+ :init
+ ;; Optionally configure the register formatting. This improves the register
+ ;; preview for `consult-register', `consult-register-load',
+ ;; `consult-register-store' and the Emacs built-ins.
+ (setq register-preview-delay 0
+ register-preview-function #'consult-register-format)
+
+ ;; Optionally tweak the register preview window.
+ ;; This adds thin lines, sorting and hides the mode line of the window.
+ (advice-add #'register-preview :override #'consult-register-window)
+
+ ;; Use Consult to select xref locations with preview
+ (setq xref-show-xrefs-function #'consult-xref
+ xref-show-definitions-function #'consult-xref)
+
+ :config
+ (consult-customize
+ consult-theme
+ :preview-key '(:debounce 0.2 any)
+
+ consult-ripgrep consult-git-grep consult-grep
+ consult-bookmark consult-recent-file consult-xref
+ consult--source-file consult--source-project-file consult--source-bookmark
+ :preview-key (kbd "M-."))
+
+ ;; Optionally configure the narrowing key.
+ ;; Both < and C-+ work reasonably well.
+ (setq consult-narrow-key "<") ;; (kbd "C-+")
+
+ ;; Optionally make narrowing help available in the minibuffer.
+ ;; You may want to use `embark-prefix-help-command' or which-key instead.
+ ;; (define-key consult-narrow-map (vconcat consult-narrow-key "?") #'consult-narrow-help)
+
+ ;; Projectile integration
+ (autoload 'projectile-project-root "projectile")
+ (setq consult-project-root-function #'projectile-project-root)
+
+ ;; Ues consult for capfs
+ (setq completion-in-region-function #'consult-completion-in-region))
+
+;; -----------------------------------------------------------------------------
+;; Marginalia
+
+(use-package marginalia
+ :ensure t
+ :bind (:map minibuffer-local-map ("M-A" . marginalia-cycle))
+ :init (marginalia-mode))
diff --git a/emacs/inits/11-selectrum.el b/emacs/inits/11-selectrum.el
deleted file mode 100644
index fa5feb7..0000000
--- a/emacs/inits/11-selectrum.el
+++ /dev/null
@@ -1,38 +0,0 @@
-;; Time-stamp: <2021-05-02 15h31 EDT (hobbies)>
-
-(use-package deadgrep
- :ensure t
- :bind (("C-c g" . deadgrep)))
-
-(defun selectrum-recentf ()
- (interactive)
- (let ((selectrum-should-sort nil))
- (find-file (completing-read "Recent file: " recentf-list nil t))))
-
-(defun selectrum-yank ()
- (interactive)
- (let ((selectrum-should-sort nil))
- (insert (selectrum-completing-read "Yank: " (delete-dups kill-ring) nil t))))
-
-(use-package selectrum
- :ensure t
- :bind (("C-x f" . selectrum-recentf)
- ("M-y" . selectrum-yank))
- :config
- (setq selectrum-num-candidates-displayed 7
- selectrum-count-style 'matches)
- ;; If i don't want `enable-recursive-minibuffers' this is the next best thing:
- ;; (setq-default completion-in-region-function selectrum--old-completion-in-region-function)
- (setq enable-recursive-minibuffers t)
- (selectrum-mode +1))
-
-(use-package selectrum-prescient
- :ensure t
- :config
- (selectrum-prescient-mode +1)
- (prescient-persist-mode +1))
-
-(use-package ctrlf
- :ensure t
- :config
- (ctrlf-mode +1))
diff --git a/emacs/inits/12-company.el b/emacs/inits/12-company.el
deleted file mode 100644
index d514496..0000000
--- a/emacs/inits/12-company.el
+++ /dev/null
@@ -1,17 +0,0 @@
-;; Time-stamp: <2019-01-26 12:50:26 (tslil@winslow)>
-
-(use-package company :ensure t
- :bind (("M-<tab>" . company-complete)
- :map company-active-map
- ("C-n" . company-select-next)
- ("C-p" . company-select-previous))
-
- :config
- (setq company-begin-commands '(self-insert-command)
- company-idle-delay 1
- company-require-match nil
- company-show-numbers t
- company-auto-complete 'company-explicit-action-p
- company-tooltip-align-annotations t)
-
- (global-company-mode))
diff --git a/emacs/inits/13-ibuffer.el b/emacs/inits/13-ibuffer.el
index f94e1a5..b40aa2d 100644
--- a/emacs/inits/13-ibuffer.el
+++ b/emacs/inits/13-ibuffer.el
@@ -1,4 +1,4 @@
-;; Time-stamp: <2021-03-21 22h32 EDT (hobbies)>
+;; Time-stamp: <2021-06-29 18h28 EDT (hobbies)>
(use-package ibuffer
:bind (("C-x C-b" . ibuffer))
@@ -10,27 +10,23 @@
'(("default"
("agda" (or (mode . agda2-mode)
(name . "^\\*[aA]gda")))
- ("c" (or (mode . c-mode)
- (mode . makefile-gmake-mode)))
("coq" (or (mode . coq-mode)
(mode . coq-goals-mode)
(mode . coq-response-mode)
(mode . coq-shell-mode)))
+ ("c" (or (mode . c-mode)
+ (mode . makefile-gmake-mode)))
("dired" (mode . dired-mode))
("elisp" (or (mode . emacs-lisp-mode)
(name . "^\\*Backtrace\\*")))
("emacs" (or (name . "^\\*scratch\\*$")
(name . "^\\*Messages\\*$")
(name . "^\\*init log\\*$")
- (name . "^\\*Compile-Log\\*$")))
- ("exwm" (mode . exwm-mode))
- ("help" (or (mode . helpful-mode)
- (name . "^\\*Help\\*$")))
+ (name . "^\\*Compile-Log\\*$")
+ (mode . helpful-mode)
+ (name . "^\\*Help\\*$")))
("irc" (mode . rcirc-mode))
("magit" (name . "^magit[:-]"))
- ("media" (or (mode . image-mode)
- (mode . doc-view-mode)))
- ("org" (mode . org-mode))
("REPL" (name . "^\\*.*REPL.*\\*$"))
("rust" (mode . rust-mode))
("slime" (name . "^\\*slime-[^*]*\\*$"))
@@ -40,7 +36,9 @@
(mode . html-mode)
(mode . css-mode)
(mode . mhtml-mode)))
- ("zig" (mode . zig-mode)))))
+ ("zig" (or (mode . zig-mode)
+ (name . "^\\*zig.*\\*$")
+ (name . "^\\*zls.*\\*$"))))))
(defadvice ibuffer-update-title-and-summary (after remove-column-titles)
(with-current-buffer "*Ibuffer*"
diff --git a/emacs/inits/20-programming.el b/emacs/inits/20-programming.el
index 2496f92..95df93d 100644
--- a/emacs/inits/20-programming.el
+++ b/emacs/inits/20-programming.el
@@ -1,4 +1,4 @@
-;; Time-stamp: <2021-04-22 17:22:56 (tslil@bison)>
+;; Time-stamp: <2021-06-29 17h23 EDT (hobbies)>
;; -----------------------------------------------------------------------------
;; General setup
@@ -83,24 +83,11 @@
;; gdb-many-windows nil
;; gdb-show-main nil)
-(use-package company-irony-c-headers
- :ensure t
- :defer t)
-
-(use-package company-irony
- :ensure t
- :defer t)
-
(use-package irony
:ensure t
:defer t
:hook (irony-mode . (lambda ()
- (require 'company)
- (company-mode-on)
- (irony-cdb-autosetup-compile-options)
- (require 'company-irony)
- (require 'company-irony-c-headers)
- (add-to-list 'company-backends '(company-irony-c-headers company-irony)))))
+ (irony-cdb-autosetup-compile-options))))
(use-package flycheck-irony
:ensure t
@@ -246,14 +233,17 @@
;; -----------------------------------------------------------------------------
;; Python
-(use-package elpy
- :ensure t
- :defer t
- :init
- (advice-add 'python-mode :before 'elpy-enable)
- :config
- (setq python-shell-interpreter "python3")
- (setq-default python-indent-offset 4))
+;;; TODO: need to find a LSP implementation for Python, currently elpy
+;;; drags in company and i don't want that.
+
+;; (use-package elpy
+;; :ensure t
+;; :defer t
+;; :init
+;; (advice-add 'python-mode :before 'elpy-enable)
+;; :config
+;; (setq python-shell-interpreter "python3")
+;; (setq-default python-indent-offset 4))
;; -----------------------------------------------------------------------------
@@ -273,7 +263,7 @@
("C-c C-r" . zig-run))
:config
(require 'lsp)
- (setq lsp-zig-zls-executable "~/prog/zig/zls/zig-cache/bin/zls"))
+ (setq lsp-zig-zls-executable "~/prog/zig/zls/zig-out/bin/zls"))
;; -------------------------------------------------------------------
;; Misc languages
@@ -334,9 +324,7 @@
("M-p" . lua-backwards-to-block-begin-or-end))
:hook (lua-mode . (lambda ()
(require 'nodemcu-mode)
- (use-package company-lua :ensure t :demand)
- (nodemcu-mode 1)
- (add-to-list 'company-backends 'company-lua))))
+ (nodemcu-mode 1))))
(use-package verilog-mode
:ensure t
diff --git a/emacs/inits/24-latex.el b/emacs/inits/24-latex.el
index a123c04..5fa8982 100644
--- a/emacs/inits/24-latex.el
+++ b/emacs/inits/24-latex.el
@@ -1,6 +1,6 @@
-;; Time-stamp: <2020-06-11 11:56:37 (tslil@bison)>
+;; Time-stamp: <2021-06-29 17h27 EDT (hobbies)>
-(defvar latex-template-dir (expand-file-name "~/academic/typeset/latex-templates"))
+(defvar latex-template-dir (expand-file-name "~/typeset/latex-templates"))
(defun prompt-latex-file-template ()
"Check if tex file does not exist or the command was called
interactively. If neither, prompt to insert from a template
@@ -22,19 +22,6 @@ populated from the directory *latex-template-dir*"
(use-package cdm-mode
:load-path "~/.emacs.d/scripts/")
-(use-package company-auctex :ensure t :defer t)
-
-(use-package company-reftex :ensure t
- :defer t
- :config
- (defun company-reftex-label-candidates (prefix)
- "Find all label candidates matching PREFIX."
- (reftex-access-scan-info t) ; This t is the difference i wanted
- (cl-loop for entry in (symbol-value reftex-docstruct-symbol)
- if (and (stringp (car entry)) (string-prefix-p prefix (car entry)))
- collect
- (company-reftex-annotate (car entry) (cl-caddr entry)))))
-
(use-package unfill :ensure t)
(use-package latex
@@ -73,12 +60,7 @@ populated from the directory *latex-template-dir*"
(defun latex-setup-completions ()
(interactive)
(require 'reftex)
- (turn-on-reftex)
- (require 'company-auctex)
- (require 'company-reftex)
- (dolist (backend '(company-auctex-macros company-auctex-symbols company-auctex-environments
- company-reftex-citations company-reftex-labels))
- (add-to-list 'company-backends backend)))
+ (turn-on-reftex))
(defun better-TeX-insert-single-quote ()
(interactive)
diff --git a/emacs/inits/27-gemini.el b/emacs/inits/27-gemini.el
index 0017557..ff6e308 100644
--- a/emacs/inits/27-gemini.el
+++ b/emacs/inits/27-gemini.el
@@ -1,4 +1,4 @@
-;; Time-stamp: <2021-02-26 17h53 UTC>
+;; Time-stamp: <2021-06-29 17h29 EDT (hobbies)>
(use-package elpher
:ensure t
diff --git a/emacs/inits/NO-10-ivy.el b/emacs/inits/NO-10-ivy.el
deleted file mode 100644
index 47cc783..0000000
--- a/emacs/inits/NO-10-ivy.el
+++ /dev/null
@@ -1,121 +0,0 @@
-;; Time-stamp: <2020-01-26 16:39:05 (tslil@bison)>
-
-(use-package amx :ensure t)
-
-(use-package counsel :ensure t
- :after amx
- :demand
- :defines (counsel-for-files)
- :bind (("C-s" . counsel-grep-or-swiper)
- ("C-x f" . counsel-recentf)
- ("C-x l" . counsel-locate)
- ("C-c C-r" . ivy-resume)
- ("C-c g" . counsel-rg)
- ("M-x" . counsel-M-x)
- ("C-s" . swiper-isearch)
- :map ivy-minibuffer-map
- ("C-m" . ivy-alt-done)
- :map swiper-map
- ("M-%" . swiper-query-replace))
-
- :config
- (setq ivy-use-virtual-buffers nil
- ivy-display-style 'fancy
- ivy-initial-inputs-alist nil
- ivy-format-function 'ivy-format-function-line
- ivy-count-format "")
-
- (setq swiper-use-visual-line t)
-
- (setq counsel-find-file-at-point t
- counsel-grep-base-command
- "rg -i -M 120 --no-heading --line-number --color never '%s' %s"
- counsel-describe-function-function 'helpful-function
- counsel-describe-variable-function 'helpful-variable)
-
- (ivy-mode t)
- (counsel-mode t))
-
-
-(use-package ivy-rich :ensure t
- :config
- (setq ivy-rich-path-style 'abbrev
- ivy-rich-parse-remote-buffer nil
- ivy-rich-parse-remote-file-path nil
- ivy-rich-display-transformers-list
- '(ivy-switch-buffer
- (:columns
- ((ivy-rich-candidate (:width 20))
- (ivy-rich-switch-buffer-size (:width 7 :align right))
- (ivy-rich-switch-buffer-indicators
- (:width 2 :face error :align right))
- (ivy-rich-switch-buffer-major-mode (:width 12 :face warning))
- (ivy-rich-switch-buffer-project (:width 8 :face success))
- (ivy-rich-switch-buffer-path
- (:width (lambda (x)
- (ivy-rich-switch-buffer-shorten-path
- x (ivy-rich-minibuffer-width 0.3))))))
- :predicate (lambda (cand) (get-buffer cand)))
- counsel-M-x
- (:columns
- ((counsel-M-x-transformer (:width 40))
- (ivy-rich-counsel-function-docstring
- (:face font-lock-doc-face))))
- counsel-describe-function
- (:columns
- ((counsel-describe-function-transformer (:width 40))
- (ivy-rich-counsel-function-docstring
- (:face font-lock-doc-face))))
- counsel-describe-variable
- (:columns
- ((counsel-describe-variable-transformer (:width 40))
- (ivy-rich-counsel-variable-docstring
- (:face font-lock-doc-face))))
- counsel-recentf
- (:columns
- ((ivy-rich-candidate (:width 0.8))
- (ivy-rich-file-last-modified-time
- (:face font-lock-comment-face))))))
-
- (ivy-rich-mode 1))
-
-
-;; (defun limited-counsel-locate-cmd (input)
-;; "Return a shell command based on INPUT."
-;; (counsel-require-program "locate")
-;; (format "locate -l 10 -i --regex '%s'"
-;; (counsel-unquote-regex-parens
-;; (ivy--regex input))))
-
-;; (defun bad ()
-;; (interactive)
-;; (let (process buffer)
-;; (ivy-read "File: "
-;; #'(lambda (input)
-;; (append
-;; '("Recent Files\n" . "")
-;; (recentf-elements 10)
-;; (directory-files default-directory "")
-;; (mapcar (lambda (b) (buffer-name b)) (buffer-list))
-;; (if (< (length input) 3) (counsel-more-chars 3)
-;; ;; (counsel--async-command
-;; ;; (funcall #'limited-counsel-locate-cmd input))
-;; (when process (kill-process process))
-;; (setq process (start-file-process-shell-command
-;; "*locate*"
-;; "*locate*"
-;; (funcall #'limited-counsel-locate-cmd input))))
-;; ))
-;; :dynamic-collection t
-;; :unwind #'(progn (kill-buffer))
-;; :sort nil
-;; :action #'(lambda (x)
-;; (with-ivy-window
-;; (if (file-exists-p x) (find-file x)
-;; (switch-to-buffer x)))))))
-
-;; '(helm-source-recentf
-;; helm-source-file-cache
-;; helm-source-files-in-current-dir
-;; helm-source-buffers-list
-;; helm-source-locate)