简体   繁体   中英

How to mark current line in emacs with some background color?

Is there a simply way to paint current line with some background color? Like it does hl-lock-line-face-buffer with regesp, but only the line wher point is.

edit : It is not smth like HIGHLIGHT-CURRENT-LINE, bacause i need to mark a line, then another line, and move point everywhere without affecting that highlights.

The visible bookmarks (bm) package will do what you want. I set bm-highlight-style to bm-highlight-only-fringe for a marker in the column only, but if you want the whole line coloured then set it to bm-highlight-only-line :

(setq bm-highlight-style 'bm-highlight-only-line)

(global-set-key (kbd "<C-f2>") 'bm-toggle)
(global-set-key (kbd "<f2>") 'bm-next)
(global-set-key (kbd "<S-f2>") 'bm-previous)

Bookmark+ does what you are asking for. Use Cx p RET (by default) to set a bookmark at point. And you can configure the kind of highlighting you want for such bookmarks. This is similar to what bm.el offers (Ben's answer), but more flexible

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM