this post was submitted on 17 Jul 2024
82 points (97.7% liked)

Ask Experienced Devs

1232 readers
1 users here now

Icon base by Delapouite under CC BY 3.0 with modifications to add a gradient

founded 2 years ago
MODERATORS
 

I'd like actual examples instead of "I work faster", something like "I can move straight to the middle of the file with 7mv" or "I can keep 4 different text snippets in memory and paste each with a number+pt, like 2pt", things that you actually use somewhat frequently instead of what you can do, but probably only did once.

you are viewing a single comment's thread
view the rest of the comments
[โ€“] [email protected] 8 points 5 months ago* (last edited 5 months ago) (1 children)

I've been using vim as my daily driver for development for the last 8 years.

There are a million things I could talk about regarding vim's editing language, consistent interface, scriptability, performance (seriously, I've opened 1GB+ files and vim barely breaks a sweat), etc., but one thing I'll highlight that most people don't talk about is vim's ability to interface with other tools. It's what takes vim from a great editor into a full-fledged development environment. You can:

  • Read the stdout of any shell program into a vim buffer (:help read !)
  • Use the contents of a buffer as stdin to any shell program (:help write !)
  • Filter a portion of the buffer through any shell program, replacing the contents with that program's stdout (:help !)
  • Parse the output of a program or the contents of a file into a set of entries for quick navigation (:help quickfix, :help make)
  • Insert the output of a shell program into the current buffer (:help <C-R>=, specifically when used with the :help system() function)
  • Control arbitrary jobs with vimscript and communicate back and forth with code

And much more. I use all of these every day: the output of git commands give me filepaths I can jump to with gf; a range in vim selected with the v command gives me line numbers to pass to git log -L to see the history of a section of code; the current filepath of the vim buffer is pass to many different shell commands to do processing with that file; the symbol under the cursor is passed as an argument to the open command on macos to lookup external (company-specific) documentation in a Web browser. And many, many other things. Unix is my IDE, and vim is at the heart of it.

[โ€“] [email protected] 5 points 5 months ago

And here I am proud that I can open a file, save it, make edits, jump to the beginning/end, and quit it. ๐Ÿ˜