From 85d13c49eede7b8e58e7eff5b42f66d7e7bb25f6 Mon Sep 17 00:00:00 2001 From: graelo Date: Tue, 2 Jun 2020 22:40:50 +0200 Subject: [PATCH 1/5] chore(ci): update workflow --- .github/workflows/rust.yml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 586e578..4032416 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -1,11 +1,19 @@ name: Rust -on: [push] +on: + push: + branches: + - '*' + pull_request: + branches: + - 'master' + +env: + CARGO_TERM_COLOR: always jobs: build-mac: runs-on: macos-latest - steps: - uses: actions/checkout@v2 @@ -17,9 +25,9 @@ jobs: name: copyrat-macos.zip path: ./target/release/*copyrat + build-linux: runs-on: ubuntu-latest - steps: - uses: actions/checkout@v2 From f9776364c69cc3497a154c9943d91a139e1e9cec Mon Sep 17 00:00:00 2001 From: graelo Date: Tue, 2 Jun 2020 22:26:06 +0200 Subject: [PATCH 2/5] chore(docs): update README --- README.md | 50 ++++++++++++++++++++++++-------------------------- 1 file changed, 24 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 63162b7..e8f3d6a 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -# tmux-thumbs +# tmux-copyrat -![](https://travis-ci.com/fcsonline/tmux-thumbs.svg?branch=master) +![Rust](https://github.com/graelo/tmux-copyrat/workflows/Rust/badge.svg) -A lightning fast version of [tmux-fingers](https://github.com/Morantron/tmux-fingers) written in [Rust](https://www.rust-lang.org/) for copy pasting with vimium/vimperator like hints. +A hommage to [tmux-copyrat](https://github.com/tmux-plugins/tmux-copycat), written in [Rust](https://www.rust-lang.org/) for copy pasting within [tmux](http://tmux.github.io). ## Usage @@ -38,20 +38,20 @@ more with `--regexp` parameter. Clone the repo: ``` -git clone https://github.com/fcsonline/tmux-thumbs ~/.tmux/plugins/tmux-thumbs +git clone https://github.com/graelo/tmux-copyrat ~/.tmux/plugins/tmux-copyrat ``` Compile it with [cargo](https://doc.rust-lang.org/cargo/getting-started/installation.html): ``` -cd ~/.tmux/plugins/tmux-thumbs +cd ~/.tmux/plugins/tmux-copyrat cargo build --release ``` Source it in your `.tmux.conf`: ``` -run-shell ~/.tmux/plugins/tmux-thumbs/tmux-thumbs.tmux +run-shell ~/.tmux/plugins/tmux-copyrat/tmux-copyrat.tmux ``` Reload TMUX conf by running: @@ -65,7 +65,7 @@ tmux source-file ~/.tmux.conf You can add this line to your list of [TPM](https://github.com/tmux-plugins/tpm) plugins in `.tmux.conf`: ``` -set -g @plugin 'fcsonline/tmux-thumbs' +set -g @plugin 'graelo/tmux-copyrat' ``` To be able to install the plugin just hit prefix + I. You should now be able to use @@ -73,26 +73,26 @@ the plugin! ## Configuration -If you want to customize how is shown your tmux-thumbs hints those all available +If you want to customize how is shown your tmux-copyrat hints those all available parameters to set your perfect profile. NOTE: for changes to take effect, you'll need to source again your `.tmux.conf` file. -* [@thumbs-key](#thumbs-key) -* [@thumbs-alphabet](#thumbs-alphabet) -* [@thumbs-reverse](#thumbs-reverse) -* [@thumbs-unique](#thumbs-unique) -* [@thumbs-position](#thumbs-position) -* [@thumbs-regexp-N](#thumbs-regexp-N) -* [@thumbs-command](#thumbs-command) -* [@thumbs-upcase-command](#thumbs-upcase-command) -* [@thumbs-bg-color](#thumbs-bg-color) -* [@thumbs-fg-color](#thumbs-fg-color) -* [@thumbs-hint-bg-color](#thumbs-hint-bg-color) -* [@thumbs-hint-fg-color](#thumbs-hint-fg-color) -* [@thumbs-select-fg-color](#thumbs-select-fg-color) -* [@thumbs-select-bg-color](#thumbs-select-bg-color) -* [@thumbs-contrast](#thumbs-contrast) +- [@copyrat-key](#thumbs-key) +- [@copyrat-alphabet](#thumbs-alphabet) +- [@copyrat-reverse](#thumbs-reverse) +- [@copyrat-unique](#thumbs-unique) +- [@copyrat-position](#thumbs-position) +- [@copyrat-regexp-N](#thumbs-regexp-N) +- [@copyrat-command](#thumbs-command) +- [@copyrat-upcase-command](#thumbs-upcase-command) +- [@copyrat-bg-color](#thumbs-bg-color) +- [@copyrat-fg-color](#thumbs-fg-color) +- [@copyrat-hint-bg-color](#thumbs-hint-bg-color) +- [@copyrat-hint-fg-color](#thumbs-hint-fg-color) +- [@copyrat-select-fg-color](#thumbs-select-fg-color) +- [@copyrat-select-bg-color](#thumbs-select-bg-color) +- [@copyrat-contrast](#thumbs-contrast) ### @thumbs-key @@ -291,8 +291,6 @@ This is the list of available colors: This is the list of available alphabets: -- `numeric`: 1234567890 -- `abcd`: abcd - `qwerty`: asdfqwerzxcvjklmiuopghtybn - `qwerty-homerow`: asdfjklgh - `qwerty-left-hand`: asdfqwerzcxv @@ -326,7 +324,7 @@ This is the known list of versions of `tmux` compatible with `tmux-thumbs`: | Version | Compatible | |:-------:|:----------:| -| 3.0a | ✅ | +| 3.0b | ✅ | | 2.9a | ✅ | | 2.8 | ❓ | | 2.7 | ❓ | From c4e7f1d1e3daca5dd07a520a0cf24acef98255ed Mon Sep 17 00:00:00 2001 From: graelo Date: Tue, 2 Jun 2020 22:26:23 +0200 Subject: [PATCH 3/5] chore(ci): remove travis.yml --- .travis.yml | 21 --------------------- 1 file changed, 21 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 294b316..0000000 --- a/.travis.yml +++ /dev/null @@ -1,21 +0,0 @@ -language: rust -cache: cargo -dist: trusty -os: - - linux - - osx - -rust: - - nightly - - stable - -before_script: - - rustup component add rustfmt - - cargo install --force cargo-audit - - cargo generate-lockfile - -script: - - cargo fmt --all -- --check - - cargo build - - cargo test - - cargo audit From 57ebb10331e5384bb5294ebbe5059d3fa43886bd Mon Sep 17 00:00:00 2001 From: graelo Date: Tue, 2 Jun 2020 23:05:35 +0200 Subject: [PATCH 4/5] chore(ci): update workflow --- .github/workflows/{rust.yml => rust-ci.yml} | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) rename .github/workflows/{rust.yml => rust-ci.yml} (87%) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust-ci.yml similarity index 87% rename from .github/workflows/rust.yml rename to .github/workflows/rust-ci.yml index 4032416..4169ec6 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust-ci.yml @@ -1,4 +1,4 @@ -name: Rust +name: Rust CI on: push: @@ -20,6 +20,9 @@ jobs: - name: Build run: cargo build --release + - name: Run tests + run: cargo test --verbose + - uses: actions/upload-artifact@v2 with: name: copyrat-macos.zip @@ -39,6 +42,9 @@ jobs: - name: Build run: cargo build --release + - name: Run tests + run: cargo test --verbose + - uses: actions/upload-artifact@v2 with: name: copyrat-linux.zip From 47f25a289340bafdf670c961e48a6c3c3f18af26 Mon Sep 17 00:00:00 2001 From: graelo Date: Tue, 2 Jun 2020 23:23:47 +0200 Subject: [PATCH 5/5] fix: provide default termsize for headless test instances --- src/ui.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ui.rs b/src/ui.rs index f2e6574..196cd3f 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -35,7 +35,7 @@ impl<'a> Ui<'a> { let lookup_trie = model::Model::build_lookup_trie(&matches); let focus_index = if model.reverse { matches.len() - 1 } else { 0 }; - let (term_width, _) = termion::terminal_size().expect("Cannot read the terminal size."); + let (term_width, _) = termion::terminal_size().unwrap_or((80u16, 30u16)); // .expect("Cannot read the terminal size."); let line_offsets = get_line_offsets(&model.lines, term_width); Ui {