有时我会从命令行启动带有2个文件的emacs,如下所示:
emacs foo.txt bar.txt
Run Code Online (Sandbox Code Playgroud)
这将打开emacs窗口,垂直拆分:
foo.txt
-------
bar.txt
Run Code Online (Sandbox Code Playgroud)
如何编辑我的.emacs文件,以便它们并排显示,如下所示?:
|
foo.txt | bar.txt
|
Run Code Online (Sandbox Code Playgroud)
编辑:为了澄清,我知道如何在 emacs启动后实现这一点(Mx 0,Mx 3,然后在右侧窗口重新访问bar.txt).我只是希望emacs在我启动时默认并排拆分,所以我没有必要.
Sea*_*ean 19
这是一个将一对垂直窗口更改为一对水平窗口的功能:
(defun 2-windows-vertical-to-horizontal ()
(let ((buffers (mapcar 'window-buffer (window-list))))
(when (= 2 (length buffers))
(delete-other-windows)
(set-window-buffer (split-window-horizontally) (cadr buffers)))))
Run Code Online (Sandbox Code Playgroud)
要在启动时自动执行此操作,请将此功能添加到emacs-startup-hook:
(add-hook 'emacs-startup-hook '2-windows-vertical-to-horizontal)
Run Code Online (Sandbox Code Playgroud)
hui*_*ker 15
以下(添加到您的.emacs)使窗口拆分默认结果为并排缓冲区(而不是一个在另一个缓冲区之上):
(setq split-height-threshold nil)
(setq split-width-threshold 0)
Run Code Online (Sandbox Code Playgroud)
当您启动诸如find-file-other-window(Ctrlx4f)之类的命令时,此默认设置也将适用.
(另一方面,要手动拆分窗口以获得两个并排缓冲区,请考虑此答案).
使用M-x split-window-horizontally或Ctrl-x 3.
小智 5
这对我来说效果很好.使用命令行中的-f function-name可以根据需要设置emacs分屏工作区.这给了我每天更新的2 x 2网格的财务文件,并将光标设置在最后的相应窗口上.我将此保存为.bashrc作为别名,因此我可以使用一个命令(doc_financial)将其提取.
alias doc_financial='emacs -nw financial_accounts.txt -f split-window-horizontally financial_budget.txt -f split-window-vertically financial_taxes.txt -f other-window -f split-window-vertically financial_tasks.txt -f other-window -f other-window -f other-window'
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
15745 次 |
| 最近记录: |