diff options
author | David Morgan <djm_uk@protonmail.com> | 2021-08-05 07:47:38 +0100 |
---|---|---|
committer | David Morgan <djm_uk@protonmail.com> | 2021-08-05 07:47:38 +0100 |
commit | fd87e0ed4c52bed31798c0f83f8f121d2659f869 (patch) | |
tree | 636db2b3ec071e0fc75aaa2fdf2644da7f2f74e9 /emacs-prelude | |
parent | 1190ad9a1882344e9046277ca50f306c82e8cc9b (diff) | |
download | dotfiles-fd87e0ed4c52bed31798c0f83f8f121d2659f869.tar.gz |
Play around with a few things
Diffstat (limited to 'emacs-prelude')
-rw-r--r-- | emacs-prelude/personal/lisp/init-clojure.el | 3 | ||||
-rw-r--r-- | emacs-prelude/personal/lisp/init-completion.el | 23 | ||||
-rw-r--r-- | emacs-prelude/personal/lisp/init-dashboard.el | 2 | ||||
-rw-r--r-- | emacs-prelude/personal/lisp/init-git.el | 26 | ||||
-rw-r--r-- | emacs-prelude/personal/lisp/init-projectile.el | 33 | ||||
-rw-r--r-- | emacs-prelude/personal/lisp/init-ui.el | 22 |
6 files changed, 83 insertions, 26 deletions
diff --git a/emacs-prelude/personal/lisp/init-clojure.el b/emacs-prelude/personal/lisp/init-clojure.el index c0b59ec..080b695 100644 --- a/emacs-prelude/personal/lisp/init-clojure.el +++ b/emacs-prelude/personal/lisp/init-clojure.el @@ -38,7 +38,6 @@ cider-repl-history-file "~/.emacs.d/cider-history" clojure-toplevel-inside-comment-form t) (key-chord-define-global "??" 'cider-xref-fn-refs-select) - (key-chord-define-global "qq" 'cider-xref-fn-refs) - :hook (cider-repl-mode . (lambda () (smartscan-mode -1)))) + (key-chord-define-global "qq" 'cider-xref-fn-refs)) (provide 'init-clojure) diff --git a/emacs-prelude/personal/lisp/init-completion.el b/emacs-prelude/personal/lisp/init-completion.el index e23284f..91fb7db 100644 --- a/emacs-prelude/personal/lisp/init-completion.el +++ b/emacs-prelude/personal/lisp/init-completion.el @@ -83,9 +83,6 @@ :init (corfu-global-mode)) -;; (use-package dabbrev -;; :bind (("M-/" . dabbrev-completion) -;; ("C-M-/" . dabbrev-expand))) (prelude-require-package 'fancy-dabbrev) (use-package fancy-dabbrev :diminish @@ -246,6 +243,15 @@ (autoload 'projectile-project-root "projectile") (setq consult-project-root-function #'projectile-project-root) + (defvar consult-initial-narrow-config + '((consult-buffer . ?p) + (consult-buffer-no-preview . ?p))) + ;; Add initial narrowing hook + (defun consult-initial-narrow () + (when-let (key (alist-get this-command consult-initial-narrow-config)) + (setq unread-command-events (append unread-command-events (list key 32))))) + (add-hook 'minibuffer-setup-hook #'consult-initial-narrow) + (defun consult-fd (&optional dir initial) (interactive "P") (let ((consult-find-command "fd --color=never --full-path ARG OPTS")) @@ -291,7 +297,13 @@ :map minibuffer-local-map ("M-A" . marginalia-cycle)) :init - (marginalia-mode)) + (marginalia-mode) + :config + ;; For Projectile + (add-to-list 'marginalia-prompt-categories '("Switch to project" . file)) + (add-to-list 'marginalia-prompt-categories '("Find file" . project-file)) + (add-to-list 'marginalia-prompt-categories '("Recently visited files" . project-file)) + (add-to-list 'marginalia-prompt-categories '("Switch to buffer" . buffer))) (prelude-require-package 'embark) (use-package embark @@ -299,7 +311,8 @@ (("C-." . embark-act) ("C-;" . embark-dwim) ("C-c C-o" . embark-export) - ("C-h B" . embark-bindings)) + ("C-h b" . embark-bindings) + ("C-h B" . describe-bindings)) :init ;; Optionally replace the key help with a completing-read interface (setq prefix-help-command #'embark-prefix-help-command) diff --git a/emacs-prelude/personal/lisp/init-dashboard.el b/emacs-prelude/personal/lisp/init-dashboard.el index 538bc4c..1986271 100644 --- a/emacs-prelude/personal/lisp/init-dashboard.el +++ b/emacs-prelude/personal/lisp/init-dashboard.el @@ -6,7 +6,7 @@ dashboard-set-footer nil dashboard-week-agenda t dashboard-projects-backend 'projectile - dashboard-projects-switch-function 'projectile-persp-switch-project + ;dashboard-projects-switch-function 'projectile-persp-switch-project dashboard-items '((recents . 15) (bookmarks . 5) (projects . 5) diff --git a/emacs-prelude/personal/lisp/init-git.el b/emacs-prelude/personal/lisp/init-git.el index ac5ce4b..7745af8 100644 --- a/emacs-prelude/personal/lisp/init-git.el +++ b/emacs-prelude/personal/lisp/init-git.el @@ -8,16 +8,28 @@ (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))))) + (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) (key-chord-define-global "RR" 'my/magit-refresh-state) - :custom (magit-diff-refine-hunk 'all)) + :custom-face + (diff-added ((t (:foreground "green4")))) + (magit-diff-added ((t (:foreground "green4")))) + (magit-diff-added-highlight ((t (:foreground "green4")))) + (diff-removed ((t (:foreground "red3")))) + (magit-diff-removed ((t (:foreground "red3")))) + (magit-diff-removed-highlight ((t (:foreground "red3")))) + :custom + (magit-diff-refine-hunk 'all) + (magit-diff-paint-whitespace t) + (magit-diff-paint-whitespace-lines 'all) + (magit-diff-highlight-trailing t) + (magit-diff-highlight-indentation t)) (prelude-require-package 'forge) (use-package forge diff --git a/emacs-prelude/personal/lisp/init-projectile.el b/emacs-prelude/personal/lisp/init-projectile.el index c788203..c2cada5 100644 --- a/emacs-prelude/personal/lisp/init-projectile.el +++ b/emacs-prelude/personal/lisp/init-projectile.el @@ -1,10 +1,33 @@ -(prelude-require-packages '(perspective persp-projectile ripgrep)) +;(prelude-require-packages '(perspective persp-projectile ripgrep)) -(use-package persp-projectile - :init (persp-mode)) +;(use-package perspective +; :init (persp-mode) +; ;; We could rely on projectile for the modes string instead +; ;:custom (persp-show-modestring nil) +; :custom (persp-modestring-short t)) + +;(use-package persp-projectile) (use-package projectile - :diminish) + ;:diminish + :config + (def-projectile-commander-method ?B + "consult-buffer" + (progn + (setq unread-command-events (listify-key-sequence "p ")) + (consult-buffer))) + (def-projectile-commander-method ?r + "consult-ripgrep" + (consult-smart-ripgrep)) + (def-projectile-commander-method ?p + "DWIM" + (cond ((> (length (projectile-project-buffer-names)) 4) (projectile-switch-to-buffer)) ;; TODO consult-buffer + ((> (length (projectile-recentf-files)) 0) (projectile-recentf)) + (t (projectile-find-file)))) + :custom + ;; We could use this instead of relying on persp + (projectile-mode-line-function '(lambda () (format "[%s]" (projectile-project-name)))) + (projectile-switch-project-action 'projectile-commander)) -(provide 'init-projectile) +(provide 'init-projectile) diff --git a/emacs-prelude/personal/lisp/init-ui.el b/emacs-prelude/personal/lisp/init-ui.el index ffb3087..734a710 100644 --- a/emacs-prelude/personal/lisp/init-ui.el +++ b/emacs-prelude/personal/lisp/init-ui.el @@ -52,12 +52,22 @@ (prelude-require-package 'smartscan) (use-package smartscan :config - (global-smartscan-mode t)) + (global-smartscan-mode t) + :hook + (cider-repl-mode . (lambda () (smartscan-mode -1))) + (vterm-mode . (lambda () (smartscan-mode -1))) + (eshell-mode . (lambda () (smartscan-mode -1)))) -(prelude-require-package 'fullframe) - (use-package fullframe - :after magit - :config - (fullframe magit-status magit-mode-quit-window)) +;;(prelude-require-package 'fullframe) +;; (use-package fullframe +;; :after magit +;; :config +;; (fullframe magit-status magit-mode-quit-window)) + +(smartrep-define-key global-map + "C-x" '(("}" . enlarge-window-horizontally) + ("{" . shrink-window-horizontally) + ("^" . enlarge-window) + ("-" . shrink-window-if-larger-than-buffer))) (provide 'init-ui) |