Switching buffers


One of the most valuable packages I rely on everyday is counsel-projectile. Combining the power of counsel and Projectile, this great work from Eric Danan has been governing my project management in Emacs for quite a while.

One nifty feature of counsel-projectile is counsel-projectile-switch-to-buffer, bound to C-c p b, which lets you pick the buffer to switch to from the current project’s open buffers.

However, old habits never die. Years and years of Ctrl+TAB and Ctrl+Shift+TAB in my web browser window are hard to forget. And so enters Joost Kremers’ nswbuff.

(use-package nswbuff                    ; Quick switching between buffers
  :ensure t
  :bind* (("<C-tab>"           . nswbuff-switch-to-next-buffer)
          ("<C-S-iso-lefttab>" . nswbuff-switch-to-previous-buffer))
  :config (setq nswbuff-buffer-list-function #'nswbuff-projectile-buffer-list
                nswbuff-display-intermediate-buffers t
                nswbuff-exclude-buffer-regexps '("^ .*" "^\\*.*\\*")))

I am loading it from a specific path, because at the time of this writing the package is not on MELPA.

The key setting here is the value of nswbuff-buffer-list-function. Using nswbuff-projectile-buffer-list activates nswbuff integration with Projectile, and so I can quickly move between my project buffers hitting the good ol’ Ctrl+TAB.