aboutsummaryrefslogtreecommitdiff
path: root/lisp/ui/init-windows.el
diff options
context:
space:
mode:
authorRichard Qin <richard.qin.x@gmail.com>2026-10-29 02:03:06 +0800
committerRichard Qin <richard.qin.x@gmail.com>2026-10-29 02:03:06 +0800
commitfcd1c99d5973baa71794d09bde16d37c322ac86f (patch)
treeccd0e8821e79a32e528117a7354ceb265122acc7 /lisp/ui/init-windows.el
parentd2b8f0cdf59e00e1e6d239fd08b2d3ae4d9a4455 (diff)
downloademacs.d-master.tar.gz
emacs.d-master.tar.xz
Configure Emacs user interfaceHEADmaster
Signed-off-by: Richard Qin <richard.qin.x@gmail.com>
Diffstat (limited to 'lisp/ui/init-windows.el')
-rw-r--r--lisp/ui/init-windows.el73
1 files changed, 73 insertions, 0 deletions
diff --git a/lisp/ui/init-windows.el b/lisp/ui/init-windows.el
new file mode 100644
index 0000000..239d022
--- /dev/null
+++ b/lisp/ui/init-windows.el
@@ -0,0 +1,73 @@
+;;; init-windows.el --- Window management -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2026 Richard Qin
+;; SPDX-License-Identifier: GPL-3.0-or-later
+
+;; Author: Richard Qin
+;; This file is not part of GNU Emacs.
+
+;;; Commentary:
+
+;; Configure Emacs window and tab management.
+;; Enable tab-bar-mode and winner-mode.
+
+;;; Code:
+
+;; ------------------------------------------------------------
+;; Tab Bar
+;; ------------------------------------------------------------
+
+(require 'tab-bar)
+
+;; Show the tab bar when multiple tabs exist.
+(setq tab-bar-show 1)
+
+;; Hide additional tab control buttons.
+(setq tab-bar-new-button-show nil)
+(setq tab-bar-close-button-show nil)
+
+;; Enable tab management.
+(tab-bar-mode 1)
+
+
+;; ------------------------------------------------------------
+;; Winner Mode
+;; ------------------------------------------------------------
+
+(require 'winner)
+
+;; Enable window layout history.
+(winner-mode 1)
+
+
+;; ------------------------------------------------------------
+;; Keybindings
+;; ------------------------------------------------------------
+
+;; Create a new tab.
+(define-key my/command-map
+ (kbd "t")
+ #'tab-new)
+
+;; Switch tabs.
+(define-key my/command-map
+ (kbd "n")
+ #'tab-next)
+
+(define-key my/command-map
+ (kbd "p")
+ #'tab-previous)
+
+;; Restore window layouts.
+(define-key my/command-map
+ (kbd "u")
+ #'winner-undo)
+
+(define-key my/command-map
+ (kbd "U")
+ #'winner-redo)
+
+
+(provide 'init-windows)
+
+;;; init-windows.el ends here