by darintay · 6y ago · 0 comments
Most anything that VSCode can do, you can make vim do with plugins, but it is often incredibly time consuming and finnicky to get up and running, whereas with VSCode everything "just works".
All the productivity of being able to edit text in vim, alongside the conveniences of a real, modern IDE.
I always loved vims movement and editing and hated it's file traversal / project management, so this is a perfect amalgamation
I have a hot key for opening the current file in an actual vim instance whenever I want to write multiline text or use visual block mode.
You can even use a custom ~/.ideavimrc and bind leader shortcuts to JetBrains actions. I rarely ever touch the mouse in IntelliJ now. It's an ultra-productive environment to have the power of IntelliJ, the convenience of vim, and Spacemacs/Doom Emacs style shortcuts.
For example, to manage projects:
nnoremap <leader>po :action ManageRecentProjects<CR>
nnoremap <leader>pc :action CloseProject<CR>
Or to create/switch git branches: nnoremap <leader>gb :action Git.Branches<CR>
Or to bring up the nav bar to change or create new files (Ctrl/Cmd + N once the nav bar is visible): nnoremap <leader>fn :action ShowNavBar<CR>
Or to summon git blame annotations in the current file (repeat to dismiss them): nnoremap <leader>ga :action Annotate<CR>
Or manipulate windows: " Window movement.
map <leader>wv :vsplit<CR>
map <leader>ws :split<CR>
map <leader>wd <C-W>c
map <leader>wx <C-W>c
map <leader>ww <C-W>w
map <leader>wl <C-W>l
map <leader>wh <C-W>h
map <leader>wk <C-W>k
map <leader>wj <C-W>j
map <leader>wo <C-W>o
Or summon “Refactor This” at the cursor point: nnoremap <leader>rt :action Refactorings.QuickListPopupAction<CR>
You can get a list of available actions for your current environment and plugins with the :actionlist command.I only started playing with this recently but my current config is here for those interested:
https://gist.github.com/nickcernis/bcb5cb7f55c07ed3de8287d16...
It takes a bit of searching and fiddling, but once you hide all the chrome (I even hide tabs at Editor → General → Editor Tabs → Tab Placement = None), install IdeaVim and configure shortcuts how you want them IntelliJ feels just as slick as a tricked-out Emacs/vim, but with better out-of-the-box code intelligence.
On Mac I also remap Ctrl+hjkl system-wide so that I can navigate IntelliJ popovers with vim-ish shortcuts. I use Karabiner for this with the “Vi Mode, left_control + hjkl. shift/option/command + arrow working” option on this page: https://ke-complex-modifications.pqrs.org/?q=%20PC-Style%20S...
I have a single config for all vim related things(vimrc) and source it for neovim as well, hence I was curious. For example,
has('nvim') checks for neovim.
Something like this for 'ideavim' would mean I can add IntelliJ related stuff inside that check.
https://stackoverflow.com/questions/34528322/how-to-include-...
There goes my afternoon...
VSCode is awesome, it provides a ton of benefits you don't get from emacs or vanilla vim. I'm really enjoying using it, and there's a chance that it will become my new "main" editor.
That said, the vim mode is not perfect. It only takes a few minutes of work before I run into a limitation of the vim mode, some binding or other that I use and that isn't replicated. More importantly, some things feel broken - there have been cases where undo didn't work properly for me, and cases where numerical arguments to commands messed things up.
That said, I've actually started taking the time to customize the vim mode in VSCode, and it's starting to pay off.
That being said, I haven't been able to make the switch myself yet, even though I sort of want to. The vibe is off.