Fix: TMUX-NVIM seamless navigation
This commit is contained in:
parent
a7acccc49b
commit
a1ad7fffc0
151
fish/.config/fish/completions/bun.fish
Normal file
151
fish/.config/fish/completions/bun.fish
Normal file
@ -0,0 +1,151 @@
|
|||||||
|
# This is terribly complicated
|
||||||
|
# It's because:
|
||||||
|
# 1. bun run has to have dynamic completions
|
||||||
|
# 2. there are global options
|
||||||
|
# 3. bun {install add remove} gets special options
|
||||||
|
# 4. I don't know how to write fish completions well
|
||||||
|
# Contributions very welcome!!
|
||||||
|
|
||||||
|
function __fish__get_bun_bins
|
||||||
|
string split ' ' (bun getcompletes b)
|
||||||
|
end
|
||||||
|
|
||||||
|
function __fish__get_bun_scripts
|
||||||
|
set -lx SHELL bash
|
||||||
|
set -lx MAX_DESCRIPTION_LEN 40
|
||||||
|
string trim (string split '\n' (string split '\t' (bun getcompletes z)))
|
||||||
|
end
|
||||||
|
|
||||||
|
function __fish__get_bun_packages
|
||||||
|
if test (commandline -ct) != ""
|
||||||
|
set -lx SHELL fish
|
||||||
|
string split ' ' (bun getcompletes a (commandline -ct))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function __history_completions
|
||||||
|
set -l tokens (commandline --current-process --tokenize)
|
||||||
|
history --prefix (commandline) | string replace -r \^$tokens[1]\\s\* "" | string replace -r \^$tokens[2]\\s\* "" | string split ' '
|
||||||
|
end
|
||||||
|
|
||||||
|
function __fish__get_bun_bun_js_files
|
||||||
|
string split ' ' (bun getcompletes j)
|
||||||
|
end
|
||||||
|
|
||||||
|
function bun_fish_is_nth_token --description 'Test if current token is on Nth place' --argument-names n
|
||||||
|
set -l tokens (commandline -poc)
|
||||||
|
set -l tokens (string replace -r --filter '^([^-].*)' '$1' -- $tokens)
|
||||||
|
test (count $tokens) -eq "$n"
|
||||||
|
end
|
||||||
|
|
||||||
|
function __bun_command_count --argument-names n
|
||||||
|
set -l cmds (commandline -poc)
|
||||||
|
|
||||||
|
test (count cmds) -eq "$n"
|
||||||
|
end
|
||||||
|
|
||||||
|
function __bun_last_cmd --argument-names n
|
||||||
|
set -l cmds (commandline -poc)
|
||||||
|
|
||||||
|
test "(cmds[-1])" = "$n"
|
||||||
|
end
|
||||||
|
|
||||||
|
set -l bun_install_boolean_flags yarn production optional development no-save dry-run force no-cache silent verbose global
|
||||||
|
set -l bun_install_boolean_flags_descriptions "Write a yarn.lock file (yarn v1)" "Don't install devDependencies" "Add dependency to optionalDependencies" "Add dependency to devDependencies" "Don't install devDependencies" "Don't install anything" "Always request the latest versions from the registry & reinstall all dependenices" "Ignore manifest cache entirely" "Don't output anything" "Excessively verbose logging" "Use global folder"
|
||||||
|
|
||||||
|
set -l bun_builtin_cmds dev create help bun upgrade discord run install remove add init link unlink
|
||||||
|
set -l bun_builtin_cmds_without_run dev create help bun upgrade discord install remove add init
|
||||||
|
set -l bun_builtin_cmds_without_bun dev create help upgrade run discord install remove add init
|
||||||
|
set -l bun_builtin_cmds_without_create dev help bun upgrade discord run install remove add init
|
||||||
|
set -l bun_builtin_cmds_without_install create dev help bun upgrade discord run remove add init
|
||||||
|
set -l bun_builtin_cmds_without_remove create dev help bun upgrade discord run install add init
|
||||||
|
set -l bun_builtin_cmds_without_add create dev help bun upgrade discord run remove install init
|
||||||
|
set -l bun_builtin_cmds_without_pm create dev help bun upgrade discord run init
|
||||||
|
|
||||||
|
complete -c bun \
|
||||||
|
-n "not __fish_seen_subcommand_from $bun_builtin_cmds_without_run; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts); and __fish_use_subcommand" -a '(__fish__get_bun_scripts)' -d 'script'
|
||||||
|
complete -c bun \
|
||||||
|
-n "not __fish_seen_subcommand_from $bun_builtin_cmds_without_run; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts); and __fish_seen_subcommand_from run" -a '(__fish__get_bun_bins)' -d 'package bin'
|
||||||
|
complete -c bun \
|
||||||
|
-n "not __fish_seen_subcommand_from $bun_builtin_cmds_without_run; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts); and __fish_seen_subcommand_from run" -a '(__fish__get_bun_scripts)' -d 'script'
|
||||||
|
complete -c bun \
|
||||||
|
-n "not __fish_seen_subcommand_from $bun_builtin_cmds_without_run; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts); and __fish_seen_subcommand_from run" -a '(__fish__get_bun_bun_js_files)' -d 'Bun.js'
|
||||||
|
complete -c bun \
|
||||||
|
-n "bun_fish_is_nth_token 1; and not __fish_seen_subcommand_from $bun_builtin_cmds; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts) and __fish_use_subcommand" -a 'run' -f -d 'Run a script or bin'
|
||||||
|
complete -c bun \
|
||||||
|
-n "not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts) install remove add;" --no-files -s 'u' -l 'origin' -r -d 'Server URL. Rewrites import paths'
|
||||||
|
complete -c bun \
|
||||||
|
-n "not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts) install remove add;" --no-files -s 'p' -l 'port' -r -d 'Port number to start server from'
|
||||||
|
complete -c bun \
|
||||||
|
-n "not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts) install remove add;" --no-files -s 'd' -l 'define' -r -d 'Substitute K:V while parsing, e.g. --define process.env.NODE_ENV:\"development\"'
|
||||||
|
complete -c bun \
|
||||||
|
-n "not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts) install remove add;" --no-files -s 'e' -l 'external' -r -d 'Exclude module from transpilation (can use * wildcards). ex: -e react'
|
||||||
|
complete -c bun \
|
||||||
|
-n "not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts) install remove add;" --no-files -l 'use' -r -d 'Use a framework (ex: next)'
|
||||||
|
complete -c bun \
|
||||||
|
-n "bun_fish_is_nth_token 1; and not __fish_seen_subcommand_from $bun_builtin_cmds; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts) and __fish_use_subcommand" -a 'dev' -d 'Start dev server'
|
||||||
|
complete -c bun \
|
||||||
|
-n "bun_fish_is_nth_token 1; and not __fish_seen_subcommand_from $bun_builtin_cmds; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts) and __bun_command_count 1 and __fish_use_subcommand" -a 'create' -f -d 'Create a new project from a template'
|
||||||
|
|
||||||
|
complete -c bun \
|
||||||
|
-n "not __fish_seen_subcommand_from $bun_builtin_cmds_without_create next react; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts); and __fish_seen_subcommand_from create;" -a 'next' -d 'new Next.js project'
|
||||||
|
|
||||||
|
complete -c bun \
|
||||||
|
-n "not __fish_seen_subcommand_from $bun_builtin_cmds_without_create next react; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts); and __fish_seen_subcommand_from create;" -a 'react' -d 'new React project'
|
||||||
|
|
||||||
|
complete -c bun \
|
||||||
|
-n "not __fish_seen_subcommand_from $bun_builtin_cmds; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts); and __fish_use_subcommand" -a 'upgrade' -d 'Upgrade bun to the latest version' -x
|
||||||
|
complete -c bun \
|
||||||
|
-n "not __fish_seen_subcommand_from $bun_builtin_cmds; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts); and __fish_use_subcommand" -a '--help' -d 'See all commands and flags' -x
|
||||||
|
|
||||||
|
complete -c bun \
|
||||||
|
-n "not __fish_seen_subcommand_from $bun_builtin_cmds; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts); and __fish_use_subcommand" -l "version" -s "v" -a '--version' -d 'bun\'s version' -x
|
||||||
|
complete -c bun \
|
||||||
|
-n "not __fish_seen_subcommand_from $bun_builtin_cmds; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts); and __fish_use_subcommand" -a 'discord' -d 'Open bun\'s Discord server' -x
|
||||||
|
|
||||||
|
|
||||||
|
complete -c bun \
|
||||||
|
-n "not __fish_seen_subcommand_from $bun_builtin_cmds_without_bun; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts); __fish_use_subcommand" -a 'bun' -d 'Generate a new bundle'
|
||||||
|
|
||||||
|
|
||||||
|
complete -c bun \
|
||||||
|
-n "not __fish_seen_subcommand_from $bun_builtin_cmds_without_bun; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts); and __fish_seen_subcommand_from bun" -F -d 'Bundle this'
|
||||||
|
|
||||||
|
complete -c bun \
|
||||||
|
-n "not __fish_seen_subcommand_from $bun_builtin_cmds_without_create; and not __fish_seen_subcommand_from (__fish__get_bun_bins); and not __fish_seen_subcommand_from (__fish__get_bun_scripts); and __fish_seen_subcommand_from react; or __fish_seen_subcommand_from next" -F -d "Create in directory"
|
||||||
|
|
||||||
|
|
||||||
|
complete -c bun \
|
||||||
|
-n "bun_fish_is_nth_token 1; and not __fish_seen_subcommand_from $bun_builtin_cmds; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts) and __bun_command_count 1 and __fish_use_subcommand" -a 'init' -F -d 'Start an empty Bun project'
|
||||||
|
|
||||||
|
complete -c bun \
|
||||||
|
-n "bun_fish_is_nth_token 1; and not __fish_seen_subcommand_from $bun_builtin_cmds; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts) and __bun_command_count 1 and __fish_use_subcommand" -a 'install' -f -d 'Install packages from package.json'
|
||||||
|
|
||||||
|
complete -c bun \
|
||||||
|
-n "bun_fish_is_nth_token 1; and not __fish_seen_subcommand_from $bun_builtin_cmds; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts) and __bun_command_count 1 and __fish_use_subcommand" -a 'add' -F -d 'Add a package to package.json'
|
||||||
|
|
||||||
|
complete -c bun \
|
||||||
|
-n "bun_fish_is_nth_token 1; and not __fish_seen_subcommand_from $bun_builtin_cmds; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts) and __bun_command_count 1 and __fish_use_subcommand" -a 'remove' -F -d 'Remove a package from package.json'
|
||||||
|
|
||||||
|
complete -c bun \
|
||||||
|
-n "bun_fish_is_nth_token 1; and not __fish_seen_subcommand_from $bun_builtin_cmds; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts) and __bun_command_count 1 and __fish_use_subcommand add remove" -F
|
||||||
|
|
||||||
|
|
||||||
|
for i in (seq (count $bun_install_boolean_flags))
|
||||||
|
complete -c bun \
|
||||||
|
-n "not __fish_seen_subcommand_from $bun_builtin_cmds_without_pm; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts); and __fish_seen_subcommand_from install add remove;" -l "$bun_install_boolean_flags[$i]" -d "$bun_install_boolean_flags_descriptions[$i]"
|
||||||
|
end
|
||||||
|
|
||||||
|
complete -c bun \
|
||||||
|
-n "not __fish_seen_subcommand_from $bun_builtin_cmds_without_pm; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts); and __fish_seen_subcommand_from install add remove;" -l 'cwd' -d 'Change working directory'
|
||||||
|
|
||||||
|
complete -c bun \
|
||||||
|
-n "not __fish_seen_subcommand_from $bun_builtin_cmds_without_pm; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts); and __fish_seen_subcommand_from install add remove;" -l 'cache-dir' -d 'Choose a cache directory (default: $HOME/.bun/install/cache)'
|
||||||
|
|
||||||
|
complete -c bun \
|
||||||
|
-n "not __fish_seen_subcommand_from $bun_builtin_cmds_without_pm; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts); and __fish_seen_subcommand_from add;" -d 'Popular' -a '(__fish__get_bun_packages)'
|
||||||
|
|
||||||
|
complete -c bun \
|
||||||
|
-n "not __fish_seen_subcommand_from $bun_builtin_cmds_without_pm; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts); and __fish_seen_subcommand_from add;" -d 'History' -a '(__history_completions)'
|
||||||
|
|
||||||
|
complete -c bun --no-files
|
@ -34,8 +34,9 @@ set -gx MANPAGER "lvim +Man!"
|
|||||||
set -gx LC_ALL en_US.UTF-8
|
set -gx LC_ALL en_US.UTF-8
|
||||||
|
|
||||||
set -gx _JAVA_AWT_WM_NONREPARENTING 1
|
set -gx _JAVA_AWT_WM_NONREPARENTING 1
|
||||||
|
set --export BUN_INSTALL "$HOME/.bun"
|
||||||
|
|
||||||
set -x PATH /home/minhradz/.ghcup/bin/ /usr/libexec /usr/local/bin /home/minhradz/.cargo/bin /home/minhradz/.local/bin /home/minhradz/go/bin /home/minhradz/.cabal/bin /home/minhradz/.local/share/gem/ruby/3.0.0/bin $PATH
|
set -x PATH /home/minhradz/.ghcup/bin/ /usr/libexec /usr/local/bin /home/minhradz/.cargo/bin /home/minhradz/.local/bin /home/minhradz/go/bin /home/minhradz/.cabal/bin /home/minhradz/.local/share/gem/ruby/3.0.0/bin $BUN_INSTALL/bin $PATH
|
||||||
|
|
||||||
starship init fish | source
|
starship init fish | source
|
||||||
|
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
# VERSION: 3.0
|
# VERSION: 3.0
|
||||||
SETUVAR --export GTK_IM_MODULE:ibus
|
SETUVAR --export GTK_IM_MODULE:ibus
|
||||||
SETUVAR --export QT_IM_MODULE:ibus
|
SETUVAR --export QT_IM_MODULE:ibus
|
||||||
SETUVAR --export SSH_AGENT_PID:1188
|
SETUVAR --export SSH_AGENT_PID:1161
|
||||||
SETUVAR --export SSH_AUTH_SOCK:/tmp/ssh\x2dXXXXXXmZ7SUl/agent\x2e1187
|
SETUVAR --export SSH_AUTH_SOCK:/tmp/ssh\x2dXXXXXXC1g8rp/agent\x2e1160
|
||||||
SETUVAR --export XMODIFIERS:\x40im\x3dibus
|
SETUVAR --export XMODIFIERS:\x40im\x3dibus
|
||||||
SETUVAR __fish_initialized:3400
|
SETUVAR __fish_initialized:3400
|
||||||
SETUVAR fish_color_autosuggestion:4c566a
|
SETUVAR fish_color_autosuggestion:4c566a
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# remap prefix from 'C-b' to 'C-a'
|
|
||||||
set-environment -g PATH "/usr/local/bin:/bin:/usr/bin"
|
set-environment -g PATH "/usr/local/bin:/bin:/usr/bin"
|
||||||
|
|
||||||
|
# remap prefix from 'C-b' to 'C-a'
|
||||||
unbind C-b
|
unbind C-b
|
||||||
set-option -g prefix C-a
|
set-option -g prefix C-a
|
||||||
bind-key C-a send-prefix
|
bind-key C-a send-prefix
|
||||||
@ -26,7 +26,12 @@ bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'wl-copy'
|
|||||||
# reload config file (change file location to your the tmux.conf you want to use)
|
# reload config file (change file location to your the tmux.conf you want to use)
|
||||||
bind r source-file /home/minhradz/.tmux.conf
|
bind r source-file /home/minhradz/.tmux.conf
|
||||||
|
|
||||||
is_vim="ps -o state= -o comm= -t '#{pane_tty}'| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|[ln]?vim?x?)(diff)?$'"
|
# is_vim="children=(); i=0; pids=( $(ps -o pid= -t '#{pane_tty}') ); \
|
||||||
|
# while read -r c p; do [[ -n c && c -ne p && p -ne 0 ]] && children[p]+=\" $\{c\}\"; done <<< \"$(ps -Ao pid=,ppid=)\"; \
|
||||||
|
# while (( $\{#pids[@]\} > i )); do pid=$\{pids[i++]\}; pids+=( $\{children[pid]-\} ); done; \
|
||||||
|
# ps -o state=,comm= -p \"$\{pids[@]\}\" | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|l?vim?x?)(diff)?$'"
|
||||||
|
|
||||||
|
is_vim="ps -o state= -o comm= -t '#{pane_tty}' | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
|
||||||
|
|
||||||
bind-key -n 'C-h' if-shell "$is_vim" 'send-keys C-h' { if -F '#{pane_at_left}' '' 'select-pane -L' }
|
bind-key -n 'C-h' if-shell "$is_vim" 'send-keys C-h' { if -F '#{pane_at_left}' '' 'select-pane -L' }
|
||||||
bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' { if -F '#{pane_at_bottom}' '' 'select-pane -D' }
|
bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' { if -F '#{pane_at_bottom}' '' 'select-pane -D' }
|
||||||
@ -38,13 +43,6 @@ bind-key -T copy-mode-vi 'C-j' if -F '#{pane_at_bottom}' '' 'select-pane -D'
|
|||||||
bind-key -T copy-mode-vi 'C-k' if -F '#{pane_at_top}' '' 'select-pane -U'
|
bind-key -T copy-mode-vi 'C-k' if -F '#{pane_at_top}' '' 'select-pane -U'
|
||||||
bind-key -T copy-mode-vi 'C-l' if -F '#{pane_at_right}' '' 'select-pane -R'
|
bind-key -T copy-mode-vi 'C-l' if -F '#{pane_at_right}' '' 'select-pane -R'
|
||||||
|
|
||||||
#is_vim="ps -o state= -o comm= -t '#{pane_tty}' | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|l?vim?x?)(diff)?$'"
|
|
||||||
|
|
||||||
is_vim="children=(); i=0; pids=( $(ps -o pid= -t '#{pane_tty}') ); \
|
|
||||||
while read -r c p; do [[ -n c && c -ne p && p -ne 0 ]] && children[p]+=\" $\{c\}\"; done <<< \"$(ps -Ao pid=,ppid=)\"; \
|
|
||||||
while (( $\{#pids[@]\} > i )); do pid=$\{pids[i++]\}; pids+=( $\{children[pid]-\} ); done; \
|
|
||||||
ps -o state=,comm= -p \"$\{pids[@]\}\" | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|l?vim?x?)(diff)?$'"
|
|
||||||
|
|
||||||
bind -n 'M-h' if-shell "$is_vim" 'send-keys M-h' 'resize-pane -L 1'
|
bind -n 'M-h' if-shell "$is_vim" 'send-keys M-h' 'resize-pane -L 1'
|
||||||
bind -n 'M-j' if-shell "$is_vim" 'send-keys M-j' 'resize-pane -D 1'
|
bind -n 'M-j' if-shell "$is_vim" 'send-keys M-j' 'resize-pane -D 1'
|
||||||
bind -n 'M-k' if-shell "$is_vim" 'send-keys M-k' 'resize-pane -U 1'
|
bind -n 'M-k' if-shell "$is_vim" 'send-keys M-k' 'resize-pane -U 1'
|
||||||
@ -54,6 +52,7 @@ bind-key -T copy-mode-vi M-h resize-pane -L 1
|
|||||||
bind-key -T copy-mode-vi M-j resize-pane -D 1
|
bind-key -T copy-mode-vi M-j resize-pane -D 1
|
||||||
bind-key -T copy-mode-vi M-k resize-pane -U 1
|
bind-key -T copy-mode-vi M-k resize-pane -U 1
|
||||||
bind-key -T copy-mode-vi M-l resize-pane -R 1
|
bind-key -T copy-mode-vi M-l resize-pane -R 1
|
||||||
|
|
||||||
# Enable mouse mode (tmux 2.1 and above)
|
# Enable mouse mode (tmux 2.1 and above)
|
||||||
set -g mouse on
|
set -g mouse on
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user