Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Personally, my problem with trying to use Vim keybindings in VS Code is not about the motions of moving around/editing the code itself, but everything else. You end up in plenty of situations where you have to resolve using the mouse because you ended up on some sub-page or whatever, where you either need to resolve using the mouse or keep pressing Tab until you get to where you want to go.

Installing plugins is one good example of this, where even if you use a Vim plugin (or this, it seems), you still need to resolve to using the mouse/Tabbing to actually install the plugin itself.

While with Neo/Vim itself, you never need to reach for the mouse, because the entire thing, not just the editing/writing, is meant to facilitate keyboard-only usage.



I do now have memorized some mix of vim and vscode keybindings, but to me it's worth it. I'm not at 100% keyboard navigation because in some cases I've burned 5-10 minutes looking up a shortcut, repeatedly 1/mo for 3 months. After so many (overly) spaced repetitions, I recognize the shortcut isn't worth memorizing.

> Installing plugins is one good example of this, where even if you use a Vim plugin (or this, it seems), you still need to resolve to using the mouse/Tabbing to actually install the plugin itself.

I agree with you here, but I rarely need to install new plugins. It's certainly not a task I repeat for a given plugin. Plugins are actually the reason I do primary development in VSCode instead of Neovim natively. I can set up linters, language highlighters, etc in VSCode much faster than I can in Neovim. The ecosystem in VSCode also seems to be bigger for what I've done in the last few years.

---

Anyways, here are some VS Code keybindings I've found essential to go hand-in-hand with vscode-neovim. These few probably get me to 90% keyboard navigation for day-to-day editing.

cmd-shift-m: toggle the bottom tray problems (works as a universal way to show/hide the bottom)

cmd-b: toggle the left sidebar (in whatever context it was last in)

cmd-shift-e: show the current file in the left sidebar

cmd-0: move context/focus to the left sidebar cmd-1: move context/focus to the editor cmd-2: move context/focus to the right editor (or open an editor split, if not yet split)

ctrl-1,...9: highlight Nth tab from the left ctrl-0: highlight rightmost tab

cmd-p: fuzzy find file cmd-shift-p: fuzzy find any installed action by description


Thank you for posting these!


My pleasure! This plugin is hands down my favorite VSCode plugin. I worked mostly in vim before, and this plugin made me comfortable doing project work in VSCode.

I'll keep an eye on this thread for a day or two and try to add more essential hotkeys if I think of them.


All that `cmd`ing makes me feel like I'm in Emacs ;). I wonder if there's a way to bind those actions to vim-like keybindings.


cmd-p is an absolute must if you use this plugin. Thanks for sharing!


I’ll add onto this, cmd-shift-p is the reason to use VS Code over neovim/vim.

For every plug-in I’ve installed in vim, I used about 5% of their behavior. I’ve spent time looking through plug-in utilities and thought “oh that’s useful” and then forgotten about them by the next day. I’m aware that in vim, I can type :substring<tab> and get a list of commands. As far as I recall, I only get name matches. VSCode’s action search massively improves the user experience of this, allowing me to scan descriptions of plug-in commands.


Personally I use Telescope, which has a commands menu you can use to fuzzy find through all known commands similar to shift-p. That being said, I've removed almost all of my neovim plugins. stock vim/neovim is surprisingly capable


I guess I am the target market. I don't mind using the mouse when I'm not in the "flow" of editing. Even browsing code, scroll wheels are pretty expressive, and clicking to jump to definition is fine. Ok not typing, so I don't need to keep my hand on the home row.

But the actual editing doesn't use the mouse.


If you have the proper jump to definition set up, vscode-neovim actually has a keybinding (that matches vim/neovim)

gd (go to definition)

You'll also like

gh (peek definition)


>Installing plugins is one good example of this, where even if you use a Vim plugin (or this, it seems), you still need to resolve to using the mouse/Tabbing to actually install the plugin itself.

Sounds like a minor annoyance at best... Where vim-mode is important to me is editing and navigating code, not when installing plugins...


It's not just installing plugins. It's the VCS view, the symbol list, the terminal, the file browser, the search pane, the debugger pane, any pane added by any extension, etc.


> the terminal

Ctrl+`


As I said, it's one example. Anything outside the code window suffers from the same problem, not just installing plugins...


I didn’t expect to disagree with you at first because I also struggle with vim -Code plug-ins, but it really never occurred to me that it would cover the entire functionality of Vim outside the editor and file navigation.


Ctrl+shift+p puts the cursor in the command search where you can find all the commands including extension related commands. Ctrl+w j puts the cursor in the terminal.

VS code is entirely navigable with key strokes even with Vim emulator


As mentioned, extensions is one example. How do you resize the sidebar? Or resizing the vertical size of the "Outline" pane?

To be honest, guess it was a long time ago I last used VS Code, but when I did, I ended up in situations where it wasn't suitable to use the keyboard too many times.


It's worth pointing out that while Vim/Neovim can be fully used without a mouse you can still use one if you want to.

That includes mouse wheel, clicking tabs, resizing windows, balloon help amongst others.

That works over SSH too.


VspaceCode might help you and others: https://vspacecode.github.io/.

It allows you to execute arbitrary VScode commands in fewer keystrokes using Emacs like menu (never used Emacs myself, so might be off a little). Along with default <space> key, I've also mapped ctrl+g as a global binding to trigger VspaceCode. So almost anywhere in the UI, I can always use keyboard to navigate.

EDIT: formatting


>>While with Neo/Vim itself, you never need to reach for the mouse, because the entire thing, not just the editing/writing, is meant to facilitate keyboard-only usage.

Exactly, most python plugins like black, code formatters, auto complete etc don't even work with these plugins.


That is the reason why I moved from eMacs to neovim. Emacs on itself is amazing piece of software, but I had to fight my way to setup vim binding on everything.

With neovim you just get that by default. Everything is thought around that.


In what scenarios were you reaching for your mouse within emacs?


Seems like they meant using vim bindings everywhere requires much work to configure.


perhaps onivim would be a good VSCode alternative for you, I think they have a mode like the browser vim extensions that labels everything on screen with a key you can press instead of clicking.

https://onivim.io/


Onivim development has stopped, it is now abandonware: https://github.com/onivim/oni2/issues/3811#issuecomment-9103...


Woah, that really sucks. I checked their website some time ago and though they still had momentum.. :( Hope that rewrite people are talking about in the issue replies does happen at some point.


SpaceVim is also a fine contender with its LSP support: https://spacevim.org/


Onivim is no longer being developed :(


If only there was some sane oob setup for neovim with decent file exploring, and debugging.



Not sure if you know, but you can install plugins from terminal.


Exactly this!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: