Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.


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)


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

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.


Just as an idea: you could try a more complicated setup where physical key positioning matches the movement direction, so Q would always be upper-left. Then at least the first jump you'd be able to do without reading, though then for the final jump you'd still need to react to feedback (or for jumping to an arbitrary area on the screen you could use a fixed "grid" that could also allow doing the first jump blindly)

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 don't use Vim to avoid the mouse, I use it so I can hack some Vim macros together when I'm editing text on a text-level. Vim (or Emacs) is an eternal tool that can do big things, avy just positions my cursor.


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 like moving from a large monitor to a small monitor would limit the usefulness of avy; it's weird that the physical size of a monitor would limit a tool like this.

If I can only see 3 lines of text at a time (maybe an accessibility thing), the usefulness of Vim-bindings is not significantly reduced. Is the same true for avy?

Again, I'm willing to learn that I was wrong, but this is the specific issue that ended my enthusiasm for learning avy.


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

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.


> 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


Don't underestimate the advantage of being able to move the cursor anywhere in a few clicks without having to take your hands off the keyboard. It is much faster than a mouse. Also, you can save your elbows the pain of constantly reaching over for the mouse.

avy does more than just jump the cursor to a specific place. It also allows you search for, copy and move text round without needing to move your cursor to that text. It is extremely easy to use and very efficient.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: