this post was submitted on 30 Jan 2024
1923 points (99.2% liked)
Programmer Humor
32595 readers
1855 users here now
Post funny things about programming here! (Or just rant about your favourite programming language.)
Rules:
- Posts must be relevant to programming, programmers, or computer science.
- No NSFW content.
- Jokes must be in good taste. No hate speech, bigotry, etc.
founded 5 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
vi?
vim, or better yet, neovim
come to the 21st century, we have lua
and plugins, and syntax highlighting, and multi buffer/multi window support, and LSP support so you can Go to Definition like in an IDE, and wAY more normal mode commands than anyone could ever hope to memorize. also when you do
cw
it deletes the word immediately instead of putting a dollar sign at the end before purring you in insert mode, and regex substitutions highlights text in the buffer as you type so you can see what you're about to replace. it's really quite cool. if you're new to programming and/or feel like committing heresy you can even skin it to look and work like VS Code. people like to joke that we're slowly but surely becoming emacs and they're not entirely wrong.but the important thing is the lua.
Used vim since the mid 90’s, but switched to emacs at some point. It was wonderful for many years, but neovim has come so far that I switched back a few years ago. Could not be happier. The tools available for programmers these days are superb and neovim chief among them.
It's probably because of Lua that the plugin ecosystem exploded in the recent years.
I'm glad I adopted neovim early.
I mean, most of those things can be done in regular vim too. I'm probably going to switch eventually, but I haven't really had any issues with vim that would motivate me to switch, and I haven't really encountered anything super useful that nvim has that vim can't also do. Though, I'll admit lua is tempting, and better defaults are certainly a plus!
For search highlighting, the relevant options are
:set hlsearch
and:set incsearch
. nvim just has those enabled by default. nvim also has a binding Ctrl+L to clear the search highlight. This isn't in vim by default, but the vim-sensible plugin also adds it.What do you mean by
cw
putting a dollar sign? I don't think I've ever encountered that.Edit: the vim syntax for Ctrl+L got eaten by markdown.
Vim and Neovim are pretty similar at this point honestly apart from the Lua and LSP integration (seriously, that feature is cool). The only difference I've really noticed is that in Neovim, when you
:term
, it opens the terminal in the active pane, putting the buffer you were working on in background. In Vim, it splits the screen and puts the terminal there. Vim also prompts you to confirm a:e
if you haven't saved the current buffer, even though it doesn't close it, just puts it in the background (iirc?)In the original vi, when you
cw
it doesn't delete the word right away, only changing the last character of it to a $ so you can see where it ends, to save screen refresh. (This was actually a concern on the 1970s modems on which vi was developed.) When you type, it looks like you're overtyping the word, but when you go back to normal mode it redraws the line and shows the rest of the line shifted over appropriately, so you replaced the whole word. Vim and Neovim redraw the line with every keystroke, which is not a problem even on today's shoddiest internet connections, and is much more intuitive. vi only starts to do that once the word you're typing becomes longer than the word it's replacing.Is the LSP support in nvim better than what you can get with plugins? I'm using coc.nvim with vim and yeah it is really cool.
I didn't know about that
:term
difference. I think I prefer vim's behavior there.If you have
:set hidden
, then the current buffer will be hidden when you open a different file, and you won't be prompted. Without it, vim doesn't allow hidden buffers and will discard the buffer when you open a different file (which is why it prompts you). Vim's defaults are very odd sometimes.Huh, that
cw
behavior in vi does seem pretty jarring. Interesting, though. It makes sense why it was like that.rimusic