Vim
Vim copied to clipboard
Using the repeat command (`.`) after inserting a tab does nothing
Is this a BUG REPORT or FEATURE REQUEST? (choose one): BUG REPORT
What happened: after inserting a tab, the . key cannot be used to repeat the last command (but repeat works for any other character, it seems to be only tab which does not work)
What did you expect to happen: I expected the . to insert a tab for me
How to reproduce it (as minimally and precisely as possible): position to start of a line of text i [tab] [ESC] position to start of next line . (to repeat last command) nothing happens.
Environment:
- Extension Name: vim
- Extension Version: 0.10.13
- OS Version: Linux x64 4.4.0-38-generic
- VSCode version: 1.19.1
Probably related, number prefixes don't work with tab - 5i<Tab><Esc>
inserts one tab, not five.
So interestingly, it's only if <tab>
is the only type of action performed. iabc<tab><esc>.
works as expected.
Yep, just the tab on its own. So you can't repeat inserting a tab on its own. Any other character in there and it works just fine. Also, from the comment above by @parkovski, using a number prefix inserts only one tab as he says, but if you then use the repeat command (.) no tab is inserted but the cursor marches backwards one character
For me, .
is just altogether broken right now. Do anything in insert mode, switch to normal mode with Esc
, hit .
, and nothing happens.
@rnewman That's a separate bug, one that I can't replicate at least. Could you open up a new issue, and post any errors you might have in your dev console? (Help > Toggle Developer Tools)
This behaviour seems consistent with vanilla VIM. In VIM, if I go i<tab><esc>.
, it doesn't re-insert <tab>
.
However, I can repro the case where 5i<Tab><Esc>
is indeed not supported on this extension.
Thats interesting.
I have been using vi and vim for the last 30 years on a variety of unix platforms and it has always worked for me.
I have just tried it now on Ubuntu 16.04 LTS (vim 7.4.1689), Debian 8 (Jessie) (vim 7.4.576) and Mac OS 10.11.6 (vim 7.3) and re-insert of tab works on all of them.
So what version of vanilla vim are you using and on which platform ?
It's something to do with indent handling. Trailing tab indents are not repeated.
Vim 8.0.1420, Mac, launched with vim --clean -v
:
-
i<Space><Space><Esc>.
inserts four spaces. -
i<Tab><Esc>.
does not insert two tabs; only one remains. -
i<Tab>a<Esc>.
inserts two tabs:\t\taa
. -
ia<Tab><Esc>.
insertsaa\t
(note a single trailing tab — the first one inserted).
It is because we do not handle
https://github.com/VSCodeVim/Vim/blob/5fe14b435ba7879d7c2fdd00d69a11a5c0a553e4/src/actions/commands/insert.ts#L218
So we never capture it as a documentChangeEvent, hmm
Can we just enable that handling? In vim, if you use tab to autocomplete or whatever, the "repeat" command respects the insertion as it should. In fact, overriding this to do anything else breaks the semantics of the dot command altogether (which really should just repeat whatever you just did).
edit: It occurs to me that a setting to enable the behavior would work too.
i've noticed that
itypesomestuff<esc>...
goes to insert mode, types 'typesomestuff' and repeats as expected
however...
itypesomestuff<esc><esc>...
does not repeat.
it seems that . repeats the esc and i believe it should not. in neovim, for example, it does not.
ahhh... looks like i remapped escape to also run :nohl
. maybe this is happening for others? everyone check your mappings?
I'm also having this issue, it's been open since 2018? Any way to get this fixed?
I am seeing this problem as well. Really makes it difficult to tab indent a large block of existing code.