diff --git a/05-start.zsh b/05-start.zsh index d2289ef..8b13789 100644 --- a/05-start.zsh +++ b/05-start.zsh @@ -1,12 +1 @@ -# Автоматическая установка описания терминала xterm-kitty -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 - mkdir -p "${HOME}/.terminfo/x" - cp -ap "${ZDOTDIR}/terminfo/xterm-kitty" "${HOME}/.terminfo/x" - fi - echo "Terminal description for xterm-kitty was installed." - echo "Close terminal and start again." - fi -fi diff --git a/65-scripts.zsh b/65-scripts.zsh index 130b13f..600525f 100644 --- a/65-scripts.zsh +++ b/65-scripts.zsh @@ -84,3 +84,31 @@ getip() { ifconfig | awk '/inet /{print $2}' | command grep -v 127.0.0.1 fi } + +# Автоматическая установка описания терминала xterm-kitty +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 + mkdir -p "${HOME}/.terminfo/x" + cp -ap "${ZDOTDIR}/terminfo/xterm-kitty" "${HOME}/.terminfo/x" + fi + echo "Terminal description for xterm-kitty was installed." + echo "Close terminal and start again." + fi + fi +} + +# Настройка mc для работы в kitty (mc не должен быть запущен) +mc-kitty-add() { + local mc_cfg="${HOME}/.config/mc/ini.test" + local mc_term="${ZDOTDIR}/terminfo/mc-kitty.ini" + + [[ "x$1" == "x-f" ]] && sed -i '/\[terminal:xterm-kitty\]/,/^$/{d}' "${mc_cfg}" + if [ -w "${mc_cfg}" -a -r "${mc_term}" ]; then + if ! grep -qF "[terminal:xterm-kitty]" "${mc_cfg}" ; then + cat "${mc_term}" >> "${mc_cfg}" + fi + fi +} + diff --git a/95-finish.zsh b/95-finish.zsh index 876722a..06ee348 100644 --- a/95-finish.zsh +++ b/95-finish.zsh @@ -1,2 +1,5 @@ zcomet compinit +mc-kitty-add +kitty-install-terminfo + diff --git a/terminfo/mc-kitty.ini b/terminfo/mc-kitty.ini new file mode 100644 index 0000000..c7ae62e --- /dev/null +++ b/terminfo/mc-kitty.ini @@ -0,0 +1,16 @@ + +[terminal:xterm-kitty] +f11=\\e[1\;2P +f12=\\e[1\;2Q +f13=\\e[1\;2R +f14=\\e[1\;2S +f15=\\e[15\;2~ +f16=\\e[17\;2~ +f17=\\e[18\;2~ +f18=\\e[19\;2~ +f19=\\e[20\;2~ +f20=\\e[21\;2~ +complete=\\e^i +backtab=\\e[Z +backspace= +