emacs:通过在当前行下划线来突出显示该行
在vim中,我们可以使用dotvim文件中的“设置光标线”来打开它。在emacs中有这样做的方法吗?我认为没有一种完全相同的内置方法。您可以使用hl行模式突出显示当前行,自定义该模式可以将突出显示设置为下划线,而不是默认的不同背景颜色——但您得到的下划线会停在行中文本的末尾,而不是继续到窗口的边缘。在.emacs中,为emacs:通过在当前行下划线来突出显示该行,emacs,Emacs,在vim中,我们可以使用dotvim文件中的“设置光标线”来打开它。在emacs中有这样做的方法吗?我认为没有一种完全相同的内置方法。您可以使用hl行模式突出显示当前行,自定义该模式可以将突出显示设置为下划线,而不是默认的不同背景颜色——但您得到的下划线会停在行中文本的末尾,而不是继续到窗口的边缘。在.emacs中,为hl line mode定制面部,如下所示: (global-hl-line-mode 1) (set-face-attribute hl-line-face nil :under
hl line mode
定制面部,如下所示:
(global-hl-line-mode 1)
(set-face-attribute hl-line-face nil :underline t)
hl line face
是一个变量,用于存储显示当前行的hl line mode
的名称。您可以根据自己的喜好自定义:前台
:后台
和一系列其他属性。检查文档
global hl line mode
打开高亮显示所有缓冲区中的当前行。如果您只想在某些缓冲区中使用它,请使用M-x hl line模式打开它。关于此主题有一篇很好的博客文章:
以下代码(输入wit M-:或在~/.emacs中)使用RGB代码#222作为背景色(如果在!),并在当前行的字体下面加下划线。取消设置前景颜色使用默认颜色,这例如保留了高亮行上的C++颜色。
(global-hl-line-mode 1)
(set-face-background 'highlight "#222")
(set-face-foreground 'highlight nil)
(set-face-underline-p 'highlight t)
您可以检查是否需要使用M-x更改高亮显示
或(afaik older)hl行
,并:
describe-face <RET> highlight
describe-face <RET> hl-line
Face: highlight (sample) (customize this face)
Documentation:
Basic face for highlighting.
Family: unspecified
Foundry: unspecified
Width: unspecified
Height: unspecified
Weight: unspecified
Slant: unspecified
Foreground: unspecified
Background: #222
Underline: t
Overline: unspecified
Strike-through: unspecified
Box: unspecified
Inverse: unspecified
Stipple: unspecified
Font: unspecified
Fontset: unspecified
Inherit: unspecified