home: tmux: fix yanking configuration
Use `tmux-yank` when a GUI is enabled, otherwise use the internal tmux buffer. In both cases, stay in copy mode after yanking.
This commit is contained in:
parent
39431c2656
commit
8d4bbaf886
|
@ -1,6 +1,7 @@
|
||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
let
|
let
|
||||||
cfg = config.my.home.tmux;
|
cfg = config.my.home.tmux;
|
||||||
|
hasGUI = config.my.home.x.enable || (config.my.home.wm != null);
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.my.home.tmux = with lib.my; {
|
options.my.home.tmux = with lib.my; {
|
||||||
|
@ -23,8 +24,16 @@ in
|
||||||
pain-control
|
pain-control
|
||||||
# Better session management
|
# Better session management
|
||||||
sessionist
|
sessionist
|
||||||
# X clipboard integration
|
(lib.optionalAttrs hasGUI {
|
||||||
yank
|
# X clipboard integration
|
||||||
|
plugin = yank;
|
||||||
|
extraConfig = ''
|
||||||
|
# Use 'clipboard' because of misbehaving apps (e.g: firefox)
|
||||||
|
set -g @yank_selection_mouse 'clipboard'
|
||||||
|
# Stay in copy mode after yanking
|
||||||
|
set -g @yank_action 'copy-pipe'
|
||||||
|
'';
|
||||||
|
})
|
||||||
{
|
{
|
||||||
# Show when prefix has been pressed
|
# Show when prefix has been pressed
|
||||||
plugin = prefix-highlight;
|
plugin = prefix-highlight;
|
||||||
|
@ -41,7 +50,11 @@ in
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
# Better vim mode
|
# Better vim mode
|
||||||
bind-key -T copy-mode-vi 'v' send -X begin-selection
|
bind-key -T copy-mode-vi 'v' send -X begin-selection
|
||||||
bind-key -T copy-mode-vi 'y' send -X copy-selection-and-cancel
|
${
|
||||||
|
lib.optionalString
|
||||||
|
(!hasGUI)
|
||||||
|
"bind-key -T copy-mode-vi 'y' send -X copy-selection"
|
||||||
|
}
|
||||||
# Block selection in vim mode
|
# Block selection in vim mode
|
||||||
bind-key -Tcopy-mode-vi 'C-v' send -X begin-selection \; send -X rectangle-toggle
|
bind-key -Tcopy-mode-vi 'C-v' send -X begin-selection \; send -X rectangle-toggle
|
||||||
'';
|
'';
|
||||||
|
|
Loading…
Reference in a new issue