Monday, July 16, 2012

Re: Scripting the enter key

On Monday, July 16, 2012 4:13:23 PM UTC-5, Douglas Mayle wrote:
> Thanks for the tip on <expr>, I hadn't known about it!
>
> </div>
> Long story short, I was using &#39;autoclose&#39; to do what delimitmate does, and was looking to add the CR expansion myself.  It turns out that delimitmate does everything that autoclose does, with smarter handling of matching (e.g. dm: I&#39;m versus ac: I&#39;&#39;m), and adds the functionality as you&#39;ve mentioned.</div>
>
>
>
> </div>
> The only caveat was that SuperTab (which I don&#39;t use, but was hanging around in my bundle directory) conflicts with delimitmate, and so I had to remove it.</div>
>
> </div>
> In any case, I&#39;ve got exactly what I was looking for, so thanks!</div>
>
>
>
> </div>
> Cheers,</div>
> Doug
>

By coincidence I was also trying to fix the problem that these two plugins conflict by both defining a imap for the enter key.
The closest I got was to add the following to a file after/plugin/

imap <silent> <cr> <Plug>delimitMateCR<C-R>=<SNR>34_SelectCompletion(1)<CR>

this would be the mapping defined by delimitmate followed by the mapping defined by supertab.
This solution doesn't really work, whenever I press enter two new lines are entered and the braces in the expansion are not correctly aligned.
The other way around doesn't work (when I put the mapping from supertab before the mapping from delimitmate).

Right now I gave up on the mapping for delimitmate and I am just using the mapping for supertab and additionally have the following map:

inoremap {{ {<cr><cr>}<esc>kcc

if anyone has any idea on how to have the <cr> key work for both plugins it would be nice, otherwise I'll stick to this mapping, once I get used to it is not bad.

Best Regards,

Jorge

--
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: