diff --git a/README.md b/README.md index 6875789..153ac17 100644 --- a/README.md +++ b/README.md @@ -86,6 +86,7 @@ NOTE: for changes to take effect, you'll need to source again your `.tmux.conf` * [@fingers-selected-highlight-style](#fingers-selected-highlight-style) * [@fingers-hint-position](#fingers-hint-position) * [@fingers-keyboard-layout](#fingers-keyboard-layout) +* [@fingers-show-copied-notification](#fingers-show-copied-notification) ## @fingers-key @@ -233,6 +234,12 @@ Hints are generated taking optimal finger movement into account. You can choose * `dvorak-right-hand` * `dvorak-homerow` +## @fingers-show-copied-notification + +`default: 0` + +Show a message using `tmux display-message` notifying about the copied result. + # Acknowledgements and inspiration This plugin is heavily inspired by diff --git a/src/fingers/commands/load_config.cr b/src/fingers/commands/load_config.cr index 0d7398a..2dfc8af 100644 --- a/src/fingers/commands/load_config.cr +++ b/src/fingers/commands/load_config.cr @@ -62,6 +62,8 @@ class Fingers::Commands::LoadConfig < Fingers::Commands::Base config.backdrop_style = tmux.parse_style(value) when "selected_highlight_style" config.selected_highlight_style = tmux.parse_style(value) + when "show_copied_notification" + config.show_copied_notification = value end if option.match(/pattern/) diff --git a/src/fingers/config.cr b/src/fingers/config.cr index dbece23..b53dbaa 100644 --- a/src/fingers/config.cr +++ b/src/fingers/config.cr @@ -20,6 +20,7 @@ module Fingers property selected_highlight_style : String property backdrop_style : String property tmux_version : String + property show_copied_notification : String FORMAT_PRINTER = TmuxStylePrinter.new @@ -76,6 +77,7 @@ module Fingers @selected_highlight_style = FORMAT_PRINTER.print("fg=blue"), @backdrop_style = "", @tmux_version = "", + @show_copied_notification = "0", @benchmark_mode = "0" ) end diff --git a/src/fingers/view.cr b/src/fingers/view.cr index f1432b4..ceffdba 100644 --- a/src/fingers/view.cr +++ b/src/fingers/view.cr @@ -54,7 +54,7 @@ module Fingers original_pane: original_pane ).run - tmux.display_message("Copied: #{state.result}", 1000) unless state.result.empty? + tmux.display_message("Copied: #{state.result}", 1000) if should_notify? end private def hide_cursor @@ -70,8 +70,11 @@ module Fingers state.modifier = modifier match = hinter.lookup(state.input) - handle_match(match) if match - tmux.display_message(state.input, 300) + if match + handle_match(match) + else + tmux.display_message(state.input, 300) + end end private def process_multimode @@ -102,5 +105,9 @@ module Fingers private def request_exit! state.exiting = true end + + private def should_notify? + !state.result.empty? && Fingers.config.show_copied_notification == "1" + end end end