itchyny / calendar.vim

A calendar application for Vim
MIT License
1.95k stars 71 forks source link

Changing Holiday Column #200

Closed 3rdey3 closed 2 years ago

3rdey3 commented 2 years ago

We can change the starting day of the week, but is there a way to change the Holiday Column. i.e. can I highlight the Friday column in Red instead of Sunday column?

itchyny commented 2 years ago

There is no option to do this (no plan to implement).

3rdey3 commented 2 years ago

One can achieve this in the "Year View" by changing this following two lines of code. Only works for the "Year View" though. But for me, it's mostly what I use.

diff --git a/autoload/calendar/constructor/view_months.vim b/autoload/calendar/constructor/view_months.vim
index 75ab812..4400cd4 100644
--- a/autoload/calendar/constructor/view_months.vim
+++ b/autoload/calendar/constructor/view_months.vim
@@ -103,7 +103,7 @@ function! s:instance.set_day_name() dict abort
       call add(daytitles, calendar#text#new(len(day_names) - (self.view.width - 2), (offsetx[-1] + v.pad) * i, y, 'DayTitle'))
       for k in range(index, index + 6)
         let l = k % 7
-        let is_sunday = l == 0
+        let is_sunday = l == 5
         let is_saturday = l == 6
         if is_sunday || is_saturday
           let x = (offsetx[-1] + v.pad) * i + offsetx[k - index]
@@ -199,7 +199,7 @@ function! s:instance.set_contents() dict abort
           for k in range(mh) " Do not use .height()
             call add(self.top_syntax, calendar#text#new(2, x, y + k, 'Sunday'))
           endfor
-        elseif d.is_sunday()
+        elseif d.is_friday()
           if sun[0] < 0 | let sun[0] = x | endif
           let sun[2 - (sun[1] < 0)] = y
         elseif d.is_saturday()