How to set if else for vim's “set background = ” for light and dark colorschemes?Why does the order of...
Why doesn't H₄O²⁺ exist?
Watching something be written to a file live with tail
Alternative to sending password over mail?
If human space travel is limited by the G force vulnerability, is there a way to counter G forces?
Why was the shrinking from 8″ made only to 5.25″ and not smaller (4″ or less)?
Intersection of two sorted vectors in C++
Arrow those variables!
Has there ever been an airliner design involving reducing generator load by installing solar panels?
How could indestructible materials be used in power generation?
Why does Arabsat 6A need a Falcon Heavy to launch
How to draw the figure with four pentagons?
CEO ridiculed me with gay jokes and grabbed me and wouldn't let go - now getting pushed out of company
AES: Why is it a good practice to use only the first 16 bytes of a hash for encryption?
I'm flying to France today and my passport expires in less than 2 months
Is it legal for company to use my work email to pretend I still work there?
Why are electrically insulating heatsinks so rare? Is it just cost?
How much of data wrangling is a data scientist's job?
Is it unprofessional to ask if a job posting on GlassDoor is real?
Facing a paradox: Earnshaw's theorem in one dimension
Why do I get two different answers for this counting problem?
How can saying a song's name be a copyright violation?
Is it possible to create light that imparts a greater proportion of its energy as momentum rather than heat?
1960's book about a plague that kills all white people
What to put in ESTA if staying in US for a few days before going on to Canada
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
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
add a comment |
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
add a comment |
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
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
vimrc colorscheme
asked 3 hours ago
mle0312mle0312
294
294
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
if &background ==# 'dark'
" balabala
endif
&background get value of 'background' option, check :help let-&
==# compare strings case sensitively, check :help ==#
While the answer is correct, could you please add some explanation? Like why&
and==#
.
– Ralf
25 mins ago
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
if &background ==# 'dark'
" balabala
endif
&background get value of 'background' option, check :help let-&
==# compare strings case sensitively, check :help ==#
While the answer is correct, could you please add some explanation? Like why&
and==#
.
– Ralf
25 mins ago
add a comment |
if &background ==# 'dark'
" balabala
endif
&background get value of 'background' option, check :help let-&
==# compare strings case sensitively, check :help ==#
While the answer is correct, could you please add some explanation? Like why&
and==#
.
– Ralf
25 mins ago
add a comment |
if &background ==# 'dark'
" balabala
endif
&background get value of 'background' option, check :help let-&
==# compare strings case sensitively, check :help ==#
if &background ==# 'dark'
" balabala
endif
&background get value of 'background' option, check :help let-&
==# compare strings case sensitively, check :help ==#
edited 20 mins ago
answered 3 hours ago
dedowsdidedowsdi
1465
1465
While the answer is correct, could you please add some explanation? Like why&
and==#
.
– Ralf
25 mins ago
add a comment |
While the answer is correct, could you please add some explanation? Like why&
and==#
.
– Ralf
25 mins ago
While the answer is correct, could you please add some explanation? Like why
&
and ==#
.– Ralf
25 mins ago
While the answer is correct, could you please add some explanation? Like why
&
and ==#
.– Ralf
25 mins ago
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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