blob: 1e9bed76717c34cc31b1ee87dd1df871f36b0f19 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# This file is sourced by .zshrc if parts/graphical.nix was imported.
function ssh() {
# In my ~/.ssh/config I configure host-specific background colors, for example:
#
# Host forest
# LocalCommand set-bg 003300
#
# Since SSH doesn't provide a way of running a command on exit, this shell
# function takes care of resetting the background color on exit.
# Note that we're setting PermitLocalCommand=yes here rather than in
# .ssh/config because the latter makes git over SSH fail with:
#
# fatal: protocol error: bad line length character: ?]11
command ssh -o PermitLocalCommand=yes "$@"; reset-bg
}
if [ $TERM = foot ]; then
# Enable spawning of new terminal instances in the current working directory
function osc7-pwd() {
emulate -L zsh # also sets localoptions for us
setopt extendedglob
local LC_ALL=C
printf '\e]7;file://%s%s\e\' $HOST ${PWD//(#m)([^@-Za-z&-;_~])/%${(l:2::0:)$(([##16]#MATCH))}}
}
function chpwd-osc7-pwd() {
(( ZSH_SUBSHELL )) || osc7-pwd
}
add-zsh-hook -Uz chpwd chpwd-osc7-pwd
fi
|