平衡点


2026/10/26

_ ターミナルを kitty に変えてみた[Debian] [Computer] 

特に理由は無いけれど.

インストール

sid を使っているので

% sudo apt install kitty

設定

設定は

  • 欧文は Iosevka Term Extended
  • 和文は PlemolJP Console NF

といった塩梅. 他にも数式記号などを補完したり.

フォントの調整

先ずは fontconfig で

<!-- %%% kitty/foot 向けの設定 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<match target="pattern">
  <test name="family" qual="any">
    <string>Iosevka Term</string>
  </test>
  <edit name="family" mode="prepend_first" binding="strong">
    <string>Iosevka Term</string>
    <string>JuliaMono</string>
    <string>Noto Sans Symbols2</string>
    <string>Noto Sans Math</string>
    <string>PlemolJP Console</string>
    <string>Symbols Nerd Font</string>
    <string>Noto Color Emoji</string>
  </edit>
</match>
<!-- PlemolJP Console: Regular → Light に -->
<match target="pattern">
  <test name="family" qual="any">
    <string>PlemolJP Console</string>
  </test>
  <test name="weight" compare="more_eq">
    <const>regular</const>
  </test>
  <test name="weight" compare="less">
    <const>bold</const>
  </test>
  <edit name="weight" mode="assign" binding="strong">
    <const>light</const>
  </edit>
</match>
<!-- PlemolJP Console:  Bold → Medium に -->
<match target="pattern">
  <test name="family" qual="any">
    <string>PlemolJP Console</string>
  </test>
  <test name="weight" compare="more_eq">
    <const>bold</const>
  </test>
  <edit name="weight" mode="assign" binding="strong">
    <const>semibold</const>
  </edit>
</match>
<!-- create bold から PlemolJP を除外 -->
<match target="font">
  <test name="family" qual="any">
    <string>PlemolJP Console</string>
  </test>
  <edit name="embolden" mode="assign">
    <bool>false</bool>
  </edit>
</match>

としておく. Regular/Bold はちょっと目に煩いので, Light/SemiBold にしている.

kitty 本体の設定

少し詰まった表示が好きなんだけど, 単にフォントの幅を減らすだけだと, 漢字のサイズがちぐはぐになる. kitty はセル幅に収まる様にフォントを縮小しているみたいだ. そんな訳で,

  • Iosevka Term Extended (0.6em) を指定して, ベースサイズを少し横長に
  • font_width: 80% で 0.6 × 80% = 0.48em に

として好みの表示にしておく.

# ----------------------------------------------------------------------------
#: Keyboard shortcuts
clear_all_shortcuts yes
kitty_mod ctrl+shift
map kitty_mod+c copy_to_clipboard
map kitty_mod+v paste_from_clipboard
map kitty_mod+equal     change_font_size all +1.0
map kitty_mod+plus      change_font_size all +1.0
map kitty_mod+minus     change_font_size all -1.0
map kitty_mod+backspace change_font_size all 0
map kitty_mod+f5 load_config_file
map kitty_mod+f6 debug_config
## font ----------------------------------------------------------------------
# あとで cell width を縮小するので Extended (0.6em) を指定
font_family      family='Iosevka Term' style='Light Extended'
bold_font        family='Iosevka Term' style='SemiBold Extended'
italic_font      family='Iosevka Term' style='Light Extended Italic'
bold_italic_font family='Iosevka Term' style='SemiBold Extended Italic'
disable_ligatures always
# @see ./toggle_ligatures.py
# -> => :: __ || ||=
# = == != =/= === !==
# <= >= <= >= <=>
map kitty_mod+l kitten toggle_ligatures.py

font_size 13.5
# Extended 0.6em × 0.8 = 0.48em に
modify_font cell_width 80%
modify_font cell_height -2px
# @see ./toggle_composition.py
map kitty_mod+m kitten toggle_composition.py
include ./text_composition.conf

box_drawing_scale 0.001, 0.6, 1.0, 1.5
modify_font underline_thickness 80%
modify_font strikethrough_thickness 150%
modify_font strikethrough_position 2px
undercurl_style thin-sparse
# ----------------------------------------------------------------------------
# symbol_map
## Nerd icon は明示的に指定しておかないと上下がズレる, ような?
## PlemolJP Console NF を指定すれば良い気もする
symbol_map U+e000-U+e00a,U+ea60-U+ebeb,U+e0a0-U+e0c8,U+e0ca,U+e0cc-U+e0d7,U+e200-U+e2a9,U+e300-U+e3e3,U+e5fa-U+e6b5,U+e700-U+e7c5,U+f000-U+f2e0,U+f300-U+f372,U+f400-U+f533,U+f0001-U+f1af0 Symbols Nerd Font
## 絵文字のズレは修正できていない. 一応指定しておくが...
# Emoji, その1
symbol_map U+1F004,U+1F0CF,U+1F170-U+1F171,U+1F17E-U+1F17F,U+1F18E,U+1F191-U+1F19A,U+1F1E6-U+1F1FF,U+1F201-U+1F202,U+1F21A,U+1F22F,U+1F232-U+1F23A,U+1F250-U+1F251,U+1F300-U+1F64F,U+1F680-U+1F6FF,U+1F900-U+1F9FF,U+1FA70-U+1FAFF Noto Color Emoji
# Emoji, その2
symbol_map U+231A-U+231B,U+23E9-U+23EC,U+23F0,U+23F3,U+25FD-U+25FE,U+2614-U+2615,U+2648-U+2653,U+267F,U+2693,U+26A1,U+26AA-U+26AB,U+26BD-U+26BE,U+26C4-U+26C5,U+26CE,U+26D4,U+26EA,U+26F2-U+26F3,U+26F5,U+26FA,U+26FD,U+2705,U+270A-U+270B,U+2728,U+274C,U+274E,U+2753-U+2755,U+2757,U+2795-U+2797,U+27B0,U+27BF,U+2B1B-U+2B1C,U+2B50,U+2B55 Noto Color Emoji
## 他の例 --------------------------------------------------------------------
#: E.g. symbol_map U+E0A0-U+E0A3,U+E0C0-U+E0C7 PowerlineSymbols
#:     symbol_map codepoints Font Family Name
# narrow_symbols
#: E.g. narrow_symbols U+E0A0-U+E0A3,U+E0C0-U+E0C7 1
#:     narrow_symbols codepoints [optionally the number of cells]
# ----------------------------------------------------------------------------

cursor_shape block
# 🤔
shell_integration no-cursor

scrollbar never
mouse_hide_wait 3.0
wheel_scroll_multiplier 0
touch_scroll_multiplier 0
wheel_scroll_min_lines 0
detect_urls yes

enable_audio_bell no
visual_bell_duration 0.0

#: Window layout
window_border_width 0pt
draw_minimal_borders no
window_margin_width 0
single_window_margin_width -1
placement_strategy bottom
hide_window_decorations yes
tab_bar_style hidden

#: keybind -------------------------------------------------------------------
# yank and kill
map kitty_mod+c copy_to_clipboard
map kitty_mod+v paste_from_clipboard
# change font size
map ctrl+plus      change_font_size all +1.0
map ctrl+minus     change_font_size all -1.0
map ctrl+0         change_font_size all 0
# reload config
map kitty_mod+f5 load_config_file
map kitty_mod+f6 debug_config

#: Color scheme: use Dracura Theme with some customize -----------------------
include current-theme.conf 
background_opacity 0.9

toggle_ligature.py

from kittens.tui.handler import result_handler

def main(args):
    pass

@result_handler(no_ui=True)
def handle_result(args, answer, target_window_id, boss):
    w = boss.window_id_map.get(target_window_id)
    if w is not None:
        # 現在が always (リガチャOFF) なら never (ON) に、それ以外なら always (OFF) に
        current = w.screen.disable_ligatures
        boss.disable_ligatures_in([w], 'never' if current == 'always' else 'always')

toggle_composition.py

import os
from pathlib import Path
from kittens.tui.handler import result_handler

def main(args):
    pass

@result_handler(no_ui=True)
def handle_result(args, answer, target_window_id, boss):
    kitty_dir = Path.home() / '.config/kitty'
    comp_conf = kitty_dir / 'text_composition.conf'
    main_conf = kitty_dir / 'kitty.conf'

    current = (
        comp_conf.read_text(encoding='utf-8').strip()
        if comp_conf.exists()
        else ''
    )
    # すでに legacy と書かれている時だけ platform に toggle.
    # 空や未作成なら legacy に
    new_val = 'platform' if 'legacy' in current else 'legacy'

    comp_conf.write_text(
        f'text_composition_strategy {new_val}\n', encoding='utf-8'
    )

    if main_conf.exists():
        os.utime(main_conf, None)

とりあえず

今の所は文句無い.

emacs on tmux on kitty で, あとはどのぐらい「ズレ」るか, だなぁ.


連絡先など

portrait

最近の日記

一覧

Back to Top ▲