Live data from Hacker News

Editing Code in Emacs

redpenguin101.github.io

31–40 of 64 posts

Re: Editing Code in Emacs

#31
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.

Honestly being able to use emacs movements everywhere is one of the reasons I stay on MacOS.

Re: Editing Code in Emacs

#32

Earlier quoted context omitted.

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.

v, then t/T or f/F if staying on the same line, j and k if it’s within a couple line, / or ? for anything else. With the repetition commands ./,/n/N if I do not land at the correct place.

Re: Editing Code in Emacs

#34

Meh. I'm not a fan of modal interfaces. But if it works for you, then knock yourself out. I appreciate the write-up here. I'll give it a try to see if I can see what the author is talking about. The overwhelming majority of code I write now is in snippets inside text documents (think Knuthian Literate Programming) so I don't know how that would work w/ the author's modal setup. But they went to the trouble of documen…

> I'm not a fan of modal interfaces

I'm assuming you're using Emacs (otherwise why would you be commenting in this thread, right?). It's weird to hear that from an Emacs user - it's inherently a modal editor - keycords are modal, isearch is modal, repeat-mode is modal, transients are all modals with states. Evil-mode only adds some consistent "language" and structure to deal with modality, there's nothing much to it.

Idea of vim-navigation is actually pretty neat thing - absolutely beautiful, practical model. Its biggest problem is that it encapsulates some tacit knowledge - nobody can really explain the benefits of it to anyone until they try it for some time and it "clicks". I suppose just how learning to ride a bike may work differently for different people - it also takes different amount of time and effort. But once you figure it out - there's really no going back - no reason. It's very rare to meet people who've mastered it and then willingly stopped using it.

There's no conceptual difference in switching between navigation and insert modes in Vim and e.g. C-c C-c/C-d in Emacs - the only difference that you're in-between state more often, but once muscle memory trained, it becomes second nature - you don't even think about what mode you're actually in - it becomes very fluid and consistent flow state that allows you to very efficiently navigate and deal with text - with any kind of text - plain and structured.

Also, I find that mastering efficiency in Emacs using only vanilla keybindings is a bit harder than becoming a keyboard-maestro with the help of evil-mode or similar modal modes like meow. I've been working over a decade in various teams where people use Emacs, and evil-mode users typically figure out things much faster, while those sticking to native keybindings, don't even discover some great features of Emacs for years.

Re: Editing Code in Emacs

#35

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 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.

Re: Editing Code in Emacs

#36

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?

If you're moving in emacs using per-line/character commands, you're definitely not using emacs as efficiently as you could be.

So the distance in efficiency (and therefore efficacy) between mouse and keyboard is rather a gulf, once you've paid the cost of learning the extra emacs commands.

Re: Editing Code in Emacs

#37

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…

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.

Re: Editing Code in Emacs

#38

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…

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/

Re: Editing Code in Emacs

#39

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's really a selector or a filter. It's power comes from combining it with other tools.

Re: Editing Code in Emacs

#40
post #38

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…

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.

Post reply on HN