Townk / vim-autoclose

This plugin for Vim enable an auto-close chars feature for you. For instance if you type an '(', ``autoclose`` will automatically insert a ')' and put the cursor between than.
http://townk.github.com/vim-autoclose/
503 stars 66 forks source link

Can't configure AutoClosePairs in .vimrc #21

Closed alexis closed 12 years ago

alexis commented 12 years ago

Hi!

I tried to add the following line:

 let b:AutoClosePairs = AutoClose#DefaultPairsModified("", "<")

to my .vimrc file to turn off autoclosing of angle brackets, but it resulted in "E117: Unknown function: AutoClose#DefaultPairsModified" error message. Ok, .vimrc gets loaded before plugins....

Then I tried to add it as autocmd:

autocmd FileType *
  \ let b:AutoClosePairs = AutoClose#DefaultPairsModified("", "<")

This one mostly worked, but not for my ruby files, which were my primary goal.

Any ideas how I could configure this for ruby language?

(I'm using vim 7.2)

artm commented 12 years ago

I need to look into it, as I run into it myself I think. I think it has to do with us adding autocommand for ruby, which runs after user's, but I'm not sure. And really, angle brackets shouldn't be in default pairs.

The first one should have been g:AutoClosePairs, but you're right, the function isn't available at that point. Potential solution could be to let user define a callback init function in their .vimrc that the plugin would call. It would be possible to call our api inside that init callback.

alexis commented 12 years ago

From my point of view, it would make sense to remove both of them - angle brackets from default pairs and "pipe brackets" autocommand for ruby (personally I like them, but they are too matter of test to include IMO).

I could do it myself and make a push if you like.

artm commented 12 years ago

Well, I have some other work planned for the plugin, I can just as well fix this, starting right now.

alexis commented 12 years ago

ok, cool. btw, thanks for the plugin.

On Tue, Feb 14, 2012 at 12:55 PM, Artem Baguinski < reply@reply.github.com

wrote:

Well, I have some other work planned for the plugin, I can just as well fix this, starting right now.


Reply to this email directly or view it on GitHub: https://github.com/Townk/vim-autoclose/issues/21#issuecomment-3957187