23 ms·
Emacs Bedrock: A minimal Emacs starter kit
- michaelsbradley 3y agobbatsov's prelude is another nice kit to get started with and learn from: https://github.com/bbatsov/prelude https://github.com/bbatsov/prelude https://prelude.emacsredux.com/en/latest/ https://prelude.emacsredux.com/en/latest/
- rashkov 3y agoI’ve been running this on one of my desktops in an effort to wean myself from spacemacs and doom. I generally like it but the one thing I’m really missing is the spacebar concept from spacemacs / doom. Anyone know a way to shoehorn that in? Or any tips for how to do without it?
- jfoutz 3y agoI don't. but I think the things you want to look for, if you start from scratch, are 1. evil mode https://evil.readthedocs.io/en/latest/overview.html#installation-via-package-el https://evil.readthedocs.io/en/latest/overview.html#installa... 2. the leader key https://github.com/noctuid/evil-guide#leader-key https://github.com/noctuid/evil-guide#leader-key these are random search results that may or may not be authoritative, but they should be a good start.
- rashkov 3y agoDidn’t know that evil has leader key support built in, this seems to be a big piece of the puzzle. Thanks!
- drw3 3y agoWhy do you want to wean yourself off them?
- rashkov 3y agoMostly to force myself into learning emacs more deeply. I’ve been using them since 2016 but I feel like I’ve hit a wall with how well I know emacs and elisp.
- weikju 3y agonot OP, so personal opinion here: Starter kits are usually opinionated, have too much in them that I may not want, I may want to do things differently, and like was said in a sibling reply, I would also want to understand my own config better...
- turboponyy 3y agoI can vouch for general.el[1]. It's easy to use and it integrates with use-package clauses, which-key and evil states. You can look at my config[2] for examples. 1. https://github.com/noctuid/general.el https://github.com/noctuid/general.el 2. https://github.com/gekoke/dotfiles/blob/main/modules/programs/emacs/init.el https://github.com/gekoke/dotfiles/blob/main/modules/program...
- luispauloml 3y agoAs another commenter pointed out, what you're probably looking for is general.el: https://github.com/noctuid/general.el https://github.com/noctuid/general.el
- cmrdporcupine 3y agoI'm a casual emacs user for 30 years. Decided to give prelude a try after reading this... 2 minutes in: ""<down> keybinding is discouraged! Use <C-n> instead." Ok, well, then. Time to uninstall.
- michaelsbradley 3y agoFair enough, though that notice can easily be disabled. For what it's worth, I happened across bbatsov/prelude in 2011, not long after it started being developed, having no prior emacs experience. The notice you mentioned was one of several that nudged me to learn and use the various key combinations, so I'm grateful for the notices, but I understand that not everyone would be.
- cmrdporcupine 3y agoLack of support for my perfectly useful arrow keys is one of the key reasons I didn't pick up vi back in 1990/1991 (when I first started Unixing) and did Emacs instead.
- cmrdporcupine 3y agoSo I tried again and disabled guru mode (had to hunt for how and had to read the author's opinionated nonsense about the "one true way to use Emacs is by using it the way it was intended to be used " (phbtbt... nonsense... have you looked at the Space Cadet keyboard?). So far I like the bundling of lsp and so on, it worked nicely out of the box to bring in my Rust projects ... it's nice to have it all set up. But there's more... opinionated stuff in here that's frustrating. C-x u for undo is wonky, and C-g does not appear to be working to abort/get out of prompts. My fingers were tripping all over the place. I feel like by the time I'd unpeeled enough of this guy's opinions and undone all the non-standard stuff in here, I'd be best to just start over.
- michaelsbradley 3y agoMaybe there's been a recent change, but I use C-g all the time every day to get out of prompts, etc. For me, C-x u opens a buffer for undo-tree, not sure if that's what you meant or not. It's possible I customized for C-g and or C-x u; I haven't changed much in .emacs.d/personal recently, except for adding a few scripts. In any case, glad you gave it another shot, but perhaps it isn't your cup of tea. It's great that Emacs is (and has long been) able to adapted to a variety of needs and preferences.
- mrmincent 3y agoYep, prelude is great. I finally have a common config across all my machines thanks to prelude, for some reason I never got everything consistent enough before.
- ljm 3y agoIf you’re running emacs 29+ I posit you get less value out of a starter kit or framework than beforehand. Treesitter is baked in for syntax, eglot is baked in for language servers (intellisense), project and tab-bar give you scoped workspaces. use-package is baked in for downloading and configuring dependencies. Modus-themes are also built in now, so you can use modus-operandi and modus-vivendi out of the box. Two incredible themes with a lot of research invested in them. My config is a few hundred lines of unadulterated elisp now and most of the code is around completion and fuzzy searching. The point being, modern emacs is a lot more viable from a vanilla config now than it ever has been. Edit: changed emacs 28 to emacs 29
- b0afc375b5 3y agoTypo, I think you meant 29+. 28 doesn't have treesitter and all the goodies you mentioned.
- ljm 3y agoYou’re right; updated.
- ashton314 3y agoI agree! But some of those things don’t come turned on/easily set up by default, hence this starter kit using only one 3rd-party package (which-key) by default and just focused on configuring built-ins to better defaults. Stock Emacs can be so comfy these days. Just still got dumpy defaults.
- weikju 3y agoMakes me want to try out a config from scratch again.. but.. need.. to.. get.. work.. done....
- ashton314 3y agoThe --init-directory flag with 29.1 makes this easy. :)
- viksit 3y agoyes But can someone please tell me how to get typescript auto complete like vscode (eg auto import, linting) that also works for jsx. running tests. oh and simple auto complete. i couldn’t get that to work with https://github.com/viksit/prelude/blob/master/init.el https://github.com/viksit/prelude/blob/master/init.el as someone else said - need to get work done :))
- G3rn0ti 3y agoFor good autocompletion you‘ll need both an autocompletion framework and a language server client. I am still using „lsp-mode“ as a language server client which works well for me and it comes with „company-mode“ integration for good autocompletion: https://emacs-lsp.github.io/lsp-mode/page/lsp-typescript/ https://emacs-lsp.github.io/lsp-mode/page/lsp-typescript/ Later that day I can paste you the relevant lines out of my init.el. Starting with Emacs 29 you can also use the treesitter mode „typescript-ts-mode“ for better syntax highlighting an navigation.
- G3rn0ti 3y agoFirst, for every IDE experience you definitely need flycheck mode: (use-package flycheck :diminish flycheck-mode :init (global-flycheck-mode)) This will underline syntax errors for you. (It'll use the language server as a backend once lsp-mode runs.) Next we install and set up "company-mode" for simple autocompletion. Basically, it starts the (minor) company mode after starting "lsp-mode", sets up key bindings and reduces the delay to zero: (use-package company :after lsp-mode :hook (lsp-mode . company-mode) :bind (:map company-active-map ("<tab>" . company-complete-selection)) (:map lsp-mode-map ("<tab>" . company-indent-or-complete-common)) :custom (company-minimum-prefix-length 1) (company-idle-delay 0.0)) This stuff is for basic JSX/TSX support you'll need to work on React projects. "web-mode" is old-school but it still works for me quite well. Since Emacs 29 you can use "typescript-ts-mode" instead but I haven't tried it out yet: (use-package web-mode :config ;; plain HTML may also contain JS (add-to-list 'auto-mode-alist '("\\.html?\\'" . web-mode)) ;; JSX (add-to-list 'auto-mode-alist '("\\.jsx\\'" . web-mode)) ; TSX (add-to-list 'auto-mode-alist '("\\.tsx\\'" . web-mode)) ;; web-mode overrides these key strokes with "link" and "reload" ;; which I *never* needed. But I love compile mode: :bind (:map web-mode-map ("C-c C-l" . 'compile) ("C-c C-r" . 'recompile))) The next stuff is for setting up lsp mode integrating the various language modes and company mode in a single user experience: (defun gernoti/lsp-mode-setup () "Gernot's Emacs: My personal modifications to lsp mode." (setq lsp-headerline-breadcrumb-segments '(path-up-to-project file symbols)) (lsp-headerline-breadcrumb-mode) (lsp-treemacs-sync-mode 1)) ;; I am still using "web-mode" for react projects. The function ;; activates lsp mode only if the file actually contains ;; javascript/typescript (IIRC it'll also work for TSX): (defun gernoti/lsp-deferred-maybe-jsx () (if (string= web-mode-content-type "jsx") (lsp-deferred))) (use-package lsp-mode :commands (lsp lsp-deferred) :hook (lsp-mode . gernoti/lsp-mode-setup) (js-mode . lsp-deferred) (typescript-mode . lsp-deferred) ;; We only turn lsp-mode on if web-mode runs in JSX or TSX mode. (web-mode . gernoti/lsp-deferred-maybe-jsx) :init (setq lsp-keymap-prefix "C-c l") ;; Or 'C-l', 's-l' :config ;; You want this if you want to discover all lsp mode's goodies. ;; Though I found I actually don't use many features, really. (lsp-enable-which-key-integration t)) At first startup it'll download and run the default js/ts language server. It seems to be working well for me. You definitely want the "lsp-ui" extensions for jumping around in definitions, too: (use-package lsp-ui :after lsp-mode :hook (lsp-mode . lsp-ui-mode) :custom (lsp-ui-doc-position 'bottom) ;; remap "M-." and "M-?" to point to the nice looking lsp-ui ;; replacements :config (define-key lsp-ui-mode-map [remap xref-find-definitions] #'lsp-ui-peek-find-definitions) (define-key lsp-ui-mode-map [remap xref-find-references] #'lsp-ui-peek-find-references))
- geokon 3y agoIt seems like a list of nice, but most are kinda opinionated non-essential tweaks (cua-mode) Well this will have the greybeards frothing at the mouth :) that said, `cua-mode` is kinda terrible/half-assed b/c it implements a tiny fraction of what I think most people would consider "CUA". If you want a real CUA-mode use `ergoemacs`. Then Emacs will start to behave like every other GUI since the last mass extinction. It comes with a nice illustration of all the keybindings which leads to good discoverability of features. The only downside I saw was it had really slow launch times. Once you're comfortable with ELisp you can just rolled your own keybindings though Is there some reason ergoemacs has never caught on?
- ashton314 3y ago> most are kinda opinionated non-essential tweaks "That's just like uh… your opinion man." —"The Big Lebowski", I think ;-) I'm mostly of the opinion that vanilla Emacs has some bad opinions with regards to discoverability and ease-of-use-for-newbies, which is what this starter kit is targeting. CUA-mode is on because without it you're gonna have newbies footgunning themselves super hard right out the gate, and that's the biggest thing I want to avoid. If you consider this setup opinionated, then great—I'll embrace that. :) I think they're the kind of opinions that help newbies. > ergoemacs Are you referring to Xah Lee's stuff? Or something else? I'd love to see what you're referring to—please send me a link here or on my contact page. That said, Xah himself said at one point that `cua-mode` should be on by default,[1] so I think it's good enough for this kit. [1]: http://xahlee.info/emacs/emacs/modernization.html http://xahlee.info/emacs/emacs/modernization.html
- geokon 3y agoyeah Xah Lee's ergoemacs. You should give it a try. I don't think we disagree. cua-mode is better than nothing.. but just enabling CUA feels kinda lazy bc it's easily improved from Xah Lee himself: http://xahlee.info/emacs/emacs/modernization_cua-mode.html http://xahlee.info/emacs/emacs/modernization_cua-mode.html
- ashton314 3y ago
- raincole 3y agoHow does Emacs (and most addons) run on Windows? I'm tempted to try it out, but knowing the community is (righteously) Unix-fist I'm not so sure it's worth the trouble.
- dzhar11 3y agoI am trying to learn and use Emacs, but I am not an expert. Surprisingly, Emacs 29 runs very good on Windows. I am happy with eshell, dired, trying to use emacs more for some simple tasks. I am experimenting with sharing emacs init.el configuration via local git + symlinks between 3 machines: 2 Windows and 1 Linux. Package configuration is challenging; sometimes, it works on Windows but breaks on Linux. Only nyan-cat never caused any issues ;)
- ashton314 3y agoI own no windows machines but afaik it should run OK on windows. Emacs is a pretty good application platform that glosses over lots of OS inconsistencies. :)
- raincole 3y agoI heard that some addons (like magit and vterm) run much worse on Windows than on Unix-like. That's my main concern. Maybe it's an outdated view tho.
- dan-robertson 3y agoThe big issue here is that spawning processes is (was?) much slower on windows. There’s also wsl2 where I think Emacs will work fine.
- ljm 3y agoI run it inside windows terminal on WSL2 and it's smooth as butter. Despite losing out on some GUI-specific features I think I prefer it.
- lost_tourist 3y ago
- vbernat 3y agoI have switched last year from custom configuration to Doom Emacs. I liked the framework, but over time, I think this makes me rely on external people too much and some of the stuff is too overengineered (but the good design makes it easy to tweak). I would prefer to keep things lean and I am pondering using Doom Emacs without any builtin modules as the framework itself is very good. I have looked at other starter kits to find leaner things, but they don't seem to bring much to seasoned Emacs users like me.
- forgotpwd16 3y agoWhat issues you had with your custom configuration?
- taude 3y agoI went Doom a few years back after declaring init file bankrupcy. I haven't looked back. I now just run pretty bare doom config with a couple extra modules for org-journal, etc.... I've even embraced the VIM bindings. I definitely love the leader key access to the options.
- globular-toast 3y agoI would probably recommend this to new users. I don't generally recommend starter kits because it defeats the real purpose of emacs which is to hack it. But this one seems to just get over the initial barrier of it looking ugly by default which enables happy hacking more quickly. I like it! (And isn't Emacs 29 great?!) Btw, one thing that probably all starter kits should do is disable JIT compilation warnings: `(setq native-comp-async-report-warnings-errors 'silent)` Maybe JIT-enabled builds aren't generally available right now, but once they are this default would scare a lot of new users right off the bat.
- lambda_dn 3y agoEmacs is a relic, it can take weeks of configuring to get it anywhere near as productive as something like VS Code or Jetbrains IDEs. If you want to procrastinate for a few months it's the perfect tool.
- gpderetta 3y ago2 weeks for 20+ years of use doesn't seem to bad!
- chimprich 3y ago> Emacs is a relic People were saying that when I started using it, over 20 years ago. Apparently I was supposed to be using Notepad++ or some MS program du jour which no one remembers now. I wouldn't be surprised if I keep using it for the rest of my career. > it can take weeks of configuring More like decades ;) > to get it anywhere near as productive as something like VS Code or Jetbrains IDE Nope - it's significantly more productive. At least for me - I can't speak for you, but I do seem to be much faster at processing text than any of my colleagues who are using those other editors. All the configuring is by design. You can set up the editor to take advantage of your strengths and paper over your weaknesses.
- not_kurt_godel 3y agoProcessing text is like 10% of time and 5% of effort of software development. emacs fails at basic core IDE features like semantic location of variable declaration and usage out of the box
- G3rn0ti 3y ago> semantic location of variable declaration This can only work if the editor internalizes the corresponding language. That does not scale for all languages available. That’s exactly what the language server protocol is all about (and certainly what parsers like tree sitter are there for). Emacs can connect to those and acquire semantic analysis capabilities. The degree to which such a semantic language features will work for you will also depend strongly on the language, of course. If you use a commercial editor it’ll jump start you for the popular languages. But, say, you wanted to program in Raku or Scheme you’ll also going to need to fiddle around.
- oblio 3y agoTotally curious: is anyone using Emacs seriously on Windows, especially with stuff like LSP? My personal experience is that most of the new dev tooling is Linux/MacOS only, and maaaaybe sometimes it's ported badly to Windows. Are people using Emacs with LSPs for Java, Python, for example? Are they solid? Would you be able to use them day to day for software engineering work?
- kriiuuu 3y agoI use it for Java and Scala and it is great. The LSP support is good as long as the LSP implementation is good. I imagine it works well for most programming languages nowadays. I have Intellij Ultimate, but I have not needed or wanted to use it in ages.
- Barrin92 3y agoI use Emacs on Windows all day long. LSP tooling works flawlessly, it would be kinda funny if it didn't given that Microsoft originally developed it for VS Code. The one thing in Emacs that does not really work for me are these fancier new completion frameworks (Vertico, Orderless etc) as the performance is abysmal. So I switched back to Helm.
- crabbone 3y agoWell, I haven't updated my configuration in many years... I've never heard of any of the extra packages this kit installs outside of Avy (but I use ace-jump). Some do look nice though. One thing I feel is a strange one to optimize for: startup times. Typical Emacs use is to start it once when the graphical interface of the system starts, and never turn it off. What's even the point of this optimization?
- qwerty456127 3y agoBecause people outside the Emacs world generally launch an editor from scratch almost every time they want to edit a particular file. Even such monstrosities like VisuatStudio, MS Office and LibreOffice take just some seconds to start on my very old PC. If Emacs takes longer that's a serious turn-off for anybody who doesn't live in Emacs already.
- crabbone 3y agoWell... I don't think closing all Emacs windows terminates Emacs server... or does it? If not, then only the first start takes time, subsequent starts don't even execute the init file, or do they?
- kramerger 3y agoI have two comments, that I think also apply to any other HN post on emacs: 1. We are on version 30. By this time emacs should have come with some better defaults. It's 2023, not 1960 people. 2. Why are 90% of emacs frameworks trying to make it into vi?? I choose emacs, if I wanted vi-ish I would have used vi from the beginning
- tharne 3y ago> 2. Why are 90% of emacs frameworks trying to make it into vi?? A lot of people want the power of emacs without the RSI that so often goes with it :)
- allarm 3y ago> 2. Why are 90% of emacs frameworks trying to make it into vi?? Idk, I can navigate in Emacs using native bindings, though I like vi modal editing more, it just feels more natural when working with text. Also I can't say about 90%, but in Doom Emacs you can easily switch between native and vi bindings (even on the fly, via the keyboard chord), it's not forced in any way. (I just checked - you can disable evil mode in spacemacs too).
- globular-toast 3y agoHave you ever done any software development? One does not simply change defaults... Who cares about defaults anyway? Just change them.
- bloopernova 3y agoThis is really great, thank you for sharing it! Good, clear comments on sensible defaults. I've already copied some into my init.el. Plus I've started using early-init.el too. Thank you!
- rakoo 3y ago> When I started learning Emacs, my dad gave me his .emacs file This is the first time I'm hearing of digital tooling used as legacy in the actual meaning of the word. I can't really be surprised that Emacs is the one that pops up, but I'm wondering if anybody has had (or heard) similar experiences
- deleted 3y ago[deleted]
- milin 3y agoWow - the at-least the landing page from vim counterparts look ages ahead.