summaryrefslogtreecommitdiff
path: root/tab-conf.el
diff options
context:
space:
mode:
authorJSDurand <mmemmew@gmail.com>2021-01-09 14:22:00 +0800
committerJSDurand <mmemmew@gmail.com>2021-01-09 14:22:00 +0800
commitdc206ebe9397d656971ba7fc3a092009ef4e797a (patch)
treed963873011122fdf0eafeba89afd487115994bc5 /tab-conf.el
parenta2f7f2bf9077ba8acfc550575b9e21aa9ffe7bae (diff)
temporary state
Diffstat (limited to 'tab-conf.el')
-rw-r--r--tab-conf.el54
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))))
+
+
+