Skip to content

Commit

Permalink
Merge branch 'python-posix'
Browse files Browse the repository at this point in the history
  • Loading branch information
laktak committed May 21, 2024
2 parents d9a4211 + b0b4c17 commit bbc713a
Show file tree
Hide file tree
Showing 7 changed files with 489 additions and 556 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
run: |
curl -LsS -o ~/shfmt https://github.com/mvdan/sh/releases/download/v3.1.2/shfmt_v3.1.2_linux_amd64
chmod +x ~/shfmt
~/shfmt -d scripts/ extrakto.tmux
~/shfmt -p -d scripts/ extrakto.tmux
- name: tests
run: |
python3 -m unittest discover -s tests/
13 changes: 5 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# extrakto for tmux

**Please test the new [python-posix](https://github.com/laktak/extrakto/tree/python-posix) branch - it no longer requires Bash, which was requested for macOS:** `set -g @plugin 'laktak/extrakto#python-posix'`

![intro](https://github.com/laktak/extrakto/wiki/assets/intro1.gif)

**Output completions** - you can complete commands that require you to retype text that is already on the screen. This works everywhere, even in remote ssh sessions.
Expand All @@ -25,14 +23,13 @@ Use it for paths, URLs, options from a man page, git hashes, docker container na
- [tmux](https://github.com/tmux/tmux) - popups require 3.2, otherwise extrakto will open in a split window.
- [fzf](https://github.com/junegunn/fzf)
- Python 3.6+
- Bash (tested with 5.0+, on macOS please `brew install bash` first)
or use the new python-posix branch without Bash
- a posix shell like Bash

Supported clipboards:

- Linux Xorg (xclip) and Wayland (wl-copy)
- macOS (pbcopy)
- WSL (aka "Bash on Windows")
- WSL
- *bring your own*, see the [Wiki](https://github.com/laktak/extrakto/wiki/) for examples (like termux)

## Installation with [Tmux Plugin Manager](https://github.com/tmux-plugins/tpm)
Expand Down Expand Up @@ -68,13 +65,13 @@ Add or look for special tips in our [wiki](https://github.com/laktak/extrakto/wi

## Options

To set any of these options write on your `~/.tmux.conf` file:
You can set any of these options by adding them to your `~/.tmux.conf` file:

```
set -g <option> "<value>"
```

Where `<option>` and `<value>` are one of the specified here below
Where `<option>` and `<value>` correspond to one of the options specified below

### Common Options

Expand Down Expand Up @@ -194,4 +191,4 @@ Thanks go to all contributors for their ideas and PRs!

**If you make a PR, please keep it small so that it's easier to test and review. Try to create one PR per feature/bug.**

Please run `black` if you change any python code and run `shfmt` if you change any bash files.
Please run `black` if you change any python code and run `shfmt -p` if you change any shell files.
20 changes: 13 additions & 7 deletions extrakto.tmux
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
#!/usr/bin/env bash
#!/bin/sh

CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
script_dir=$(dirname "$0")
script_dir=$(
cd "$script_dir"
pwd
)

source "$CURRENT_DIR/scripts/helpers.sh"
extrakto_open="$CURRENT_DIR/scripts/open.sh"
. "$script_dir/scripts/helpers.sh"

extrakto_key=$(get_option "@extrakto_key")
extrakto_open="$script_dir/scripts/open.sh"
extrakto_key=$(get_option "@extrakto_key" "tab")

if [[ $(echo $extrakto_key | tr [:upper:] [:lower:]) != none ]]; then
tmux bind-key ${extrakto_key} run-shell "\"$extrakto_open\" \"#{pane_id}\""
lowercase_key=$(echo $extrakto_key | tr '[:upper:]' '[:lower:]')

if [ "$lowercase_key" != "none" ]; then
tmux bind-key "${extrakto_key}" run-shell "\"$extrakto_open\" \"#{pane_id}\""
fi
Loading

0 comments on commit bbc713a

Please sign in to comment.