├── .gitattributes ├── .gitignore ├── config-root.yaml ├── config.yaml ├── dotfiles-root ├── aptitude │ ├── .gitignore │ └── config ├── sudoers.local ├── sway-run ├── sway-run.desktop └── tzupdate │ ├── 99-tzupdate │ └── tzupdate └── dotfiles ├── R └── Rprofile ├── alacritty ├── base.toml ├── desert-theme.toml └── material-theme.toml ├── atuin └── config.toml ├── awesome ├── .vscode │ └── settings.json ├── eldritch │ ├── applets │ │ ├── battery.lua │ │ ├── cal.lua │ │ ├── cpu.lua │ │ ├── docker.lua │ │ ├── inhibit.lua │ │ ├── init.lua │ │ ├── memory.lua │ │ ├── notifhist.lua │ │ └── rhino.lua │ ├── init.lua │ ├── mpris.lua │ ├── osd.lua │ ├── separator.lua │ ├── tooltip.lua │ ├── utils.lua │ ├── widgets │ │ ├── circularprogressbar.lua │ │ └── init.lua │ ├── workers │ │ ├── docker.lua │ │ ├── init.lua │ │ └── rhino.lua │ └── xdg_menu.lua ├── inspect.lua ├── pulse │ ├── init.lua │ ├── pulse.lua │ └── widget.lua ├── rc.lua ├── scratch │ ├── drop.lua │ ├── init.lua │ ├── pad.lua │ └── uniqdrop.lua ├── themes │ └── desert │ │ ├── .gitignore │ │ ├── icons │ │ ├── awesome-icon.png │ │ ├── layouts │ │ │ ├── cornernw.png │ │ │ ├── dwindle.png │ │ │ ├── fairh.png │ │ │ ├── fairv.png │ │ │ ├── floating.png │ │ │ ├── magnifier.png │ │ │ ├── max.png │ │ │ ├── tile.png │ │ │ ├── tilebottom.png │ │ │ └── tileleft.png │ │ ├── submenu.png │ │ ├── taglist │ │ │ ├── squarefz.png │ │ │ └── squarez.png │ │ └── widgets │ │ │ ├── battery.png │ │ │ ├── cpu.png │ │ │ ├── docker.png │ │ │ ├── docker_active.png │ │ │ ├── inhibit.png │ │ │ ├── inhibit_active.png │ │ │ ├── memory.png │ │ │ ├── notifhist.png │ │ │ ├── rhino.png │ │ │ ├── rhino_active.png │ │ │ ├── separator.png │ │ │ └── volume.png │ │ └── theme.lua └── xrandr.lua ├── bash ├── bash_logout ├── bash_profile └── bashrc ├── bat ├── config ├── syntaxes │ └── cue.sublime-syntax └── themes │ └── ansi.tmTheme ├── bibtoolrsc ├── bin ├── daily-cleanup ├── get-machine-id ├── grimshot-wrapper ├── idle-notify ├── sack ├── systemd-mail └── toggledark ├── ctags ├── digrc ├── excludes ├── archive └── diff ├── fontconfig └── conf.d │ ├── 20-hinting.conf │ ├── 20-tahoma.conf │ ├── 30-aliases.conf │ ├── 30-overrides.conf │ ├── 45-latin.conf │ └── 60-latin.conf ├── fuzzel └── fuzzel.ini ├── gdbinit ├── git ├── attributes ├── config ├── hooks │ ├── commit-msg │ ├── commit-msg.d │ │ └── 50_check-format │ ├── post-checkout │ ├── post-checkout.d │ │ └── 50_prune-local-branches │ ├── pre-commit │ ├── pre-commit.d │ │ └── 50_check-whitespace │ ├── reference-transaction │ ├── reference-transaction.d │ │ └── 50_record-parent-branch │ └── stub └── ignore ├── gnuplot ├── bw.gnuplot ├── gnuplot └── grey.gnuplot ├── idea ├── idea.properties ├── idea64.vmoptions └── ideavimrc ├── inputrc ├── irbrc ├── keynavrc ├── kitty ├── .gitignore ├── diff.conf ├── init.vim ├── kitty.conf ├── pyproject.toml ├── select_scrollback.py ├── tab_bar.py ├── theme-desert.conf └── theme-material.conf ├── latexmk └── latexmkrc ├── lazygit └── config.yml ├── less ├── lessfilter └── lesskey ├── lua ├── init.lua └── luarocks-config.lua ├── mise └── config.toml ├── moc ├── .gitignore ├── config ├── keymap └── themes │ └── desert_theme ├── mozilla ├── user.js └── userChrome.css ├── ncdu └── config ├── ncmpcpp ├── bindings └── config ├── nethackrc ├── offlineimap ├── config └── helpers.py ├── picom-vbox.conf ├── picom.conf ├── psqlrc ├── python └── mypy.ini ├── ranger ├── .gitignore ├── colorschemes │ ├── __init__.py │ └── desert.py ├── commands.py ├── rc.conf ├── rifle.conf └── scope.sh ├── redshift.conf ├── ripgreprc ├── rofi ├── config.rasi └── desert.rasi ├── ruff └── pyproject.toml ├── shell-common ├── dircolors └── profile ├── shellcheckrc ├── ssh_config ├── sshrc ├── .sshrc └── .sshrc.d │ ├── dircolors │ ├── get-machine-id │ ├── git │ ├── config │ └── config.default │ ├── inputrc │ ├── lessfilter │ ├── lesskey │ ├── tmux-status │ ├── tmux.conf │ └── vimrc ├── starship.toml ├── sway ├── config ├── config.test ├── inactive-windows-transparency.py ├── pulse-notify.py ├── switch-top-level.py └── toggle-dark.py ├── swaync ├── config.json └── style.css ├── systemd ├── daily-cleanup.service ├── daily.target ├── daily.timer ├── status-mail@.service ├── weekly.target └── weekly.timer ├── tigrc ├── tmux ├── tmux-bind-root.conf ├── tmux-move-window ├── tmux-move-window-new ├── tmux-unbind-root.conf ├── tmux-vim-select-pane └── tmux.conf ├── vim ├── .gitignore ├── UltiSnips │ ├── all.snippets │ ├── ant.snippets │ ├── help.snippets │ ├── java.snippets │ ├── lua.snippets │ ├── python.snippets │ ├── sh.snippets │ ├── vim.snippets │ ├── xml.snippets │ ├── xsd.snippets │ └── zsh.snippets ├── after │ ├── ftplugin │ │ ├── help.vim │ │ └── xdefaults.vim │ └── plugin │ │ └── syntaxcomplete.vim ├── autoload │ ├── qftoggle.vim │ └── stl.vim ├── bundles │ ├── mark │ │ ├── autoload │ │ │ ├── mark.vim │ │ │ └── mark │ │ │ │ └── palettes.vim │ │ ├── doc │ │ │ └── mark.txt │ │ └── plugin │ │ │ └── mark.vim │ ├── templates │ │ ├── ftdetect │ │ │ └── template.vim │ │ ├── plugin │ │ │ └── templates.vim │ │ ├── syntax │ │ │ └── template.vim │ │ └── templates │ │ │ ├── python.template │ │ │ ├── sh.template │ │ │ ├── tex.template │ │ │ └── vim.template │ ├── vimflowy │ │ ├── ftdetect │ │ │ └── vf.vim │ │ ├── ftplugin │ │ │ └── vf.vim │ │ └── syntax │ │ │ └── vf.vim │ └── vimoutliner │ │ ├── INSTALL │ │ ├── LICENSE │ │ ├── doc │ │ └── vo_readme.txt │ │ ├── ftdetect │ │ └── otl.vim │ │ ├── ftplugin │ │ └── otl.vim │ │ └── syntax │ │ └── otl.vim ├── colors │ └── desert.vim ├── filetype.vim ├── ftplugin │ ├── c │ │ ├── if0comment.vim │ │ └── misc.vim │ ├── desktop.vim │ ├── help.vim │ ├── jproperties.vim │ ├── markdown.vim │ ├── nerdtree.vim │ ├── python │ │ ├── custom.vim │ │ └── jpythonfold.vim │ ├── qf.vim │ ├── tex.vim │ ├── vala.vim │ ├── xdefaults.vim │ └── yaml.vim ├── indent │ ├── c.vim │ ├── cpp.vim │ └── python.vim ├── init.vim ├── plugin │ ├── detect_indent.vim │ ├── dragvisuals.vim │ ├── emacsfilevars.vim │ ├── foldsearch.vim │ ├── footnotes.vim │ ├── gnuplot.vim │ ├── hlcurword.vim │ ├── pairs.vim │ ├── stl.vim │ ├── swapexists.vim │ ├── syntax_info.vim │ ├── textobj-number.vim │ ├── tmux_navigator.vim │ └── undowarnings.vim ├── scripts.vim ├── syntax │ ├── c │ │ └── stdfuncs.vim │ ├── confluencewiki.vim │ ├── cpp │ │ ├── mozilla.vim │ │ └── stl.vim │ ├── diff.vim │ ├── dircolors.vim │ ├── tmux.vim │ ├── vala.vim │ └── vim.vim └── vimrc ├── waybar ├── config.jsonc ├── power_menu.xml └── style.css ├── xdg-desktop-portal-wlr └── config ├── xdg-desktop-portal ├── awesome-portals.conf └── sway-portals.conf ├── xkb ├── keymap │ └── default └── symbols │ └── majutsushi ├── xorg ├── Xresources ├── inputplug-hook ├── xsession ├── xsessionrc ├── xsettingsd └── xsettingsd-setup ├── yazi ├── init.lua ├── keymap.toml ├── packages.yaml ├── plugins │ ├── lessfilter.yazi │ │ └── main.lua │ ├── parent-arrow.yazi │ │ └── main.lua │ └── simple-close.yazi │ │ └── main.lua ├── theme.toml └── yazi.toml ├── zathurarc └── zsh ├── zsh ├── .zlogin ├── .zlogout ├── .zprofile ├── .zshenv ├── .zshrc ├── func │ ├── _extpwds │ ├── _git-log-divergence │ ├── _git-missing-commits │ ├── baseconv │ ├── git-escape-magic │ ├── giturl │ ├── hr │ ├── is-active-shell │ ├── jump-target │ ├── purge │ ├── rationalize-dots │ ├── showlinkchain │ ├── ssh-vm │ ├── svn │ └── update-third-party ├── logging ├── rcsstub ├── sourcedir ├── zlogin.d │ └── 10_shlvl ├── zlogout.d │ └── 90_logout ├── zprofile.d │ ├── 00_common_profile │ └── 99_local ├── zshenv.d │ ├── 01_profiling │ ├── 10_checks │ ├── 20_paths │ ├── 30_compat │ └── 90_misc └── zshrc.d │ ├── 00_autoload │ ├── 10_options │ ├── 11_prevars │ ├── 14_dircycle │ ├── 15_variables │ ├── 16_colours │ ├── 19_zinit │ ├── 20_completion │ ├── 20_dirhashes │ ├── 30_aliases │ ├── 30_osx │ ├── 50_dirprofiles │ ├── 80_dirstack │ ├── 80_history │ ├── 80_reporting │ ├── 80_zle │ ├── 85_prompt │ ├── 85_titles │ ├── 90_cleanfiles │ ├── 90_fzf │ ├── 98_misc │ ├── 99_pipenv │ ├── 99_tmux │ └── 99_zshrun └── zshenv /.gitattributes: -------------------------------------------------------------------------------- 1 | dotfiles/git/config whitespace=blank-at-eol,space-before-tab,indent-with-non-tab,blank-at-eof,cr-at-eol 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | *.hi 3 | 4 | tags-?? 5 | 6 | .nfs* 7 | -------------------------------------------------------------------------------- /dotfiles-root/aptitude/.gitignore: -------------------------------------------------------------------------------- 1 | cache 2 | -------------------------------------------------------------------------------- /dotfiles-root/sudoers.local: -------------------------------------------------------------------------------- 1 | Defaults insults 2 | 3 | # Don't create ~/.sudo_as_admin_successful file 4 | # https://github.com/sudo-project/sudo/issues/56 5 | Defaults !admin_flag 6 | 7 | # vim: ft=sudoers 8 | -------------------------------------------------------------------------------- /dotfiles-root/sway-run: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # https://man.sr.ht/~kennylevinsen/greetd/#how-to-set-xdg_session_typewayland 3 | 4 | # Session 5 | export XDG_SESSION_TYPE=wayland 6 | export XDG_SESSION_DESKTOP=sway 7 | export XDG_CURRENT_DESKTOP=sway 8 | 9 | # Wayland stuff 10 | export MOZ_ENABLE_WAYLAND=1 11 | export QT_QPA_PLATFORM=wayland 12 | export SDL_VIDEODRIVER=wayland 13 | export _JAVA_AWT_WM_NONREPARENTING=1 14 | export ELECTRON_OZONE_PLATFORM_HINT=auto 15 | 16 | # https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/1873 17 | export WLR_DRM_NO_MODIFIERS=1 18 | 19 | if [[ -f "$HOME/.profile" ]]; then 20 | . "$HOME/.profile" 21 | fi 22 | 23 | eval "$(ssh-agent -s)" 24 | 25 | # exec sway "$@" 26 | exec systemd-cat --identifier=sway sway "$@" 27 | 28 | # 29 | # If you use systemd and want sway output to go to the journal, use this 30 | # instead of the `exec sway "$@"` above: 31 | # 32 | # exec systemd-cat --identifier=sway sway "$@" 33 | # 34 | -------------------------------------------------------------------------------- /dotfiles-root/sway-run.desktop: -------------------------------------------------------------------------------- 1 | # Copy to /usr/local/share/wayland-sessions/ 2 | [Desktop Entry] 3 | Name=Sway-run 4 | Comment=An i3-compatible Wayland compositor 5 | Exec=sway-run 6 | Type=Application 7 | DesktopNames=sway 8 | -------------------------------------------------------------------------------- /dotfiles-root/tzupdate/99-tzupdate: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | IFACE="$1" 4 | ACTION="$2" 5 | 6 | [[ "$IFACE" == tun* ]] && exit 0 7 | 8 | # [[ "$CONNECTION_ID" == some-vpn ]] && exit 0 9 | 10 | if [[ "$ACTION" == up ]]; then 11 | sudo tzupdate 12 | fi 13 | -------------------------------------------------------------------------------- /dotfiles-root/tzupdate/tzupdate: -------------------------------------------------------------------------------- 1 | ALL ALL=(root) NOPASSWD: /usr/local/bin/tzupdate 2 | 3 | # vim: ft=sudoers 4 | -------------------------------------------------------------------------------- /dotfiles/R/Rprofile: -------------------------------------------------------------------------------- 1 | # http://stackoverflow.com/questions/1189759/expert-r-users-whats-in-your-rprofile 2 | .First <- function() { 3 | # library(graphics) 4 | options("repos" = c(CRAN = "http://cran.nz.r-project.org/")) 5 | # options("device" = "quartz") 6 | } 7 | 8 | setHook(packageEvent("grDevices", "onLoad"), 9 | function(...) grDevices::X11.options(type = "cairo")) 10 | 11 | # tikz 12 | options(tikzMetricsDictionary = "~/.cache/tikzMetricsDictionary") 13 | options(tikzDocumentDeclaration = "\\documentclass[12pt]{book}") 14 | options(tikzLatexPackages = c( 15 | "\\usepackage{tikz}", 16 | "\\usepackage[active,tightpage]{preview}", 17 | "\\PreviewEnvironment{pgfpicture}", 18 | "\\setlength\\PreviewBorder{0pt}", 19 | "\\usepackage[T1]{fontenc}", 20 | "\\usepackage[utf8]{inputenc}", 21 | "\\usepackage{lmodern}", 22 | "\\usepackage{textcomp}", 23 | "\\usepackage{latexsym}", 24 | "\\usepackage[sc,osf]{mathpazo}", 25 | "\\usepackage[scaled]{berasans}", 26 | "\\usepackage[scaled]{beramono}", 27 | "\\usepackage{pifont}", 28 | "\\usepackage[tracking=smallcaps]{microtype}", 29 | "\\SetTracking{ encoding = *, shape = sc}{ 50 }" 30 | )) 31 | 32 | # vim: filetype=r 33 | -------------------------------------------------------------------------------- /dotfiles/alacritty/base.toml: -------------------------------------------------------------------------------- 1 | [colors] 2 | draw_bold_text_with_bright_colors = false 3 | 4 | [font] 5 | size = 11.0 6 | 7 | [hints] 8 | alphabet = "jfkdls;ahgurieowpq" 9 | 10 | [[hints.enabled]] 11 | command = "xdg-open" 12 | post_processing = true 13 | regex = "(mailto:|gemini:|gopher:|https:|http:|news:|file:|git:|ssh:|ftp:)[^\u0000-\u001F\u007F-Ÿ<>\"\\s{-}\\^⟨⟩`]+" 14 | 15 | [hints.enabled.binding] 16 | key = "U" 17 | mods = "Control|Alt" 18 | 19 | [hints.enabled.mouse] 20 | enabled = true 21 | mods = "None" 22 | 23 | [[keyboard.bindings]] 24 | chars = "\u001B[13;5u" 25 | key = "Return" 26 | mods = "Control" 27 | 28 | [[keyboard.bindings]] 29 | chars = "\u001B[32;5u" 30 | key = "Space" 31 | mods = "Control" 32 | 33 | [mouse] 34 | hide_when_typing = true 35 | 36 | [scrolling] 37 | history = 1000 38 | 39 | [selection] 40 | save_to_clipboard = false 41 | semantic_escape_chars = ",│`|:\"' ()[]{}<>\t" 42 | 43 | [window] 44 | decorations = "none" 45 | dynamic_padding = true 46 | 47 | [window.padding] 48 | x = 15 49 | y = 15 50 | -------------------------------------------------------------------------------- /dotfiles/alacritty/desert-theme.toml: -------------------------------------------------------------------------------- 1 | [colors.bright] 2 | black = "0x555753" 3 | red = "0xef2929" 4 | green = "0x8ae234" 5 | yellow = "0xfce94f" 6 | blue = "0x729fcf" 7 | magenta = "0xbb95b7" 8 | cyan = "0x00ffff" 9 | white = "0xeeeeec" 10 | 11 | [colors.cursor] 12 | text = "0x000000" 13 | cursor = "0xffff00" 14 | 15 | [colors.normal] 16 | black = "0x2e3436" 17 | red = "0xd75f5f" 18 | green = "0x87ff87" 19 | yellow = "0xffd700" 20 | blue = "0x87d7d7" 21 | magenta = "0xad7fa8" 22 | cyan = "0x34e2e2" 23 | white = "0xd3d7cf" 24 | 25 | [colors.primary] 26 | background = "0x333333" 27 | foreground = "0xffffff" 28 | -------------------------------------------------------------------------------- /dotfiles/alacritty/material-theme.toml: -------------------------------------------------------------------------------- 1 | [colors.bright] 2 | black = "0x90a4ae" 3 | red = "0xe53935" 4 | green = "0x91b859" 5 | yellow = "0xf6a434" 6 | blue = "0x6182b8" 7 | magenta = "0x7c4dff" 8 | cyan = "0x39adb5" 9 | white = "0xffffff" 10 | 11 | [colors.cursor] 12 | text = "0x000000" 13 | cursor = "0xf6a434" 14 | 15 | [colors.normal] 16 | black = "0x000000" 17 | red = "0xe53935" 18 | green = "0x91b859" 19 | yellow = "0xf6a434" 20 | blue = "0x6182b8" 21 | magenta = "0x7c4dff" 22 | cyan = "0x39adb5" 23 | white = "0xffffff" 24 | 25 | [colors.primary] 26 | background = "0xfafafa" 27 | foreground = "0x546e7a" 28 | -------------------------------------------------------------------------------- /dotfiles/awesome/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Lua.diagnostics.globals": [ 3 | "awesome", 4 | "root", 5 | "debian", 6 | "client", 7 | "screen", 8 | "mouse" 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /dotfiles/awesome/eldritch/applets/battery.lua: -------------------------------------------------------------------------------- 1 | local beautiful = require("beautiful") 2 | local tooltip = require("eldritch.tooltip") 3 | local vicious = require("vicious") 4 | local wibox = require("wibox") 5 | 6 | local batwidget = {} 7 | 8 | local function new() 9 | local textbox = wibox.widget.textbox() 10 | 11 | local widget = wibox.widget { 12 | { 13 | wibox.widget.imagebox(beautiful.widget_bat), 14 | textbox, 15 | layout = wibox.layout.fixed.horizontal, 16 | }, 17 | right = 7, 18 | widget = wibox.container.margin 19 | } 20 | 21 | textbox.tooltip = tooltip( 22 | "Battery charge", 23 | { "State", "Charge", "Time left" }, 24 | { widget } 25 | ) 26 | 27 | vicious.register(textbox, vicious.widgets.bat, function(widget, args) 28 | local text = "" 29 | if args[1] == "-" or args[1] == "−" then 30 | text = text .. '' 31 | elseif args[1] == "+" then 32 | text = text .. '' 33 | else 34 | text = args[1] 35 | end 36 | if args[1] == "-" or args[1] == "−" or args[1] == "+" then 37 | if args[2] < 20 then 38 | text = text .. string.format('%d%%', args[2]) 39 | elseif args[2] < 50 then 40 | text = text .. string.format('%d%%', args[2]) 41 | else 42 | text = text .. string.format('%d%%', args[2]) 43 | end 44 | end 45 | widget.tooltip:update({ args[1], args[2] .. "%", args[3] }) 46 | return text 47 | end, 61, "BAT0") 48 | 49 | return widget 50 | end 51 | 52 | return setmetatable(batwidget, { __call = function(_, ...) return new() end }) 53 | -------------------------------------------------------------------------------- /dotfiles/awesome/eldritch/applets/inhibit.lua: -------------------------------------------------------------------------------- 1 | local beautiful = require("beautiful") 2 | local utils = require("eldritch.utils") 3 | local wibox = require("wibox") 4 | 5 | local inhibitwidget = {} 6 | 7 | local enabled = false 8 | 9 | local function get_root_win_id() 10 | local out = utils.trim(utils.exec("xwininfo -root | grep -E '^xwininfo:'")) 11 | return out:match("Window id: (0x[0-9a-f]+) ") 12 | end 13 | 14 | local function new() 15 | local icon = wibox.widget.imagebox(beautiful.widget_inhibit) 16 | 17 | local widget = wibox.widget { 18 | icon, 19 | right = 7, 20 | widget = wibox.container.margin 21 | } 22 | 23 | local window_id = get_root_win_id() 24 | if window_id ~= nil then 25 | icon:connect_signal("button::press", function() 26 | if enabled then 27 | if os.execute("xdg-screensaver resume " .. window_id) then 28 | enabled = false 29 | icon:set_image(beautiful.widget_inhibit) 30 | end 31 | else 32 | if os.execute("xdg-screensaver suspend " .. window_id) then 33 | enabled = true 34 | icon:set_image(beautiful.widget_inhibit_active) 35 | end 36 | end 37 | end) 38 | end 39 | 40 | return widget 41 | end 42 | 43 | return setmetatable(inhibitwidget, { __call = function(_, ...) return new() end }) 44 | -------------------------------------------------------------------------------- /dotfiles/awesome/eldritch/applets/init.lua: -------------------------------------------------------------------------------- 1 | return { 2 | battery = require("eldritch.applets.battery"), 3 | cal = require("eldritch.applets.cal"), 4 | cpu = require("eldritch.applets.cpu"), 5 | docker = require("eldritch.applets.docker"), 6 | inhibit = require("eldritch.applets.inhibit"), 7 | memory = require("eldritch.applets.memory"), 8 | notifhist = require("eldritch.applets.notifhist"), 9 | rhino = require("eldritch.applets.rhino") 10 | } 11 | -------------------------------------------------------------------------------- /dotfiles/awesome/eldritch/applets/memory.lua: -------------------------------------------------------------------------------- 1 | local beautiful = require("beautiful") 2 | local tooltip = require("eldritch.tooltip") 3 | local vicious = require("vicious") 4 | local wibox = require("wibox") 5 | local widgets = require("eldritch.widgets") 6 | 7 | local memwidget = {} 8 | 9 | local function new() 10 | local bar = widgets.circularprogressbar() 11 | 12 | local widget = wibox.widget { 13 | { 14 | wibox.widget.imagebox(beautiful.widget_mem), 15 | bar, 16 | layout = wibox.layout.fixed.horizontal, 17 | }, 18 | right = 7, 19 | widget = wibox.container.margin 20 | } 21 | 22 | bar.tooltip = tooltip( 23 | "Memory", 24 | { "Memory", "Swap" }, 25 | { widget } 26 | ) 27 | 28 | vicious.register(bar, vicious.widgets.mem, function(widget, args) 29 | widget.tooltip:update({ 30 | string.format("%d / %d MB", args[2], args[3]), 31 | string.format("%d / %d MB", args[6], args[7]) 32 | }) 33 | return args[1] 34 | end, 13) 35 | 36 | return widget 37 | end 38 | 39 | return setmetatable(memwidget, { __call = function(_, ...) return new() end }) 40 | -------------------------------------------------------------------------------- /dotfiles/awesome/eldritch/applets/notifhist.lua: -------------------------------------------------------------------------------- 1 | local awful = require("awful") 2 | local beautiful = require("beautiful") 3 | local utils = require("eldritch.utils") 4 | local wibox = require("wibox") 5 | 6 | 7 | local notifhist = {} 8 | 9 | notifhist.notifications = {} 10 | 11 | 12 | function notifhist.add_notification(data) 13 | if not data.title and not data.text then return end 14 | 15 | table.insert(notifhist.notifications, { 16 | title = data.title or data.appname, 17 | text = data.text, 18 | urgency = data.freedesktop_hints and data.freedesktop_hints.urgency 19 | }) 20 | 21 | -- Remove the oldest notification if we are over the limit 22 | if #notifhist.notifications > 10 then 23 | table.remove(notifhist.notifications, 1) 24 | end 25 | end 26 | 27 | function notifhist.new() 28 | local icon = wibox.widget.imagebox(beautiful.widget_notifhist) 29 | 30 | local widget = wibox.widget { 31 | icon, 32 | widget = wibox.container.margin 33 | } 34 | 35 | icon.tooltip = awful.tooltip({ objects = { widget } }) 36 | function icon.tooltip.update() 37 | local items = {} 38 | local text 39 | 40 | for _, val in ipairs(notifhist.notifications) do 41 | if val.title then 42 | text = utils.bold(val.title) 43 | -- Print the title of critical notifications in red 44 | if val.urgency == "\2" then 45 | text = utils.fgcolor("#ff0000", text) 46 | end 47 | end 48 | if text and val.text then 49 | text = text .. "\n" .. val.text 50 | elseif val.text then 51 | text = val.text 52 | end 53 | table.insert(items, utils.font(beautiful.notification_font, text)) 54 | end 55 | 56 | local separator = utils.fgcolor("#999999", "\n —————————— \n") 57 | text = table.concat(items, separator) 58 | 59 | icon.tooltip:set_markup(text) 60 | end 61 | 62 | icon.tooltip:update() 63 | 64 | widget:connect_signal("mouse::enter", icon.tooltip.update) 65 | 66 | return widget 67 | end 68 | 69 | return notifhist 70 | -------------------------------------------------------------------------------- /dotfiles/awesome/eldritch/applets/rhino.lua: -------------------------------------------------------------------------------- 1 | local awful = require("awful") 2 | local beautiful = require("beautiful") 3 | local vicious = require("vicious") 4 | local wibox = require("wibox") 5 | local workers = require("eldritch.workers") 6 | 7 | local rhinowidget = {} 8 | 9 | local function new() 10 | local icon = wibox.widget.imagebox(beautiful.widget_rhino) 11 | 12 | local widget = wibox.widget { 13 | icon, 14 | right = 7, 15 | widget = wibox.container.margin 16 | } 17 | 18 | icon.tooltip = awful.tooltip({ objects = { widget } }) 19 | 20 | vicious.register(icon, workers.rhino, function(widget, args) 21 | if #args == 0 then 22 | icon:set_image(beautiful.widget_rhino) 23 | else 24 | icon:set_image(beautiful.widget_rhino_active) 25 | end 26 | icon.tooltip:set_markup(table.concat(args, "\n")) 27 | return "" 28 | end, 31) 29 | 30 | return widget 31 | end 32 | 33 | return setmetatable(rhinowidget, { __call = function(_, ...) return new() end }) 34 | -------------------------------------------------------------------------------- /dotfiles/awesome/eldritch/init.lua: -------------------------------------------------------------------------------- 1 | return { 2 | applets = require("eldritch.applets"), 3 | mpris = require("eldritch.mpris"), 4 | osd = require("eldritch.osd"), 5 | separator = require("eldritch.separator"), 6 | tooltip = require("eldritch.tooltip"), 7 | utils = require("eldritch.utils"), 8 | widgets = require("eldritch.widgets"), 9 | workers = require("eldritch.workers"), 10 | xdg_menu = require("eldritch.xdg_menu") 11 | } 12 | -------------------------------------------------------------------------------- /dotfiles/awesome/eldritch/mpris.lua: -------------------------------------------------------------------------------- 1 | local awful = require("awful") 2 | local naughty = require("naughty") 3 | local utils = require("eldritch.utils") 4 | 5 | local mpris = {} 6 | 7 | function mpris.send_cmd(cmd) 8 | utils.exec("playerctl " .. cmd) 9 | local status = utils.trim(utils.exec("playerctl -f '{{playerName}}: {{status}}' status")) 10 | naughty.notify({ title = cmd, text = status }) 11 | end 12 | 13 | return mpris 14 | -------------------------------------------------------------------------------- /dotfiles/awesome/eldritch/osd.lua: -------------------------------------------------------------------------------- 1 | local awful = require("awful") 2 | local naughty = require("naughty") 3 | local wibox = require("wibox") 4 | local beautiful = require("beautiful") 5 | local gears = require("gears") 6 | 7 | local osd = {} 8 | 9 | local _osd = {} 10 | 11 | local current = nil 12 | 13 | function _osd:die() 14 | self.tmr:stop() 15 | naughty.destroy(self.notification) 16 | self.notification = nil 17 | current = nil 18 | end 19 | 20 | local function new(title) 21 | local o = setmetatable({}, { __index = _osd }) 22 | 23 | local titlecolor = beautiful.tooltip_title_color or "#f0e68c" 24 | title = '' .. title .. '' 25 | local titlebox = wibox.widget.textbox(title) 26 | local title_m = wibox.container.margin(titlebox, 5, 5, 5, 5) 27 | 28 | o.percent = wibox.widget.textbox() 29 | local percent_m = wibox.container.margin(o.percent, 5, 5, 5, 5) 30 | 31 | o.progress = wibox.widget { 32 | max_value = 100, 33 | forced_width = 150, 34 | color = beautiful.fg_widget, 35 | background_color = beautiful.bg_widget, 36 | widget = wibox.widget.progressbar 37 | } 38 | local progress_m = wibox.container.margin(o.progress, 5, 5, 5, 5) 39 | 40 | local layout_bottom = wibox.layout.fixed.horizontal() 41 | layout_bottom:add(progress_m) 42 | layout_bottom:add(percent_m) 43 | 44 | local layout = wibox.layout.align.vertical() 45 | layout:set_top(title_m) 46 | layout:set_bottom(layout_bottom) 47 | layout:buttons(awful.util.table.join(awful.button({}, 1, function() o:die() end))) 48 | 49 | o.tmr = gears.timer({ timeout = 2 }) 50 | o.tmr:connect_signal("timeout", function() o:die() end) 51 | 52 | o.notification = naughty.notify({ height = 50, width = 205, timeout = 0 }) 53 | o.notification.box:set_widget(layout) 54 | 55 | return o 56 | end 57 | 58 | function osd.notify(title, value) 59 | if not current then 60 | current = new(title) 61 | else 62 | current.tmr:stop() 63 | end 64 | 65 | current.percent:set_markup(value .. "%") 66 | current.progress:set_value(value) 67 | current.tmr:start() 68 | end 69 | 70 | return osd 71 | -------------------------------------------------------------------------------- /dotfiles/awesome/eldritch/separator.lua: -------------------------------------------------------------------------------- 1 | local wibox = require("wibox") 2 | 3 | local separator = wibox.widget.base.make_widget() 4 | 5 | function separator.fit(sep, width, height) 6 | return width, 10 7 | end 8 | 9 | function separator.draw(sep, wibox, cr, width, height) 10 | cr:move_to(width / 4, height / 2) 11 | cr:line_to(width * 3 / 4, height / 2) 12 | cr:set_line_width(3) 13 | cr:stroke() 14 | end 15 | 16 | return separator 17 | -------------------------------------------------------------------------------- /dotfiles/awesome/eldritch/tooltip.lua: -------------------------------------------------------------------------------- 1 | local awful = require("awful") 2 | local beautiful = require("beautiful") 3 | local utils = require("eldritch.utils") 4 | 5 | local tooltip = {} 6 | 7 | local _tooltip = { 8 | titlecolor = beautiful.tooltip_title_color or "#f0e68c", 9 | keycolor = beautiful.tooltip_key_color or "#98fb98" 10 | } 11 | 12 | function _tooltip:update(values) 13 | local title = " " .. utils.bold(self.title) 14 | local title = utils.fgcolor(self.titlecolor, title) .. "\n\n" 15 | 16 | local body = "" 17 | for i, key in ipairs(self.keys) do 18 | body = body .. key .. tostring(values[i]) .. " \n" 19 | end 20 | 21 | self.tooltip:set_markup(utils.font("monospace 10", title .. body)) 22 | end 23 | 24 | local function new(title, keys, objects) 25 | local o = setmetatable({}, { __index = _tooltip }) 26 | 27 | o.tooltip = awful.tooltip({ objects = objects }) 28 | o.title = title 29 | 30 | local maxlen = 0 31 | for _, key in ipairs(keys) do 32 | if key:len() > maxlen then 33 | maxlen = key:len() 34 | end 35 | end 36 | o.keys = {} 37 | for i, key in ipairs(keys) do 38 | local text = " " .. utils.fgcolor(o.keycolor, key) 39 | text = text .. string.rep(" ", maxlen - key:len()) .. " : " 40 | o.keys[i] = text 41 | end 42 | 43 | return o 44 | end 45 | 46 | setmetatable(tooltip, { __call = function(_, ...) return new(...) end }) 47 | 48 | return tooltip 49 | -------------------------------------------------------------------------------- /dotfiles/awesome/eldritch/widgets/init.lua: -------------------------------------------------------------------------------- 1 | return 2 | { 3 | circularprogressbar = require("eldritch.widgets.circularprogressbar") 4 | } 5 | -------------------------------------------------------------------------------- /dotfiles/awesome/eldritch/workers/docker.lua: -------------------------------------------------------------------------------- 1 | local docker = {} 2 | 3 | local function worker(format, warg) 4 | local f = io.popen("docker ps -q") 5 | 6 | local images = {} 7 | for line in f:lines() do images[#images + 1] = line end 8 | 9 | f:close() 10 | 11 | return images 12 | end 13 | 14 | return setmetatable(docker, { __call = function(_, ...) return worker(...) end }) 15 | -------------------------------------------------------------------------------- /dotfiles/awesome/eldritch/workers/init.lua: -------------------------------------------------------------------------------- 1 | return { 2 | docker = require("eldritch.workers.docker"), 3 | rhino = require("eldritch.workers.rhino") 4 | } 5 | -------------------------------------------------------------------------------- /dotfiles/awesome/eldritch/workers/rhino.lua: -------------------------------------------------------------------------------- 1 | local rhino = {} 2 | 3 | local function worker(format, warg) 4 | local f = io.popen("jps | grep -E '^[[:digit:]]+ Rhino$'") 5 | if f == nil then return {} end 6 | -- local rhinos = f:read("*all") 7 | 8 | local rhinos = {} 9 | 10 | while true do 11 | local line = f:read() 12 | if line == nil then break end 13 | rhinos[#rhinos + 1] = line 14 | end 15 | 16 | f:close() 17 | 18 | return rhinos 19 | end 20 | 21 | return setmetatable(rhino, { __call = function(_, ...) return worker(...) end }) 22 | -------------------------------------------------------------------------------- /dotfiles/awesome/pulse/init.lua: -------------------------------------------------------------------------------- 1 | local pulse = {} 2 | 3 | pulse.pulse = require("pulse.pulse") 4 | pulse.widget = require("pulse.widget") 5 | 6 | return pulse 7 | -------------------------------------------------------------------------------- /dotfiles/awesome/pulse/pulse.lua: -------------------------------------------------------------------------------- 1 | --------------------------------------------------- 2 | -- Licensed under the GNU General Public License v2 3 | -- * (c) 2010, MrMagne 4 | -- * (c) 2010, Mic92 5 | -- * (c) 2013, Jan Larres 6 | --------------------------------------------------- 7 | 8 | local utils = require("eldritch.utils") 9 | 10 | -- Pulse: provides volume levels of requested pulseaudio sinks and methods to 11 | -- change them 12 | local pulse = {} 13 | 14 | -- {{{ Helper functions 15 | local function pactl(args) 16 | local f = io.popen("pactl " .. args) 17 | local out = f:read("*all") 18 | f:close() 19 | return utils.trim(out) 20 | end 21 | 22 | local function escape(text) 23 | local special_chars = { ["."] = "%.", ["-"] = "%-" } 24 | return text:gsub("[%.%-]", special_chars) 25 | end 26 | 27 | local function round(num) 28 | return math.floor(num + 0.5) 29 | end 30 | -- }}} 31 | 32 | -- {{{ Pulseaudio widget type 33 | local function worker(format) 34 | -- If mute return 0 (not "Mute") so we don't break progressbars 35 | if string.find(pactl("get-sink-mute @DEFAULT_SINK@"), "Mute: yes") then 36 | return {0, "off"} 37 | end 38 | 39 | local out = pactl("get-sink-volume @DEFAULT_SINK@") 40 | local vol = tonumber(string.match(out, "([%d]+)%%")) 41 | if vol == nil then vol = 0 end 42 | 43 | return { vol, "on"} 44 | end 45 | -- }}} 46 | 47 | -- {{{ Volume control helper 48 | function pulse.add(percent) 49 | local s 50 | if percent > 0 then 51 | s = "+" .. percent 52 | else 53 | s = tostring(percent) 54 | end 55 | pactl("set-sink-volume @DEFAULT_SINK@ " .. s .. "%") 56 | end 57 | 58 | function pulse.toggle() 59 | pactl("set-sink-mute @DEFAULT_SINK@ toggle") 60 | end 61 | -- }}} 62 | 63 | function pulse.toggle_mic() 64 | pactl("set-source-mute @DEFAULT_SOURCE@ toggle") 65 | end 66 | 67 | setmetatable(pulse, { __call = function(_, ...) return worker(...) end }) 68 | 69 | return pulse 70 | -------------------------------------------------------------------------------- /dotfiles/awesome/pulse/widget.lua: -------------------------------------------------------------------------------- 1 | -- Based on https://awesome.naquadah.org/wiki/Rman%27s_Simple_Volume_Widget 2 | 3 | local wibox = require("wibox") 4 | local beautiful = require("beautiful") 5 | local eldritch = require("eldritch") 6 | 7 | local colors = {} 8 | local pulsewidget = {} 9 | 10 | function pulsewidget:set_current_level(level) 11 | self.curlevel = level 12 | end 13 | 14 | function pulsewidget:set_muted(state) 15 | self.is_muted = state 16 | if self.is_muted then 17 | self:get_children_by_id("bar")[1]:set_color(colors.muted) 18 | self.tooltip:update({ "[Muted]" }) 19 | else 20 | self:get_children_by_id("bar")[1]:set_color(colors.unmuted) 21 | self.tooltip:update({ self.curlevel .. "%" }) 22 | end 23 | end 24 | 25 | function pulsewidget:update(args, notify) 26 | self:set_current_level(args[1]) 27 | 28 | if args[2] == "off" then 29 | self:set_muted(true) 30 | return 100 31 | end 32 | 33 | self:set_muted(false) 34 | 35 | return args[1] 36 | end 37 | 38 | function pulsewidget:notify() 39 | eldritch.osd.notify("Volume", self.curlevel) 40 | end 41 | 42 | local function new(icon) 43 | colors = { unmuted = beautiful.fg_widget, muted = "#FF5656" } 44 | 45 | local widget = wibox.widget { 46 | { 47 | id = "bar", 48 | background_color = beautiful.bg_widget, 49 | color = colors.unmuted, 50 | widget = wibox.widget.progressbar, 51 | }, 52 | forced_width = 8, 53 | direction = "east", 54 | layout = wibox.container.rotate, 55 | } 56 | 57 | for k, v in pairs(pulsewidget) do 58 | if type(v) == "function" then 59 | widget[k] = v 60 | end 61 | end 62 | 63 | widget.curlevel = 0 64 | widget.is_muted = false 65 | widget.tooltip = eldritch.tooltip("Volume", { "Level" }, { widget, icon }) 66 | 67 | return widget 68 | end 69 | 70 | setmetatable(pulsewidget, { __call = function(_, ...) return new(...) end }) 71 | 72 | return pulsewidget 73 | -------------------------------------------------------------------------------- /dotfiles/awesome/scratch/init.lua: -------------------------------------------------------------------------------- 1 | --------------------------------------------------------------- 2 | -- Drop-down applications and scratchpad manager for awesome wm 3 | --------------------------------------------------------------- 4 | -- Coded by: * Adrian C. (anrxc) 5 | -- Licensed under the WTFPL version 2 6 | -- * http://sam.zoy.org/wtfpl/COPYING 7 | --------------------------------------------------------------- 8 | 9 | local scratch = {} -- module scratch 10 | 11 | scratch.pad = require("scratch.pad") 12 | scratch.drop = require("scratch.drop") 13 | scratch.uniqdrop = require("scratch.uniqdrop") 14 | 15 | return scratch 16 | -------------------------------------------------------------------------------- /dotfiles/awesome/themes/desert/.gitignore: -------------------------------------------------------------------------------- 1 | background-*.png 2 | -------------------------------------------------------------------------------- /dotfiles/awesome/themes/desert/icons/awesome-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majutsushi/etc/c5877b881f191c010ee8e2703bbe2571afb64616/dotfiles/awesome/themes/desert/icons/awesome-icon.png -------------------------------------------------------------------------------- /dotfiles/awesome/themes/desert/icons/layouts/cornernw.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majutsushi/etc/c5877b881f191c010ee8e2703bbe2571afb64616/dotfiles/awesome/themes/desert/icons/layouts/cornernw.png -------------------------------------------------------------------------------- /dotfiles/awesome/themes/desert/icons/layouts/dwindle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majutsushi/etc/c5877b881f191c010ee8e2703bbe2571afb64616/dotfiles/awesome/themes/desert/icons/layouts/dwindle.png -------------------------------------------------------------------------------- /dotfiles/awesome/themes/desert/icons/layouts/fairh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majutsushi/etc/c5877b881f191c010ee8e2703bbe2571afb64616/dotfiles/awesome/themes/desert/icons/layouts/fairh.png -------------------------------------------------------------------------------- /dotfiles/awesome/themes/desert/icons/layouts/fairv.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majutsushi/etc/c5877b881f191c010ee8e2703bbe2571afb64616/dotfiles/awesome/themes/desert/icons/layouts/fairv.png -------------------------------------------------------------------------------- /dotfiles/awesome/themes/desert/icons/layouts/floating.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majutsushi/etc/c5877b881f191c010ee8e2703bbe2571afb64616/dotfiles/awesome/themes/desert/icons/layouts/floating.png -------------------------------------------------------------------------------- /dotfiles/awesome/themes/desert/icons/layouts/magnifier.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majutsushi/etc/c5877b881f191c010ee8e2703bbe2571afb64616/dotfiles/awesome/themes/desert/icons/layouts/magnifier.png -------------------------------------------------------------------------------- /dotfiles/awesome/themes/desert/icons/layouts/max.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majutsushi/etc/c5877b881f191c010ee8e2703bbe2571afb64616/dotfiles/awesome/themes/desert/icons/layouts/max.png -------------------------------------------------------------------------------- /dotfiles/awesome/themes/desert/icons/layouts/tile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majutsushi/etc/c5877b881f191c010ee8e2703bbe2571afb64616/dotfiles/awesome/themes/desert/icons/layouts/tile.png -------------------------------------------------------------------------------- /dotfiles/awesome/themes/desert/icons/layouts/tilebottom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majutsushi/etc/c5877b881f191c010ee8e2703bbe2571afb64616/dotfiles/awesome/themes/desert/icons/layouts/tilebottom.png -------------------------------------------------------------------------------- /dotfiles/awesome/themes/desert/icons/layouts/tileleft.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majutsushi/etc/c5877b881f191c010ee8e2703bbe2571afb64616/dotfiles/awesome/themes/desert/icons/layouts/tileleft.png -------------------------------------------------------------------------------- /dotfiles/awesome/themes/desert/icons/submenu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majutsushi/etc/c5877b881f191c010ee8e2703bbe2571afb64616/dotfiles/awesome/themes/desert/icons/submenu.png -------------------------------------------------------------------------------- /dotfiles/awesome/themes/desert/icons/taglist/squarefz.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majutsushi/etc/c5877b881f191c010ee8e2703bbe2571afb64616/dotfiles/awesome/themes/desert/icons/taglist/squarefz.png -------------------------------------------------------------------------------- /dotfiles/awesome/themes/desert/icons/taglist/squarez.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majutsushi/etc/c5877b881f191c010ee8e2703bbe2571afb64616/dotfiles/awesome/themes/desert/icons/taglist/squarez.png -------------------------------------------------------------------------------- /dotfiles/awesome/themes/desert/icons/widgets/battery.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majutsushi/etc/c5877b881f191c010ee8e2703bbe2571afb64616/dotfiles/awesome/themes/desert/icons/widgets/battery.png -------------------------------------------------------------------------------- /dotfiles/awesome/themes/desert/icons/widgets/cpu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majutsushi/etc/c5877b881f191c010ee8e2703bbe2571afb64616/dotfiles/awesome/themes/desert/icons/widgets/cpu.png -------------------------------------------------------------------------------- /dotfiles/awesome/themes/desert/icons/widgets/docker.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majutsushi/etc/c5877b881f191c010ee8e2703bbe2571afb64616/dotfiles/awesome/themes/desert/icons/widgets/docker.png -------------------------------------------------------------------------------- /dotfiles/awesome/themes/desert/icons/widgets/docker_active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majutsushi/etc/c5877b881f191c010ee8e2703bbe2571afb64616/dotfiles/awesome/themes/desert/icons/widgets/docker_active.png -------------------------------------------------------------------------------- /dotfiles/awesome/themes/desert/icons/widgets/inhibit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majutsushi/etc/c5877b881f191c010ee8e2703bbe2571afb64616/dotfiles/awesome/themes/desert/icons/widgets/inhibit.png -------------------------------------------------------------------------------- /dotfiles/awesome/themes/desert/icons/widgets/inhibit_active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majutsushi/etc/c5877b881f191c010ee8e2703bbe2571afb64616/dotfiles/awesome/themes/desert/icons/widgets/inhibit_active.png -------------------------------------------------------------------------------- /dotfiles/awesome/themes/desert/icons/widgets/memory.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majutsushi/etc/c5877b881f191c010ee8e2703bbe2571afb64616/dotfiles/awesome/themes/desert/icons/widgets/memory.png -------------------------------------------------------------------------------- /dotfiles/awesome/themes/desert/icons/widgets/notifhist.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majutsushi/etc/c5877b881f191c010ee8e2703bbe2571afb64616/dotfiles/awesome/themes/desert/icons/widgets/notifhist.png -------------------------------------------------------------------------------- /dotfiles/awesome/themes/desert/icons/widgets/rhino.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majutsushi/etc/c5877b881f191c010ee8e2703bbe2571afb64616/dotfiles/awesome/themes/desert/icons/widgets/rhino.png -------------------------------------------------------------------------------- /dotfiles/awesome/themes/desert/icons/widgets/rhino_active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majutsushi/etc/c5877b881f191c010ee8e2703bbe2571afb64616/dotfiles/awesome/themes/desert/icons/widgets/rhino_active.png -------------------------------------------------------------------------------- /dotfiles/awesome/themes/desert/icons/widgets/separator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majutsushi/etc/c5877b881f191c010ee8e2703bbe2571afb64616/dotfiles/awesome/themes/desert/icons/widgets/separator.png -------------------------------------------------------------------------------- /dotfiles/awesome/themes/desert/icons/widgets/volume.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majutsushi/etc/c5877b881f191c010ee8e2703bbe2571afb64616/dotfiles/awesome/themes/desert/icons/widgets/volume.png -------------------------------------------------------------------------------- /dotfiles/bash/bash_logout: -------------------------------------------------------------------------------- 1 | # ~/.bash_logout: executed by bash(1) when login shell exits. 2 | 3 | # when leaving the console clear the screen to increase privacy 4 | 5 | if [ "$SHLVL" = 1 ]; then 6 | sudo -k 7 | [ -x /usr/bin/clear_console ] && /usr/bin/clear_console -q 8 | clear 9 | fi 10 | -------------------------------------------------------------------------------- /dotfiles/bash/bash_profile: -------------------------------------------------------------------------------- 1 | if [[ -r ~/.profile ]]; then 2 | . ~/.profile 3 | fi 4 | 5 | if [[ $- == *i* ]] && [[ -r ~/.bashrc ]]; then 6 | . ~/.bashrc 7 | fi 8 | 9 | # vim: ft=sh 10 | -------------------------------------------------------------------------------- /dotfiles/bash/bashrc: -------------------------------------------------------------------------------- 1 | # minimal bashrc for starting zsh or in case zsh is not available 2 | 3 | source_if_exists() { 4 | [[ -r $1 ]] && . "$1" 5 | } 6 | 7 | source_if_exists /etc/bash.bashrc 8 | source_if_exists /etc/bashrc 9 | 10 | source_if_exists ~/.local/etc/bashenv 11 | 12 | # If not running interactively stop here 13 | [[ ! $- == *i* ]] && unset -f source_if_exists && return 14 | 15 | set -o noclobber 16 | 17 | shopt -s checkwinsize 18 | 19 | # disable XON/XOFF flow control (^s/^q) 20 | stty stop '' 21 | stty -ixoff 22 | stty -ixon 23 | 24 | HISTCONTROL=ignorespace:ignoredups:erasedups 25 | HISTSIZE=100000 26 | HISTFILE=$XDG_STATE_HOME/bash_history 27 | HISTFILESIZE=100000 28 | HISTTIMEFORMAT='%F %T ' 29 | shopt -s histappend 30 | shopt -s cmdhist 31 | mkdir -p "$(dirname "$HISTFILE")" 32 | 33 | source_if_exists /etc/bash_completion 34 | 35 | umask 0022 36 | 37 | function bk() { 38 | cp -b "${1}" "${1}_$(date --iso-8601=m)" 39 | } 40 | 41 | PROMPT_COMMAND="history -a" 42 | PROMPT_DIRTRIM=2 43 | PS1="\\[\\e[31m\\]\\u\\[\\e[m\\]@\\[\\e[33m\\]\\h\\[\\e[m\\]:\\[\\e[32m\\]\\w\\[\\e[m\\] \\[\\e[1m\\]$\\[\\e[m\\] " 44 | 45 | alias ls='ls -F --color=auto' 46 | alias ll='ls -lF --color=auto' 47 | alias l='ls -lAF --color=auto' 48 | alias vi=vim 49 | 50 | source_if_exists ~/.local/etc/bashrc 51 | 52 | unset -f source_if_exists 53 | 54 | if shopt -q login_shell && command -v zsh &>/dev/null; then 55 | exec zsh -l 56 | fi 57 | -------------------------------------------------------------------------------- /dotfiles/bat/config: -------------------------------------------------------------------------------- 1 | # This is `bat`s configuration file. Each line either contains a comment or 2 | # a command-line option that you want to pass to `bat` by default. You can 3 | # run `bat --help` to get a list of all possible configuration options. 4 | 5 | # Specify desired highlighting theme (e.g. "TwoDark"). Run `bat --list-themes` 6 | # for a list of all available themes 7 | --theme=ansi 8 | 9 | # Automatic dark mode detection: 10 | # https://github.com/sharkdp/bat/pull/2896 11 | # --theme-dark= 12 | # --theme-light= 13 | 14 | # Enable this to use italic text on the terminal. This is not supported on all 15 | # terminal emulators (like tmux, by default): 16 | #--italic-text=always 17 | 18 | # Uncomment the following line to disable automatic paging: 19 | #--paging=never 20 | 21 | # Uncomment the following line if you are using less version >= 551 and want to 22 | # enable mouse scrolling support in `bat` when running inside tmux. This might 23 | # disable text selection, unless you press shift. 24 | #--pager="less --RAW-CONTROL-CHARS --quit-if-one-screen --mouse" 25 | 26 | # Syntax mappings: map a certain filename pattern to a language. 27 | # Example 1: use the C++ syntax for Arduino .ino files 28 | # Example 2: Use ".gitignore"-style highlighting for ".ignore" files 29 | #--map-syntax "*.ino:C++" 30 | #--map-syntax ".ignore:Git Ignore" 31 | -------------------------------------------------------------------------------- /dotfiles/bat/syntaxes/cue.sublime-syntax: -------------------------------------------------------------------------------- 1 | %YAML 1.2 2 | --- 3 | # http://www.sublimetext.com/docs/3/syntax.html 4 | # Converted from https://github.com/relikd/CUE-Sheet_sublime 5 | name: CUE Sheet 6 | comment: Textmate bundle for CUE Sheets 7 | file_extensions: 8 | - cue 9 | - CUE 10 | scope: source.cuesheet 11 | contexts: 12 | main: 13 | - match: \b(CATALOG|CDTEXTFILE|FILE|FLAGS|INDEX|ISRC|PERFORMER|(POST|PRE)GAP|REM (GENRE|DATE|DISCID|DISCNUMBER|TOTALDISCS|COMMENT)|SONGWRITER|TITLE|TRACK)\b 14 | scope: keyword 15 | - match: \b(BINARY|MOTOROLA|AIFF|WAVE|MP3)\w*\b 16 | scope: constant.other 17 | - match: \b(4CH|DCP|PRE|SCMS)\w*\b 18 | scope: constant.other 19 | - match: \b(AUDIO|CDG|MODE(1/(2048|2336)|2/(2336|2352))|CDI/23(36|52))\w*\b 20 | scope: constant.other 21 | - match: '\b[0-9]{2}:[0-9]{2}:[0-9]{2}\b' 22 | scope: constant.numeric 23 | - match: '"' 24 | push: 25 | - meta_scope: variable.parameter 26 | - match: '"' 27 | pop: true 28 | -------------------------------------------------------------------------------- /dotfiles/bibtoolrsc: -------------------------------------------------------------------------------- 1 | % entry formatting 2 | print.align = 19 3 | print.align.key = 19 4 | print.align.string = 19 5 | print.comma.at.end = on 6 | print.equal.right = on 7 | print.indent = 4 8 | print.line.length = 77 9 | print.newline = 1 10 | print.use.tab = off 11 | %print.wide.equal = on 12 | suppress.initial.newline = on 13 | 14 | % sort in ascending order 15 | sort = on 16 | sort.reverse = off 17 | 18 | % keys 19 | preserve.keys = off 20 | preserve.key.case = on 21 | key.make.alias = off 22 | key.generation = on 23 | key.number.separator = "*" 24 | key.base = lower 25 | fmt.et.al = ".ea" 26 | new.format.type {2 = "%*5.1l[][.][]"} 27 | key.format = 28 | { 29 | %s(bibkey) # 30 | { 31 | { 32 | %-2.2p(author) # 33 | %-2.2p(editor) # 34 | anon 35 | } 36 | : 37 | { 38 | %-2.5T(title) # 39 | %-2.5T(booktitle) # 40 | notitle 41 | } 42 | { 43 | : %4d(year) # 44 | } 45 | } # 46 | ??? 47 | } 48 | ignored.word = "{a}" 49 | ignored.word = "{a}n" 50 | ignored.word = "das" 51 | ignored.word = "der" 52 | ignored.word = "die" 53 | ignored.word = "{}ein" 54 | ignored.word = "{}eine" 55 | ignored.word = "{}el" 56 | ignored.word = "{}il" 57 | ignored.word = "la" 58 | ignored.word = "le" 59 | ignored.word = "les" 60 | ignored.word = "the" 61 | ignored.word = "{}un" 62 | ignored.word = "{}une" 63 | ignored.word = "annual" 64 | ignored.word = "conference" 65 | ignored.word = "for" 66 | ignored.word = "meeting" 67 | ignored.word = "of" 68 | 69 | % get rid of unnecessary fields 70 | delete.field = {url} 71 | delete.field = {abstract} 72 | delete.field = {doi} 73 | delete.field = {isbn} 74 | delete.field = {issn} 75 | delete.field = {note} 76 | delete.field = {keywords} 77 | 78 | % sort fields 79 | sort.order = {* = author # title # year} 80 | 81 | % wrap URLs in \url{} 82 | rewrite.rule = { howpublished # "^{{\(.*\)}}$" # "\"\\url{\1}\"" } 83 | rewrite.rule = { howpublished # "^{\(.*\)}$" # "\"\\url{\1}\"" } 84 | -------------------------------------------------------------------------------- /dotfiles/bin/daily-cleanup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -eEu -o pipefail 4 | IFS=$'\n\t' 5 | PS4='+\t ' 6 | 7 | error_handler() { echo "Error: Line ${1} exited with status ${2}"; } 8 | trap 'error_handler ${LINENO} $?' ERR 9 | 10 | [[ "${TRACE:-0}" == "1" ]] && set -x 11 | 12 | 13 | shopt -s nullglob 14 | 15 | # Remove old files from the trash 16 | if command -v trash-empty >/dev/null 2>&1; then 17 | trash-empty 30 18 | fi 19 | 20 | # Remove unused Vim swap files 21 | if command -v lsof >/dev/null 2>&1; then 22 | for i in "$XDG_STATE_HOME/vim/swap"/*; do 23 | lsof -F p "$i" >/dev/null 2>&1 || rm -f "$i" 24 | done 25 | 26 | for i in "$XDG_STATE_HOME/nvim/swap"/*; do 27 | lsof -F p "$i" >/dev/null 2>&1 || rm -f "$i" 28 | done 29 | fi 30 | 31 | # Remove old Vim undo files 32 | find "$XDG_STATE_HOME/vim/undo" -type f -mtime +100 -delete 33 | find "$XDG_STATE_HOME/nvim/undo" -type f -mtime +100 -delete 34 | -------------------------------------------------------------------------------- /dotfiles/bin/get-machine-id: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Based on https://github.com/denisbrodbeck/machineid#snippets 3 | 4 | set -eEu -o pipefail 5 | shopt -s inherit_errexit 6 | IFS=$'\n\t' 7 | PS4='+\t ' 8 | 9 | error_handler() { echo "Error: Line ${1} exited with status ${2}"; } 10 | trap 'error_handler ${LINENO} $?' ERR 11 | 12 | [[ "${TRACE:-0}" == "1" ]] && set -x 13 | 14 | 15 | if [[ -f /var/lib/dbus/machine-id ]]; then 16 | cat /var/lib/dbus/machine-id 17 | elif [[ -f /etc/machine-id ]]; then 18 | cat /etc/machine-id 19 | elif [[ -f /etc/hostid ]]; then 20 | cat /etc/hostid 21 | elif command -v kenv >/dev/null; then 22 | kenv -q smbios.system.uuid 23 | elif command -v ioreg >/dev/null; then 24 | ioreg -rd1 -c IOPlatformExpertDevice | awk '/IOPlatformUUID/ { gsub("\"", "", $3); print $3 }' 25 | else 26 | echo "No machine id source found" >&2 27 | exit 1 28 | fi 29 | -------------------------------------------------------------------------------- /dotfiles/bin/grimshot-wrapper: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -eEu -o pipefail 4 | shopt -s inherit_errexit 5 | IFS=$'\n\t' 6 | PS4='+\t ' 7 | 8 | error_handler() { 9 | echo "Error: Line ${1} exited with status ${2}" 10 | notify-send -a grimshot-wrapper --urgency=critical -i image "Error saving screenshot" 11 | } 12 | trap 'error_handler ${LINENO} $?' ERR 13 | 14 | [[ "${TRACE:-0}" == "1" ]] && set -x 15 | 16 | 17 | if [[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/user-dirs.dirs" ]]; then 18 | . "${XDG_CONFIG_HOME:-$HOME/.config}/user-dirs.dirs" 19 | fi 20 | TARGET_DIR="${XDG_PICTURES_DIR:-$HOME}/Screenshots" 21 | TARGET_FILE="$TARGET_DIR/$(date +'%Y-%m-%d %H-%M-%S').png" 22 | 23 | grimshot save anything - | \ 24 | magick - \ 25 | \( +clone -background black -shadow 50x15+0+10 \) \ 26 | +swap \ 27 | -background white \ 28 | -layers merge \ 29 | +repage \ 30 | "$TARGET_FILE" 31 | 32 | echo "$TARGET_FILE" | cb 33 | notify-send -t 3000 -a grimshot-wrapper -i image -e "Screenshot" "Saved to $TARGET_FILE" 34 | -------------------------------------------------------------------------------- /dotfiles/bin/idle-notify: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # Author: Jan Larres 3 | # License: MIT/X11 4 | 5 | import contextlib 6 | import logging 7 | import sys 8 | 9 | logging.basicConfig(format="%(levelname)s: %(message)s", level=logging.INFO) 10 | log = logging.getLogger(__name__) 11 | 12 | import gi 13 | 14 | gi.require_version("Gdk", "3.0") 15 | gi.require_version("Gtk", "3.0") 16 | from gi.repository import Gdk 17 | from gi.repository import Gtk 18 | 19 | 20 | def main() -> int: 21 | display = Gdk.Display.get_default() 22 | seat = display.get_default_seat() 23 | pointer = seat.get_pointer() 24 | pos = pointer.get_position() 25 | monitor = display.get_monitor_at_point(pos.x, pos.y) 26 | workarea = monitor.get_workarea() 27 | 28 | win_height = workarea.height * 2 / 3 29 | win_width = workarea.width * 2 / 3 30 | 31 | geom = Gdk.Geometry() 32 | geom.min_height = win_height 33 | geom.max_height = win_height 34 | geom.min_width = win_width 35 | geom.max_width = win_width 36 | 37 | win = Gtk.Window() 38 | win.set_geometry_hints( 39 | None, geom, Gdk.WindowHints.MAX_SIZE | Gdk.WindowHints.MIN_SIZE 40 | ) 41 | win.set_position(Gtk.WindowPosition.CENTER) 42 | 43 | label = Gtk.Label(label="About to lock screen") 44 | win.add(label) 45 | 46 | win.connect("destroy", Gtk.main_quit) 47 | win.show_all() 48 | 49 | with contextlib.suppress(KeyboardInterrupt): 50 | Gtk.main() 51 | 52 | return 0 53 | 54 | 55 | if __name__ == "__main__": 56 | sys.exit(main()) 57 | -------------------------------------------------------------------------------- /dotfiles/bin/sack: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Author: Jan Larres 4 | # 5 | # License: MIT/X11 6 | # 7 | # Based on 'sack' by Sampson L. Chen which is available at: 8 | # https://github.com/sampson-chen/sack 9 | 10 | BIN=$1 11 | shift 12 | 13 | # Prefixes a shortcut tag to relevant output lines. 14 | display_shortcuts() { 15 | # Note that by default ack uses the --nogroup -H option by default when 16 | # output is piped or redirected, so we do get a file name on each line as $1 17 | # We could have restored the default look for ack with the --group option, but 18 | # it turns out that this is actually simpler to parse with --nogroup and then 19 | # reformat the output to match the --group formats. 20 | awk -v f_name="" -F':' ' 21 | BEGIN {x=1}; 22 | { 23 | if ($1 != f_name) { 24 | printf("\n%s\n", $1); 25 | f_name=$1; 26 | }; 27 | printf("[%s] ", x); 28 | printf("%s", $2); 29 | for (i=3; i<=NF; i++) { 30 | printf(":%s", $i); 31 | } 32 | printf("\n"); 33 | x++; 34 | };' 35 | } 36 | 37 | # Processes the output that goes into the shortcut file: 38 | # Format: line_number:full_file_path 39 | process_shorcut_paths() { 40 | # Using : as the delimiter here should be fine, because : is not used in file names 41 | awk -F':' ' 42 | { 43 | print $2 " " $1; 44 | };' 45 | } 46 | 47 | # Remove the escaped characters that get piped from ack in order to preserve 48 | # colored output to stdout 49 | remove_escaped_chars() { 50 | sed -E "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g" 51 | } 52 | 53 | $BIN "$@" | \ 54 | tee >/dev/null >(display_shortcuts) >(process_shorcut_paths | remove_escaped_chars > "${SACK_SHORTCUT_FILE}") | \ 55 | less -F 56 | -------------------------------------------------------------------------------- /dotfiles/bin/systemd-mail: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | /usr/sbin/sendmail -t < 6 | Subject: Unit $2 failed 7 | Content-Transfer-Encoding: 8bit 8 | Content-Type: text/plain; charset=UTF-8 9 | 10 | $(systemctl --user --lines 0 status --full "$2") 11 | 12 | $(journalctl --user-unit "$2" --since="$(systemctl --user show -p ExecMainStartTimestamp "$2" | cut -d= -f 2)") 13 | ERRMAIL 14 | -------------------------------------------------------------------------------- /dotfiles/ctags: -------------------------------------------------------------------------------- 1 | --sort=yes 2 | --c-kinds=+p 3 | --c++-kinds=+p 4 | --fields=+iaS 5 | -I __THROW,__NTH,__wur,__warnattr,__nonnull,__attribute_malloc__,__attribute_pure__,__attribute_used__,__attribute_noinline__,__attribute_deprecated__,__attribute_format_arg__,__attribute_format_strfmon__,__attribute_warn_unused_result__,__always_inline,__extern_inline,__extension__,__restrict,PR_IMPLEMENT,XPT_PUBLIC_API,NSPR_API 6 | 7 | --langdef=bib 8 | --langmap=bib:.bib 9 | --regex-bib=/^@[A-Za-z]+\{([^,]*)/\1/b,bib/ 10 | 11 | --langdef=xpidl 12 | --langmap=xpidl:.idl 13 | --regex-xpidl=/^[[:blank:]]*interface[[:space:]]+([a-zA-Z0-9_]+);$/\1/p,prototype/ 14 | --regex-xpidl=/^[[:blank:]]*interface[[:space:]]+([a-zA-Z0-9_]+)[[:space:]]+(:[[:space:]]*[^{]+[[:space:]]*)?/\1/i,interface/ 15 | --regex-xpidl=/^.*[[:blank:]]+attribute[[:space:]]+([a-zA-Z0-9_]+)[[:space:]]+([a-zA-Z0-9_]+);/\2/a,attribute/ 16 | --regex-xpidl=/^.*native[[:blank:]]+([a-zA-Z0-9_]+)\(/\1/t,type/ 17 | --regex-xpidl=/^.*(void|boolean|octet|short|long|long[[:blank:]]+long|unsigned[[:blank:]]+short|unsigned[[:blank:]]+long|unsigned[[:blank:]]+long[[:blank:]]+long|float|double|char|wchar|string|wstring|nsrefcnt)[[:blank:]]+([a-zA-Z0-9_]+)\(/\2/o,operation/ 18 | 19 | --langdef=rfc 20 | --langmap=rfc:(rfc*).txt 21 | --regex-rfc=/^(([[:alpha:]]+.)?[[:digit:].]+)\. /\1/s,section/ 22 | --regex-rfc=/^ +(\[[[:alnum:]]+\])/\1/r,reference/ 23 | -------------------------------------------------------------------------------- /dotfiles/digrc: -------------------------------------------------------------------------------- 1 | +nocmd 2 | +nocomments 3 | +noquestion 4 | +nostats 5 | -------------------------------------------------------------------------------- /dotfiles/excludes/archive: -------------------------------------------------------------------------------- 1 | *.*.sw[a-z] 2 | *tags 3 | *cscope.* 4 | -------------------------------------------------------------------------------- /dotfiles/excludes/diff: -------------------------------------------------------------------------------- 1 | *.sw? 2 | *.[ao] 3 | *.so 4 | *.class 5 | *.jar 6 | *.pyc 7 | 8 | tags 9 | cscope.* 10 | 11 | .git 12 | .hg 13 | .svn 14 | CVS 15 | 16 | target 17 | *.key 18 | .classpath 19 | .settings 20 | .project 21 | ivy-cache 22 | -------------------------------------------------------------------------------- /dotfiles/fontconfig/conf.d/20-tahoma.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Tahoma 10 | false 11 | 12 | 13 | -------------------------------------------------------------------------------- /dotfiles/fontconfig/conf.d/30-aliases.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /dotfiles/fontconfig/conf.d/30-overrides.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /dotfiles/fuzzel/fuzzel.ini: -------------------------------------------------------------------------------- 1 | font=monospace:size=16 2 | use-bold=yes 3 | fields=filename,name,generic,exec,categories,keywords,comment 4 | match-mode=exact 5 | show-actions=yes 6 | # list-executables-in-path=yes 7 | 8 | width=60 9 | horizontal-pad=20 10 | vertical-pad=20 11 | inner-pad=10 12 | line-height=20 13 | 14 | [colors] 15 | background=333333ff 16 | text=ffffffff 17 | # prompt=586e75ff 18 | input=ffffffff 19 | # match=cb4b16ff 20 | selection=6b8e23ff 21 | selection-text=f0e68cff 22 | # selection-match=cb4b16ff 23 | border=6b8e23ff 24 | 25 | [border] 26 | width=2 27 | 28 | [key-bindings] 29 | delete-line-forward=none 30 | prev-with-wrap=ISO_Left_Tab Control+k 31 | next-with-wrap=Control+j 32 | insert-selected=Control+Tab Control+Return 33 | -------------------------------------------------------------------------------- /dotfiles/gdbinit: -------------------------------------------------------------------------------- 1 | # set prompt \033[1m(gdb) \033[0m 2 | set extended-prompt \w - \f\n(gdb) 3 | 4 | python 5 | import os 6 | gdb.execute('set history filename ' + os.environ['XDG_STATE_HOME'] + '/gdb_history') 7 | end 8 | set history save on 9 | set history size 1024 10 | 11 | set print pretty 12 | set print symbol-filename on 13 | set print array on 14 | set print array-indexes on 15 | 16 | # Show the concrete types behind nsIFoo 17 | set print object on 18 | 19 | # https://wiki.archlinux.org/title/Debuginfod 20 | set debuginfod enabled on 21 | set debuginfod urls https://debuginfod.debian.net/ https://debuginfod.elfutils.org/ 22 | 23 | 24 | # https://droettboom.com/blog/2015/11/20/gdb-python-extensions/ 25 | python 26 | import gdb 27 | import re 28 | import sys 29 | import os 30 | from pathlib import Path 31 | PATTERN = re.compile(r"^python3\.[0-9]+$") 32 | for p in Path("/usr/share/doc/").glob("python3.*"): 33 | match = PATTERN.match(p.name) 34 | if match is not None: 35 | sys.path.insert(0, str(p / "examples/gdb")) 36 | def setup_python(event): 37 | import libpython 38 | gdb.events.new_objfile.connect(setup_python) 39 | break 40 | else: 41 | print("No GDB Python integration found") 42 | end 43 | -------------------------------------------------------------------------------- /dotfiles/git/attributes: -------------------------------------------------------------------------------- 1 | # https://github.com/git/git/blob/master/userdiff.c 2 | # https://gist.github.com/tekin/12500956bd56784728e490d8cef9cb81 3 | # https://gist.github.com/ruediger/5647207 4 | *.c diff=cpp 5 | *.c++ diff=cpp 6 | *.cc diff=cpp 7 | *.cpp diff=cpp 8 | *.cs diff=csharp 9 | *.css diff=css 10 | *.el diff=lisp 11 | *.ex diff=elixir 12 | *.exs diff=elixir 13 | *.go diff=golang 14 | *.h diff=cpp 15 | *.h++ diff=cpp 16 | *.hh diff=cpp 17 | *.hpp diff=cpp 18 | *.html diff=html 19 | *.lisp diff=lisp 20 | *.m diff=objc 21 | *.md diff=markdown 22 | *.mm diff=objc 23 | *.php diff=php 24 | *.pl diff=perl 25 | *.py diff=python 26 | *.rake diff=ruby 27 | *.rb diff=ruby 28 | *.rs diff=rust 29 | *.xhtml diff=html 30 | -------------------------------------------------------------------------------- /dotfiles/git/hooks/commit-msg: -------------------------------------------------------------------------------- 1 | stub -------------------------------------------------------------------------------- /dotfiles/git/hooks/commit-msg.d/50_check-format: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -eEu -o pipefail 4 | IFS=$'\n\t' 5 | 6 | error_handler() { echo "Error: Line ${1} exited with status ${2}"; } 7 | trap 'error_handler ${LINENO} $?' ERR 8 | 9 | 10 | error() { 11 | echo ERROR: "$1" >&2 12 | 13 | echo "To edit the commit message and try the commit again run:" >&2 14 | echo " git commit -F '$MSGFILE' -e" >&2 15 | 16 | exit 1 17 | } 18 | 19 | warn() { 20 | echo WARNING: "$@" 21 | } 22 | 23 | MSGFILE="$1" 24 | 25 | if ! grep -q -E -v '^(#.*| *)$' "$MSGFILE"; then 26 | # Empty commit message, nothing to do 27 | exit 0 28 | fi 29 | 30 | if [[ $(head -1 "$MSGFILE" | sed -n -e 's/.*\(.\)$/\1/p') == "." ]]; then 31 | warn "Summary should not end with a period, please remove it by running 'git commit --amend'" 32 | fi 33 | 34 | if (( $(head -1 "$MSGFILE" | wc -c) > 101 )); then 35 | error "Summary should not be longer than 100 characters, please rephrase it" 36 | fi 37 | 38 | if (( $(head -1 "$MSGFILE" | wc -c) > 81 )); then 39 | warn "Summary is longer than 80 characters, please try rephrasing it by running 'git commit --amend'" 40 | fi 41 | 42 | if (( $(cat "$MSGFILE" | sed -e '/# ------------------------ >8 ------------------------/,$d' | grep -v '^#' | wc -l) > 1 )) && ! grep -v '^#' "$MSGFILE" | head -2 | tail -1 | grep '^$'; then 43 | error "The second line in a commit message must be empty" 44 | fi 45 | -------------------------------------------------------------------------------- /dotfiles/git/hooks/post-checkout: -------------------------------------------------------------------------------- 1 | stub -------------------------------------------------------------------------------- /dotfiles/git/hooks/post-checkout.d/50_prune-local-branches: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Remove local branches whose upstream branch has been removed by 3 | # "git fetch --prune" and that have been fully merged 4 | 5 | # Only run on branch checkouts 6 | [[ "$3" == 1 ]] || exit 0 7 | 8 | # Macs have an old version on xargs without the flag used below. 9 | # Most mac users will probably have Homebrew installed though 10 | # and can easily install GNU xargs using 'brew install findutils' 11 | gnuxargs() { 12 | if command -v gxargs 2>&1 > /dev/null; then 13 | gxargs "$@" 14 | else 15 | xargs "$@" 16 | fi 17 | } 18 | 19 | git branch -r | \ 20 | awk '{print $1}' | \ 21 | egrep -v -f /dev/stdin <(git branch -vv | grep ': gone\]') | \ 22 | awk '{print $1}' | \ 23 | gnuxargs --no-run-if-empty git branch -d || : 24 | -------------------------------------------------------------------------------- /dotfiles/git/hooks/pre-commit: -------------------------------------------------------------------------------- 1 | stub -------------------------------------------------------------------------------- /dotfiles/git/hooks/pre-commit.d/50_check-whitespace: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if git rev-parse --verify HEAD >/dev/null 2>&1 4 | then 5 | against=HEAD 6 | else 7 | # Initial commit: diff against an empty tree object 8 | against=4b825dc642cb6eb9a060e54bf8d69288fbee4904 9 | fi 10 | 11 | # If there are whitespace errors, print the offending file names and fail. 12 | exec git diff-index --check --cached $against -- 13 | -------------------------------------------------------------------------------- /dotfiles/git/hooks/reference-transaction: -------------------------------------------------------------------------------- 1 | stub -------------------------------------------------------------------------------- /dotfiles/git/hooks/reference-transaction.d/50_record-parent-branch: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Record the branch that a new branch was created from 3 | # as branch..parent 4 | 5 | set -eEu -o pipefail 6 | IFS=$'\n\t' 7 | 8 | error_handler() { echo "Error: Line ${1} exited with status ${2}"; } 9 | trap 'error_handler ${LINENO} $?' ERR 10 | 11 | 12 | if [[ "$1" != "committed" ]]; then 13 | exit 14 | fi 15 | 16 | while read -r LINE; do 17 | [[ -z "$LINE" ]] && continue 18 | IFS=' ' read -r -a ARRAY <<< "$LINE" 19 | 20 | OLD_REF="${ARRAY[0]}" 21 | NEW_REF="${ARRAY[1]}" 22 | REF_NAME="${ARRAY[2]}" 23 | 24 | # We're only interested in local, proper branches 25 | if ! [[ "$REF_NAME" =~ refs/heads/* ]]; then 26 | continue 27 | fi 28 | 29 | # We're only interested in new branches, which have an all-zeroes old ref 30 | if [[ "$OLD_REF" != "0000000000000000000000000000000000000000" ]]; then 31 | continue 32 | fi 33 | 34 | # If the new ref is all zeroes then it is getting deleted 35 | if [[ "$NEW_REF" == "0000000000000000000000000000000000000000" ]]; then 36 | continue 37 | fi 38 | 39 | NEW_BRANCH=${REF_NAME##*/} 40 | OLD_BRANCH=$(git symbolic-ref --short -q HEAD) || true 41 | 42 | if [[ -z "$OLD_BRANCH" ]] || [[ "$OLD_BRANCH" == "$NEW_BRANCH" ]]; then 43 | continue 44 | fi 45 | 46 | git config branch."${NEW_BRANCH}".parent "$OLD_BRANCH" 47 | done 48 | -------------------------------------------------------------------------------- /dotfiles/git/ignore: -------------------------------------------------------------------------------- 1 | # backup files 2 | *~ 3 | 4 | .nfs* 5 | 6 | # object files 7 | *.[ao] 8 | *.so 9 | 10 | # byte-compiled files 11 | *.class 12 | *.pyc 13 | *.pyo 14 | *.zwc 15 | 16 | # vim 17 | [._]*.s[a-w][a-z] 18 | [._]s[a-w][a-z] 19 | *.un~ 20 | Session.vim 21 | .netrwhist 22 | 23 | # tags 24 | tags 25 | cscope.* 26 | 27 | # LaTeX stuff 28 | *.aux 29 | *.auxlock 30 | *.bbl 31 | *.blg 32 | *.fdb_latexmk 33 | *.fls 34 | *.lof 35 | *.log 36 | *.lol 37 | *.lot 38 | *.nav 39 | *.out 40 | *.snm 41 | *.toc 42 | *.vrb 43 | 44 | *.pdf 45 | 46 | # configure stuff 47 | config.log 48 | config.status 49 | 50 | # gcov stuff 51 | *.gcov 52 | *.gcda 53 | *.gcno 54 | gmon.out 55 | 56 | # IDEs 57 | .idea 58 | .classpath 59 | .project 60 | .settings/ 61 | *.iml 62 | 63 | .mypy_cache/ 64 | .venv/ 65 | 66 | mise.local.toml 67 | .mise.local.toml 68 | mise.*.local.toml 69 | .mise.*.local.toml 70 | -------------------------------------------------------------------------------- /dotfiles/gnuplot/bw.gnuplot: -------------------------------------------------------------------------------- 1 | set style line 80 lc rgb "#808080" lt 1 2 | set border 3 back ls 80 3 | set tics nomirror out scale 1,0.001 4 | 5 | set mxtics 6 | set mytics 7 | set style line 81 lc rgb "grey90" lt 1 lw 1 8 | set style line 82 lc rgb "#f8f8f8" lt 1 lw 1 9 | set grid xtics mxtics ytics mytics ls 81, ls 82 10 | 11 | # set key opaque width 0.5 height 0.5 box lc rgb "black" lt 1 12 | -------------------------------------------------------------------------------- /dotfiles/gnuplot/gnuplot: -------------------------------------------------------------------------------- 1 | load "{{@@ _dotdrop_dotpath @@}}/gnuplot/grey.gnuplot" 2 | -------------------------------------------------------------------------------- /dotfiles/gnuplot/grey.gnuplot: -------------------------------------------------------------------------------- 1 | set object 1 rectangle from graph 0,0 to graph 1,1 behind 2 | set object 1 rectangle fillcolor rgb "grey90" 3 | 4 | set mxtics 5 | set mytics 6 | set style line 80 lc rgb "grey50" lt 1 7 | set border 0 back ls 80 8 | set tics nomirror out textcolor rgb "grey50" scale 1,0.001 9 | 10 | set style line 81 lc rgb "white" lt 1 lw 1 11 | set style line 82 lc rgb "#eeeeee" lt 1 lw 0.5 12 | set grid xtics mxtics ytics mytics ls 81, ls 82 13 | 14 | set key opaque width 0.5 height 0.5 box lc rgb "black" lt 1 15 | -------------------------------------------------------------------------------- /dotfiles/idea/idea.properties: -------------------------------------------------------------------------------- 1 | idea.popup.weight=medium 2 | 3 | # java.net.useSystemProxies=true 4 | -------------------------------------------------------------------------------- /dotfiles/idea/idea64.vmoptions: -------------------------------------------------------------------------------- 1 | # default 2 | #-Xms128m 3 | -Xmx2048m 4 | #-XX:ReservedCodeCacheSize=240m 5 | #-XX:+UseConcMarkSweepGC 6 | #-XX:SoftRefLRUPolicyMSPerMB=50 7 | #-ea 8 | #-Dsun.io.useCanonCaches=false 9 | #-Djava.net.preferIPv4Stack=true 10 | #-Djdk.http.auth.tunneling.disabledSchemes="" 11 | #-XX:+HeapDumpOnOutOfMemoryError 12 | #-XX:-OmitStackTraceInFastThrow 13 | #-Dawt.useSystemAAFontSettings=lcd 14 | #-Dsun.java2d.renderer=sun.java2d.marlin.MarlinRenderingEngine 15 | 16 | # custom 17 | -Dundo.documentUndoLimit=200 18 | # -DactionSystem.xWindow.remove.focus.from.nonFocusable.popups=false 19 | # -Dfocus.follows.mouse.workarounds=true 20 | # -Dallow.dialog.based.popups=false 21 | 22 | # Needed by google-java-format plugin 23 | # https://github.com/google/google-java-format/blob/master/README.md#intellij-android-studio-and-other-jetbrains-ides 24 | --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED 25 | --add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED 26 | --add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED 27 | --add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED 28 | --add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED 29 | --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED 30 | -------------------------------------------------------------------------------- /dotfiles/idea/ideavimrc: -------------------------------------------------------------------------------- 1 | " Ideas: https://github.com/sdaschner/dotfiles/blob/master/.ideavimrc 2 | 3 | set ignorecase 4 | set smartcase 5 | 6 | set incsearch 7 | set hlsearch 8 | 9 | set showmode 10 | set showcmd 11 | 12 | set NERDTree 13 | let g:NERDTreeMapActivateNode='l' 14 | let g:NERDTreeMapJumpParent='h' 15 | 16 | set ideamarks 17 | set ideajoin 18 | set idearefactormode=keep 19 | set surround 20 | 21 | set clipboard+=unnamed 22 | set clipboard+=unnamedplus 23 | 24 | set scrolloff=5 25 | set sidescrolloff=5 26 | 27 | nmap (GotoDeclaration) 28 | 29 | nmap (GotoClass) 30 | nmap (RecentFiles) 31 | nmap (Vcs.UpdateProject) 32 | nmap (Vcs.QuickListPopupAction) 33 | nmap (OverrideMethods) 34 | " nmap (ParameterInfo) 35 | nmap (GotoSuperMethod) 36 | nmap (ImplementMethods) 37 | 38 | " imap :action ParameterInfoa 39 | 40 | nmap (Back) 41 | " nmap (Back) 42 | " nmap (Forward) 43 | nmap 44 | nnoremap :nohlsearch 45 | 46 | " Doesn't really work yet due to 47 | " https://youtrack.jetbrains.com/issue/VIM-510 48 | nmap (EditorSelectWord) 49 | nmap (EditorUnSelectWord) 50 | vmap (EditorSelectWord) 51 | vmap (EditorUnSelectWord) 52 | imap :action CodeCompletiona 53 | imap :action SmartTypeCompletiona 54 | -------------------------------------------------------------------------------- /dotfiles/inputrc: -------------------------------------------------------------------------------- 1 | $include /etc/inputrc 2 | 3 | $if Bash 4 | Tab: menu-complete 5 | # bash >= 4 only 6 | # "\e[Z": menu-complete-backward 7 | "\e[Z": "\e-1\C-i" 8 | 9 | "\C-j": menu-complete 10 | # bash >= 4 only 11 | # "\C-k": menu-complete-backward 12 | "\C-k": "\e-1\C-j" 13 | $endif 14 | 15 | "\C-p": history-search-backward 16 | "\C-n": history-search-forward 17 | "\ew": unix-filename-rubout 18 | 19 | set bell-style visible 20 | set blink-matching-paren on 21 | set colored-stats on 22 | set enable-bracketed-paste on 23 | set mark-symlinked-directories on 24 | set revert-all-at-newline on 25 | set visible-stats on 26 | 27 | set colored-completion-prefix on 28 | set completion-ignore-case on 29 | set completion-map-case on 30 | # set completion-prefix-display-length 2 31 | set match-hidden-files off 32 | set menu-complete-display-prefix on 33 | set show-all-if-ambiguous on 34 | set show-all-if-unmodified on 35 | set skip-completed-text on 36 | -------------------------------------------------------------------------------- /dotfiles/irbrc: -------------------------------------------------------------------------------- 1 | #IRB.conf[:AUTO_INDENT] = true 2 | IRB.conf[:USE_READLINE] = true 3 | IRB.conf[:SAVE_HISTORY] = 5000 4 | IRB.conf[:HISTORY_FILE] = "#{ENV['XDG_STATE_HOME']}/irb_history" 5 | 6 | IRB.conf[:PROMPT][:MY_PROMPT] = { 7 | :PROMPT_I => "%N(%m):%03n:%i> ", 8 | :PROMPT_N => "%N(%m):%03n:%i> ", 9 | :PROMPT_S => "%N(%m):%03n:%i%l ", 10 | :PROMPT_C => "%N(%m):%03n:%i* ", 11 | :RETURN => "=> %s\n" 12 | } 13 | IRB.conf[:PROMPT_MODE] = :MY_PROMPT 14 | #IRB.conf[:PROMPT_MODE] = :SIMPLE 15 | 16 | require 'irb/completion' 17 | require 'irb/ext/save-history' 18 | require 'pp' 19 | 20 | # load rubygems and wirble 21 | require 'rubygems' rescue nil 22 | require 'wirble' 23 | require 'utility_belt' 24 | 25 | # load wirble 26 | Wirble.init 27 | Wirble.colorize 28 | -------------------------------------------------------------------------------- /dotfiles/keynavrc: -------------------------------------------------------------------------------- 1 | clear 2 | daemonize 3 | ctrl+alt+semicolon start 4 | Escape end 5 | ctrl+bracketleft end 6 | q record ~/.keynav_macros 7 | shift+at playback 8 | a history-back 9 | h cut-left 10 | j cut-down 11 | k cut-up 12 | l cut-right 13 | shift+h move-left 14 | shift+j move-down 15 | shift+k move-up 16 | shift+l move-right 17 | space warp,click 1,end 18 | Return warp,click 1,end 19 | semicolon warp,end 20 | w warp 21 | t windowzoom 22 | c cursorzoom 300 300 23 | e grid-nav toggle 24 | 1 click 1 25 | 2 click 2 26 | 3 click 3 27 | ctrl+h cut-left 28 | ctrl+j cut-down 29 | ctrl+k cut-up 30 | ctrl+l cut-right 31 | y cut-left,cut-up 32 | u cut-right,cut-up 33 | b cut-left,cut-down 34 | n cut-right,cut-down 35 | shift+y move-left,move-up 36 | shift+u move-right,move-up 37 | shift+b move-left,move-down 38 | shift+n move-right,move-down 39 | ctrl+y cut-left,cut-up 40 | ctrl+u cut-right,cut-up 41 | ctrl+b cut-left,cut-down 42 | ctrl+n cut-right,cut-down 43 | -------------------------------------------------------------------------------- /dotfiles/kitty/.gitignore: -------------------------------------------------------------------------------- 1 | current-theme.conf 2 | .env 3 | -------------------------------------------------------------------------------- /dotfiles/kitty/init.vim: -------------------------------------------------------------------------------- 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! 28 | nmap i 29 | 30 | highlight CurSearch ctermfg=0 ctermbg=2 guifg=Black guibg=LightGreen 31 | 32 | augroup quickfix 33 | autocmd BufReadPost quickfix syntax match ConcealedDetails /\v^[^|]*\|[^|]*\| / conceal 34 | autocmd FileType qf setlocal conceallevel=2 35 | autocmd FileType qf setlocal concealcursor=nvic 36 | autocmd FileType qf setlocal nowrap 37 | autocmd FileType qf nmap q :cclose 38 | augroup END 39 | 40 | " Populate the quickfix window with the last search 41 | nnoremap g/ :execute 'vimgrep /' . @/ . '/j %':copen 42 | -------------------------------------------------------------------------------- /dotfiles/kitty/pyproject.toml: -------------------------------------------------------------------------------- 1 | [tool.ruff] 2 | ignore = [ 3 | "UP" 4 | ] 5 | -------------------------------------------------------------------------------- /dotfiles/kitty/theme-desert.conf: -------------------------------------------------------------------------------- 1 | #: The basic colors 2 | 3 | foreground #ffffff 4 | background #333333 5 | selection_foreground #f0e68c 6 | selection_background #6b8e23 7 | 8 | 9 | #: Cursor colors 10 | 11 | cursor #ffff00 12 | # cursor_text_color #111111 13 | 14 | 15 | #: URL underline color when hovering with mouse 16 | 17 | # url_color #0087bd 18 | 19 | 20 | #: kitty window border colors and terminal bell colors 21 | 22 | # active_border_color #00ff00 23 | # inactive_border_color #cccccc 24 | # bell_border_color #ff5a00 25 | # visual_bell_color none 26 | 27 | 28 | #: OS Window titlebar colors 29 | 30 | # wayland_titlebar_color system 31 | # macos_titlebar_color system 32 | 33 | 34 | #: Tab bar colors 35 | 36 | active_tab_foreground #333333 37 | active_tab_background #ffffff 38 | inactive_tab_foreground #ffffff 39 | inactive_tab_background #333333 40 | # tab_bar_background none 41 | # tab_bar_margin_color none 42 | 43 | 44 | #: Colors for marks (marked text in the terminal) 45 | 46 | # mark1_foreground black 47 | # mark1_background #98d3cb 48 | # mark2_foreground black 49 | # mark2_background #f2dcd3 50 | # mark3_foreground black 51 | # mark3_background #f274bc 52 | 53 | 54 | #: The basic 16 colors 55 | 56 | #: black 57 | color0 #2e3436 58 | color8 #555753 59 | 60 | #: red 61 | color1 #d75f5f 62 | color9 #ef2929 63 | 64 | #: green 65 | color2 #87ff87 66 | color10 #8ae234 67 | 68 | #: yellow 69 | color3 #ffd700 70 | color11 #fce94f 71 | 72 | #: blue 73 | color4 #87d7d7 74 | color12 #729fcf 75 | 76 | #: magenta 77 | color5 #ad7fa8 78 | color13 #bb95b7 79 | 80 | #: cyan 81 | color6 #34e2e2 82 | color14 #00ffff 83 | 84 | #: white 85 | color7 #d3d7cf 86 | color15 #eeeeec 87 | 88 | 89 | #: You can set the remaining 240 colors as color16 to color255. 90 | -------------------------------------------------------------------------------- /dotfiles/kitty/theme-material.conf: -------------------------------------------------------------------------------- 1 | #: The basic colors 2 | 3 | foreground #546e7a 4 | background #fafafa 5 | selection_foreground #546e7a 6 | selection_background #80cbc4 7 | 8 | 9 | #: Cursor colors 10 | 11 | cursor #f6a434 12 | # cursor_text_color #111111 13 | 14 | 15 | #: URL underline color when hovering with mouse 16 | 17 | # url_color #0087bd 18 | 19 | 20 | #: kitty window border colors and terminal bell colors 21 | 22 | # active_border_color #00ff00 23 | # inactive_border_color #cccccc 24 | # bell_border_color #ff5a00 25 | # visual_bell_color none 26 | 27 | 28 | #: OS Window titlebar colors 29 | 30 | # wayland_titlebar_color system 31 | # macos_titlebar_color system 32 | 33 | 34 | #: Tab bar colors 35 | 36 | active_tab_foreground #fafafa 37 | active_tab_background #00BCD4 38 | inactive_tab_foreground #546e7a 39 | inactive_tab_background #fafafa 40 | # tab_bar_background none 41 | # tab_bar_margin_color none 42 | 43 | 44 | #: Colors for marks (marked text in the terminal) 45 | 46 | # mark1_foreground black 47 | # mark1_background #98d3cb 48 | # mark2_foreground black 49 | # mark2_background #f2dcd3 50 | # mark3_foreground black 51 | # mark3_background #f274bc 52 | 53 | 54 | #: The basic 16 colors 55 | 56 | #: black 57 | color0 #000000 58 | color8 #90a4ae 59 | 60 | #: red 61 | color1 #e53935 62 | color9 #e53935 63 | 64 | #: green 65 | color2 #91b859 66 | color10 #91b859 67 | 68 | #: yellow 69 | color3 #f6a434 70 | color11 #f6a434 71 | 72 | #: blue 73 | color4 #6182b8 74 | color12 #6182b8 75 | 76 | #: magenta 77 | color5 #7c4dff 78 | color13 #7c4dff 79 | 80 | #: cyan 81 | color6 #39adb5 82 | color14 #39adb5 83 | 84 | #: white 85 | color7 #ffffff 86 | color15 #ffffff 87 | 88 | 89 | #: You can set the remaining 240 colors as color16 to color255. 90 | -------------------------------------------------------------------------------- /dotfiles/latexmk/latexmkrc: -------------------------------------------------------------------------------- 1 | $pdf_mode = 1; 2 | 3 | $pdflatex = 'pdflatex --shell-escape %O %S'; 4 | 5 | # Custom dependency to convert tif to png 6 | add_cus_dep('tif', 'png', 0, 'maketif2png'); 7 | sub maketif2png { 8 | system("convert $_[0].tif $_[0].png"); 9 | } 10 | 11 | # vim: ft=perl 12 | -------------------------------------------------------------------------------- /dotfiles/lazygit/config.yml: -------------------------------------------------------------------------------- 1 | gui: 2 | enlargedSideViewLocation: 'top' 3 | expandFocusedSidePanel: true 4 | timeFormat: '2006-01-02' 5 | shortTimeFormat: '03:04' 6 | theme: 7 | selectedLineBgColor: 8 | - reverse 9 | selectedRangeBgColor: 10 | - reverse 11 | showCommandLog: false 12 | showDivergenceFromBaseBranch: arrowAndNumber # or 'onlyArrow' 13 | nerdFontsVersion: "3" 14 | git: 15 | autoForwardBranches: none 16 | paging: 17 | # colorArg: always 18 | # pager: delta --features=decorations --paging=never 19 | pager: delta --paging=never --line-numbers --hyperlinks --hyperlinks-file-link-format="lazygit-edit://{path}:{line}" 20 | branchLogCmd: 'git log --graph --color=always --abbrev-commit --decorate --date=iso --pretty=medium {{branchName}} --' 21 | allBranchesLogCmd: 'git log --graph --all --color=always --abbrev-commit --decorate --date=iso --pretty=medium' 22 | keybinding: 23 | commits: 24 | markCommitAsBaseForRebase: b 25 | viewBisectOptions: B 26 | customCommands: 27 | - key: D 28 | command: git d {{.SelectedLocalBranch.UpstreamRemote}}/{{.SelectedLocalBranch.UpstreamBranch}}..{{.SelectedLocalBranch.Name}} 29 | context: localBranches 30 | description: Show diff with upstream 31 | subprocess: true 32 | - key: t 33 | command: tig show {{.SelectedSubCommit.Sha}} 34 | context: subCommits 35 | description: tig commit (`t` again to browse files at revision) 36 | subprocess: true 37 | - key: t 38 | command: tig show {{.SelectedLocalBranch.Name}} 39 | context: localBranches 40 | description: tig branch (`t` again to browse files at revision) 41 | subprocess: true 42 | - key: t 43 | command: tig show {{.SelectedRemoteBranch.RemoteName}}/{{.SelectedRemoteBranch.Name}} 44 | context: remoteBranches 45 | description: tig branch (`t` again to browse files at revision) 46 | subprocess: true 47 | -------------------------------------------------------------------------------- /dotfiles/less/lesskey: -------------------------------------------------------------------------------- 1 | #command 2 | h left-scroll 3 | l right-scroll 4 | ^L noaction ^R\eu 5 | [ prev-file 6 | ] next-file 7 | Q quit \1 8 | :cq quit \1 9 | D noaction j/\^((diff|commit|Date|From) )|((added|deleted|modified): )\n\eu 10 | # ^s noaction /\^\\s+ 11 | ^s noaction /\^ 12 | V noaction g|$/usr/bin/vim -\n 13 | 14 | #line-edit 15 | ^A home 16 | ^E end 17 | ^F right 18 | ^B left 19 | ^D delete 20 | ^W word-backspace 21 | ^P up 22 | ^N down 23 | 24 | ^[ abort 25 | 26 | #env 27 | # See 'man 5 termcap' for capabilities 28 | # start bold mode => bold red 29 | LESS_TERMCAP_md = ^[[1;31m 30 | # start underlining => bold green 31 | LESS_TERMCAP_us = ^[[1;32m 32 | # end underlining => turn off all attributes 33 | LESS_TERMCAP_ue = ^[[m^O 34 | -------------------------------------------------------------------------------- /dotfiles/lua/init.lua: -------------------------------------------------------------------------------- 1 | -- http://www.playwithlua.com/?p=64 2 | 3 | lua_version = string.gmatch(_VERSION, "Lua ([0-9.]+)")() 4 | 5 | local luarocks_path = os.getenv("HOME") .. "/.local/luarocks/share/lua/" .. lua_version 6 | package.path = package.path .. ";" .. os.getenv("DOTFILES") .. "/lua/?.lua" .. ";" .. luarocks_path .. "/?.lua" .. ";" .. luarocks_path .. "/?/init.lua" 7 | package.cpath = package.cpath .. ";" .. os.getenv("DOTFILES") .. "/lua/?.so" .. ";" .. luarocks_path .. "/?.so" 8 | 9 | -- https://stackoverflow.com/a/34965917/102250 10 | function prequire(...) 11 | local status, lib = pcall(require, ...) 12 | if status then return lib end 13 | return nil 14 | end 15 | 16 | inspect = prequire("inspect") 17 | 18 | 19 | function string:split(sep) 20 | if sep == nil then 21 | sep = "%s" 22 | end 23 | 24 | local t = {} 25 | local i = 1 26 | 27 | for str in string.gmatch(self, "([^" .. sep .. "]+)") do 28 | t[i] = str 29 | i = i + 1 30 | end 31 | 32 | return t 33 | end 34 | 35 | function string:trim() 36 | return (self:gsub("^%s*(.-)%s*$", "%1")) 37 | end 38 | 39 | function table.clone(t, deep) 40 | deep = deep == nil and true or deep 41 | local c = { } 42 | for k, v in pairs(t) do 43 | if deep and type(v) == "table" then 44 | c[k] = table.clone(v) 45 | else 46 | c[k] = v 47 | end 48 | end 49 | return c 50 | end 51 | 52 | function table.merge(t1, t2) 53 | local ret = table.clone(t1, true) 54 | 55 | for k, v in pairs(t2) do 56 | if type(v) == "table" and ret[k] and type(ret[k]) == "table" then 57 | ret[k] = table.merge(ret[k], v) 58 | else 59 | ret[k] = v 60 | end 61 | end 62 | 63 | return ret 64 | end 65 | -------------------------------------------------------------------------------- /dotfiles/lua/luarocks-config.lua: -------------------------------------------------------------------------------- 1 | -- https://github.com/luarocks/luarocks/wiki/Config-file-format 2 | -- https://github.com/luarocks/luarocks/wiki/config 3 | 4 | rocks_trees = { home .. "/.local/luarocks" } 5 | -------------------------------------------------------------------------------- /dotfiles/mise/config.toml: -------------------------------------------------------------------------------- 1 | [settings] 2 | experimental = true 3 | idiomatic_version_file_enable_tools = ["python", "node"] 4 | 5 | [settings.python] 6 | uv_venv_auto = true 7 | 8 | [settings.status] 9 | show_env = true 10 | show_tools = true 11 | -------------------------------------------------------------------------------- /dotfiles/moc/.gitignore: -------------------------------------------------------------------------------- 1 | cache 2 | equalizer 3 | last_directory 4 | playlist.m3u 5 | pid 6 | socket2 7 | softmixer 8 | tags_cache 9 | -------------------------------------------------------------------------------- /dotfiles/mozilla/user.js: -------------------------------------------------------------------------------- 1 | // Reference: 2 | // https://searchfox.org/mozilla-central/source/modules/libpref/init/StaticPrefList.yaml 3 | 4 | // Open all requests for new windows in new tabs instead 5 | user_pref('browser.link.open_newwindow', 3); 6 | user_pref('browser.link.open_newwindow.restriction', 0); 7 | 8 | // Resume previous session on startup 9 | user_pref('browser.startup.page', 3); 10 | 11 | user_pref('browser.tabs.loadDivertedInBackground', true); 12 | user_pref('browser.urlbar.trimURLs', false); 13 | user_pref('browser.urlbar.update2.engineAliasRefresh', true); 14 | 15 | user_pref('devtools.chrome.enabled', true); 16 | user_pref('devtools.command-button-measure.enabled', true); 17 | user_pref('devtools.command-button-rulers.enabled', true); 18 | user_pref('devtools.command-button-screenshot.enabled', true); 19 | user_pref('devtools.selfxss.count', 0); 20 | 21 | user_pref('general.warnOnAboutConfig', false); 22 | 23 | // This pref defines what the blocking policy would be used in blocking autoplay. 24 | // 0 : use sticky activation (default) 25 | // https://html.spec.whatwg.org/multipage/interaction.html#sticky-activation 26 | // 1 : use transient activation (the transient activation duration can be 27 | // adjusted by the pref `dom.user_activation.transient.timeout`) 28 | // https://html.spec.whatwg.org/multipage/interaction.html#transient-activation 29 | // 2 : user input depth (allow autoplay when the play is trigged by user input 30 | // which is determined by the user input depth) 31 | user_pref('media.autoplay.blocking_policy', 1); 32 | // Block autoplay, asking for permission by default. 33 | // 0=Allowed, 1=Blocked, 5=All Blocked 34 | user_pref('media.autoplay.default', 5); 35 | 36 | // Reject all third-party cookies 37 | user_pref('network.cookie.cookieBehavior', 1); 38 | 39 | user_pref('privacy.donottrackheader.enabled', true); 40 | user_pref('privacy.donottrackheader.value', 1); 41 | user_pref('privacy.trackingprotection.enabled', true); 42 | -------------------------------------------------------------------------------- /dotfiles/mozilla/userChrome.css: -------------------------------------------------------------------------------- 1 | #TabsToolbar { 2 | visibility: collapse; 3 | } 4 | 5 | /* #sidebar-header { */ 6 | /* display:none; */ 7 | /* } */ 8 | 9 | #sidebar-switcher-target { 10 | font-size: 75%; 11 | } 12 | -------------------------------------------------------------------------------- /dotfiles/ncdu/config: -------------------------------------------------------------------------------- 1 | -e 2 | --color dark 3 | -------------------------------------------------------------------------------- /dotfiles/offlineimap/config: -------------------------------------------------------------------------------- 1 | [general] 2 | accounts = Main 3 | ui = ttyui 4 | pythonfile = ~/.config/offlineimap/helpers.py 5 | metadata = $XDG_STATE_HOME/offlineimap 6 | fsync = False 7 | 8 | [Account Main] 9 | localrepository = Local 10 | remoterepository = Remote 11 | autorefresh = 10 12 | holdconnectionopen = yes 13 | keepalive = 60 14 | 15 | [Repository Local] 16 | type = Maildir 17 | localfolders = ~/Maildir 18 | nametrans = lambda folder: 'INBOX' if len(folder) == 0 else re.sub('^.', '', folder) 19 | 20 | [Repository Remote] 21 | type = IMAP 22 | remotehost = mail.majutsushi.net 23 | remoteport = 993 24 | remoteuser = app-eilonwy-keyring 25 | remotepasseval = get_password() 26 | ssl = yes 27 | sslcacertfile = /etc/ssl/certs/ca-certificates.crt 28 | nametrans = lambda folder: '' if folder == 'INBOX' else '.' + folder 29 | # idlefolders = ['INBOX'] 30 | 31 | # vim: ft=cfg 32 | -------------------------------------------------------------------------------- /dotfiles/offlineimap/helpers.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import keyring 4 | 5 | def get_password(): 6 | return keyring.get_password("majutsushi.net", "app-eilonwy-keyring") 7 | -------------------------------------------------------------------------------- /dotfiles/picom-vbox.conf: -------------------------------------------------------------------------------- 1 | # Shadow 2 | shadow = true; 3 | shadow-radius = 18; 4 | shadow-offset-x = -18; 5 | shadow-offset-y = -16; 6 | shadow-opacity = 0.7; 7 | shadow-red = 0.0; 8 | shadow-green = 0.0; 9 | shadow-blue = 0.0; 10 | shadow-exclude = [ 11 | "name = 'Notification'", 12 | "class_g = 'Conky'", 13 | "class_g ?= 'Notify-osd'", 14 | "class_g = 'Cairo-clock'" 15 | ]; 16 | shadow-ignore-shaped = false; 17 | 18 | inactive-dim = 0.3; 19 | 20 | mark-wmwin-focused = true; 21 | mark-ovredir-focused = true; 22 | detect-rounded-corners = true; 23 | detect-client-opacity = true; 24 | detect-transient = false; 25 | detect-client-leader = false; 26 | 27 | # Window type settings 28 | wintypes : 29 | { 30 | dock = { shadow = false; } 31 | dnd = { shadow = false; } 32 | }; 33 | -------------------------------------------------------------------------------- /dotfiles/picom.conf: -------------------------------------------------------------------------------- 1 | # Shadow 2 | shadow = true; 3 | shadow-radius = 18; 4 | shadow-offset-x = -18; 5 | shadow-offset-y = -16; 6 | shadow-opacity = 0.7; 7 | shadow-red = 0.0; 8 | shadow-green = 0.0; 9 | shadow-blue = 0.0; 10 | shadow-exclude = [ 11 | "name = 'Notification'", 12 | "class_g = 'Conky'", 13 | "class_g ?= 'Notify-osd'", 14 | "class_g = 'Cairo-clock'", 15 | "class_g = 'firefox' && argb" 16 | ]; 17 | shadow-ignore-shaped = false; 18 | 19 | # Opacity 20 | inactive-opacity = 1.0; 21 | active-opacity = 1.0; 22 | frame-opacity = 1.0; 23 | inactive-opacity-override = false; 24 | inactive-dim = 0.3; 25 | blur-background = false; 26 | blur-background-frame = true; 27 | blur-background-fixed = true; 28 | blur-kern = "3x3box"; 29 | blur-background-exclude = [ 30 | "window_type = 'dock'", 31 | "window_type = 'desktop'" 32 | ]; 33 | opacity-rule = [ 34 | "95:class_g ~= 'URxvt|U?XTerm'" 35 | ]; 36 | 37 | # Fading 38 | fading = false; 39 | fade-in-step = 0.4; 40 | fade-out-step = 0.4; 41 | fade-exclude = [ ]; 42 | 43 | # Other 44 | backend = "glx"; 45 | mark-wmwin-focused = true; 46 | mark-ovredir-focused = true; 47 | detect-rounded-corners = true; 48 | detect-client-opacity = true; 49 | refresh-rate = 0; 50 | vsync = true; 51 | dbe = false; 52 | unredir-if-possible = true; 53 | xrender-sync-fence = true; 54 | focus-exclude = [ 55 | "class_g = 'Cairo-clock'", 56 | "_NET_WM_NAME@:s = 'rofi'" 57 | ]; 58 | detect-transient = false; 59 | detect-client-leader = false; 60 | invert-color-include = [ ]; 61 | 62 | # GLX backend 63 | glx-copy-from-front = false; 64 | glx-swap-method = 3; 65 | glx-no-stencil = true; 66 | glx-no-rebind-pixmap = true; 67 | 68 | # Window type settings 69 | wintypes : 70 | { 71 | tooltip : 72 | { 73 | fade = true; 74 | shadow = false; 75 | opacity = 0.85; 76 | focus = true; 77 | }; 78 | dock = { shadow = false; } 79 | dnd = { shadow = false; } 80 | popup_menu = { opacity = 0.95; } 81 | dropdown_menu = { opacity = 0.95; } 82 | }; 83 | -------------------------------------------------------------------------------- /dotfiles/python/mypy.ini: -------------------------------------------------------------------------------- 1 | [mypy] 2 | cache_dir = ~/.cache/mypy 3 | check_untyped_defs = True 4 | disallow_incomplete_defs = True 5 | disallow_subclassing_any = True 6 | disallow_untyped_calls = True 7 | disallow_untyped_decorators = True 8 | disallow_untyped_defs = True 9 | no_implicit_optional = True 10 | strict_optional = True 11 | warn_redundant_casts = True 12 | warn_return_any = True 13 | warn_unused_configs = False 14 | warn_unused_ignores = True 15 | ; scripts_are_modules = True 16 | 17 | [mypy-keyring] 18 | ignore_missing_imports = True 19 | -------------------------------------------------------------------------------- /dotfiles/ranger/.gitignore: -------------------------------------------------------------------------------- 1 | bookmarks 2 | history 3 | tagged 4 | -------------------------------------------------------------------------------- /dotfiles/ranger/colorschemes/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majutsushi/etc/c5877b881f191c010ee8e2703bbe2571afb64616/dotfiles/ranger/colorschemes/__init__.py -------------------------------------------------------------------------------- /dotfiles/redshift.conf: -------------------------------------------------------------------------------- 1 | ; Global settings 2 | [redshift] 3 | ; temp-day=5700 4 | temp-day=6500 5 | temp-night=3700 6 | transition=1 7 | ; gamma=0.8:0.7:0.8 8 | location-provider=geoclue2 9 | ; location-provider=gnome-clock 10 | ; adjustment-method=vidmode 11 | adjustment-method=randr 12 | 13 | ; The location provider and adjustment method settings 14 | ; are in their own sections. 15 | [manual] 16 | ; lat=51.8 17 | ; lon=10.3 18 | 19 | ; In this example screen 1 is adjusted by vidmode. Note 20 | ; that the numbering starts from 0, so this is actually 21 | ; the second screen. 22 | ; [vidmode] 23 | ; screen=1 24 | [randr] 25 | ;screen=0 26 | ;crtc=0 27 | -------------------------------------------------------------------------------- /dotfiles/ripgreprc: -------------------------------------------------------------------------------- 1 | # https://github.com/BurntSushi/ripgrep/blob/master/GUIDE.md#configuration-file 2 | 3 | --smart-case 4 | 5 | --colors=path:none 6 | --colors=path:fg:green 7 | --colors=path:style:bold 8 | --colors=line:none 9 | --colors=line:fg:yellow 10 | --colors=line:style:bold 11 | --colors=column:none 12 | --colors=column:fg:cyan 13 | --colors=column:style:bold 14 | --colors=match:none 15 | --colors=match:bg:yellow 16 | --colors=match:fg:black 17 | -------------------------------------------------------------------------------- /dotfiles/rofi/desert.rasi: -------------------------------------------------------------------------------- 1 | /* configuration { */ 2 | /* show-icons: true; */ 3 | /* } */ 4 | 5 | * { 6 | font: "DejaVu Sans Mono 14"; 7 | padding: 3px 0px 3px 3px; 8 | background-color: #333333; 9 | text-color: #ffffff; 10 | } 11 | 12 | window { 13 | border: 0px; 14 | border-radius: 5px; 15 | padding: 3px 0px 6px 0px; 16 | spacing: 0; 17 | } 18 | 19 | mainbox { 20 | padding: 3px 0px 3px 0px; 21 | } 22 | 23 | inputbar { 24 | padding: 6px 6px 6px 15px; 25 | children: [entry, case-indicator]; 26 | } 27 | 28 | prompt { 29 | font: "DejaVu Sans Mono 20"; 30 | } 31 | 32 | entry { 33 | font: "DejaVu Sans Mono Bold 20"; 34 | } 35 | 36 | button.selected { 37 | background-color: #ffffff; 38 | text-color: #333333; 39 | } 40 | 41 | listview { 42 | padding: 3px 0px 3px 0px; 43 | scrollbar: true; 44 | } 45 | 46 | element { 47 | /* border: 0; */ 48 | padding: 4px 0px 4px 20px; 49 | } 50 | element-text { 51 | background-color: inherit; 52 | text-color: inherit; 53 | } 54 | element-icon { 55 | background-color: inherit; 56 | text-color: inherit; 57 | size: 1em; 58 | } 59 | element.normal.normal { 60 | /* background-color: #333333; */ 61 | text-color: #ffffff; 62 | } 63 | element.normal.urgent { 64 | /* background-color: @urgent-background; */ 65 | text-color: #cc0000; 66 | } 67 | element.normal.active { 68 | /* background-color: @active-background; */ 69 | text-color: #87ceeb; 70 | } 71 | element.selected.normal { 72 | background-color: #6b8e23; 73 | text-color: #f0e68c; 74 | } 75 | element.selected.urgent { 76 | background-color: #cc0000; 77 | text-color: #fdf6e3; 78 | } 79 | element.selected.active { 80 | background-color: #268bd2; 81 | text-color: #fdf6e3; 82 | } 83 | /* element.alternate.normal { */ 84 | /* background-color: #4d4d4d; */ 85 | /* /1* text-color: #ffffff; *1/ */ 86 | /* } */ 87 | /* element.alternate.urgent { */ 88 | /* background-color: #4d4d4d; */ 89 | /* /1* text-color: #ffffff; *1/ */ 90 | /* } */ 91 | /* element.alternate.active { */ 92 | /* background-color: #4d4d4d; */ 93 | /* /1* text-color: #ffffff; *1/ */ 94 | /* } */ 95 | 96 | scrollbar { 97 | handle-color: #777777; 98 | padding: 0px 6px 0px 10px; 99 | } 100 | -------------------------------------------------------------------------------- /dotfiles/shellcheckrc: -------------------------------------------------------------------------------- 1 | # See shellcheck --list-optional 2 | 3 | # Suggest adding a default case in `case` statements 4 | enable=add-default-case 5 | 6 | # Suggest explicitly using -n in `[ $var ]` 7 | enable=avoid-nullary-conditions 8 | 9 | # Check for additional cases where exit codes are masked 10 | enable=check-extra-masked-returns 11 | 12 | # Notify when set -e is suppressed during function invocation 13 | # Warns about functions called in if-conditions 14 | # enable=check-set-e-suppressed 15 | 16 | # Warn when uppercase variables are unassigned 17 | enable=check-unassigned-uppercase 18 | 19 | # Suggest 'command -v' instead of 'which' 20 | enable=deprecate-which 21 | -------------------------------------------------------------------------------- /dotfiles/ssh_config: -------------------------------------------------------------------------------- 1 | # This needs to be at the top so that included files 2 | # have priority over the defaults below 3 | Include ~/.ssh/config.d/*.conf 4 | 5 | Host github.com 6 | User git 7 | 8 | Host bitbucket.org 9 | User git 10 | IdentityFile ~/.ssh/id_ed25519 11 | # BitBucket seems to have disabled connection sharing :/ 12 | ControlMaster no 13 | HostKeyAlgorithms +ssh-rsa 14 | 15 | Host ssh.dev.azure.com vs-ssh.visualstudio.com 16 | HostKeyAlgorithms +rsa-sha2-512 17 | 18 | Host console.gandi.net 19 | KexAlgorithms +diffie-hellman-group14-sha1 20 | 21 | Host * 22 | AddKeysToAgent yes 23 | Ciphers -3des-cbc,arcfour*,blowfish-cbc,cast128-cbc 24 | Compression yes 25 | ControlMaster auto 26 | ControlPath ~/.ssh/sock/%r@%h:%p 27 | ControlPersist 180 28 | EnableEscapeCommandline yes 29 | ForwardAgent no 30 | ForwardX11 no 31 | HostKeyAlgorithms -*ecdsa*,*nist*,rsa-* 32 | IdentitiesOnly yes 33 | # IdentityFile ~/.ssh/id_rsa 34 | KexAlgorithms -*nist*,diffie-hellman-*-sha1 35 | LocalCommand echo -e "\e]0;%h\e\\" 36 | MACs -*-md5,*-md5-*,*-sha1,*-sha1-*,umac-64* 37 | PermitLocalCommand no 38 | ServerAliveCountMax 3 39 | ServerAliveInterval 30 40 | TCPKeepAlive yes 41 | 42 | # https://stribika.github.io/2015/01/04/secure-secure-shell.html 43 | # https://infosec.mozilla.org/guidelines/openssh.html 44 | # vim: ft=sshconfig 45 | -------------------------------------------------------------------------------- /dotfiles/sshrc/.sshrc.d/dircolors: -------------------------------------------------------------------------------- 1 | ../../shell-common/dircolors -------------------------------------------------------------------------------- /dotfiles/sshrc/.sshrc.d/get-machine-id: -------------------------------------------------------------------------------- 1 | ../../bin/get-machine-id -------------------------------------------------------------------------------- /dotfiles/sshrc/.sshrc.d/git/config: -------------------------------------------------------------------------------- 1 | [include] 2 | path = config.default 3 | 4 | [pager] 5 | diff = less -F 6 | log = less -F 7 | show = less -F 8 | 9 | [log] 10 | date = iso 11 | 12 | [pull] 13 | rebase = true 14 | 15 | # vim: filetype=gitconfig noexpandtab sw=8 sts=8 16 | -------------------------------------------------------------------------------- /dotfiles/sshrc/.sshrc.d/git/config.default: -------------------------------------------------------------------------------- 1 | ../../../git/config -------------------------------------------------------------------------------- /dotfiles/sshrc/.sshrc.d/inputrc: -------------------------------------------------------------------------------- 1 | ../../inputrc -------------------------------------------------------------------------------- /dotfiles/sshrc/.sshrc.d/lessfilter: -------------------------------------------------------------------------------- 1 | ../../less/lessfilter -------------------------------------------------------------------------------- /dotfiles/sshrc/.sshrc.d/lesskey: -------------------------------------------------------------------------------- 1 | #command 2 | h left-scroll 3 | l right-scroll 4 | ^L noaction ^R\eu 5 | [ prev-file 6 | ] next-file 7 | Q quit \1 8 | :cq quit \1 9 | D noaction j/\^((diff|commit|Date|From) )|((added|deleted|modified): )\n\eu 10 | ^s noaction /\^ 11 | V noaction g|$/usr/bin/vim -\n 12 | 13 | #line-edit 14 | ^A home 15 | ^E end 16 | ^F right 17 | ^B left 18 | ^D delete 19 | ^W word-backspace 20 | ^P up 21 | ^N down 22 | ^[ abort 23 | -------------------------------------------------------------------------------- /dotfiles/sshrc/.sshrc.d/tmux.conf: -------------------------------------------------------------------------------- 1 | set-option -sg set-clipboard on 2 | 3 | set-option -g activity-action none 4 | set-option -g base-index 1 5 | set-option -g bell-action current 6 | set-option -g renumber-windows on 7 | set-option -g visual-activity on 8 | set-option -g visual-bell off 9 | 10 | set-option -wg automatic-rename on 11 | set-option -wg aggressive-resize on 12 | set-option -wg monitor-activity on 13 | 14 | # statusline 15 | set-option -g status-justify centre 16 | set-option -g status-style "fg=default,bg=default" 17 | set-option -g status-interval 10 18 | set-option -g status-left-length 256 19 | set-option -g status-right-length 256 20 | set-option -g status-left "" 21 | set-option -ga status-left '#[fg=default,bg=default,bold,reverse]' 22 | set-option -ga status-left '#{?client_prefix,[Prefix],}' 23 | set-option -ga status-left '#{?pane_in_mode,[Copy],}' 24 | set-option -ga status-left '#{?pane_synchronized,[Sync],}' 25 | set-option -g status-right " #(bash --noprofile --norc $SSHRCD/tmux-status) #[fg=default,bold]#h:#S" 26 | set-option -wg window-status-style "fg=default,bg=default" 27 | set-option -wg window-status-current-style "fg=default,bg=default,reverse" 28 | set-option -wg window-status-bell-style "fg=red,bg=default" 29 | set-option -wg window-status-activity-style "fg=green,bg=default" 30 | set-option -wg window-status-format '#I:#{=15:window_name}#F' 31 | set-option -wg window-status-current-format '#I:#W#F' 32 | 33 | # Set prefix to ctrl-z 34 | unbind-key C-b 35 | set-option -g prefix C-z 36 | bind-key C-z send-prefix 37 | 38 | bind-key c new-window -c '#{pane_current_path}' 39 | bind-key b copy-mode \; send-keys -X start-of-line \; send-keys -X search-backward ' ' 40 | 41 | set-option -sga terminal-features "xterm-kitty:hyperlinks" 42 | -------------------------------------------------------------------------------- /dotfiles/sway/inactive-windows-transparency.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import signal 4 | import sys 5 | 6 | import i3ipc 7 | 8 | OPACITY = "0.7" 9 | 10 | 11 | def on_window_focus(ipc, event): 12 | global prev_focused 13 | 14 | focused_workspace = ipc.get_tree().find_focused() 15 | 16 | if focused_workspace is None: 17 | return 18 | 19 | focused = event.container 20 | 21 | if focused.id != prev_focused.id: # https://github.com/swaywm/sway/issues/2859 22 | focused.command("opacity 1") 23 | prev_focused.command("opacity " + OPACITY) 24 | prev_focused = focused 25 | 26 | 27 | def reset_opacity(ipc): 28 | for workspace in ipc.get_tree().workspaces(): 29 | for w in workspace: 30 | w.command("opacity 1") 31 | ipc.main_quit() 32 | sys.exit(0) 33 | 34 | 35 | if __name__ == "__main__": 36 | ipc = i3ipc.Connection() 37 | prev_focused = None 38 | 39 | for window in ipc.get_tree(): 40 | if window.focused: 41 | prev_focused = window 42 | else: 43 | window.command("opacity " + OPACITY) 44 | for sig in [signal.SIGINT, signal.SIGTERM]: 45 | signal.signal(sig, lambda signal, frame: reset_opacity(ipc)) 46 | ipc.on("window::focus", on_window_focus) 47 | ipc.main() 48 | -------------------------------------------------------------------------------- /dotfiles/systemd/daily-cleanup.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Daily cleanup 3 | OnFailure=status-mail@%n.service 4 | 5 | [Service] 6 | Type=oneshot 7 | ExecStart=bash ${DOTFILES}/bin/daily-cleanup 8 | 9 | [Install] 10 | WantedBy=daily.target 11 | -------------------------------------------------------------------------------- /dotfiles/systemd/daily.target: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Daily timer target 3 | StopWhenUnneeded=true 4 | -------------------------------------------------------------------------------- /dotfiles/systemd/daily.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Daily timer 3 | 4 | [Timer] 5 | OnCalendar=*-*-* 03:00:00 6 | Persistent=true 7 | Unit=daily.target 8 | 9 | [Install] 10 | WantedBy=timers.target 11 | -------------------------------------------------------------------------------- /dotfiles/systemd/status-mail@.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=status email for %i 3 | 4 | [Service] 5 | Type=oneshot 6 | ExecStart=bash ${DOTFILES}/bin/systemd-mail %u@%H %i 7 | -------------------------------------------------------------------------------- /dotfiles/systemd/weekly.target: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Weekly timer target 3 | StopWhenUnneeded=true 4 | -------------------------------------------------------------------------------- /dotfiles/systemd/weekly.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Weekly timer 3 | 4 | [Timer] 5 | OnCalendar=weekly 6 | Persistent=true 7 | Unit=weekly.target 8 | 9 | [Install] 10 | WantedBy=timers.target 11 | -------------------------------------------------------------------------------- /dotfiles/tmux/tmux-bind-root.conf: -------------------------------------------------------------------------------- 1 | bind-key -n M-> next-window 2 | bind-key -n M-< previous-window 3 | bind-key -n M-right next-window 4 | bind-key -n M-left previous-window 5 | bind-key -n C-right swap-window -d -t +1 6 | bind-key -n C-left swap-window -d -t -1 7 | 8 | # move around panes with hjkl, as one would in vim after pressing ctrl-w 9 | bind-key -n M-h run-shell "$DOTFILES/tmux/tmux-vim-select-pane -L" 10 | bind-key -n M-j run-shell "$DOTFILES/tmux/tmux-vim-select-pane -D" 11 | bind-key -n M-k run-shell "$DOTFILES/tmux/tmux-vim-select-pane -U" 12 | bind-key -n M-l run-shell "$DOTFILES/tmux/tmux-vim-select-pane -R" 13 | bind-key -n M-p run-shell "$DOTFILES/tmux/tmux-vim-select-pane -l" 14 | -------------------------------------------------------------------------------- /dotfiles/tmux/tmux-move-window: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | TARGETSESSION=$1 4 | 5 | tmux move-window -t ${TARGETSESSION}: 6 | tmux move-window -r 7 | tmux move-window -r -t ${TARGETSESSION}: 8 | -------------------------------------------------------------------------------- /dotfiles/tmux/tmux-move-window-new: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SOURCEWIN="$1" 4 | 5 | NUMSESSIONS=$(tmux list-sessions | wc -l) 6 | 7 | echo 'local awful = require("awful") awful.util.spawn("x-terminal-emulator")' | awesome-client 8 | 9 | while (( $(tmux list-sessions | wc -l) == NUMSESSIONS )); do 10 | sleep 0.1 11 | done 12 | 13 | NEWSESSION=$(tmux list-sessions -F '#{session_created} #{session_name}' | sort -n | tail -1 | awk '{ printf $2 }') 14 | 15 | tmux move-window -s "${SOURCEWIN}" -t ${NEWSESSION}: 16 | tmux kill-window -t ${NEWSESSION}:1 17 | tmux move-window -r 18 | tmux move-window -r -t ${NEWSESSION}: 19 | -------------------------------------------------------------------------------- /dotfiles/tmux/tmux-unbind-root.conf: -------------------------------------------------------------------------------- 1 | unbind-key -n M-. 2 | unbind-key -n M-, 3 | unbind-key -n M-right 4 | unbind-key -n M-left 5 | unbind-key -n C-right 6 | unbind-key -n C-left 7 | 8 | unbind-key -n M-h 9 | unbind-key -n M-j 10 | unbind-key -n M-k 11 | unbind-key -n M-l 12 | unbind-key -n M-p 13 | -------------------------------------------------------------------------------- /dotfiles/tmux/tmux-vim-select-pane: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Like 'tmux select-pane', but if Vim is running in the current pane it sends 3 | # a '' keystroke to Vim instead. 4 | 5 | title="$(tmux display -p '#{pane_title}')" 6 | 7 | if [[ "${title}" =~ ^n?vim.* ]]; then 8 | direction="$(echo "${1#-}" | tr 'lLDUR' 'phjkl')" 9 | # forward the keystroke to Vim 10 | tmux send-keys "M-$direction" 11 | else 12 | tmux select-pane "$@" 13 | fi 14 | 15 | exit 0 16 | -------------------------------------------------------------------------------- /dotfiles/vim/.gitignore: -------------------------------------------------------------------------------- 1 | abbrevs.vim 2 | systags 3 | .netrwhist 4 | cache 5 | spell 6 | GetLatest/Installed 7 | passwords.vim 8 | -------------------------------------------------------------------------------- /dotfiles/vim/UltiSnips/ant.snippets: -------------------------------------------------------------------------------- 1 | extends xml 2 | -------------------------------------------------------------------------------- /dotfiles/vim/UltiSnips/help.snippets: -------------------------------------------------------------------------------- 1 | # Snippets for VIM Help Files 2 | 3 | priority -20 4 | 5 | global !p 6 | def sec_title(snip, t): 7 | file_start = snip.fn.split('.')[0] 8 | sec_name = t[1].strip("1234567890. ").lower().replace(' ', '-') 9 | return ("*%s-%s*" % (file_start, sec_name)).rjust(78-len(t[1])) 10 | endglobal 11 | 12 | snippet sec "Section marker" b 13 | ============================================================================== 14 | ${1:SECTION}`!p snip.rv = sec_title(snip, t)` 15 | 16 | $0 17 | endsnippet 18 | 19 | snippet ssec "Sub section marker" b 20 | ${1:Subsection}`!p snip.rv = sec_title(snip, t) 21 | snip += "-"*len(t[1])` 22 | 23 | $0 24 | endsnippet 25 | 26 | snippet sssec "Subsub Section marker" b 27 | ${1:SubSubsection}:`!p snip.rv = sec_title(snip, t)` 28 | 29 | $0 30 | endsnippet 31 | 32 | # vim:ft=snippets: 33 | -------------------------------------------------------------------------------- /dotfiles/vim/UltiSnips/lua.snippets: -------------------------------------------------------------------------------- 1 | snippet fun 2 | function ${1:fname}(${2:...}) 3 | ${0:-- body} 4 | end 5 | endsnippet 6 | 7 | snippet for 8 | for ${1:i} = ${2:1}, ${3:10} do 9 | ${0:print(i)} 10 | end 11 | endsnippet 12 | 13 | snippet forp 14 | for ${1:i}, ${2:v} in pairs(${3:table_name}) do 15 | ${0:-- body} 16 | end 17 | endsnippet 18 | 19 | snippet fori 20 | for ${1:i}, ${2:v} in ipairs(${3:table_name}) do 21 | ${0:-- body} 22 | end 23 | endsnippet 24 | -------------------------------------------------------------------------------- /dotfiles/vim/UltiSnips/vim.snippets: -------------------------------------------------------------------------------- 1 | priority -20 2 | 3 | snippet if "if" 4 | if $1 5 | ${2:${VISUAL}} 6 | endif 7 | endsnippet 8 | 9 | snippet for "for" 10 | for $1 in $2 11 | ${3:${VISUAL}} 12 | endfor 13 | endsnippet 14 | 15 | snippet fun "function" 16 | function! ${1:`!v expand('%') =~ 'autoload' ? substitute(matchstr(expand('%:p'),'autoload/\zs.*\ze.vim'),'[/\\]','#','g').'#' : ''`}${2:function_name}(${3}) abort 17 | ${0:${VISUAL:" body}} 18 | endfunction 19 | endsnippet 20 | 21 | snippet mfun "member function" 22 | function! ${1:function_name}(${2}) dict abort 23 | ${0:${VISUAL:" body}} 24 | endfunction 25 | endsnippet 26 | -------------------------------------------------------------------------------- /dotfiles/vim/UltiSnips/xml.snippets: -------------------------------------------------------------------------------- 1 | priority -20 2 | 3 | snippet xml "XML declaration" b 4 | 5 | 6 | endsnippet 7 | 8 | snippet t "Simple tag" b 9 | <${1:tag}> 10 | ${2:${VISUAL}} 11 | 12 | endsnippet 13 | 14 | snippet ti "Inline tag" b 15 | <${1:tag}>${2:${VISUAL}} 16 | endsnippet 17 | 18 | snippet c "Comment" 19 | 20 | endsnippet 21 | -------------------------------------------------------------------------------- /dotfiles/vim/UltiSnips/xsd.snippets: -------------------------------------------------------------------------------- 1 | extends xml 2 | -------------------------------------------------------------------------------- /dotfiles/vim/UltiSnips/zsh.snippets: -------------------------------------------------------------------------------- 1 | priority -20 2 | 3 | extends sh 4 | 5 | priority -10 6 | 7 | snippet #! "shebang" b 8 | #!/bin/zsh 9 | 10 | endsnippet 11 | 12 | snippet !env "#!/usr/bin/env" b 13 | #!/usr/bin/env zsh 14 | 15 | endsnippet 16 | 17 | # vim:ft=snippets: 18 | -------------------------------------------------------------------------------- /dotfiles/vim/after/ftplugin/help.vim: -------------------------------------------------------------------------------- 1 | " -- help editing settings 2 | " Author : Jan Larres 3 | " Website : http://majutsushi.net 4 | " Created : 2012-01-14 17:30:52 +1300 NZDT 5 | " Last changed : 2012-01-14 17:30:52 +1300 NZDT 6 | 7 | " disable concealing when editing help files 8 | if has('conceal') && &buftype != 'help' 9 | setlocal conceallevel=0 10 | endif 11 | -------------------------------------------------------------------------------- /dotfiles/vim/after/ftplugin/xdefaults.vim: -------------------------------------------------------------------------------- 1 | " Author : Jan Larres 2 | " Website : http://majutsushi.net 3 | " Created : 2012-03-29 23:54:15 +1300 NZDT 4 | " Last changed : 2012-03-29 23:54:15 +1300 NZDT 5 | 6 | setlocal commentstring=!%s 7 | -------------------------------------------------------------------------------- /dotfiles/vim/after/plugin/syntaxcomplete.vim: -------------------------------------------------------------------------------- 1 | if has("autocmd") && exists("+omnifunc") 2 | augroup syntaxcomplete 3 | au Filetype * 4 | \ if &omnifunc == "" | 5 | \ setl omnifunc=syntaxcomplete#Complete | 6 | \ endif 7 | augroup END 8 | endif 9 | -------------------------------------------------------------------------------- /dotfiles/vim/bundles/templates/ftdetect/template.vim: -------------------------------------------------------------------------------- 1 | augroup filetypedetect 2 | autocmd BufNewFile,BufReadPost *.template set filetype=template 3 | augroup END 4 | -------------------------------------------------------------------------------- /dotfiles/vim/bundles/templates/plugin/templates.vim: -------------------------------------------------------------------------------- 1 | " Author: Jan Larres 2 | " License: MIT/X11 3 | " 4 | " Syntax (Django/Jinja-like): 5 | " {% ex command %} 6 | " {%+ ex command %} Dont' remove leading whitespace 7 | " {% ex command +%} Dont' remove trailing whitespace 8 | " {{ expression }} At least one space around the expression is mandatory. 9 | " Variables have to be script-local (s:foo) variables. 10 | " Variables starting with '__' are reserved. 11 | 12 | if &compatible || exists("g:loaded_templates") 13 | finish 14 | endif 15 | let g:loaded_templates = 1 16 | 17 | function! s:load_template() abort 18 | if &filetype == '' 19 | return 20 | endif 21 | 22 | let defaults = split(globpath(&runtimepath, 'templates/' . &filetype . '.template'), '\n') 23 | 24 | if empty(defaults) 25 | return 26 | endif 27 | 28 | silent! execute 'keepalt 0read ' . defaults[0] 29 | 30 | let report_save = &report 31 | set report=99999 32 | 33 | try 34 | %substitute/\(\s*\){%\(\S*\)\_s\+\(\_.\{-}\)\_s*\(\S*\)%}\(\s*\n\?\)/\=s:exec(submatch(1), submatch(2), submatch(3), submatch(4), submatch(5))/ge 35 | %substitute/{{\s\+\(.\{-}\)\s\+}}/\=eval(submatch(1))/ge 36 | finally 37 | let &report = report_save 38 | endtry 39 | set nomodified 40 | 41 | " Remove template variables from the script namespace 42 | call filter(s:, 'v:key =~# "^__"') 43 | 44 | normal! G 45 | endfunction 46 | 47 | function! s:exec(prews, preflags, cmd, postflags, postws) abort 48 | execute a:cmd 49 | 50 | return (a:preflags !~# '+' ? '' : a:prews) . (a:postflags !~# '+' ? '' : a:postws) 51 | endfunction 52 | 53 | augroup templates 54 | autocmd! 55 | autocmd FileType * if line('$') == 1 && getline(1) == '' | call s:load_template() | endif 56 | augroup END 57 | -------------------------------------------------------------------------------- /dotfiles/vim/bundles/templates/syntax/template.vim: -------------------------------------------------------------------------------- 1 | " Author: Jan Larres 2 | " License: MIT/X11 3 | 4 | " Quit when a syntax file was already loaded {{{2 5 | if exists("b:current_syntax") 6 | finish 7 | endif 8 | let s:keepcpo = &cpo 9 | set cpo&vim 10 | 11 | syntax include @vim syntax/vim.vim 12 | 13 | syntax region templateCmd start=/{%+\?/hs=s+2 keepend end=/+\?%}/me=s-1 contains=@vim,templateCmdTag 14 | syntax match templateCmdTag /{%+\?/ contained 15 | syntax match templateCmdTag /+\?%}/ 16 | 17 | syntax region templateExpr start=/{{\s/hs=s+3 keepend end=/\s}}/me=s-1 contains=@vim,templateExprTag 18 | syntax match templateExprTag /{{\ze\s/ contained 19 | syntax match templateExprTag /\s\zs}}/ 20 | 21 | highlight default link templateCmdTag Statement 22 | highlight default link templateExprTag Identifier 23 | 24 | let b:current_syntax = "template" 25 | 26 | let &cpo = s:keepcpo 27 | unlet s:keepcpo 28 | -------------------------------------------------------------------------------- /dotfiles/vim/bundles/templates/templates/python.template: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # Author: Jan Larres 3 | # License: MIT/X11 4 | # 5 | # /// script 6 | # requires-python = ">=3.11" 7 | # dependencies = [ 8 | # "requests<3", 9 | # "rich", 10 | # ] 11 | # /// 12 | 13 | import argparse 14 | import fileinput 15 | from importlib.util import find_spec 16 | import logging 17 | import sys 18 | 19 | logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.INFO) 20 | log = logging.getLogger(__name__) 21 | 22 | if find_spec('better_exceptions'): 23 | import better_exceptions # pylint: disable=unused-import 24 | 25 | 26 | def main(args: argparse.Namespace) -> int: 27 | if args.verbose: 28 | log.setLevel(logging.DEBUG) 29 | 30 | log.info(args.echo) 31 | 32 | # for line in fileinput.input(): 33 | # pass 34 | 35 | return 0 36 | 37 | 38 | def parse_args() -> argparse.Namespace: 39 | parser = argparse.ArgumentParser(description="TODO") # TODO 40 | parser.add_argument("echo", help="echo the string you use here") 41 | parser.add_argument( 42 | "-v", 43 | "--verbose", 44 | action="store_true", 45 | default=False, 46 | help="increase output verbosity", 47 | ) 48 | return parser.parse_args() 49 | 50 | 51 | if __name__ == "__main__": 52 | sys.exit(main(parse_args())) 53 | -------------------------------------------------------------------------------- /dotfiles/vim/bundles/templates/templates/sh.template: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Author: {{ g:user_name }} <{{ g:user_email }}> 3 | # Created: {{ strftime('%Y-%m-%d %H:%M:%S %z %Z') }} 4 | # Last changed: {{ strftime('%Y-%m-%d %H:%M:%S %z %Z') }} 5 | 6 | set -eEu -o pipefail 7 | shopt -s inherit_errexit 8 | IFS=$'\n\t' 9 | PS4='+\t ' 10 | 11 | error_handler() { echo "Error: Line ${1} exited with status ${2}"; } 12 | trap 'error_handler ${LINENO} $?' ERR 13 | 14 | [[ "${TRACE:-0}" == "1" ]] && set -x 15 | -------------------------------------------------------------------------------- /dotfiles/vim/bundles/templates/templates/vim.template: -------------------------------------------------------------------------------- 1 | {% let s:fname = substitute(fnamemodify(expand('%'), ':t:r'), '\W', '_', 'g') %} 2 | " Author: {{ g:user_name }} <{{ g:user_email }}> 3 | " License: MIT/X11 4 | 5 | if &compatible || exists('g:loaded_{{ s:fname }}') 6 | finish 7 | endif 8 | let g:loaded_{{ s:fname }} = 1 9 | -------------------------------------------------------------------------------- /dotfiles/vim/bundles/vimflowy/ftdetect/vf.vim: -------------------------------------------------------------------------------- 1 | autocmd filetypedetect BufNewFile,BufReadPost *.vf setfiletype vf 2 | -------------------------------------------------------------------------------- /dotfiles/vim/bundles/vimflowy/syntax/vf.vim: -------------------------------------------------------------------------------- 1 | if exists("b:current_syntax") 2 | finish 3 | endif 4 | 5 | let s:cpo_save = &cpo 6 | set cpo&vim 7 | 8 | 9 | syntax match vfBullet "^ *\zs\*" 10 | syntax match vfNote "^ *[^ *-].*" 11 | syntax match vfHashtag "#\w\+" 12 | syntax match vfAttag "@\w\+" 13 | 14 | syntax match vfBold "\*\w\+\*" 15 | syntax match vfItalic "/\w\+/" 16 | 17 | syntax region vfDone start='^\z(\s*\)-' skip='\z1\s' end='^\z1\ze\S'me=s-1 end='^\z1\@!' contains=vfDoneFirstLine 18 | syntax match vfDoneFirstLine "^ *- \zs.*" contained 19 | 20 | highlight default vfDone guifg=#999999 ctermfg=247 21 | highlight default vfDoneFirstLine guifg=#999999 gui=strikethrough ctermfg=247 term=strikethrough 22 | highlight default vfNote guifg=#bbbbbb ctermfg=250 23 | 24 | highlight default vfBold gui=bold term=bold cterm=bold 25 | highlight default vfItalic gui=italic term=italic cterm=italic 26 | 27 | highlight default link vfBullet Keyword 28 | highlight default link vfHashtag Identifier 29 | highlight default link vfAttag Identifier 30 | 31 | 32 | let b:current_syntax = "vf" 33 | 34 | let &cpo = s:cpo_save 35 | unlet s:cpo_save 36 | -------------------------------------------------------------------------------- /dotfiles/vim/bundles/vimoutliner/LICENSE: -------------------------------------------------------------------------------- 1 | LICENSE 2 | 3 | VimOutliner 4 | Copyright (C) 2001, 2003 by Steve Litt 5 | Copyright (C) 2004 by Noel Henson 6 | Licensed under the GNU General Public License (GPL), version 2 7 | Absolutely no warranty. 8 | 9 | If your distro doesn't come with this file 10 | HTML: http://www.gnu.org/copyleft/gpl.html 11 | Text: http://www.gnu.org/copyleft/gpl.txt 12 | -------------------------------------------------------------------------------- /dotfiles/vim/bundles/vimoutliner/ftdetect/otl.vim: -------------------------------------------------------------------------------- 1 | "# ####################################################################### 2 | "# filetype.vim: filetype loader 3 | "# VimOutliner functions, commands and settings, version 0.2.0 4 | "# Copyright (C) 2001,2003 by Steve Litt (slitt@troubleshooters.com) 5 | "# 6 | "# This program is free software; you can redistribute it and/or modify 7 | "# it under the terms of the GNU General Public License as published by 8 | "# the Free Software Foundation; either version 2 of the License, or 9 | "# (at your option) any later version. 10 | "# 11 | "# This program is distributed in the hope that it will be useful, 12 | "# but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | "# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | "# GNU General Public License for more details. 15 | "# 16 | "# You should have received a copy of the GNU General Public License 17 | "# along with this program; if not, write to the Free Software 18 | "# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | "# 20 | "# Steve Litt, slitt@troubleshooters.com, http://www.troubleshooters.com 21 | "# ####################################################################### 22 | 23 | au BufRead,BufNewFile *.otl setfiletype otl 24 | -------------------------------------------------------------------------------- /dotfiles/vim/filetype.vim: -------------------------------------------------------------------------------- 1 | " set filetypes 2 | if exists("did_load_filetypes") 3 | finish 4 | endif 5 | 6 | augroup filetypedetect 7 | " autocmd BufNewFile,BufReadPost *.json setfiletype jsonc 8 | autocmd BufNewFile,BufReadPost *.rhtml setfiletype eruby 9 | autocmd BufNewFile,BufReadPost *.rbx setfiletype ruby 10 | autocmd BufNewFile,BufReadPost *.viki setfiletype viki 11 | autocmd BufNewFile,BufReadPost *.mips setfiletype mips 12 | autocmd BufNewFile,BufReadPost *.tt2 setfiletype tt2 13 | autocmd BufNewFile,BufReadPost *.gnuplot setfiletype gnuplot 14 | autocmd BufNewFile,BufReadPost *.gle setfiletype gle 15 | autocmd BufNewFile,BufReadPost *.otl.gpg setfiletype vo_base 16 | autocmd BufNewFile,BufReadPost {.,}tmux.conf setfiletype tmux 17 | autocmd BufNewFile,BufReadPost sgc*.dat setfiletype xml 18 | autocmd BufNewFile,BufReadPost *.adoc,*.asciidoc setfiletype asciidoc 19 | autocmd BufNewFile,BufReadPost *.vala,*.vapi setfiletype vala 20 | autocmd BufNewFile,BufReadPost *.confluence setfiletype confluencewiki 21 | autocmd BufNewFile,BufReadPost *.sieve setfiletype sieve 22 | autocmd BufNewFile,BufReadPost *.jobdsl setfiletype groovy 23 | autocmd BufNewFile,BufReadPost Dockerfile.*,*.Dockerfile setfiletype dockerfile 24 | augroup END 25 | -------------------------------------------------------------------------------- /dotfiles/vim/ftplugin/c/if0comment.vim: -------------------------------------------------------------------------------- 1 | " Comment out code with #if 0/#endif 2 | " Based on http://www.vim.org/scripts/script.php?script_id=637 3 | 4 | xnoremap c :call If0comment() 5 | nnoremap c :call If0uncomment() 6 | 7 | function! If0comment() range 8 | call append((a:firstline - 1), "#if 0") 9 | call append(a:lastline + 1, "#endif") 10 | endfunction 11 | 12 | function! If0uncomment() 13 | let start = search('^#if 0', 'bcnW', 1) 14 | if start == 0 15 | echo 'No valid comment block found' 16 | return 17 | endif 18 | 19 | execute start . 'd' 20 | let emb = 0 21 | for linenr in range(start + 1, line('$')) 22 | let line = getline(linenr) 23 | 24 | if line =~ '^#if' 25 | let emb += 1 26 | elseif line =~ '^#else' 27 | if emb == 0 28 | " not an embedded else so turn else into an #if 0 to match 29 | " following #endif 30 | let newline = substitute(line, '^#else', '#if 0', '') 31 | call setline(linenr, newline) 32 | break 33 | endif 34 | elseif line =~ '^#endif' 35 | if emb > 0 36 | let emb -= 1 37 | else 38 | " found matching endif; remove it 39 | execute linenr . 'd' 40 | break 41 | endif 42 | endif 43 | endfor 44 | endfunction 45 | 46 | " vim: ts=4 sts=4 sw=4 et 47 | -------------------------------------------------------------------------------- /dotfiles/vim/ftplugin/c/misc.vim: -------------------------------------------------------------------------------- 1 | " Author : Jan Larres 2 | " Website : http://majutsushi.net 3 | 4 | setlocal foldmethod=syntax 5 | -------------------------------------------------------------------------------- /dotfiles/vim/ftplugin/desktop.vim: -------------------------------------------------------------------------------- 1 | " desktop.vim -- .desktop file settings 2 | " Author : Jan Larres 3 | " Website : http://majutsushi.net 4 | " Created : 2012-07-07 15:36:19 +1200 NZST 5 | " Last changed : 2012-07-07 15:36:19 +1200 NZST 6 | 7 | autocmd BufWritePost silent !update-desktop-database ~/.local/share/applications 8 | -------------------------------------------------------------------------------- /dotfiles/vim/ftplugin/help.vim: -------------------------------------------------------------------------------- 1 | if &buftype == 'help' 2 | " Set custom statusline 3 | let b:stl = "#[Branch] HELP " 4 | let b:stl .= "#[FileName] %<%t " 5 | let b:stl .= "#[FunctionName] " 6 | let b:stl .= "%=" 7 | let b:stl .= "%(#[Warning]%{get(g:, 'zoomwin_zoomed', 0) ? 'Z' : ''}%)" 8 | let b:stl .= "#[LinePercent] %p%%" 9 | 10 | nnoremap " Space selects subject 11 | nnoremap " Backspace to go back 12 | nnoremap q :q 13 | endif 14 | -------------------------------------------------------------------------------- /dotfiles/vim/ftplugin/jproperties.vim: -------------------------------------------------------------------------------- 1 | " Author : Jan Larres 2 | " Website : http://majutsushi.net 3 | 4 | setlocal commentstring=#%s 5 | -------------------------------------------------------------------------------- /dotfiles/vim/ftplugin/markdown.vim: -------------------------------------------------------------------------------- 1 | " Author : Jan Larres 2 | " Website : http://majutsushi.net 3 | " Created : 2012-03-15 02:10:51 +1300 NZDT 4 | " Last changed : 2012-03-20 22:21:15 +1300 NZDT 5 | 6 | setlocal equalprg=pandoc\ -t\ markdown 7 | -------------------------------------------------------------------------------- /dotfiles/vim/ftplugin/nerdtree.vim: -------------------------------------------------------------------------------- 1 | " Move up a directory using "-" like vim-vinegar (usually "u" does this). 2 | nmap - g:NERDTreeMapUpdir 3 | -------------------------------------------------------------------------------- /dotfiles/vim/ftplugin/python/custom.vim: -------------------------------------------------------------------------------- 1 | " Author : Jan Larres 2 | 3 | "setlocal foldmethod=indent 4 | setlocal omnifunc=pythoncomplete#Complete 5 | 6 | "setlocal makeprg=python2.6\ -c\ \"import\ py_compile,sys;\ sys.stderr=sys.stdout;\ py_compile.compile(r'%')\" 7 | setlocal makeprg=python3\ % 8 | setlocal efm=%C\ %.%#,%A\ \ File\ \"%f\"\\,\ line\ %l%.%#,%Z%[%^\ ]%\\@=%m 9 | 10 | "map e :!python2.6 % 11 | 12 | nnoremap :YcmCompleter GoTo 13 | 14 | if has("python3") 15 | python3 << EOF 16 | import os 17 | import sys 18 | import vim 19 | for p in sys.path: 20 | if os.path.isdir(p): 21 | vim.command(r"setlocal path+=%s" % (p.replace(" ", r"\ "))) 22 | EOF 23 | endif 24 | -------------------------------------------------------------------------------- /dotfiles/vim/ftplugin/qf.vim: -------------------------------------------------------------------------------- 1 | " Author : Jan Larres 2 | " Website : http://majutsushi.net 3 | 4 | let b:stl = "#[FileName]%t #[FileType]%{exists('w:quickfix_title') ? ' ' . w:quickfix_title : ''} #[FunctionName]%=#[LineNumber] %04(%l%)#[LineColumn]:%03(%c%V%) #[LinePercent] %p%%" 5 | 6 | nnoremap p p 7 | 8 | setlocal nocursorline 9 | 10 | " Folding of (gnu)make output. 11 | setlocal foldmethod=marker 12 | setlocal foldmarker=Entering\ directory,Leaving\ directory 13 | nnoremap zq zM:g/error:/normal zv 14 | nnoremap zw zq:g/warning:/normal zv 15 | nnoremap q :call qftoggle#toggle() 16 | 17 | " normal zq 18 | -------------------------------------------------------------------------------- /dotfiles/vim/ftplugin/tex.vim: -------------------------------------------------------------------------------- 1 | " Author : Jan Larres 2 | " Website : http://majutsushi.net 3 | 4 | setlocal foldmethod=expr 5 | setlocal foldexpr=LatexFold(v:lnum) 6 | 7 | let b:pairs_parens = "(:),[:],{:},`:'" 8 | let b:pairs_quotes = "\"'" 9 | 10 | let b:chapter_present = search('^\\chapter{', 'cnw') 11 | autocmd BufWritePost let b:chapter_present = search('^\\chapter{', 'cnw') 12 | 13 | function! LatexFold(lnum) 14 | if b:chapter_present > 0 15 | let base = 2 16 | else 17 | let base = 1 18 | endif 19 | 20 | let line = getline(a:lnum) 21 | 22 | if line =~ '^\\chapter{.\+}' 23 | return '>1' 24 | elseif line =~ '^\\section{.\+}' 25 | return '>' . base 26 | elseif line =~ '^\\subsection{.\+}' 27 | return '>' . string(base + 1) 28 | elseif line =~ '^\\subsubsection{.\+}' 29 | return '>' . string(base + 2) 30 | elseif line =~ '\\begin{.\+}' 31 | return 'a1' 32 | elseif line =~ '\\end{.\+}' 33 | return 's1' 34 | endif 35 | 36 | return '=' 37 | endfunction 38 | 39 | " Reformat lines (getting the spacing correct) 40 | function! s:TeX_format() 41 | if getline('.') == '' 42 | return 43 | endif 44 | 45 | let cursor_save = getpos('.') 46 | let wrapscan_save = &wrapscan 47 | set nowrapscan 48 | 49 | let par_begin = '^\(%D\)\=\s*\($\|\\begin\|\\end\|\\[\|\\]\|\\\(sub\)*section\>\|\\item\>\|\\NC\>\|\\blank\>\|\\noindent\>\)' 50 | let par_end = '^\(%D\)\=\s*\($\|\\begin\|\\end\|\\[\|\\]\|\\\(sub\)*section\>\|\\item\>\|\\NC\>\|\\blank\>\|\\place\)' 51 | 52 | try 53 | execute '?' . par_begin . '?+' 54 | catch /E384/ 55 | 1 56 | endtry 57 | 58 | normal! V 59 | 60 | try 61 | execute '/' . par_end . '/-' 62 | catch /E385/ 63 | $ 64 | endtry 65 | 66 | normal! gq 67 | 68 | let &wrapscan = wrapscan_save 69 | call setpos('.', cursor_save) 70 | endfunction 71 | 72 | nnoremap Q :call TeX_format() 73 | 74 | inoremap [[ \begin{ 75 | imap ]] LatexCloseCurEnv 76 | -------------------------------------------------------------------------------- /dotfiles/vim/ftplugin/vala.vim: -------------------------------------------------------------------------------- 1 | " Author: Jan Larres 2 | " License: MIT/X11 3 | 4 | setlocal commentstring=//%s 5 | setlocal errorformat=%f:%l.%c-%[%^:]%#:\ %t%[%^:]%#:\ %m 6 | 7 | " Disable valadoc syntax highlight 8 | " let g:vala_ignore_valadoc = 1 9 | 10 | " Enable comment strings 11 | " let g:vala_comment_strings = 1 12 | 13 | " Highlight space errors 14 | let g:vala_space_errors = 1 15 | " Disable trailing space errors 16 | " let g:vala_no_trail_space_error = 1 17 | " Disable space-tab-space errors 18 | " let g:vala_no_tab_space_error = 1 19 | 20 | " Minimum lines used for comment syncing (default 50) 21 | " let g:vala_minlines = 120 22 | -------------------------------------------------------------------------------- /dotfiles/vim/ftplugin/xdefaults.vim: -------------------------------------------------------------------------------- 1 | " xdefaults.vim -- Handle X resources reloading 2 | " Author : Jan Larres 3 | " Created : 2012-02-21 17:11:48 +1300 NZDT 4 | " Last changed : 2012-02-21 18:01:07 +1300 NZDT 5 | 6 | " s:prewrite() {{{1 7 | " Save all resources that were not specified in the file to a temporary file 8 | " so they can be restored later 9 | function! s:prewrite(fname) 10 | let output = system('xrdb -query') 11 | let curvalues = split(output, '\n\+') 12 | let oldfilevals = readfile(a:fname) 13 | 14 | let unknownvals = [] 15 | 16 | for val in curvalues 17 | let key = split(val, ':')[0] 18 | if match(oldfilevals, '\V\^' . key . ':') == -1 19 | let unknownvals += [val] 20 | endif 21 | endfor 22 | 23 | let s:unknownstmpfile = tempname() 24 | 25 | execute 'redir! > ' . s:unknownstmpfile 26 | for val in unknownvals 27 | echo val 28 | endfor 29 | redir END 30 | endfunction 31 | 32 | " postwrite() {{{1 33 | " First load the resources that didn't come from the old version of the file 34 | " and then merge in the values from the new version of the file 35 | function! s:postwrite(fname) 36 | let output = system('xrdb -load ' . s:unknownstmpfile) 37 | 38 | if v:shell_error 39 | echoerr output 40 | return 41 | endif 42 | 43 | let output = system('xrdb -merge ' . a:fname) 44 | 45 | if v:shell_error 46 | echoerr output 47 | endif 48 | endfunction 49 | 50 | autocmd BufWritePre silent call s:prewrite(expand('')) 51 | autocmd BufWritePost silent call s:postwrite(expand('')) 52 | -------------------------------------------------------------------------------- /dotfiles/vim/ftplugin/yaml.vim: -------------------------------------------------------------------------------- 1 | " Author: Jan Larres 2 | " License: MIT/X11 3 | 4 | if &compatible || exists('g:loaded_yaml') 5 | finish 6 | endif 7 | let g:loaded_yaml = 1 8 | 9 | 10 | function! YamlFolds() 11 | let previous_level = indent(prevnonblank(v:lnum - 1)) / &shiftwidth 12 | let current_level = indent(v:lnum) / &shiftwidth 13 | let next_level = indent(nextnonblank(v:lnum + 1)) / &shiftwidth 14 | 15 | if getline(v:lnum) =~ '^\s*$' 16 | return "=" 17 | elseif current_level < next_level 18 | return next_level 19 | elseif current_level > next_level 20 | return ('s' . (current_level - next_level)) 21 | elseif current_level == previous_level 22 | return "=" 23 | endif 24 | 25 | return next_level 26 | endfunction 27 | 28 | setlocal foldmethod=expr 29 | setlocal foldexpr=YamlFolds() 30 | 31 | let b:undo_ftplugin = 32 | \ exists('b:undo_ftplugin') 33 | \ ? b:undo_ftplugin . ' | ' 34 | \ : '' 35 | \ . 'setlocal foldexpr< foldmethod< foldtext<' 36 | -------------------------------------------------------------------------------- /dotfiles/vim/indent/c.vim: -------------------------------------------------------------------------------- 1 | " Author : Jan Larres 2 | " Website : http://majutsushi.net 3 | " Created : 2011-03-16 15:12:16 +1300 NZDT 4 | " Last changed : 2011-03-16 15:12:16 +1300 NZDT 5 | 6 | setlocal cinoptions+=t0,(0,u0,U1,Ws,m1,)50 7 | -------------------------------------------------------------------------------- /dotfiles/vim/indent/cpp.vim: -------------------------------------------------------------------------------- 1 | " Author : Jan Larres 2 | " Website : http://majutsushi.net 3 | " Created : 2011-03-16 12:53:01 +1300 NZDT 4 | " Last changed : 2011-03-16 15:14:02 +1300 NZDT 5 | 6 | runtime! indent/c.vim 7 | 8 | setlocal cinoptions+=g0 9 | -------------------------------------------------------------------------------- /dotfiles/vim/init.vim: -------------------------------------------------------------------------------- 1 | vimrc -------------------------------------------------------------------------------- /dotfiles/vim/plugin/foldsearch.vim: -------------------------------------------------------------------------------- 1 | " Author: Jan Larres 2 | " License: MIT/X11 3 | " Original code from 4 | " https://github.com/jszakmeister/vimfiles/blob/master/vimrc 5 | 6 | if &compatible || exists('g:loaded_foldsearch') 7 | finish 8 | endif 9 | let g:loaded_foldsearch = 1 10 | 11 | let w:foldsearch_folded = 0 12 | 13 | function s:sid() abort 14 | return matchstr(expand(''), '\zs\d\+_\zeSID$') 15 | endfun 16 | 17 | function! s:fold_show_expr() abort 18 | return (getline(v:lnum) =~# @/) ? 0 : 1 19 | endfunction 20 | 21 | function! s:fold_hide_expr() abort 22 | return (getline(v:lnum) =~# @/) ? 1 : 0 23 | endfunction 24 | 25 | function! s:fold_regex(func, regex) abort 26 | if a:regex != '' 27 | let @/ = a:regex 28 | call histadd('search', a:regex) 29 | endif 30 | 31 | " Save current settings 32 | let w:foldsearch_foldexpr = &foldexpr 33 | let w:foldsearch_foldmethod = &foldmethod 34 | let w:foldsearch_foldlevel = &foldlevel 35 | let w:foldsearch_foldminlines = &foldminlines 36 | let w:foldsearch_foldenable = &foldenable 37 | 38 | let &foldexpr = s:sid() . a:func . '()' 39 | 40 | setlocal foldmethod=expr 41 | setlocal foldlevel=0 42 | setlocal foldminlines=0 43 | setlocal foldenable 44 | 45 | " Set manual folding to allow more fold tweaking 46 | setlocal foldmethod=manual 47 | 48 | let w:foldsearch_folded = 1 49 | endfunction 50 | 51 | function! s:fold_restore() abort 52 | if !w:foldsearch_folded 53 | echo 'No fold command active; nothing to restore' 54 | return 55 | endif 56 | 57 | let &foldexpr = w:foldsearch_foldexpr 58 | let &foldmethod = w:foldsearch_foldmethod 59 | let &foldlevel = w:foldsearch_foldlevel 60 | let &foldminlines = w:foldsearch_foldminlines 61 | let &foldenable = w:foldsearch_foldenable 62 | 63 | let w:foldsearch_folded = 0 64 | endfunction 65 | 66 | " Search (and "show") regex; fold everything else. 67 | command! -nargs=? Foldshow call s:fold_regex('fold_show_expr', ) 68 | 69 | " Fold matching lines ("hide" the matches). 70 | command! -nargs=? Foldhide call s:fold_regex('fold_hide_expr', ) 71 | 72 | " Fold away comment lines (including blank lines). 73 | " TODO: Extend for more than just shell comments. 74 | command! -nargs=0 Foldcomments Fold ^\s*#\|^\s*$ 75 | 76 | command! -nargs=0 Foldrestore call s:fold_restore() 77 | -------------------------------------------------------------------------------- /dotfiles/vim/plugin/footnotes.vim: -------------------------------------------------------------------------------- 1 | " Author : Jan Larres 2 | " Website : https://github.com/majutsushi/ 3 | " Based on http://vim.wikia.com/wiki/Make_footnotes_in_vim 4 | 5 | if exists("g:loaded_footnotes") 6 | finish 7 | endif 8 | let g:loaded_footnotes = 1 9 | 10 | let s:cpo_save = &cpo 11 | set cpo&vim 12 | 13 | imap f :call AddFootnote() 14 | 15 | function! s:AddFootnote() 16 | if exists('b:footnotenr') 17 | let b:footnotenr += 1 18 | let cr = "" 19 | else 20 | let b:footnotenr = 1 21 | let cr = "\" 22 | endif 23 | 24 | execute "normal! i[" . b:footnotenr . "]\" 25 | 26 | belowright 3split 27 | normal G 28 | if search("^-- $", "bW") 29 | if len(cr) == 0 30 | execute "normal! \" 31 | else 32 | execute "normal! O" 33 | endif 34 | execute "normal! O" . cr . " [" . b:footnotenr . "] " 35 | else 36 | execute "normal! o" . cr . " [" . b:footnotenr . "] " 37 | endif 38 | 39 | startinsert! 40 | endfunction 41 | 42 | let &cpo = s:cpo_save 43 | -------------------------------------------------------------------------------- /dotfiles/vim/plugin/gnuplot.vim: -------------------------------------------------------------------------------- 1 | " Execute Gnuplot on selection 2 | " Author: Jan Larres 3 | " Website: http://majutsushi.net 4 | 5 | let s:theme_default = expand('$DOTFILES/gnuplot/grey.gnuplot') 6 | 7 | if !exists('g:gnuplot_theme') && filereadable(s:theme_default) 8 | let g:gnuplot_theme = s:theme_default 9 | endif 10 | 11 | " s:gnuplot() {{{1 12 | function! s:gnuplot(args) range abort 13 | if a:args == '' 14 | let style = 'linespoints' 15 | else 16 | let style = a:args 17 | endif 18 | 19 | let datafile = tempname() 20 | 21 | if visualmode() ==# "\026" 22 | " Visual block mode 23 | 24 | let reg_save = @g 25 | 26 | normal! gv"gy 27 | execute 'redir! > ' . datafile 28 | echo @g 29 | redir END 30 | 31 | let @g = reg_save 32 | else 33 | call writefile(getbufline('%', a:firstline, a:lastline), datafile) 34 | endif 35 | 36 | let commandfile = tempname() 37 | 38 | execute 'redir! > ' . commandfile 39 | if exists('g:gnuplot_theme') 40 | echon "load '" . g:gnuplot_theme . "'\n" 41 | endif 42 | echon "plot('" . datafile . "') with " . style . "\n" 43 | redir END 44 | 45 | call s:exec_gnuplot(commandfile) 46 | 47 | call delete(datafile) 48 | call delete(commandfile) 49 | endfunction 50 | 51 | " s:exec_gnuplot() {{{1 52 | function! s:exec_gnuplot(commandfile) abort 53 | let output = system('gnuplot -p ' . a:commandfile) 54 | 55 | if v:shell_error 56 | echoerr output 57 | endif 58 | endfunction 59 | 60 | " Command {{{1 61 | command! -nargs=* -range=% Gnuplot silent ,call s:gnuplot() 62 | -------------------------------------------------------------------------------- /dotfiles/vim/plugin/hlcurword.vim: -------------------------------------------------------------------------------- 1 | " Author: Jan Larres 2 | " License: MIT/X11 3 | 4 | if &compatible || exists('g:loaded_hlcurword') 5 | finish 6 | endif 7 | let g:loaded_hlcurword = 1 8 | 9 | if !hlexists('CurWord') 10 | if &background == 'dark' 11 | highlight CurWord guibg=#555555 12 | else 13 | highlight CurWord guibg=#aaaaaa 14 | endif 15 | endif 16 | 17 | function! s:hlcurword() abort 18 | let word = expand('') 19 | 20 | " Safer to do this than save the id from matchadd() in case someone has 21 | " called clearmatches() 22 | let matches = filter(getmatches(), 'v:val.group == "CurWord"') 23 | for lastmatch in matches 24 | call matchdelete(lastmatch.id) 25 | endfor 26 | 27 | call matchadd('CurWord', '\V\<' . escape(word, '\') . '\>', -50) 28 | endfunction 29 | 30 | augroup HlCurWord 31 | autocmd CursorHold * call s:hlcurword() 32 | autocmd CursorHoldI * call s:hlcurword() 33 | augroup END 34 | -------------------------------------------------------------------------------- /dotfiles/vim/plugin/stl.vim: -------------------------------------------------------------------------------- 1 | " Author: Jan Larres 2 | " License: MIT/X11 3 | 4 | if &compatible || exists('g:loaded_stl') 5 | finish 6 | endif 7 | let g:loaded_stl = 1 8 | 9 | function! s:set_colours(colours) abort 10 | for name in keys(a:colours) 11 | let colours = {'c': a:colours[name][0], 'nc': a:colours[name][1]} 12 | let name = (name ==# 'NONE' ? '' : name) 13 | 14 | if exists("colours['c'][0]") 15 | exec 'hi StatusLine' . name . 16 | \ ' guibg=' . colours['c'][0] . 17 | \ ' guifg=' . colours['c'][1] . 18 | \ ' gui=' . colours['c'][2] . 19 | \ ' cterm=' . colours['c'][2] 20 | endif 21 | 22 | if exists("colours['nc'][0]") 23 | exec 'hi StatusLine' . name . 'NC' . 24 | \ ' guibg=' . colours['nc'][0] . 25 | \ ' guifg=' . colours['nc'][1] . 26 | \ ' gui=' . colours['nc'][2] . 27 | \ ' cterm=' . colours['nc'][2] 28 | endif 29 | endfor 30 | endfunction 31 | 32 | function! s:get_statuscolours(theme) abort 33 | let normalized = substitute(a:theme, '-', '_', 'g') 34 | if has_key(g:, normalized . '_statuscolours') 35 | return g:{normalized}_statuscolours 36 | else 37 | return {} 38 | endif 39 | endfunction 40 | 41 | augroup stl 42 | autocmd! 43 | autocmd ColorScheme * call s:set_colours(s:get_statuscolours(expand(''))) 44 | autocmd BufReadPost,CursorHold,BufWritePost * call stl#recompute_stl_ts() 45 | autocmd BufReadPost,CursorHold,BufWritePost * call stl#recompute_stl_ws() 46 | autocmd VimEnter,WinEnter,BufWinEnter,CursorHold * call stl#update() 47 | augroup END 48 | 49 | call s:set_colours(s:get_statuscolours(g:colors_name)) 50 | -------------------------------------------------------------------------------- /dotfiles/vim/plugin/syntax_info.vim: -------------------------------------------------------------------------------- 1 | " This is heavily modified from Dr. Chip's HiLinkTrace plugin. 2 | 3 | function! s:syntax_info() abort 4 | let curline = line('.') 5 | let curcol = col('.') 6 | 7 | let idlist = synstack(curline, curcol) 8 | if empty(idlist) 9 | echo 'No syntax found' 10 | return 11 | endif 12 | call map(idlist, 'synIDattr(v:val, "name")') 13 | let syntaxstack = join(idlist, ' -> ') 14 | 15 | let firstlink = synIDattr(synID(curline, curcol, 1), 'name') 16 | let translink = synIDattr(synID(curline, curcol, 0), 'name') 17 | let lastlink = synIDattr(synIDtrans(synID(curline, curcol, 1)), 'name') 18 | 19 | " if transparent link isn't the same as the top highlighting link, 20 | " then indicate it with a leading 'T:' 21 | if firstlink != translink && firstlink != '' 22 | let hilink = 'T:' . translink . ' -> ' . firstlink 23 | elseif firstlink != translink 24 | let hilink = 'T:' . translink 25 | else 26 | let hilink = firstlink 27 | endif 28 | 29 | redir => hi_out 30 | silent! highlight 31 | redir END 32 | 33 | " trace through the linkages 34 | if firstlink != lastlink && firstlink != '' 35 | let no_overflow = 0 36 | let curlink = firstlink 37 | while curlink != lastlink && no_overflow < 10 38 | let nextlink = substitute(hi_out, '^.*\<' . curlink . '\s\+xxx links to \([A-Za-z_]\+\).*$', '\1', '') 39 | if nextlink =~ '\ ' . nextlink 42 | break 43 | endif 44 | let hilink = hilink . ' -> ' . nextlink 45 | let curlink = nextlink 46 | let no_overflow += 1 47 | endwhile 48 | endif 49 | 50 | echo 'Synstack: ' syntaxstack 51 | echo 'Highlighting:' hilink 52 | if lastlink != '' 53 | execute 'highlight ' . lastlink 54 | endif 55 | endfunction 56 | 57 | nnoremap sy :call syntax_info() 58 | -------------------------------------------------------------------------------- /dotfiles/vim/plugin/textobj-number.vim: -------------------------------------------------------------------------------- 1 | " From https://github.com/sjl/dotfiles/blob/master/vim/vimrc#L1415-1583 2 | " Numbers {{{ 3 | 4 | " Motion for numbers. Great for CSS. Lets you do things like this: 5 | " 6 | " margin-top: 200px; -> daN -> margin-top: px; 7 | " ^ ^ 8 | " TODO: Handle floats. 9 | 10 | onoremap N :call NumberTextObject(0) 11 | xnoremap N :call NumberTextObject(0) 12 | onoremap aN :call NumberTextObject(1) 13 | xnoremap aN :call NumberTextObject(1) 14 | onoremap iN :call NumberTextObject(1) 15 | xnoremap iN :call NumberTextObject(1) 16 | 17 | function! s:NumberTextObject(whole) 18 | let num = '\v[0-9]' 19 | 20 | echomsg getline('.')[col('.') - 1] 21 | " If the current char isn't a number, walk forward. 22 | while getline('.')[col('.') - 1] !~# num 23 | normal! l 24 | endwhile 25 | 26 | " Now that we're on a number, start selecting it. 27 | normal! v 28 | 29 | " If the char after the cursor is a number, select it. 30 | while getline('.')[col('.')] =~# num 31 | normal! l 32 | endwhile 33 | 34 | " If we want an entire word, flip the select point and walk. 35 | if a:whole 36 | normal! o 37 | 38 | while col('.') > 1 && getline('.')[col('.') - 2] =~# num 39 | normal! h 40 | endwhile 41 | endif 42 | endfunction 43 | 44 | " }}} 45 | -------------------------------------------------------------------------------- /dotfiles/vim/plugin/tmux_navigator.vim: -------------------------------------------------------------------------------- 1 | " Adapted from https://github.com/christoomey/vim-tmux-navigator 2 | 3 | if exists("g:loaded_tmux_navigator") || &cp 4 | finish 5 | endif 6 | let g:loaded_tmux_navigator = 1 7 | 8 | let s:tmux_is_last_pane = 0 9 | au WinEnter * let s:tmux_is_last_pane = 0 10 | 11 | " Like 'wincmd' but also change tmux panes instead of vim windows when needed. 12 | function! s:TmuxWinCmd(direction) 13 | if $TMUX != '' 14 | call s:TmuxAwareNavigate(a:direction) 15 | else 16 | call s:VimNavigate(a:direction) 17 | endif 18 | endfunction 19 | 20 | function! s:TmuxAwareNavigate(direction) 21 | let nr = winnr() 22 | let tmux_last_pane = (a:direction == 'p' && s:tmux_is_last_pane) 23 | if !tmux_last_pane 24 | call s:VimNavigate(a:direction) 25 | endif 26 | " Forward the switch panes command to tmux if: 27 | " a) we're toggling between the last tmux pane; 28 | " b) we tried switching windows in vim but it didn't have effect. 29 | if tmux_last_pane || nr == winnr() 30 | let cmd = 'tmux select-pane -' . tr(a:direction, 'phjkl', 'lLDUR') 31 | silent call system(cmd) 32 | let s:tmux_is_last_pane = 1 33 | else 34 | let s:tmux_is_last_pane = 0 35 | endif 36 | endfunction 37 | 38 | function! s:VimNavigate(direction) 39 | try 40 | execute 'wincmd ' . a:direction 41 | catch 42 | echohl ErrorMsg | echo 'E11: Invalid in command-line window; executes, CTRL-C quits: wincmd k' | echohl None 43 | endtry 44 | endfunction 45 | 46 | command! TmuxNavigateLeft call TmuxWinCmd('h') 47 | command! TmuxNavigateDown call TmuxWinCmd('j') 48 | command! TmuxNavigateUp call TmuxWinCmd('k') 49 | command! TmuxNavigateRight call TmuxWinCmd('l') 50 | command! TmuxNavigatePrevious call TmuxWinCmd('p') 51 | -------------------------------------------------------------------------------- /dotfiles/vim/plugin/undowarnings.vim: -------------------------------------------------------------------------------- 1 | " Vim global plugin adding warnings to persistent undo 2 | " Last change: Tue Jun 19 17:25:10 EST 2012 3 | " Maintainer: Damian Conway 4 | " License: This file is placed in the public domain. 5 | 6 | " If already loaded, we're done... 7 | if exists("loaded_undowarnings") 8 | finish 9 | endif 10 | let loaded_undowarnings = 1 11 | 12 | " Preserve external compatibility options, then enable full vim compatibility... 13 | let s:save_cpo = &cpo 14 | set cpo&vim 15 | 16 | "=====[ INTERFACE ]================== 17 | 18 | " Remap the undo key to warn about stepping back into a buffer's pre-history... 19 | nnoremap u verify_undo() 20 | 21 | "=====[ IMPLEMENTATION ]================== 22 | " 23 | " Track each buffer's starting position in the undo history... 24 | augroup UndoWarnings 25 | autocmd! 26 | autocmd BufReadPost,BufNewFile * call s:rememberundo_start() 27 | augroup END 28 | 29 | function! s:rememberundo_start () 30 | let b:undo_start = exists('b:undo_start') ? b:undo_start : undotree().seq_cur 31 | endfunction 32 | 33 | function! s:verify_undo () 34 | " Nothing to verify if can't undo into previous session... 35 | if !exists('*undotree') || !exists('b:undo_start') 36 | return 'u' 37 | endif 38 | 39 | " Are we back at the start of this session (but still with undos possible)??? 40 | let undo_now = undotree().seq_cur 41 | 42 | " Open folds that contain the undo point if configured to do so 43 | let suffix = &foldopen =~# 'undo' ? 'zv' : '' 44 | 45 | " If so, check whether to undo into pre-history... 46 | if undo_now > 0 && undo_now == b:undo_start 47 | if confirm('', "Undo into previous session? (&Yes\n&No)", 1) == 1 48 | return "\u" . suffix 49 | else 50 | return "\" 51 | endif 52 | 53 | " Otherwise, always undo... 54 | else 55 | return 'u' . suffix 56 | endif 57 | endfunction 58 | 59 | " Restore previous external compatibility options 60 | let &cpo = s:save_cpo 61 | -------------------------------------------------------------------------------- /dotfiles/vim/scripts.vim: -------------------------------------------------------------------------------- 1 | if did_filetype() 2 | finish 3 | endif 4 | 5 | let s:line1 = getline(1) 6 | 7 | if s:line1 =~ '^\d\{4}-\d\{2}-\d\{2} \+\d\{2}:\d\{2}:\d\{2}\.\d\{3} \+\w\+ \+\[[^]]\+\]' 8 | setfiletype rhinolog 9 | elseif s:line1 =~ '^\d\{4}-\d\{2}-\d\{2} \+\d\{2}:\d\{2}:\d\{2},\d\{3} \+\[[^]]\+\]\+ \+\w\+ \+\S\+ \+-' 10 | setfiletype scenlog 11 | endif 12 | -------------------------------------------------------------------------------- /dotfiles/vim/syntax/cpp/mozilla.vim: -------------------------------------------------------------------------------- 1 | " -- Mozilla additional syntax 2 | " Author : Jan Larres 3 | " Website : http://majutsushi.net 4 | " Created : 2010-12-06 17:26:01 +1300 NZDT 5 | " Last changed : 2010-12-06 17:26:01 +1300 NZDT 6 | 7 | syn keyword cppBoolean PR_TRUE PR_FALSE 8 | syn keyword cType PRBool PRFloat64 PRInt16 PRInt32 PRInt32 PRInt64 PRInt64 PRInt64 PRInt64 PRInt64 PRInt8 PRInt8 PRIntn PROffset32 PROffset64 PRPackedBool PRPtrdiff PRSize PRStatus PRUint16 PRUint32 PRUint32 PRUint64 PRUint64 PRUint64 PRUint64 PRUint64 PRUint8 PRUintn PRUnichar PRUnichar PRUptrdiff PRUptrdiff PRUword PRUword PRWord PRWord 9 | syn keyword cConstant nsnull 10 | -------------------------------------------------------------------------------- /dotfiles/vim/syntax/diff.vim: -------------------------------------------------------------------------------- 1 | " Author: Jan Larres 2 | " License: MIT/X11 3 | 4 | highlight diffAdded guifg=#87ff87 ctermfg=120 5 | highlight diffRemoved guifg=#d75f5f ctermfg=167 6 | highlight diffSubname guifg=#34e2e2 ctermfg=80 7 | -------------------------------------------------------------------------------- /dotfiles/vim/syntax/vim.vim: -------------------------------------------------------------------------------- 1 | " Author: Jan Larres 2 | 3 | syntax keyword vimTodo TODO FIXME XXX contained containedin=vimLineComment 4 | 5 | highlight default link vimTodo Todo 6 | -------------------------------------------------------------------------------- /dotfiles/waybar/power_menu.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Suspend 7 | 8 | 9 | 10 | 11 | Hibernate 12 | 13 | 14 | 15 | 16 | Shut down 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | Reboot 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /dotfiles/xdg-desktop-portal-wlr/config: -------------------------------------------------------------------------------- 1 | [screencast] 2 | exec_before=swaync-client --inhibitor-add "xdg-desktop-portal-wlr" 3 | exec_after=swaync-client --inhibitor-remove "xdg-desktop-portal-wlr" 4 | -------------------------------------------------------------------------------- /dotfiles/xdg-desktop-portal/awesome-portals.conf: -------------------------------------------------------------------------------- 1 | [preferred] 2 | #default=gnome;gtk; 3 | default=gtk 4 | org.freedesktop.impl.portal.Access=gtk 5 | org.freedesktop.impl.portal.Secret=gnome-keyring 6 | org.freedesktop.impl.portal.Settings=darkman;gtk 7 | -------------------------------------------------------------------------------- /dotfiles/xdg-desktop-portal/sway-portals.conf: -------------------------------------------------------------------------------- 1 | [preferred] 2 | default=wlr;gtk; 3 | # org.freedesktop.impl.portal.Secret=gnome-keyring 4 | org.freedesktop.impl.portal.Settings=darkman;gtk 5 | 6 | # xdg-desktop-portal-gtk will try to use org.gnome.SessionManager and 7 | # org.freedesktop.ScreenSaver interfaces, which aren't implemented. 8 | # Certain programs (Firefox) will always try to use the Inhibit interface 9 | # if available, and only use idle-inhibit as a fallback. 10 | # See: 11 | # https://github.com/flatpak/xdg-desktop-portal-gtk/issues/465 12 | # https://github.com/emersion/xdg-desktop-portal-wlr/pull/315 13 | org.freedesktop.impl.portal.Inhibit=none 14 | -------------------------------------------------------------------------------- /dotfiles/xkb/keymap/default: -------------------------------------------------------------------------------- 1 | default xkb_keymap "default" { 2 | xkb_keycodes { include "evdev+aliases(qwerty)" }; 3 | xkb_types { include "complete" }; 4 | xkb_compat { include "complete" }; 5 | xkb_symbols { include "pc+us+inet(evdev)+level3(ralt_switch_multikey)+ctrl(nocaps)+compose(rwin)+nbsp(level3)+terminate(ctrl_alt_bksp)+majutsushi(custom)" }; 6 | xkb_geometry { include "pc(pc105)" }; 7 | }; 8 | -------------------------------------------------------------------------------- /dotfiles/xkb/symbols/majutsushi: -------------------------------------------------------------------------------- 1 | // Key names in /usr/include/X11/keysymdef.h 2 | 3 | partial alphanumeric_keys 4 | xkb_symbols "custom" { 5 | key { [ grave, asciitilde, degree ] }; 6 | key { [ 1, exclam, onesuperior, onequarter ] }; 7 | key { [ 2, at, twosuperior, onehalf ] }; 8 | key { [ 3, numbersign, threesuperior, threequarters ] }; 9 | key { [ 5, percent, EuroSign ] }; 10 | key { [ 8, asterisk, infinity ] }; 11 | key { [ minus, underscore, endash, emdash ] }; 12 | key { [ equal, plus, approximate, plusminus ] }; 13 | 14 | key { [ e, E, ediaeresis, Ediaeresis ] }; 15 | key { [ u, U, udiaeresis, Udiaeresis ] }; 16 | key { [ o, O, odiaeresis, Odiaeresis ] }; 17 | key { [ bracketleft, braceleft, guillemotleft, leftdoublequotemark ] }; 18 | key { [ bracketright, braceright, guillemotright, rightdoublequotemark ] }; 19 | 20 | key { [ a, A, adiaeresis, Adiaeresis ] }; 21 | key { [ s, S, ssharp, section ] }; 22 | key { [ h, H, Left ] }; 23 | key { [ j, J, Down ] }; 24 | key { [ k, K, Up ] }; 25 | key { [ l, L, Right ] }; 26 | 27 | key { [ c, C, copyright, cent ] }; 28 | key { [ n, N, ntilde, Ntilde ] }; 29 | key { [ m, M, mu, mu ] }; 30 | key { [ period, greater, ellipsis, periodcentered ] }; 31 | key { [ slash, question, exclamdown, questiondown ] }; 32 | key { [ backslash, bar, notsign, brokenbar ] }; 33 | }; 34 | -------------------------------------------------------------------------------- /dotfiles/xorg/Xresources: -------------------------------------------------------------------------------- 1 | !Xft.dpi: 96 2 | !Xft.hinting: 0 3 | !Xft.hintstyle: hintmedium 4 | 5 | !Xcursor.theme: redglass 6 | !Xcursor.size: 24 7 | 8 | !*fontList: -*-helvetica-medium-r-normal-*-*-80-*-*-*-*-*-* 9 | 10 | ! *** colour definitions *** 11 | #define FOREGROUND white 12 | #define BACKGROUND #303030 13 | #define CURSORCOLOR yellow 14 | ! Black 15 | #define COLOR0 #2E3436 16 | #define COLOR8 #555753 17 | ! Red 18 | #define COLOR1 #D75F5F 19 | #define COLOR9 #ef2929 20 | ! Green 21 | #define COLOR2 #87FF87 22 | #define COLOR10 #8AE234 23 | ! Yellow 24 | #define COLOR3 #FFD700 25 | #define COLOR11 #FCE94F 26 | ! Blue 27 | #define COLOR4 #87D7D7 28 | #define COLOR12 #729fcf 29 | ! Magenta 30 | #define COLOR5 #AD7FA8 31 | #define COLOR13 #BB95B7 32 | ! Cyan 33 | #define COLOR6 #34E2E2 34 | #define COLOR14 #00FFFF 35 | ! *color6: #CD853F 36 | ! *color14: #FFD700 37 | ! White 38 | #define COLOR7 #D3D7CF 39 | #define COLOR15 #EEEEEC 40 | 41 | ! *** common terminal settings *** 42 | *loginShell: true 43 | 44 | 45 | ! *** XTerm *** 46 | 47 | ! Is there a way to programatically determine whether xterm has really been 48 | ! compiled with 256 colours? 49 | XTerm.termName: xterm-256color 50 | UXTerm.termName: xterm-256color 51 | 52 | *vt100.cursorColor: CURSORCOLOR 53 | *vt100.foreground: FOREGROUND 54 | *vt100.background: BACKGROUND 55 | *vt100.color0: COLOR0 56 | *vt100.color1: COLOR1 57 | *vt100.color2: COLOR2 58 | *vt100.color3: COLOR3 59 | *vt100.color4: COLOR4 60 | *vt100.color5: COLOR5 61 | *vt100.color6: COLOR6 62 | *vt100.color7: COLOR7 63 | *vt100.color8: COLOR8 64 | *vt100.color9: COLOR9 65 | *vt100.color10: COLOR10 66 | *vt100.color11: COLOR11 67 | *vt100.color12: COLOR12 68 | *vt100.color13: COLOR13 69 | *vt100.color14: COLOR14 70 | *vt100.color15: COLOR15 71 | 72 | *vt100.geometry: 80x50 73 | *vt100.metaSendsEscape: true 74 | *vt100.visualBell: true 75 | *vt100.translations: #override \ 76 | Ctrl Up: larger-vt-font() \n\ 77 | Ctrl Down: smaller-vt-font() \n\ 78 | Ctrl space: string(0x1b) string("Q32;5~") \n 79 | 80 | 81 | KDrill*kdictfile: /usr/share/edict/kanjidic 82 | !KDrill*edictfile: /usr/share/edict/edict 83 | -------------------------------------------------------------------------------- /dotfiles/xorg/inputplug-hook: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | readonly EVENT_TYPE="$1" 4 | readonly DEVICE_ID="$2" 5 | readonly DEVICE_TYPE="$3" 6 | readonly DEVICE_NAME="$4" 7 | 8 | readonly SCRIPTDIR="$(cd "$(dirname "$0")" && pwd -P)" 9 | 10 | exec &> >(logger -t inputplug-hook -p user.info) 11 | 12 | [[ "$EVENT_TYPE" == XIDeviceEnabled ]] || exit 0 13 | 14 | case "$DEVICE_TYPE" in 15 | XISlaveKeyboard) 16 | echo "Handling keyboard '$DEVICE_NAME'" 17 | echo "Setting custom keymap and symbols" 18 | # http://madduck.net/docs/extending-xkb/ 19 | xkbcomp -w3 "-I${XDG_CONFIG_HOME}/xkb" "${XDG_CONFIG_HOME}/xkb/keymap/default" "${DISPLAY%%.*}" 20 | ;; 21 | XISlavePointer) 22 | echo "Handling pointer '$DEVICE_NAME'" 23 | case "$DEVICE_NAME" in 24 | Microsoft\ Microsoft\ Trackball\ Explorer®) 25 | echo "Remapping trackball buttons" 26 | xinput --set-button-map "$DEVICE_ID" 1 2 8 4 5 6 7 3 9 10 11 12 13 27 | ;; 28 | Microsoft\ \ Microsoft\ Basic\ Optical\ Mouse\ v2.0\ ) 29 | if [[ $(hostname) == vanadis ]]; then 30 | echo "Enabling left-hand mode on mouse" 31 | xinput set-prop "$DEVICE_ID" "libinput Left Handed Enabled" 1 32 | fi 33 | ;; 34 | esac 35 | ;; 36 | esac 37 | 38 | if [[ -f "$HOME/.local/etc/inputplug" ]]; then 39 | . "$HOME/.local/etc/inputplug" 40 | fi 41 | -------------------------------------------------------------------------------- /dotfiles/xorg/xsession: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # https://github.com/vincentbernat/awesome-configuration/blob/master/xsession 3 | 4 | # . $HOME/.xsessionrc 5 | 6 | # Redirect output to the syslog instead of ~/.xsession-errors 7 | # Close stdout and stderr first so all references to the file are gone 8 | exec 1>&- 2>&- 9 | exec 1> >(logger -e -t xsession -p user.info &>/dev/null) \ 10 | 2> >(logger -e -t xsession -p user.warning &>/dev/null) 11 | logger -e -t xsession -p user.info -f "$HOME/.xsession-errors" 12 | rm -f "$HOME"/.xsession-errors{,.old} 13 | 14 | eval "$(gnome-keyring-daemon --start --components=secrets)" 15 | /usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1 & 16 | 17 | if systemd-detect-virt -q; then 18 | # Running in a VM; no need for monitor management 19 | xset s off 20 | xset -dpms 21 | else 22 | xset s 600 120 23 | xset dpms 0 0 1200 24 | if command -v xsecurelock &> /dev/null; then 25 | export XSECURELOCK_SAVER=saver_blank 26 | xss-lock --notifier="/usr/libexec/xsecurelock/dimmer" -l -- xsecurelock & 27 | else 28 | xss-lock --notifier="$DOTFILES/bin/xss-notify" -- slock & 29 | fi 30 | fi 31 | 32 | dex -a -e Awesome 33 | clipit & 34 | xbanish & 35 | 36 | if [[ $(systemd-detect-virt) == "oracle" ]]; then 37 | picom --config "$DOTFILES/picom-vbox.conf" -b 38 | else 39 | picom --config "$DOTFILES/picom.conf" -b 40 | fi 41 | 42 | # copied from /etc/X11/Xsession.d/95dbus_update-activation-env 43 | ( 44 | # unset login-session-specifics 45 | unset XDG_SEAT 46 | unset XDG_SESSION_ID 47 | unset XDG_VTNR 48 | 49 | dbus-update-activation-environment --verbose --systemd --all 50 | ) 51 | 52 | "$DOTFILES/xorg/xsettingsd-setup" 53 | inputplug -0 -c "$DOTFILES/xorg/inputplug-hook" 54 | 55 | # https://gitlab.freedesktop.org/pipewire/pipewire/-/merge_requests/836 56 | pactl load-module module-switch-on-connect 57 | 58 | # Wayland alternative: https://github.com/rvaiya/warpd 59 | keynav "loadconfig $DOTFILES/keynavrc" 60 | 61 | exec logger-wrapper awesome 62 | -------------------------------------------------------------------------------- /dotfiles/xorg/xsessionrc: -------------------------------------------------------------------------------- 1 | if [ -f ~/.profile ]; then 2 | . ~/.profile 3 | fi 4 | 5 | # export XDG_CURRENT_DESKTOP=awesome:GNOME 6 | export XDG_CURRENT_DESKTOP=awesome 7 | 8 | # Fix Java menu issues in Awesome 9 | xprop -root -f _NET_WM_NAME 8u -set _NET_WM_NAME Sawfish 10 | 11 | # vim: ft=sh 12 | -------------------------------------------------------------------------------- /dotfiles/xorg/xsettingsd: -------------------------------------------------------------------------------- 1 | # https://www.freedesktop.org/wiki/Specifications/XSettingsRegistry/ 2 | # https://github.com/GNOME/gtk/blob/master/gdk/x11/gdksettings.c 3 | # https://developer.gnome.org/gtk3/stable/GtkSettings.html 4 | 5 | Net/CursorBlink 1 6 | Net/CursorBlinkTime 1200 7 | Net/DndDragThreshold 8 8 | Net/DoubleClickDistance 5 9 | Net/DoubleClickTime 400 10 | Net/EnableEventSounds 0 11 | Net/EnableInputFeedbackSounds 0 12 | # Net/IconThemeName "Faenza-Darkest" 13 | Net/SoundThemeName "freedesktop" 14 | Net/ThemeName "Adwaita-dark" 15 | 16 | Xft/Antialias 1 17 | Xft/Hinting 1 18 | Xft/HintStyle "hintslight" 19 | Xft/RGBA "rgb" 20 | # Xft/DPI 96 21 | 22 | Gtk/AutoMnemonics 1 23 | Gtk/CanChangeAccels 0 24 | Gtk/CursorBlinkTimeout 10 25 | Gtk/CursorThemeName "Adwaita" 26 | # Gtk/CursorThemeSize 24 27 | Gtk/DecorationLayout "menu:close" 28 | # Gtk/DecorationLayout "menu:minimize,maximize,close" 29 | Gtk/DialogsUseHeader 1 30 | Gtk/EnableAccels 1 31 | Gtk/EnableAnimations 1 32 | Gtk/EnablePrimaryPaste 1 33 | Gtk/FontName "Ubuntu 10" 34 | Gtk/IMModule "gtk-im-context-simple" 35 | Gtk/KeyThemeName "Emacs" 36 | Gtk/KeynavUseCaret 0 37 | # Gtk/Modules "canberra-gtk-module" 38 | Gtk/PrimaryButtonWarpsSlider 0 39 | Gtk/RecentFilesEnabled 1 40 | Gtk/RecentFilesMaxAge -1 41 | Gtk/ShellShowsAppMenu 0 42 | Gtk/ShellShowsDesktop 0 43 | Gtk/ShellShowsMenubar 0 44 | 45 | # For older Gtk 46 | Gtk/ToolbarStyle "icons" 47 | # Gtk/ToolbarIconSize "small-toolbar" 48 | 49 | # For client-side decorated windows 50 | # minimize, toggle-maximize, menu, lower or none 51 | Gtk/TitlebarDoubleClick "toggle-maximize" 52 | Gtk/TitlebarMiddleClick "none" 53 | Gtk/TitlebarRightClick "menu" 54 | -------------------------------------------------------------------------------- /dotfiles/xorg/xsettingsd-setup: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # based on 3 | # https://github.com/vincentbernat/awesome-configuration/blob/master/bin/xsettingsd-setup 4 | 5 | dpi=120 6 | cursor_size=36 7 | 8 | # Build xsettingsd 9 | cp "$DOTFILES/xorg/xsettingsd" ~/.config/xsettingsd 10 | echo Xft/DPI $(( dpi * 1024 )) >> ~/.config/xsettingsd 11 | echo Gtk/CursorThemeSize $cursor_size >> ~/.config/xsettingsd 12 | 13 | # Signal xsettingsd 14 | pid=$(xprop -name xsettingsd _NET_WM_PID 2> /dev/null | awk '{print $NF}') 15 | if [[ "$pid" == "" ]]; then 16 | xsettingsd -c ~/.config/xsettingsd & 17 | else 18 | kill -HUP "$pid" 19 | fi 20 | 21 | # Also use xrdb for very old stuff (you know, LibreOffice) 22 | echo Xft.dpi: $dpi | xrdb -merge 23 | echo Xcursor.size: $cursor_size | xrdb -merge 24 | -------------------------------------------------------------------------------- /dotfiles/yazi/packages.yaml: -------------------------------------------------------------------------------- 1 | - url: https://github.com/yazi-rs/plugins 2 | path: chmod.yazi 3 | - url: https://github.com/yazi-rs/plugins 4 | path: git.yazi 5 | - url: https://github.com/yazi-rs/plugins 6 | path: hide-preview.yazi 7 | - url: https://github.com/yazi-rs/plugins 8 | path: mount.yazi 9 | - url: https://github.com/yazi-rs/plugins 10 | path: smart-enter.yazi 11 | - url: https://github.com/yazi-rs/plugins 12 | path: smart-filter.yazi 13 | - url: https://github.com/yazi-rs/plugins 14 | path: toggle-pane.yazi 15 | - url: https://github.com/yazi-rs/plugins 16 | path: vcs-files.yazi 17 | - url: https://github.com/KKV9/compress.yazi 18 | - url: https://github.com/KKV9/command.yazi 19 | - url: https://github.com/Rolv-Apneseth/starship.yazi 20 | - url: https://github.com/Ape/open-with-cmd.yazi 21 | -------------------------------------------------------------------------------- /dotfiles/yazi/plugins/lessfilter.yazi/main.lua: -------------------------------------------------------------------------------- 1 | local M = {} 2 | 3 | function M:peek(job) 4 | local dotfiles = os.getenv("DOTFILES") 5 | local child = Command(dotfiles .. "/less/lessfilter") 6 | :arg({ 7 | tostring(job.file.url), 8 | }) 9 | :stdout(Command.PIPED) 10 | :stderr(Command.PIPED) 11 | :spawn() 12 | 13 | if not child then 14 | return self:print_error(job) 15 | end 16 | 17 | local limit = job.area.h 18 | local i, lines = 0, "" 19 | repeat 20 | local next, event = child:read_line() 21 | if event == 2 then 22 | break 23 | end 24 | 25 | i = i + 1 26 | if i > job.skip then 27 | lines = lines .. next 28 | end 29 | until i >= job.skip + limit 30 | 31 | child:start_kill() 32 | if job.skip > 0 and i < job.skip + limit then 33 | ya.manager_emit("peek", { math.max(0, i - limit), only_if = tostring(job.file.url), upper_bound = true }) 34 | else 35 | lines = lines:gsub("\t", string.rep(" ", rt.preview.tab_size)) 36 | ya.preview_widgets(job, { ui.Text.parse(lines):area(job.area):wrap(rt.preview.wrap == "yes" and ui.Text.WRAP or ui.Text.WRAP_NO) }) 37 | end 38 | end 39 | 40 | function M:seek(job) 41 | local h = cx.active.current.hovered 42 | if h and h.url == job.file.url then 43 | local step = math.floor(job.units * job.area.h / 10) 44 | ya.manager_emit("peek", { 45 | math.max(0, cx.active.preview.skip + step), 46 | only_if = tostring(job.file.url), 47 | }) 48 | end 49 | end 50 | 51 | function M:print_error(job) 52 | p = ui.Text({ 53 | ui.Line { 54 | ui.Span("Failed to spawn `lessfilter` command"), 55 | }, 56 | }):area(job.area) 57 | 58 | ya.preview_widgets(job, { p:wrap(ui.Text.WRAP) }) 59 | end 60 | 61 | return M 62 | -------------------------------------------------------------------------------- /dotfiles/yazi/plugins/parent-arrow.yazi/main.lua: -------------------------------------------------------------------------------- 1 | --- @sync entry 2 | local function entry(_, job) 3 | local parent = cx.active.parent 4 | if not parent then 5 | return 6 | end 7 | 8 | local target = parent.files[parent.cursor + 1 + job.args[1]] 9 | if target and target.cha.is_dir then 10 | ya.manager_emit("cd", { tostring(target.url) }) 11 | end 12 | end 13 | 14 | return { entry = entry } 15 | -------------------------------------------------------------------------------- /dotfiles/yazi/plugins/simple-close.yazi/main.lua: -------------------------------------------------------------------------------- 1 | --- @sync entry 2 | return { 3 | entry = function() 4 | if #cx.tabs > 1 then 5 | ya.manager_emit("close", {}) 6 | return 7 | end 8 | ya.manager_emit("quit", { no_cwd_file = true }) 9 | end, 10 | } 11 | -------------------------------------------------------------------------------- /dotfiles/yazi/theme.toml: -------------------------------------------------------------------------------- 1 | # Default: https://github.com/sxyazi/yazi/blob/main/yazi-config/preset/theme.toml 2 | "$schema" = "https://yazi-rs.github.io/schemas/theme.json" 3 | 4 | [mgr] 5 | border_style = { fg = "darkgray" } 6 | 7 | [mode] 8 | normal_main = { fg = "white", bg = "#6182b8", bold = true } 9 | select_main = { fg = "white", bg = "red", bold = true } 10 | unset_main = { fg = "white", bg = "red", bold = true } 11 | 12 | [which] 13 | cols = 1 14 | mask = { bg = "reset" } 15 | cand = { fg = "red" } 16 | # rest = { fg = "darkgray" } 17 | desc = { fg = "reset" } 18 | # separator = "  " 19 | # separator_style = { fg = "darkgray" } 20 | 21 | [filetype] 22 | rules = [ 23 | # Images 24 | { mime = "image/*", fg = "cyan" }, 25 | 26 | # Media 27 | { mime = "video/*", fg = "yellow" }, 28 | { mime = "audio/*", fg = "yellow" }, 29 | 30 | # Archives 31 | { mime = "application/*zip", fg = "magenta" }, 32 | { mime = "application/x-tar", fg = "magenta" }, 33 | { mime = "application/x-bzip*", fg = "magenta" }, 34 | { mime = "application/x-7z-compressed", fg = "magenta" }, 35 | { mime = "application/x-rar", fg = "magenta" }, 36 | { mime = "application/x-xz", fg = "magenta" }, 37 | 38 | # Documents 39 | { mime = "application/doc", fg = "green" }, 40 | { mime = "application/pdf", fg = "green" }, 41 | { mime = "application/rtf", fg = "green" }, 42 | { mime = "application/vnd.*", fg = "green" }, 43 | 44 | # Special files 45 | { name = "*", is = "link", fg = "cyan" }, 46 | { name = "*", is = "orphan", bg = "red"}, 47 | { name = "*", is = "exec", fg = "green", bold = true }, 48 | 49 | # Dummy files 50 | { name = "*", is = "dummy", bg = "red" }, 51 | { name = "*/", is = "dummy", bg = "red" }, 52 | 53 | # Fallback 54 | # { name = "*", fg = "reset" }, 55 | { name = "*/", fg = "blue" } 56 | ] 57 | -------------------------------------------------------------------------------- /dotfiles/zathurarc: -------------------------------------------------------------------------------- 1 | # zathurarc 2 | 3 | # settings 4 | set window-height 1024 5 | set window-width 768 6 | set adjust-open width 7 | # set show-scrollbars true 8 | set first-page-column 2 9 | set window-title-basename true 10 | set database sqlite 11 | set recolor-keephue 12 | set selection-clipboard clipboard 13 | 14 | 15 | # key bindings 16 | # map abort # Still doesn't work :( 17 | map [normal] toggle_fullscreen 18 | map [fullscreen] toggle_fullscreen 19 | map [normal] reload 20 | map [fullscreen] reload 21 | 22 | map [normal] e scroll down 23 | map [fullscreen] e scroll down 24 | map [normal] scroll down 25 | map [fullscreen] scroll down 26 | map [normal] y scroll up 27 | map [fullscreen] y scroll up 28 | map [normal] scroll up 29 | map [fullscreen] scroll up 30 | map [normal] R rotate rotate-ccw 31 | map [fullscreen] R rotate rotate-ccw 32 | 33 | map [normal] navigate previous 34 | map [fullscreen] navigate previous 35 | map [normal] navigate next 36 | map [fullscreen] navigate next 37 | 38 | map [normal] set "first-page-column 1:1" 39 | map [fullscreen] set "first-page-column 1:1" 40 | map [normal] set "first-page-column 1:2" 41 | map [fullscreen] set "first-page-column 1:2" 42 | 43 | # Why are these only defined for normal mode by default? 44 | map [fullscreen] a adjust_window best-fit 45 | map [fullscreen] s adjust_window width 46 | map [fullscreen] f follow 47 | map [fullscreen] d toggle_page_mode 2 48 | map [fullscreen] toggle_index 49 | map [fullscreen] j scroll down 50 | map [fullscreen] k scroll up 51 | map [fullscreen] scroll half-down 52 | map [fullscreen] scroll half-up 53 | map [fullscreen] jumplist backward 54 | map [fullscreen] jumplist forward 55 | 56 | map [index] q quit 57 | 58 | # colors 59 | set recolor-darkcolor "#FFFFFF" 60 | set recolor-lightcolor "#333333" 61 | set statusbar-fg "#000000" 62 | set statusbar-bg "#C2BFA5" 63 | set inputbar-fg "#FFFFFF" 64 | set inputbar-bg "#333333" 65 | set completion-highlight-fg "#F0E68C" 66 | set completion-highlight-bg "#6B8E23" 67 | # set highlight-color "#CD853F" 68 | # set highlight-active-color "#F0E68C" 69 | set notification-fg "#FFFFFF" 70 | set notification-bg "#333333" 71 | -------------------------------------------------------------------------------- /dotfiles/zsh/zsh/.zlogin: -------------------------------------------------------------------------------- 1 | rcsstub -------------------------------------------------------------------------------- /dotfiles/zsh/zsh/.zlogout: -------------------------------------------------------------------------------- 1 | rcsstub -------------------------------------------------------------------------------- /dotfiles/zsh/zsh/.zprofile: -------------------------------------------------------------------------------- 1 | rcsstub -------------------------------------------------------------------------------- /dotfiles/zsh/zsh/.zshenv: -------------------------------------------------------------------------------- 1 | rcsstub -------------------------------------------------------------------------------- /dotfiles/zsh/zsh/.zshrc: -------------------------------------------------------------------------------- 1 | rcsstub -------------------------------------------------------------------------------- /dotfiles/zsh/zsh/func/_extpwds: -------------------------------------------------------------------------------- 1 | #autoload 2 | # Originally from http://www.zsh.org/mla/users/2014/msg01100.html 3 | 4 | local -a expl 5 | local -au dirs 6 | 7 | # undo work _main_complete did to remove the tilde 8 | PREFIX="$IPREFIX$PREFIX" 9 | IPREFIX= 10 | SUFFIX="$SUFFIX$ISUFFIX" 11 | ISUFFIX= 12 | 13 | [[ -o magicequalsubst ]] && compset -P '*=' 14 | 15 | case $OSTYPE in 16 | solaris*) dirs=( ${(M)${${(f)"$(pgrep -U $UID -x zsh|xargs pwdx)"}:#$$:*}%%/*} ) ;; 17 | linux*) dirs=( /proc/${^$(pidof zsh):#$$}/cwd(N:A) ) ;; 18 | esac 19 | dirs=( ${(D)dirs} ) 20 | 21 | # remove deleted directories that have a dangling symlink 22 | dirs=( ${dirs//\/proc\/*\/cwd/} ) 23 | 24 | compstate[pattern_match]='*' 25 | _wanted directories expl 'current directory from other shells' \ 26 | compadd -M "r:|/=* r:|=*" -Q -f -a dirs 27 | -------------------------------------------------------------------------------- /dotfiles/zsh/zsh/func/_git-log-divergence: -------------------------------------------------------------------------------- 1 | #compdef git-log-divergence 2 | 3 | branches=(${(f)"$(git for-each-ref --format="%(refname:short)" refs/heads)"}) 4 | _describe -t branches branches branches 5 | remote_branches=(${(f)"$(git for-each-ref --format="%(refname:short)" refs/remotes)"}) 6 | _describe -t remote_branches 'remote branches' remote_branches 7 | tags=(${(f)"$(git for-each-ref --format="%(refname:short)" refs/tags)"}) 8 | _describe -t tags tags tags 9 | -------------------------------------------------------------------------------- /dotfiles/zsh/zsh/func/_git-missing-commits: -------------------------------------------------------------------------------- 1 | #compdef git-missing-commits 2 | 3 | branches=(${(f)"$(git for-each-ref --format="%(refname:short)" refs/heads)"}) 4 | _describe -t branches branches branches 5 | remote_branches=(${(f)"$(git for-each-ref --format="%(refname:short)" refs/remotes)"}) 6 | _describe -t remote_branches 'remote branches' remote_branches 7 | tags=(${(f)"$(git for-each-ref --format="%(refname:short)" refs/tags)"}) 8 | _describe -t tags tags tags 9 | -------------------------------------------------------------------------------- /dotfiles/zsh/zsh/func/baseconv: -------------------------------------------------------------------------------- 1 | #!/bin/zsh 2 | # 3 | # func/baseconv 4 | # 5 | # zsh-based conversion between numeric bases 6 | # 7 | # Copyright © 1994–2008 martin f. krafft 8 | # Released under the terms of the Artistic Licence 2.0 9 | # 10 | # Source repository: git://git.madduck.net/etc/zsh.git 11 | # 12 | 13 | if [ $# -ne 3 ]; then 14 | echo Usage: ${0##*/} ibase obase number 15 | return 1 16 | fi 17 | 18 | typeset -li $2 var 19 | eval ((var=${1}#${3})) 20 | echo ${var#*\#} 21 | -------------------------------------------------------------------------------- /dotfiles/zsh/zsh/func/hr: -------------------------------------------------------------------------------- 1 | # Based on https://github.com/LuRsT/hr/blob/master/hr 2 | 3 | emulate -L zsh 4 | 5 | local cols="$(tput cols)" 6 | if (( cols <= 0 )); then 7 | cols="${COLUMNS:-80}" 8 | fi 9 | 10 | local word 11 | for word in "${@:-#}"; do 12 | local line="" 13 | while (( ${#line} < cols )); do 14 | line="$line$word" 15 | done 16 | 17 | echo "${line:0:$cols}" 18 | done 19 | -------------------------------------------------------------------------------- /dotfiles/zsh/zsh/func/is-active-shell: -------------------------------------------------------------------------------- 1 | if [[ "$TERM" == xterm-kitty ]]; then 2 | local kitty_focused=$(kitty @ ls | jq ".[].tabs[] | select(.windows[].is_self == true) | .is_focused") 3 | [[ $kitty_focused == false ]] && return 1 4 | elif [[ -n "${DISPLAY}" ]]; then 5 | local activewin=$(xprop -root 32x '\t$0' _NET_ACTIVE_WINDOW | cut -f 2) 6 | local -l curwin="0x$(print $(( [##16] 10#${WINDOWID} )) )" 7 | 8 | [[ $activewin != ${curwin} ]] && return 1 9 | elif [[ -n "$ITERM_SESSION_ID" ]]; then 10 | local is_app_focused=$(osascript -e 'tell application "iTerm" to frontmost') 11 | [[ $is_app_focused != true ]] && return 1 12 | 13 | local focused_session=$(osascript 2>/dev/null < 0 && buffer_idx <= $#BUFFER )) 29 | do 30 | target_choice=${ZSH_JUMP_TARGET_CHOICES[target_idx]} 31 | BUFFER[buffer_idx]=$target_choice 32 | target_to_buffer_idx[$target_choice]=$buffer_idx 33 | (( start = buffer_idx - 1 )) 34 | region_highlight+=( "$start $buffer_idx $ZSH_JUMP_TARGET_STYLE" ) 35 | (( target_idx++ )) 36 | if (( target_idx > target_choices_len )); then 37 | break 38 | fi 39 | done 40 | 41 | if (( target_idx == 1 )); then 42 | return 0 43 | fi 44 | 45 | if (( target_idx == 2 )); then 46 | target_choice=${ZSH_JUMP_TARGET_CHOICES[1]} 47 | else 48 | zle -R "Target:" 49 | read -k target_choice 50 | fi 51 | 52 | if (( ${+target_to_buffer_idx[$target_choice]} )); then 53 | (( CURSOR = target_to_buffer_idx[$target_choice] - 1 )) 54 | fi 55 | 56 | } always { 57 | BUFFER=$orig_buffer 58 | region_highlight=("${orig_region_highlight[@]}") 59 | zle -cR '' 60 | } 61 | } 62 | 63 | # vim: ft=zsh 64 | -------------------------------------------------------------------------------- /dotfiles/zsh/zsh/func/purge: -------------------------------------------------------------------------------- 1 | # Clean up directory - remove well known tempfiles 2 | emulate -L zsh 3 | 4 | setopt HIST_SUBST_PATTERN 5 | local -a TEXTEMPFILES GHCTEMPFILES PYTEMPFILES FILES 6 | 7 | TEXTEMPFILES=(*.tex(N:s/%tex/'(log|toc|aux|nav|snm|out|tex.backup|bbl|blg|bib.backup|vrb|lof|lot|hd|idx|fdb_latexmk|fls)(N)'/)) 8 | 9 | GHCTEMPFILES=(*.(hs|lhs)(N:r:s/%/'.(hi|hc|(p|u|s)_(o|hi))(N)'/)) 10 | 11 | PYTEMPFILES=(*.py(N:s/%py/'(pyc|pyo)(N)'/)) 12 | 13 | ZSH_COMPILED=(*.zwc(.NDe:'[[ -f ${REPLY%.zwc} && ${REPLY%.zwc} -nt ${REPLY} ]]':)) 14 | 15 | FILES=( 16 | *~(.N) 17 | \#*\#(.N) 18 | *.o(.N) 19 | a.out(.N) 20 | (*.|)core(.N) 21 | *.cmo(.N) 22 | *.cmi(.N) 23 | .*.swp(.N) 24 | *.(orig|rej)(.DN) 25 | *.dpkg-(old|dist|new)(DN) 26 | ._(cfg|mrg)[0-9][0-9][0-9][0-9]_*(N) 27 | .DS_Store(.N) 28 | __MACOSX(/N) 29 | ${~TEXTEMPFILES} 30 | ${~GHCTEMPFILES} 31 | ${~PYTEMPFILES} 32 | ${ZSH_COMPILED} 33 | ) 34 | 35 | local NBFILES=${#FILES} 36 | local CURDIRSUDO="" 37 | 38 | [[ ! -w ./ ]] && CURDIRSUDO=$SUDO 39 | 40 | if [[ $NBFILES > 0 ]] ; then 41 | print -l $FILES 42 | local ans 43 | echo -n "Remove these files? [y/N] " 44 | read -q ans; echo 45 | if [[ $ans == "y" ]] ; then 46 | $CURDIRSUDO rm ${FILES} 47 | echo ">> $PWD purged, $NBFILES files removed" 48 | else 49 | echo "Nothing done" 50 | fi 51 | fi 52 | -------------------------------------------------------------------------------- /dotfiles/zsh/zsh/func/rationalize-dots: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | # ------------------------------------------------------------------------------------------ 3 | # Description 4 | # ZLE widget that turns dots into "../". 5 | # 6 | # Usage 7 | # Bind it to ".": 8 | # autoload rationalize-dots 9 | # zle -N rationalize-dots 10 | # bindkey . rationalize-dots 11 | # bindkey -M isearch . self-insert 12 | # ------------------------------------------------------------------------------------------ 13 | 14 | case $LBUFFER in 15 | (./..|* ./..) LBUFFER+='.' ;; # In Go: "go list ./..." 16 | (..|*[ /=]..) LBUFFER+='/..' ;; 17 | (*) LBUFFER+='.' ;; 18 | esac 19 | 20 | have _zsh_highlight && _zsh_highlight 21 | 22 | if [[ "$LBUFFER" =~ "/\.\.$" ]]; then 23 | typeset -a line 24 | line=(${(z)LBUFFER}) 25 | local dots=$line[$#line] 26 | 27 | zle -M ${(D)dots:a} 28 | fi 29 | -------------------------------------------------------------------------------- /dotfiles/zsh/zsh/func/showlinkchain: -------------------------------------------------------------------------------- 1 | local args 2 | 3 | while [[ -h $1 ]]; do 4 | zstat -A args +link $1 5 | if [[ -n $args[1] ]]; then 6 | print -r - $args[1] 7 | set -- $args[1] 8 | else 9 | break 10 | fi 11 | done 12 | 13 | # vim: filetype=zsh 14 | -------------------------------------------------------------------------------- /dotfiles/zsh/zsh/func/ssh-vm: -------------------------------------------------------------------------------- 1 | emulate -L zsh 2 | 3 | local destination=${@[-1]} 4 | local host=${destination##*@} 5 | 6 | echo Pinging $host ... 7 | while ! ping -c 1 -W 1 $host > /dev/null; do 8 | sleep 1 9 | echo Pinging $host ... 10 | done && while ! sshrc \ 11 | -o StrictHostKeyChecking=no \ 12 | -o UserKnownHostsFile=/dev/null \ 13 | -o LogLevel=error \ 14 | -o ConnectTimeout=2 \ 15 | "$@"; do 16 | sleep 1 17 | done 18 | 19 | # vim: filetype=zsh 20 | -------------------------------------------------------------------------------- /dotfiles/zsh/zsh/func/svn: -------------------------------------------------------------------------------- 1 | # wrap some svn commands with a pager and colours 2 | # originally from 3 | # http://got-ravings.blogspot.com/2010/10/colorizing-and-autopaging-svn-diffs.html 4 | 5 | local fg_red=$'\e[31m' 6 | local fg_green=$'\e[32m' 7 | local fg_yellow=$'\e[33m' 8 | local fg_blue=$'\e[34m' 9 | local fg_magenta=$'\e[35m' 10 | local reset=$'\e[0m' 11 | 12 | if [[ $# -lt 1 ]]; then 13 | command svn 14 | return 15 | fi 16 | 17 | local sub_cmd=$1 18 | shift 19 | 20 | if [[ $sub_cmd == diff ]]; then 21 | command svn diff "$@" | diff | less -RF 22 | 23 | # note that C and M can be preceded by whitespace - see $svn help status 24 | elif [[ $sub_cmd =~ ^(status|st)$ ]]; then 25 | command svn status "$@" | sed -r -e 's/^(([A-Z]\s+(\+\s+)?)?C .*)$/'$fg_magenta'\1'$reset'/' \ 26 | -e 's/^(\s*M.*)$/'$fg_blue'\1'$reset'/' \ 27 | -e 's/^(A.*)$/'$fg_green'\1'$reset'/' \ 28 | -e 's/^([D!~].*)$/'$fg_red'\1'$reset'/' | less -RF 29 | elif [[ $sub_cmd =~ ^(blame|help|h|cat)$ ]]; then 30 | command svn $sub_cmd "$@" | less -F 31 | elif [[ $sub_cmd == log ]]; then 32 | command svn log "$@" | sed -r -e 's/^(.*)\|(.*)\|(.*)\|(.*)$/'${fg_yellow}'\1'$reset'|'${fg_green}'\2'$reset'|'${fg_blue}'\3'$reset'|\4/' \ 33 | -e 's/^( M .*)/'$fg_blue'\1'$reset'/' \ 34 | -e 's/^( A .*)/'$fg_green'\1'$reset'/' \ 35 | -e 's/^( D .*)/'$fg_red'\1'$reset'/' | less -RF 36 | else 37 | command svn $sub_cmd "$@" 38 | fi 39 | 40 | # vim: filetype=zsh 41 | -------------------------------------------------------------------------------- /dotfiles/zsh/zsh/func/update-third-party: -------------------------------------------------------------------------------- 1 | setopt err_return 2 | 3 | print Updating zinit 4 | zinit update --all 5 | 6 | if have flatpak; then 7 | print 8 | print Updating flatpak 9 | flatpak update --noninteractive 10 | fi 11 | 12 | if have rustup; then 13 | print 14 | print Updating Rust 15 | rustup update stable 16 | fi 17 | 18 | if have cargo; then 19 | print 20 | print Updating cargo 21 | nice -n 19 cargo install-update --all 22 | fi 23 | 24 | if have uv; then 25 | print 26 | print Updating uv 27 | uv tool upgrade --all 28 | fi 29 | 30 | if have brew; then 31 | print 32 | print Updating Homebrew 33 | brew upgrade 34 | fi 35 | 36 | if have gh; then 37 | print 38 | print Updating GitHub CLI extensions 39 | gh extension upgrade --all 40 | fi 41 | 42 | print 43 | print Updating yazi packages 44 | yazi-package update 45 | 46 | # vim: filetype=zsh 47 | -------------------------------------------------------------------------------- /dotfiles/zsh/zsh/logging: -------------------------------------------------------------------------------- 1 | # logging 2 | # 3 | # Logging abilities for the shell initialisation scripts 4 | # 5 | # Copyright © 1994–2008 martin f. krafft 6 | # Released under the terms of the Artistic Licence 2.0 7 | # 8 | # Source repository: git://git.madduck.net/etc/zsh.git 9 | # 10 | 11 | __log() { 12 | local level; level="$1"; shift 13 | echo "${level}: $@" >&2 14 | } 15 | __do_debug() { 16 | [ -n "${ZDEBUG:-}" ] 17 | } 18 | log_error() { 19 | [[ -o xtrace ]] && set +x && local __XTRACE=1 20 | __log E "$@" 21 | [ "${__XTRACE:-}" ] && set -x 22 | } 23 | log_warn() { 24 | [[ -o xtrace ]] && set +x && local __XTRACE=1 25 | __log W "$@" 26 | [ "${__XTRACE:-}" ] && set -x 27 | } 28 | log_info() { 29 | [[ -o xtrace ]] && set +x && local __XTRACE=1 30 | __log I "$@" 31 | [ "${__XTRACE:-}" ] && set -x 32 | } 33 | log_debug() { 34 | [[ -o xtrace ]] && set +x && local __XTRACE=1 35 | __do_debug && __log D "$@" 36 | [ "${__XTRACE:-}" ] && set -x 37 | } 38 | 39 | # vim:ft=zsh 40 | -------------------------------------------------------------------------------- /dotfiles/zsh/zsh/rcsstub: -------------------------------------------------------------------------------- 1 | # rcsstub 2 | # 3 | # Stub for all .z* files; actual content comes from a directory 4 | # 5 | # Copyright © 1994–2008 martin f. krafft 6 | # Released under the terms of the Artistic Licence 2.0 7 | # 8 | # Source repository: git://git.madduck.net/etc/zsh.git 9 | # 10 | 11 | if [[ -o rcs ]]; then 12 | source $ZDOTDIR/logging 13 | source $ZDOTDIR/sourcedir 14 | 15 | # __do_debug && set -x || : 16 | 17 | _BASE=${${(%):-%1N}#.} 18 | eval "${(U)_BASE}_INIT=1" 19 | _DIR=$ZDOTDIR/${_BASE}.d 20 | sourcedir $_DIR 21 | 22 | if [[ -d $_DIR/parts.d ]]; then 23 | sourcedir $_DIR/parts.d 24 | fi 25 | 26 | unset _DIR 27 | eval "unset ${(U)_BASE}_INIT" 28 | unset _BASE 29 | 30 | # __do_debug && set +x || : 31 | fi 32 | 33 | # vim:ft=zsh 34 | -------------------------------------------------------------------------------- /dotfiles/zsh/zsh/sourcedir: -------------------------------------------------------------------------------- 1 | # sourcedir 2 | # 3 | # Defines helper function to source files in a directory 4 | # 5 | # Copyright © 1994–2008 martin f. krafft 6 | # Released under the terms of the Artistic Licence 2.0 7 | # 8 | # Source repository: git://git.madduck.net/etc/zsh.git 9 | # 10 | 11 | . $ZDOTDIR/logging 12 | 13 | sourcedir() { 14 | if [ ! -d "$1" ]; then 15 | log_error "no such directory: $1" 16 | return 1 17 | fi 18 | # log_debug "sourcing directory ${1#$ZDOTDIR/}" 19 | for f in "$1"/*(.N,@N); do 20 | case "$f" in 21 | *~|*.bak|*.old|*.sw?|*.zwc|*.disabled) continue;; 22 | esac 23 | # log_debug " sourcing file $f" 24 | source "$f" 25 | done 26 | } 27 | 28 | # vim:ft=zsh 29 | -------------------------------------------------------------------------------- /dotfiles/zsh/zsh/zlogin.d/10_shlvl: -------------------------------------------------------------------------------- 1 | # reset SHLVL for login shells 2 | # 3 | # Copyright © 1994–2008 martin f. krafft 4 | # Released under the terms of the Artistic Licence 2.0 5 | 6 | SHLVL=1 7 | 8 | # vim: filetype=zsh 9 | -------------------------------------------------------------------------------- /dotfiles/zsh/zsh/zlogout.d/90_logout: -------------------------------------------------------------------------------- 1 | if [ "$SHLVL" -eq 1 ]; then 2 | sudo -k 3 | have clear_console && clear_console 2>/dev/null 4 | clear 5 | fi 6 | 7 | # vim: filetype=zsh 8 | -------------------------------------------------------------------------------- /dotfiles/zsh/zsh/zprofile.d/00_common_profile: -------------------------------------------------------------------------------- 1 | if ismac && [[ -x /usr/libexec/path_helper ]]; then 2 | # Clear the path because the path_helper run in /etc/zprofile will have 3 | # messed up the order. Running it here again with an empty PATH will then 4 | # just populate it with the default values. 5 | # This is important when running tmux with a login shell. 6 | # https://superuser.com/a/583502 7 | # https://gist.github.com/ekreutz/995bb95e428358b9efa2b2f80b02143c 8 | PATH= 9 | eval $(/usr/libexec/path_helper -s) 10 | fi 11 | 12 | emulate sh -c 'source "$HOME"/.profile' 13 | 14 | # vim: filetype=zsh 15 | -------------------------------------------------------------------------------- /dotfiles/zsh/zsh/zprofile.d/99_local: -------------------------------------------------------------------------------- 1 | if [[ -f $HOME/.local/etc/zprofile ]]; then 2 | source $HOME/.local/etc/zprofile 3 | fi 4 | if [[ -d "$HOME/.local/etc/zprofile.d" ]]; then 5 | for file in $HOME/.local/etc/zprofile.d/??_*; do 6 | source "$file" 7 | done 8 | fi 9 | 10 | # vim: filetype=zsh 11 | -------------------------------------------------------------------------------- /dotfiles/zsh/zsh/zshenv.d/01_profiling: -------------------------------------------------------------------------------- 1 | # just execute 'ZSH_PROFILE_RC=1 zsh' and run 'zprof' to get the details 2 | if [[ -n $ZSH_PROFILE_RC ]] ; then 3 | zmodload zsh/zprof 4 | fi 5 | 6 | # vim: filetype=zsh 7 | -------------------------------------------------------------------------------- /dotfiles/zsh/zsh/zshenv.d/10_checks: -------------------------------------------------------------------------------- 1 | # check for versions (compatibility reasons) 2 | 3 | autoload -U is-at-least 4 | 5 | islinux() { 6 | [[ $OSTYPE == linux* ]] && return 0 7 | return 1 8 | } 9 | ismac() { 10 | [[ $OSTYPE == darwin* ]] && return 0 11 | return 1 12 | } 13 | issolaris() { 14 | [[ $OSTYPE == solaris* ]] && return 0 15 | return 1 16 | } 17 | 18 | isecs() { 19 | [[ -z "${HOST%%*ecs.vuw.ac.nz}" ]] && return 0 20 | return 1 21 | } 22 | 23 | issolaris && return 0 24 | 25 | # check for user, if not running as root set $SUDO to sudo 26 | (( EUID != 0 )) && SUDO='sudo' || SUDO='' 27 | 28 | # this function checks if a command exists and returns either true 29 | # or false. This avoids using 'which' and 'whence', which will 30 | # avoid problems with aliases for which on certain weird systems. :-) 31 | # Usage: have [-c|-g] word 32 | # -c only checks for external commands 33 | # -g does the usual tests and also checks for global aliases 34 | have() { 35 | emulate -L zsh 36 | local -i comonly gatoo 37 | 38 | if [[ $1 == '-c' ]] ; then 39 | (( comonly = 1 )) 40 | shift 41 | elif [[ $1 == '-g' ]] ; then 42 | (( gatoo = 1 )) 43 | else 44 | (( comonly = 0 )) 45 | (( gatoo = 0 )) 46 | fi 47 | 48 | if (( ${#argv} != 1 )) ; then 49 | printf 'usage: have [-c|-g] \n' >&2 50 | return 1 51 | fi 52 | 53 | if (( comonly > 0 )) ; then 54 | [[ -n ${commands[$1]} ]] && return 0 55 | return 1 56 | fi 57 | 58 | if [[ -n ${commands[$1]} ]] \ 59 | || [[ -n ${functions[$1]} ]] \ 60 | || [[ -n ${aliases[$1]} ]] \ 61 | || [[ -n ${reswords[(r)$1]} ]] ; then 62 | 63 | return 0 64 | fi 65 | 66 | if (( gatoo > 0 )) && [[ -n ${galiases[$1]} ]] ; then 67 | return 0 68 | fi 69 | 70 | return 1 71 | } 72 | 73 | # vim: filetype=zsh 74 | -------------------------------------------------------------------------------- /dotfiles/zsh/zsh/zshenv.d/20_paths: -------------------------------------------------------------------------------- 1 | normalize_path() { 2 | eval $1'=( ${(u)^'${1}':A}(N-/xe:'\''[[ "$REPLY" != "." ]]'\'':) )' 3 | } 4 | 5 | fpath=( 6 | "$HOME/.local/etc/zshfunc" 7 | "$ZDOTDIR/func" 8 | /usr/share/zsh/site-functions 9 | $fpath 10 | ) 11 | normalize_path fpath 12 | 13 | # cdpath=(.. ~) 14 | normalize_path cdpath 15 | 16 | typeset -gxT LIBRARY_PATH library_path 17 | typeset -gxT LD_LIBRARY_PATH ld_library_path 18 | 19 | # vim: filetype=zsh 20 | -------------------------------------------------------------------------------- /dotfiles/zsh/zsh/zshenv.d/30_compat: -------------------------------------------------------------------------------- 1 | # use GNU tools on *BSD 2 | # based on 3 | # https://github.com/sorin-ionescu/oh-my-zsh/blob/master/plugins/gnu-utils/init.zsh 4 | 5 | if (( $+commands[gdircolors] )); then 6 | __gnu_utils() { 7 | emulate -L zsh 8 | local gcmds 9 | local gcmd 10 | local cmd 11 | local prefix 12 | 13 | # GNU Coreutils. 14 | gcmds=('g[' 'gbase64' 'gbasename' 'gcat' 'gchcon' 'gchgrp' 'gchmod' 15 | 'gchown' 'gchroot' 'gcksum' 'gcomm' 'gcp' 'gcsplit' 'gcut' 'gdate' 16 | 'gdd' 'gdf' 'gdir' 'gdircolors' 'gdirname' 'gdu' 'gecho' 'genv' 'gexpand' 17 | 'gexpr' 'gfactor' 'gfalse' 'gfmt' 'gfold' 'ggroups' 'ghead' 'ghostid' 18 | 'gid' 'ginstall' 'gjoin' 'gkill' 'glink' 'gln' 'glogname' 'gls' 'gmd5sum' 19 | 'gmkdir' 'gmkfifo' 'gmknod' 'gmktemp' 'gmv' 'gnice' 'gnl' 'gnohup' 'gnproc' 20 | 'god' 'gpaste' 'gpathchk' 'gpinky' 'gpr' 'gprintenv' 'gprintf' 'gptx' 'gpwd' 21 | 'greadlink' 'grm' 'grmdir' 'gruncon' 'gseq' 'gsha1sum' 'gsha224sum' 22 | 'gsha256sum' 'gsha384sum' 'gsha512sum' 'gshred' 'gshuf' 'gsleep' 'gsort' 23 | 'gsplit' 'gstat' 'gstty' 'gsum' 'gsync' 'gtac' 'gtail' 'gtee' 'gtest' 24 | 'gtimeout' 'gtouch' 'gtr' 'gtrue' 'gtruncate' 'gtsort' 'gtty' 'guname' 25 | 'gunexpand' 'guniq' 'gunlink' 'guptime' 'gusers' 'gvdir' 'gwc' 'gwho' 26 | 'gwhoami' 'gyes') 27 | 28 | # Not part of coreutils, installed separately. 29 | gcmds+=('ggrep' 'gsed' 'gtar' 'gtime') 30 | 31 | for gcmd in "$gcmds[@]"; do 32 | # This method allows for builtin commands to be primary but it's 33 | # lost if hash -r or rehash -f is executed. Thus, those two 34 | # functions have to be wrapped. 35 | if (( $+commands[$gcmd] )); then 36 | hash "$gcmd[2,-1]"="$commands[$gcmd]" 37 | fi 38 | done 39 | 40 | return 0 41 | } 42 | __gnu_utils; 43 | 44 | hash() { 45 | if (( $+argv[(er)-r] )) || (( $+argv[(er)-f] )); then 46 | builtin hash "$@" 47 | __gnu_utils 48 | else 49 | builtin hash "$@" 50 | fi 51 | } 52 | 53 | rehash() { 54 | hash -r "$@" 55 | } 56 | fi 57 | 58 | # vim: filetype=zsh 59 | -------------------------------------------------------------------------------- /dotfiles/zsh/zsh/zshenv.d/90_misc: -------------------------------------------------------------------------------- 1 | # make sure the value of SHELL is an absolute path 2 | export SHELL=$(which zsh) 3 | 4 | if [[ -f $HOME/.local/etc/zshenv ]]; then 5 | source $HOME/.local/etc/zshenv 6 | fi 7 | if [[ -d "$HOME/.local/etc/zshenv.d" ]]; then 8 | for file in $HOME/.local/etc/zshenv.d/??_*; do 9 | source "$file" 10 | done 11 | fi 12 | 13 | # Disable some features from Debian's /etc/zsh/zshrc 14 | DEBIAN_PREVENT_KEYBOARD_CHANGES=1 15 | skip_global_compinit=1 16 | 17 | # Disable shell sessions in macOS's Terminal app 18 | SHELL_SESSIONS_DISABLE=1 19 | 20 | # vim: filetype=zsh 21 | -------------------------------------------------------------------------------- /dotfiles/zsh/zsh/zshrc.d/00_autoload: -------------------------------------------------------------------------------- 1 | zmodload -F zsh/stat b:zstat 2 | 3 | # autoload all executable files in $fpath 4 | autoload -U $^fpath/*(.xN:t) 5 | 6 | autoload -U zmv 7 | 8 | autoload -U zrecompile 9 | 10 | autoload -U colors; colors 11 | 12 | autoload -U add-zsh-hook 13 | 14 | autoload run-help 15 | autoload run-help-git 16 | autoload run-help-sudo 17 | autoload run-help-svn 18 | 19 | # vim: filetype=zsh 20 | -------------------------------------------------------------------------------- /dotfiles/zsh/zsh/zshrc.d/10_options: -------------------------------------------------------------------------------- 1 | umask 022 2 | 3 | # in order to use #, ~ and ^ for filename generation 4 | # $ grep word *~(*.gz|*.bz|*.bz2|*.zip|*.Z) 5 | # -> searches for word not in compressed files 6 | # don't forget to quote '^', '~' and '#'! 7 | setopt extended_glob 8 | 9 | setopt numeric_glob_sort 10 | 11 | setopt prompt_subst 12 | 13 | # disable backslash escapes unless -e is given 14 | setopt bsd_echo 15 | 16 | # don't kill background jobs when exiting shell 17 | setopt no_hup 18 | 19 | # display pid when suspending jobs 20 | setopt long_list_jobs 21 | 22 | # report the status of backgrounds jobs immediately 23 | setopt notify 24 | 25 | # print exit value of programs if not 0 26 | # setopt print_exit_value 27 | 28 | # try to avoid the 'zsh: no matches found...' 29 | setopt no_nomatch 30 | 31 | setopt no_beep 32 | setopt interactive_comments 33 | 34 | # more brace expansion (e.g. {0-9}) 35 | setopt brace_ccl 36 | 37 | # warn when overwriting files with output redirection 38 | # '>!'/'>|' and '>>!'/'>>|' to force 39 | setopt no_clobber 40 | 41 | # set $0 to name of current function or script 42 | setopt function_argzero 43 | 44 | # ctrl-s will no longer freeze the terminal. 45 | setopt no_flow_control 46 | stty -ixoff 47 | stty -ixon 48 | 49 | setopt correct 50 | 51 | setopt pipe_fail 52 | 53 | # watch for everyone but me and root 54 | watch=(notme root) 55 | 56 | # use emacs style per default: 57 | bindkey -e 58 | # use vi style: 59 | # bindkey -v 60 | 61 | # vim: filetype=zsh 62 | -------------------------------------------------------------------------------- /dotfiles/zsh/zsh/zshrc.d/11_prevars: -------------------------------------------------------------------------------- 1 | typeset -gi __last_cmd_exitstatus 2 | 3 | _record_exitstatus() { 4 | __last_cmd_exitstatus=$(print -P "%?") 5 | } 6 | add-zsh-hook precmd _record_exitstatus 7 | 8 | # vim: filetype=zsh 9 | -------------------------------------------------------------------------------- /dotfiles/zsh/zsh/zshrc.d/14_dircycle: -------------------------------------------------------------------------------- 1 | # handle moved or deleted and then recreated directories 2 | _dir_cycle() { 3 | local dir="$PWD" 4 | if ! [[ . -ef "$PWD" ]]; then 5 | if (cd . && [[ $(pwd) == "$dir" || $(pwd) == "." ]] && ! cd "$dir" &>/dev/null); then 6 | local -a cmd; cmd=(${(z)1}) 7 | if [[ "$1" == "" || "${cmd[1]}" != "cd" ]]; then 8 | echo "Warning: ${dir} does no longer exist" 9 | return 1 10 | fi 11 | else 12 | cd . 13 | cd . 14 | if [[ "$PWD" != "$dir" ]]; then 15 | echo "zsh: Directory moved from ${dir/#$HOME/~} to ${PWD/#$HOME/~}" 16 | fi 17 | fi 18 | fi 19 | } 20 | add-zsh-hook precmd _dir_cycle 21 | add-zsh-hook preexec _dir_cycle 22 | 23 | # vim: filetype=zsh 24 | -------------------------------------------------------------------------------- /dotfiles/zsh/zsh/zshrc.d/16_colours: -------------------------------------------------------------------------------- 1 | # Enable colour for BSD ls and a few other tools 2 | export CLICOLOR=1 3 | 4 | typeset -g __toggledark_timestamp 5 | typeset -ga _update_colours_funcs 6 | 7 | _update_colours() { 8 | local mode 9 | if is-dark-mode; then 10 | mode="dark" 11 | else 12 | mode="light" 13 | fi 14 | for func in ${_update_colours_funcs[@]}; do 15 | $func $mode 16 | done 17 | } 18 | 19 | _check_update_colours() { 20 | local timestamp 21 | if [[ -f "$XDG_STATE_HOME/toggledark" ]]; then 22 | timestamp=$(zstat +ctime "$XDG_STATE_HOME/toggledark") 23 | else 24 | timestamp=0 25 | fi 26 | if (( timestamp > __toggledark_timestamp )); then 27 | _update_colours 28 | fi 29 | __toggledark_timestamp=$timestamp 30 | } 31 | add-zsh-hook preexec _check_update_colours 32 | 33 | 34 | _update_ls_colors() { 35 | if [[ "$1" == dark ]]; then 36 | LS_COLORS=$(vivid generate molokai) 37 | else 38 | LS_COLORS=$(vivid generate ayu) 39 | fi 40 | zstyle ':completion:*:default' list-colors 'hi=30;41' 'du=37;41' ${(s.:.)LS_COLORS} 41 | } 42 | if have vivid; then 43 | _update_colours_funcs+=_update_ls_colors 44 | _update_ls_colors 45 | export LS_COLORS 46 | else 47 | eval "$(dircolors -b "$DOTFILES/shell-common/dircolors")" 2>/dev/null || : 48 | zstyle ':completion:*:default' list-colors 'hi=30;41' 'du=37;41' ${(s.:.)LS_COLORS} 49 | fi 50 | 51 | ls-colors() { 52 | echo "$LS_COLORS" | tr : '\n' | sed 's/\(.*\)=\(.*\)/\x1b[\2m\1\t\2\x1b[0m/' 53 | } 54 | 55 | 56 | # Set correct colours before the first preexec call 57 | _check_update_colours 58 | 59 | # vim: filetype=zsh 60 | -------------------------------------------------------------------------------- /dotfiles/zsh/zsh/zshrc.d/20_dirhashes: -------------------------------------------------------------------------------- 1 | hash -d doc=/usr/share/doc 2 | hash -d log=/var/log 3 | 4 | # From https://github.com/vincentbernat/zshrc/blob/master/rc/bookmarks.zsh 5 | # 6 | # Handle bookmarks. This uses the static named directories feature of 7 | # zsh. Such directories are declared with `hash -d 8 | # name=directory`. Both prompt expansion and completion know how to 9 | # handle them. We populate the hash with directories. 10 | 11 | MARKPATH=$ZSH_STATE_DIR/marks 12 | 13 | # Populate the hash 14 | for link ($MARKPATH/*(N@)) { 15 | hash -d -- ${link:t}=${link:A} 16 | } 17 | 18 | # Manage bookmarks 19 | bookmark() { 20 | [[ -d $MARKPATH ]] || mkdir -p $MARKPATH 21 | if (( $# == 0 )); then 22 | # When no arguments are provided, just display existing 23 | # bookmarks 24 | for link in $MARKPATH/*(N@); do 25 | local markname="$fg[green]${link:t}$reset_color" 26 | local markpath="$fg[blue]${link:A}$reset_color" 27 | printf "%-30s -> %s\n" $markname $markpath 28 | done 29 | else 30 | # Otherwise, we may want to add a bookmark or delete an 31 | # existing one. 32 | local -a delete 33 | zparseopts -D d=delete 34 | if (( $+delete[1] )); then 35 | # With `-d`, we delete an existing bookmark 36 | command rm $MARKPATH/$1 37 | else 38 | # Otherwise, add a bookmark to the current 39 | # directory. The first argument is the bookmark 40 | # name. `.` is special and means the bookmark should 41 | # be named after the current directory. 42 | local name=$1 43 | [[ $name == "." ]] && name=${PWD:t} 44 | ln -s $PWD $MARKPATH/$name 45 | hash -d -- ${name}=${PWD} 46 | fi 47 | fi 48 | } 49 | 50 | # vim: filetype=zsh 51 | -------------------------------------------------------------------------------- /dotfiles/zsh/zsh/zshrc.d/30_osx: -------------------------------------------------------------------------------- 1 | # based on 2 | # https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/osx 3 | 4 | if ismac; then 5 | 6 | # Show/hide hidden files in the Finder 7 | alias showfiles="defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder" 8 | alias hidefiles="defaults write com.apple.finder AppleShowAllFiles -bool false && killall Finder" 9 | 10 | # Return the path of the frontmost Finder window 11 | pfd() { 12 | osascript 2>/dev/null </dev/null < 0 )) && qlmanage -p "$@" &> /dev/null &| 41 | } 42 | 43 | fi 44 | 45 | # vim: filetype=zsh 46 | -------------------------------------------------------------------------------- /dotfiles/zsh/zsh/zshrc.d/80_dirstack: -------------------------------------------------------------------------------- 1 | # make cd push the old directory onto the directory stack. 2 | setopt auto_pushd 3 | 4 | # Don't push multiple copies of the same directory onto the directory stack. 5 | setopt pushd_ignore_dups 6 | 7 | # Exchanges the meanings of `+' and `-' when used with a number to specify a 8 | # directory in the stack. 9 | setopt pushd_minus 10 | 11 | # Do not print the directory stack after pushd or popd. 12 | setopt pushd_silent 13 | 14 | DIRSTACKSIZE=20 15 | DIRSTACKFILE=$ZSH_STATE_DIR/zdirs 16 | 17 | if [[ -f ${DIRSTACKFILE} ]] && [[ ${#dirstack[*]} -eq 0 ]] ; then 18 | dirstack=( ${(f)"$(< $DIRSTACKFILE)"} ) 19 | # "cd -" won't work after login by just setting $OLDPWD, so 20 | is_local=1 21 | if have findmnt; then 22 | # Check whether the old directory is on a remote filesystem that may hang 23 | for mount in $(findmnt -o target -t nfs4 -l | tail -n +2); do 24 | if [[ $dirstack[1] =~ ^${mount}(/.*)?$ ]]; then 25 | is_local=0 26 | break 27 | fi 28 | done 29 | fi 30 | if (( is_local )); then 31 | [[ -d $dirstack[1] ]] && cd $dirstack[1] && cd $OLDPWD 32 | fi 33 | fi 34 | 35 | _update_dirstack() { 36 | local -ax my_stack 37 | my_stack=( ${PWD} ${dirstack} ) 38 | builtin print -l ${(u)my_stack} >! ${DIRSTACKFILE} 39 | } 40 | if [[ "$INCOGNITO" != 1 ]]; then 41 | add-zsh-hook chpwd _update_dirstack 42 | fi 43 | 44 | # vim: filetype=zsh 45 | -------------------------------------------------------------------------------- /dotfiles/zsh/zsh/zshrc.d/80_history: -------------------------------------------------------------------------------- 1 | # append history list to the history file 2 | # (important for multiple parallel zsh sessions!) 3 | setopt append_history 4 | 5 | # import new commands from the history file also in other zsh-sessions 6 | setopt share_history 7 | 8 | # save each command's beginning timestamp and the duration to the history file 9 | setopt extended_history 10 | 11 | # If a new command line being added to the history list duplicates an older 12 | # one, the older command is removed from the list 13 | setopt hist_ignore_all_dups 14 | 15 | # remove command lines from the history list when the first character on the 16 | # line is a space 17 | setopt hist_ignore_space 18 | 19 | # use proper shell splitting for words read from history 20 | setopt hist_lex_words 21 | 22 | if [[ "$INCOGNITO" == 1 ]]; then 23 | unset HISTFILE 24 | else 25 | HISTFILE=$ZSH_STATE_DIR/history 26 | fi 27 | HISTSIZE=100000 28 | SAVEHIST=100000 29 | 30 | _hist_ignore_f() { 31 | typeset -a cmd 32 | cmd=(${(z)${1%%$'\n'}}) 33 | if [[ ${#cmd} -ge 1 && "${cmd[1]}" == "f" ]]; then 34 | return 1 35 | fi 36 | return 0 37 | } 38 | add-zsh-hook zshaddhistory _hist_ignore_f 39 | 40 | # vim: filetype=zsh 41 | -------------------------------------------------------------------------------- /dotfiles/zsh/zsh/zshrc.d/80_reporting: -------------------------------------------------------------------------------- 1 | # report about cpu-/system-/user-time of command 2 | # if running longer than 5 seconds 3 | # REPORTTIME=5 4 | 5 | zmodload zsh/datetime 6 | 7 | typeset -g __last_cmd 8 | typeset -g __last_cmd_dir 9 | typeset -g __last_cmd_time 10 | 11 | _record_cmd() { 12 | __last_cmd="$1" 13 | __last_cmd_dir="${(D)PWD}" 14 | __last_cmd_time=$(print -P "%D{%s}") 15 | } 16 | add-zsh-hook preexec _record_cmd 17 | 18 | alert() { 19 | local urgency 20 | local summary 21 | if (( __last_cmd_exitstatus == 0 )); then 22 | urgency=normal 23 | summary="✅ Background job finished" 24 | else 25 | urgency=critical 26 | summary="❌ Background job failed" 27 | fi 28 | 29 | if islinux; then 30 | local body="\$ $__last_cmd\n${__last_cmd_dir}" 31 | notify-send \ 32 | --icon terminal \ 33 | --expire-time=10000 \ 34 | --transient \ 35 | --urgency=$urgency "$summary" "$body" 36 | 37 | # set urgent hint on window 38 | tput bel 39 | elif ismac; then 40 | osascript -e "display notification \"\$ ${__last_cmd//\\/\\\\}\" with title \"$summary\" subtitle \"$__last_cmd_dir\"" 41 | tmux-echo '\e]1337;RequestAttention=yes\a' 42 | fi 43 | } 44 | 45 | _alert_bg_job_finished() { 46 | [[ -z "$__last_cmd" ]] && return 47 | [[ -n "$SSH_CONNECTION" ]] && return 48 | [[ "$TERM_PROGRAM" == vscode ]] && return 49 | is-active-shell && return 50 | 51 | alert 52 | } 53 | add-zsh-hook precmd _alert_bg_job_finished 54 | 55 | _clear_last_cmd() { 56 | __last_cmd="" 57 | __last_cmd_dir="" 58 | } 59 | add-zsh-hook precmd _clear_last_cmd 60 | 61 | 62 | # vim: filetype=zsh 63 | -------------------------------------------------------------------------------- /dotfiles/zsh/zsh/zshrc.d/85_prompt: -------------------------------------------------------------------------------- 1 | __prompt_orighome() { 2 | if [[ $HOME != $ORIGHOME ]]; then 3 | print "%F{246}${PWD/$ORIGHOME/\~}%f" 4 | fi 5 | } 6 | 7 | export STARSHIP_CONFIG=$DOTFILES/starship.toml 8 | eval "$(starship init zsh)" 9 | 10 | RPS1='$(__prompt_orighome)' 11 | 12 | PS2="%B%_%b %(!.#.>) " 13 | PS3='?# ' # selection prompt used within a select loop. 14 | PS4='+[%D{%H:%M:%S.%.}]:%N:%i:%_> ' # the execution trace prompt (setopt xtrace). default: '+%N:%i>' 15 | 16 | PROMPT_EOL_MARK=%B⏎%b 17 | 18 | # vim: filetype=zsh 19 | -------------------------------------------------------------------------------- /dotfiles/zsh/zsh/zshrc.d/85_titles: -------------------------------------------------------------------------------- 1 | _update_terminal_title() { 2 | if [[ -n "$1" ]]; then 3 | set_terminal_title "${1}" 4 | elif [[ -n "$SSH_CLIENT" ]]; then 5 | set_terminal_title "${(%):-%m}" 6 | else 7 | set_terminal_title "${(%):-%(4~|…/%3~|%~)}" 8 | fi 9 | } 10 | add-zsh-hook precmd _update_terminal_title 11 | 12 | 13 | _simplify_cmd() { 14 | # get first word of command that doesn't match the pattern 15 | local pattern="^(*=*|sudo|(auto)?ssh|-*)" 16 | local cmd="${1[(wr)${pattern}]}" 17 | 18 | # only retain part after last / 19 | cmd="${cmd//*\//}" 20 | 21 | # if running under ssh append @host 22 | if [[ -n $SSH_CLIENT ]]; then 23 | cmd+="@${(%):-%m}" 24 | fi 25 | 26 | print -n "$cmd" 27 | } 28 | 29 | # adapted from 30 | # http://git.madduck.net/v/etc/zsh.git/blob/HEAD:/.zsh/zshrc/85_xtermtitle 31 | _update_exec_titles() { 32 | # split up the command line 33 | local -a cmd; cmd=(${(z)3}) 34 | 35 | # Construct a command that will output the desired job number. 36 | case $cmd[1] in 37 | fg) if (( $#cmd == 1 )); then 38 | # No arguments, must find the current job 39 | cmd=(builtin jobs -l %+) 40 | else 41 | # Replace the command name, ignore extra args. 42 | cmd=(builtin jobs -l ${(Q)cmd[1]}) 43 | fi;; 44 | %*) cmd=(builtin jobs -l ${(Q)cmd[1]});; # Same as "else" above 45 | *) # Not resuming a job, 46 | _update_terminal_title "$(_simplify_cmd "$cmd")" 47 | return;; # so we're all done 48 | esac 49 | 50 | local -A jt; jt=(${(kv)jobtexts}) # Copy jobtexts for subshell 51 | 52 | # Run the command, read its output, and look up the jobtext. 53 | # Could parse $rest here, but $jobtexts (via $jt) is easier. 54 | $cmd >>( 55 | read num rest 56 | cmd=(${(z)${(e):-\$jt$num}}) 57 | _update_terminal_title "$(_simplify_cmd "$cmd")" 58 | ) 59 | } 60 | add-zsh-hook preexec _update_exec_titles 61 | 62 | # vim: filetype=zsh 63 | -------------------------------------------------------------------------------- /dotfiles/zsh/zsh/zshrc.d/90_cleanfiles: -------------------------------------------------------------------------------- 1 | # remove files we never want to keep around 2 | # 3 | # Copyright © 1994–2008 martin f. krafft 4 | # Released under the terms of the Artistic Licence 2.0 5 | 6 | typeset -la rmfiles 7 | 8 | # rmfiles+=~/.*.sw[mnop](N) 9 | rmfiles+=~/.bash_history 10 | rmfiles+=~/.bzr.log 11 | # rmfiles+=~/.cshrc 12 | rmfiles+=~/.fonts.cache-1 13 | # rmfiles+=~/.gksu.lock 14 | rmfiles+=~/.less 15 | rmfiles+=~/.lesshst 16 | rmfiles+=~/.viminfo 17 | rmfiles+=~/core 18 | # rmfiles+=~/hs_err_pid[0-9]*.log 19 | # rmfiles+=~/minicom.log 20 | # rmfiles+=~/java.log.*(N) 21 | # rmfiles+=~/jpilot.log 22 | # rmfiles+=~/nohup.out 23 | # rmfiles+=~/plugin131.trace 24 | # rmfiles+=~/srtp.log 25 | # rmfiles+=~/typescript 26 | rmfiles+=~/unison.log 27 | 28 | typeset -la _rmfiles 29 | 30 | for f in ${~rmfiles}; do 31 | [[ -f $f ]] || continue 32 | _rmfiles+="$f" 33 | done 34 | 35 | 36 | if (( $#_rmfiles )); then 37 | log_info "Removing files: ${_rmfiles[@]#$HOME/}..." 38 | rm -f ${_rmfiles[@]} 39 | fi 40 | 41 | unset _rmfiles 42 | 43 | # vim:ft=zsh 44 | -------------------------------------------------------------------------------- /dotfiles/zsh/zsh/zshrc.d/98_misc: -------------------------------------------------------------------------------- 1 | lazy_load() { 2 | local load_func=$1 3 | local lazy_func="lazy_${load_func}" 4 | shift 5 | 6 | eval " 7 | function $@ { 8 | for func in $@; do 9 | if (( \$+functions[\$func] )); then 10 | unfunction \$func 11 | fi 12 | done 13 | eval $load_func 14 | unfunction $load_func 15 | \"\$0\" \"\$@\" 16 | } 17 | " 18 | } 19 | # lazy_load cmd1 cmd2 ... 20 | 21 | 22 | if [[ "$INCOGNITO" != 1 ]]; then 23 | eval "$(atuin init zsh)" 24 | 25 | # Adapted from 26 | # https://leahneukirchen.org/blog/archive/2013/03/10-fresh-zsh-tricks-you-may-not-know.html 27 | autoload -Uz narrow-to-region 28 | _atuin_search_nested() { 29 | local state 30 | MARK=CURSOR 31 | narrow-to-region -S state 32 | LBUFFER+=$(RUST_LOG=error atuin search $* -i 3>&1 1>&2 2>&3) 33 | narrow-to-region -R state 34 | zle reset-prompt 35 | } 36 | zle -N _atuin_search_nested 37 | bindkey -M emacs '\er' _atuin_search_nested 38 | bindkey -M vicmd '\er' _atuin_search_nested 39 | bindkey -M viins '\er' _atuin_search_nested 40 | fi 41 | 42 | if have mise; then 43 | eval "$(mise activate zsh)" 44 | fi 45 | 46 | export PNPM_HOME="$XDG_DATA_HOME/pnpm" 47 | path+="$PNPM_HOME" 48 | alias pn=pnpm 49 | 50 | for dir in "$XDG_DATA_HOME"/gem/ruby/*/bin; do 51 | path+="$dir" 52 | done 53 | 54 | if [[ -f $HOME/.local/etc/zshrc ]]; then 55 | source $HOME/.local/etc/zshrc 56 | fi 57 | if [[ -d $HOME/.local/etc/zshrc.d ]]; then 58 | for file in $HOME/.local/etc/zshrc.d/??_*(N); do 59 | source "$file" 60 | done 61 | fi 62 | 63 | mkdir -p $HOME/.ssh/sock 64 | 65 | # Needs to happen late since manpath automatically finds man locations 66 | # based on PATH 67 | if [[ -z "$MANPATH" ]]; then 68 | MANPATH="$(manpath)" 69 | else 70 | MANPATH="$MANPATH:$(MANPATH= manpath)" 71 | fi 72 | export MANPATH 73 | 74 | for patharray in path manpath library_path ld_library_path; do 75 | normalize_path $patharray 76 | done 77 | 78 | # vim: filetype=zsh 79 | -------------------------------------------------------------------------------- /dotfiles/zsh/zsh/zshrc.d/99_pipenv: -------------------------------------------------------------------------------- 1 | # Ported from https://github.com/kennethreitz/fish-pipenv/blob/master/conf.d/pipenv.fish 2 | 3 | if have -c pipenv; then 4 | if ! [[ -e "$HOME/.local/etc/zshfunc/_pipenv" ]]; then 5 | mkdir -p "$HOME/.local/etc/zshfunc" 6 | pipenv --completion > "$HOME/.local/etc/zshfunc/_pipenv" 7 | fi 8 | 9 | chpwd_pipenv() { 10 | local pwd_file="$XDG_CACHE_HOME/zsh/pipenv-pwd" 11 | 12 | if ! [[ -f "$PWD/Pipfile" ]]; then 13 | if [[ $PWD != $__pipenv_base_wd/* ]]; then 14 | echo "$PWD" > "$pwd_file" 15 | exit 16 | fi 17 | return 18 | fi 19 | 20 | if ! [[ -n "$PIPENV_ACTIVE" ]]; then 21 | if pipenv --venv &> /dev/null; then 22 | export __pipenv_base_wd="$PWD" 23 | 24 | pipenv shell --fancy 25 | 26 | unset __pipenv_base_wd 27 | 28 | if [[ -f "$pwd_file" ]]; then 29 | local pipenv_pwd 30 | read pipenv_pwd < "$pwd_file" 31 | cd "$pipenv_pwd" 32 | rm "$pwd_file" 33 | fi 34 | fi 35 | fi 36 | } 37 | 38 | add-zsh-hook chpwd chpwd_pipenv 39 | fi 40 | 41 | # vim: filetype=zsh 42 | -------------------------------------------------------------------------------- /dotfiles/zsh/zsh/zshrc.d/99_tmux: -------------------------------------------------------------------------------- 1 | # start tmux if not already in it or running a dumb terminal 2 | 3 | # 'rxvt' is needed for dvtm 4 | # if [[ ! "$TERM" =~ ^\(screen.*\|rxvt\|dumb\|vt100\)$ ]] \ 5 | # && [[ -z "$TMUX" ]] \ 6 | # && [[ -z "$TMUX_DISABLE" ]] \ 7 | # && [[ -z "$ZSHRUN" ]] \ 8 | # && [[ -z "$VIM" ]] \ 9 | # && [[ "$TERM_PROGRAM" != vscode ]] \ 10 | # && [[ "$TERMINAL_EMULATOR" != JetBrains-JediTerm ]]; then 11 | # export ORIGTERM=$TERM 12 | # export ORIGCOLORTERM=$COLORTERM 13 | # unset TMUX 14 | # tmux new-session 15 | # fi 16 | 17 | # update session environment variables if they got changed after re-attaching 18 | # a tmux session 19 | if [[ -n "$TMUX" ]]; then 20 | _update_from_tmux() { 21 | # Remove need to detach/re-attach after using session in different client 22 | # See also https://groups.google.com/forum/#!topic/tmux-users/UZFikgdglJU 23 | tmux switch-client 24 | eval "$(tmux show-environment -s)" 25 | } 26 | add-zsh-hook precmd _update_from_tmux 27 | add-zsh-hook preexec _update_from_tmux 28 | fi 29 | 30 | # vim: filetype=zsh 31 | -------------------------------------------------------------------------------- /dotfiles/zsh/zsh/zshrc.d/99_zshrun: -------------------------------------------------------------------------------- 1 | # Adapted from: 2 | # http://www.zsh.org/mla/workers//2015/msg01110.html 3 | # http://mika.l3ib.org/code/dot-zshrc 4 | 5 | if [[ -n "$ZSHRUN" ]]; then 6 | PS1=$'%Bzshrun%b %F{2}%~%f> ' 7 | 8 | setopt hist_ignore_all_dups 9 | unsetopt share_history 10 | HISTFILE=$ZSH_STATE_DIR/zshrun-history 11 | 12 | unset ZSHRUN 13 | 14 | unsetopt correct 15 | unsetopt checkjobs 16 | setopt nohup 17 | 18 | _accept_and_quit() { 19 | local -a buf 20 | buf=(${(z)BUFFER}) 21 | if have -c $buf[1]; then 22 | print -sr -- "${BUFFER}" 23 | print -s 24 | zsh -c "${BUFFER}" 0>&- 1>&- 2>&- &| 25 | exit 26 | else 27 | zle -M "Command $buf[1] not found" 28 | fi 29 | } 30 | zle -N _accept_and_quit 31 | bindkey "^M" _accept_and_quit 32 | 33 | _exit() { 34 | exit 35 | } 36 | zle -N _exit 37 | bindkey "\e" _exit 38 | fi 39 | 40 | # vim: filetype=zsh 41 | -------------------------------------------------------------------------------- /dotfiles/zsh/zshenv: -------------------------------------------------------------------------------- 1 | ZDOTDIR={{@@ _dotdrop_dotpath @@}}/zsh/zsh 2 | [ -f $ZDOTDIR/.zshenv ] && . $ZDOTDIR/.zshenv 3 | --------------------------------------------------------------------------------