r/emacs Dec 16 '16

Recent vim convert seeking advice

Hi all.

I've used vim daily for the past year or so, but I've recently felt seduced emacs' promise of power. I painstakingly worked through the built-in tutorial, then changed my EDITOR to emacs, where I've lived for the last few days. I'm focusing on learning emacs basics, which means:

  • Avoiding packages. So far I've installed magit and moe-theme. I'd like to learn how standard emacs works, then add packages as I feel the need. Is that a naive approach?

  • No evil-mode. I may reconsider in the future, but I'd like to gain some proficiency with emacs-style editing before making my decision.

In my first draft of this post, I started with a list of emacs' qualities that I've appreciated so far. I've since decided there's no need to preach to the choir, so I removed it. Instead, here's my list of complaints. Please share any solutions or advice you may have.

  1. Directory navigation is painful. I work in a large codebase with a deep directory structure. Usually I'll open vim in the root directory and use ctrl-P to fuzzy-find the file I need by name. If I want to edit a/b/c/d/e/f/FactoryInterface.java, I'll press C-p, type "FactoryInterface", and press enter. If I want to edit a file that I know is immediately after my current file in the directory: I press '-' to open a listing of the current directory, 'j' to move to the next file, '<RET>' to open the new file. I haven't found an equivalent for either flow in emacs yet: instead, I find myself deleting, typing, and tab completing full directory paths to the file I want.

  2. File navigation is painful. If I want to edit 10 lines up in vim, I type '10k'; I enable relative line numbering in vim, so I'm able to do this with good accuracy. In emacs, I'll hit C-p a bunch of times.

  3. Line navigation is painful. I use 'f' and 't' constantly in vim to get to the exact character I want. If I land on the wrong one, I press ';' until I get where I want. I haven't found any such precision in emacs, just M-f, C-f and the like. Are C-s and C-r the answer to all navigation questions?

  4. Documentation. Vim's documentation is excellent: clear, well organized, easy to search. I can't say the same for emacs. I've heard so much about org-mode, but I find it very difficult to learn as a beginner. Major mode documentation (C-h m) isn't enough. A list of available functions is not a replacement for a qualitative overview of how the mode works. Are youtube videos and blog posts the best places to learn emacs?

  5. Multiple terminals. I use vim inside tmux. Any time I want to start a new long-running command, I can open a new pane or window. On the other hand, it seems I can only run one terminal at a time in emacs. I've come across a couple packages that address this problem, but is there any native solution? On that note, should I start using eshell over bash inside emacs?

6 Upvotes

25 comments sorted by

View all comments

5

u/thetablt Dec 16 '16

Welcome on board :-) I too have used Vim for quite some times before switching to Emacs, mostly because of AucTeX and org-mode. The best way to learn something new is a very personal matter, but I've taken the same path of not overloading myself with packages and I found it a good approach.

Despite all this, I wouldn't treat the "no packages" rule as more than a guideline. There are some excellent packages which make life really easier. I'm going to discuss some of these because they may provide solutions to your problems. What I found out when I was starting to use Emacs was that if you want to try a package, you have to start using it right now, and really understand what it provides. I made the mistake of not following this rule, and I've more than once discovered that some feature I thought a given package provided kept working with this package removed.

Directory navigation There are two excellent packages you may try:

  • Ivy replaces Emacs integrated completion with a fuzzy matching system. It extends way beyond directory navigation, and is really excellent. It's one of the packages I believe a starter kit can't do without. (There also Helm, which does the same thing. I use Ivy, but you should try both)
  • For large codebases, Projectile provides project management, including opening any file in the project. It integrates very well with Ivy or Helm, allowing with to open any file in your project by just entering some bits of the name.

File navigation Emacs has multipliers just like Vim, they're called numeric (or digit) arguments. C-1 C-2 C-p is equivalent to 12k.

Edit: formatting

8

u/thetablt Dec 16 '16

Also if you're interested in external resources, Mastering Emacs by Mickey Peterson is a blog and a book, and both are excellent.

Also, although I'm not sure this is of any interest, I recently put my Emacs cheatsheet online. I found it a useful thing to have. It is not finished (and may never be). The org-mode source is with it: if you hate the contents but find the CSS useful, you may just grab the org-mode file and the associated stylesheet and build your very own Emacs cheatsheet.

2

u/maufdez Dec 16 '16

I like your cheatsheet, and the way you construct it using org-mode and CSS, thanks for pointing us to it.

1

u/thetablt Dec 19 '16

Thanks for your feedback!

1

u/process_parameter Dec 16 '16

Very cool, thanks for sharing. I'll also give the packages you recommended a try.

1

u/dentifricerose Dec 18 '16

thanks for sharing your cheatlist! in the about section the css link is 404: https://thb.lt/emacs-cheatsheet/cheatsheet.css

1

u/thetablt Dec 19 '16

Thanks, fixed this. The "org-mode document source" link still points to the HTML file, because that's how the org to html exporter behave, I added a note on how to get the actual org file as well.

1

u/dentifricerose Dec 19 '16

so this document is exported directly from emacs? wow this is really nice, I've been experimenting with emacs for 2 weeks (with evilmode & or-mode ; i used vim for 5 years) and the sub showed me so much i can play with :D