autopair.fish icon indicating copy to clipboard operation
autopair.fish copied to clipboard

Auto-complete matching pairs in the Fish command line

autopair.fish

Auto-complete matching pairs in the Fish command line.

Automatically insert, erase, and skip matching pairs as you type in the command-line: (), [], {}, "", and ''. E.g., pressing ( inserts () and positions the cursor in between the parentheses. Hopefully.

  • Insert matching pairs.

    $ echo ⎒ # Let's say βŽͺ is the cursor!
    

    " πŸ₯Š

    $ echo "βŽͺ"
    
  • Erase pairs on backspace:

    $ echo "HeyβŽͺ"
    

    Backspace πŸ₯ŠπŸ₯ŠπŸ₯Š

    $ echo "βŽͺ"
    

    Backspace πŸ₯Š

    $ echo βŽͺ
    
  • Skip over matched pairs:

    $ echo "HeyβŽͺ"
    

    " πŸ₯Š

    $ echo "Hey"βŽͺ
    
  • Gracefully handle Tab completions for variables while inside double quotes.

    $ echo "$fish_color_βŽͺ"
    

    Tab πŸ₯Š

    $ echo "$fish_color_βŽͺ
    "$fish_color_autosuggestion   (Variable: '555' 'brblack')
    "$fish_color_cancel           (Variable: -r)
    "$fish_color_command          (Variable: blue)
    "$fish_color_comment          (Variable: red)
    ...
    

Installation

Install with Fisher:

fisher install jorgebucaran/autopair.fish

License

MIT