[change colour scheme depending on time of day]

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[change colour scheme depending on time of day]

Maxim Abalenkov
Dear all,

I have a rather simple task. I would like Vim to change the colour scheme depending on the time of the day. Please find my solution below. I place it into my ~/.vimrc file. I’m wondering, maybe there is a more elegant way to do it? Maybe there is a built-in Vim function to enquire the hour of the day?

let hr = substitute(system('date +%H'), "\n", "", "")

" colour scheme setting
if (hr >= 6) && (hr < 18)
  colorscheme solarized8_light
else
  colorscheme solarized8_dark
endif

Thank you for your help!

Best wishes,
Maxim

Maxim Abalenkov \\ [hidden email]
+44 7 486 486 505 \\ http://mabalenk.gitlab.io

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/7A9F43C0-A964-4D97-B681-1363021170CA%40gmail.com.
Al
Reply | Threaded
Open this post in threaded view
|

Re: [change colour scheme depending on time of day]

Al
Hi Maxim,

>I have a rather simple task. I would like Vim to change the colour scheme depending on the time of the day. Please find my solution below. I place it into my ~/.vimrc file. I’m wondering, maybe there is a more elegant way to do it? Maybe there is a built-in Vim function to enquire the hour of the day?
>
>let hr = substitute(system('date +%H'), "\n", "", "")

I believe strftime("%H") will do what you want. According to the help, this isn't particularly portable, so ymmv.

Al

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20200917220753.GA13368%40sleipnir.
Reply | Threaded
Open this post in threaded view
|

Re: [change colour scheme depending on time of day]

tooth pik
In reply to this post by Maxim Abalenkov
i think strftime() is what you're looking for

On Thu, Sep 17, 2020 at 2:54 PM Maxim Abalenkov <[hidden email]> wrote:
Dear all,

I have a rather simple task. I would like Vim to change the colour scheme depending on the time of the day. Please find my solution below. I place it into my ~/.vimrc file. I’m wondering, maybe there is a more elegant way to do it? Maybe there is a built-in Vim function to enquire the hour of the day?

let hr = substitute(system('date +%H'), "\n", "", "")

" colour scheme setting
if (hr >= 6) && (hr < 18)
  colorscheme solarized8_light
else
  colorscheme solarized8_dark
endif

Thank you for your help!

Best wishes,
Maxim

Maxim Abalenkov \\ [hidden email]
+44 7 486 486 505 \\ http://mabalenk.gitlab.io

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/7A9F43C0-A964-4D97-B681-1363021170CA%40gmail.com.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CALfSX1zgonfkrR93cyAFx_dbpvnzHobC4DwM3jaU%3DOYq1NENfA%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: [change colour scheme depending on time of day]

UncleBill
In reply to this post by Al
I have a plugin change colorscheme depending on working directory:


Hope it could give you some inspiration 

Al <[hidden email]>于2020年9月18日 周五下午2:03写道:
Hi Maxim,



>I have a rather simple task. I would like Vim to change the colour scheme depending on the time of the day. Please find my solution below. I place it into my ~/.vimrc file. I’m wondering, maybe there is a more elegant way to do it? Maybe there is a built-in Vim function to enquire the hour of the day?

>

>let hr = substitute(system('date +%H'), "\n", "", "")



I believe strftime("%H") will do what you want. According to the help, this isn't particularly portable, so ymmv.



Al



--

--

You received this message from the "vim_use" maillist.

Do not top-post! Type your reply below the text you are replying to.

For more information, visit http://www.vim.org/maillist.php



---

You received this message because you are subscribed to the Google Groups "vim_use" group.

To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].

To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20200917220753.GA13368%40sleipnir.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAPHDgoNQGa4ogg1o%3DMTOGPUx34R0fTcPwxWoVm2DowGYH7YMfg%40mail.gmail.com.