Skip to content

Commit

Permalink
add kitty config
Browse files Browse the repository at this point in the history
  • Loading branch information
majutsushi committed May 30, 2023
1 parent fb8b9da commit 4629f62
Show file tree
Hide file tree
Showing 11 changed files with 2,861 additions and 0 deletions.
5 changes: 5 additions & 0 deletions config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ dotfiles:
src: icons
dst: ~/.local/share/icons
link: link_children
d_kitty:
src: kitty
dst: ~/.config/kitty
actions:
- ln "$HOME/.config/kitty/theme-desert.conf" "$HOME/.config/kitty/current-theme.conf"
d_ncdu:
src: ncdu
dst: ~/.config/ncdu
Expand Down
15 changes: 15 additions & 0 deletions dotfiles/bin/toggledark
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def main(args: argparse.Namespace) -> int:
handle_timestamp(is_dark)
handle_awesome(is_dark)
handle_alacritty(is_dark)
handle_kitty(is_dark)
handle_vim(is_dark)
handle_xsettings(is_dark)
handle_gnome(is_dark)
Expand Down Expand Up @@ -85,6 +86,20 @@ def handle_alacritty(is_dark: bool) -> None:
theme_file.write_text(settings)


def handle_kitty(is_dark: bool) -> None:
theme = "theme-desert.conf" if is_dark else "theme-material.conf"
link_path = XDG_CONFIG_HOME / "kitty" / "current-theme.conf"
if link_path.exists():
link_path.unlink()
link_path.symlink_to(XDG_CONFIG_HOME / "kitty" / theme)

try:
pid = int(check_output(["pidof", "-s", "kitty"]))
os.kill(pid, signal.SIGUSR1)
except CalledProcessError:
return


def handle_vim(is_dark: bool) -> None:
light_theme = "vim-material"
dark_theme = "desert"
Expand Down
2 changes: 2 additions & 0 deletions dotfiles/kitty/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
current-theme.conf
.env
186 changes: 186 additions & 0 deletions dotfiles/kitty/diff.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
# vim:fileencoding=utf-8:foldmethod=marker

#: Diffing {{{

syntax_aliases pyj:py pyi:py recipe:py

#: File extension aliases for syntax highlight. For example, to syntax
#: highlight file.xyz as file.abc use a setting of xyz:abc.

num_context_lines 3

#: The number of lines of context to show around each change.

diff_cmd auto

#: The diff command to use. Must contain the placeholder _CONTEXT_
#: which will be replaced by the number of lines of context. The
#: default special value auto is to search the system for either git
#: or diff and use that, if found.

replace_tab_by \x20\x20\x20\x20

#: The string to replace tabs with. Default is to use four spaces.

# ignore_name

#: A glob pattern that is matched against only the filename of files
#: and directories. Matching files and directories are ignored when
#: scanning the filesystem to look for files to diff. Can be specified
#: multiple times to use multiple patterns. For example::

#: ignore_name .git
#: ignore_name *~
#: ignore_name *.pyc

#: }}}

#: Colors {{{

pygments_style default

#: The pygments color scheme to use for syntax highlighting. See
#: pygments builtin styles <https://pygments.org/styles/> for a list
#: of schemes.

foreground black
background white

#: Basic colors

title_fg black
title_bg white

#: Title colors

margin_bg #fafbfc
margin_fg #aaaaaa

#: Margin colors

removed_bg #ffeef0
highlight_removed_bg #fdb8c0
removed_margin_bg #ffdce0

#: Removed text backgrounds

added_bg #e6ffed
highlight_added_bg #acf2bd
added_margin_bg #cdffd8

#: Added text backgrounds

filler_bg #fafbfc

#: Filler (empty) line background

margin_filler_bg none

#: Filler (empty) line background in margins, defaults to the filler
#: background

hunk_margin_bg #dbedff
hunk_bg #f1f8ff

#: Hunk header colors

search_bg #444
search_fg white
select_bg #b4d5fe
select_fg black

#: Highlighting

#: }}}

#: Keyboard shortcuts {{{

#: Quit

map q quit
map esc quit

#: Scroll down

map j scroll_by 1
map down scroll_by 1

#: Scroll up

map k scroll_by -1
map up scroll_by -1

#: Scroll to top

map home scroll_to start
map g scroll_to start

#: Scroll to bottom

map end scroll_to end
map shift+g scroll_to end

#: Scroll to next page

map page_down scroll_to next-page
map space scroll_to next-page
map ctrl+d scroll_to next-page
map d scroll_to next-page

#: Scroll to previous page

map page_up scroll_to prev-page
map ctrl+u scroll_to prev-page
map u scroll_to prev-page

#: Scroll to next change

map n scroll_to next-change

#: Scroll to previous change

map p scroll_to prev-change

#: Show all context

map a change_context all

#: Show default context

map = change_context default

#: Increase context

map + change_context 5

#: Decrease context

map - change_context -5

#: Search forward

map / start_search regex forward

#: Search backward

map ? start_search regex backward

#: Scroll to next search match

map . scroll_to next-match
map > scroll_to next-match

#: Scroll to previous search match

map , scroll_to prev-match
map < scroll_to prev-match

#: Search forward (no regex)

map f start_search substring forward

#: Search backward (no regex)

map b start_search substring backward

#: }}}
28 changes: 28 additions & 0 deletions dotfiles/kitty/init.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
set laststatus=0
set foldcolumn=0
set showtabline=0
set nolist
set nonumber
" set noruler

set clipboard+=unnamedplus
set scrollback=100000
set termguicolors
set virtualedit=all

set ignorecase
set smartcase

function! s:stdin_terminal() abort
let tmpfile = trim(system(["mktemp", "-t", "kitty-nvim-pager.XXXXXX"]))
execute "silent write! " .. tmpfile
execute "terminal cat " .. tmpfile .. "; rm " .. tmpfile .. "; cat"
endfunction
autocmd StdinReadPost * call s:stdin_terminal()

autocmd TextYankPost * silent! lua require'vim.highlight'.on_yank({timeout = 100})
autocmd TermEnter * stopinsert
" autocmd VimEnter * normal G

nmap q :qa!<CR>
nmap i <Nop>
Loading

0 comments on commit 4629f62

Please sign in to comment.