6 ms·
I end up using the built-in emacs key bindings a lot (they also work in many shells). Ctrl-k (cut to the end of the current line and save it in a special secre
by frankus 5y ago
I end up using the built-in emacs key bindings a lot (they also work in many shells).
Ctrl-k (cut to the end of the current line and save it in a special secret extra clipboard) and ctrl-y to paste
Ctrl-e to go to the end of a line, ctrl-a to go to the beginning.
Ctrl-d to forward-delete, ctrl-t to transpose characters (this rarely saves time but I do it anyway).
You can also use ctrl with b, f, p, and n to go back or forwards one character or to the previous or next line, but I just use the arrow keys.
- ubercow13 5y agoThey don't work everywhere though, making them basically useless. For example ctrl+a and ctrl+e don't work in the Safari address bar or the text box I'm typing this comment in, or TextEdit, and many other native text widgets.
- reayn 5y agoFirst and foremost, they should work everywhere, especially the places you describe, almost every native widget (even in third party native apps) should support the readline bindings. If, however, you desire more control, you can use Karabiner-Elements [0] and one of the many [1] community made emacs-like configurations to have this behaviour system wide, these also add many many more keybinds (such as C-w to delete last word) to further emacsify your workflow! 1. karabiner-elements.pqrs.org 2. https://ke-complex-modifications.pqrs.org/?q=emacs https://ke-complex-modifications.pqrs.org/?q=emacs
- saagarjha 5y agoThey work for me? Do you have an app that might be eating those shortcuts?
- jjoonathan 5y agoThey work for me too on latest Safari, FF, and Chrome, and pretty much everywhere else. I'd actually flip the critique upside down: ctrl+aedfb are so useful precisely because they are deeply embedded in the lower layers of the OSX text system and therefore work almost everywhere.
- ubercow13 5y agoHm you're right, I thought about it after these replies and it seems they don't work because I'm using a nonstandard keyboard layout which seems to break them somehow. I'll have to work out how to fix that. Thanks.
- chrisfinazzo 5y agoFor the places it doesn't work well, you can usually guess the reason. TextEdit and Safari respond to Command as the primary modifier, the same as any other Cocoa application. (FWIW, I just tried this in TextEdit's plaintext mode on Big Sur and it does indeed work - more than likely due to the UNIX heritage, the emacs bindings work here too) It is well known that Command-L will focus the address bar and select any text that might be there, so overriding it is generally a bad idea if you can avoid it. The same goes for 3rd parties - my Dad is a recent convert to macOS and is frequently stumped when Control-A doesn't select text in Microsoft Word - I explained this to him, but in the moment he sometimes forgets.
- kps 5y agoYou're mixing up Command-A (select all) with Control-A (Emacs-style beginning of line). The biggest and best thing about MacOS shortcuts is that they don't stomp over typing ASCII controls.
- chrisfinazzo 5y agoI am well aware of the shortcuts and just recreated the effect I described in TextEdit... 1. Type a sentence in TextEdit 2. Ctrl-A will go to the beginning of the line 3. Ctrl-E moves the cursor to the end It's a native app, and will dutifully select all text with Command-A - but the other keys still do something. A paradox, to be sure. I do blame Microsoft for the confusion I described, but I'm not sure there's a way they can solve it among their Mac customers without doing as you mentioned and making someone else's life difficult.
- jjoonathan 5y agoCtrl+a / ctrl+e should be home/end everywhere on mac, and they generally are, which is to say they work everywhere. If a mac app has mapped ctrl+a to select-all, this should not be called "working." It is an abomination and should be purged from the universe hastily and with extreme prejudice before the cancer spreads. I understand and sympathize with the difficulty of moving between ctrl/cmd as super keys, but there are a hundred shortcuts with the same problem and forcing mac to adopt the poor keyboard choices of windows is not the answer.
- sodapopcan 5y agoThey work for me literally everywhere. I also add ctrl-w and ctrl-u.
- giraffe_lady 5y agoI use these bindings constantly every minute of every day. I know exactly which apps break it because it annoys the shit out of me, and those aren't the ones. You must have broken a configuration or have some other problem. I'm writing this in safari and can use these bindings in this text box and the address bar right now.
- amake 5y agoYou can get even more Emacs bindings by providing an appropriate ~/Library/KeyBindings/DefaultKeyBinding.dict; example: https://github.com/amake/dotfiles/blob/master/prefs/Library/KeyBindings/DefaultKeyBinding.dict https://github.com/amake/dotfiles/blob/master/prefs/Library/...
- jwr 5y agoYes, this is a fantastic feature of MacOS, and one that many people do not appreciate enough. It's so incredibly convenient to be able to use the same keys in every entry field. Unfortunately, more and more apps try to do something "smart" when you click in a text field, like auto-selecting the entire text (WHY WOULD YOU EVER DO THAT?). And some apps just don't respect the platform conventions and as a result feel incredibly clunky and annoying to use (Autodesk Fusion 360).
- criddell 5y agoFusion 360 is incredibly clunky and annoying on Windows as well.
- antipaul 5y agoctrl-n and ctrl-p also work to select things – so much closer than getting to the arrow keys ;) Examples: search results in safari, search results in GitHub.com search. Sadly, google chrome and apps like docs don't respect this
- __mharrison__ 5y agoIf you are on Windows, look into AutoHotkeys. There are various emacs scripts for this floating about. I've found that it gives me a better experience than I had on Mac.