Giter Club home page Giter Club logo

marker's Introduction

marker

Do you heavily use Ctrl+R(search through history) to search for commands that you frequently use?
Marker lets you easily bookmark these commands and quickly retrieve them without going through Shell Aliases/Functions/Multiple Ctrl-R...
It offers the following features:

  • A UI selector that lets you easily select the desired command if more than one command is matched.
  • Fuzzy matching (rather than Ctrl-R exact match).
  • Aliases: listen port can be expanded into sudo netstat -nlp | grep.
  • Command templates: Marker lets you bookmark commands with place-holders and easily place the cursor at those place-holders.
  • Portability across supported shells: you can use bookmarked commands in both Bash and Zshell.

command-template

Usage

Simplicity is key, Three keyboard shortcuts let you take most of Marker:

  • Ctrl-k: Mark the current written string in the command line.
  • Ctrl-space: search for commands that match the current written string.
  • Ctrl-t: place the cursor at the next placeholder, identified by '%%'
  • marker remove: remove a bookmark

ScreenShot

Requirements

  • python (2.7+ or 3.0+)
  • Bash-4.3+ or Zshell.
  • Linux Or OSX

#####Note: In OSX, it seems like Bash 3.x is the default shell which is not supported. you have to update your Bash to 4.3+ or change your shell to zshell in order to use Marker.

Installation

  • mkdir ~/.marker && cd ~/.marker or go wherever you want to install Marker
  • git clone https://github.com/pindexis/marker .
  • ./install.py

How It Works:

Marker is a composed of shell script, and a python tool:
The shell code acts as a wrapper around that python tool, it's responsible for managing the user input in the command-line(adding/removing text, moving the cursor around etc...).
The python utility in the other hand(called marker) contains the app logic. It manages the bookmarked data, do the matching, and present a UI selector if it's called in interactive mode. It doesn't depend on the Shell script, so it can be called separately as a command line utility(marker --help)

The communication between the shell script and the python commandline tool is done via a temporary file. For example, here's how things work when Ctrl+space is pressed:

  • A shell code executes, calling 'marker' tool in non-interactive mode(without displaying UI selector) passing as argument the written string in the commandline and a file path where the matched commands will be stored. The python tool will then determine the commands that match the given string and stores them in the file that was passed as an argument.
  • The shell script will then parse that file. if there is only one command there, It will replace the current string written on the command-line by that command. If there is more than one command returned, It calls the python tool again in Interactive mode, where a UI selector will be shown that allows the user to select the desired command. The user selected command will be stored in the file passed as an argument and displayed in the command-line. (The reason of this approach is to avoid creating a new command-line prompt when there is only one match, but rather work on current prompt).

You can take a look at bin/marker.sh for more details. Most magic happens there.

License

MIT

marker's People

Contributors

pindexis avatar

Watchers

Youm 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.