1
0
Fork 0

switch to chezmoi

This commit is contained in:
Von Random 2025-01-02 17:33:13 +02:00
parent 3c5d00dbf3
commit a8b0acd4db
76 changed files with 27 additions and 531 deletions

View file

@ -0,0 +1,57 @@
[colors.bright]
black = "0x002b36"
blue = "0x839496"
cyan = "0x93a1a1"
green = "0x586e75"
magenta = "0x6c71c4"
red = "0xcb4b16"
white = "0xfdf6e3"
yellow = "0x657b83"
[colors.cursor]
cursor = "0xcb4b16"
[colors.normal]
black = "0x073642"
blue = "0x268bd2"
cyan = "0x2aa198"
green = "0x859900"
magenta = "0xd33682"
red = "0xdc322f"
white = "0xeee8d5"
yellow = "0xb58900"
[colors.primary]
background = "0xfdf6e3"
foreground = "0x657b83"
[colors.selection]
background = "0xeee8d5"
text = "CellForeground"
[cursor.style]
shape = "Block"
[font]
builtin_box_drawing = true
size = 13
[font.normal]
family = "IBM Plex Mono"
[[keyboard.bindings]]
action = "Paste"
key = "V"
mods = "Alt"
[[keyboard.bindings]]
action = "Copy"
key = "C"
mods = "Alt"
[[mouse.bindings]]
action = "PasteSelection"
mouse = "Middle"
[scrolling]
history = 15000

2
dot_config/bat/config Normal file
View file

@ -0,0 +1,2 @@
'--theme=Solarized (light)'
--italic-text=always

51
dot_config/foot/foot.ini Normal file
View file

@ -0,0 +1,51 @@
# -*- conf -*-
font=VascadiaMod:size=12
box-drawings-uses-font-glyphs=no
# dpi-aware=yes
notify=notify-send -a ${app-id} -i ${app-id} ${title} ${body}
bold-text-in-bright=no
word-delimiters=,│`|:"'()[]{}<>
[bell]
urgent=no
notify=no
[scrollback]
lines=15000
[mouse]
hide-when-typing=no
[colors]
background=282828
foreground=ebdbb2
regular0=282828
regular1=cc241d
regular2=98971a
regular3=d79921
regular4=458588
regular5=b16286
regular6=689d6a
regular7=a89984
bright0=928374
bright1=fb4934
bright2=b8bb26
bright3=fabd2f
bright4=83a598
bright5=d3869b
bright6=8ec07c
bright7=ebdbb2
[key-bindings]
clipboard-copy=Mod1+c XF86Copy
clipboard-paste=Mod1+v XF86Paste
[mouse-bindings]
select-begin-block=Mod1+BTN_LEFT
# vim: ft=conf

28
dot_config/ghostty/config Normal file
View file

@ -0,0 +1,28 @@
font-family = Cascadia Mono PL
font-feature = ss01
font-feature = ss19
font-feature = ss20
font-size = 12
cursor-style = block
cursor-style-blink = false
cursor-color = #d65d0e
shell-integration-features = no-cursor
theme = GruvboxDark
keybind = alt+t=new_tab
keybind = alt+c=copy_to_clipboard
keybind = alt+v=paste_from_clipboard
keybind = ctrl+g>c=new_tab
keybind = ctrl+g>v=new_split:right
keybind = ctrl+g>s=new_split:down
keybind = ctrl+g>h=goto_split:left
keybind = ctrl+g>j=goto_split:bottom
keybind = ctrl+g>k=goto_split:top
keybind = ctrl+g>l=goto_split:right
keybind = ctrl+g>r=reload_config
keybind = ctrl+g>f=toggle_fullscreen
keybind = ctrl+g>d=toggle_window_decorations
keybind = ctrl+m=text:\n
keybind = ctrl+i=text:\t

View file

@ -0,0 +1,24 @@
theme = "gruvbox_custom"
[editor]
true-color = true
[editor.cursor-shape]
normal = "block"
insert = "bar"
select = "underline"
[editor.file-picker]
hidden = false
[editor.indent-guides]
render = true
[editor.soft-wrap]
enable = true
[keys.normal.space]
l = ":toggle-option whitespace.render all none"
m = ":toggle-option mouse"
x = ":toggle-option cursorline"
z = ":toggle-option line-number relative absolute"

View file

@ -0,0 +1,4 @@
[[language]]
name = "common-lisp"
scope = "source.lisp"
file-types = ["kbd", "lisp", "asd", "cl", "l", "lsp", "ny", "podsl", "sexp"]

View file

@ -0,0 +1,5 @@
inherits = "gruvbox"
# transparent background, if ever needed
#"ui.background" = {}
"ui.cursor.primary.normal" = { fg = "bg1", bg = "orange1" }

View file

@ -0,0 +1,52 @@
[theme]
theme = "gruvbox-dark"
[theme.overrides]
separator = '|'
idle_bg = "#2c2c2c"
idle_fg = "#ebdbb2"
info_bg = "#2c2c2c"
info_fg = "#458588"
good_bg = "#2c2c2c"
good_fg = "#98971a"
warning_bg = "#2c2c2c"
warning_fg = "#d79921"
critical_bg = "#2c2c2c"
critical_fg = "#cc241d"
separator_bg = "#2c2c2c"
separator_fg = "#3c3836"
[icons]
icons = "awesome4"
[[block]]
block = "disk_space"
path = "/"
warning = 10.0
alert = 5.0
[[block]]
block = "cpu"
interval = 1
[[block]]
block = "memory"
format = "$icon $mem_used.eng(prefix:Mi) ($mem_used_percents)"
#[[block]]
#block = "sound"
#on_click = "pavucontrol"
#step_width = 2
[[block]]
block = "keyboard_layout"
driver = "sway"
[block.mappings]
"English (US)" = "EN"
"Russian (typewriter)" = "RU"
[[block]]
block = "time"
interval = 1
[block.format]
full = "$icon $timestamp.datetime(f:'%a %R')"
short = "$icon $timestamp.datetime(f:'%R')"

View file

@ -0,0 +1,92 @@
# Use Ctrl+Alt+F5 to reload
font_family FiraCode
disable_ligatures always
modify_font underline_position 1
font_size 12
cursor_blink_interval 0
term xterm-256color
active_border_color #cb4b16
inactive_border_color #93a1a1
tab_title_template " ┇{index}┇{title} "
tab_bar_style separator
tab_separator ""
tab_bar_edge top
active_tab_foreground #282828
active_tab_background #a89984
active_tab_font_style italic
inactive_tab_foreground #ebdbb2
inactive_tab_background #282828
inactive_tab_font_style italic
hide_window_decorations yes
enabled_layouts splits,stack
enable_audio_bell no
strip_trailing_spaces always
open_url_with default
window_padding_width 2
placement_strategy top-left
remember_window_size no
initial_window_width 120c
initial_window_height 30c
resize_in_steps no
shell_integration no-cursor
editor nvim
map ctrl+g>c new_tab
map ctrl+g>n next_tab
map ctrl+g>p prev_tab
map ctrl+g>x close_window
map ctrl+g>s launch --location=hsplit
map ctrl+g>v launch --location=vsplit
map ctrl+g>r start_resizing_window
map ctrl+g>h neighboring_window left
map ctrl+g>j neighboring_window down
map ctrl+g>k neighboring_window up
map ctrl+g>l neighboring_window right
map ctrl+g>f show_scrollback
map ctrl+g>z toggle_layout stack
map ctrl+g>1 goto_tab 1
map ctrl+g>2 goto_tab 2
map ctrl+g>3 goto_tab 3
map ctrl+g>4 goto_tab 4
map ctrl+g>5 goto_tab 5
map ctrl+g>6 goto_tab 6
map ctrl+g>7 goto_tab 7
map ctrl+g>8 goto_tab 8
map ctrl+g>9 goto_tab 9
map ctrl+g>0 goto_tab 10
map alt+c copy_to_clipboard
map ctrl+alt+c copy_to_clipboard
map alt+v paste_from_clipboard
map ctrl+alt+v paste_from_clipboard
mouse_map left click ungrabbed mouse_click_url_or_select
mouse_map alt+left press ungrabbed mouse_selection rectangle
# Gruvbox Dark
selection_foreground #282828
selection_background #83a598
foreground #ebdbb2
background #282828
cursor #fb4934
cursor_text_color #282828
color0 #282828
color1 #cc241d
color2 #98971a
color3 #d79921
color4 #458588
color5 #b16286
color6 #689d6a
color7 #a89984
color8 #928374
color9 #fb4934
color10 #b8bb26
color11 #fabd2f
color12 #83a598
color13 #d3869b
color14 #8ec07c
color15 #ebdbb2

3
dot_config/nvim/init.lua Normal file
View file

@ -0,0 +1,3 @@
require('settings')
require('maps')
require('plugins')

View file

@ -0,0 +1,31 @@
vim.g.mapleader = ' '
function map(mode, key, action)
vim.api.nvim_set_keymap(mode, key, action, {noremap = true})
end
function unmap(key)
map('', key, '')
end
-- some unmaps
unmap(' ')
unmap('q')
unmap('<F1>')
-- option control
map('n', '<Leader>c', ':setlocal cursorline!<CR>')
map('n', '<Leader>l', ':setlocal list!<CR>')
map('n', '<Leader>w', ':setlocal wrap!<CR>')
-- search
map('n', '<Leader>/', ':noh<CR>')
-- copy / paste
map('n', '<Leader>y', '"+y')
map('n', '<Leader>d', '"+d')
map('n', '<Leader>p', '"+p')
map('n', '<Leader>P', '"+P')
-- keymap switch
map('!', '<C-Space>', '<C-^>')
map('!', '<C-@>', '<C-^>')

View file

@ -0,0 +1,55 @@
-- [[ plugins bootstrap ]]
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
local lazyurl = "https://github.com/folke/lazy.nvim.git"
local lazycmd = {"git", "clone", "--filter=blob:none", "--branch=stable", lazyurl, lazypath}
if not vim.loop.fs_stat(lazypath) then vim.fn.system(lazycmd) end
vim.opt.rtp:prepend(lazypath)
--[[ plugins list ]]
require('lazy').setup {
{'ellisonleao/gruvbox.nvim', priority = 1000, config = true},
{'w0rp/ale', cmd = 'ALEEnable', ft = {'bash', 'go', 'lua', 'python', 'sh', 'zsh'}},
'smoka7/hop.nvim',
'kdheepak/lazygit.nvim',
'nvim-telescope/telescope.nvim',
'nvim-treesitter/nvim-treesitter',
'lewis6991/gitsigns.nvim',
'lifepillar/vim-cheat40',
'nvim-lualine/lualine.nvim',
'tpope/vim-rsi',
'tpope/vim-vinegar',
{'nvim-lua/plenary.nvim', lazy = true},
}
--[[ plugin configs and maps ]]
require('hop').setup()
require('gitsigns').setup()
require('gruvbox').setup {
italic = {strings = false},
terminal_colors = true
}
require('nvim-treesitter.configs').setup {
highlight = {
enable = true
}
}
require('lualine').setup {
options = {
icons_enabled = false,
section_separators = {left = nil, right = nil},
component_separators = {left = "\u{2022}", right = "\u{2022}"}
}
}
map('n', '<Leader>f', '<cmd>HopWord<CR>')
map('n', '<Leader>g', '<cmd>LazyGit<CR>')
map('n', '<Leader>L', '<cmd>Lazy<CR>')
map('n', '<Leader>?', '<cmd>Cheat40<CR>')
map('n', '<Leader>.', '<cmd>Telescope git_files<CR>')
map('n', '<Leader>,', '<cmd>Telescope buffers<CR>')
--[[ theme ]]
vim.o.termguicolors = true
vim.o.bg = 'dark'
vim.cmd [[colorscheme gruvbox]]

View file

@ -0,0 +1,30 @@
vim.o.modeline = false
vim.o.foldmethod = 'marker'
vim.o.cursorline = false
vim.o.colorcolumn = '80'
vim.o.relativenumber = true
vim.o.breakindent = true
vim.o.clipboard = 'unnamedplus'
vim.o.statusline = '[%F] %R%H%W%M %=[%{&fenc}/%{&ff}] %y [%4l/%L:%3v]'
vim.o.list = true
vim.o.listchars = 'tab:|_,nbsp:x,trail:*'
vim.o.ignorecase = true
vim.o.smartcase = true
vim.o.scrolloff = 3
vim.o.sidescrolloff = 15
vim.o.tabstop = 8
vim.o.softtabstop = 3
vim.o.shiftwidth = 4
vim.o.expandtab = true
vim.o.keymap = 'russian-jcukenwintype'
vim.o.iminsert = 0
vim.o.imsearch = 0
local fsize = '11'
if vim.loop.os_uname().sysname == 'Darwin' then fsize = '14' end
vim.o.guifont = 'Vascadia Mono PL:h' .. fsize

View file

@ -0,0 +1,7 @@
set -x LESS 'i n M R S'
set -x PAGER less
set -x EDITOR hx
set -x TIME_STYLE long-iso
set -x SSH_AUTH_SOCK "$XDG_RUNTIME_DIR/ssh-agent.socket"
set -x ALTERNATE_EDITOR ""
set -U fish_greeting

View file

@ -0,0 +1,3 @@
function atmux
tmux attach || tmux
end

View file

@ -0,0 +1,3 @@
function diff
command diff --color $argv
end

View file

@ -0,0 +1,3 @@
function g
command lazygit $argv
end

View file

@ -0,0 +1,3 @@
function gci
command git commit $argv
end

View file

@ -0,0 +1,3 @@
function grep
command grep --color=auto $argv
end

View file

@ -0,0 +1,6 @@
function greset
read -P "OK to reset and clean teh repo?"\n -ln1 resp
test "$resp" != y && return 0
command git clean -fd
command git reset --hard
end

View file

@ -0,0 +1,6 @@
function groot
set -l is_git_worktree (command git rev-parse --is-inside-work-tree)
string match -qe 'true' "$is_git_worktree" || return
set -l root (command git rev-parse --show-toplevel)
test $status -eq 0 && cd $root
end

View file

@ -0,0 +1,3 @@
function gsi
termcompat tig status
end

View file

@ -0,0 +1,3 @@
function gsl
command git stash list $argv
end

View file

@ -0,0 +1,3 @@
function gss
command git status -sbu $argv
end

View file

@ -0,0 +1,3 @@
function gsw
command git switch $argv
end

View file

@ -0,0 +1,3 @@
function gup
command git pull $argv
end

View file

@ -0,0 +1,5 @@
function gwta
groot && cd ..
command git worktree add $argv
cd $argv
end

View file

@ -0,0 +1,3 @@
function gwtp
command git worktree prune --verbose
end

View file

@ -0,0 +1,3 @@
function k
command kubectl $argv
end

View file

@ -0,0 +1,3 @@
function kc
command kubectl config $argv
end

View file

@ -0,0 +1,3 @@
function kg
command kubectl get $argv
end

View file

@ -0,0 +1,3 @@
function kshell
command kubectl exec -n "$1" --stdin --tty "$2" -- /bin/sh
end

View file

@ -0,0 +1,3 @@
function ksw
command kubecm switch $argv
end

View file

@ -0,0 +1,3 @@
function ll
ls -alg $argv
end

View file

@ -0,0 +1,3 @@
function ls
command eza --group-directories-first --icons $argv
end

View file

@ -0,0 +1,3 @@
function rgrep
grep --exclude-dir=.git -R $argv
end

View file

@ -0,0 +1,3 @@
function s
termcompat ssh $argv
end

View file

@ -0,0 +1,3 @@
function tailf
command less +F $argv
end

View file

@ -0,0 +1,15 @@
function termcompat
set -l term $TERM
switch $term
case 'alacritty*' 'kitty*' 'wezterm' 'xterm-*'
set term xterm
case 'rxvt-unicode-*'
set term rxvt-unicode
case 'tmux*'
set term screen.xterm-new
end
begin
set -lx TERM $term
command $argv
end
end

View file

@ -0,0 +1,3 @@
function tig
termcompat tig $argv
end

View file

@ -0,0 +1,3 @@
function tmux
command tmux -2 $argv
end

View file

@ -0,0 +1,3 @@
function whence
command -v $argv
end

22
dot_config/starship.toml Normal file
View file

@ -0,0 +1,22 @@
format = '[\[](bright-black) $all[\]](bright-black)$character'
add_newline = false
[git_status]
conflicted = '*'
ahead = '↑'
behind = '↓'
diverged = '?'
up_to_date = ''
untracked = '!'
stashed = '$'
modified = '~'
staged = '+'
renamed = '→'
deleted = '×'
typechanged = ''
[character]
format = "\n[❯](bright-black) "
[line_break]
disabled = true

223
dot_config/sway/config Normal file
View file

@ -0,0 +1,223 @@
# Logo key. Use Mod1 for Alt.
set $mod Mod4
# Home row direction keys, like vim
set $left h
set $down j
set $up k
set $right l
set $term ghostty
set $font_symb Font Awesome 6 Free
set $font_face IBM Plex Mono
set $font_size 10
font pango:$font_face, $font_symb $font_size
#set $wallpaper /home/von/.wallpaper
default_border pixel
default_floating_border pixel
seat seat0 xcursor_theme Vanilla-DMZ-AA
#output * bg $wallpaper fill
output Virtual-1 resolution 1920x1080 scale 2
#exec swayidle -w \
# timeout 300 'swaylock -f -i '$wallpaper \
# timeout 600 'swaymsg "output * dpms off"' \
# resume 'swaymsg "output * dpms on"' \
# before-sleep 'swaylock -f -i '$wallpaper
#bindsym --to-code $mod+z exec 'swaylock -f -i '$wallpaper
# This will lock your screen after 300 seconds of inactivity, then turn off
# your displays after another 300 seconds, and turn your screens back on when
# resumed. It will also lock your screen before your computer goes to sleep.
# keys:
# Start a terminal
bindsym --to-code $mod+x exec $term
# Kill focused window
bindsym --to-code $mod+Shift+c kill
# Start your launcher
bindsym --to-code $mod+d exec bemenu-run -i --fn "$font_face $font_size" --no-exec | xargs swaymsg exec --
bindsym --to-code $mod+u exec bemenu-pass -i --fn "$font_face $font_size"
# Drag floating windows by holding down $mod and left mouse button.
# Resize them with right mouse button + $mod.
# Despite the name, also works for non-floating windows.
# Change normal to inverse to use left mouse button for resizing and right
# mouse button for dragging.
floating_modifier $mod normal
# Reload the configuration file
bindsym --to-code $mod+Shift+r reload
# Exit sway (logs you out of your Wayland session)
bindsym --to-code $mod+Shift+e exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit'
# Screenshot
bindsym --to-code $mod+Shift+s exec screenshot-tool
#
# Moving around:
#
# Move your focus around
bindsym --to-code $mod+$left focus left
bindsym --to-code $mod+$down focus down
bindsym --to-code $mod+$up focus up
bindsym --to-code $mod+$right focus right
# Or use $mod+[up|down|left|right]
bindsym --to-code $mod+Left focus left
bindsym --to-code $mod+Down focus down
bindsym --to-code $mod+Up focus up
bindsym --to-code $mod+Right focus right
# Move the focused window with the same, but add Shift
bindsym --to-code $mod+Shift+$left move left
bindsym --to-code $mod+Shift+$down move down
bindsym --to-code $mod+Shift+$up move up
bindsym --to-code $mod+Shift+$right move right
# Ditto, with arrow keys
bindsym --to-code $mod+Shift+Left move left
bindsym --to-code $mod+Shift+Down move down
bindsym --to-code $mod+Shift+Up move up
bindsym --to-code $mod+Shift+Right move right
#
# Workspaces:
#
# move to another screen
bindsym --to-code $mod+Shift+o move workspace to output left
# switch between recent workspaces
bindsym --to-code $mod+o workspace back_and_forth
# Switch to workspace
bindsym --to-code $mod+1 workspace 1
bindsym --to-code $mod+2 workspace 2
bindsym --to-code $mod+3 workspace 3
bindsym --to-code $mod+4 workspace 4
bindsym --to-code $mod+5 workspace 5
bindsym --to-code $mod+6 workspace 6
bindsym --to-code $mod+7 workspace 7
bindsym --to-code $mod+8 workspace 8
bindsym --to-code $mod+9 workspace 9
bindsym --to-code $mod+0 workspace 10
# Move focused container to workspace
bindsym --to-code $mod+Shift+1 move container to workspace 1
bindsym --to-code $mod+Shift+2 move container to workspace 2
bindsym --to-code $mod+Shift+3 move container to workspace 3
bindsym --to-code $mod+Shift+4 move container to workspace 4
bindsym --to-code $mod+Shift+5 move container to workspace 5
bindsym --to-code $mod+Shift+6 move container to workspace 6
bindsym --to-code $mod+Shift+7 move container to workspace 7
bindsym --to-code $mod+Shift+8 move container to workspace 8
bindsym --to-code $mod+Shift+9 move container to workspace 9
bindsym --to-code $mod+Shift+0 move container to workspace 10
# Note: workspaces can have any name you want, not just numbers.
# We just use 1-10 as the default.
#
# Layout stuff:
#
# You can "split" the current object of your focus with
# $mod+b or $mod+v, for horizontal and vertical splits
# respectively.
bindsym --to-code $mod+b splith
bindsym --to-code $mod+v splitv
# Switch the current container between different layout styles
bindsym --to-code $mod+s layout stacking
bindsym --to-code $mod+w layout tabbed
bindsym --to-code $mod+e layout toggle split
# Make the current focus fullscreen
bindsym --to-code $mod+f fullscreen
# Toggle the current focus between tiling and floating mode
bindsym --to-code $mod+Shift+Return floating toggle
# Swap focus between the tiling area and the floating area
bindsym --to-code $mod+Return focus mode_toggle
# Move focus to the parent container
bindsym --to-code $mod+a focus parent
#
# Scratchpad:
#
# Sway has a "scratchpad", which is a bag of holding for windows.
# You can send windows there and get them back later.
# Move the currently focused window to the scratchpad
bindsym --to-code $mod+Shift+minus move scratchpad
# Show the next scratchpad window or hide the focused scratchpad window.
# If there are multiple scratchpad windows, this command cycles through them.
bindsym --to-code $mod+minus scratchpad show
#
# Resizing containers:
#
mode "resize" {
# left will shrink the containers width
# right will grow the containers width
# up will shrink the containers height
# down will grow the containers height
bindsym --to-code $left resize shrink width 10px
bindsym --to-code $down resize grow height 10px
bindsym --to-code $up resize shrink height 10px
bindsym --to-code $right resize grow width 10px
# Ditto, with arrow keys
bindsym --to-code Left resize shrink width 10px
bindsym --to-code Down resize grow height 10px
bindsym --to-code Up resize shrink height 10px
bindsym --to-code Right resize grow width 10px
# Return to default mode
bindsym --to-code Return mode "default"
bindsym --to-code Escape mode "default"
}
bindsym --to-code $mod+r mode "resize"
bindsym --to-code XF86AudioRaiseVolume exec "pactl set-sink-volume 0 +5%"
bindsym --to-code XF86AudioLowerVolume exec "pactl set-sink-volume 0 -5%"
bindsym --to-code XF86AudioMute exec "pactl set-sink-volume 0 0%"
#
# Status Bar:
#
# Read `man 5 sway-bar` for more information about this section.
bar {
position top
status_command "i3status-rs"
colors {
separator #6d0080
background #2c2c2c
statusline #ffffff
}
}
input "type:keyboard" {
xkb_layout "us,ru"
xkb_variant ",typewriter"
xkb_options "grp:win_space_toggle,compose:menu,ctrl:nocaps"
}
input "type:touchpad" {
dwt disabled
tap disabled
natural_scroll disabled
click_method clickfinger
}
# scratchpad
for_window [app_id="keepassxc"] move scratchpad, scratchpad show
bindsym --to-code $mod+i [app_id="keepassxc"] scratchpad show
# other settings
workspace_auto_back_and_forth yes
focus_wrapping yes
# autostart
exec mako
include /etc/sway/config.d/*

View file

@ -0,0 +1,15 @@
local function get_os()
local current_os = os.getenv('OS')
if current_os then return current_os end
return io.popen('uname -s', 'r'):read()
end
local function set_by_os(values)
local my_os = get_os()
if values[my_os] then return values[my_os] end
return values.others
end
return {
set_by_os = set_by_os
}

View file

@ -0,0 +1,39 @@
local act = require('wezterm').action
local leader_key = { key = 'g', mods = 'CTRL', timeout_milliseconds = 1000 }
local keybinds = {
{ key = 'c', mods = 'META', action = act.CopyTo('Clipboard') },
{ key = 'v', mods = 'META', action = act.PasteFrom('Clipboard') },
-- overrides
{ key = 'y', mods = 'LEADER', action = act.EmitEvent('override-fonts') },
{ key = 't', mods = 'LEADER', action = act.EmitEvent('override-theme') },
{ key = 'r', mods = 'LEADER', action = act.EmitEvent('override-reset') },
-- misc
{ key = 'f', mods = 'LEADER', action = act.ToggleFullScreen },
-- tabs
{ key = 'c', mods = 'LEADER', action = act.SpawnTab('DefaultDomain') },
{ key = 'n', mods = 'LEADER', action = act.ActivateTabRelative( 1) },
{ key = 'p', mods = 'LEADER', action = act.ActivateTabRelative(-1) },
-- panes
{ key = 's', mods = 'LEADER', action = act.SplitVertical { domain = 'CurrentPaneDomain' } },
{ key = 'v', mods = 'LEADER', action = act.SplitHorizontal { domain = 'CurrentPaneDomain' } },
{ key = 'h', mods = 'LEADER', action = act.ActivatePaneDirection('Left') },
{ key = 'j', mods = 'LEADER', action = act.ActivatePaneDirection('Down') },
{ key = 'k', mods = 'LEADER', action = act.ActivatePaneDirection('Up') },
{ key = 'l', mods = 'LEADER', action = act.ActivatePaneDirection('Right') },
{ key = 'u', mods = 'LEADER', action = act.RotatePanes('Clockwise') },
{ key = 'i', mods = 'LEADER', action = act.RotatePanes('CounterClockwise') },
{ key = 'Return', mods = 'LEADER', action = act.TogglePaneZoomState },
{ key = 'Space', mods = 'LEADER', action = act.PaneSelect },
}
for i = 1, 9 do
table.insert(
keybinds,
{ key = tostring(i), mods = 'LEADER', action = act.ActivateTab(i - 1) }
)
end
return {
leader = leader_key,
keybinds = keybinds
}

View file

@ -0,0 +1,65 @@
local wt = require('wezterm')
local current = {}
-- colors
local color_scheme = 'Solarized Light (Gogh)'
local tab_fg = '#657b83'
local tab_bg = '#eee8d5'
local tab_bg_active = '#fdf6e3'
local cursor_fg = '#fdf6e3'
local cursor_bg = '#cb4b16'
-- fonts
local fonts = wt.config_builder()
fonts.font = wt.font('IBM Plex Mono')
fonts.harfbuzz_features = {'ss03'}
-- theme
local theme = wt.config_builder()
theme.color_scheme = color_scheme
theme.colors = {
cursor_fg = cursor_fg,
cursor_bg = cursor_bg,
tab_bar = {
background = tab_bg,
active_tab = {
fg_color = tab_fg,
bg_color = tab_bg_active
},
inactive_tab = {
fg_color = tab_fg,
bg_color = tab_bg
}
}
}
theme.colors.tab_bar.inactive_tab_hover = theme.colors.tab_bar.inactive_tab
theme.window_frame = {
active_titlebar_bg = tab_bg,
inactive_titlebar_bg = tab_bg
}
local overrides = {
fonts = fonts,
theme = theme
}
local function toggle_overrides(window, conf)
for k, v in pairs(conf) do
if current[k] == v then
current[k] = nil
else
current[k] = v
end
end
window:set_config_overrides(current)
end
local function reset_overrides(window)
window:set_config_overrides()
current = {}
end
wt.on('override-theme', function(window) toggle_overrides(window, overrides.theme) end)
wt.on('override-fonts', function(window) toggle_overrides(window, overrides.fonts) end)
wt.on('override-reset', reset_overrides)

View file

@ -0,0 +1,72 @@
local wt = require('wezterm')
local kb = require('keybinds')
local fn = require('functions')
-- colors
local color_scheme = 'GruvboxDark'
local tab_fg = '#ebdbb2'
local tab_bg = '#504945'
local tab_bg_active = '#282828'
local cursor_fg = '#ebdbb2'
local cursor_bg = '#d65d0e'
-- misc
local cfg = wt.config_builder()
cfg.leader = kb.leader
cfg.keys = kb.keybinds
cfg.audible_bell = 'Disabled'
cfg.check_for_updates = false
-- fonts & text
cfg.cursor_blink_rate = 0
cfg.bold_brightens_ansi_colors = false
cfg.font = wt.font('Cascadia Mono PL')
cfg.harfbuzz_features = {"ss01", "ss19", "ss20"}
cfg.font_size = fn.set_by_os{
Darwin = 14,
others = 10
}
-- visuals
cfg.native_macos_fullscreen_mode = false
cfg.window_decorations = 'RESIZE'
cfg.xcursor_theme = 'Adwaita'
cfg.use_fancy_tab_bar = false
cfg.hide_tab_bar_if_only_one_tab = false
cfg.show_new_tab_button_in_tab_bar = false
cfg.tab_max_width = 24
cfg.window_padding = {
left = '5pt',
right = 0,
top = '2pt',
bottom = 0
}
-- theming
cfg.color_scheme = color_scheme
cfg.colors = {
cursor_fg = cursor_fg,
cursor_bg = cursor_bg,
tab_bar = {
background = tab_bg,
active_tab = {
fg_color = tab_fg,
bg_color = tab_bg_active
},
inactive_tab = {
fg_color = tab_fg,
bg_color = tab_bg
}
}
}
cfg.colors.tab_bar.inactive_tab_hover = cfg.colors.tab_bar.inactive_tab
cfg.window_frame = {
active_titlebar_bg = tab_bg,
inactive_titlebar_bg = tab_bg
}
-- callbacks
wt.on('format-window-title', function() return 'WezTerm' end)
require('overrides')
return cfg

View file

@ -0,0 +1,99 @@
# Fuck default aliases
unalias -a
function testbin { whence $@ > /dev/null }
function termcompat {
typeset term=$TERM
case $term in
(alacritty*) ;&
(kitty*) ;&
(wezterm) ;&
(xterm-*)
term=xterm;;
(rxvt-unicode*)
term=rxvt-unicode;;
(tmux*)
term=screen.xterm-new;;
esac
TERM=$term command $@
}
function addpath {
typeset newpath=$1
if [[ ! $PATH =~ $newpath ]]; then
PATH+=:$newpath
export PATH
fi
}
function fsf {
typeset host prompt="SSH Remote > "
host=$(cut -d\ -f1 $HOME/.ssh/known_hosts | sort -u | fzf --prompt=$prompt) || return 1
termcompat ssh $host $@
}
function beep { printf $'\007' }
function fixterm { printf $'\u001bc' }
function diff { command diff --color $@ }
function tailf { command less +F $@ }
function grep { command grep --color=auto $@ }
function rgrep { grep --exclude-dir=.git -R $@ }
function s { termcompat ssh $@ }
function tmux { command tmux -2 $@ }
function atmux { tmux attach || tmux }
function ksw { command kubecm switch $@ }
function k { command kubectl $@ }
function kg { command kubectl get $@ }
function kc { command kubectl config $@ }
function kshell { command kubectl exec -n $1 --stdin --tty $2 -- /bin/sh }
function g { command lazygit $@ }
function gci { command git commit $@ }
function gsl { command git stash list $@ }
function gss { command git status -sbu $@ }
function gsw { command git switch $@ }
function gup { command git pull $@ }
function gwta { command git worktree add $@ }
function gwtp { command git worktree prune -v }
function groot { cd $(command git rev-parse --show-toplevel) || return 0 }
function gdiff { command git diff --color $@ }
function greset {
echo "OK to reset and clean teh repo?"
read -sq _
(( $? )) && return 1
command git clean -fd
command git reset --hard
}
if testbin diff-so-fancy; then
function gdf { gdiff $@ | command diff-so-fancy | command less --tabs=4 -RSFX }
else
function gdf { gdiff $@ }
fi
if testbin eza; then
function ls { command eza --group-directories-first $@ }
function ll { ls -alg $@ }
function ld { ls -dlg $@ }
else
function ls { command ls --color=auto --group-directories-first $@ }
function ll { ls -alh $@ }
function ld { ls -dlh $@ }
fi
# grc
if testbin grc; then
cmds=(\
cc configure cvs df dig gcc gmake id ip last lsof make mount \
mtr netstat ping ping6 ps tcpdump traceroute traceroute6 \
)
for cmd in $cmds; do
eval "function $cmd { command grc -es --colour=auto $cmd \$@ }"
done
unset cmds cmd
fi

183
dot_config/zsh/prompt.zsh Normal file
View file

@ -0,0 +1,183 @@
prompt_fmtn='[ %%{\e[2;3m%%}%s%%{\e[0m%%} ] '
printf -v PROMPT2 $prompt_fmtn '%_'
printf -v PROMPT3 $prompt_fmtn '?#'
printf -v PROMPT4 $prompt_fmtn '+%N:%i'
prompt_fifo=$HOME/.zsh_gitstatus_$$
prompt_blimit=50
kube_config=$HOME/.kube/config
typeset -A prompt_symbols=(
sep_a $'\ue0b0'
ellipsis $'\u2026'
git $'\ue0a0'
git_unstaged '~'
git_staged $'\u2713'
git_untracked '!'
git_unmerged '*'
helm $'\u2388'
bang $'\u276f'
)
typeset -A prompt_colors=(
# fg '15'
root '1'
ssh '15'
cwd '4'
git_branch ''
git_unstaged '3'
git_staged '6'
git_untracked '1'
git_unmerged '5'
kube_context '2'
brackets '8'
bang '8'
)
prompt.set_bang() {
(( $# )) || return 1
prompt_symbols[bang]=$1
}
precmd.window_title() {
typeset dir=$(pwd)
printf '\033]0;%s:%s\007' ${HOST%%.*} ${dir##*/}
}
precmd.has_kube() {
[[ -r $kube_config ]]
}
precmd.kube_context() {
typeset kube_context=$(awk -F- '($1 == "current") {print $3}' $kube_config)
precmd.prompt.add $prompt_symbols[helm]
precmd.prompt.add $kube_context $prompt_colors[kube_context]
}
precmd.is_git_repo() {
typeset prompt_git_dir
prompt_git_dir=$(git rev-parse --git-dir 2>/dev/null) || return 1
[[ ! -e $prompt_git_dir/nozsh ]]
}
precmd.prompt.add() {
(( $# )) || return 1
typeset data=$1 color=$2
[[ -n $prompt_string ]] && prompt_string+=" "
if [[ -n $color ]]; then
prompt_string+="%F{$color}$data%f"
else
prompt_string+="$data"
fi
}
precmd.prompt.add_pl() {
(( $# < 2 )) && return 1
typeset data=$1 color=$2
if [[ -z $prompt_string ]]; then
prompt_string+="%K{$color}%F{$prompt_colors[fg]} $data "
else
prompt_string+="%F{$prev_color}%K{$color}$prompt_symbols[sep_a]%F{$prompt_colors[fg]} $data "
fi
prev_color=$color
}
precmd.prompt.apply() {
PROMPT=$prompt_string
unset prompt_string
}
precmd.prompt.pre_git() {
precmd.prompt.add "$prompt_symbols[git] $prompt_symbols[ellipsis]" $prompt_colors[git_branch]
}
precmd.prompt.git() {
typeset raw_status IFS=
raw_status=$(git status --porcelain -bu 2>/dev/null) || return 0
typeset -A count
while read line; do
case $line[1,2] in
('##')
typeset branch_status=${line[4,-1]%%...*}
((${#branch_status}>prompt_blimit)) && \
branch_status=$branch_status[1,$prompt_blimit]$prompt_symbols[ellipsis]
[[ $line =~ behind ]] && branch_status+=?
[[ $line =~ ahead ]] && branch_status+=!
precmd.prompt.add "$prompt_symbols[git] $branch_status" $prompt_colors[git_branch]
;;
(?[MD]) (( ++count[git_unstaged] )) ;|
([MDARC]?) (( ++count[git_staged] )) ;|
('??') (( ++count[git_untracked] )) ;|
([ADU][ADU]) (( ++count[git_unmerged] ))
esac
done <<< $raw_status
for i in git_untracked git_unmerged git_unstaged git_staged; do
(( count[$i] )) && precmd.prompt.add "$count[$i]$prompt_symbols[$i]" $prompt_colors[$i]
done
}
precmd.prompt() {
typeset -g prompt_string= prev_color=
precmd.prompt.add '[' $prompt_colors[brackets]
(( UID )) \
|| precmd.prompt.add '#' $prompt_colors[root]
[[ -n $SSH_CONNECTION ]]\
&& precmd.prompt.add %n@%m $prompt_colors[ssh]
precmd.prompt.add %~ $prompt_colors[cwd]
if precmd.has_kube; then
precmd.kube_context
fi
[[ $1 == pre_git ]]\
&& precmd.prompt.pre_git
[[ $1 == git ]]\
&& precmd.prompt.git
precmd.prompt.add $']\n' $prompt_colors[brackets]
prompt_string+="%F{$prompt_colors[bang]}$prompt_symbols[bang]%f "
}
precmd.git_update() {
precmd.prompt git
[[ ! -p $prompt_fifo ]] && mkfifo -m 0600 $prompt_fifo
echo -n $prompt_string > $prompt_fifo &!
kill -s USR1 $$
}
precmd.prompt.update() {
typeset -g prompt_string=$(<$prompt_fifo)
precmd.prompt.apply
zle && zle reset-prompt
}
precmd() {
precmd.window_title
if precmd.is_git_repo; then
precmd.prompt pre_git
precmd.git_update &!
else
precmd.prompt
fi
precmd.prompt.apply
}
TRAPUSR1() {
precmd.prompt.update
}
TRAPEXIT() {
[[ -p $prompt_fifo ]] && rm $prompt_fifo
}
function zle-line-init zle-keymap-select {
local seq=$'\e[2 q'
[[ $KEYMAP == vicmd ]] && seq=$'\e[4 q'
printf $seq
}
zle -N zle-line-init
zle -N zle-keymap-select

View file

@ -0,0 +1,45 @@
# disable the bloody ^S / ^Q
stty -ixon
setopt APPEND_HISTORY EXTENDED_HISTORY HIST_IGNORE_DUPS EXTENDED_GLOB AUTO_CD AUTO_PUSHD PRINT_EXIT_VALUE
unsetopt BEEP NO_MATCH NOTIFY MENU_COMPLETE AUTO_MENU
SAVEHIST=1000
HISTSIZE=1000
HISTFILE=$HOME/.histfile.$UID
EDITOR=vim
whence hx >/dev/null && EDITOR=hx
export EDITOR
export LESS='i M R'
export PAGER=less
export TIME_STYLE=long-iso
export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.socket"
bindkey -e
bindkey $terminfo[kdch1] delete-char
bindkey $terminfo[khome] beginning-of-line
bindkey $terminfo[kend] end-of-line
bindkey '^[' vi-cmd-mode
# autocompletion
autoload -Uz compinit
compinit
zstyle ':completion:*' completer _list _complete _ignored
zstyle ':completion:*' insert-unambiguous true
zstyle ':completion:*' file-sort name
zstyle ':completion:*' format 'Completing %d'
zstyle ':completion:*' group-name ''
zstyle ':completion:*' list-colors ''
zstyle ':completion:*' list-prompt '%SAt %p: Hit TAB for more, or the character to insert%s'
zstyle ':completion:*' list-suffixes true
zstyle ':completion:*' original true
zstyle ':completion:*' select-prompt '%SScrolling active: current selection at %p%s'
zstyle ':completion:*' matcher-list 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}' '+l:|=* r:|=*'
zstyle ':completion:*' rehash true
zstyle ':completion:*:kill:*:processes' command 'ps --forest -A -o pid,user,cmd'
zstyle ':completion:*:processes-names' command 'ps axho command'
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
unalias ld ls ll &>/dev/null