Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Breaks '.' #3

Closed
srushti opened this issue Jul 8, 2011 · 15 comments
Closed

Breaks '.' #3

srushti opened this issue Jul 8, 2011 · 15 comments

Comments

@srushti
Copy link

srushti commented Jul 8, 2011

I'm not sure if this is even fixable (and I've faced similar issues with other pairing plugins), but could it possibly be made to work with '.'.
Currently if I type ''i[Hello world]' and then hit '.' I only get the 'Hello World' and not the brackets. I understand they work as different actions, but unfortunately vim users are used to thinking of an insert action as a repeatable command.
This becomes even more tricky if you use this as part of a 'cw' (change word) type command, because it forgets the changing part of the action.

@jiangmiao
Copy link
Owner

Hello srushti,
i[hello world is be expand to i[]<LEFT>hello world, and the <LEFT> break the '.'
Currently I haven't a good solution. maybe you already know, you could use complex repeat(macro) qq to start recording a macro 'q', press q to stop recording then use @q to repeat the macro, and use @@ to repeat it again and again.

@srushti
Copy link
Author

srushti commented Jul 8, 2011

Yeah, I can use a macro, but I'd really rather not have to do that every time.
After trying out a bunch of different plugins which does what yours does (and each of them failing the '.' test in different ways) I came across AutoClose which seems to use a different approach, but also doesn't have any customisability.

@bartels
Copy link

bartels commented Feb 19, 2012

It might be worth looking into vim repeat to accomplish this.

@jiangmiao
Copy link
Owner

vim-repeat doesn't work for me,maybe I didn't configure vim-repeat write.
nmap . shows
n . * :<C-U>call <SNR>65_repeat(v:count)<CR>

@dsummersl
Copy link

I've been experiencing this problem fairly frequently lately - is this not fixed?

@ptrin
Copy link

ptrin commented Mar 6, 2015

@jiangmiao Is it necessary to use <LEFT>? Have you looked at getpos() and setpos() to move the cursor?

e.g.

function! MoveLeft()
    let l:curPos = getpos('.')
    call setpos('.',[curPos[0], curPos[1], curPos[2]-1, curPos[3]])
endfunction

@jiangmiao
Copy link
Owner

@ptrin I've tested code. But it cannot work. The function action won't be recorded. The code (foo) will be repeated as ()foo

@unphased
Copy link

unphased commented Apr 7, 2015

So for future reference, using Ctrl+V to circumvent auto-pairs does work...

As long as you are careful to not trigger auto-pairs by escaping each of these open parens/brackets with Ctrl+V they will land in the dot register properly.

@chrisbra
Copy link

chrisbra commented Dec 1, 2015

Note: Starting from version 7.4.849 you can use <C-G>Cursor to move within a line and not break undo/redo

@muffinmad
Copy link

@chrisbra <C-g>U<cursor> maybe?
@jiangmiao Take a look at :help i_CTRL-G_U please

@chrisbra
Copy link

chrisbra commented Feb 4, 2016

@muffinmad yes

@jiangmiao
Copy link
Owner

The issue should be fixed now.

@unphased
Copy link

Works great but only in nvim and not vim? Can anyone confirm?

@muffinmad
Copy link

@unphased Works fine in vim 7.4.1639. You need at least vim 7.4.849 i guess.

@ianwitherow
Copy link

It seems like new lines within a pair breaks repeating with '.'. Has anyone else experienced this?

For example:

function moo() {
    |  <- cursor
}

Pressing '.' after that only enters a blank line. Any ideas?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants