4
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

3 packages for Emacs beginners

Last updated at Posted at 2019-12-13

Trying out Emacs

I've been using Emacs for 1 year and 8 months(ever since I become a developer) and I think Emacs is an awesome editor. Although people may feel it's not so friendly for beginners who are unfamiliar with such kind of old-school text editor(indeed Emacs is more than 40-year-old :slight_smile:), I'll say no pain no gain. Not only your coding efficiency will be improved, but also complexities for workflows such as Deployment will be tremendously reduced.

Here I'm going to introduce some of my favorite packages in Emacs. You can enjoy them without having a good knowledge of Lisp.

Magit

Magit is a great interface for git. It helps me get rid of the long-heavy-difficult git commands.

install

  • M-x package-refresh-contents RET
  • M-x package-install RET magit RET

usage

You can check the usages by M-x magit-status to enter the status buffer, then h to see the key-bindings for git commands.
magit-h.png
For example, if you want to do a cherry-pick, it really easy in Magit:

  • M-x magit-status
  • A, you'll buffer with cherry-pick subcommands like this:
    cherry-pick.png
  • A, it'll ask for the commit id to be picked:
    cmm.png
  • Paste the commit id and then RET

If you want to view the raw git commands, M-x magit-process-buffer. There are records for each git command and its status done in Magit.

lsp-mode

Before using lsp-mode, I was using GTag and CTag for C++ development. I'm forced to switch to lsp because I started to develop in Rust and lsp appears as the only reliable code navigation plugin(at least for Emacs), which turns out far beyond my expectation.

install

I've had a painful time to get lsp-mode installed for various reasons.

usage

  • Code navigation: lsp-find-definition is one of the most impressive features is code navigation. Take Rust for example, not only within the crate, but also the external crate, which is really helpful because you don't need to search for the document in browser. It'll take you to the source code directly.
  • Real-time Diagnostics/linting: M-x package-install RET flycheck RET
    dd.png

counsel-tramp

tramp a remote file editing package for Emacs which I heavily rely on when edit config files on servers. But please take care when you operate as sudo.

install

  • M-x package-install counsel-tramp

usage

  • add server host name in your ~/.ssh/config
  • M-x counsel-tramp
  • choose the server in the list. it's something like /ssh:test-hostname1: or /ssh:test-hostname1|sudo:root@test-hostname1:/
  • then you can edit files on test-hostname1 on your local Emacs.

Conclusion

There are many other excellent packages I haven't introduced, maybe I'll introduce more of them in other posts.

  • magit: a must-have mode if you use git in your workflow.
  • lsp-mode: provide easy-to-use code navigation, real-time diagnostics, formatting etc.
  • counsel-tramp: a great tool for editing remote files.
4
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?