DEV Community 👩‍💻👨‍💻

Discussion on: Navigate your vscode like it's 1999 (the vim way)

danielcodex profile image
Daniel Codex

thanks for the answer.
actually you can delete the word in insert mode with ctrl+w, but when I use your setting I couldn't (because when you press ctrl+w vscode is waiting for the next word/command). so I change that to alt+u for now.
and just another question which I don't get about vim, when we split the window horizontal/vertical, why in vim (or vscodevim I don't know) it split the file we are in it.
here is the picture:
shouldn't it actually split another file in the right??
for example, shouldn't be like ctrl+w v {filename}??

(and sorry for my English and my lack of knowledge in vim in general)

Thread Thread
karlredman profile image
Karl N. Redman Author • Edited on

Daniel, I completely glossed over that you were talking about insert mode and not normal mode. Sorry about that and I'm glad you found a solution that works for you.

Nonetheless, in Vim proper the way to delete the word under the cursor while in insert mode would be (ctrl+o)dw. I have not found a solution to do insert mode operations in VsCode.

I should also mention that I almost never do any commands in insert mode -not even in Vim. Also, and this might be useful(?), I never use the Esc key to toggle back to normal mode -I have Alt+[hjkl] mapped for that (i.e. hitting Alt+k while in insert mode puts me back in normal mode). This way I don't move my hands around as much :D

As far as the split goes, yes, (ctrl+w)v is emulating normal Vim behavior. However, if you want to create a new split with a new file in both Vim and VsCode you can use the command :vnew. So you may want to replace the normal vsplit command with vnew instead.

Also note: vsplit is really for editing/reviewing long files in different places at the same time. In VsCode splits have a different context because a split also opens a new tab within a "view". Vim's concept of window vs. tab vs. view is not a 1:1 match with VsCode.

Thread Thread
danielcodex profile image
Daniel Codex

thanks for the answer.
actually what I want to open an existing file, vertically.
so around that, I usually, used ctrl+w v to open a file vertically, and when I open file with ctrl+p (go to file... which is for vscode), and when i open the file, i will close the previous file.
just watch this:
as you can see, the only thing i wanted in that video is to open all the flag.txt vertically.