mirror of
https://github.com/Morantron/tmux-fingers.git
synced 2026-09-10 07:26:32 -04:00
add new @fingers-enable-bindings option
This commit is contained in:
parent
d05ec8817f
commit
6677dd1701
24
README.md
24
README.md
|
|
@ -95,6 +95,7 @@ NOTE: for changes to take effect, you'll need to source again your `.tmux.conf`
|
|||
* [@fingers-show-copied-notification](#fingers-show-copied-notification)
|
||||
* [@fingers-enabled-builtin-patterns](#fingers-enabled-builtin-patterns)
|
||||
* [@fingers-use-system-clipboard](#fingers-use-system-clipboard)
|
||||
* [@fingers-enable-bindings](#fingers-enable-bindings)
|
||||
|
||||
Recipes:
|
||||
|
||||
|
|
@ -283,6 +284,23 @@ A list of comma separated pattern names. Built-in patterns are the following:
|
|||
| git-status-branch | will match branch name in the output of git status | `Your branch is up to date withname-of-branch` |
|
||||
| diff | will match paths in diff output | `+++ a/path/to/file` |
|
||||
|
||||
## @fingers-use-system-clipboard
|
||||
|
||||
`default: 1`
|
||||
|
||||
Whether to use the system clipboard when copying matches. If set to `0`,
|
||||
tmux-fingers will only copy matches to the tmux buffer.
|
||||
|
||||
## @fingers-enable-bindings
|
||||
|
||||
`default: 1`
|
||||
|
||||
By default, tmux-fingers will bind to `prefix` + `@fingers-key` and `prefix` +
|
||||
`@fingers-jump-key`. You can opt-out of these bindings in case they clash with
|
||||
other parts of your configuration.
|
||||
|
||||
Check [recipes](#Recipes) for alternative ways to set up bindings.
|
||||
|
||||
## @fingers-cli
|
||||
|
||||
You can set up key bindings directly to invoke tmux-fingers by using a special global option `@fingers-cli` exposed by the plugin.
|
||||
|
|
@ -308,12 +326,6 @@ Options:
|
|||
|
||||
Check some examples in the [Recipes](#Recipes) section below.
|
||||
|
||||
## @fingers-use-system-clipboard
|
||||
|
||||
`default: 1`
|
||||
|
||||
Whether to use the system clipboard when copying matches. If set to `0`,
|
||||
tmux-fingers will only copy matches to the tmux buffer.
|
||||
|
||||
# Recipes
|
||||
|
||||
|
|
|
|||
|
|
@ -76,6 +76,8 @@ class Fingers::Commands::LoadConfig < Cling::Command
|
|||
config.show_copied_notification = value
|
||||
when "enabled_builtin_patterns"
|
||||
config.enabled_builtin_patterns = value
|
||||
when "enable_bindings"
|
||||
config.enable_bindings = to_bool(value)
|
||||
end
|
||||
|
||||
if option.match(/^pattern/) && !value.empty?
|
||||
|
|
@ -123,12 +125,16 @@ class Fingers::Commands::LoadConfig < Cling::Command
|
|||
end
|
||||
|
||||
def setup_bindings
|
||||
`tmux bind-key #{Fingers.config.key} run-shell -b "#{cli} start "\#{pane_id}" >>#{Fingers::Dirs::LOG_PATH} 2>&1"`
|
||||
`tmux bind-key #{Fingers.config.jump_key} run-shell -b "#{cli} start --mode jump "\#{pane_id}" >>#{Fingers::Dirs::LOG_PATH} 2>&1"`
|
||||
setup_root_bindings if Fingers.config.enable_bindings
|
||||
setup_fingers_mode_bindings
|
||||
`tmux set-option -g @fingers-cli #{cli}`
|
||||
end
|
||||
|
||||
def setup_root_bindings
|
||||
`tmux bind-key #{Fingers.config.key} run-shell -b "#{cli} start "\#{pane_id}" >>#{Fingers::Dirs::LOG_PATH} 2>&1"`
|
||||
`tmux bind-key #{Fingers.config.jump_key} run-shell -b "#{cli} start --mode jump "\#{pane_id}" >>#{Fingers::Dirs::LOG_PATH} 2>&1"`
|
||||
end
|
||||
|
||||
def setup_fingers_mode_bindings
|
||||
("a".."z").to_a.each do |char|
|
||||
next if char.match(DISALLOWED_CHARS)
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ module Fingers
|
|||
property tmux_version : String
|
||||
property show_copied_notification : String
|
||||
property enabled_builtin_patterns : String
|
||||
property enable_bindings : Bool
|
||||
|
||||
FORMAT_PRINTER = TmuxStylePrinter.new
|
||||
|
||||
|
|
@ -84,6 +85,7 @@ module Fingers
|
|||
@tmux_version = "3.1",
|
||||
@show_copied_notification = "0",
|
||||
@enabled_builtin_patterns = "all",
|
||||
@enable_bindings = true,
|
||||
@benchmark_mode = "0"
|
||||
)
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue