diff options
author | David Morgan <djm_uk@protonmail.com> | 2021-07-09 21:03:07 +0100 |
---|---|---|
committer | David Morgan <djm_uk@protonmail.com> | 2021-07-09 21:03:07 +0100 |
commit | 02f72d1f9f14ae3c04dc60d99cc5e0c86d064bdf (patch) | |
tree | aa5a09c40b9eb474d1df7cb88f5cbf227c3922ce /emacs-prelude | |
parent | 22525b8d3c7b4f854d2fdf70967d084246729de9 (diff) | |
download | dotfiles-02f72d1f9f14ae3c04dc60d99cc5e0c86d064bdf.tar.gz |
More updates - consult, git, multi-vterm
Diffstat (limited to 'emacs-prelude')
-rw-r--r-- | emacs-prelude/personal/custom.el | 2 | ||||
-rw-r--r-- | emacs-prelude/personal/lisp/init-completion.el | 47 | ||||
-rw-r--r-- | emacs-prelude/personal/lisp/init-git.el | 22 | ||||
-rw-r--r-- | emacs-prelude/personal/lisp/init-misc.el | 14 |
4 files changed, 68 insertions, 17 deletions
diff --git a/emacs-prelude/personal/custom.el b/emacs-prelude/personal/custom.el index 20c2aaa..12d78ee 100644 --- a/emacs-prelude/personal/custom.el +++ b/emacs-prelude/personal/custom.el @@ -10,7 +10,7 @@ '(es-always-pretty-print t) '(org-agenda-files nil) '(package-selected-packages - '(ripgrep persp-projectile perspective consult-flycheck ctrlf consult-lsp embark-consult embark marginalia consult vertico corfu orderless es-mode multi-term jq-mode restclient multi-vterm solarized-theme flycheck-indicator simple-modeline miniedit smart-mode-line prelude subword-mode smartparens-mode projectile-mode prelude-mode rg f forge vterm dash magit-section markdown-mode popup s transient envrc hydra easy-kill-extras paredit-functions eval-expr lsp clj-refactor flycheck-clj-kondo yasnippet paredit dashboard emacs-dashboard yaml-mode web-mode lsp-ui lsp-mode json-mode js2-mode rainbow-mode elisp-slime-nav cider clojure-mode rainbow-delimiters exec-path-from-shell zop-to-char zenburn-theme which-key volatile-highlights undo-tree super-save smartrep smartparens operate-on-number nlinum move-text magit projectile imenu-anywhere hl-todo guru-mode gitignore-mode gitconfig-mode git-timemachine gist flycheck expand-region epl editorconfig easy-kill diminish diff-hl discover-my-major crux browse-kill-ring anzu ag ace-window)) + '(multi-vterm ripgrep persp-projectile perspective consult-flycheck ctrlf consult-lsp embark-consult embark marginalia consult vertico corfu orderless es-mode jq-mode restclient solarized-theme flycheck-indicator simple-modeline miniedit smart-mode-line prelude subword-mode smartparens-mode projectile-mode prelude-mode rg f forge vterm dash magit-section markdown-mode popup s transient envrc hydra easy-kill-extras paredit-functions eval-expr lsp clj-refactor flycheck-clj-kondo yasnippet paredit dashboard emacs-dashboard yaml-mode web-mode lsp-ui lsp-mode json-mode js2-mode rainbow-mode elisp-slime-nav cider clojure-mode rainbow-delimiters exec-path-from-shell zop-to-char zenburn-theme which-key volatile-highlights undo-tree super-save smartrep smartparens operate-on-number nlinum move-text magit projectile imenu-anywhere hl-todo guru-mode gitignore-mode gitconfig-mode git-timemachine gist flycheck expand-region epl editorconfig easy-kill diminish diff-hl discover-my-major crux browse-kill-ring anzu ag ace-window)) '(pdf-view-midnight-colors '("#DCDCCC" . "#383838"))) (custom-set-faces ;; custom-set-faces was added by Custom. diff --git a/emacs-prelude/personal/lisp/init-completion.el b/emacs-prelude/personal/lisp/init-completion.el index 91d8244..202b4e5 100644 --- a/emacs-prelude/personal/lisp/init-completion.el +++ b/emacs-prelude/personal/lisp/init-completion.el @@ -106,6 +106,7 @@ ;; 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 B" . consult-buffer-no-preview) ;; 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 @@ -129,11 +130,17 @@ ("M-g I" . consult-project-imenu) ;; C-c c bindings (search-map) ("C-c c C-f" . consult-recent-file) - ("C-c c f" . consult-find) + ("C-c c f" . consult-fd) + ("C-c c F" . consult-find) ("C-c c L" . consult-locate) ("C-c c g" . consult-grep) ("C-c c G" . consult-git-grep) - ("C-c c r" . consult-ripgrep) + ("C-c c r" . consult-smart-ripgrep) + ("C-c c R" . consult-ripgrep-auto-preview) + ("C-c c C-M-r" . consult-iripgrep) + ("C-c c M-r" . consult-ripgrep-unrestricted) + ("C-c c C-r" . consult-ripgrep) + ("C-c c s" . consult-ripgrep-symbol-at-point) ("C-c c l" . consult-line) ("C-c c m" . consult-multi-occur) ("C-c c k" . consult-keep-lines) @@ -177,7 +184,8 @@ consult-theme :preview-key '(:debounce 0.2 any) consult-ripgrep consult-git-grep consult-grep - consult-bookmark consult-recent-file consult-xref consult-buffer + consult-smart-ripgrep consult-iripgrep consult-ripgrep-unrestricted + consult-bookmark consult-recent-file consult-xref consult-buffer-no-preview consult--source-file consult--source-project-file consult--source-bookmark :preview-key (kbd "M-.")) @@ -192,10 +200,33 @@ (autoload 'projectile-project-root "projectile") (setq consult-project-root-function #'projectile-project-root) - (defun find-fd (&optional dir initial) + (defun consult-fd (&optional dir initial) (interactive "P") (let ((consult-find-command "fd --color=never --full-path ARG OPTS")) (consult-find dir initial))) + (defun consult-smart-ripgrep (&optional dir initial) + (interactive "P") + (let ((consult-ripgrep-command "rg -S --null --line-buffered --color=ansi --max-columns=1000 --no-heading --line-number . -e ARG OPTS")) + (consult-ripgrep dir initial))) + (defun consult-ripgrep-symbol-at-point (&optional dir initial) + (interactive + (list prefix-arg (when-let ((s (symbol-at-point))) + (symbol-name s)))) + (consult-smart-ripgrep dir initial)) + (defun consult-ripgrep-auto-preview (&optional dir initial) + (interactive "P") + (consult-smart-ripgrep dir initial)) + (defun consult-iripgrep (&optional dir initial) + (interactive "P") + (let ((consult-ripgrep-command "rg -i --null --line-buffered --color=ansi --max-columns=1000 --no-heading --line-number . -e ARG OPTS")) + (consult-ripgrep dir initial))) + (defun consult-ripgrep-unrestricted (&optional dir initial) + (interactive "P") + (let ((consult-ripgrep-command "rg -S -uu --null --line-buffered --color=ansi --max-columns=1000 --no-heading --line-number . -e ARG OPTS")) + (consult-ripgrep dir initial))) + (defun consult-buffer-no-preview () + (interactive) + (consult-buffer)) (defun consult-line-symbol-at-point () (interactive) (consult-line (thing-at-point 'symbol)))) @@ -254,8 +285,14 @@ affe-highlight-function #'orderless--highlight) ;; Manual preview key for `affe-grep' (consult-customize affe-grep :preview-key (kbd "M-.")) + (defun my/affe-grep-symbol-at-point (&optional dir initial) + (interactive + (list prefix-arg (when-let ((s (symbol-at-point))) + (symbol-name s)))) + (affe-grep dir initial)) :bind (("C-c c a g" . affe-grep) - ("C-c c a f" . affe-find))) + ("C-c c a f" . affe-find) + ("C-c c a s" . my/affe-grep-symbol-at-point))) (provide 'init-completion) diff --git a/emacs-prelude/personal/lisp/init-git.el b/emacs-prelude/personal/lisp/init-git.el index 626b3d0..041ff8e 100644 --- a/emacs-prelude/personal/lisp/init-git.el +++ b/emacs-prelude/personal/lisp/init-git.el @@ -4,18 +4,19 @@ (defun my/magit-set-upstream () (interactive) (magit-shell-command-topdir "git upstream")) + ;; update stale git info on the modeline (based on code removed from doom modeline) + (defun my/magit-refresh-state () + (interactive) + (dolist (buf (buffer-list)) + (when (and (not (buffer-modified-p buf)) + (buffer-file-name buf) + (file-exists-p (buffer-file-name buf)) + (file-in-directory-p (buffer-file-name buf) (magit-toplevel))) + (with-current-buffer buf + (vc-refresh-state))))) :config (key-chord-define-global "UU" 'my/magit-set-upstream) - ;; prevent the git info on the modeline from becoming stale (based on code removed from doom modeline) - :hook (magit-post-refresh . - (lambda () - (dolist (buf (buffer-list)) - (when (and (not (buffer-modified-p buf)) - (buffer-file-name buf) - (file-exists-p (buffer-file-name buf)) - (file-in-directory-p (buffer-file-name buf) (magit-toplevel))) - (with-current-buffer buf - (vc-refresh-state))))))) + (key-chord-define-global "RR" 'my/magit-refresh-state)) (prelude-require-package 'forge) (use-package forge @@ -32,3 +33,4 @@ ("C-c j r" . git-gutter:revert-hunk)) (provide 'init-git) + diff --git a/emacs-prelude/personal/lisp/init-misc.el b/emacs-prelude/personal/lisp/init-misc.el index fd1396c..20dcca5 100644 --- a/emacs-prelude/personal/lisp/init-misc.el +++ b/emacs-prelude/personal/lisp/init-misc.el @@ -10,11 +10,23 @@ (rg-enable-default-bindings)) (prelude-require-package 'restclient) -(use-package restclient) +(use-package restclient + :mode (("\\.http\\'" . restclient-mode))) (prelude-require-package 'es-mode) (use-package es-mode :mode "\.es\'") +(prelude-require-package 'multi-vterm) +(use-package multi-vterm + :init (unbind-key "C-c t" prelude-mode-map) + :bind (("C-c t" . multi-vterm-next) + ("C-c M-t" . multi-vterm) + (:map vterm-mode-map + ("C-a" . vterm-send-C-a) ; TODO the crux binding is taking precedence + ("C-c C-a" . vterm-send-C-a) + ("M-[" . multi-vterm-prev) + ("M-]" . multi-vterm-next)))) + (provide 'init-misc) |