From dc206ebe9397d656971ba7fc3a092009ef4e797a Mon Sep 17 00:00:00 2001 From: JSDurand Date: Sat, 9 Jan 2021 14:22:00 +0800 Subject: temporary state --- tab-conf.el | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 tab-conf.el (limited to 'tab-conf.el') diff --git a/tab-conf.el b/tab-conf.el new file mode 100644 index 0000000..f55259c --- /dev/null +++ b/tab-conf.el @@ -0,0 +1,54 @@ +;;; tab-conf.el --- My configurations of the tabs -*- lexical-binding: t; -*- + +(require 'tab-bar) + +(define-key tab-switcher-mode-map (vector ?n) 'tab-switcher-next-or-first) +(define-key tab-switcher-mode-map (vector ?p) 'tab-switcher-prev-or-last) +(define-key tab-prefix-map (vector 'tab) 'tab-switcher) + +;;;###autoload +(defun tab-switcher-first () + "Go to the first window configuration line." + (interactive) + (goto-char (point-min)) + (skip-chars-forward "[:space:]\n") + (forward-char -1)) + +;;;###autoload +(defun tab-switcher-last () + "Go to the last window configuration line." + (interactive) + (goto-char (point-max)) + (skip-chars-backward "[:space:]\n") + (goto-char (line-beginning-position)) + (skip-chars-forward "[:space:]") + (forward-char -1)) + +;;;###autoload +(defun tab-switcher-next-or-first () + "Go to the next configuration line. +If the next line is not a configuration line, +then go to the first configuration line." + (interactive) + (forward-line 1) + (cond + ((looking-at "^\\s-*$") + (tab-switcher-first)) + (t (skip-chars-forward "[:space:]") + (forward-char -1)))) + +;;;###autoload +(defun tab-switcher-prev-or-last () + "Go to the previous configuration line. +If the previous line is not a configuration line, +then go to the last configuration line." + (interactive) + (forward-line -1) + (cond + ((looking-at "^\\s-*$") + (tab-switcher-last)) + (t (skip-chars-forward "[:space:]") + (forward-char -1)))) + + + -- cgit v1.2.3-18-g5258