Thursday, September 17, 2020

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

i think strftime() is what you're looking for

On Thu, Sep 17, 2020 at 2:54 PM Maxim Abalenkov <maxim.abalenkov@gmail.com> 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 \\ maxim.abalenkov@gmail.com
+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 vim_use+unsubscribe@googlegroups.com.
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 vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CALfSX1zgonfkrR93cyAFx_dbpvnzHobC4DwM3jaU%3DOYq1NENfA%40mail.gmail.com.

No comments: