How to set if else for vim's “set background = ” for light and dark colorschemes?Why does the order of...

Why do I get two different answers for this counting problem?

Why doesn't H₄O²⁺ exist?

What typically incentivizes a professor to change jobs to a lower ranking university?

Why doesn't Newton's third law mean a person bounces back to where they started when they hit the ground?

Why "Having chlorophyll without photosynthesis is actually very dangerous" and "like living with a bomb"?

Today is the Center

Is it possible to run Internet Explorer on OS X El Capitan?

How does quantile regression compare to logistic regression with the variable split at the quantile?

When a company launches a new product do they "come out" with a new product or do they "come up" with a new product?

Intersection point of 2 lines defined by 2 points each

How is the claim "I am in New York only if I am in America" the same as "If I am in New York, then I am in America?

Approximately how much travel time was saved by the opening of the Suez Canal in 1869?

Why is 150k or 200k jobs considered good when there's 300k+ births a month?

Is it unprofessional to ask if a job posting on GlassDoor is real?

Can I make popcorn with any corn?

How is it possible to have an ability score that is less than 3?

LWC SFDX source push error TypeError: LWC1009: decl.moveTo is not a function

strTok function (thread safe, supports empty tokens, doesn't change string)

Fully-Firstable Anagram Sets

What are these boxed doors outside store fronts in New York?

Can a Cauchy sequence converge for one metric while not converging for another?

Modeling an IP Address

Can you really stack all of this on an Opportunity Attack?

Why does Kotter return in Welcome Back Kotter?



How to set if else for vim's “set background = ” for light and dark colorschemes?


Why does the order of :set bg=dark and :set bg=light matter?I can't get 256 colours to work with Vim in iTerm2 on MacOS XShowing a different background color or layout beyond 80 column using spf13How to setup in `~/.vimrc` a mapping for `colorscheme` to toggle `solarized` between `dark` and `light`?The simplest way to start Vim in private modeColor Schemes not displayed correctly in neovim“set background=dark” masking highlight commandWhat does :set background=dark do?How to set VIM's background based on terminal's background colour?Incremental Highlighting Colorscheme Override













1















For themes like One or PaperColor, there are dark and light versions. For dark or light theme, I usually add my own customizations like bracket color, comment color... etc.



I tried to combine them so that everytime I set background=dark or light, with an if else statement. I tried the following but it doesn't work.



if (set background=dark)
""" my own code here
endif


Please let me know how to go about this and thank you.










share|improve this question



























    1















    For themes like One or PaperColor, there are dark and light versions. For dark or light theme, I usually add my own customizations like bracket color, comment color... etc.



    I tried to combine them so that everytime I set background=dark or light, with an if else statement. I tried the following but it doesn't work.



    if (set background=dark)
    """ my own code here
    endif


    Please let me know how to go about this and thank you.










    share|improve this question

























      1












      1








      1








      For themes like One or PaperColor, there are dark and light versions. For dark or light theme, I usually add my own customizations like bracket color, comment color... etc.



      I tried to combine them so that everytime I set background=dark or light, with an if else statement. I tried the following but it doesn't work.



      if (set background=dark)
      """ my own code here
      endif


      Please let me know how to go about this and thank you.










      share|improve this question














      For themes like One or PaperColor, there are dark and light versions. For dark or light theme, I usually add my own customizations like bracket color, comment color... etc.



      I tried to combine them so that everytime I set background=dark or light, with an if else statement. I tried the following but it doesn't work.



      if (set background=dark)
      """ my own code here
      endif


      Please let me know how to go about this and thank you.







      vimrc colorscheme






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked yesterday









      mle0312mle0312

      294




      294






















          1 Answer
          1






          active

          oldest

          votes


















          4














          if &background ==# 'dark'
          " balabala
          endif


          &background get value of 'background' option, check :help let-&

          ==# compare strings case sensitively, check :help ==#






          share|improve this answer


























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "599"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fvi.stackexchange.com%2fquestions%2f19435%2fhow-to-set-if-else-for-vims-set-background-for-light-and-dark-colorschemes%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            4














            if &background ==# 'dark'
            " balabala
            endif


            &background get value of 'background' option, check :help let-&

            ==# compare strings case sensitively, check :help ==#






            share|improve this answer






























              4














              if &background ==# 'dark'
              " balabala
              endif


              &background get value of 'background' option, check :help let-&

              ==# compare strings case sensitively, check :help ==#






              share|improve this answer




























                4












                4








                4







                if &background ==# 'dark'
                " balabala
                endif


                &background get value of 'background' option, check :help let-&

                ==# compare strings case sensitively, check :help ==#






                share|improve this answer















                if &background ==# 'dark'
                " balabala
                endif


                &background get value of 'background' option, check :help let-&

                ==# compare strings case sensitively, check :help ==#







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited 23 hours ago

























                answered yesterday









                dedowsdidedowsdi

                38615




                38615






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Vi and Vim Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fvi.stackexchange.com%2fquestions%2f19435%2fhow-to-set-if-else-for-vims-set-background-for-light-and-dark-colorschemes%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Why not use the yoke to control yaw, as well as pitch and roll? Announcing the arrival of...

                    Couldn't open a raw socket. Error: Permission denied (13) (nmap)Is it possible to run networking commands...

                    VNC viewer RFB protocol error: bad desktop size 0x0I Cannot Type the Key 'd' (lowercase) in VNC Viewer...