search

Home  >  Q&A  >  body text

gvim - Problems with undoing command line command operations and highlighting the line where the cursor is located in Vim

Regarding gVim in Windows environment, I have the following questions. I would like some Vim experts to give me some advice:

1) I know that u is the command to undo the last editing operation. Is there any command to undo the last command line operation? For example, after I type::set list, I want to cancel the operation directly. Without typing::set nolist, are there other more general shortcut keys and commands?

2) How to highlight the line where the cursor is and change the line number color of the line where the cursor is in insert mode (for example, change it to red to more clearly remind yourself that you are in insert mode); and then restore it after exiting insert mode. For the original?

3) A very strange problem: Set the line number foreground color: highlight LineNr guifg=dimgray. It can be successfully set by entering it on the command line, but it does not work after writing it to the _vimrc file, saving it and restarting. why is that? No error was reported when starting. The settings in the _vimrc file are as follows:

Greatful!

给我你的怀抱给我你的怀抱2777 days ago1021

reply all(1)I'll reply

  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-05-16 16:38:38

    1) Not as far as I know

    2) A solution copied from StackOverflow:

    " Enable CursorLine
    set cursorline
    
    " Default Colors for CursorLine
    highlight  CursorLine ctermbg=Yellow ctermfg=None
    
    " Change Color when entering Insert Mode
    autocmd InsertEnter * highlight  CursorLine ctermbg=Green ctermfg=Red
    
    " Revert Color to default when leaving Insert Mode
    autocmd InsertLeave * highlight  CursorLine ctermbg=Yellow ctermfg=None
    

    3) Vim may not read your _vimrc file. You can check the settings to see if there is a problem.

    reply
    0
  • Cancelreply