如果我在emacs中运行M-x shell
以获取终端,它会知道在哪里自动换行。例如,ls
的输出被格式化为适合窗口的列。拆分窗口后Emacs shell模式显示太宽
我的问题是,如果我然后垂直分割窗口与C-x 3
,壳模式仍认为窗口填充整个框架。结果是丑陋的命令输出包装。有没有办法让shell模式知道它必须更新屏幕宽度?
编辑:
使用下面HN的答案,我想出了这个修复:
(defun my-resize-window()
"Reset the COLUMNS environment variable to the current width of the window."
(interactive)
(let ((proc (get-buffer-process (current-buffer)))
(str (format "export COLUMNS=%s" (window-width))))
(funcall comint-input-sender proc str)))
(defun my-shell-mode-hook()
(local-set-key "\C-cw" 'my-resize-window))
这是一个非常有用的修复程序。请提交作为错误报告! –
感谢有用的功能,但它会导致问题,当进程为零,所以我在设置过程窗口大小之前添加了无检查 - [请参阅我的答案](http://stackoverflow.com/a/20015336/554279) –