From 588b6031e152b031be1dee04c7b38938ea7eb706 Mon Sep 17 00:00:00 2001 From: JSDurand Date: Thu, 21 Jan 2021 23:52:21 +0800 Subject: Regular updates In the course of configuring Emacs there are numerous changes to make. This is one regular step. --- ibuffer.el | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'ibuffer.el') diff --git a/ibuffer.el b/ibuffer.el index 2033bba..c67325e 100644 --- a/ibuffer.el +++ b/ibuffer.el @@ -8,10 +8,34 @@ (setq ibuffer-show-empty-filter-groups nil) -;;; a temporary binding +;;; Bindings related to buffers + +;;;; Quickly switch to the last buffer. + +;;;###autoload +(defun durand-switch-to-last-buffer (&optional arg) + "Switch to the last buffer. + +The last buffer is given by `other-buffer'. + +If ARG is non-nil, then display the last buffer in a new window." + (interactive "P") + (cond + (arg (switch-to-buffer-other-window nil)) + ((switch-to-buffer nil)))) + +;;;###autoload +(defun durand-switch-to-last-buffer-other-window () + "Switch to the last buffer in a new window." + (interactive) + (switch-to-buffer-other-window nil)) (define-key global-map (vector 24 2) #'ibuffer) -(define-key global-map (vector ?\s-b) #'ibuffer) +(define-key global-map (vector ?\s-h) #'ibuffer) +(define-key global-map (vector ?\s-b) #'switch-to-buffer) +(define-key global-map (vector ?\s-B) #'switch-to-buffer-other-window) +(define-key global-map (vector ?\s-n) #'durand-switch-to-last-buffer) +(define-key global-map (vector ?\s-N) #'durand-switch-to-last-buffer-other-window) (define-key ibuffer-mode-map (vector ?d) #'ibuffer-do-delete) (define-key ibuffer-mode-map (vector ?D) #'ibuffer-mark-for-delete) -- cgit v1.2.3-18-g5258