> ....
> I'm starting to think this is a bug in vim itself. Here's more of the
> background:
>
> The error is happening on an up-to-date ArchLinux system running the
> development branch of the VimOrganizer filetype plugin. (Available
> at: https://github.com/hsitz/VimOrganizer)
>
> I'm author of that plugin and a user complained of problems running
> that I debugged remotely. This problem does not happen on any of my
> Windows installs or on a couple Linux installs I've checked (Ubuntu,
> OpenSuse).
>
> The user is able to replicate the problem this way:
>
> 1. open terminal vim from command line with command 'vim'
> 2. run :echo 'DONE' > '' (properly outputs value of 1)
> 3. quit vim
> 4. open any org file, 'vim anyorgfile.org'
> 5. run :echo 'DONE' > '' (returns invalid output of 0)
>
> So it seems something gets screwed up when the filetype plugin is
> initialized. Strange because (1) no errors are thrown, (2) same code
> works fine on many other systems, and (3) even if something in
> VimOrganizer is screwy I can't imagine proper behavior for vim is to
> have different results for same expression in steps numbered 2 and 5,
> above.
>
> -- Herb
The culprit is indeed Vim option 'ignorecase'. I can reproduce this on
Win2k, 32-bit, Vim 7.3.145, Normal version.
:let ignorecase_saved = &ignorecase
:set noignorecase
:echo 'DONE' > ''
:set ignorecase
:echo 'DONE' > ''
:let &ignorecase = ignorecase_saved
:unlet ignorecase_saved
1
0
Don't know if this is a bug, but this is a weird way to test if a
string is empty. Why not just do:
if mystring != ''
" do something here
[. . . ]
endif
VimOrganizer sets 'ignorecase' in ftplugin/org.vim, near the top in
https://github.com/hsitz/VimOrganizer/raw/development/ftplugin/org.vim
This is WRONG because it's a **global** option. Ditto for
'smartcase'.
If you need a particular global option, change it temporarily right
before the action that needs it, then set back to the original value,
as in the example above.
When comparing strings, use '==#' or '==?' and so on if case matters.
To make your patterns independent from 'ignorecase' and 'magic',
prepend patterns with '\m\C' or '\m\c'.
Regards,
Vlad
--
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
No comments:
Post a Comment