diff options
Diffstat (limited to 'tab-conf.el')
-rw-r--r-- | tab-conf.el | 54 |
1 files changed, 54 insertions, 0 deletions
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)))) + + + |