Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Request for javascript? :D #11

pheze opened this Issue · 8 comments

6 participants


$('bleh').click(function() {
|(cursor here) , possibility to add missing ; ?


Cool though this may be, I can't imagine contorting endwise into figuring out multiple endings (')' and '}') in a single line. It would probably require an entirely new algorithm, one that I can't even conceive of (yet, anyways).


Something like autoclose (my fork) (or snippets, e.g. via snipMate) might work better in this case, or good enough as a workaround for now.


What's lacking in autoclose is that it won't break open the

$('bleh').click(function() {|})


$('bleh').click(function() {

I've been working on a way to do this, but then I realized that imaping <CR> breaks endwise. Is there a good way for two things to watch for <CR>?


There's not a good way. If endwise finds an existing <CR> map, it'll include it, so in theory it's possible to chain.


Is this plugin meant to close C-style blocks? I had the impression it was for VimScript-style blocks. C-style blocks should probably be closed by other plugins. I have found several in addition to Autoclose, which was mentioned above: ClosePairs, lhBrackets, delimitMate, and auto-pairs. I have not tried any of these yet, so this is not an endorsement; just an attempt to give some leads to future viewers of this thread. There is further info at this wikia page.


This doesn't work as expected with delimitMate. It uses a setting delimitMate_expand_cr to determine if: {|<CR>} should turn into:


Obviously this setting is set in a user's vimrc. Since it's set conditionally here only if there isn't an existing mapping for <CR> what ends up happening is it's sourced and it ignores that mapping the first time through. Then endwise is sourced, adding a mapping like there is no other <CR> mapping. And then the second time delimitMate calls the maps, there is a <CR> mapping so it is not overwritten. This obviously isn't the fault of endwise, but more of an FYI. I'm not sure how to circumvent this besides attempting to not load endwise based on some filetypes where you'd prefer the delimitMate functionality.

On another note this conditional in endwise can also not be used in a user's vimrc (assuming the plugins are loaded first) since the functions would already be mapped before the variable was defined.

@keith keith referenced this issue in Raimondi/delimitMate

Does not auto indent #39


I almost got around by creating the mapping myself with:

execute "imap <CR> <Plug>delimitMateCR <Plug>DiscretionaryEnd"

But that messes up endwise to where, in Ruby this happens:

if foo<CR>

Turns into:

if foo

The naive solution works without delimitMate's help:

execute "inoremap {<CR> {<CR>}<ESC>O"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.