![]() 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. $ echo 'bindkey "^Xx7f" backward-kill-line' > ~/.zshrc # binds hex 0x18 0x7f with deleting everything to the left of the cursor $ echo 'bindkey "^U" backward-kill-line' > ~/.zshrc 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įor zsh, you can setup binding for the not yet functional ⌘+←Delete and ⇧+⌘+Z/⌘+y by running: # changes hex 0x15 to delete everything to the left of the cursor, ⌥+fn←Delete or ⌥+Delete→ Send Hex Codes: 0x01b 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. Remove the mappings for key combinations ⌥ + ← and ⌥ + →.To jump between words and start/end of lines in iTerm2 follow these steps: ĭon't forget to remove the previous bindings : In order to get Alt+left/right arrow working correctly for word jumping follow this article.Īdd in iTerm2 the following Profile Shortcut Keys FOR ACTION SEND How to change this to Cmd+left/right arrow? Let’s help each other to get smarter and more productive.I can see that Ctrl+left/right jumps to the beginning/end of line. That post is just a collection of random terminal tricks so if you know some more please put it in the comment. Then restart terminal (or source the file) and you’re done! Just add that to your ~/.bashrc : export HISTTIMEFORMAT="%d/%m/%y %T " Configure iTerm 2 If you already setup your subl command, just go to your iterm 2 Preferences change the dropdown to Always run command. If you ever tried to run history command, then you noticed that there is a plain list of commands without dates. Just a quick timesaver: Jump from stack traces in iTerm 2 straight to the right location in Sublime Text 3. Run it and youll see that it will divide the terminal into two horizontal sessions. usr/bin/osascript tell application 'iTerm2' tell current session of current tab of current window split horizontally with default profile end tell end tell. Create a file sessions.scpt with the content below. I use it every time I need to copy the content of a file. Lets now automate creation of multiple sessions. It’s a nice hint to copy output from the previous command. If you want to re-enable them for the terminal Terminal -> Preferences -> Keyboard Check Use Option as Meta key my iTerm2 version is 3.1.6. It is extremely useful when you do a few operations with one file or folder and you don’t want to type it every time. It is getting last argument from the previous command and paste it where cursor is. It’s another trick that I use all the time. That’s how you install iTerm2 Shell Integration Double-click on ⌥→ hotkey, for Action, choose send to escape sequence and write f in the input field. Preferences → Profile → Default → Keys - Choose Left option (⌥) Key acts as: +Esc - Double-click on ⌥← hotkey, for Action, choose send to escape sequence and write b in the input field. Thanks to Edward Robinson’s post we can fix it like this: In case you don’t know, it’s a native macOS shortcut to quickly move the cursor from word to word. For some reason it doesn’t understand alt + left arrow key combination out of the box. It’s a thing that you really should know if you are using iTerm2. I use it all the time, for example, when viewing logs with tail -f file.log. In iTerm2 this shortcut works like clear command. It’s convenient to quickly clear your input if you changed your mind about executing some command. ctrl + uĮrases current line from cursor to the beginning. It’s very handy to use with remote servers. And it will take you only 5 minutes to learn it all. I’ll help you to learn some of my best stuff that I’ve been gathering for years. If you’re still not sure that CLI (console line interface) is better than GUI, then you just don’t have enough practice with it. 11 hot terminal features you might not know about
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |