pisces ☯ 双鱼
pisces ['paɪsiz]
is a plugin for fish that helps you to work with paired symbols like ()
and ''
in the command line. Similar to your favorite text editor!
Features
Here |
denotes the current cursor position. No manual cursor motion involved
- autocloses pair symbol:
... |
+ ( ⇒... (|)
- skips the closing symbol:
...|)
+ ) ⇒... )|
- removes empty pairs:
...([|])
+ backspace ⇒...(|)
+ backspace ⇒...|
- the set of pairs is configurable (see below)
Installation
Notes on fish 2.x compatibility
The minimum recommended version of fish is v2.6, because
- it has a feature called bracketed (a.k.a safe) paste which solves the problem with pasting strings containing paired symbols (they get autoclosed), see #6 for details.
The minimum required version of fish is v2.3, because
- there was a bug #2210 in v2.2 which would brake quotes handling
- it uses
string
builtin which was introduced in v2.3
-
Using Fisher:
fisher install laughedelic/pisces
-
Using oh-my-fish:
omf install pisces
Notice that you will need to restart fish to get this new installation working. This is specific to the way oh-my-fish handles installation.
Configuration
Only completing at the end of the line
To disable completing pairs unless the cursor is at the end of the line, set the $pisces_only_insert_at_eol
variable:
set -U pisces_only_insert_at_eol 1
Changing the set of pairs
You can set the $pisces_pairs
universal variable and launch a new fish session to reload key bindings:
set -U pisces_pairs $pisces_pairs '<,>' '`,`' '«,»'
Note that at the moment pisces works correctly only with single-symbol delimiters.
The default set of pairs:
(,)
parenthesis[,]
brackets{,}
braces","
double quotes','
single quotes