jszakmeister / vim-togglecursor

Toggle the cursor shape in the terminal for Vim.
http://www.vim.org/scripts/script.php?script_id=4403
119 stars 20 forks source link

Wrapped under had("gui_running") and a word about Neovim #22

Closed yacinehmito closed 9 years ago

yacinehmito commented 9 years ago

There was a check for the use a graphical Vim that I moved in the beginning of the code. The rationale is that there is no point in using the plugin if you're not in a terminal emulator.

Also, I added a bit in the doc about Neovim. The plugin wouldn't work and I struggled for 2 hours before finding out that you need to set an environment variable in order to enable the feature.

jszakmeister commented 9 years ago

Thanks, but I don't like how the conditional was done. I'd rather bail out early and avoid all the extra indentation, so I've pushed up a different version that does this without adding any extra indentation.

Also, NVIM_TUI_ENABLE_CURSOR_SHAPE doesn't allow the sequences to work but causes Neovim to emit sequences itself (IOW, my plugin still does nothing in Neovim). I've toyed with the idea of having vim-togglecursor turning on NVIM_TUI_ENABLE_CURSOR_SHAPE for Neovim, but I'm not sure how to communicate that choosing the shapes is not an option under Neovim other than to document it in the plugin documentation--which is, sadly, the last place people look. The one thing I don't like about that is if you're under a terminal that doesn't support the sequences (and Neovim has done a bad job of detecting this), then garbage could be emitted to the screen, which I try very hard to avoid ever doing. :-( But, given that folks are looking for it to work, I might as well try and help it along. See a11f21b775811810317dead718fec40f33d820e7.

I'm a bit picky about my commit history (sorry!), so I think the commits should have been separated in history and not mixed together in the same commit, for future reference.

Thanks for taking the time. I hope you like what you see on master as a result. And sorry you struggled so much on the Neovim front. The NVIM_TUI_ENABLE_CURSOR_SHAPE is documented in the man page, but it does get overlooked often because the compatibility between Neovim and Vim is so good.

yacinehmito commented 9 years ago

I was indeed mistaken about Neovim. I realized that when I saw the line cursor blinking. Sorry about that.

As I'm not very proficient in VimL I didn't know you could just finish the script like that. Glad I learned something.

Thank you for reviewing my modest contribution and thank you for giving us this plug in.