Vim: `emmet.triggerExpansionOnTab` enters visual mode
Describe the bug
When emmet.triggerExpansionOnTab
is triggered via TAB
, the editor enters visual mode.
To Reproduce
- Open a new
.html
file. - In insert mode, type
div
. - Press
Tab
. - The editor enters visual mode.
Expected behavior
The editor should remain in insert mode.
Screenshots
Environment (please complete the following information):
- Extension (VsCodeVim) version: 1.18.5
- VSCode version: 1.52.0
- OS: macOS Catalina
Additional context
Related to: https://github.com/VSCodeVim/Vim/issues/5474
The PR referenced in the issue above did not fix the issue.
About this issue
- Original URL
- State: open
- Created 4 years ago
- Reactions: 35
- Comments: 28 (4 by maintainers)
This is still an issue in 1.21.1 in case anyone was wondering. Thanks for your work! ❤️
any progress now ?
It might be worth a try, but I have the following Emmet settings right now and I can use the abbreviations without getting shoved into visual mode. I had the same problem as everyone else until I added the
emmet.includeLanguages
setting.How to fix it
@berknam i’ve found, the error does not apply to emmet
This commit causes the problem https://github.com/VSCodeVim/Vim/commit/35d06e6780fbde4624081e47ddfc95cd60a1451d (Jul 25)
https://user-images.githubusercontent.com/10743009/105640384-c9445e00-5e8e-11eb-9d1f-1a4ff327bff7.mov
1 commit before: https://github.com/VSCodeVim/Vim/commit/94b3c684ec708c3d553bb5e0f2478341df4b743d (Jul 24):
https://user-images.githubusercontent.com/10743009/105640382-c5184080-5e8e-11eb-9352-c6669be3bf8d.mov
https://github.com/VSCodeVim/Vim/blob/35d06e6780fbde4624081e47ddfc95cd60a1451d/src/mode/modeHandler.ts#L213 this line to be specific
I had faced the same issue (with
erb
files). After doing some research to configure VSCode for Rails, I’ve fixed this issue by doing:"erb": "html"
to theemmet.includeLanguages
array setting.Here’s my full settings file in case you wanna replicate it:
And the extensions I have installed:
* Most of them are not related to the issue, but may be worth mention it.
Perhaps this just needs to be reassigned? @berknam seems to not be very active anymore. Considering that we’ve identified the commit that caused this issue in this comment, perhaps the fix is straightforward? As far as I can tell this is still an issue in the latest version of the extension.
@J-Fields any chance this could get re-prioritized? The label seems to suggest that this is an upstream issue, but it seems doubtful if there are version of the Vim extension that work and ones that do not.
Any update?
@rehack Cool!, I install another version(1.16.0) and The problem is gone like magic.
This is How to switch to another version
@devstefancho I switched to amVim, but you can fork and comment this line https://github.com/VSCodeVim/Vim/blob/35d06e6780fbde4624081e47ddfc95cd60a1451d/src/mode/modeHandler.ts#L181
@berknam
I personally can reproduce it on both Insiders and non-Insiders version. And am sure that the expansion occurs via
editor.emmet.action.expandAbbreviation
Btw, per https://github.com/VSCodeVim/Vim/issues/5495, I downgraded to 1.6 and the issue no longer persist.
So I suspect there should be a commit between 1.6 and 1.7 that causes this.
https://github.com/VSCodeVim/Vim/compare/v1.16.0...v1.17.0
This issue is still relevant. I modified a bit @mrwest808 solution to be able to handle more scenarios with a simple repeated keystroke:
It will map the <kbd>C-m</kbd> key combination (<kbd>C-m</kbd> is more ergonomic for me) in both insert mode and in normal mode:
emmet
and exits to vim normal mode.You just have to press <kbd>C-m</kbd> twice, and you are golden 👯
I cannot found a solution to do it with one mapping as
vscodevim
doesn’t support the:normal
command yet, and I don’t want to bother with integrating the externalnvim
toVSCode
yet.With this double mapping you can have more complex
emmet
expansions:I’m experimenting with this issue right now (locally in my settings), and I’ve noticed that this abomination of a custom keybinding actually seems to produce the desired effect.
I simply tried recreating the steps I usually do manually to counteract this issue (
<Esc>
to exit visual mode followed byc i t
to enter input mode inside of the newly created tag).Can confirm this is still an issue in Vim (
v1.22.2
):As mentioned in the comment above, I had the same settings but was not able to get it to work.
No I don’t.
The only settings enabled are
I’ve disabled all extension and only enabled the vim extension and those settings. Note that the editor enters visual mode when
Tab
is pressed.Side Note
I noticed another thing, if you enable
emmet.showExpandedAbbreviation
, then pressingTab
works as expected for known HTML elements, but unknown element element, where the suggestion is not shown, then vim enters visual mode.