this post was submitted on 01 Jul 2023
52 points (100.0% liked)

Programming

13380 readers
1 users here now

All things programming and coding related. Subcommunity of Technology.


This community's icon was made by Aaron Schneider, under the CC-BY-NC-SA 4.0 license.

founded 1 year ago
MODERATORS
 

Im considering spending some serious time learning one of the above. Two principle engineers I work with exclusively use them, and watching them work is incredible, the speed they move and get things done is pure wizadry. Can anyone learn this skill? For what it's worth, the alternative is learning VScode. I’ve exclusive used Android Studio in my career.

top 50 comments
sorted by: hot top controversial new old
[–] Penguincoder 27 points 1 year ago (6 children)

Definitely. vim is hard to get used to, but after you do, it's damn powerful especially with plugins. Always nice to be able to do typing and coding entirely on the keyboard and not needing to move your hands to the mouse for something. Also, if you do any Linux cli stuff, you almost always have access to vi at LEAST. So being familiar with the tool she the gui and something like nano isn't available, is invaluable.

:wq

[–] arandomthought@vlemmy.net 4 points 1 year ago

I see what you did there. 😅

[–] rostriano@vlemmy.net 3 points 1 year ago

To add to that: start with vimtutor. It teaches you vim from within vim itself which is a really nice way to learn the basics.

[–] burrp@burrp.xyz 3 points 1 year ago

:%s/she/set/g

[–] haakon@lemmy.fmhy.ml 2 points 1 year ago

Thanks, I think everyone unanimously agrees on this! Learning curve seems very steep but I’ll make it my daily driver for a few weeks

[–] Haus@kbin.social 2 points 1 year ago

There are so many editors with Vi emulation that it's still very useful. When I actually used emacs all day every day, it was slightly superior to vi at the cost of a little overhead, and slight differences in different installations. But I think vi won the war by being universal Shift-A, Shift-I, Y, P, cw, c$, /foo... so much useful goodness baked into any emulator.

load more comments (1 replies)
[–] zauberin 13 points 1 year ago (2 children)

Learn vim and use it in vscode, kinda gives you the best of both worlds

[–] variouslegumes@reddthat.com 4 points 1 year ago* (last edited 1 year ago)

Vim still has some stuff going for it that isn't (at least built into) vscode.

  • The vscode vim plugin is still very slow compared to vim (running a global normal command on a few lines makes it chug iirc. Not to mention macros are pretty slow comparatively)
  • The vscode tab behavior is frustrating to use coming from vim. Why are tabs specific to each split? How do I switch between buffers with just the keyboard?
  • Vim has built in utilities to process the contents of a buffer through any program on your path. Think formatting a buffer with jq.
  • some Vim plugins are just really good. Fugitive for git for example.

Is any of this worth learning vim for? I don't know 🙂

[–] arandomthought@vlemmy.net 3 points 1 year ago

Agreed. Vim or Neovim can be set up to act like an IDE, but pretty much every IDE or editor worth their salt will have a plugin that allows you to use vim keybindings.

[–] interolivary 12 points 1 year ago (1 children)

I may be the odd one out here, but I don't think that the editor you use is really going to make all that much of a difference for your efficiency. Text manipulation is rarely your bottleneck when coding, so I'd just go with an IDE / editor you feel comfortable with.

I used to be a hardcore vim user but nowadays I just use VSCode with a heavily customized keymap.

[–] gerbal 3 points 1 year ago (1 children)

If you find yourself thinking "I wish I could type/manipulate text faster" it might be worth it

load more comments (1 replies)
[–] Ninmi@sopuli.xyz 10 points 1 year ago* (last edited 1 year ago) (2 children)

I think anyone who does programming should at least give Neovim a good shot. Like, dedicate a few months to get a feel for the basic controls, use relative line numbers to jump to lines, f and F to jump to spots in lines, ciw ci" etc. to change stuff. If it's not your thing then fine, but learning Neovim is like switching from clicking file -> save to ctrl+s, but with everything.

You really don't need a mouse at all and in the end you'll get to make changes as fast as you can think. It's a language you speak through your keyboard to your editor and things just happen once you get fluent. E: checking if editing helps this thread federate better.

[–] Ninmi@sopuli.xyz 4 points 1 year ago

This thread stopped federating for some reason so I'll reply to myself:

How different is neo vim from regular vim?

Functionally it's pretty much identical. For the user the difference is in the added features and development model. Neovim's development model is not centralized to one person and makes real progress. Vim on the other hand is much more a pet project of its creator and seems to get new features only if it starts losing users over to Neovim. Using Vim you're always going to be behind the curve and under the whims of Bram's decisions. Neovim integrated Lua as a first-class language for configuration and it was then that Bram had to do something about vimscript, but opted instead to create a new, backwards incompatible version of vimscript, another bespoke language. I very much advocate making Neovim the norm instead.

[–] crisisingot 4 points 1 year ago (1 children)

How different is neo vim from regular vim?

[–] neotecha 6 points 1 year ago

Neovim is a rewrite of the vim project. From a high level (or from the perspective of a beginner to both), there's not much difference between the two. That is, basic usage will be the same regardless of which ones you choose. Like, the model philosophy and default key bindings are basically identical.

You start seeing major differences with more advanced usage and under the hood.

  • Neovim is built to support async processing, while Vim is entirely synchronous

  • Neovim offers native Language Server support while Vim requires plugins to do so. (Language Server Protocol is part of what makes VSCode so powerful)

  • Vim plugins are written with a custom script called "vimscript" while Neovim plugins are written in Lua but also supports vimscript.

There are more differences, but this should cover the basic differences. I haven't used neovim in an age, so I'm up for any corrections if anyone has any

[–] key@lemmy.keychat.org 9 points 1 year ago (1 children)

Emacs is awesome, definitely learn to use it then learn to lisp. Vim mostly learn to exit before running EDITOR=emacs

[–] kool_newt 7 points 1 year ago

Reported to mods for recommending awful editor

[–] AdamBomb@lemmy.sdf.org 8 points 1 year ago (1 children)

Yes, for me the happy medium is to learn and use Vim emulation within your IDE of choice. Purists will object that Vim emulators offer inconsistent levels of support, but in my experience they all offer support for the core functionality plus varying extras. For those who already have Vim fully configured for their workflow and preferences, there is no substitute. But for anyone else, Vim emulation in an IDE is a great way to level up your text editing powers.

load more comments (1 replies)
[–] sznio 7 points 1 year ago (3 children)

You should learn basics of Vim just for quickly editing config files on servers.

For programming I don't think the speed gains are worth it. It would take more time to learn it than I would shave while using it.

[–] jackattackson@lemm.ee 4 points 1 year ago

Same - I regularly use vim on servers when I have to, but I can only remember some super basic commands. Most of my coding is done in a basic text editor like Sublime Text or Notepad++ or an IDE.

I do get the appeal of becoming fluent in Vim or emacs and theoretically attaining giant productivity gains. Although for me at least, text editing is not where all my time is wasted. I lose my productivity the old fashioned way: attending unnecessary meetings and wasting time solving the wrong problems.

[–] r2vq@lemmy.ca 3 points 1 year ago
load more comments (1 replies)
[–] sincle354 7 points 1 year ago

When you get into Vim, you love it. There's so many buttons for movement and editing that you never have to mash the arrow keys ever again. But that's because you must customize Vim for how you like it. As you use Vim and accustom to the crazy binds, you will find situation where you think "I want to do this movement over and over and faster". Then you learn about the dot (repeat) key, the "copy(y) within quotes", the "jump to next function" button, the "jump to definition" button, etc... And if you don't find a button for what you need? YOU MAKE YOUR OWN BIND. I have a button combo that does "take the current word under the cursor and grep it for every file with the same current filetype down the directory tree". I use that button 50 times a day. Pure bliss.

It's a text editor where you can program in your favorite movements.

[–] varsock 7 points 1 year ago

Just to help you differentiate: vim is a text editor with a huge ecosystem of plugins and its own "language" where you can make the vim program into a sophisticated IDE. Vim also has very clever key bindings to help you interact with text more efficiently. My advice is that keyboard navigation using vim key bindings are worth learning, not necessarily sinking time to creating an IDE in vim for yourself with plugins.

vim key bindings make it incredibly easy and efficient to manipulate text, after putting effort into learning it. Most text editors, IDEs, Note taking apps (Joplin, Obsidian, etc.) have VIM mode where you can interact with text same way as in vim. Hell, I wish Word had vim key bindings!

To make VIM useful as an IDE you have to spend time to find plugins you need/want, customizing, tweaking, troubleshooting, etc etc.

personally, in my professional software eng career, I don't have time to troubleshoot VIM plugins or customize my setup and I need an env that is frictionless and basically pay others to maintain it and make improvements. I use IntelliJ IDEs and VS code with vim binding enabled.

I do hobby around with it in my free time, making tweaks here and there but it is a huge time sink. Also, my squishy brain cannot always take the overhead of keyboard navigating an IDE. On days I am mentally drained of chasing evasive bugs, having a GUI that where i can click through menus without having to invoke a command really helps with mental fatigue.

I would suggest enabling vim keyboard navigation and getting the hang of that first while still using android studio so you don't lose all your IDE features. Looks like your editor has a vim plugin. Then, if you like navigating with a keyboard, you can slowly build your own IDE using plugins and switch over.

[–] rofoldos@lemm.ee 6 points 1 year ago (3 children)

It is really a good idea to learn vim. It’s everywhere, particularly useful when connecting to remote servers.

In order to use it for all your development needs, you’ll probably resort to multiple plugins. The advantage: wizardry, the disadvantage: you get used to it, and won’t work on vanilla remote installations.

I like to use vim for every day scripts and remote text editing, while using helix as main code editor.

Helix is not yet as popular, but it comes with batteries included. Many of the plugins that you’d install in vim come as a feature in helix. It is also a modal editor, and it varies slightly in it’s use, but a nice addon to your toolbelt.

[–] Dominic 5 points 1 year ago (1 children)

Seconding the recommendation for Helix.

As you noted, it’s batteries-included. For me, the hard part of using vim/Neovim is choosing and configuring all of the plugins that you need to have an IDE-like experience. Helix doesn’t have a plugin system, so it’s not as powerful or flexible as Neovim, but it gives you 90% of the features of a fully-configured Neovim setup with 10% of the work.

I also like Helix’s approach to modal editing. It’s a little more intuitive to use motions and then actions (e.g. select the next 3 words, delete them) than the other way around.

[–] StrayCatFrump 2 points 1 year ago* (last edited 1 year ago)

I use tmux instead of a bunch of vim plugins. What I can't do inside the editor, I hop over to the other half of the terminal to do with tools in bash. The great part is that tmux can run in just about all the places vim can, and you also run ssh within it instead of the reverse. Whereas getting all your vim plugins onto each server you want to work in is a major PITA.

You can get a similar experience with a split vim screen and the :term command, but tmux offers more versatility IMX.

[–] Jummit@lemmy.one 4 points 1 year ago

I can recommend Helix as well, just be aware that it's still in active development. Dropping the link for the lazy: https://helix-editor.com/

load more comments (1 replies)
[–] Sinfaen 6 points 1 year ago (1 children)

Engineer here who has had to work on many machines that were off-network, without a monitor or with a crappy one, with no ability to install random software:

There's a very good chance that vim is installed. Getting good at it certainly helped my productivity working in those environments

[–] varsock 2 points 1 year ago

I agree with you, knowing vim for keyboard navigation is very benifitial in the majority of time when working with computers. To that point, most IDEs have vim keybindings/mode so you can edit inside the IDE using vim keymaps.To OPs question, replicating IDE functionality using vim plugins is a huge timesink.

[–] Lanthanae@lemmy.blahaj.zone 5 points 1 year ago* (last edited 1 year ago)

I think it's worth it mostly because it's really not hard to get to a point where you're equally as efficient as you were before, and from there the sky's the limit.

It's also really nice not to have to open a full gui to make quick edits to files.

For me though, it's not even the efficiency which brought me to it, it's that it just feels so much nicer to use. Someone once told me it's like using a really nice pen: it's not going to make you a better writer but it will make writing a hell of a lot more enjoyable.

[–] pkulak 5 points 1 year ago (1 children)

Vim is great because you can enable the bindings in nearly every editor.

[–] ollien 4 points 1 year ago (1 children)

And then painfully learn which subset of the bindings each editor supports :(

[–] pkulak 2 points 1 year ago

Haha. True. But some are really close.

[–] admin@lemmy.devils.house 4 points 1 year ago

I really enjoy vim, especially when I need to work in a lot of remote sessions. I’d recommend neovim with a prepackaged config like lazyvim and customize from there as you figure out what works for you.

[–] Elw@lemmy.sdf.org 4 points 1 year ago

I'm quite biased, but I think it's great to learn vim. The best advice I've ever heard for beginners is "don't feel like you have to use the command line vim, start with gvim or the vim mode for VSCode and gradually try to use more and more vim keys". Check out ThePrimeagen on Youtube too. He's not everyone's cup of tea but he's got some really good playlists for getting started.

[–] Veraticus@lib.lgbt 4 points 1 year ago (1 children)

vim keybindings are an amazing and useful skillset to have.

And neovim is the best editor in existence.

Let the religious wars commence!

[–] sinnerdotbin@lemmy.ca 3 points 1 year ago* (last edited 1 year ago)

Complete heathen here. emacs with evil-mode FTW. Or better yet: https://github.com/doomemacs/doomemacs

What everyone here is echoing: the bindings in these editors (and particularily I would argue in vi/vim) is the secrect behind the wizardry. The principle is your hands never leave the keyboard and you never have to dialog surf. Any mainstream IDE (Vcode;IntelliJ) will have a bindings plugin. I'd honestly quit programming if I had to use and editor without.

[–] slartibartfast42 4 points 1 year ago

Personally, I'm a vim guy, but I think either is fine. For most coding purposes, a graphical editor like VScode is fine, but knowing emacs or vim is essential if you ever want to edit files without a GUI, e.g. on a remote host over SSH.

[–] l3mming@lemmy.fmhy.ml 4 points 1 year ago (1 children)

Learn vim, but learn it well. Not enough people take advantage of it's macros feature. Once you've tried that, you'll never go back.

Also, while you're at it, spend some time learning i3. Then you'll be able to show your principle engineers a thing or two.

load more comments (1 replies)
[–] pandaontoast 3 points 1 year ago

I would recommend trying a vim extension for vscode first if thats what you're used to already. The learning curve can feel a bit daunting but once you learn some of the really basic shortcuts you will have already noticeably increased your efficiency imo

[–] oscar@programming.dev 3 points 1 year ago* (last edited 1 year ago)

Learning vim was valuable for me since many servers that I manage have it installed, so it's easy to edit files on them. For example advanced searches using regex (and replacing), multiline editing, jumping to function definitions etc.

For servers that don't, they usually have vi at the very least. (i.e. BusyBox)

As for emacs, I've been interested in trying it before but it seemed to require a separate graphical application? But I could be wrong.

[–] SomeGuyNamedPaul 3 points 1 year ago

I'm simply faster with vim and I don't even do anything fancy. It's also available basically anywhere there's a command line as the default.

[–] santiagopim@lemmy.nz 2 points 1 year ago

If you want to edit code use the old and veterans vim or emacs. But if you want that and beyond, just use emacs.

[–] furrowsofar 2 points 1 year ago

What I suggest is know how to use nano.

Vi and Emacs only look at those if your going to use them a lot. Otherwise you will forget. I have used both at times. It is very personality based to. Vi and now Vim people will say how great it is. On the other hand not for me, I think they are nuts. I favor emacs but even then I really favor nano. Just different perspectives.

[–] Frederic 2 points 1 year ago

Vi, yes, it's on about every distro especially server one without X.

I used exclusively emacs last century, even in DOS/Windows, but not anymore, vi or nano are ok for simple editor.

[–] SebKra@feddit.de 2 points 1 year ago (2 children)

Using Vim-Bindings in an IDE is nice, but I could live without them.

The structurally-aware commands of your IDE are at least as important. (expand selection, surround, refactorings, the contextual commands on alt-enter, ...)

Do not replace your IDE with cli vim.

[–] AnarchoYeasty 2 points 1 year ago

You can do all of that with neovim and lsp integration though. I'm not fully using nvim as my ide but I'm getting there and will be soon.

load more comments (1 replies)
[–] Sleekly 2 points 1 year ago

I can personally recommend learning to work with some kind of modal editor, whether that is vim or one of the more modern alternatives like neovim or helix.

load more comments
view more: next ›