Рефакторинг

This commit is contained in:
Andrei Astafev 2021-12-12 19:28:51 +03:00
parent e6e01d8917
commit 6029a95324
2 changed files with 13 additions and 11 deletions

View File

@ -87,21 +87,23 @@ getip() {
# Автоматическая установка описания терминала xterm-kitty # Автоматическая установка описания терминала xterm-kitty
kitty-install-terminfo() { kitty-install-terminfo() {
if [[ "x${TERM}" = "xxterm-kitty" ]]; then
if ! infocmp "xterm-kitty" > /dev/null 2>&1 ; then
if ! sudo apt-get install kitty-terminfo > /dev/null 2>&1 ; then if ! sudo apt-get install kitty-terminfo > /dev/null 2>&1 ; then
mkdir -p "${HOME}/.terminfo/x" mkdir -p "${HOME}/.terminfo/x"
cp -ap "${ZDOTDIR}/terminfo/xterm-kitty" "${HOME}/.terminfo/x" cp -ap "${ZDOTDIR}/terminfo/xterm-kitty" "${HOME}/.terminfo/x"
fi fi
echo "Terminal description for xterm-kitty was installed." echo "Terminal description for xterm-kitty was installed."
echo "Close terminal and start again." echo "Close terminal and start again."
fi
fi
} }
if [[ "x${TERM}" = "xxterm-kitty" ]]; then
if infocmp "xterm-kitty" > /dev/null 2>&1 ; then
unset -f kitty-install-terminfo
fi
fi
# Настройка mc для работы в kitty (mc не должен быть запущен) # Настройка mc для работы в kitty (mc не должен быть запущен)
mc-kitty-add() { mc-kitty-add() {
local mc_cfg="${HOME}/.config/mc/ini.test" local mc_cfg="${HOME}/.config/mc/ini"
local mc_term="${ZDOTDIR}/terminfo/mc-kitty.ini" local mc_term="${ZDOTDIR}/terminfo/mc-kitty.ini"
[[ "x$1" == "x-f" ]] && sed -i '/\[terminal:xterm-kitty\]/,/^$/{d}' "${mc_cfg}" [[ "x$1" == "x-f" ]] && sed -i '/\[terminal:xterm-kitty\]/,/^$/{d}' "${mc_cfg}"

View File

@ -1,5 +1,5 @@
zcomet compinit zcomet compinit
mc-kitty-add mc-kitty-add
kitty-install-terminfo [ declare -f -F kitty-install-terminfo ] && kitty-install-terminfo