Live data from Hacker News

Editing Code in Emacs

redpenguin101.github.io

21–30 of 64 posts

Re: Editing Code in Emacs

#21
Thanks for sharing. I've been off editor hopping for quite some time, nowadays I just use some pre-defined configuration like Doom Emacs, occasionally I try to build some environment, with AI help, from "scratch" for fun and curiosity.

I really like Emacs' flexibility + evil-mode and reactivity, recently I searched for something similar and found Lem: https://github.com/lem-project/lem, looks promising, I'll try it out and compare with Emacs when I have the chance and time.

Re: Editing Code in Emacs

#22

I really like this, it's a bit hardcore, but for someone that really cares about efficiency (whether it is worth it or not - debatable), this is great. Though I have one minor nit against one point, that I've seen basically in every similar article: > This means no arrow keys and no mouse I use Neovim daily, and there is no denying that 98% of the time, using mouse is less efficient than doing a fancy search or jump.…

How using a mouse and incurring a context switch is better than just mashing j/k a couple of times in worst case scenario?

Re: Editing Code in Emacs

#23

I really like this, it's a bit hardcore, but for someone that really cares about efficiency (whether it is worth it or not - debatable), this is great. Though I have one minor nit against one point, that I've seen basically in every similar article: > This means no arrow keys and no mouse I use Neovim daily, and there is no denying that 98% of the time, using mouse is less efficient than doing a fancy search or jump.…

How using a mouse and incurring a context switch is better than just mashing j/k a couple of times in worst case scenario?

When you're not editing lisp.

Re: Editing Code in Emacs

#24
post #12

I've used Emacs for 20 years and I never learnt to navigate in a file except backwards and forwards search. Is there still hope for me? I think my biggest issue is that I am a slow coder and I never feel in a hurry.

Just type C-h t (help-with-tutorial) and work your way through it.

Re: Editing Code in Emacs

#25

My favorite way to move around in Emacs, and to move text around, is via avy-mode: https://github.com/abo-abo/avy . If you have not experienced avy-mode, give it a try, I think you will wonder how you ever got along without it.

I don't think this was the first package to use the tree idea, but `avy-goto-char-timer` is amazing and is new since the first time I tried it. After activating goto with a key press you type as many characters as you like to get where you want. Often you can get straight there if it's something unique, but if not then it goes to the tree. It's amazing how quick you get at typing "def" or something to get to a Python function definition, for example.

What I love about functionality like this is it's completely generic. It's just text. I don't need any lsp support to get me "go to def" or something. I can open a file in a language I've never seen before and use the exact same interface I'm used to to navigate around.

Re: Editing Code in Emacs

#26

I really like this, it's a bit hardcore, but for someone that really cares about efficiency (whether it is worth it or not - debatable), this is great. Though I have one minor nit against one point, that I've seen basically in every similar article: > This means no arrow keys and no mouse I use Neovim daily, and there is no denying that 98% of the time, using mouse is less efficient than doing a fancy search or jump.…

> But for the remaining 2%, it's provably true that mouse is better

This is definitely true. The thing is that using the mouse is a habit, and until you break it, people find themselves instinctively using it in situations where it would be better to use the keyboard. So the 'hard' mouse disable is more of a 'going cold-turkey' type thing to try and break the habit. I agree that once it's broken it makes sense to relax this.

Re: Editing Code in Emacs

#27
post #12

I've used Emacs for 20 years and I never learnt to navigate in a file except backwards and forwards search. Is there still hope for me? I think my biggest issue is that I am a slow coder and I never feel in a hurry.

If your workflow feels comfortable there's really no need to change it in my opinion. The reason I do this is to avoid the frustrating feeling that I'm spending all my time moving around in the text file rather than actually making the program. It's less about speed and more about feeling good while programming.

Re: Editing Code in Emacs

#28
post #12

I've used Emacs for 20 years and I never learnt to navigate in a file except backwards and forwards search. Is there still hope for me? I think my biggest issue is that I am a slow coder and I never feel in a hurry.

You really only need a few shortcuts to feel comfortable. The ones in the basic tutorial are pretty much all I use, but I also enable god-mode to avoid having to keep Ctrl pressed as that hurts.

Re: Editing Code in Emacs

#29
post #19

Earlier quoted context omitted.

Disagree with this just because it makes everything else easier. The more you stick to common key bindings, the more intuitive various packages will be. Eg navigating lines vs blocks in a magit diff block is C-n and N respectively. Copying a full hash is M-w. All these bindings are intuitive “overlays” on conventional bindings. Emacs shines when packages combine to form a whole greater than the sum of its parts. Chan…

Firefox opens a new window when I press C-n. Is this a setting that you have to enable?

The op is probably on Mac where emacs movements use Ctrl but FF and other apps use Cmd key, so they always work as there’s no conflict.

Re: Editing Code in Emacs

#30

My favorite way to move around in Emacs, and to move text around, is via avy-mode: https://github.com/abo-abo/avy . If you have not experienced avy-mode, give it a try, I think you will wonder how you ever got along without it.

I have it installed and have the main commands bound to convenient keys. But I’m so used to moving via words, paragraphs and isearch that the only time I remember it is when targeting symbols.
Post reply on HN