Live data from Hacker News

Editing Code in Emacs

redpenguin101.github.io

41–50 of 64 posts

Re: Editing Code in Emacs

#41
I used Emacs for several years before I discovered "project" (it's built in). If you're navigating dired trees or similar to find files or grep for strings in groups of files, this is like magic:

C-x p f (find any file in the current "project", e.g. git repo)

C-x p v (grep the whole project super fast)

It's embarrassing how long it took me to realize it was there all along. :-)

Re: Editing Code in Emacs

#42
post #38

Earlier quoted context omitted.

Definitely not it's purpose. Avy can be used to select a word, line, or region. One action is move to it. But it can also, in it's own words, copy, yank, zap to, transpose, teleport, kill, mark, ispell, org-refile, and custom actions. https://karthinks.com/software/avy-can-do-anything/

I've bounced off that blog post in the past, because it makes it appear the first step to doing something in avy is to position all my files and "windows" (a "window" is an editing pane inside Emacs) in some clever way, and after I got all that setup, and the windows are all looking at just the right parts of the files, then I can move a paragraph from one window to another with just a few special keystrokes. I feel…

I would agree that the usefulness is reduced if you have tight vertical space constraints (3 lines of text).

Re: Editing Code in Emacs

#43
post #39

Earlier quoted context omitted.

I was excited for avy until I realized its purpose is only to move the cursor to a place visible on the screen. It does nothing a mouse can't do with one click. (This is my understanding at least; I'm open to correction.) I'm a lover of Vim bindings, and so I appreciate keyboard controls, but where Vim enables working with files and text in a general and powerful way, avy enables avoiding one click with the mouse. I…

It's really a selector or a filter. It's power comes from combining it with other tools.

Can you elaborate. I just use it by itself and think it is wonderful, but I am curious for some examples of using it with other tools.

EDIT: I just looked at the link posted by lvass and I understand now. So cool! I am going to update my workflow.

Re: Editing Code in Emacs

#44

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.

About my only usage is to augment my isearch. I frequently use isearch to navigate to a place on screen, but sometimes there are so many matches it would take a lot of repeated "C-s" to get there. I have "C-'" bound to avy-isearch (from within isearch), which instantly turns that into one or two keystrokes to filter down.

(or I could pick up the mouse, I know, but that's not why we're here)

Re: Editing Code in Emacs

#45

I used Emacs for several years before I discovered "project" (it's built in). If you're navigating dired trees or similar to find files or grep for strings in groups of files, this is like magic: C-x p f (find any file in the current "project", e.g. git repo) C-x p v (grep the whole project super fast) It's embarrassing how long it took me to realize it was there all along. :-)

I am consistently using `m` for marking relevant files/directories in the dired mode and then `A` to find a regex among all included files. It does not seem that I miss anything by not relying on such a project approach.

Re: Editing Code in Emacs

#46

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 haven't tried Avy, but I gave ace-jump mode a shot. Maybe I didn't give it enough time, but it just never felt fast for me. The problem is the eye -> hand -> eye feedback loop latency. If I want to jump to a given place, I need invoke ace-jump, wait to read what letter ace jump assigns my destination, press that letter, read the new letter, and repeat until the destination becomes unambitious. It just feels slower than navigating by sexp or whatever.

Maybe if I combine it with eye tracking so I can limit letter assignment to the foveated region I can reduce the cycle count and make this style of navigation win.

Re: Editing Code in Emacs

#48
post #29
post #19

Earlier quoted context omitted.

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.

Is there a way to enable such a mode on a Linux Desktop Environment, so most mnemonics use Super- instead of Ctrl- ?

Re: Editing Code in Emacs

#49

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.

Yes, that's a "paradigm shift" in behavior, so you need to force yourself to use it for some time to evaluate it properly

Re: Editing Code in Emacs

#50

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 was excited for avy until I realized its purpose is only to move the cursor to a place visible on the screen. It does nothing a mouse can't do with one click. (This is my understanding at least; I'm open to correction.) I'm a lover of Vim bindings, and so I appreciate keyboard controls, but where Vim enables working with files and text in a general and powerful way, avy enables avoiding one click with the mouse. I…

> It does nothing a mouse can't do with one click.

But the you'd need to take the hands off keyboard, also it might be slightly more precise as a typo is less likely than a less-than-perfect mouse movement

Post reply on HN