![]() It’s a tiny example of ‘automating toil’, but it makes me smile whenever I save a second. Now while I’m doing red-green-refactor I’m able to save time with fewer clicks. Applescript code block in automator System prefs showing how to set a keyboard shortcut for an action It’s been baked into osx for forever and it’s fairly readable. This is written in a funny little scripting language called applescript. I set the shortcut to be command f3, so now I can run my tests without taking my hands off the keyboard (and in one shortcut!) I also had to make sure vscode wasn’t using that shortcut. It’s really simple: I set up an automator task that switches to iTerm, presses the up arrow, and then presses enter. Idea: use a system-wide keyboard shortcut to re-run the last command in the terminal. That was better, but now I needed to use my mouse or a bunch more shortcuts in order to switch to iTerm, press up to get the previous command, and then switch back to the code to start fixing. Last week I stopped using the vscode terminal and started using iTerm again. I played with turning my monitor, but that felt pretty bad for my neck and didn’t make me feel better about my layout. That means I can’t get much height out of it unless my code window is tiny. One thing I really don’t like is that the terminal has to be fixed to the bottom. I'm unable to find a solution for adding redo in bash or readline, so if anyone know a solution for either of those, please comment below and I'll try to add them in.įor anyone looking for the lookup table on how to convert key sequences to hex, I find this table very helpful.I’m still tweaking my screen layout in vscode a lot. $ echo 'bindkey "^X\\x7f" backward-kill-line' > ~/.zshrc # binds hex 0x18 0x7f with deleting everything to the left of the cursor $ echo 'bindkey "^U" backward-kill-line' > ~/.zshrc ⌘+ ←Delete and ⇧+ ⌘+ Z/ ⌘+ y by running: # changes hex 0x15 to delete everything to the left of the cursor, Actions An action consists of something to do (such as open a new window) with a name, called its title. The Actions Menu and Snippets Menu status bar components. ⇧+ ⌘+ Z or ⌘+ y Send Hex Codes: 0x18 0x1fįor zsh, you can setup binding for the not yet functional There are various places in the UI where you can activate shortcuts: The Shortcuts toolbelt tool. Redo typically not bound in bash, zsh or readline, so we can set it to a unused hexcode which we can then fix in zsh ⌥+ fn ←Delete or ⌥+ Delete→ Send Hex Codes: 0x1b 0圆4 ⌘+ fn+ ←Delete or ⌘+ Delete→ Send Hex Codes: 0x0bĠx1b 0x08 Breaks in Elixir's IEX, seems to work fine everywhere elseĠx17 Works everywhere, but doesn't stop at normal word breaks in IRB and will instead delete until it sees a literal space. I personally use this and then overwrite my zsh bindkey for ^U to delete only stuff to the left of the cursor (see below).Ġx18 0x7f Less compatible, doesn't work in node and won't work in zsh by default, see below to fix zsh (bash/irb/pry should be fine), performs desired functionality when it does work.ĭelete all characters right of the cursor Open the iTerm preferences ⌘+, and navigate to the Profiles tab (the Keys tab can be used, but adding keybinding to your profile allows you to save your profile and sync it to multiple computers) and keys sub-tab and enter the following:Ġx15 More compatible, but functionality sometimes is to delete the entire line rather than just the characters to the left of the curser. ![]() I verified that this works in ZSH, Bash, node, python -i, iex and irb/pry sessions (using rb-readline gem for readline, but should work for all). I see there's a lot of good answers already, but this should provide the closest to native OSX functionality as possible in more than just your shell.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |