hsitz / VimOrganizer

VimOrganizer is partly a clone of Emacs' Org-mode, and partly a front end to Org-mode itself. Do Org in Vim.
http://vimeo.com/31531308
517 stars 67 forks source link

TODO toggling fix #9

Open jessesherlock opened 13 years ago

jessesherlock commented 13 years ago

I had to make a change to get toggling to work. I don't know vimscript very well so I didn't know if the greater than operator was overloaded for strings and this was supposed to work or if it was just a typo bug.

jessesherlock commented 13 years ago

Yeah, turns out it is a vim setting set ignorecase (a really handy setting) makes "foobar" > '' return false set noignorecase (default) makes it return true

at least i've figured it out since i found that that bug was causing all sorts of problems with vimorganizer.

I'd be happy to contribute a change that changes these to: "foobar" ># '' which forces case sensitivity and seems to work fine even when ignorecase is set (in the same way that "foobar" >? '' is always broken regardless of the ignorecase setting). If that's not acceptable to you, i'll make that change in this fork and this is something that should be added with a comment in your example _vimrc because it's an annoying bug to track down.

Absolutely love the work you've done so far by the way. An org mode clone for vim has been sitting in my "someday" projects list for a long time. Good job.

jessesherlock commented 13 years ago

Hmm, from the #vim irc chan it seems this isn't universal behaviour either. Found one person who didn't see a change in the return value with the ignorecase setting, while the other 2 did.

May be a locale issue (using en_US.utf8) or something very unusual.

Is there any reason the empty() function is not ideal? (which if i was thinking I would have used instead of len())

insanum commented 13 years ago

I have the same exact problem with the TODO toggling. After seeing the changes in jessesherlock's fork that changed all (foo > '') to (!empty(foo))... I tried it out and it now works as expected. Regarding what the underlying problem actually is I don't know. But I will say that using "empty()" is much clearer and obviously a better coding practice.

Note that I'm on Linux using unicode-rxvt.

jessesherlock commented 13 years ago

Interesting, I'm also using unicode-rxvt.

I assume it's either a locale or unicode thing. I don't know enough about vimscript to say that using empty() is definitely a better coding practice but it looks that way.