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

  • SEARCH
  • Home
  • 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 7803583
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T01:37:52+00:00 2026-06-02T01:37:52+00:00

I have this in my .vimrc : augroup filetype_colorscheme au BufEnter * \ if

  • 0

I have this in my .vimrc:

augroup filetype_colorscheme
        au BufEnter *
        \ if !exists('b:colors_name')
            \ | if &ft == "vim"
                \ | let b:colors_name = 'color_dark'
            \ | else
                \ | let b:colors_name = 'color_light'
            \ | endif
        \ | endif
        \ | exe 'colorscheme' b:colors_name
augroup END 

What it does:
When I open a .vim page it opens my dark colorscheme “color_dark.vim”
when I open whatever other page it opens my light colorscheme “color_light.vim”

This is very nice but it is not so nice in split windows.
Every time when I click in a split window with p.e. a text file, all split windows become light colored with the light colorscheme (even the .vim files).
When I switch to a vim file in a split window all other files in the other split windows become dark as well.

Is it possible to retain every filetype his own colorscheme in a split window?
What do I have to change in above code?

EDIT
If this is not possible would it be possible to disable above code when I enter in a split window? (in order to let me choose the colorscheme myself, the same for all split windows)

  • 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-06-02T01:37:55+00:00Added an answer on June 2, 2026 at 1:37 am

    Colorschemes will always affect the entire vim instance. It is not possible to have a different color scheme per split window.

    Edit 1: To answer your second question in the edit, you can probably add && winnr('$') == 1 to that first if to stop this from happening when you have multiple split windows open.

    Edit 2: Whoops, the edit above would not work, however I think wrapping everything in another if should.

    Edit 3: Missed a couple of pipes.

    augroup filetype_colorscheme
            au BufEnter *
            \ | if winnr('$') == 1
                    \ if !exists('b:colors_name')
                        \ | if &ft == "vim"
                            \ | let b:colors_name = 'color_dark'
                        \ | else
                            \ | let b:colors_name = 'color_light'
                        \ | endif
                    \ | endif
                    \ | exe 'colorscheme' b:colors_name
            \ | endif
    augroup END 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have this youtube url http://www.youtube.com/watch?v=9N51Etoikfw&feature=youtube_gdata i need to remove the feature parameter and
I have this in my .vimrc, which work correctly iab abbash \#!bin/bash \<CR>############################################################################### \<CR>#
I have added this to .vimrc set t_Co=256 That did not seem to have
I have this line in my .vimrc: nmap <silent> <Leader>p :NERDTreeToggle<CR> So what is
I have the following mapping in my .vimrc. :nmap <F5> :<C-U>make %:r && ./%:r<CR>
In my .vimrc file, I have this line: set mouse=a This enables the mouse
after months of tweaking my vimrc file and installing plugins, I have this little
I have some .c files that don't automatically highlight in vim. This problem only
This question follows on from this vim search question I have a setting in
I have this in my .vimrc set formatprg=astyle I can press gggqG to format

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.