itchyny / calendar.vim

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

Tasks: would like to see the entire task titles #94

Closed nikisix closed 9 years ago

nikisix commented 9 years ago

I've been leaving calendar.vim open on my desktop as a day/task planner. I'd really like to use the task list as my todo list, but as is I can only see a handful of characters for each task (and the first few are the date of course).

I was wondering how hard it would be to make the task list a bit wider (as wide as the longest task would be nice)? I started tooling around in the code and found view.vim, but can't find anything that would relate to relative widths in there..

itchyny commented 9 years ago

Try <C-g>.

nikisix commented 9 years ago

Yep that definitely works to print out a single task on the bottom of the screen, but is it too much to ask to see all tasks at once?

I finally found the width code in constructor/view.vim, however I can't find where the width is getting set on the task variable anywhere in the task code.

Btw, I forgot to thank you for writing an awesome application that I use all the time :)

itchyny commented 9 years ago

Unfortunately, there's no good api to change the width of the task view. Please look into autoload/calendar/setting.vim and search by /s:view_source. The dictionary is used to control almost everything; the list, order, visibility, position and size of the views. This trick is not written in the doc, but you can overwrite this setting by the global variable g:calendar_view_source, just like as the other options.

let g:calendar_view_source = [
...
        \ { 'type': 'task'
        \ , 'align': 'right'
        \ , 'left': 'calendar#util#winwidth() * 3 / 6'
        \ , 'top': '(calendar#util#winheight() - self.height()) / 2'
        \ , 'position': 'absolute'
        \ , 'maxwidth': 'calendar#util#winwidth() * 3 / 6'
...
        \ ]
nikisix commented 9 years ago

Thank you itchyny! That was very helpful indeed. For anyone else whose happened upon this thread I ended up just giving the task util window the same properties as the event window (suits my personal needs): \ { 'type': 'task' \ , 'align': 'right' \ , 'left': '(calendar#util#winwidth() - self.width()) / 2' \ , 'top': '(calendar#util#winheight() - self.height()) / 2' \ , 'position': 'absolute' \ , 'maxwidth': 'max([calendar#util#winwidth() / 3, 15])' \ , 'maxheight': 'max([calendar#util#winheight() * 5 / 6, 3])' \ , 'visible': 'b:calendar.view._task' \ },

itchyny commented 9 years ago

Well in that case, you may want to fix the width of the calendar; in the default setting

        \ , 'maxwidth': 'b:calendar.view.task_visible() ? calendar#util#winwidth() * 5 / 6 - 3  : calendar#util#winwidth() - 1'

you may want to change this width to

        \ , 'maxwidth': 'calendar#util#winwidth() * 5 / 6 - 3'

to stop the calendar to shrink. Umm, anyway, you may know how to configure the arrangement of the views.

As I did not write the configuration of the arrangement in the help file, I do not make this way of configuration open as the stable api. So use at your own risk; I may change the codes of evaluating the settings of the arrangements. I've got less interested in changing the codes of this plugin dynamically; configuration of g:calendar_view_source would less possibly stop working.