Skip to content

Breaks '.' #3

srushti opened this Issue Jul 8, 2011 · 14 comments

8 participants

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.


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 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 commented Feb 19, 2012

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


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>

@jiangmiao jiangmiao closed this Sep 2, 2012
@nilbus nilbus referenced this issue in tpope/vim-repeat Feb 8, 2014

Repeating imap commands #21


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

ptrin commented Mar 6, 2015

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


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

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


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

@jiangmiao jiangmiao added a commit that referenced this issue Mar 27, 2016
@jiangmiao Fixes #3, breaks '.'. 0c30ba8

The issue should be fixed now.


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


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

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.