News for hackers. Stuff that matters.
Re:Vim is touch-typing on steroids by ARandomerDude on Thursday January 12, 2023 @10:50PM (#34363728)
> And finally, whatever you think of Vim, it's not worth using unless you've read Practical Vim.

Uh, what? I find it absolutely painful to watch my coworkers click around in their IDEs. It takes them forever to get things done.

Of the handful of hard core Vim users in the office, I’m the least sophisticated. But I’m WAY faster than all the non-Vim users.

Re:Vim is touch-typing on steroids by jrockway on Thursday January 12, 2023 @11:17PM (#34363885)
I very much agree with this. It is very tedious to edit code without a "text editor". By the way, Vim and Emacs have all the fancy refactoring / formatting / navigation things that VS Code does; using the exact same implementation. You get a no-compromises best of both worlds, at the cost of a lot of front-loaded learning. (That is to say, I get why Intro to Python books don't suggest learning vim. One problem at a time. But someday, it will really help you with the mechanics of slinging code to have a featureful text editor around.)
Re:Vim is touch-typing on steroids by galangalalgol on Friday January 13, 2023 @12:05AM (#34364164)
Python without vscode and pylance is rough. And even then you need to keep up with the typehinting. Vim and python leaves me with all sorts of horrific runtime errors to debug.
Re:Vim is touch-typing on steroids by Aperocky on Friday January 13, 2023 @12:31AM (#34364305)
Write unit tests.

I write unit tests for my personal projects - it might sounds ridiculous but it is the reason why I can grow these projects beyond the initial 12 hours of interest. Since personal project tend to be on the smaller side I usually uses typescript or python but I've never found it an issue where pure vim usage becomes an issue at scale.

It also strongly enforces separation of concern in terms of file organization. I found using vim for development to be a positive feedback loop.

Re:Vim is touch-typing on steroids by galangalalgol on Friday January 13, 2023 @07:38AM (#34366900)
Insisnwrite unit tests, but they often passed for reasons other than the intended ones because of the dynamic typing. I kept adding tests every time I caught something runtime, but I was at an order of magnitude more tests than I would need with a strong and static types language. Pylance kept me from making thos mistakes in the first place.
Re:Vim is touch-typing on steroids by ilikehurdles on Friday January 13, 2023 @12:54AM (#34364413)
Vim has all the same language servers that vscode has, with all the same capabilities.

e: never mind, I see Microsoft closed sourced pylance and restricted it to their products. Typical. Of course there is still pyright along with a python language server, but I guess technically not pylance any more.

Re:Vim is touch-typing on steroids by seanw444 on Friday January 13, 2023 @10:28AM (#34369046)
I use Pyright with Doom Emacs at work, and I have no need for anything more. And I work on a relatively large Python codebase.
Re:Vim is touch-typing on steroids by calvinmorrison on Thursday January 12, 2023 @11:01PM (#34363793)
Every few years I trot out some vim command new to me and it falls to the wayside. I don't even use buffers right, I use tabs. Which are apparently a bastardized version but I digress.

F f g G jkl; ESC i r R yy p and control A and control E probably cover 90% of my cases.

However. I use a nub on my ThinkPad so I have sort of instant mouse access for location things, I mostly use jumping for inside a line

Re:Vim is touch-typing on steroids by doix on Thursday January 12, 2023 @11:09PM (#34363847)
Buffers and tabs serve different purposes. I think a lot of people dismiss tabs because they don't understand their purpose. It's not just about switching to different buffers quickly.

Tabs are an organized collection of windows, and you can quickly switch between them. I might organize my windows so half the screen is one buffer and on the other half, is split 3 times horizontally. Then I edit some code and realize I need to edit some other part of the codebase. I make a new tab instead of changing buffer, so I can go back to the view I setup already without having to recreate it.

Tabs are the true power of vim, I don't have that functionality in any other editor (apart from Emacs?) and I miss it constantly. Buffers aren't really a novel concept, they work the same in VS code and JetBrains IDEs.

Re:Vim is touch-typing on steroids by pxc on Thursday January 12, 2023 @11:20PM (#34363901)
> Tabs are the true power of vim, I don't have that functionality in any other editor (apart from Emacs?)

Yeah, Emacs also lets you do that! You can achieve similar workflows via tmux or a tiling window manager as well. It's my favorite way to work! For whatever reason I've never gone down the tiling WM rabbit hole, but I use this kind of thing in Emacs and tmux all the time.

Re:Vim is touch-typing on steroids by doix on Friday January 13, 2023 @12:14AM (#34364201)
So I do use a tiling window manager, but the problem is that to take advantage of it, I'd need the editor to put each buffer in its own (real xorg) window. I couldn't get something working with either vscode or IntelliJ.

One editor that does support it, is kakoune. I forgot about it when writing my previous comment. Each instance can connect to a server, so they can all share registers/buffers/etc. Then you can use tmux or your window manager to create the layout you want.

It's very clever, I actually think it's superior to vim, as you aren't limited to organizing your views inside a single vim "main" window. You could do stuff like kak | browser | kak, and both kak instances share everything.

Unfortunately I can't get used to the kak commands so I'll probably never change. Perhaps neovim will one day implement something similar.

Re:Vim is touch-typing on steroids by sodapopcan on Friday January 13, 2023 @12:00AM (#34364131)
Ya, "tabs" are a misnomer coming from almost any other editor which is unfortunate. Vim doesn't have what most people think of as "tabs" (I guess you could think of them as "dynamic" tabs but I digress).

Vim has been my only code editor for the past 10+ years and I wish I used tabs a little better (ie, the way you describe). As it stands I have some plugins that open in a tab so they are easy to close (like gv.vim) and otherwise use my tabline as a secondary status line (it tells me my working directory and if I'm tracking a session or not).

Re:Vim is touch-typing on steroids by Aperocky on Friday January 13, 2023 @12:34AM (#34364315)
airline and bufferline plugins are great - it helps unify/bridge buffer and tabs
Re:Vim is touch-typing on steroids by sodapopcan on Friday January 13, 2023 @09:51AM (#34368459)
I never liked airline as I felt it was too busy and I like customizing my own statusline, though you've piqued my interest with how they deal with tabs. I actually like vim's tabs just as they are--I mostly need better mapping for manipulating them. I'm otherwise a dual-split-with-a-mark-or-two person.
Re:Vim is touch-typing on steroids by deathanatos on Friday January 13, 2023 @01:26AM (#34364562)
Try :normal (:norm for short.) It can edit a set of lines given a certain set of vim commands. Sometimes simpler to reason with than regexes.

E.g., if you want to turn,

  * a
  * b
  * c
into,

  "a",
  "b",
  "c",
V, highlight the lines, :norm 2xi"^[A", — 2x to remove the star+space, i" to insert the quote — now we need to get out of insert mode, so that's tricky: Type ^V ESC there for verbatim ESC (I've rendered that in the command as vim will, ^[, but it will be colored to denote that it's a real ESC character) — then A", (append a quote and a comma).

You could do it with a regex, but I just find it far more natural to list the commands: my brain is already imaging it that way: remove the bullet, add the quotes and the comma.

Good for-loop for "do this to each line". Sometimes takes a bit of back & forth to construct the command, or sometimes it's just easier to do multiple :norm's. One of the best additions to my repertoire in years.

Re:Vim is touch-typing on steroids by voidhorse on Thursday January 12, 2023 @11:48PM (#34364069)
It's not so much the absence of vim as it is their apparent ignorance of the magic of hotkeys. Download a vim plugin for your IDE and you get modal editing (usually w/ vimrc binding support) too. imo that's the absolute best way to go. You get modal editing speed, modern UI, better autocomplete over a wider bank of languages, two key press project wide refactors, go to definition without needing ctags, a terminal in the ide so you can still run commands easily (typically better than vims term window does), git integration...the list goes on and on. And sure, you can download a huge set of vim plugins to get something close, but the ux will never feel as unified as it does in an ide and it takes extra work to maintain your rc+.vim...
Re:Vim is touch-typing on steroids by doix on Friday January 13, 2023 @12:29AM (#34364296)
> but the ux will never feel as unified as it does in an ide

I argue the opposite. Because vim is such a constrained environment, the UX is extremely unified.

An IDE with vim mode is the opposite. Vim mode usually only works in the text buffers and nowhere else (at least not properly). You need to memorize a combination of vim hotkeys and regular ide hotkeys OR spend a long time messing around with your IDE hotkeys (probably comparable to vim config).

In vim, since everything is a buffer and a window, you can use your regular navigation hotkeys to move between them. I just think "I want to shift my focus to the window on the left" and it doesn't matter if the window on the left is a text file or some plugin.

In something like IntelliJ, you can't "just go left". You need to know what the hotkey is for the panel on the left. The "non-modern" UI, which constrains vim actually makes a significantly more unified experience.

> terminal in the ide so you can still run commands easily (typically better than vims term window does)

This is a perfect example. How do you switch back and forth between your terminal and text file in an IDE? How do you copy paste between your terminal and text file? Can you use vim movement in your terminal that you opened in your IDE? Or your registers? In vim, that all works perfectly just like you'd expect without learning anything new, it just works like regular vim.

That being said, I still use IntelliJ if I'm writing Kotlin. The semantic analysis they can do is absolutely top notch, can't get something comparable in vim and the productivity gains out weigh my annoyance with the inconsistent UX. Something like python though? I'll probably stick with vim, jedi is good enough.

Re:Vim is touch-typing on steroids by Aperocky on Friday January 13, 2023 @12:24AM (#34364264)
Vim binding is great and I find it solves at least 90% of my usage.

It's the 5% of vim that's unavailable (i.e. norm, macros) and 5% of needing to still click the IDE UI occasionally that reminds me that it still isn't vim.

But then again, for some language families there just isn't a choice.