There are always more cool tricks and great plugins out there, have fun!
Also I’d recommend Neovim, it’s exactly like vim except it supports Lua scripting, so there are lots of powerful plugins that aren’t available on vanilla vim.
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.
Hope you enjoy the instance!
Rules
Follow the wormhole through a path of communities !webdev@programming.dev
There are always more cool tricks and great plugins out there, have fun!
Also I’d recommend Neovim, it’s exactly like vim except it supports Lua scripting, so there are lots of powerful plugins that aren’t available on vanilla vim.
Ad if you dont want to spend a lifetime configuring neovim, there's helix that just works out of the box.
Can helix be fully controlled by keyboard? Does it have a 1-to-1 vim mode? Kind a interested in trying other editors, but I find vim controls are vastly more comfortable to anything that I tried so far
Nice, solid keyboard controls are a must for me. I'll try it out.
Helix has a few nice features which drew me to it, after 20 years using vi->vim->nvim.
dw), and sometimes it's [context, operation] (eg 100j). In Helix, it's always [context, operation], so its wd.Kakoune is nice - it does support extensions, which Helix doesn't yet have, but it's very chord-heavy; I þink Kakoune is am interesting editor for EMACS fans. Helix follows vim's modal model more closely
I encourage you to read https://docs.helix-editor.com/from-vim.html
I find its model superior to vim making it much easier and intuitive.
I’ll have to try neovim, and eMacs and all the derivatives. Honestly I just went straight to vim first because I wanted to try to OG experience first to see what it was like. I’ve also simultaneously been using vim mode in Zed which has been pretty nice too.
I like to say that using Vim turns editing into an optimisation puzzle. That will either sound super fun to you in which case you'll probably love it or it will sound like a nightmare in which case maybe it's not for you.
I looove solving the optimization puzzles instead of actually doing my job :D
"Yes boss, I am working on that feature. Right now I am installing a new plugin that will save me 5 seconds and 14 keypresses!"
The bad part is when you learn vim bindings you want to throw up when you use any other editor.
I've always liked vim but one thing that I really loved about it was when I started using vim mode in zsh.
Being able to just navigate through commands in my terminal and easily highlight and edit and all that ... it's so good.
when I started using vim mode in zsh.
I'm an emacs user myself, but if you're not aware, readline
which handles a considerable portion of the "prompt for text" stuff in many terminal programs, like input for bash and such
can be put into vi mode.
https://tiswww.case.edu/php/chet/readline/rluserman.html#Readline-vi-Mode
In order to switch interactively between emacs and vi editing modes, use the command M-C-j (bound to emacs-editing-mode when in vi mode and to vi-editing-mode in emacs mode). The Readline default is emacs mode.
When you enter a line in vi mode, you are already placed in ‘insertion’ mode, as if you had typed an ‘i’. Pressing ESC switches you into ‘command’ mode, where you can edit the text of the line with the standard vi movement keys, move to previous history lines with ‘k’ and subsequent lines with ‘j’, and so forth.
Or, in ~/.inputrc:
set editing-mode vi
To set the default.
HOLY CRAP
Let's say I run a command that spews output. Are you saying that with Zsh I can use only the keyboard to navigate the spew, copy a bit of it, and paste it in a new command?
If so I should try it out!
Modal editors in general are awesome. Currently using Helix as my goto editor
I was just going to say this. The modal part is the important part. Helix seems great, but I was unable to find a killer feature to draw me away.
For me, the killer feature is the consistent selection->action grammar followed by the discoverability features. Being able to see what I am doing before I do it works much better for me and having those little pop ups for the space and g menus mean that I learned the bindings so much faster and use more of them that I ever did for either emacs or vim.
The thing about Vim is once you get the navigation down you'll want it for everything and you'll refuse to go back to anything else.
I used Vim for so long that I can't live without some form of vim style navigation. my Window Manager uses it, my web browser uses it, all my TUIs use it, hell I even switched to Emacs and installed Doom Emacs and THAT uses it. Now I only ever use a mouse for gaming because you realize that navigating around your PC purely with your keyboard is actually faster than using a mouse. I've disabled the touchpad completely on both my laptops.
If you're digging Vim check out NeoVim with LazyVim. makes plugins and theming and what have you easier. I use it as my backup to DOOM Emacs.
So I keep trying vim and now neovim, I kind of like it as a good allrounder for one off syntax highlighted editing. It's just that for me, quick and simple editor.
For a true IDE I need proper symbol navigation. What I have in my JetBrains setup: ctrl+click - go to definition, ctrl+shift+click - search for references, alt+ctrl+click - go to implementation, alt+ctrl+shift+click go to declaration (specific to going to an interface). Then there's symbol renaming and good multi carret / selection support with keyboard and mouse bindings (alt+up/down arrows, alt+single/double/tripple click). Also, multicarret copy pasting is a major feature.
Let's not forget about live static analysis and autocomplete with support for fuzzy search and documentation.
I don't even know where to start to make vim or neovim do all that. If it can't do that seamlessly and just as well, vimlike editors will never be a replacement for a proper IDE. It's fast, capable single file and small scope editor for me.
I do also like all the alt and ctrl combinations with arrow keys to move lines, blocks and jump over words.
gd to j(g)ump to definition.
Just to say that those features exist in nvim.
I always thought it was (g)o to (d)efinition.
Give Helix a try. It comes with everything you are asking for built in, plus discovery for the commands, plus a selection first approach so you can see what you’re doing.
I do also like all the alt and ctrl combinations with arrow keys to move lines, blocks and jump over words.
That's what I love the most about VIM, that it has dozen little tricks like these. Need to jump over a word? Jump to next occurance of letter L? Jump five words? Jump to second parameter of a function definition? Jump to matching bracket? There's a motion for all of that, and more. Including "go to definition" or "go to references", if you set up your vim correctly.
I don’t even know where to start to make vim or neovim do all that.
What I did was simply install IdeaVIM into my Rider, so I can start learning the motions while also keep the features of the IDE I'm used to, but also more importantly installed LazyVim, which is a pre-made config for nvim that can do most of that by default, or has a simple addon menu (LazyExtras) that automatically download and install plugins relevant for a language you are working on. I.e I need to work in Zig, I just open LazyExtras menu, find zig-lang, and it install LSP, debugger, linter, etc that's specific for that language.
I don’t even know where to start to make vim or neovim do all that. If it can’t do that seamlessly and just as well, vimlike editors will never be a replacement for a proper IDE. It’s fast, capable single file and small scope editor for me.
If you're interested in learning how to do it, I found this guide extremely helpful for getting started. it's in both blog and video format, and it shows how to install Lazy (a package manager for vim), and which plugins to install to get LSP working (which is what would provide all the hotkeys that you were mentioning above).
It's definitely not a task for the faint of heart, but I found it very rewarding once I figured out how to work with the plugin systems because it's so powerful and easy to customize. I found it helpful to just watch the video a few times to see everything working, then slowly started building up my own configuration (which was a bit more minimal than the linked guide I provided - I only installed about 30-40% of the plugins he listed on that page).
Another alternative is Lazyvim, which provides an out-of-the-box configuration experience for you. It installs a lot of plugins and most things should work out of the box with very little configuration. It is a massive beast though, but still pretty good for a first start.
I completely agree. Also almost all of the fancy editing you can do with Vim can be done just with multiple cursors, and it's less annoying because you do it incrementally (rather than typing a long sequence of commands and then seeing the result), and you much less to memorise.
I know! The other day I just figured out what :q does, never felt so powerful.
wait until you try emacs
I went from vim to Emacs and loved it, right up until I found Helix. My “just trying it out” became “never opened emacs again”.
Tried emacs after vim and it made my pinkies hurt. If only it was exactly as vim...
Check out evil to use vim keybindings within emacs. If you want a battery-included experience, try Doom Emacs where enabling evil is a breeze.
Yeah. It was frustrating to use vim. Emacs on the other hand was so much fun. The amount of things you could tweak and change. I haven't seen another software which can do this today.
It really is unique.
On a related note, try Vimium (FF / chrome extension) that brings vim motions into your browser. You will have a more complete experience.
Vim is great for editing in general and coding simple things but I kind of gave up on using it as an IDE. Too many plugins to configure, to many breaking changes, too many bugs. My current issue is that after couple hours or days code formatting simply breaks and starts mangling my code. Only full restart fixes the problem. It's impossible to figure out were the issue is as there are so many plugins and external tools involved. I still think it's amazing you can setup vim to work as a full IDE with code completion, refactoring, formatting and all but it's just not stable enough. I reluctantly switched to Zed with vim mode. I miss smooth scrolling but other then that it's really nice.
Welcome to the club. Don't worry too much about setting it up perfectly in your first attempt. You're gonna rewrite your whole config every year-ish anyway. (Or is that just me? 😥) Also, try Neovim. It'll be a drop-in replacement for your current config. But Lua is just a superior language compared to Vimscript, so you'll have a much better performance in the future. You also get all the sweet LSP and treesitter features.
You probably already know this, but most IDEs have a setting to enable Vim keybinds or you can easily install an extension to add them.
I really like Neovim but my job often requires some stuff that it doesn’t easily do. So, VSCode is what I use a lot of the time… with the Vim extension.
Just something to consider if your stack isn’t super well supported in Vim/Neovim or you need tools it doesn’t have for your work.
I tried vim keybinds in an IDE, and it sucked.
It wasn't even that advanced usage, but it just didn't work.
Instead I know run language servers in neovim.
What part didn't work? I use that all the time in IntelliJ and Visual Studio Code.
Most of vim is not emulated. It's very surface-level and limited. The closest is evil mode for emacs, which is decent, but still lacks a fair bit. The emulators in Intellij and VsCode are paltry in comparison to what vim can do.
I agree with you. I figure you probably know this, but VS Code can act as a frontend for Neovim, providing one-to-one Neovim keybindings.
Some parts I never got working, but movement was honestly flawless. But I use a lot of snippets with ultisnips, and I didn't like the idea of translating all of that to hypersnips (or whatever the VS Code equivalent was called), so I stuck with Neovim.
Awesome! There's a tooon of stuff to learn, but Vim is eternal, so it'll be a good investment.