jiangmiao / auto-pairs

Vim plugin, insert or delete brackets, parens, quotes in pair
http://www.vim.org/scripts/script.php?script_id=3599
4.12k stars 374 forks source link

Issue typing closing paren #177

Open dderg opened 7 years ago

dderg commented 7 years ago

i have code:

import request from '../request';

export const setTags = () => ({

}|

export const loadTags = () => {
    return async (dispatch) => {
        let result = await request('/tags');
        console.log(result);
    };
};

when i type ) i get:

import request from '../request';

export const setTags = () => ({

}

export const loadTags = ()| => {
    return async (dispatch) => {
        let result = await request('/tags');
        console.log(result);
    };
};
woat commented 7 years ago

Closes fine for me.

dderg commented 7 years ago

strange...

woat commented 7 years ago

Maybe you have another plugin that's causing that?

dderg commented 7 years ago

I've changed auto-pairs to https://github.com/Raimondi/delimitMate and issue is gone

Terr commented 7 years ago

I'm having similar issues. prog666's example is working correctly for me too but I have had it happen with JavaScript, Python and PHP.

I haven't found a consistent pattern of when it happens, but I did manage to reproduce it with this simple example: https://asciinema.org/a/xrwwV1CkuHPn7PWhyE3T3hgij

I'm using vim 7.4 on this machine but I also have the issue with vim 8

PezCoder commented 7 years ago

I've faced this countless times, this is how you can reproduce:

function() {
    const x = {
};

Copy paste this code & go back to normal mode go back to insert mode & try to close the bracket after x = { It'll go to the next closing bracket rather than putting a new closing bracket.

PezCoder commented 7 years ago

@prog666 delimitMate handles it really well, but it has bugs of itself (UI bug that i faced). I would rather prefer it to get fixed in this library as everything seems to work really for me with it. But maybe we can use delimitMate as an inspiration to fix it

sunnypp commented 6 years ago

Any updates on this? I was going to raise a new issue -- however I've found this thread.

Is it appropriate to describe the issue as "Flying to closing bracket when typing the closing bracket with the caret inside an unclosed bracket"?

jordansoltman commented 6 years ago

This is incredibly annoying, but it looks like they found a solution in another thread: https://github.com/jiangmiao/auto-pairs/issues/104

Add these lines to your vimrc:

let g:AutoPairsMultilineClose = 0
let g:AutoPairsFlyMode = 0

It's fixed the problem for me :)