我可以将 emacs(非 Windows)中的长行换到下一行吗?
使用 emacs(非 Windows),当终端打开时,我会在行尾看到“$”标记宽度较窄。有没有办法将长行断到下一行而不是显示“$”标记?
添加的
M-x 自动填充模式适用于文本模式,但在组织模式下,$ 标记仍保留在自动填充模式中。
With emacs (non windows), I see '$' mark at the end of the line when the terminal width is narrow. Is there a way to break the long line to the next line instead of showing the '$' mark?
ADDED
M-x auto-fill-mode works fine for text-mode, but with org-mode, the $ mark remains with the auto-fill-mode.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
您可以使用
Mx fill-paragraph
或Mx fill-region
让 emacs 将长行分成多个较短的行。您还可以使用Mx auto-fill-mode
将其设置为默认行为。You can get emacs to break long lines into multiple shorter lines with
M-x fill-paragraph
orM-x fill-region
. You can also make this the default behavior withM-x auto-fill-mode
.您可以使用
Mx
set-variable
truncate-lines
nil
禁用行截断。您还可以放入 .emacs
(setq-default truncate-lines nil)
中以默认设置该设置。You can disable line truncation with
M-x
set-variable
truncate-lines
nil
.You can also put in your .emacs
(setq-default truncate-lines nil)
to have that setting by default.您可以自定义
word-wrap
变量以直观地换行。这应该类似于 longlines-mode ,只不过它会使用缓冲区宽度而不是填充列进行换行。您也可以使用 Visual-line-mode 来启用自动换行,并“重新定义简单的编辑命令以作用于视觉线,而不是逻辑线”,这解决了 nominolo 提到的问题。
You can customize the
word-wrap
variable to visually wrap lines. This should be similar tolonglines-mode
, except it would use the buffer width rather than the fill column for wrapping.You can alternatively use
visual-line-mode
to both enable word wrapping, and also "Redefine simple editing commands to act on visual lines, not logical lines", which addresses a point that nominolo mentioned.为所有缓冲区设置它:
仅针对特定模式(例如组织模式)设置它:
Set it for all buffers:
Set it just for specific mode(org-mode for instance):
对于当前会话仅使用命令
For the current session only use command
将
truncate-lines
设置为nil
会中断长行,但如果按Cn
或downarrow
光标将跳转到下一个物理行,而不是光标下方显示的位置。使用 Tex 时,我通常会打开 Mx longlines-mode。它有其怪癖,但效果相当好。
Setting
truncate-lines
tonil
will break long lines, but if pressC-n
ordownarrow
the cursor will jump to the next physical line, not the position displayed below the cursor.When working with Tex, I usually switch on
M-x longlines-mode
. It has its quirks, but it works reasonably well.