GithubHelp home page GithubHelp logo

alin23 / pisces Goto Github PK

View Code? Open in Web Editor NEW

This project forked from laughedelic/pisces

0.0 3.0 0.0 30 KB

♓️Fish shell plugin that helps you to work with paired symbols in the command line

License: Other

Shell 100.00%

pisces's Introduction

pisces ['paɪsiz] is a plugin for fish that helps you to work with paired symbols like () and '' in the command line. Just as in 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

Installation

NOTE:
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

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

Roadmap

Here are some ideas for further development (some are already implemented):

  • autoclosing:

    • ignore closing " when trying to autocomplete a var (see v0.3.0)
    • #5 (WIP): context-dependent autoclosing. Some particular cases:
      • ? autoclose only when surrounded by non-word characters
      • ignore escaped symbols: ...\| + ( => ...\(| (or autoclose them?)
      • ? ignore single quote (apostrophe) in the comments
      • multi-character pairs, similar to simple code-snippets: for | end, if | end, begin; |; end, etc.
  • empty pairs removal:

    • treat pair as empty if it has only whitespaces inside: ...(| ) + backspace...|
    • remove an empty pair even when the cursor is after it (or go inside?): ...()| + backspace...| or ...(|) (this is probably confusing)
    • key bindings for ^W and similar? foo bar(|) + ctrlwfoo |
  • optional alt+symbol keybindings that do something else, for example:

    • surround the current token
    • just insert single symbol
    • jump after the closing symbol
  • #3: support for vi-mode

  • autoreload on the $pisces_pairs var changes

  • restore previous keybindings instead of erasing them

If you have any other ideas or feature requests, feel free to open an issue or just write me in the chat.

pisces's People

Contributors

laughedelic avatar terlar avatar alin23 avatar

Watchers

James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.