GithubHelp home page GithubHelp logo

shi2wei3 / tmux-url-select Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dequis/tmux-url-select

2.0 1.0 2.0 10 KB

Keyboard based URL selector that integrates with tmux

License: MIT License

Perl 100.00%

tmux-url-select's Introduction

tmux-url-select

tmux-url-select is a perl script that lets you select URLs with the keyboard.

It integrates with tmux to capture the current pane buffer, switch to a window with highlighted links, and let you select the link you want to open/yank.

It's like the urxvtperls url-select script or urlview, except that it's inspired by the interface of the former and the capture-pane method usually used with the latter.

Features

  • Tightly integrated to tmux to prevent flickering when switching to url selection
  • No dependencies (Not even ncurses, so no portability either!)
  • Uses colors! Configurable colors!
  • Configurable external commands too!
  • vi-like keybindings (actually just j and k)

Is it any good?

Yes

Huge animated GIF

Requirements

Depends on perl, tmux and stty.

Optional and configurable: xdg-open (can be any url opener or browser) and xclip (for yank)

Installation

Place it somewhere in your path with name tmux-url-select and chmod +x it.

Add this to your .tmux.conf:

bind some-key-here run tmux-url-select

Where some-key-here is any key you want to use to start url selection. Personally I use "z" which is an unused keybinding that is really close to my tmux prefix key (`)

bind z run tmux-url-select

Usage

Once you're inside tmux-url-select, keybindings:

  • j or down arrow: down
  • k or up arrow: up
  • 0-9: select link by number
  • y: yank (copy to clipboard)
  • Enter or o: open link
  • Y / O: yank or open link without closing
  • q: quit

Configuration

There's a bunch of constants near the top of the file, you can modify them to your liking.

use constant COMMAND => 'xdg-open %s';
use constant YANK_COMMAND => 'echo %s | xclip -i';

use constant SHOW_STATUS_BAR => 1;
use constant VERBOSE_MESSAGES => 0;
use constant TMUX_WINDOW_TITLE => 'Select URL';

use constant PROMPT_COLOR => "\033[42;30m";
use constant ACTIVE_LINK_HIGHLIGHT => "\033[44;4m";
use constant NORMAL_LINK_HIGHLIGHT => "\033[94;1;4m";

Probably should add some explanations. Maybe. For now just go ahead and experiment with stuff.

Known issues

If a line with a link has a background color, it will get reset after the link. I have no idea how to do this without writing a parser of ansi escape codes or using ncurses properly, so I'm leaving it unfixed as a reminder that as humans we're all flawed in different ways.

Might flicker when selecting links because the whole screen is redrawn. It can't be helped. Works fine for me most of the time.

There used to be a section here about problems launching process but that should be fixed now.

FAQ

Q: Why perl? It's dead and it sucks, cool kids use node.js nowadays.

A: It's fun. Fun things are fun.

tmux-url-select's People

Contributors

dequis avatar nijotz avatar shi2wei3 avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

alex8866 lexfork

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.