tmux/fish
This commit is contained in:
parent
bdaefa4d5c
commit
02bd57490f
2 changed files with 295 additions and 293 deletions
|
|
@ -5,257 +5,256 @@ inputs@{ machine, ... }:
|
||||||
inherit inputs;
|
inherit inputs;
|
||||||
requirements = [ "cli" ];
|
requirements = [ "cli" ];
|
||||||
home-config =
|
home-config =
|
||||||
{
|
{ config
|
||||||
config,
|
, pkgs
|
||||||
pkgs,
|
, lib
|
||||||
lib,
|
, ...
|
||||||
...
|
|
||||||
}:
|
}:
|
||||||
with builtins;
|
with builtins;
|
||||||
with lib.attrsets;
|
with lib.attrsets;
|
||||||
let
|
let
|
||||||
scripts = (import ./scripts.nix) pkgs;
|
scripts = (import ./scripts.nix) pkgs;
|
||||||
aliases = with scripts; {
|
aliases = with scripts; {
|
||||||
"cp-mov" = cp-media "mov" "movies";
|
"cp-mov" = cp-media "mov" "movies";
|
||||||
"cp-ser" = cp-media "ser" "shows";
|
"cp-ser" = cp-media "ser" "shows";
|
||||||
"cp-ani" = cp-media "ani" "anime";
|
"cp-ani" = cp-media "ani" "anime";
|
||||||
"ragdoll" = ragdoll;
|
"ragdoll" = ragdoll;
|
||||||
"dumpasm" = "${pkgs.custom.dumpasm}/bin/dumpasm";
|
"dumpasm" = "${pkgs.custom.dumpasm}/bin/dumpasm";
|
||||||
"p" = builtins.trace calc calc;
|
"p" = builtins.trace calc calc;
|
||||||
"s" = "systemctl";
|
"s" = "systemctl";
|
||||||
"j" = "journalctl";
|
"j" = "journalctl";
|
||||||
"ju" = "journalctl -u";
|
"ju" = "journalctl -u";
|
||||||
"jfu" = "journalctl -fu";
|
"jfu" = "journalctl -fu";
|
||||||
"ls" = "${pkgs.eza}/bin/eza --git";
|
"ls" = "${pkgs.eza}/bin/eza --git";
|
||||||
"ll" = "${pkgs.eza}/bin/eza --git";
|
"ll" = "${pkgs.eza}/bin/eza --git";
|
||||||
"lt" = "${pkgs.eza}/bin/eza --long --tree -L 3";
|
"lt" = "${pkgs.eza}/bin/eza --long --tree -L 3";
|
||||||
"open" = "${pkgs.xdg-utils}/bin/xdg-open";
|
"open" = "${pkgs.xdg-utils}/bin/xdg-open";
|
||||||
"cb" = "${pkgs.wl-clipboard-rs}/bin/wl-copy";
|
"cb" = "${pkgs.wl-clipboard-rs}/bin/wl-copy";
|
||||||
"cat" = "${pkgs.bat}/bin/bat";
|
"cat" = "${pkgs.bat}/bin/bat";
|
||||||
|
|
||||||
# "pull" = "${pkgs.git}/bin/git pull";
|
# "pull" = "${pkgs.git}/bin/git pull";
|
||||||
# "push" = "${pkgs.git}/bin/git push";
|
# "push" = "${pkgs.git}/bin/git push";
|
||||||
# "commit" = "${pkgs.git}/bin/git commit";
|
# "commit" = "${pkgs.git}/bin/git commit";
|
||||||
# "add" = "${pkgs.git}/bin/git add";
|
# "add" = "${pkgs.git}/bin/git add";
|
||||||
# "patch" = "${pkgs.git}/bin/git add -p";
|
# "patch" = "${pkgs.git}/bin/git add -p";
|
||||||
# "amend" = "${pkgs.git}/bin/git commit --amend";
|
# "amend" = "${pkgs.git}/bin/git commit --amend";
|
||||||
# "log" = "${pkgs.git}/bin/git log --all --graph --decorate";
|
# "log" = "${pkgs.git}/bin/git log --all --graph --decorate";
|
||||||
# "st" = "${pkgs.git}/bin/git status";
|
# "st" = "${pkgs.git}/bin/git status";
|
||||||
# "checkout" = "${pkgs.git}/bin/git checkout";
|
# "checkout" = "${pkgs.git}/bin/git checkout";
|
||||||
# "rebase" = "${pkgs.git}/bin/git rebase";
|
# "rebase" = "${pkgs.git}/bin/git rebase";
|
||||||
# "stash" = "${pkgs.git}/bin/git stash";
|
# "stash" = "${pkgs.git}/bin/git stash";
|
||||||
|
|
||||||
"edit" = "jj edit";
|
"edit" = "jj edit";
|
||||||
"old" = "jj edit @-";
|
"old" = "jj edit @-";
|
||||||
"new" = "jj edit @+";
|
"new" = "jj edit @+";
|
||||||
"rebase" = "jj rebase";
|
"rebase" = "jj rebase";
|
||||||
"pull" = "jj git fetch; jj catchup";
|
"pull" = "jj git fetch; jj catchup";
|
||||||
"msg" = "jj describe -m";
|
"msg" = "jj describe -m";
|
||||||
"branch" = "jj bookmark set";
|
"branch" = "jj bookmark set";
|
||||||
"stat" = "jj status";
|
"stat" = "jj status";
|
||||||
"push" = "jj git push";
|
"push" = "jj git push";
|
||||||
|
|
||||||
"tidy" = "x test tidy --bless";
|
"tidy" = "x test tidy --bless";
|
||||||
"ui" = "x test tests/ui/";
|
"ui" = "x test tests/ui/";
|
||||||
|
|
||||||
"f" = "nautilus --no-desktop . &";
|
"f" = "nautilus --no-desktop . &";
|
||||||
};
|
};
|
||||||
# extracting any compressed format
|
# extracting any compressed format
|
||||||
extract = ''
|
extract = ''
|
||||||
function extract -a file -d "decompress a file"
|
function extract -a file -d "decompress a file"
|
||||||
if not test -f $file
|
if not test -f $file
|
||||||
echo "'$file' is not a valid file"
|
echo "'$file' is not a valid file"
|
||||||
return 1
|
|
||||||
end
|
|
||||||
switch $file
|
|
||||||
# tar can automatically figure out how to decompress
|
|
||||||
case '*.{tar,tar.{bz2,zst,gz,xz},tbz2,tgz'; ${pkgs.gnutar}/bin/tar xf $file; end
|
|
||||||
case '*.bz2'; bunzip2 $file; end
|
|
||||||
case '*.rar'; unrar e $file; end
|
|
||||||
case '*.gz'; gunzip $file; end
|
|
||||||
case '*.zip'; ${pkgs.unzip}/bin/unzip $file; end
|
|
||||||
case '*.Z'; uncompress $file; end
|
|
||||||
case '*.7z'; 7z x $file; end
|
|
||||||
case '*';
|
|
||||||
echo "'$file' cannot be extracted"
|
|
||||||
return 1
|
return 1
|
||||||
|
end
|
||||||
|
switch $file
|
||||||
|
# tar can automatically figure out how to decompress
|
||||||
|
case '*.{tar,tar.{bz2,zst,gz,xz},tbz2,tgz'; ${pkgs.gnutar}/bin/tar xf $file; end
|
||||||
|
case '*.bz2'; bunzip2 $file; end
|
||||||
|
case '*.rar'; unrar e $file; end
|
||||||
|
case '*.gz'; gunzip $file; end
|
||||||
|
case '*.zip'; ${pkgs.unzip}/bin/unzip $file; end
|
||||||
|
case '*.Z'; uncompress $file; end
|
||||||
|
case '*.7z'; 7z x $file; end
|
||||||
|
case '*';
|
||||||
|
echo "'$file' cannot be extracted"
|
||||||
|
return 1
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
'';
|
||||||
'';
|
in
|
||||||
in
|
{
|
||||||
{
|
programs = {
|
||||||
programs = {
|
atuin = {
|
||||||
atuin = {
|
enable = true;
|
||||||
enable = true;
|
enableFishIntegration = true;
|
||||||
enableFishIntegration = true;
|
|
||||||
|
|
||||||
settings = {
|
settings = {
|
||||||
filter_mode_shell_up_key_binding = "workspace";
|
filter_mode_shell_up_key_binding = "workspace";
|
||||||
exit_mode = "return-original";
|
exit_mode = "return-original";
|
||||||
inline_height = 20;
|
inline_height = 20;
|
||||||
workspaces = true;
|
workspaces = true;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
|
||||||
|
|
||||||
zoxide = {
|
zoxide = {
|
||||||
enable = true;
|
enable = true;
|
||||||
enableFishIntegration = true;
|
enableFishIntegration = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
direnv = {
|
direnv = {
|
||||||
enable = true;
|
enable = true;
|
||||||
# enableFishIntegration = lib.mkDefault true;
|
# enableFishIntegration = lib.mkDefault true;
|
||||||
};
|
};
|
||||||
|
|
||||||
fzf = {
|
fzf = {
|
||||||
enable = true;
|
enable = true;
|
||||||
enableFishIntegration = true;
|
enableFishIntegration = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
fish = {
|
fish = {
|
||||||
enable = true;
|
enable = true;
|
||||||
shellAliases = aliases;
|
shellAliases = aliases;
|
||||||
plugins = with pkgs.fishPlugins; [
|
plugins = with pkgs.fishPlugins; [
|
||||||
{
|
{
|
||||||
name = "bang-bang";
|
name = "bang-bang";
|
||||||
src = pkgs.fetchFromGitHub {
|
src = pkgs.fetchFromGitHub {
|
||||||
owner = "oh-my-fish";
|
owner = "oh-my-fish";
|
||||||
repo = "plugin-bang-bang";
|
repo = "plugin-bang-bang";
|
||||||
rev = "ec991b80ba7d4dda7a962167b036efc5c2d79419";
|
rev = "ec991b80ba7d4dda7a962167b036efc5c2d79419";
|
||||||
hash = "sha256-oPPCtFN2DPuM//c48SXb4TrFRjJtccg0YPXcAo0Lxq0=";
|
hash = "sha256-oPPCtFN2DPuM//c48SXb4TrFRjJtccg0YPXcAo0Lxq0=";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "tide";
|
||||||
|
inherit (tide) src;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "sponge";
|
||||||
|
inherit (sponge) src;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "autopair";
|
||||||
|
inherit (autopair) src;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
functions = {
|
||||||
|
fish_jj_prompt = {
|
||||||
|
body = ''
|
||||||
|
if not ${config.programs.jujutsu.package}/bin/jj root --quiet &>/dev/null
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
|
||||||
|
${config.programs.jujutsu.package}/bin/jj log --ignore-working-copy --no-graph --color always -r @ -T '
|
||||||
|
separate(
|
||||||
|
" ",
|
||||||
|
bookmarks.join(", "),
|
||||||
|
change_id.shortest(),
|
||||||
|
commit_id.shortest(),
|
||||||
|
if(conflict, "conflict"),
|
||||||
|
if(empty, "empty"),
|
||||||
|
if(divergent, "divergent"),
|
||||||
|
if(hidden, "hidden"),
|
||||||
|
)
|
||||||
|
'
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
}
|
|
||||||
{
|
|
||||||
name = "tide";
|
|
||||||
inherit (tide) src;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
name = "sponge";
|
|
||||||
inherit (sponge) src;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
name = "autopair";
|
|
||||||
inherit (autopair) src;
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
functions = {
|
_tide_item_jj = {
|
||||||
fish_jj_prompt = {
|
body = ''
|
||||||
body = ''
|
set -l _tide_item_jj_color $_tide_location_color
|
||||||
if not ${config.programs.jujutsu.package}/bin/jj root --quiet &>/dev/null
|
echo -ns $_tide_item_jj_color" ("(fish_jj_prompt)$_tide_item_jj_color")"
|
||||||
return 1
|
'';
|
||||||
end
|
};
|
||||||
|
|
||||||
${config.programs.jujutsu.package}/bin/jj log --ignore-working-copy --no-graph --color always -r @ -T '
|
_tide_item_git = {
|
||||||
separate(
|
body = ''
|
||||||
" ",
|
if not test -d .jj
|
||||||
bookmarks.join(", "),
|
fish_git_prompt '%s'
|
||||||
change_id.shortest(),
|
end
|
||||||
commit_id.shortest(),
|
'';
|
||||||
if(conflict, "conflict"),
|
};
|
||||||
if(empty, "empty"),
|
|
||||||
if(divergent, "divergent"),
|
|
||||||
if(hidden, "hidden"),
|
|
||||||
)
|
|
||||||
'
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
_tide_item_jj = {
|
interactiveShellInit = ''
|
||||||
body = ''
|
fish_vi_key_bindings
|
||||||
set -l _tide_item_jj_color $_tide_location_color
|
|
||||||
echo -ns $_tide_item_jj_color" ("(fish_jj_prompt)$_tide_item_jj_color")"
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
_tide_item_git = {
|
bind \e\[3\;5~ kill-word
|
||||||
body = ''
|
bind \cH backward-kill-word
|
||||||
if not test -d .jj
|
bind \cV beginning-of-line
|
||||||
fish_git_prompt '%s'
|
bind \f end-of-line
|
||||||
end
|
|
||||||
'';
|
bind -M insert \e\[3\;5~ kill-word
|
||||||
};
|
bind -M insert \cH backward-kill-word
|
||||||
|
bind -M insert \cV beginning-of-line
|
||||||
|
bind -M insert \f end-of-line
|
||||||
|
|
||||||
|
bind \cl 'clear; commandline -f repaint'
|
||||||
|
bind -M insert \cl 'clear; commandline -f repaint'
|
||||||
|
|
||||||
|
set -g sponge_successful_exit_codes 0
|
||||||
|
set -g sponge_allow_previously_successful false
|
||||||
|
set -g sponge_delay 10
|
||||||
|
|
||||||
|
${config.programs.jujutsu.package}/bin/jj util completion fish | source
|
||||||
|
|
||||||
|
# if set -q tide_left_prompt_items; and not contains "jj" $tide_left_prompt_items
|
||||||
|
# set -l tide_item_jj_idx (contains -i "pwd" $tide_left_prompt_items)
|
||||||
|
# if test $tide_item_jj_idx
|
||||||
|
# set tide_left_prompt_items \
|
||||||
|
# $tide_left_prompt_items[1..$tide_item_jj_idx] \
|
||||||
|
# jj \
|
||||||
|
# $tide_left_prompt_items[(math $tide_item_jj_idx + 1)..-1]
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
|
||||||
|
function t
|
||||||
|
cd "$(${pkgs.custom.t}/bin/t-rs $argv | tail -n 1)"
|
||||||
|
end
|
||||||
|
|
||||||
|
function temp
|
||||||
|
t $argv
|
||||||
|
end
|
||||||
|
|
||||||
|
function rs
|
||||||
|
cd "$(${pkgs.custom.t}/bin/t-rs $argv | tail -n 1)"
|
||||||
|
cargo init . --bin --name $(basename "$PWD")
|
||||||
|
vim src/main.rs
|
||||||
|
end
|
||||||
|
|
||||||
|
fish_add_path "$HOME/.cargo/bin"
|
||||||
|
fish_add_path "$HOME/.local/bin"
|
||||||
|
fish_add_path "$HOME/Documents/scripts"
|
||||||
|
fish_add_path "$HOME/.nix-profile/bin"
|
||||||
|
|
||||||
|
function fish_greeting
|
||||||
|
${pkgs.blahaj}/bin/blahaj -s
|
||||||
|
echo "mrow! This is $(uname -n) and ur $(whoami) :3"
|
||||||
|
end
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
|
||||||
interactiveShellInit = ''
|
home.activation = {
|
||||||
fish_vi_key_bindings
|
setupTide = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
|
||||||
|
setupTide() {
|
||||||
bind \e\[3\;5~ kill-word
|
${pkgs.fish}/bin/fish -c ${lib.escapeShellArg "tide configure ${
|
||||||
bind \cH backward-kill-word
|
lib.cli.toGNUCommandLineShell { } {
|
||||||
bind \cV beginning-of-line
|
auto = true;
|
||||||
bind \f end-of-line
|
style = "Lean";
|
||||||
|
prompt_colors = "True color";
|
||||||
bind -M insert \e\[3\;5~ kill-word
|
show_time = "No";
|
||||||
bind -M insert \cH backward-kill-word
|
lean_prompt_height = "Two lines";
|
||||||
bind -M insert \cV beginning-of-line
|
prompt_connection = "Disconnected";
|
||||||
bind -M insert \f end-of-line
|
prompt_spacing = "Compact";
|
||||||
|
icons = "Few icons";
|
||||||
bind \cl 'clear; commandline -f repaint'
|
transient = "Yes";
|
||||||
bind -M insert \cl 'clear; commandline -f repaint'
|
}
|
||||||
|
}"} >/dev/null 2>&1
|
||||||
set -g sponge_successful_exit_codes 0
|
}
|
||||||
set -g sponge_allow_previously_successful false
|
setupTide
|
||||||
set -g sponge_delay 10
|
|
||||||
|
|
||||||
${config.programs.jujutsu.package}/bin/jj util completion fish | source
|
|
||||||
|
|
||||||
# if set -q tide_left_prompt_items; and not contains "jj" $tide_left_prompt_items
|
|
||||||
# set -l tide_item_jj_idx (contains -i "pwd" $tide_left_prompt_items)
|
|
||||||
# if test $tide_item_jj_idx
|
|
||||||
# set tide_left_prompt_items \
|
|
||||||
# $tide_left_prompt_items[1..$tide_item_jj_idx] \
|
|
||||||
# jj \
|
|
||||||
# $tide_left_prompt_items[(math $tide_item_jj_idx + 1)..-1]
|
|
||||||
# end
|
|
||||||
# end
|
|
||||||
|
|
||||||
function t
|
|
||||||
cd "$(${pkgs.custom.t}/bin/t-rs $argv | tail -n 1)"
|
|
||||||
end
|
|
||||||
|
|
||||||
function temp
|
|
||||||
t $argv
|
|
||||||
end
|
|
||||||
|
|
||||||
function rs
|
|
||||||
cd "$(${pkgs.custom.t}/bin/t-rs $argv | tail -n 1)"
|
|
||||||
cargo init . --bin --name $(basename "$PWD")
|
|
||||||
vim src/main.rs
|
|
||||||
end
|
|
||||||
|
|
||||||
fish_add_path "$HOME/.cargo/bin"
|
|
||||||
fish_add_path "$HOME/.local/bin"
|
|
||||||
fish_add_path "$HOME/Documents/scripts"
|
|
||||||
fish_add_path "$HOME/.nix-profile/bin"
|
|
||||||
|
|
||||||
function fish_greeting
|
|
||||||
${pkgs.blahaj}/bin/blahaj -s
|
|
||||||
echo "mrow! This is $(uname -n) and ur $(whoami) :3"
|
|
||||||
end
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
home.activation = {
|
|
||||||
setupTide = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
|
|
||||||
setupTide() {
|
|
||||||
${pkgs.fish}/bin/fish -c ${lib.escapeShellArg "tide configure ${
|
|
||||||
lib.cli.toGNUCommandLineShell { } {
|
|
||||||
auto = true;
|
|
||||||
style = "Lean";
|
|
||||||
prompt_colors = "True color";
|
|
||||||
show_time = "No";
|
|
||||||
lean_prompt_height = "Two lines";
|
|
||||||
prompt_connection = "Disconnected";
|
|
||||||
prompt_spacing = "Compact";
|
|
||||||
icons = "Few icons";
|
|
||||||
transient = "Yes";
|
|
||||||
}
|
|
||||||
}"} >/dev/null 2>&1
|
|
||||||
}
|
|
||||||
setupTide
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,30 +14,33 @@ inputs@{ machine, ... }:
|
||||||
|
|
||||||
shortcut = "k";
|
shortcut = "k";
|
||||||
|
|
||||||
plugins = with pkgs; [
|
plugins =
|
||||||
{
|
with pkgs;
|
||||||
plugin = tmuxPlugins.mkTmuxPlugin {
|
with tmuxPlugins;
|
||||||
pluginName = "suspend";
|
[
|
||||||
version = "1a2f806";
|
{
|
||||||
src = pkgs.fetchFromGitHub {
|
plugin = mkTmuxPlugin {
|
||||||
owner = "MunifTanjim";
|
pluginName = "suspend";
|
||||||
repo = "tmux-suspend";
|
version = "1a2f806";
|
||||||
rev = "1a2f806666e0bfed37535372279fa00d27d50d14";
|
src = pkgs.fetchFromGitHub {
|
||||||
sha256 = "0j7vjrwc7gniwkv1076q3wc8ccwj42zph5wdmsm9ibz6029wlmzv";
|
owner = "MunifTanjim";
|
||||||
|
repo = "tmux-suspend";
|
||||||
|
rev = "1a2f806666e0bfed37535372279fa00d27d50d14";
|
||||||
|
sha256 = "0j7vjrwc7gniwkv1076q3wc8ccwj42zph5wdmsm9ibz6029wlmzv";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
extraConfig = ''
|
||||||
extraConfig = ''
|
set -g @suspend_key 'F11'
|
||||||
set -g @suspend_key 'F11'
|
'';
|
||||||
'';
|
}
|
||||||
}
|
{
|
||||||
{
|
plugin = mode-indicator;
|
||||||
plugin = tmuxPlugins.mode-indicator;
|
}
|
||||||
}
|
];
|
||||||
];
|
|
||||||
|
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
# unbind every single normal keybinding
|
# unbind every single normal keybinding
|
||||||
unbind-key -a
|
unbind -a
|
||||||
|
|
||||||
# for special characters to work right
|
# for special characters to work right
|
||||||
# like <C-_>
|
# like <C-_>
|
||||||
|
|
@ -62,36 +65,36 @@ inputs@{ machine, ... }:
|
||||||
set -s set-clipboard on
|
set -s set-clipboard on
|
||||||
|
|
||||||
# get back normal terminal emulator bindings
|
# get back normal terminal emulator bindings
|
||||||
bind-key -n S-PPage copy-mode -u
|
bind -n S-PPage copy-mode -u
|
||||||
bind-key -T copy-mode -n S-NPage send-keys -X page-down
|
bind -T copy-mode -n S-NPage send-keys -X page-down
|
||||||
|
|
||||||
# don't scroll to end when copying with mouse
|
# don't scroll to end when copying with mouse
|
||||||
bind-key -T copy-mode MouseDragEnd1Pane send-keys -X copy-pipe
|
bind -T copy-mode MouseDragEnd1Pane send-keys -X copy-pipe
|
||||||
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe
|
bind -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe
|
||||||
bind-key -T copy-mode DoubleClick1Pane select-pane \; send-keys -X select-word \; run-shell -d 0.3 \; send-keys -X copy-pipe
|
bind -T copy-mode DoubleClick1Pane select-pane \; send-keys -X select-word \; run-shell -d 0.3 \; send-keys -X copy-pipe
|
||||||
bind-key -T copy-mode TripleClick1Pane select-pane \; send-keys -X select-line \; run-shell -d 0.3 \; send-keys -X copy-pipe
|
bind -T copy-mode TripleClick1Pane select-pane \; send-keys -X select-line \; run-shell -d 0.3 \; send-keys -X copy-pipe
|
||||||
bind-key -T copy-mode-vi DoubleClick1Pane select-pane \; send-keys -X select-word \; run-shell -d 0.3 \; send-keys -X copy-pipe
|
bind -T copy-mode-vi DoubleClick1Pane select-pane \; send-keys -X select-word \; run-shell -d 0.3 \; send-keys -X copy-pipe
|
||||||
bind-key -T copy-mode-vi TripleClick1Pane select-pane \; send-keys -X select-line \; run-shell -d 0.3 \; send-keys -X copy-pipe
|
bind -T copy-mode-vi TripleClick1Pane select-pane \; send-keys -X select-line \; run-shell -d 0.3 \; send-keys -X copy-pipe
|
||||||
|
|
||||||
# window control
|
# window control
|
||||||
bind t new-window -c "#{pane_current_path}"
|
bind t new-window -c "#{pane_current_path}"
|
||||||
bind-key Tab next-window
|
bind Tab next-window
|
||||||
bind-key BTab previous-window
|
bind BTab previous-window
|
||||||
set -g automatic-rename-format "#{?#{==:#{pane_current_path},$HOME},~,#{b:pane_current_path}} (#{pane_current_command})"
|
set -g automatic-rename-format "#{?#{==:#{pane_current_path},$HOME},~,#{b:pane_current_path}} (#{pane_current_command})"
|
||||||
set -g renumber-windows on
|
set -g renumber-windows on
|
||||||
bind-key Q confirm-before -p "kill-window #W? (y/n)" kill-window
|
bind Q confirm-before -p "kill-window #W? (y/n)" kill-window
|
||||||
bind A last-window
|
bind A last-window
|
||||||
|
|
||||||
bind-key 1 select-window -t :0
|
bind 1 select-window -t :0
|
||||||
bind-key 2 select-window -t :1
|
bind 2 select-window -t :1
|
||||||
bind-key 3 select-window -t :2
|
bind 3 select-window -t :2
|
||||||
bind-key 4 select-window -t :3
|
bind 4 select-window -t :3
|
||||||
bind-key 5 select-window -t :4
|
bind 5 select-window -t :4
|
||||||
bind-key 6 select-window -t :5
|
bind 6 select-window -t :5
|
||||||
bind-key 7 select-window -t :6
|
bind 7 select-window -t :6
|
||||||
bind-key 8 select-window -t :7
|
bind 8 select-window -t :7
|
||||||
bind-key 9 select-window -t :8
|
bind 9 select-window -t :8
|
||||||
bind-key 0 select-window -t :9
|
bind 0 select-window -t :9
|
||||||
|
|
||||||
# pane control
|
# pane control
|
||||||
bind h select-pane -L
|
bind h select-pane -L
|
||||||
|
|
@ -110,40 +113,41 @@ inputs@{ machine, ... }:
|
||||||
bind S-Down split-window -v -c "#{pane_current_path}"
|
bind S-Down split-window -v -c "#{pane_current_path}"
|
||||||
bind S-Up split-window -h -b -c "#{pane_current_path}"
|
bind S-Up split-window -h -b -c "#{pane_current_path}"
|
||||||
bind S-Right split-window -v -b -c "#{pane_current_path}"
|
bind S-Right split-window -v -b -c "#{pane_current_path}"
|
||||||
bind-key -r -T prefix M-h resize-pane -L 5
|
bind -r -T prefix M-h resize-pane -L 5
|
||||||
bind-key -r -T prefix M-j resize-pane -D 5
|
bind -r -T prefix M-j resize-pane -D 5
|
||||||
bind-key -r -T prefix M-k resize-pane -U 5
|
bind -r -T prefix M-k resize-pane -U 5
|
||||||
bind-key -r -T prefix M-l resize-pane -R 5
|
bind -r -T prefix M-l resize-pane -R 5
|
||||||
bind x swap-pane -D
|
bind x swap-pane -D
|
||||||
|
bind z resize-pane -Z
|
||||||
|
|
||||||
# double-click ^k (or lshift with kanata) for previous pane like ^w in vim
|
# double-click ^k (or lshift with kanata) for previous pane like ^w in vim
|
||||||
bind -r ^k select-pane -l
|
bind -r ^k select-pane -l
|
||||||
bind-key q confirm-before -p "kill-pane #P? (y/n)" kill-pane
|
bind q confirm-before -p "kill-pane #P? (y/n)" kill-pane
|
||||||
|
|
||||||
# bind-key o choose-tree -wZ
|
# bind o choose-tree -wZ
|
||||||
# bind-key O choose-tree -sZ
|
# bind O choose-tree -sZ
|
||||||
|
|
||||||
# get back command mode and some other basics...
|
# get back command mode and some other basics...
|
||||||
bind : command-prompt
|
bind : command-prompt
|
||||||
bind r source-file ~/.config/tmux/tmux.conf \; display "config reloaded"
|
bind r source-file ~/.config/tmux/tmux.conf \; display "config reloaded"
|
||||||
bind-key ? list-keys
|
bind ? list-keys
|
||||||
|
|
||||||
# Scroll oin man etc
|
# Scroll oin man etc
|
||||||
tmux_commands_with_legacy_scroll="nano less more man git"
|
tmux_commands_with_legacy_scroll="nano less more man git"
|
||||||
|
|
||||||
bind-key -T root WheelUpPane \
|
bind -T root WheelUpPane \
|
||||||
if-shell -Ft= '#{?mouse_any_flag,1,#{pane_in_mode}}' \
|
if-shell -Ft= '#{?mouse_any_flag,1,#{pane_in_mode}}' \
|
||||||
'send -Mt=' \
|
'send -Mt=' \
|
||||||
'if-shell -t= "#{?alternate_on,true,false} || echo \"#{tmux_commands_with_legacy_scroll}\" | grep -q \"#{pane_current_command}\"" \
|
'if-shell -t= "#{?alternate_on,true,false} || echo \"#{tmux_commands_with_legacy_scroll}\" | grep -q \"#{pane_current_command}\"" \
|
||||||
"send -t= Up" "copy-mode -et="'
|
"send -t= Up" "copy-mode -et="'
|
||||||
|
|
||||||
bind-key -T root WheelDownPane \
|
bind -T root WheelDownPane \
|
||||||
if-shell -Ft = '#{?pane_in_mode,1,#{mouse_any_flag}}' \
|
if-shell -Ft = '#{?pane_in_mode,1,#{mouse_any_flag}}' \
|
||||||
'send -Mt=' \
|
'send -Mt=' \
|
||||||
'if-shell -t= "#{?alternate_on,true,false} || echo \"#{tmux_commands_with_legacy_scroll}\" | grep -q \"#{pane_current_command}\"" \
|
'if-shell -t= "#{?alternate_on,true,false} || echo \"#{tmux_commands_with_legacy_scroll}\" | grep -q \"#{pane_current_command}\"" \
|
||||||
"send -t= Down" "send -Mt="'
|
"send -t= Down" "send -Mt="'
|
||||||
|
|
||||||
bind-key -T copy-mode-vi ] \
|
bind -T copy-mode-vi ] \
|
||||||
send-keys -X clear-selection \; \
|
send-keys -X clear-selection \; \
|
||||||
send-keys -X search-forward "--> " \; \
|
send-keys -X search-forward "--> " \; \
|
||||||
send-keys -X next-word \; \
|
send-keys -X next-word \; \
|
||||||
|
|
@ -151,7 +155,7 @@ inputs@{ machine, ... }:
|
||||||
send-keys -X jump-forward ":" \; \
|
send-keys -X jump-forward ":" \; \
|
||||||
send-keys -X jump-to-forward ":" \;
|
send-keys -X jump-to-forward ":" \;
|
||||||
|
|
||||||
bind-key -T copy-mode-vi [ \
|
bind -T copy-mode-vi [ \
|
||||||
send-keys -X clear-selection \; \
|
send-keys -X clear-selection \; \
|
||||||
send-keys -X start-of-line \; \
|
send-keys -X start-of-line \; \
|
||||||
send-keys -X search-backward "--> " \; \
|
send-keys -X search-backward "--> " \; \
|
||||||
|
|
@ -160,8 +164,8 @@ inputs@{ machine, ... }:
|
||||||
send-keys -X jump-forward ":" \; \
|
send-keys -X jump-forward ":" \; \
|
||||||
send-keys -X jump-to-forward ":" \;
|
send-keys -X jump-to-forward ":" \;
|
||||||
|
|
||||||
bind-key [ copy-mode \; send-keys [
|
bind [ copy-mode \; send-keys [
|
||||||
bind-key ] copy-mode \; send-keys ]
|
bind ] copy-mode \; send-keys ]
|
||||||
|
|
||||||
# f: file search
|
# f: file search
|
||||||
# unbound: git files
|
# unbound: git files
|
||||||
|
|
@ -171,32 +175,31 @@ inputs@{ machine, ... }:
|
||||||
# M-i: ips
|
# M-i: ips
|
||||||
# include line and column numbers in file search
|
# include line and column numbers in file search
|
||||||
# rebind `f` so we can reuse it here
|
# rebind `f` so we can reuse it here
|
||||||
bind-key -T prefix C-f command-prompt { find-window -Z "%%" }
|
bind -T prefix C-f command-prompt { find-window -Z "%%" }
|
||||||
# jyn is so sorry, and so am I now
|
# jyn is so sorry, and so am I now
|
||||||
# https://github.com/jyn514/dotfiles/blob/65be3c004113290f41f858f4d7f1a6799fabab19/config/tmux.conf#L203-L212
|
# https://github.com/jyn514/dotfiles/blob/65be3c004113290f41f858f4d7f1a6799fabab19/config/tmux.conf#L203-L212
|
||||||
# see `search-regex.sh` for wtf this means
|
# see `search-regex.sh` for wtf this means
|
||||||
# TODO: include shell variable names
|
# TODO: include shell variable names
|
||||||
bind-key f copy-mode \; send-keys -X search-backward '(^|/|\<|[[:space:]"])((\.|\.\.)|[[:alnum:]~_"-]*)((/[][[:alnum:]_.#$%&+=@"-]+)+([/ "]|\.([][[:alnum:]_.#$%&+=@"-]+(:[0-9]+)?(:[0-9]+)?)|[][[:alnum:]_.#$%&+=@"-]+(:[0-9]+)(:[0-9]+)?)|(/[][[:alnum:]_.#$%&+=@"-]+){2,}([/ "]|\.([][[:alnum:]_.#$%&+=@"-]+(:[0-9]+)?(:[0-9]+)?)|[][[:alnum:]_.#$%&+=@"-]+(:[0-9]+)(:[0-9]+)?)?|(\.|\.\.)/([][[:alnum:]_.#$%&+=@"-]+(:[0-9]+)?(:[0-9]+)?))'
|
bind f copy-mode \; send-keys -X search-backward '(^|/|\<|[[:space:]"])((\.|\.\.)|[[:alnum:]~_"-]*)((/[][[:alnum:]_.#$%&+=@"-]+)+([/ "]|\.([][[:alnum:]_.#$%&+=@"-]+(:[0-9]+)?(:[0-9]+)?)|[][[:alnum:]_.#$%&+=@"-]+(:[0-9]+)(:[0-9]+)?)|(/[][[:alnum:]_.#$%&+=@"-]+){2,}([/ "]|\.([][[:alnum:]_.#$%&+=@"-]+(:[0-9]+)?(:[0-9]+)?)|[][[:alnum:]_.#$%&+=@"-]+(:[0-9]+)(:[0-9]+)?)?|(\.|\.\.)/([][[:alnum:]_.#$%&+=@"-]+(:[0-9]+)?(:[0-9]+)?))'
|
||||||
# urls
|
# urls
|
||||||
bind-key u copy-mode \; send-keys -X search-backward '(https?://|git@|git://|ssh://|ftp://|file:///)[[:alnum:]?=%/_.:,;~@!#$&*+-]*'
|
bind u copy-mode \; send-keys -X search-backward '(https?://|git@|git://|ssh://|ftp://|file:///)[[:alnum:]?=%/_.:,;~@!#$&*+-]*'
|
||||||
# hashes
|
# hashes
|
||||||
bind-key g copy-mode \; send-keys -X search-backward '[[:<:]]([0-9a-f]{7,40}|[[:alnum:]]{52}|[0-9a-f]{64})[[:>:]]'
|
bind g copy-mode \; send-keys -X search-backward '[[:<:]]([0-9a-f]{7,40}|[[:alnum:]]{52}|[0-9a-f]{64})[[:>:]]'
|
||||||
# ips
|
# ips
|
||||||
bind-key M-i copy-mode \; send-keys -X search-backward '[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}'
|
bind M-i copy-mode \; send-keys -X search-backward '[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}'
|
||||||
|
|
||||||
bind-key -T copy-mode-vi o send-keys -X copy-pipe \
|
bind -T copy-mode-vi o send-keys -X copy-pipe \
|
||||||
'cd #{pane_current_path}; xargs -I {} echo "echo {}" | bash | xargs ${../nvim/editor-hax.py} xdg-open-proxy' \; \
|
'cd #{pane_current_path}; xargs -I {} echo "echo {}" | bash | xargs ${../nvim/editor-hax.py} xdg-open-proxy' \; \
|
||||||
if -F "#{alternate_on}" { send-keys -X cancel }
|
if -F "#{alternate_on}" { send-keys -X cancel }
|
||||||
# save the buffer, then open an editor in the current pane
|
# save the buffer, then open an editor in the current pane
|
||||||
bind-key -T copy-mode-vi O send-keys -X copy-pipe-and-cancel \
|
bind -T copy-mode-vi O send-keys -X copy-pipe-and-cancel \
|
||||||
'tmux send-keys "C-q"; xargs -I {} tmux send-keys "vim {}"; tmux send-keys "C-m"'
|
'tmux send-keys "C-q"; xargs -I {} tmux send-keys "vim {}"; tmux send-keys "C-m"'
|
||||||
# search for the highlighted text
|
# search for the highlighted text
|
||||||
bind-key -T copy-mode-vi s send-keys -X copy-pipe \
|
bind -T copy-mode-vi s send-keys -X copy-pipe \
|
||||||
"cd #{pane_current_path}; xargs -I {} open 'https://www.google.com/search?q={}'" \; \
|
"cd #{pane_current_path}; xargs -I {} open 'https://www.google.com/search?q={}'" \; \
|
||||||
if -F "#{alternate_on}" { send-keys -X cancel }
|
if -F "#{alternate_on}" { send-keys -X cancel }
|
||||||
# save buffer and retype into the shell
|
# save buffer and retype into the shell
|
||||||
bind-key -T copy-mode-vi Tab send-keys -X copy-selection-and-cancel \; paste-buffer -p
|
bind -T copy-mode-vi Tab send-keys -X copy-selection-and-cancel \; paste-buffer -p
|
||||||
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue