Compare commits
21 Commits
Author | SHA1 | Date |
---|---|---|
Jorge Morante | 9b393e5757 | |
Jorge Morante | 27c5512bc2 | |
Jorge Morante | 2996ef2644 | |
Jorge Morante | 3c7c6a8673 | |
Morantron | 03f0048468 | |
Avimitin | 7e693d40cd | |
Jorge Morante | 4d3fa1eb30 | |
Jorge Morante | 47d986b8a2 | |
Jorge Morante | f6813b8b16 | |
Jorge Morante | 4ba2ec3125 | |
Jorge Morante | a30f2fb566 | |
Jorge Morante | 65a3dd2665 | |
Jorge Morante | c186efa73c | |
Jorge Morante | cd3241ad42 | |
Jorge Morante | 05a9ece2d9 | |
Jorge Morante | 1be65bc1dc | |
Jorge Morante | 26d1f67aa9 | |
Jorge Morante | 7e408344b2 | |
Jorge Morante | 680d801770 | |
Jorge Morante | 8cfc2bd1ad | |
Jorge Morante | 6718322da9 |
20
CHANGELOG.md
20
CHANGELOG.md
|
@ -1,3 +1,23 @@
|
|||
## 2.1.5 - 02 May 2024
|
||||
|
||||
* User defined patterns now take precedence over built-in ones.
|
||||
* Fix blank screen under certain circumstances due to incorrect handling of capture groups.
|
||||
|
||||
## 2.1.4 - 08 Mar 2024
|
||||
|
||||
* Fixed "No last pane" error when using "tmux last-pane" ( Fixes #48 )
|
||||
|
||||
## 2.1.3 - 31 Jan 2024
|
||||
|
||||
* Fix "Too many matches" exception ( fixes #112 ).
|
||||
|
||||
## 2.1.2 - 19 Jan 2024
|
||||
|
||||
* Added termux support.
|
||||
* Fixes to Fingers::Dirs to remove hardcoded paths. Default log path is now /tmp/fingers.log.
|
||||
* Updated Crystal version to generate clean ELF executables.
|
||||
* Improve exception handling when rendering.
|
||||
|
||||
## 2.1.1 - 16 Nov 2023
|
||||
|
||||
* Fix copy/jump when using special named capture group "match".
|
||||
|
|
|
@ -74,6 +74,7 @@ $ tmux source-file ~/.tmux.conf
|
|||
NOTE: for changes to take effect, you'll need to source again your `.tmux.conf` file.
|
||||
|
||||
* [@fingers-key](#fingers-key)
|
||||
* [@fingers-jump-key](#fingers-jump-key)
|
||||
* [@fingers-patterns-N](#fingers-patterns-N)
|
||||
* [@fingers-main-action](#fingers-main-action)
|
||||
* [@fingers-ctrl-action](#fingers-ctrl-action)
|
||||
|
|
|
@ -0,0 +1,77 @@
|
|||
require "semantic_version"
|
||||
require "yaml"
|
||||
|
||||
struct ShardFile
|
||||
include YAML::Serializable
|
||||
include YAML::Serializable::Unmapped
|
||||
|
||||
property version : String
|
||||
end
|
||||
|
||||
current_version = SemanticVersion.parse(`shards version`.chomp)
|
||||
current_branch = `git symbolic-ref --short HEAD`.chomp
|
||||
pending_changes = `git status -s`.chomp
|
||||
|
||||
if current_branch != "develop"
|
||||
puts "This script should be ran from develop branch"
|
||||
exit 1
|
||||
end
|
||||
|
||||
if pending_changes != ""
|
||||
puts "There are uncommited changes"
|
||||
exit 1
|
||||
end
|
||||
|
||||
puts "Which component you want to bump? major.minor.patch"
|
||||
print "> "
|
||||
|
||||
component = gets
|
||||
|
||||
puts "Bumping #{component} in #{current_version}"
|
||||
|
||||
next_version = case component
|
||||
when "major"
|
||||
current_version.bump_major
|
||||
when "minor"
|
||||
current_version.bump_minor
|
||||
when "patch"
|
||||
current_version.bump_patch
|
||||
else
|
||||
current_version.bump_patch
|
||||
end
|
||||
|
||||
shard = ShardFile.from_yaml(File.read("shard.yml"))
|
||||
shard.version = next_version.to_s
|
||||
|
||||
File.write("shard.yml", shard.to_yaml)
|
||||
|
||||
current_date = Time.local.to_s("%d %b %Y")
|
||||
|
||||
`git add shard.yml`
|
||||
`git commit -am "bump version in shard.yml"`
|
||||
|
||||
content_to_prepend = "## #{next_version.to_s} - #{current_date}\n\nEDIT THIS:\n\n#{`git log --oneline #{current_version}..@`.chomp}\n\n"
|
||||
|
||||
original_content = File.read("CHANGELOG.md")
|
||||
File.write("CHANGELOG.md", content_to_prepend + original_content)
|
||||
|
||||
Process.run(ENV["EDITOR"], args: ["CHANGELOG.md"], input: :inherit, output: :inherit, error: :inherit)
|
||||
|
||||
`git add CHANGELOG.md`
|
||||
`git commit -am 'updated CHANGELOG.md'`
|
||||
|
||||
print "Confirm release? [Y/n]\n >"
|
||||
answer = gets
|
||||
|
||||
if answer == "n"
|
||||
puts "Canceling release"
|
||||
exit 1
|
||||
end
|
||||
|
||||
`git checkout master`
|
||||
`git merge develop`
|
||||
`git tag #{next_version.to_s}`
|
||||
|
||||
puts "Run the following command to push the release"
|
||||
puts ""
|
||||
puts "git push && git push --tags"
|
|
@ -4,7 +4,6 @@ CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|||
PLATFORM=$(uname -s)
|
||||
action=$1
|
||||
|
||||
|
||||
# set up exit trap
|
||||
function finish {
|
||||
exit_code=$?
|
||||
|
@ -58,7 +57,11 @@ function install_with_brew() {
|
|||
|
||||
function download_binary() {
|
||||
mkdir -p $CURRENT_DIR/bin
|
||||
# TODO check architecture
|
||||
|
||||
if [[ ! "$(uname -m)" == "x86_64" ]]; then
|
||||
echo "tmux-fingers binaries are only provided for x86_64 architecture."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Getting latest release..."
|
||||
|
||||
|
|
|
@ -1,6 +1,2 @@
|
|||
version: 2.0
|
||||
shards:
|
||||
ameba:
|
||||
git: https://github.com/crystal-ameba/ameba.git
|
||||
version: 1.5.0
|
||||
|
||||
shards: {}
|
||||
|
|
16
shard.yml
16
shard.yml
|
@ -1,18 +1,10 @@
|
|||
---
|
||||
version: 2.1.5
|
||||
name: fingers
|
||||
version: 2.1.1
|
||||
|
||||
authors:
|
||||
- Jorge Morante <jorge@morante.eu>
|
||||
|
||||
- Jorge Morante <jorge@morante.eu>
|
||||
targets:
|
||||
tmux-fingers:
|
||||
main: src/fingers.cr
|
||||
|
||||
development_dependencies:
|
||||
ameba:
|
||||
github: crystal-ameba/ameba
|
||||
version: ~> 1.5.0
|
||||
|
||||
crystal: 1.9.2
|
||||
|
||||
crystal: 1.11.2
|
||||
license: MIT
|
||||
|
|
|
@ -75,8 +75,8 @@ class Fingers::Commands::LoadConfig < Fingers::Commands::Base
|
|||
end
|
||||
|
||||
config.patterns = clean_up_patterns([
|
||||
*enabled_default_patterns,
|
||||
*user_defined_patterns,
|
||||
*enabled_default_patterns,
|
||||
])
|
||||
|
||||
config.alphabet = ::Fingers::Config::ALPHABET_MAP[Fingers.config.keyboard_layout].split("").reject do |char|
|
||||
|
|
|
@ -26,9 +26,11 @@ module Fingers::Commands
|
|||
|
||||
class Start < Base
|
||||
@original_options : Hash(String, String) = {} of String => String
|
||||
@last_pane_id : String | Nil
|
||||
|
||||
def run
|
||||
track_options_to_restore!
|
||||
track_options_to_restore
|
||||
track_last_pane
|
||||
show_hints
|
||||
|
||||
if Fingers.config.benchmark_mode == "1"
|
||||
|
@ -40,7 +42,7 @@ module Fingers::Commands
|
|||
teardown
|
||||
end
|
||||
|
||||
private def track_options_to_restore!
|
||||
private def track_options_to_restore
|
||||
options_to_preserve.each do |option|
|
||||
value = tmux.get_global_option(option)
|
||||
@original_options[option] = value
|
||||
|
@ -53,6 +55,16 @@ module Fingers::Commands
|
|||
end
|
||||
end
|
||||
|
||||
private def restore_last_pane
|
||||
tmux.select_pane(@last_pane_id)
|
||||
tmux.select_pane(target_pane.pane_id)
|
||||
end
|
||||
|
||||
private def track_last_pane
|
||||
last_pane_id = tmux.exec("display-message -t '{last}' -p '\#{pane_id}'").chomp
|
||||
@last_pane_id = last_pane_id unless last_pane_id.empty?
|
||||
end
|
||||
|
||||
private def options_to_preserve
|
||||
%w[prefix prefix2]
|
||||
end
|
||||
|
@ -94,7 +106,9 @@ module Fingers::Commands
|
|||
tmux.swap_panes(fingers_pane_id, target_pane.pane_id)
|
||||
tmux.kill_pane(fingers_pane_id)
|
||||
|
||||
restore_last_pane
|
||||
restore_options
|
||||
|
||||
view.run_action if state.result
|
||||
end
|
||||
|
||||
|
|
|
@ -5,9 +5,10 @@ require "file_utils"
|
|||
module Fingers::Dirs
|
||||
TMUX_PID = (ENV["TMUX"] || ",0000").split(",")[1]
|
||||
|
||||
ROOT = Path["/tmp"] / "tmux-#{TMUX_PID}"
|
||||
TMP = Path[File.dirname(File.tempname)]
|
||||
|
||||
LOG_PATH = ROOT / "fingers.log"
|
||||
ROOT = TMP / "tmux-#{TMUX_PID}"
|
||||
LOG_PATH = TMP / "fingers.log"
|
||||
CACHE = ROOT / "tmux-fingers"
|
||||
CONFIG_PATH = CACHE / "config.json"
|
||||
SOCKET_PATH = CACHE / "fingers.sock"
|
||||
|
|
|
@ -47,7 +47,7 @@ module Fingers
|
|||
end
|
||||
|
||||
def run
|
||||
regenerate_hints! unless reuse_hints
|
||||
regenerate_hints!
|
||||
lines[0..-2].each_with_index { |line, index| process_line(line, index, "\n") }
|
||||
process_line(lines[-1], lines.size - 1, "")
|
||||
|
||||
|
@ -106,7 +106,7 @@ module Fingers
|
|||
def replace(match, line_index)
|
||||
text = match[0]
|
||||
|
||||
captured_text = match["match"]? || text
|
||||
captured_text = captured_text_for_match(match)
|
||||
relative_capture_offset = relative_capture_offset_for_match(match, captured_text)
|
||||
|
||||
absolute_offset = {
|
||||
|
@ -114,7 +114,7 @@ module Fingers
|
|||
match.begin(0) + (relative_capture_offset ? relative_capture_offset[0] : 0)
|
||||
}
|
||||
|
||||
hint = hint_for_text(text)
|
||||
hint = hint_for_text(captured_text)
|
||||
build_target(captured_text, hint, absolute_offset)
|
||||
|
||||
if !state.input.empty? && !hint.starts_with?(state.input)
|
||||
|
@ -129,6 +129,10 @@ module Fingers
|
|||
)
|
||||
end
|
||||
|
||||
def captured_text_for_match(match)
|
||||
match["match"]? || match[0]
|
||||
end
|
||||
|
||||
def hint_for_text(text)
|
||||
return pop_hint! unless reuse_hints
|
||||
|
||||
|
@ -195,7 +199,7 @@ module Fingers
|
|||
|
||||
lines.each do |line|
|
||||
line.scan(pattern) do |match|
|
||||
match_set.add(match[0]?.not_nil!)
|
||||
match_set.add(captured_text_for_match(match))
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -28,7 +28,13 @@ module Fingers
|
|||
def render
|
||||
clear_screen
|
||||
hide_cursor
|
||||
hinter.run
|
||||
|
||||
begin
|
||||
hinter.run
|
||||
rescue e
|
||||
Log.fatal { e }
|
||||
request_exit!
|
||||
end
|
||||
end
|
||||
|
||||
def process_input(input : String)
|
||||
|
|
|
@ -283,7 +283,7 @@ class Tmux
|
|||
exec(Process.quote(["display-message", "-d", delay.to_s, msg]))
|
||||
end
|
||||
|
||||
private def exec(cmd)
|
||||
def exec(cmd)
|
||||
@sh.exec("#{tmux} #{cmd}")
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue