reddit / emacs
New to Emacs. Just wanted a single go-to editor for all my programming and editing needs
KaliYuga-VaradA · 2022-02-27 08:45
My needs are just to write or edit simple code in C++, Python and Rust; And to maintain a lot of markdown, xml and text files.
Trying to find the "best" ide and corresponding plugins for each programming language was just annoying to me. For eg. IntelliJ IDEA is great for Rust, but doesn't have an easy C++ support.
Thus my decision to switch to something like emacs or vim, which would have all-round support.
I completed the tutorial and immediately felt how convenient it would be to navigate around without having to take your hands off the keyboard.
I want to now continue to set up Emacs so that I can conveniently use it for the above needs. I'm setting it up in Manjaro Linux.
Do you all have any tips?
TomahawkChopped · 2022-02-27 09:47
Start with a prebuilt config. My config is based off of this one:
https://github.com/purcell/emacs.d
There are many others. But this will give you a head start with a wide array of modes, sanely configured
Lefantom55 · 2022-02-27 09:49
First, rebind your CapsLock key to act as a CTRL key, it will be more convenient ;)
You may want to look at Evil mode which adds the evil keybindings to emacs. (Keep in mind that it's a more complex way of editing if you don't come from vim)
Consider checking LSP-mode for langage server protocols.
If you want git support go check Magit.
I advise you to check the awesome-emacs repository on github, it's a community driven list of good/useful packages, I always find good things there.
If you want a ''pre-built" emacs check Doom-emacs. It's ready out of the box (I personnaly prefer customizing my own emacs)
Check the Emacs-from-scratch tuto serie on youtube from System Crafters.
I don't know on which OS you are but clearly Linux systems run Emacs better than Windows.
Here you are !
EDIT : typos & added remark from answer to this comment
adouzzy · 2022-02-27 10:08
Just is a strong word. Please allow your self with time and effort to sunk into Emacs.
Most Emacers spend years to get a satisfied config.
And after that they still tweak their config on a daily basis.
Nothing is more thrilling and exciting than a starting from scratch .
BettaGeorge · 2022-02-27 10:17
>Fiest, rebind your TAB key to act as a CTRL key, it will be more convenient ;)
I hope you mean capslock? I kinda need my tab key.
>You lay want to look at Evil mode which adds the evil keybindings to emacs.
IMO that's bad advice for a beginner not switching over from vim. Why not give the normal behaviour a try first? Evil isn't for everyone.
BettaGeorge · 2022-02-27 10:19
Just FYI, emacs is great, but you have to be prepared to put a great deal of work into your config, even if you start with a heavily preconfigured one. If that does not sound appealing to you, I would suggest vim instead, which is also a brilliant IDE.
Lefantom55 · 2022-02-27 10:20
Oh you are right ^^ totally capslock and not tab. I edited it.
I think Evil mode is more effective at editing but it's true that it's very complicated. I don't personally use it. Akd yeah, modal editing is not for everyone
BettaGeorge · 2022-02-27 10:32
Funnily enough, I came to emacs after years of vim, but I never got around to really trying evil. I guess I am done with that life.
[deleted] · 2022-02-27 10:42
Two options:
1. If you have the patience and the time to build your own config, go for it. It will require sacrificing your productivity for at least a month. And it will take several months to get to a point where you will not want to tweak things in your config every time you come across a task you can't accomplish or would like to accomplish faster.
2. If you want to be productive right off the bat, go with a prebuilt config like spacemacs, doom, purcell, centaur etc. You will be able to start on your work-tasks within a couple of hours. You can tweak these configs to your liking as you get more experience. Or, you can start writing your own custom config when you know what you like, and what you do not like.
Have fun! Remember, your computer is a tool. Get shit done, log off.
kryptonik · 2022-02-27 12:10
Strongly recommend working through the built-in tutorial (Emacs is self-documenting, and getting used to looking things up about Emacs within Emacs is a core skill you'll need to develop). AND I recommend reading cover-to-cover the book Mastering Emacs as it will give you a really solid foundation to build off of. In particular I appreciate how it emphasizes "keep the menus visible at first!" and "use the visual configuration system!" Many old timers say those are the first things to turn off and avoid, but for the first year+ they are actually really useful. (You will eventually turn them off, but not at first.)
https://masteringemacs.org/book
7890yuiop · 2022-02-27 12:11
> My needs are just to write or edit simple code in C++, Python and Rust; And to maintain a lot of markdown, xml and text files.
Emacs will do most of that out of the box, so you're largely sorted already.
For Markdown and Rust you'll need to install additional packages. It looks like `markdown-mode` is only in MELPA, so you'll want to add that to your package archives. `rust-mode` is in Non-GNU ELPA (which you'll not have configured by default unless you're using a pre-release version of Emacs), but it's almost certainly in MELPA too.
Once you've added those, you should have the basic modes you need for what you're doing; so get started and find out if you have specific issues to follow up.
Horrih · 2022-02-27 15:07
As mentioned, the power of emacs is that you can easily tweak everything including the plugins (called packages) that you install. And every customization goes through your config file which is an emacs lisp script loaded on startup
Emacs includes coloration for most languages out of the box(this is called the major mode) . You need packages when you need/want to improve the default experience, or want more ide features like code completion, error checking or debugging
For a mostly hassle free start, use one of the preconfigured emacs like doom emacs. This provides a simplified way to enable features. But this comes at the cost of another layer of abstraction which hinders config changes not anticipated by the maintainers.
Building your own config is more rewarding but requires more time. The emacs ecosystem is really modular, so you need several packages for all the IDE features of c++ for example . But you need more time to understand it all.
If you go down this path, start with vanilla emacs and the built in major mode. Then progressively add features ; color theme, completion, linting, etc one at a time. Doing the built in elisp tutorial helped me greatly to do this.
When you become more advanced you'll see how easy it is to tweak everything to your liking, all through the keyboard. I switched 4 months ago from vs code to emacs and couldnt be happier
A getting started guide for c++ code completion just in case, using lsp mode and clangd as backend when you're ready https://emacs-lsp.github.io/lsp-mode/tutorials/CPP-guide/
[deleted] · 2022-02-27 15:37
[deleted]
AuroraDraco · 2022-02-27 21:54
Oh wow, this post basically covers everything I was gonna say and more. So I am just gonna say listen to this guy OP