bash emacs 中的术语:: 如何关闭“自动换行”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3898181/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
term inside emacs:: how to turn "word wrap" off
提问by Alexander Bird
In setting up my personal Linux command line development environment, I want to use term inside emacs b/c then I can switch to 'line mode' and copy/paste the output into any other buffer.
在设置我的个人 Linux 命令行开发环境时,我想在 emacs b/c 中使用 term 然后我可以切换到“行模式”并将输出复制/粘贴到任何其他缓冲区中。
However, when I run mysql inside term inside emacs, the pretty sql tables still word wrap according to the width of that emacs window :(. I was hoping that emacs would truncate the bash output.
但是,当我在 emacs 内的 term 内运行 mysql 时,漂亮的 sql 表仍然根据该 emacs 窗口的宽度自动换行 :(。我希望 emacs 会截断 bash 输出。
Is there a way to do this?
有没有办法做到这一点?
EDIT:
编辑:
toggle-truncate-lines is on, so "word wrap" is off, but the problem is that before emacs even does anything with the text, the underlying bash process itself manually adds newlines to wrap text according to the width it's told it's using. That's at least how it acts. toggling truncate lines on/off doesn't change anything for me in the termbuffer
toggle-truncate-lines 是打开的,所以“自动换行”是关闭的,但问题是在 emacs 甚至对文本做任何事情之前,底层的 bash 进程本身根据它被告知的宽度手动添加换行符来包装文本。至少它是这样运作的。在术语缓冲区中打开/关闭截断线对我来说没有任何改变
回答by JOTN
I think what you probably want is "M-x toggle-truncate-lines". That toggles between wrapping or requiring you to scroll right and left to see the entire line.
我想你可能想要的是“Mx toggle-truncate-lines”。这在换行或要求您左右滚动以查看整行之间切换。
回答by Trey Hymanson
You probably want to add something to the sql hook to turn off the wrapping:
你可能想在 sql 钩子中添加一些东西来关闭包装:
(add-hook 'sql-interactive-mode-hook '(lambda () (toggle-truncate-lines 1))
回答by Joakim H?rsman
I think Emacs might be setting the COLUMNSenvironment variable to indicate when the shell should wrap lines. Try setting it to a very large value and see if that helps.
我认为 Emacs 可能正在设置COLUMNS环境变量以指示 shell 何时应该换行。尝试将其设置为一个非常大的值,看看是否有帮助。
I have no idea what other things this will break though.
我不知道这会破坏什么其他东西。
回答by Jistanidiot
Meta-X auto-fill-mode
This will toggle auto-fill mode and stop the line wrap.
这将切换自动填充模式并停止换行。

