Code Monkey home page Code Monkey logo

marker's Introduction

Marker

marker

Marker is a command palette for the terminal. It lets you bookmark commands (or commands templates) and easily retreive them with the help of a real-time fuzzy matcher.

It's also shipped with many commands common usage(Thanks to tldr).

Features:

  • A UI selector that lets you easily select the desired command if more than one command is matched.
  • Fuzzy matching (through commands and their descriptions).
  • Command template: You can bookmark commands with place-holders and place the cursor at those place-holders using a keyboard shortcut.
  • Portability across supported shells: you can use bookmarked commands in both Bash and Zshell.

Usage

  • Ctrl-space: search for commands that match the current written string in the command-line.
  • Ctrl-k (or marker mark): Bookmark a command.
  • Ctrl-t: place the cursor at the next placeholder, identified by '{{anything}}'
  • marker remove: remove a bookmark

You can customize key binding using environment variables, respectively with MARKER_KEY_GET, MARKER_KEY_MARK and MARKER_KEY_NEXT_PLACEHOLDER.

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

git clone --depth=1 https://github.com/pindexis/marker ~/.marker && ~/.marker/install.py

License

MIT

marker's People

Contributors

antham avatar deagon avatar dongminkim avatar luboszk avatar pindexis avatar rsepassi avatar selfish avatar tzutalin avatar yurivm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

marker's Issues

iterm compatibility

I'm getting three copies of the possible commands rendered in iterm after a control space, in a typical 80x25 iterm window. Mojave 10.14.3, Bash 4.4.19(1), iTerm 2.1.4

marker doesn't work well with aliased grep commands

Every time I use ctrl+t, I get the following error message, which prevents me from further editing the current command line:

grep: conflicting matchers specified

I'm on marker commit 9bd181db2f6e10d9d74b45cbc00ab3553fe89c4a, with zsh version 5.2.

Fish shell compatibility

I use fish and want to know what the status of marker on fish is - are you planning a port, or not planning but you'll allow for patches to be merged, or do not want fish patches to be merged (and so I should fork the project)?

Add intelligent placeholder

Hi,

I find myself reentering the same text string over and over again.
Would it be possible for you to make placeholder references ?

For example when doing

  touch %1 && chmod +x %1

Only filling the first placeholder would be enough, the second one being filled automatically.

How to delete a Marked command ?

I added a marked command, but I don't want it anymore. Where can I find the folder where my commands are saved ? or how can I delete it ?

Persist bookmarks accross computers

Hi,

I'm used to store loads of stuff on github to share them accross computers. Bookmarks are stored in ~/.local/share/marker along with

  • the txt file used by the shell script and the python script to communicate, which is bound to change all the time.
  • the sh file that holds exports and a source instruction.

It's not very convenient because I cannot init a git repository in this directory.

Would it be possible to extract the marks.txt definition file from this directory to place it in $HOME/.marker or any other place ?

commands not populated

I followed the install instructions. But when I git ctrl+space after a command. I don't see the list. I only see (arg: 1) <commnd> and then if I take an action it goes back to prompt.
screen shot 2016-04-06 at 1 39 23 pm
Iterm 2.9
OSX
Bash 4

configurable config dir

The configuration dir is hardcoded:

config_dir_relative_path = '.local/share/marker'

There should be an option at install time to change it. I, for one, would prefer $XDG_CONFIG_HOME/marker/.

Tab in shell is starting a new mark

In zsh if I do a TAB it starts a new mark:
~> ls TAB
turns into
~> marker mark --command='ls '
command: ls
Alias?:

Is there a way to reconfigure so TAB doesn't start a new mark?

Traceback when marker is called with no arguments

Maybe the help text should be shown instead?

dotfiles ➤ marker
Traceback (most recent call last):
  File "/home/siddharthist/.local/share/marker-git/bin/marker", line 65, in <module>
    parse_arguments()
  File "/home/siddharthist/.local/share/marker-git/bin/marker", line 31, in parse_arguments
    return args.func(args)
AttributeError: 'Namespace' object has no attribute 'func'

Split tldr/linux.txt into distribution-specific files

The current linux.txt includes commands that are geared towards Debian/Ubuntu installations (e.g. apt-get), but are not useful in other distros such as Arch, Redhat, etc.

Rather than assume one particular flavor of Linux, instead it might be useful to try and detect which flavor of Linux the user is using, and then load a distro-specific template, if one exists. If not, then fall back on a distro-agnostic file which contains only commands that do not depend on the specific distro the user is using (so no package manager commands, for example).

To avoid redundancy, you might consider adding a second layer of "common" commands -- this way you could load a linux_common.txt + linux_<distro>.txt (if the distro is known and supported).

Interested users of alternative distros could then submit PR's with distro-specific commands.

It doesn't work with multi-line commands

Like this one:

aria2c -Z ${(f):-'http://30nama.download/download/5570060627:3456113055:305576221:231c5f85d2244b8307b0f56e362153562fe12c39/1/12267/series/teenage_mutant_ninja_turtles_2003/Teenage_Mutant_Ninja_Turtles_2003_S03E01_DVDRip_30NAMA.mkv
http://30nama.download/download/5570060627:3456113055:305576221:231c5f85d2244b8307b0f56e362153562fe12c39/1/12267/series/teenage_mutant_ninja_turtles_2003/Teenage_Mutant_Ninja_Turtles_2003_S03E02_DVDRip_30NAMA.mkv
http://30nama.download/download/5570060627:3456113055:305576221:231c5f85d2244b8307b0f56e362153562fe12c39/1/12267/series/teenage_mutant_ninja_turtles_2003/Teenage_Mutant_Ninja_Turtles_2003_S03E03_DVDRip_30NAMA.mkv
http://30nama.download/download/5570060627:3456113055:305576221:231c5f85d2244b8307b0f56e362153562fe12c39/1/12267/series/teenage_mutant_ninja_turtles_2003/Teenage_Mutant_Ninja_Turtles_2003_S03E04_DVDRip_30NAMA.mkv
http://30nama.download/download/5570060627:3456113055:305576221:231c5f85d2244b8307b0f56e362153562fe12c39/1/12267/series/teenage_mutant_ninja_turtles_2003/Teenage_Mutant_Ninja_Turtles_2003_S03E05_DVDRip_30NAMA.mkv
http://30nama.download/download/5570060627:3456113055:305576221:231c5f85d2244b8307b0f56e362153562fe12c39/1/12267/series/teenage_mutant_ninja_turtles_2003/Teenage_Mutant_Ninja_Tur'}

Marker should catch all KeyboardInterrupts and fail silently

This shouldn't happen, it should just exit quietly.

dotfiles ➤  marker mark --command='***'
command: ***
Alias?:^CTraceback (most recent call last):
  File "/home/siddharthist/.config/marker/bin/marker", line 65, in <module>
    parse_arguments()
  File "/home/siddharthist/.config/marker/bin/marker", line 31, in parse_arguments
    return args.func(args)
  File "/home/siddharthist/.config/marker/bin/marker", line 35, in cmd_mark
    core.mark_command(args.command, None)
  File "/home/siddharthist/.config/marker/bin/../marker/core.py", line 46, in mark_command
    alias = keyboard_input("Alias?:")
KeyboardInterrupt

Incompatible with aliased rm

I have in my zshrc:
alias rm='echo "This is not the command you are looking for."; false'
to prevent me absent mindedly using rm instead of trash-cli.

marker is incompatible with this alias.
Changing line 42 in marker.sh to \rm -f $tmp_file seems to fix it.

TypeError: cannot use a string pattern on a bytes-like object

When trying to run install.py, i get this error:

Traceback (most recent call last):
  File "./install.py", line 109, in <module>
    main()
  File "./install.py", line 81, in main
    verify_requirements()
  File "./install.py", line 61, in verify_requirements
    m = re.search('(\d).(\d)', version_text)
  File "/usr/lib/python3.5/re.py", line 173, in search
    return _compile(pattern, flags).search(string)
TypeError: cannot use a string pattern on a bytes-like object

On my system, when using pipes, i do sometimes get this weird error message (line 2 below). I haven't been able to figure out the cause, but i haven't seen any side effects from it before now, so i don't know if it is the problem here:

$ bash --version | head -1
bash: child setpgid (20301 to 20297): Operation not permitted
GNU bash, version 4.3.42(1)-release (x86_64-unknown-linux-gnu)

Here's what i get in the REPL:

$ python
Python 3.5.0 (default, Sep 20 2015, 11:28:25) 
[GCC 5.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import subprocess
>>> subprocess.Popen("bash --version | head -1", shell=True, stdout=subprocess.PIPE).stdout.read()
b'GNU bash, version 4.3.42(1)-release (x86_64-unknown-linux-gnu)\n'

Unescaped left brace in regex is deprecated, passed through in regex

I've installed marker on OSX + zsh following the instructions, now when I'm pressing Ctrl-T getting following error on terminal screen:

Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/{{ <-- HERE .+?}}/ at -e line 1.

What could be possible reason for this error and how I can fix it?

PS. I've tried both iTerm and Terminal.

Uninstall script

Currently, the recommended way to install is running the install.py script. But there is no script to run uninstallation.

Release

Any way you could package up a release?

Pipes and redirection

For composing multiple commands, it'd be useful if one could do something like the following:

curl http://some-url.com/ | grep links<ctrl+space>

... where it would then search for grep links (but not the curl command before it), and then upon completion, result in something like this:

curl http://some-url.com/ | grep -E 'https?:\/\/[^ ]+'

... so, in effect, only autocompleting the command you're currently writing - the same for > redirection.

This doesn't seem currently implemented, unless there's something I'm missing?

Great job otherwise, by the way :)

Doesn't respond to the hotkeys

Hey,

this software is exactly what I'm looking for! Unfortunately it's not responding after the installation. When i press CTRL + space within bash with or without a command typed in, nothing happens. I've changed the key binding according to the workaround from pindexis (#28) but nothing changed.

Ubuntu 16.04.5 LTS 64-bit
GNU bash, version 4.3.48(1)-release (x86_64-pc-linux-gnu)

I'm looking forward to any advice!
Max

Default keybindings override useful ones

I very often use Ctrl-T (swap characters, super useful when your fingers are faster than your brain, esp. in the morning :), and Ctrl-K (delete from cursor to end of line) when editing a command.

Might I thus suggest to switch the default bindings to some less "useful" combinations? e.g. Ctrl-B to "Bookmark" (Ctrl-B just moves the cursor to the left), and Ctrl-G to "Go to next placeholder" (Ctrl-G just beeps)

Readme inconsitency.

In the README you put Ctrl-Space as the default key binding to invoke marker get, but looking at the code, is actually Ctrl-@

marker_key_get=${MARKER_KEY_GET:-'\C-@'}

Just that. Great work, very useful.

marker update claims there are arguments even if none are given

marker update<Enter>
Traceback (most recent call last):
  File "/home/pawel/.marker/bin/marker", line 65, in <module>
    parse_arguments()
  File "/home/pawel/.marker/bin/marker", line 31, in parse_arguments
    return args.func(args)
TypeError: cmd_update() takes no arguments (1 given)

os x grep

marker.sh (line 118):
match=$(echo "$READLINE_LINE" | grep -ohP '{{.+?}}' | head -n 1)

There is no option "-P" in os x grep.

zsh bug

With lash version of zsh i have double output like this:

 kvokka@kvokka-PC  ~                                                     1 ↵  3959  16:00:16 
search for: 
 apt-cache depends {{package}} Show dependencies for a package
 apt-cache policy {{package}} Show whether a package is installed and up to date
 apt-cache rdepends {{package}} Show packages that depend on a particular package
 apt-cache search {{query}} Search for a package in your current sources
 apt-cache show {{package}} Show information about a package
 apt-get dist-upgrade Upgrade installed packages (like "upgrade"), but remove obsolete packages and install additional packages to meet new dependencies
 apt-get install {{package}} Install a new package
 apt-get remove {{package}} Remove a package
 apt-get update Synchronize list of packages and versions available. This should be run first, before running subsequent apt-get commands
search for: 
 apt-cache depends {{package}} Show dependencies for a package
 apt-cache policy {{package}} Show whether a package is installed and up to date
 apt-cache rdepends {{package}} Show packages that depend on a particular package
 apt-cache search {{query}} Search for a package in your current sources
 apt-cache show {{package}} Show information about a package
 apt-get dist-upgrade Upgrade installed packages (like "upgrade"), but remove obsolete packages and install additional packages to meet new dependencies
 apt-get install {{package}} Install a new package
 apt-get remove {{package}} Remove a package
 apt-get update Synchronize list of packages and versions available. This should be run first, before running subsequent apt-get commands
 apt-get upgrade Upgrade installed packages to newest available versions

Keybindings not working on Ubuntu 12.04.5 LTS via PuTTY

Trying to hit Ctrl-Space or Ctrl-K ...

bash: bash_execute_unix_command: cannot find keymap for command
$  bind -s
"\C-@": "\emg1\emgn\emg2\C-t"
"\C-k": "\emm1\C-j\emm2"
$ bash -version
GNU bash, version 4.2.25(1)-release (i686-pc-linux-gnu)

Unescaped left brace in regex is deprecated

When I push ctrl + t I get the following error:

Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/{{ <-- HERE .+?}}/ at -e line 1.

Using Ubuntu 16.04 that comes with Perl 5 version 22. Bash version 4.3.46.

Where are the customized actions saved?

Hi,

Just want to know if I saved a command using marker, where can I find the file which contains this command.

I try to trace through the source code by myself, but I'm not an expert in python or shell. Hope someone can help me out.

Thank you again for this amazing project!

Selection Bug

When trying to select something the screen doesn't clear

iTerm 2.1.1
OSX 10.10.2
Python 2.7.8
zsh 5.0.5 (x86_64-apple-darwin14.0)

deploy via package manager (brew, apt, yum...)

Mac OS users can manage all their packages and binary installations with homebrew, its a huge convenience for updating packages and for migrating to other machines.

example package tmux

The well-known tmux utility is hosted on github here: https://tmux.github.io/

Here is the ruby formula for package tmux, you can manage target machine type and dependencies can all be loaded automatically by brew.

Here is (i think) the homebrew starting point for contributing a package.

I've never done this myself, but I think the same is true for packages on ubuntu and other platforms -- its better to distribute via the package manager.

Install gives error on Yosemite

I've upgraded bash to 4.x and echo $BASH_VERSION prints 4.3.33(1)-release but doing a ./install.py I get this error:
Couldn't extract bash version, please report the issue
Installation failed

on reboot "warning: line editing not enabled"

After installation I get on restart a warning for all the 'bind' command lines in marker.sh; something like:
marker.sh: line 143: bind: warning: line editing not enabled
etc (for line 144, etc.)

Do you have a solution for this?

ImportError: No module named 'string_score'

After marker upgrade I am getting error

ImportError: No module named 'string_score'

Ubuntu 14.04 pyenv with python 3.4

pip install string_score

Collecting string-score
  Could not find a version that satisfies the requirement string-score (from versions: )
No matching distribution found for string-score

What am I doing wrong?

Could you allow custom mappings

Hi,

Ctrl + t is built-in in the terminal, so is Ctrl + k. Would it be possible for you to allow one to choose the keys the actions are bound to ?

Thanks in advance

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.