diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index bb72688..bccde84 100755 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -2292,13 +2292,13 @@ A very helpful package that provides jump-to-link functionality: * Projectile #+BEGIN_SRC emacs-lisp (use-package projectile + :hook ((after-init . projectile-mode)) :commands (projectile-mode projectile-find-file projectile-grep projectile-switch-project projectile-project-root) :config - (projectile-mode) (jdormit/define-prefix "p" "projectile") (leader-def-key "p" projectile-command-map)) @@ -2309,6 +2309,39 @@ A very helpful package that provides jump-to-link functionality: ,@body)) #+END_SRC +* Perspective +A package that groups buffers/windows into workspaces per project: +#+BEGIN_SRC emacs-lisp + (use-package perspective + :commands (persp-mode) + :hook ((after-init . persp-mode)) + :init + (jdormit/define-prefix "v" "perspective") + :config + (leader-def-key "v" perspective-map) + (defun switch-to-previous-buffer () + "Switch to previously open buffer. + Repeated invocations toggle between the two most recently open buffers." + (interactive) + (persp-switch-to-buffer (other-buffer (current-buffer) 1))) + :custom + (persp-sort 'access) + :general + ([remap kill-buffer] #'persp-kill-buffer*) + ([remap switch-to-buffer] #'persp-switch-to-buffer*) + ([remap counsel-switch-buffer] #'persp-counsel-switch-buffer) + ([remap ivy-switch-buffer] #'persp-ivy-switch-buffer)) + + (use-package persp-projectile + :after (perspective projectile) + :demand t + :config + (projectile-persp-bridge counsel-projectile) + (projectile-persp-bridge counsel-projectile-switch-project) + :general + ([remap projectile-switch-project] #'projectile-persp-switch-project)) +#+END_SRC + * Mode line * UI Get rid of the janky buttons: @@ -2398,6 +2431,17 @@ UI-related keybindings: (leader-def-key "ub" #'display-battery-mode) #+END_SRC +* Window handling +Following [[https://github.com/nex3/perspective-el#some-musings-on-emacs-window-layouts][some excellent advice]] from the author of perspective.el +about making Emacs' window handling saner: +#+BEGIN_SRC emacs-lisp + (setq display-buffer-alist + '((".*" (display-buffer-reuse-window display-buffer-same-window)))) + + (setq display-buffer-reuse-frames t) ; reuse windows in other frames + (setq even-window-sizes nil) ; display-buffer: avoid resizing +#+END_SRC + * Centaur tabs [[https://github.com/ema2159/centaur-tabs][Centaur tabs]] is a package that gives Emacs buffer tabs similar to those in Atom or VS Code: #+BEGIN_SRC emacs-lisp @@ -4942,7 +4986,7 @@ An alternative minibuffer completion framework: (leader-def-key "ia" #'swiper-all) (leader-def-key "ff" #'counsel-find-file) (leader-def-key "oc" #'counsel-org-capture) - (leader-def-key "bb" #'counsel-ibuffer) + (leader-def-key "bb" #'ivy-switch-buffer) (if (executable-find "rg") (leader-def-key "ig" #'counsel-rg)