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. This enables all sorts of cool features: you can easily navigate to previous shell prompts with and. $ echo 'bindkey "^X\\x7f" backward-kill-line' > ~/.zshrc iTerm2 can integrate with your shell so it knows where your shell prompt is, what commands you're entering, which host you are on, and what your current directory is. # 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, ⇧ ⌘ Z or ⌘ y Send Hex Codes: 0x18 0x1fįor zsh, you can setup binding for the not yet functional 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). Write tests (I guess I need to do that.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.Improve protocol support checking (need to test in various terminal).Work on handling transparency/GIFs with Sixel protocol (GIFs work but don't render well).Make releases/packages (publish on crates.io).iTerm protocol always loop GIFs, except if -static is specified.Sixel protocol may require libsixel to be installed.p, -protocol Previewing protocol to use -load Load image with the given id (kitty only ) -display Display image with the given id (kitty only ) -clear Clear image with the given id ( 0 for all ) (kitty only ) -h, -help Print helpįn main ( ) Notes s, - static Only show first frame of GIFs Options : -x, -x x position ( 0 is left ) -y, -y y position ( 0 is top ) -c, -cols Number of cols to fit the preview in -r, -rows Number of rows to fit the preview in -u, -upscale Upscale image if needed Ĭommand line instructions # Build and installĬommand line instructions # Add the dependency in your project directoryĬommand line usage Preview Image in CLI. Pic Images/YourFavouriteImage.png -cols 13. -load -display and -clear options to interact with Kitty protocolĬommand line instructions # Clone the repository.-static and -loop options to interact with GIFs. -upscale option to preview image at full wanted size if needed.-cols and -rows options to choose the size of your image (always tries preserving ratio).-x and -y options to choose where to display your image.Unicode blocks with truecolor/ansi256 support otherwise.iTerm which displays GIFs incredibly well.Sixel which works in a lot of terminals.Kitty graphics with multiple actions available ( load/ clear).PIC also provides a library for you to use in your own tools! Features With support for various image protocols ( Kitty, Sixel, iTerm) it works in several terminals, and can still use Unicode blocks in case your terminal isn't supported. PIC ( Preview Image in CLI ) is a lightweight Rust tool to preview images in your terminal! # 147 in #command-line Download history 55/week 26/week 2/week
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |