this post was submitted on 11 Jul 2023
16 points (100.0% liked)

Text Editors

457 readers
1 users here now

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

founded 1 year ago
MODERATORS
 

I'm relatively new to programming, I've been learning C on linux using nano and it's been very fun. I've recently fallen into the emacs/vim rabbithole and I've been watching videos about emacs, Doom, spacemacs, neovim and reading comments about people switching from this or that to another config or editor, and I've been a bit lost on what to do. Then I realised that I haven't done any coding and spent all of my time focusing on editors. So here is my question (which has probably been asked many times) : what is the point of investing so much time learning all of this when there are some IDEs that are preconfigured with all the functionality a programmer would need ? Does learning neovim or emacs actually save time in the long run? I know that they're much more lightweight than IDEs and I've been really enjoying using the terminal much more than my time on IntelliJ, but having an easy out of the box visual debugger, refactoring and jump into functions can be really helpful in the long run I think, especially when starting to write actual large programs. Nano is fun, but not a time saver. Why did you chose your editor?

top 29 comments
sorted by: hot top controversial new old
[–] nous 12 points 1 year ago (2 children)

what is the point of investing so much time learning all of this when there are some IDEs that are preconfigured with all the functionality a programmer would need ?

Editors are a thing you use a lot. They are probably one of the most used tools you will ever use as a programmer. If anything deserve some time investment to learn it is the editor you use. Doing so will pay dividends in the long term. Even one that is preconfigured requires time to learn all those features and how to use them effectively. Time spent configuring is just time spent exploring the features the editor has to offer. Vim and Emacs force you to do this to become on par with other editors, but just because another editor has the tools built in does not mean you don't still need to spend the time to learn those tools.

Does learning neovim or emacs actually save time in the long run?

Lots of people think so. I personally hate using normal editors these days, modal editors like vim are just far nicer to use and lets me jump around and edit code far faster than normal editors. I cannot comment on emacs though.

I know that they’re much more lightweight than IDEs and I’ve been really enjoying using the terminal much more than my time on IntelliJ, but having an easy out of the box visual debugger, refactoring and jump into functions can be really helpful in the long run I think

You can get all these things in terminal editors. Especially with the LSP (language server protocol) vim and similar editors can support all of the language servers that were created for vscode giving you the same refactoring tools as available in vscode. It is mostly a question of finding the right plug-ins that you require.

Why did you chose your editor?

I learnt vim in uni - cannot remember why exactly any more. But ever since I properly learnt it I have not been able to move back to normal editors anymore. They just feel far more clunky than modal ones. Yes you can get the vim input mode on vscode and other editors - but they are always lacking compaire to the real thing.

Recently though I have switch to helix which is a modal terminal editor inspired by neovim and kakoune - takes the keybinding from kakoune but integrates LSP and treesitter in addition to a lot of the common plugins that you have in vim. I love that it requires basically no configuration to give you what is more of a fully functional IDE but still has all the power of a modal editor. It lacks a plugin architecture though (this is still a work in progress feature) but since it bakes in a lot of what you typically go to plugins for I have never felt it lacking by missing this feature.

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

As an alternative to helix, there are lots of preconfigured/opinionated vim/neovim setups. Lunarvim (my choice), chadvim (I think is the name), and more.

All the benefits of the vim plugins etc. With sane defaults. You still have to take time learning everything, and I would probably recommend spending time with configuring a vanilla neovin config to understand how it works then jumping into one of these later, but I've found it saves a lot of time configuring and gives you a fantastic starting point.

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

I have tried some of these before - and they always felt a bit janky compared to something with everything built in like Helix. You still have to keep lots of plugins up to date and installation is IMO kinda dodgy on most of them - having to run some script to mess with your home directory settings. As someone that like to manage config via config managers I always found these install methods get in the way for me. And they are so complex that manually setting them up is also a huge pain.

Where as helix just works as you would expect straight from your distros repo.

[–] clushh 1 points 1 year ago (1 children)

That's valid, especially the complexity issue. Everything mostly works, until it doesn't. And if you have some sort of dep issue or otherwise, you're now combing through lots of scripts to try to narrow it down and fix it unless you wait for an update.

Personally still find I have saved a lot of time using a preconfiged setup, though everyone could have different experiences.

[–] nous 1 points 1 year ago

Personally still find I have saved a lot of time using a preconfiged setup

Oh, they can save time if you want to use vim/neovim and get you into a fairly good state. But when compared to helix they still have a lot of short comings and quirky behaviour to the near 0 line of config and no extra files needing to be copied around you home dir with multiple repos being cloned down that all the vim bundles require.

[–] rastignac 1 points 1 year ago

Those are a lot of good arguments. Thank you.

[–] zygo_histo_morpheus 5 points 1 year ago

I wrote a comment on a thread with a similar topic elsewhere:

I love vim and am very happy that I’ve learned it, but at the same time I wouldn’t oversell how useful it is. I doubt that it makes you much more productive, although you might look and feel more productive. This is because at the end of the day being good at programming is more important than being good at editing text.

The main reason why I like vim is that it’s fun and because there is a closer mapping between what I want to do and the action of doing it. When editing in vim I usually have an idea of what I want to do which I can “compile” into a set of vim commands that I can quickly type out, usually without having to leave the home row on the keyboard too much. Using a “normal” editor feels sluggish and like I’m having to “dumb down” my actions.

I think that you should learn vim (or emacs) because it’s fun and empowering, or maybe even to occasionally get the opportunity to impress your colleagues. Don’t overthink it though!

[–] oessessnex 5 points 1 year ago

Editing in (neo)vim is akin to live programming in a very terse programming language. You can also create your own commands (keybindings) and repeat snippets multiple times (macros). This is amazingly powerful if you need to convert between two formats or extract some information.

The UI is not a highlight of this editor.

It also takes years before selecting the commands becomes mostly subconscious. It is definitely a long term investment.

[–] sukhmel 3 points 1 year ago

To answer your question directly, there are some presets available on the internet that show how to set up Vim (Emacs too, I guess, but I only have experience with Vim) for development in a specific language. Those presets allow for a pretty fast set up and you only need to learn basics then.

Still, compared to UI-based IDE, I'd say that those are handier. After all, most of the time you spend is usually spent on thinking, not traversing the code or typing one. So whatever advantages you will get from navigating Vim quicker they can't be a major difference in dev speed.

TLDR; choose what feels better, there are plugins for lots of things in console and vice versa, but don't invest too heavily in an instrument you don't like after several tries.

[–] varsock 3 points 1 year ago* (last edited 1 year ago) (1 children)

Then I realized that I haven’t done any coding and spent all of my time focusing on editors. So here is my question (which has probably been asked many times): what is the point of investing so much time learning all of this when there are some IDEs that are preconfigured with all the functionality a programmer would need ?

I applaud you for realizing this so early on, and acting on it. I spent waaay too much time in rabbit holes, resulting in not doing anything productive and becoming overwhelmed.

In short, learn vim keybindings for text based navigation - that is the game changer in being productive. Activate vim navigation in an IDE. Don't try to make a terminal based IDE with vim plugins unless that is a hobby.

[–] rastignac 1 points 1 year ago (1 children)

I'm happy someone else is considering the time investment. I started using neovim since yesterday for the very purpose of learning key bindings that I deem useful. I'll then move to a config already made with features I like or an IDE. Thanks !

[–] varsock 1 points 1 year ago

give "enabling in the IDE" a shot immediately. The best way to learn what keybindings are useful is by fixing the friction you have when actively using it. When you've mastered the basics you can then think "how can I improve this this thing that I hate that takes time"

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

There's nothing saying you have to use one editor. My main editor is VSCode, but if I need to say edit a config variable on my server, or hot fix a script, knowing Vim is useful. Or I might use Rider for C#, etc. Vim (and emacs, nano and others) are usually always available on Linux servers, making it very quick to poke around, which makes them attractive to a lot of linux enthusiasts.

Choose the editor you find the best for the current job. If you prefer the full IDE experience, go for it. If you want a lighter editor, then use that. If you just want to learn the different terminal editors, there's no fault in that, it can be fun to master something.

[–] sukhmel 2 points 1 year ago

Agreed, different editors give different look and feel. An IDE is good because of lots of clever things it can do, but most of them could be replicated in Vim with proper plugins.

Though to be hones I never had the nerve to properly set up Vim, so use it only for small scale stuff :-)

Regarding Vim vs Emacs vs Any other editor it all boils down to what you will like more, although you should probably give it a bit more than one time to get better acquainted woth the quirks and advantages of a specific variant.

[–] matrixdot 2 points 1 year ago

It's worth it.

[–] Uplink 2 points 1 year ago

I appreciate all the terminal-only solutions but as you said: having a visual debugger is nice. I can certainly get around the terminal but for my daily programming work, I use an almost unmodified vscode. I know electron is bloat but I've been using it for so long, I don't feel like switching anymore.

[–] [email protected] 1 points 1 year ago

I use intellij too. And I learn helix since few weeks.

I feel that not the same usage and I can imagine that I could use both of them for what they are good for.

[–] natecox 1 points 1 year ago (1 children)

I’ve spent most of my career bouncing between vim and emacs, but also trying out the new thing as it came out along the way (sublime, atom, IntelliJ and the variants, vscode, even eclipse for a while).

In general, the out of the box IDEs are powerful but walled in and I’ve always felt that it was a trade off that didn’t fit for me.

Emacs was my main for a long time because it’s not really a text editor, it’s a Lisp REPL; meaning you could modify it in place to do basically anything you could ever want. I have an emacs config large enough that it has its own repo now.

That said, I think that the recent introduction of Language Server Protocols (LSPs) have really changed the game. They basically provide much of the power from the walled in IDEs and give it to any editor willing to write an LSP interface API.

Providing your editor supports LSPs, I think ergonomics of editing is more important than ever. Find something comfortable and just stick with it. Today I’m using helix-editor because I love the editing model and LSP support is giving me the vast majority of what my old emacs config was intended to do.

[–] rastignac 1 points 1 year ago

Thanks for the advice !

[–] tatterdemalion 1 points 1 year ago

I learned vim when working at a company where pair programming was encouraged and most people used vim. The keybindings and macro features are pretty nice for avoiding strain on your hands. It was nice if you needed to do development on a remote host for some reason. Since I left that company I have stopped using it almost entirely in favor of VSCode. VSCode has vim bindings emulation if you like them. I still use vim sometimes if I'm already in a shell.

[–] somegeek 1 points 1 year ago (1 children)

I use both vscode with the neovim, and neovim alone. I'm a huge linux geek (so a lot of config-ing), a syadmin (so a lot of config-ing), and a web dev (so I work with js frameworks and typescript/js)

the short answer is yes, it's totally worth it but I want to explain more in detail.

I haven't gotten myself to develop my projects with only neovim, so I do most of my web-dev stuff in vscode BUT with the neovim plugin. because once you learn working with vim keys, using a plain text editor without the key bindings that vim/neovim provide is like hell, so the vim movements are TOP TIER and I wish we had them in every single application in existence. But setting up plain vim/neovim/emacs for something like web-dev has been really hard for me, so I just prefer the more simple out of the box setup of vscode, where everything is easily available, plus neovim keybinds. And for editing config files, writing scripts, hobby projects in python, js , bash, rust, I use neovim and it's really enjoyable. Learning vim/neovim is a HUGE asset for a computer person. firstly it's really fun, second , once you learn it it's really fast and productive, third, you look badass.

[–] Teddly 2 points 1 year ago

This is exactly where I'm at. Learning vim binding has also opened me up to a lot of REALLY great TUI options. lazygit has become something I never want to work without again, and it's only pleasant if you're used to vim bindings. There's also k9s and other great TUI tools out there that make learning vim bindings hugely worth it.

But, after investing a week into heavily trying to get neovim working, I went back to VS Code w/ vim plugin. Still want to get neovim working for me at some point but will have to find time to do it without hurting my professional output.

I will say so far the only pain point I've found running vim plugin in VS Code is missing ctrl/cmd + d... I used to use that a lot to do some really powerful multi-cursor editing and vim bindings ruins it. I actually went and disabled the vim plugin just to go do one thing with uninhibited multi-cursor a while ago, and turned it back on when I was done.

[–] kogasa 1 points 1 year ago

I used NeoVim exclusively for years with a workload consisting of typical Linux use (config files, scripting) and LaTeX. When I switched to a heavy software dev workload I started using JetBrains IDEs and find them invaluable for all projects that span more than one or two small files of code. I still use NeoVim daily for config files and scripting. So I guess that's what I recommend: learn (n)vim, use it as a text editor and when you aren't sitting down for a full development session. Use an IDE otherwise.

[–] gamma 1 points 1 year ago

You can absolutely build a full dev environment out of one of the extensible text editors, and there is value in the exercise. You can learn what the different language tools are doing (linters, formatters, LSPs) and plumb those in manually or find plugins which do that for you.

TJ DeVries (a Neovim dev) has a video where he goes in more detail on this, calling highly-extensible editors "PDE"s, or "Personalized Development Environments".

If you're trying to save time in the short term, use an IDE. If you want more control over the long term, maybe consider an extensible editor.

[–] Shareni 1 points 1 year ago

Emacs is my text editor, ide, git client, app launcher, element and IRC client, file manager, remote machine client (tramp + ssh/scp), docker client, sometimes even my window manager, and the list goes on. It starts at boot, and never shuts down alone.

what is the point of investing so much time learning all of this when there are some IDEs that are preconfigured with all the functionality a programmer would need ? Does learning neovim or emacs actually save time in the long run?

Emacs/nvim don't magically turn you into an efficient, ultra fast programmer. It just makes working with code nicer. Everything is just the way you want it because you spent time making it so it's the way you want it. And that part is a great time sink.

A "normal" ide is going to have everything preconfigured, but good luck modifying anything. At best you're going to get an API that forces you to jump through a bunch of hoops to add some functionality. No ide/editor offers the same degree of freedom that Emacs does.

Is it worth it? That's a question only you can answer... For me, Emacs is irreplaceable.

[–] MrJay 1 points 1 year ago* (last edited 1 year ago) (1 children)

Like some others have mentioned the biggest part of emacs and vim is the Vim Keybinds/Motions this is something you can take to almost every editor since most editors have the majority of keybinds/Motions.

(you mentioned you use Nano so you may already find this to be true with Nano as well)

The Second biggest thing you learn from Emacs/Vim is how to use the terminal better, when I started out using intellij I didnt realize the command prompt was a command prompt, when I switched to notepad++ and used the terminal I began understanding how the terminal actually worked and it has helped me a lot, I find myself using the fd utility to find documents and ripgrep to search through config files even when I am not programming and it makes me way faster than my coworkers (I work as an artist) when we are searching through some of are more intense config files I find stuff first. I switched to Emacs/Vim to unify my workflow because I was using Notepad++ and the Terminal, now I understand Intellij better because I actually started looking things up, Emacs/Vim for better or worse force you to learn. now if I ever want to try out a language it does not matter if it has a language server I can use a small set of universal tools to get done what needs to be done.

I would say a full IDE is probably faster however Vim Motions can save a lot of time, because with Vim Motions worse case scenario you use the mouse which is what you would have done anyway if you didnt know them, so it can only save you time.

I will say the biggest danger is tinkering too much and wasting time on your Emacs/Vim config files, for me I havent really touched my config files in over a year, only thing I have done is add some languages too it and changed the theme.

I sometimes do some Java development but its very rare so I dont know the language well enough to use Emacs or Vim to program Java I normally just use IntelliJ with Vim Motions. but for my main dev projects I use Emacs.

Third benefit is a Very customizable Editor; for work and for side projects I use languages that are not very common so they dont have great support in IDE's so if I ever want a feature I can make it myself. a common feature is structural editing.

[–] rastignac 2 points 1 year ago

Good points ! Thanks !

[–] rastignac 1 points 1 year ago

Thank you all for your time and valuable input ! I'll be trying out vim and learn a few key bindings then move on to emacs and see what I can do. I'll then try out premade configs like doom and spacemacs and see or the neovim ones and settle on one that has the stuff i want.

[–] o11c 0 points 1 year ago

The problem with IDEs is that they are less than the sum of their parts.

There are no old Emacs users on the internet because their fingers are no longer capable of typing. Unfortunately, most other text editors use keybindings reminscent of emacs.

Neovim doesn't offer much value over classic vim, and is much more prone to being outdated on some random system you might use.

Don't put too much in your .vimrc, since then you'll have trouble when you move to another computer. I can survive with just 3 lines in my .vimrc (easy to memorize), with a 4th likely:

" because I hate default <Esc> location and behavior
set virtualedit=onemore
nnoremap <CR> i<CR>
inoremap <CR> <C-O>:stopinsert<CR>
" If you press it fast enough, don't break undo.
inoremap <CR><CR> <CR>

That's not all I end up with if I use vim extensively on a single system, but the other stuff can be added as I get bothered (line numbering, tab behavior, TTY title, backups, undos, modeline, mouse, search, wrapping)

(admittedly I don't bother with LSP integration; if you rely on that you probably need more)