Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6629133
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T22:13:01+00:00 2026-05-25T22:13:01+00:00

There is good snippet for changing cursor color: if &term =~ xterm\\|rxvt use an

  • 0

There is good snippet for changing cursor color:

if &term =~ "xterm\\|rxvt"
  " use an orange cursor in insert mode
  let &t_SI = "\<Esc>]12;orange\x7"
  " use a red cursor otherwise
  let &t_EI = "\<Esc>]12;red\x7"
  silent !echo -ne "\033]12;red\007"
  " reset cursor when vim exits
  autocmd VimLeave * silent !echo -ne "\033]112\007"
  " use \003]12;gray\007 for gnome-terminal
endif

How should I alter this that instead of cursor, CursorLine would change color for example from dark blue to blue?

My complete config is https://bitbucket.org/JackLeo/home-configs/src/5b8faf340f87/.vimrc

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T22:13:02+00:00Added an answer on May 25, 2026 at 10:13 pm

    Have you look in into the ‘highlight’ command which is a easier way to control this.

    For example, to change the CursorLine,

    :hi CursorLine guifg=red guibg=blue
    

    Reference: :help highlight

    To make it switch between mode.

    " 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
    

    I may be possible to mix termcap color with autocmd, but IMO, highlight is more easy to maintain in long term (and in case if use gVim occassionally)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any good tutorial or code snippet out there on how to use
Are there any good code snippet plugins for visual studio? I want a plugin
Is there a good code snippets application for Delphi or general purpose with IDE
Are there good reasons why it's a better practice to have only one return
Are there good efficiency savings using Sql Server 2005 over Sql Server 2000? Or
Is there good example code or a test project for explaining the Model–view–presenter (MVP)
What are the tensions between multithreading and exception-safety in C++? Are there good guidelines
Is there any good way to deal with the class renaming refactor from Resharper
Is there a good way for displaying unicode text in opengl under Windows? For
Is there a good ruby gem for a WYSIWYG editor that will easily work

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.