replace tmux-edit-helper with equivalent wezterm script

This commit is contained in:
Daniel Lundin 2023-03-07 22:56:45 +01:00
parent 7a66f62635
commit a04e268db9
3 changed files with 34 additions and 7 deletions

View file

@ -52,6 +52,24 @@ end
local is_server = wezterm.hostname() == "dln-dev"
wezterm.on("user-var-changed", function(window, pane, name, value)
wezterm.log_info("user-var-changed", name, value)
if name == "nvim_activate" then
for _, t in ipairs(window:mux_window():tabs_with_info()) do
for _, p in ipairs(t.tab:panes()) do
if p:get_title() == "nvim" then
window:perform_action(act.ActivateTab(t.index), p)
if t.index > 0 then
window:perform_action(act.MoveTab(0), p)
end
end
end
end
-- window:perform_action(act.ActivateTab(0), pane)
end
end)
return {
color_scheme = _get_scheme(),
color_scheme_dirs = { "/home/dln/.config/wezterm" },
@ -154,6 +172,9 @@ return {
{ 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) },
},
unix_domains = {
{

2
.zshrc
View file

@ -105,7 +105,7 @@ export LESS="--mouse --wheel-lines=1 -nRXF"
## Aliases
alias c='cut -c-${COLUMNS}'
alias e='tmux-edit-helper'
alias e='wezterm-edit-helper'
alias dotgit='git --work-tree $HOME --git-dir $HOME/.dot_git'
alias l=bat
alias lw='bat --wrap=never'

View file

@ -14,11 +14,17 @@ else
fre --store_name "$_store" --add "$_file"
fi
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 "$XDG_RUNTIME_DIR/nvim.sock"
function _nvim_setenv() {
nvim --server "$XDG_RUNTIME_DIR/nvim.sock" --remote-expr "execute(\"let \$${1} = \\\"${2}\\\"\")"
}
nvim --server "$XDG_RUNTIME_DIR/nvim.sock" --remote-expr "42" 2>/dev/null ||
(wezterm cli spawn --cwd "${PWD}" nvim --listen "$XDG_RUNTIME_DIR/nvim.sock" && sleep 0.5)
_nvim_setenv BUILD_COMMAND "$BUILD_COMMAND"
_nvim_setenv GOPACKAGESDRIVER "$GOPACKAGESDRIVER"
_nvim_setenv GOFLAGS "$GOFLAGS"
nvim --server "$XDG_RUNTIME_DIR/nvim.sock" --remote "$_file"
printf "\033]1337;SetUserVar=%s=%s\007" nvim_activate $(date +%s | base64)