Skip to content

Commit 4629f62

Browse files
committed
add kitty config
1 parent fb8b9da commit 4629f62

File tree

11 files changed

+2861
-0
lines changed

11 files changed

+2861
-0
lines changed

config.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,11 @@ dotfiles:
9797
src: icons
9898
dst: ~/.local/share/icons
9999
link: link_children
100+
d_kitty:
101+
src: kitty
102+
dst: ~/.config/kitty
103+
actions:
104+
- ln "$HOME/.config/kitty/theme-desert.conf" "$HOME/.config/kitty/current-theme.conf"
100105
d_ncdu:
101106
src: ncdu
102107
dst: ~/.config/ncdu

dotfiles/bin/toggledark

+15
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ def main(args: argparse.Namespace) -> int:
4747
handle_timestamp(is_dark)
4848
handle_awesome(is_dark)
4949
handle_alacritty(is_dark)
50+
handle_kitty(is_dark)
5051
handle_vim(is_dark)
5152
handle_xsettings(is_dark)
5253
handle_gnome(is_dark)
@@ -85,6 +86,20 @@ def handle_alacritty(is_dark: bool) -> None:
8586
theme_file.write_text(settings)
8687

8788

89+
def handle_kitty(is_dark: bool) -> None:
90+
theme = "theme-desert.conf" if is_dark else "theme-material.conf"
91+
link_path = XDG_CONFIG_HOME / "kitty" / "current-theme.conf"
92+
if link_path.exists():
93+
link_path.unlink()
94+
link_path.symlink_to(XDG_CONFIG_HOME / "kitty" / theme)
95+
96+
try:
97+
pid = int(check_output(["pidof", "-s", "kitty"]))
98+
os.kill(pid, signal.SIGUSR1)
99+
except CalledProcessError:
100+
return
101+
102+
88103
def handle_vim(is_dark: bool) -> None:
89104
light_theme = "vim-material"
90105
dark_theme = "desert"

dotfiles/kitty/.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
current-theme.conf
2+
.env

dotfiles/kitty/diff.conf

+186
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,186 @@
1+
# vim:fileencoding=utf-8:foldmethod=marker
2+
3+
#: Diffing {{{
4+
5+
syntax_aliases pyj:py pyi:py recipe:py
6+
7+
#: File extension aliases for syntax highlight. For example, to syntax
8+
#: highlight file.xyz as file.abc use a setting of xyz:abc.
9+
10+
num_context_lines 3
11+
12+
#: The number of lines of context to show around each change.
13+
14+
diff_cmd auto
15+
16+
#: The diff command to use. Must contain the placeholder _CONTEXT_
17+
#: which will be replaced by the number of lines of context. The
18+
#: default special value auto is to search the system for either git
19+
#: or diff and use that, if found.
20+
21+
replace_tab_by \x20\x20\x20\x20
22+
23+
#: The string to replace tabs with. Default is to use four spaces.
24+
25+
# ignore_name
26+
27+
#: A glob pattern that is matched against only the filename of files
28+
#: and directories. Matching files and directories are ignored when
29+
#: scanning the filesystem to look for files to diff. Can be specified
30+
#: multiple times to use multiple patterns. For example::
31+
32+
#: ignore_name .git
33+
#: ignore_name *~
34+
#: ignore_name *.pyc
35+
36+
#: }}}
37+
38+
#: Colors {{{
39+
40+
pygments_style default
41+
42+
#: The pygments color scheme to use for syntax highlighting. See
43+
#: pygments builtin styles <https://pygments.org/styles/> for a list
44+
#: of schemes.
45+
46+
foreground black
47+
background white
48+
49+
#: Basic colors
50+
51+
title_fg black
52+
title_bg white
53+
54+
#: Title colors
55+
56+
margin_bg #fafbfc
57+
margin_fg #aaaaaa
58+
59+
#: Margin colors
60+
61+
removed_bg #ffeef0
62+
highlight_removed_bg #fdb8c0
63+
removed_margin_bg #ffdce0
64+
65+
#: Removed text backgrounds
66+
67+
added_bg #e6ffed
68+
highlight_added_bg #acf2bd
69+
added_margin_bg #cdffd8
70+
71+
#: Added text backgrounds
72+
73+
filler_bg #fafbfc
74+
75+
#: Filler (empty) line background
76+
77+
margin_filler_bg none
78+
79+
#: Filler (empty) line background in margins, defaults to the filler
80+
#: background
81+
82+
hunk_margin_bg #dbedff
83+
hunk_bg #f1f8ff
84+
85+
#: Hunk header colors
86+
87+
search_bg #444
88+
search_fg white
89+
select_bg #b4d5fe
90+
select_fg black
91+
92+
#: Highlighting
93+
94+
#: }}}
95+
96+
#: Keyboard shortcuts {{{
97+
98+
#: Quit
99+
100+
map q quit
101+
map esc quit
102+
103+
#: Scroll down
104+
105+
map j scroll_by 1
106+
map down scroll_by 1
107+
108+
#: Scroll up
109+
110+
map k scroll_by -1
111+
map up scroll_by -1
112+
113+
#: Scroll to top
114+
115+
map home scroll_to start
116+
map g scroll_to start
117+
118+
#: Scroll to bottom
119+
120+
map end scroll_to end
121+
map shift+g scroll_to end
122+
123+
#: Scroll to next page
124+
125+
map page_down scroll_to next-page
126+
map space scroll_to next-page
127+
map ctrl+d scroll_to next-page
128+
map d scroll_to next-page
129+
130+
#: Scroll to previous page
131+
132+
map page_up scroll_to prev-page
133+
map ctrl+u scroll_to prev-page
134+
map u scroll_to prev-page
135+
136+
#: Scroll to next change
137+
138+
map n scroll_to next-change
139+
140+
#: Scroll to previous change
141+
142+
map p scroll_to prev-change
143+
144+
#: Show all context
145+
146+
map a change_context all
147+
148+
#: Show default context
149+
150+
map = change_context default
151+
152+
#: Increase context
153+
154+
map + change_context 5
155+
156+
#: Decrease context
157+
158+
map - change_context -5
159+
160+
#: Search forward
161+
162+
map / start_search regex forward
163+
164+
#: Search backward
165+
166+
map ? start_search regex backward
167+
168+
#: Scroll to next search match
169+
170+
map . scroll_to next-match
171+
map > scroll_to next-match
172+
173+
#: Scroll to previous search match
174+
175+
map , scroll_to prev-match
176+
map < scroll_to prev-match
177+
178+
#: Search forward (no regex)
179+
180+
map f start_search substring forward
181+
182+
#: Search backward (no regex)
183+
184+
map b start_search substring backward
185+
186+
#: }}}

dotfiles/kitty/init.vim

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
set laststatus=0
2+
set foldcolumn=0
3+
set showtabline=0
4+
set nolist
5+
set nonumber
6+
" set noruler
7+
8+
set clipboard+=unnamedplus
9+
set scrollback=100000
10+
set termguicolors
11+
set virtualedit=all
12+
13+
set ignorecase
14+
set smartcase
15+
16+
function! s:stdin_terminal() abort
17+
let tmpfile = trim(system(["mktemp", "-t", "kitty-nvim-pager.XXXXXX"]))
18+
execute "silent write! " .. tmpfile
19+
execute "terminal cat " .. tmpfile .. "; rm " .. tmpfile .. "; cat"
20+
endfunction
21+
autocmd StdinReadPost * call s:stdin_terminal()
22+
23+
autocmd TextYankPost * silent! lua require'vim.highlight'.on_yank({timeout = 100})
24+
autocmd TermEnter * stopinsert
25+
" autocmd VimEnter * normal G
26+
27+
nmap q :qa!<CR>
28+
nmap i <Nop>

0 commit comments

Comments
 (0)