42 points · by mudrockbestgirl · 4y ago · 82 comments
I think my problem is the lack of a structured guide/tutorial focused on real-world project usage. I can do all basic operations, but I'm probably doing them in an inefficient way, which ends up being slower than a GUI. But I don't know what I don't know, so I don't know what commands and keybindings I should use instead or what my options are.
How did you become good at using these editors? Just using them doesn't really work because by myself I'd never discover most of the features and keybindings.
1. Don't. There's no need to 'switch'. There are marvellously 'productive' developers using every editor under the sun, and neither the quality nor quantity of their work is strongly related to their choice of editor. There are world-class developers who do everything in a vanilla Sublime Text. Others who have a fully tricked-out emacs who dream in org mode. Some use a mouse in one hand and do keyboard shortcuts in the other. None of it matters much. Ignore antiempirical self-attestations to the contrary - they're entertaining but informationally worthless. If self-attestations were relevant, then everything (from quack medicines to cult healing methods to levitation) would be true, because everything has more utterly self-convinced dataless self-attestations than you could absorb in all a bodhisattva's recalled lifetimes. [all scare quotes intended].
2. Do. Emacs and vim/nvim are great and will serve you well if one matches your preferences. Pick one using your preferred criteria, and commit to it for a period. Your 1-2 weeks just isn't enough - I'd say 2 months at least. Put that commitment in your calendar. If it slows you down too much for practicality to start with, limit its use (to an an hour a day, or to a side project), but stick with it for the full period regardless. In the first week or two, go through enough basic tutorials to be able to do essential editing with their basic keybindings without plugins. With reasonable fluency established, just keep a note in which to jot down what's missing compared to your IDE, and pick them off, one-by-one, over time. Sort the list once a week to keep it fresh, and just pick the next item to configure/learn. Get fluent with each new item before moving on to the next.
This is just as much a caricature as the one you're objecting to. People do good work using all of the available tools. Some use more than one! There are people who like both emacs and IntelliJ! We really don't have to tribalize over every little choice people make.
You're laying out a false dichotomy.
I tried VS Code as well but did not enjoy the experience. Back to Emacs with which I have too many habits and a long love affair. I also use Atom a bit for some tasks but it's more rare.
You also don't need to configure your IDE from the start. It's a bit of a thankless task but not that difficult or incomprehensible. It took me a few years before I started messing with my Emacs configuration. The advantage is that it is portable and I can find my environment on any computer just by copying a folder.
I did once use emacs extensively. I stopped because at the time I moved almost exclusively into iOS work, which mostly meant XCode. I disliked that enough that I tried and enjoyed the only real alternative - Jetbrains' AppCode. So then when I moved on again to non-iOS work I had fallen for the Jetbrains approach, so mostly used IntelliJ. I did have one small spell again with emacs, when writing some clojure (for which it's a good fit), but found it overwrought for my more recent taste.
But all this time I had used vim for small on-off and in-terminal edits, and mostly used vim keybinds in other editors. Anyway, via a couple more shifts (including using VSCode for a while), the advent of LSP and treesitter really makes neovim close enough to matching IntelliJ's features for my purposes. I just like neovim and its ecosystem, and it works well enough for me. But so would emacs or IntelliJ or VSCode or vim or emacs. I probably make several choices a week far more significant than what text editor to use.
Emacs manual is great, at least skim it to see what's out there in stock Emacs.
Look at what Spacemacs provides in packages: these are most likely the most popular extensions. You don't need to use Spacemacs, but this is the closest to the curated list of useful packages Emacs has (would be glad to be proven wrong - is there a better list?), so at least reading through it will give you an idea what could be added to Emacs to make it more useful.
LSP support is a gift to all non-mainstream-IDE users. Use it.
"Mastering Emacs" is a good book: https://www.masteringemacs.org/book, I wish it was available when I started.
Be aware that many Emacs packages are terribly outdated and not very good to start with. Don't try too hard to make work something that sounds good on paper: if it doesn't work, or cumbersome to configure or use then look for alternatives. Over time I got rid of most of the packages I tried.
Learn some Elisp. It's not a large language, and knowledge of it makes making Emacs lifestyle improvements trivial.
P.S: It helped that at 1998 IDEs were too slow to run on a computer I could afford, so I stick to Emacs and eventually got better at it.
For example, I have Command-O bound to "open file" and Command-S bound to "save file", because I don't want to remember another set of obscure hotkeys. I have Command-T for "open me a new blank file", because that's browsers' hotkey.
I use Control-[FBNP] and derivatives because they also work in shells and in majority of edit fields in mac OS. Otherwise I would probably stick to cursor keys.
Maybe that's doing your shell/terminal work in Emacs. Perhaps it's note taking and organising your thoughts, tasks, and agenda. Perhaps email. Maybe it's small shell scripts at first, before you move on to larger tasks, like full-on programming like you do in your daily job (I am guessing.)
If you try to do everything, while trying to remain productive at your job, you'll probably abandon Emacs.
I've written a book on Emacs, which will definitely teach you Emacs. But it's not a _requirement_ to read a book on it. The manual and tutorial and both good places to start if you'd rather do it for free.
It finally clicked when I started a job where I had to use a windows laptop with a linux VM as my primary computer. I found that using vscode either within the VM or over "Remote-SSH" from windows was severely cramping my productivity. So I switched to NeoVim+Tmux cold turkey (SSHing into VM using "Windows Terminal"). I set up some shortcuts that made sense for me somewhat from vscode (e.g. Alt+<number> for switching "tabs", alt+hjkl or alt+arrow keys to switch between tmux panes etc.). Within a couple of weeks I was back to my old level of productivity.
My usual setup has neovim on the left and a terminal in the right pane. Adding more panes vertically or horizontally is super easy as well. This may not be the most optimal setup, and there are still a few pain points from time to time - particularly with the LSP/"intellisense" stuff. But it works for me.
Oh and when I am coding on my MacBook Pro at home, I still prefer to use vscode + iTerm.
Some resources that helped:
"Practical Vim" by Drew Neil. I didn't read it cover to cover but I have scanned through it enough to pick up the important stuff.
https://www.youtube.com/watch?v=iF4RvQq6yU0
After I got the basic movements down (doing vimtutor if I needed refresher), then I would watch videos on youtube of peoples favourite keybinds, or lesser known keybinds. A lot of times this would open up a lot of things I didn't realize was possible.
Eventually I started to understand the vim "language", and things became natural to the point where I don't even really think about the keybinds I'm using, it just happens.
It was definitely a struggle at first though. If I could go back and be a TA again for intro to programming labs I would have found a way to give people extra credit for learning vim. The best time to start putting in the work is now, you'll thank yourself later.
If you program in C, google "Ctags" and the associated keybinds and vim command line argument (-t). Most useful utility for me personally.
No, seriously, why do you think you have to switch if you are productive with VSCode?
I used to be all in with Vim and then Emacs many years ago. I can manage pretty well with both to this day. But I moved onto VSCode a few years ago and… it’s very nice. It just works out of the box. I have tried to move back to Emacs for example, but the lack of trivial and good remoting features and the lack of great LSP integration are hard to overcome.
Nowadays I still use vim for quick or repetitive edits (learn how to record and replay macros; they are a game changer), but otherwise spend all of my time in VSCode with its Vim mode enabled.
And to be fair, I only use the Vim mode in VSCode because I moved from macOS to Windows and I could not stand the Windows native shortcuts.
isnt emacs just M-x ssh … and ure done?
I used Vim (GVim to be specific) as part of my job in a semiconductor industry. Everybody in our team used it and we'd help each other. My recollection is not 100% sure, but I think nobody knew how awesome user manuals were (start with vimtutor and then go through `:h usr_toc.txt` https://vimhelp.org/usr_toc.txt.html a few times).
I've also collected a list of Vim resources here: https://learnbyexample.github.io/curated_resources/vim.html
For Emacs, check out https://www.emacswiki.org/emacs/SiteMap
- [x] SpaceVim, SpaceMacs
- [ ] awesome-vim > Learning Vim https://github.com/akrawchyk/awesome-vim#learning-vim
- [x] https://learnxinyminutes.com/docs/vim/
- [ ]
:help help
:h help
:h usr_toc.txt
:help noautoindent
- [ ] https://en.wikibooks.org/wiki/Learning_the_vi_Editor/Vim/Mod... : :help Command-line-mode
:help Ex-mode
- [ ] my dotvim with regexable comments: https://github.com/westurner/dotvim/blob/master/vimrc1. Modal editing (VIM / Evil): Install vim extension pack[1][2][3] for VSCode. This should give a good starter pack.
2. Practice:
- Disable the arrow keys using keymapping in VSCode or with a keyboard customization (s/w or h/w).
- Disconnect the mouse
- Practice long writing / code editing sessions where your productivity doesn't matter. You are learning.
- Start with simple navigation (hjkl, go to line)
- Use numeric prefixes
- Begin using text manipulation commands (yi" or di> for example)
- Use normal mode keys for window navigation (spc + w + h for example)
Once you get comfortable with this you should already see a decent leap in comfort/experience and almost zero mouse usage.
3. Next install emacs with a configuration repository[4]. Most of your practice in VSCode vim should apply almost directly.4. With emacs, you have a vast operating surface. You can choose to use it just as your editor or you can use it as an operating system: email, calendering, note taking, calculations, twitter, rss, text based browser, file manager, http request playground etc. Org mode is essential emacs experience. You can add the rest of them very slowly
[1]: vscodevim.vim: https://marketplace.visualstudio.com/items?itemName=vscodevi...
[2]: vspacecode.vspacecode: https://marketplace.visualstudio.com/items?itemName=VSpaceCo...
[3]: vspacecode.whichkey: https://marketplace.visualstudio.com/items?itemName=VSpaceCo...
[4]: doom emacs: https://github.com/doomemacs/doomemacs
I'd say using Vim Keybindings in VSCode, being able to use Vim when on some remote machine and using Doom Emacs with its included packages is a good approach for improving without investing too much time.
[1] https://youtube.com/playlist?list=PLhXZp00uXBk4np17N39WvB80z...
At least 75% of Vim users I’ve encountered don’t know Vim well enough to justify their using it. Most users stop at vimtutor and are left without the knowledge of the terrible nightmare of Vim knowledge you need to get close to useful editing.
Also keep in mind Vim is a text editor, not a code editor. IDEs are incredibly more powerful than Vim for code editing.
Editing text efficiently is not the same as being a productive developer. The bottleneck is rarely how fast you can type or edit the code; it's how fast you can reason about the code. When you watch a prerecorded video most of the time all the thinking has already happened, and you're watching someone just go through the motions of implementation.
Obviously editing faster is nice, but you'd probably find you just have bigger gaps for thinking rather than a sustained increase in output.
If you want to truly be more productive as dev, focus on learning mental tools for reasoning about code quicker. Learn to step away from the keyboard to think , work with others well, communicate your ideas, how to be more organized, how to understand what algorithms are doing, how to break down problems, etc.
This is sometimes true... and then sometimes it simply isn't. When I'm working on building something truly great and unique--and yes, I do try to spend my time building things that are truly great and unique as much as I can--I'm not spending most my time typing; but, we don't have the luxury of building things that are truly great and unique a lot of the time.
Sometimes, you need to write a debugger for some new architecture or a compiler for some new language or hell you just need to build some silly content management system for the billing backend of the new business you're putting together for the new mobile application video streaming pay-by-the-voice project you're working on, and suddenly you can see ahead of you days if not weeks of just having to type a bunch of stuff, because it isn't like we don't know how to write all of these things off the top of our head: they just don't exist off-the-shelf.
There have been multiple times in my life that I've managed to build something pretty amazing that got used--and even cherished--by millions of people that I only was willing to build because I was so sick that I couldn't bring myself to do anything "intelligent" and so dequeued a "spend a full week doing nothing but typing" project off the stack ("you win wars with lead bullets, not silver ones", yadda yadda etc. etc.).
(And hell: even when you are doing something hard, it isn't like you are able to fully pipeline your brain to be thinking of the hard things constantly while your hands are typing... I know I often find myself thinking for a while, figuring out what I need to do, and then having to rapidly type a bunch of stuff to build a new interface or refactor a project--during which time the language center of my brain is pretty actively engaged doing symbol manipulation--and only when I'm done with that burst can I go back to thinking. Or hell: I might have needed to finish typing that to run an experiment to learn something new so I could use the result of that typing in the next segment of thinking.)
That's like saying suturing dexterity does not a good surgeon make. Anything that reduces cognitive friction, including the ease with which keystrokes go from your brain to the screen, makes you a better dev.
I'd say vim wins the fewest-keystrokes battle. But emacs wins the war because it leads you to lisp, and lisp makes you a better programmer.
That's the reason why I have been not learning to touch type for the last decade or so. I just have this strong feeling that it's my brain, not my fingers that is the bottleneck. At the same time, I somehow acknowledge that being able to touch type could in some still undefined way to me increase my productivity.
Development isn't just coding. It's writing documentation (requirements, high level design, detailed design, reference manuals, ...), commit comments, bug reports, e-mails, status reports, ...
Poor keyboarding skills will definitely hold you back.
In order to reason about code, one thing you can do is write. Not write code, but prose about the subject matter. Writing is a thinking tool, and if you have good typing skills, the words pour out a lot faster, at times almost as fast as you can think.
I also got a job from it once, when the company boss saw me coding away and was impressed by my typing speed! Silly I know, but it did happen :)
Really doesn't take that long to learn, a few weeks or months of a small amount of daily practice would get you to enough proficiency to use it for real. I used Mavis Beacon I think, but that was a long time ago.
- to languages: partly Java (OO), partly Prolog (declarative style), most importantly Clojure (FP)
- then Emacs
- then i3wm
Each of them "unlocked" something in my head.
Without Emacs I would write slower than I reason, as if I were rate limited
It gets a bit weirder from there. If you pick vim for example theres a whole lot of customization rabbit holes you can go down. My advice is to find some sensible defaults and layer in stuff as you need it from there. vim-sensible[0] is a good start.
Good luck!
Emacs is a lifelong journey. Expecting to be great at it in a few weeks is very unrealistic.
To answer your question I spent a week reading a book on Emacs and forced myself to figure out any task rather than reaching for another editor. This was for the editing part.
For the IDE, my default is to use another IDE and as time permits I try to replicate features in Emacs - but I never have an obsession to completely replace an IDE.
Watching the system crafters YouTube channel will teach you about a lot of cool features and packages. Highly recommend it.
Monitoring the Emacs subreddit is a good source of inspiration as well.
Ultimately people use Emacs because they enjoy it - not because it is a superior IDE. If you're frustrated with Emacs, consider that it's not for you.
I used vimtutor on Mac to get started.
Then I also tried my hands at a few vimgolfs and then tried to understand the winning answers.
There’s a lot of YouTube tutorials now too.
I have too many years experience using vi, but probably still only use 30% of the features. And for example it's really not designed to be an IDE, even though, with splits, and combined with tmux, you can make a pretty good IDE out of it. One problem I find is that mis-keying can really blow up; I'm often using u or ctrl-o or to undo or get back to where I accidentally navigated to by tapping the wrong key, etc.
I think the thing that originally hooked me were Drew Neil's Vimcasts[1].
I do agree with others here, though, that ~2 weeks is not enough time. You need to force yourself to live with it for longer than that, and any time you encounter a pain point or something that you feel should be less cumbersome, have the patience to Google for solutions.
Personally, I feel that time investment has been worth it, but YMMV.
I'd also probably recommend getting your vim/emacs/whatever setup working really well for one language at a time, rather than trying to make it work for a bunch of different things all at once. Getting e.g. LSP-based autocomplete to work is a very language-specific effort, and is far from plug-and-play.
If it's helpful at all, I publish and version control my vim config on GitHub[2]. I can't guarantee it'll work on anything but my machines, but feel free to send Pull Requests. :-)
[1]: http://vimcasts.org
I’m the most productive on IDEs like Sublime or IntelliJ so I mainly use those and jump into vim when I need to on Linux.
It’s been more than good enough for my entire career. I used Ultraedit and Visual Studio whenever I could as well, and always used vim when I needed to.
You can't discover everything by exploring and reading help. The way you make radical improvements to how you use tools like Emacs and Vim is to identify pain points with what you're doing and search for solutions online.
There is a Vim StackExchange site, and Vim questions are also topical on StackOverflow.
For instance, one day I got tired of the clumsy buffer switching commands in Vim, so I researched into buffer management; are there better ways. I discovered buffer management plugins. I found one I liked and then customized its silly keybindings so that to bring up the visual buffer list, I just have to type \\ (backslash backslash).
I got tired of reloading files after quitting, so I researched into sessions. Then customized my ~/.vimrc with some useful things for working well with sessions. I can save a session with just :S <name>, and save with +. Sessions are great. I have sessions named after Jira tickets. When revisiting some ticket, I just "vim -S sess/<ticket-name>" and there is the edit session from three weeks ago with all the same files.
I replace Vim's configured grep program with lid, which is a tool from GNU Id-Utils. It uses ahead-of-time indexing (performed by a tool called mkid which builds a binary file called ID) for instantaneous grep-like searches of large trees. In some situations/projects, I also replace Vim's grep with "git grep".
Tags are important in Vim: they are the basis for "jump to definition". The Exuberant Ctags program has a lot of options. You can have it index filenames so that they become tags: :tj foo.h will jump to a foo.h file somewhere deep in the tree.
You could try thinking of which things feel tedious in Vim, and look up known ways to do it. It's rare that you come across a situation that can't be dealt with using a keybinding or plugin. But sometimes you just can't know beforehand what to look for, you likely won't learn features in the optimal order because there's just so much. Guides and tips on the internet come from people with very different workflows.
I'll just add a few things that might be useful to you, because they took me FAR too long to discover:
- * and # search the word under the cursor
- { and } lets you jump across paragraphs
- set clipboard=unnamedplus makes y, d, c, p use the system clipboard
- ci( to replace everything inside a pair of parentheses. Same works for [, {, <, ", ' etc. and other operations
- W and B are like w and b but always jump to the next whitespacewas always searching with / and "n"
You should accept a longer trajectory -- say 1-2 years to learn it and 7 years to get good at it. But even then it means you need to review things you do, look for repeated patterns and wonder about/hunt down smarter ways of doing things.
A big help for me when starting was hanging out in the Vim IRC channel (Freenode, I think). This stackoverflow reply is a classic on how to learn Vim: https://stackoverflow.com/a/1220118/4751065
Bairui's blog has some good stuff, but sadly he left the IRC channel in 2015 then I guess: http://of-vim-and-vigor.blogspot.com/?m=1
Finally, of course, the koans: https://blog.sanctum.geek.nz/vim-koans/
Then after that, I just started using vim and keeping with it. To me, the biggest hurdle was switching between modes. Hitting esc was too far for me. So I found some post that helped me configure vim that bound "ii" to command mode. So to switch between insert mode and command mode was just "i" and "ii".
Nowadays, I use the escape key. It's second nature by now. But I'm still trying to make navigation with 't' and 'f' more natural. I think it's just persisting, honestly.
My view is that it’s just like learning a language (albeit easier) and you just need to give yourself space and time. Structure is good, but can also be overwhelming in the sense that you try to min max like vim pros from youtube. I just found that I would take it in digestible pieces and build on that. First it was jumping lines, then changing inside or around, and so on and so on.
I spent most of high school in vim. And college. Then I got into lisp in grad school and picked up emacs.
Now I use vim and emacs, with the latter as my primary IDE. Spent years customizing both, and honestly, can't recommend it enough.
https://github.com/viksit/dotfiles
Taking those and making a point to work them into muscle memory has been key.
Eventually I found that I was familiar with the core modifiers (and figuring out new things) without any real effort. I knew that shift + something would do a specific thing
It takes knowing about the thing... and using it so much that you don't even have to think about it
The cases where I'm a little bit beyond what one can reasonably handle with sed is when I get to flex the vim muscles. Things like visual mode, finding/replacing, etc.
What's the 90% that's not available in VSCode with the Vim extension?
Proficiency is simply training your muscle memory when editing code and trying to use the sharpest tool at your disposal (eg. forcing yourself to use the "right" text object).
Knowledge comes from exploring the tool shed to see what's there and try to find how it can be useful to you. (Or try to solve a problem). Emacs is very good at that ! You can search for callable commands with M-x, show the next key (in a keybinding) + its effect with which-key, explore the documentation with describe-function/describe-variable/describe-key/...
Cycle between the two and after a while you'll feel at home.
And not just any programming language, but one that contains significant new concepts that you will not have encountered in other languages/systems, even if you already know some form of lisp.
1-2 weeks is nowhere near enough. When I learned it ~20 years ago it was a couple of months before I was reasonably proficient, and I've been learning ever since.
Also, read "Mastering Emacs", whose author has commented on this post.
I've been using Emacs for five years. When I got started, I also started journaling daily with Org-mode. That gave me a reason to open Emacs every day.
Vscode also has vim keybindings available.
Get the basic operations down, keep a cheatsheet handy, anything you'd want to do that you think might have a key combo look it up the minute you need it. Take an interest in it for it's own sake every now and then.
Keeping it simple and staying in the terminal (tmux, vim, fzf, rg, etc) slowly and incrementally over 18 yrs it just makes sense. It is not about good, but about what's comfortable and known, like learning a language; there's always something new and fun to incorporate. Despite years with emacs-nox, Orgmode, EvilMode and DoomEmacs, I kept returning and staying in vim. Old habits, die hard.
Maybe provide a few examples? Might help to understand what kind of productivity gains you are trying to achieve (and help with giving you better learning material for vim/emacs).
I've been using vim for ~15y, and it's been my exclusive editor for the past 10y. But I also have a lot of experience with Eclipse (and love it!).
When it comes to editors/tools, I don't think about productivity, but the amount of irritation. IMO, it's not about increasing the output/speed, but removing the things that irritate you (cause friction) so you can keep longer focus and do fewer context switches. If there's no friction, the tool you are using is already good choice.
What I noticed when using vim:
- In the beginning, it was difficult to get used to the modal mode. It took me quite some time and effort.
- Setting up vim from scratch is pain. Having a config to bootstrap from is great help.
- The startup time is amazing! This was one of the sources of irritation when working with the other editors.
- Using mouse causes context switch. Another irritation.
- I love vim macros. They are uncomplicated, almost friction free. And make repetitive and dull task easy and less boring (less irritation).
- Vim UI for searching, replacing, jumping to a specific line is distraction free. No context loss due to a pop up like in the classic editors (have no idea what's this like in vscode). I realized this is an irritation only after using vim for years and then having to do find/replace in a word processor.
- Simple extensibility removes a lot of irritation. Instead of having to write a complex plugin, a small script is enough (e.g. I use Fzf inside Vim a lot, or calling other small scripts from vim). Having to adjust to UX of a specific plugin (and be ready for its brakeage upon every editor update) was significant source of irritation.
Does anything from above resonate with you? I'll be happy to provide more context or pointers.
BTW. the best short text about Vim on the whole Internet is the answer at https://stackoverflow.com/questions/1218390/what-is-your-mos...
Also, check out fugitive by tim pope. It’s a git plugin for vim that’s changed my life. It’ll open your files with the old version in one split and the new version in another. You can then pull in changes chunk by chunk. It’s amazing.
It helped me to be a better vimmer, and it was fun too!
I'm terrible at it.
But, this is great!
nothing wrong with gui apps on macos/windows, but a terminal+browser setup on linux can be amazing.
2. Hang out in #vim :)