I believe it's possible to get an underline under the current line, rather than a highlight.
This adds the highlight in my .vimrc:
set cursorline
This is what I've tried adding to get an underline:
:highlight CursorLine gui=underline cterm=underline
But it appears to make no difference.
I'm using vim 7.4.629 on Centos 6.7 through putty, if that helps.
Assuming that you want to edit the text file to underline a heading or similar. You can do this by duplicating the line using y y ] p (or :t . <CR> ) and replacing the text with hyphens with a :substitute command like :s!\ S!-!
With the default backslash leader key, pressing \l will highlight the line that currently contains the cursor. The mapping also sets mark l so you can type 'l to return to the highlighted line.
Most filetypes (like python) in Vim come with a syntax that defines highlight groups (see them via :highlight ). A colorscheme then provides combinations of foreground / background color and/or formatting like bold and italic, for terminals, color terminals, and/or GVIM.
Highlighting that moves with the cursor. Simply putting :set cursorline in your vimrc will highlight the current line in every window and update the highlight as the cursor moves. The following example shows how to change the highlight colors and how to create a mapping to toggle cursorline (to highlight the current line) and cursorcolumn ...
The following command in Vim activates a vertical line at the cursor's location. to toggle (with the exclamation mark, works with all set-command) set cursorcolumn! set cursorline set cursorline! hi CursorLine ctermbg=235 *#defines a gray colour for the horizontal line*
You can highlight the corresponding column as well, using the command: It is useful to toggle highlighting on and off by pressing one key in the editor. Add these line to your vimrc: typing 'H' will toggle highlighting on and off (Map it to another key if you want)
This is restored during program startup through session restoration. However, since the session restoration is typically done after .vimrc has been run (typically using a function invoked through 'autocmd VimEnter *'), the cursorline highlight setting in .vimrc is reset by the default for the restored colorscheme.
try :hi clear CursorLine
to clear the current cusorline hl, then :hi CursorLine gui=underline cterm=underline
The color of underline is same as your ctermfg
or guifg
. You can either live with your "colorful" underline, or add cterm/guifg
to make the underlined text and the underline same color.
:set cursorline
was the best solution for me, you can combine it with removing the cursorLine as the answer above mentions
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With