在 emacs 中如何将窗口的垂直分割改为水平分割

文章目录

<2022-08-25 周四>

emacs中如何将窗口的垂直分割改为水平分割

emacs没有原生支持,所以抄了一个函数,如下:

emacs-lisp 复制代码
;;; https://www.emacswiki.org/emacs/ToggleWindowSplit
(defun toggle-window-split ()
  (interactive)
  (if (= (count-windows) 2)
      (let* ((this-win-buffer (window-buffer))
             (next-win-buffer (window-buffer (next-window)))
             (this-win-edges (window-edges (selected-window)))
             (next-win-edges (window-edges (next-window)))
             (this-win-2nd (not (and (<= (car this-win-edges)
                                         (car next-win-edges))
                                     (<= (cadr this-win-edges)
                                         (cadr next-win-edges)))))
             (splitter
              (if (= (car this-win-edges)
                     (car (window-edges (next-window))))
                  'split-window-horizontally
                'split-window-vertically)))
        (delete-other-windows)
        (let ((first-win (other-window 1)))
          (funcall splitter)
          (if this-win-2nd
              (other-window 1))
          (set-window-buffer (selected-window) this-win-buffer)
          (set-window-buffer (next-window) next-win-buffer)
          (if this-win-2nd
              (other-window 1))))))

emacs如何将两个窗口的内容交换?调用M-x window-swap-states即可。

相关推荐
逐步前行19 小时前
C/C++图形库_EasyX 环境配置(VSCode+MinGW )
ide·vscode·编辑器
名剑走天下1 天前
在 VSCode 中:修改快捷键
ide·vscode·编辑器
名剑走天下1 天前
在 VSCode 中:如何主动生成c_cpp_properties.json文件
ide·vscode·编辑器
扣得君1 天前
解决glibc版本低VSCode无法远程问题
ide·vscode·编辑器·glibc升级·vscode远程glibc版本
2503_928411561 天前
11.5 包和包管理器
数据库·arcgis·node.js·编辑器
名剑走天下1 天前
在VSCode中:解决终端输出中文乱码问题
ide·vscode·编辑器
兰文彬1 天前
vscode 安装Jupiter以后,终端无法切换conda环境了
ide·vscode·编辑器
名剑走天下1 天前
在 VSCode 中:引入开源cJSon解析库+示例demo
ide·vscode·编辑器
ii_best1 天前
安卓/IOS工具开发基础教程:按键精灵一个简单的文字识别游戏验证
android·开发语言·游戏·ios·编辑器
你很易烊千玺2 天前
处理wangEditor编辑器缩进问题
编辑器