Return of the tmux
This commit is contained in:
parent
6dfd7d5f8e
commit
1a1acba0e7
8 changed files with 47 additions and 104 deletions
|
@ -1,20 +1,26 @@
|
|||
add_newline = false
|
||||
|
||||
# $git_branch\
|
||||
# $git_commit\
|
||||
# $git_state\
|
||||
# $git_status\
|
||||
|
||||
format = """\
|
||||
${env_var.TMUX_WINDOW}\
|
||||
$hostname\
|
||||
$directory\
|
||||
${custom.sl_status}\
|
||||
$git_branch\
|
||||
$git_commit\
|
||||
$git_state\
|
||||
$git_status\
|
||||
($character)\
|
||||
"""
|
||||
|
||||
right_format = """\
|
||||
"""
|
||||
|
||||
[env_var.TMUX_WINDOW]
|
||||
default = ""
|
||||
format = '[ $env_value ]($style)[](fg:#d1002f) '
|
||||
style = 'italic bg:#d1002f fg:#ffffff'
|
||||
|
||||
[custom.sl_status]
|
||||
command = '''~/bin/starship-sl-status'''
|
||||
when = false
|
||||
|
|
|
@ -10,70 +10,6 @@ local function font_with_fallback(name, params)
|
|||
return wezterm.font_with_fallback(names, params)
|
||||
end
|
||||
|
||||
wezterm.on("gui-startup", function(cmd)
|
||||
local args = {}
|
||||
if cmd then
|
||||
args = cmd.args
|
||||
end
|
||||
|
||||
local tab, pane, window = mux.spawn_window({
|
||||
workspace = "local",
|
||||
args = { "nvim", "--listen", os.getenv("XDG_RUNTIME_DIR") .. "/nvim-persistent.sock" },
|
||||
})
|
||||
tab:set_title("nvim")
|
||||
|
||||
for _ = 1, 9 do
|
||||
window:spawn_tab({})
|
||||
end
|
||||
window:gui_window():perform_action(act.ActivateTab(1), pane)
|
||||
|
||||
local tab, pane, window = mux.spawn_window({
|
||||
workspace = dev_host,
|
||||
args = spawn_dev_nvim,
|
||||
})
|
||||
tab:set_title("nvim")
|
||||
|
||||
for _ = 1, 9 do
|
||||
window:spawn_tab({ args = { "ssh", dev_host } })
|
||||
end
|
||||
|
||||
mux.set_active_workspace("local")
|
||||
end)
|
||||
|
||||
local function activate_nvim(window, pane)
|
||||
for _, t in ipairs(window:mux_window():tabs_with_info()) do
|
||||
for _, p in ipairs(t.tab:panes()) do
|
||||
if p:get_title() == "nvim" or t.tab:get_title() == "nvim" then
|
||||
window:perform_action(
|
||||
act.Multiple({
|
||||
act.ActivateTab(t.index),
|
||||
act.MoveTab(0),
|
||||
}),
|
||||
pane
|
||||
)
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local nvim = { "nvim", "--listen", os.getenv("XDG_RUNTIME_DIR") .. "/nvim-persistent.sock" }
|
||||
if window:mux_window():get_workspace() == dev_host then
|
||||
nvim = spawn_dev_nvim
|
||||
end
|
||||
|
||||
local tab, pane, _ = window:mux_window():spawn_tab({ args = nvim })
|
||||
window:perform_action(act.MoveTab(0), pane)
|
||||
tab:set_title("nvim")
|
||||
end
|
||||
|
||||
wezterm.on("user-var-changed", function(window, pane, name, value)
|
||||
if name == "nvim_activate" then
|
||||
activate_nvim(window, pane)
|
||||
end
|
||||
end)
|
||||
|
||||
wezterm.on("activate-nvim", activate_nvim)
|
||||
|
||||
wezterm.add_to_config_reload_watch_list(os.getenv("HOME") .. "/.config/shelman-theme/current/wezterm")
|
||||
|
||||
return {
|
||||
|
@ -115,6 +51,7 @@ return {
|
|||
initial_cols = 132,
|
||||
initial_rows = 45,
|
||||
use_resize_increments = true,
|
||||
window_decorations = "RESIZE",
|
||||
window_background_opacity = 1.0,
|
||||
colors = {
|
||||
tab_bar = {
|
||||
|
@ -127,6 +64,7 @@ return {
|
|||
default_cursor_style = "SteadyBlock",
|
||||
cursor_thickness = "3px",
|
||||
cursor_blink_rate = 0,
|
||||
hide_mouse_cursor_when_typing = false,
|
||||
enable_wayland = true,
|
||||
enable_tab_bar = false,
|
||||
tab_bar_at_bottom = true,
|
||||
|
@ -149,19 +87,6 @@ return {
|
|||
{ key = "Enter", mods = "ALT", action = "ToggleFullScreen" },
|
||||
{ key = "r", mods = "ALT", action = act.ReloadConfiguration },
|
||||
{ key = "L", mods = "CTRL", action = wezterm.action.ShowDebugOverlay },
|
||||
-- mux
|
||||
{ key = "1", mods = "ALT", action = act.EmitEvent("activate-nvim") },
|
||||
{ key = "2", mods = "ALT", action = act.ActivateTab(1) },
|
||||
{ key = "3", mods = "ALT", action = act.ActivateTab(2) },
|
||||
{ key = "4", mods = "ALT", action = act.ActivateTab(3) },
|
||||
{ key = "5", mods = "ALT", action = act.ActivateTab(4) },
|
||||
{ key = "6", mods = "ALT", action = act.ActivateTab(5) },
|
||||
{ key = "7", mods = "ALT", action = act.ActivateTab(6) },
|
||||
{ key = "8", mods = "ALT", action = act.ActivateTab(7) },
|
||||
{ key = "9", mods = "ALT", action = act.ActivateTab(8) },
|
||||
{ key = "0", mods = "ALT", action = act.ActivateTab(9) },
|
||||
{ key = "RightArrow", mods = "CTRL", action = act.ActivateTabRelative(1) },
|
||||
{ key = "LeftArrow", mods = "CTRL", action = act.ActivateTabRelative(-1) },
|
||||
{ key = "l", mods = "ALT", action = wezterm.action.ActivateCommandPalette },
|
||||
{ key = "Backspace", mods = "ALT", action = act.SwitchWorkspaceRelative(1) },
|
||||
{ key = "UpArrow", mods = "SHIFT", action = act.ScrollByLine(-1) },
|
||||
|
|
|
@ -7,4 +7,4 @@ TryExec=/usr/bin/wezterm
|
|||
Icon=org.wezfurlong.wezterm
|
||||
Terminal=false
|
||||
Categories=System;TerminalEmulator;
|
||||
Exec=/usr/bin/wezterm start --always-new-process --class=wezterm-dln-dev
|
||||
Exec=/usr/bin/wezterm --config 'default_prog={"ssh", "-q", "dln-dev", "--", "tmux", "-u", "new", "-As0"}' start --class=wezterm-dln-dev
|
||||
|
|
11
.local/share/applications/wezterm-local.desktop
Normal file
11
.local/share/applications/wezterm-local.desktop
Normal file
|
@ -0,0 +1,11 @@
|
|||
[Desktop Entry]
|
||||
Name=wezterm-local
|
||||
GenericName=wezterm-local
|
||||
StartupWMClass=wezterm-local
|
||||
Type=Application
|
||||
TryExec=/usr/bin/wezterm
|
||||
Icon=org.wezfurlong.wezterm
|
||||
Terminal=false
|
||||
Categories=System;TerminalEmulator;
|
||||
Exec=/usr/bin/wezterm --config 'default_prog={"tmux", "-u", "new", "-As0"}' start
|
||||
|
24
.tmux.conf
24
.tmux.conf
|
@ -53,9 +53,9 @@ bind-key -T copy-mode-vi WheelDownPane select-pane \; send-keys -X -N 1 scroll-d
|
|||
bind-key / copy-mode \; send-key ?
|
||||
bind-key P 'capture-pane' \; capture-pane -S - \; save-buffer /tmp/tmux \; delete-buffer
|
||||
bind-key -n C-\\ copy-mode \; send -X search-backward " % "\; send -X search-again
|
||||
bind -n M-g display-popup -S 'bg=#F1F8E9,fg=#689F38' -s 'bg=#F1F8E9' -h '90%' -w '90%' -b rounded -d '#{pane_current_path}' -E "gitui"
|
||||
bind -n M-e display-popup -S 'bg=#E3F2FD,fg=#0288D1' -s 'bg=#E3F2FD' -h '40%' -w '90%' -y 0 -b rounded -d '#{pane_current_path}' -e FZF=fzf -E "~/bin/tmux-edit-helper"
|
||||
bind -n M-m display-popup -S 'bg=#FFF8E1,fg=#FF6F00' -s 'bg=#FFF8E1' -h '90%' -w '90%' -b rounded -d '#{pane_current_path}' -E "~/bin/tmux-build-helper"
|
||||
bind -n M-g display-popup -h '90%' -w '90%' -b rounded -d '#{pane_current_path}' -E "gitui"
|
||||
bind -n M-e display-popup -h '40%' -w '90%' -y 0 -b rounded -d '#{pane_current_path}' -e FZF=fzf -E "~/bin/tmux-edit-helper"
|
||||
bind -n M-m display-popup -h '90%' -w '90%' -b rounded -d '#{pane_current_path}' -E "~/bin/tmux-build-helper"
|
||||
|
||||
setw -g window-status-format ""
|
||||
setw -g window-status-current-format ""
|
||||
|
@ -71,14 +71,14 @@ set -g set-titles on
|
|||
set -g set-titles-string "#H - #T"
|
||||
|
||||
new -s0 -n 1 nvim --listen $XDG_RUNTIME_DIR/nvim.sock
|
||||
new-window -n 2
|
||||
new-window -n 3
|
||||
new-window -n 4
|
||||
new-window -n 5
|
||||
new-window -n 6
|
||||
new-window -n 7
|
||||
new-window -n 8
|
||||
new-window -n 9
|
||||
new-window -n 0
|
||||
new-window -n 2 -e TMUX_WINDOW=2
|
||||
new-window -n 3 -e TMUX_WINDOW=3
|
||||
new-window -n 4 -e TMUX_WINDOW=4
|
||||
new-window -n 5 -e TMUX_WINDOW=5
|
||||
new-window -n 6 -e TMUX_WINDOW=6
|
||||
new-window -n 7 -e TMUX_WINDOW=7
|
||||
new-window -n 8 -e TMUX_WINDOW=8
|
||||
new-window -n 9 -e TMUX_WINDOW=9
|
||||
new-window -n 0 -e TMUX_WINDOW=0
|
||||
|
||||
# vim:set ft=tmux:
|
||||
|
|
2
.zshrc
2
.zshrc
|
@ -105,7 +105,7 @@ export LESS="--mouse --wheel-lines=1 -nRXF"
|
|||
|
||||
## Aliases
|
||||
alias c='cut -c-${COLUMNS}'
|
||||
alias e='wezterm-edit-helper'
|
||||
alias e='tmux-edit-helper'
|
||||
alias dotgit='git --work-tree $HOME --git-dir $HOME/.dot_git'
|
||||
alias l=bat
|
||||
alias lw='bat --wrap=never'
|
||||
|
|
4
bin/tmux-build-helper
Executable file
4
bin/tmux-build-helper
Executable file
|
@ -0,0 +1,4 @@
|
|||
#!/usr/bin/env bash
|
||||
set -ef -o pipefail
|
||||
eval "$(direnv export bash)"
|
||||
eval "${BUILD_COMMAND:-echo 'BUILD_COMMAND not set'}" | bat --paging=always
|
|
@ -16,14 +16,11 @@ fi
|
|||
|
||||
_nvim_socket="$XDG_RUNTIME_DIR/nvim-persistent.sock"
|
||||
|
||||
function _nvim_setenv() {
|
||||
nvim --server "$_nvim_socket" --remote-expr "execute(\"let \$${1} = \\\"${2}\\\"\")" 2>&1 >/dev/null
|
||||
}
|
||||
|
||||
_nvim_setenv BUILD_COMMAND "$BUILD_COMMAND"
|
||||
_nvim_setenv GOPACKAGESDRIVER "$GOPACKAGESDRIVER"
|
||||
_nvim_setenv GOFLAGS "$GOFLAGS"
|
||||
tmux select-window -t nvim 2>/dev/null ||
|
||||
tmux new-window -S -n nvim \
|
||||
-e "BUILD_COMMAND=$BUILD_COMMAND" \
|
||||
-e "GOPACKAGESDRIVER=$GOPACKAGESDRIVER" \
|
||||
-e "GOFLAGS=$GOFLAGS" \
|
||||
nvim --listen "$_nvim_socket"
|
||||
|
||||
nvim --server "$_nvim_socket" --remote "$_file"
|
||||
|
||||
printf "\033]1337;SetUserVar=%s=%s\007" nvim_activate $(date +%s | base64)
|
Loading…
Reference in a new issue