Initial config

This commit is contained in:
Wekuz 2026-03-29 00:11:55 +02:00
commit b54ad20782
Signed by: Wekuz
GPG key ID: 2E502F2AABD32DF9
94 changed files with 5895 additions and 0 deletions

1
.chezmoiignore Normal file
View file

@ -0,0 +1 @@
.config/zsh/plugins/*

View file

@ -0,0 +1,52 @@
[global]
origin = top-right
offset = (10, 20)
notification_limit = 20
progress_bar = true
progress_bar_corner_radius = 2
progress_bar_corners = all
icon_corner_radius = 2
icon_corners = all
indicate_hidden = yes
frame_color = "#909090"
sort = true
idle_threshold = 5m
font = JetBrainsMonoNLNFM-Regular 8
markup = full
# format =
alignment = left
vertical-alignment = center
show_age_threshold = 60
ignore_newline = no
stack_duplicates = true
hide_duplicate_count = false
show_indicators = yes
icon_theme = Papirus-Dark
enable_recursive_icon_lookup = true
icon_position = left
history_length = 25
# dmenu = /usr/bin/fuzzel --dmenu dunst
browser = /usr/bin/xdg-open
corner_radius = 4
corners = all
[urgency_low]
background = "#222222"
foreground = "#909090"
timeout = 10
default_icon = dialog-information # TODO
[urgency_normal]
background = "#444455"
foreground = "#ffffff"
timeout = 10
override_pause_level = 30
default_icon = dialog-information # TODO
[urgency_critical]
background = "#900000"
foreground = "#ffffff"
frame_color = "#ff0000"
timeout = 0
override_pause_level = 60
default_icon = dialog-warning # TODO

View file

@ -0,0 +1,23 @@
font=monospace
prompt="> "
lines=15
width=40
horizontal-pad=10
vertical-pad=10
line-height=18
layer = top
exit-on-keyboard-focus-loss = yes
launch-prefix="uwsm app -- "
[colors]
background=333333f0
text=ffffffff
match=00bb00ff
selection-match=00bb00ff
selection=666666dd
selection-text=ffffffff
border=646464ff
[border]
width=2
radius=10

View file

@ -0,0 +1,19 @@
[user]
name = Wekuz
email = wekuz@duck.com
signingkey = 2E502F2AABD32DF9
[commit]
gpgsign = true
verbose = true
cleanup = scissors
[init]
defaultBranch = main
[diff]
algorithm = histogram
colorMoved = plain
[merge]
conflictstyle = zdiff3
[tag]
sort = version:refname
[help]
autoCorrect = prompt

View file

@ -0,0 +1,17 @@
[Settings]
gtk-theme-name=Adwaita-dark
gtk-icon-theme-name=Adwaita
gtk-font-name=JetBrainsMono Nerd Font 12
gtk-cursor-theme-name=Nordzy-cursors
gtk-cursor-theme-size=24
gtk-toolbar-style=GTK_TOOLBAR_ICONS
gtk-toolbar-icon-size=GTK_ICON_SIZE_LARGE_TOOLBAR
gtk-button-images=0
gtk-menu-images=0
gtk-enable-event-sounds=1
gtk-enable-input-feedback-sounds=0
gtk-xft-antialias=1
gtk-xft-hinting=1
gtk-xft-hintstyle=hintslight
gtk-xft-rgba=rgb
gtk-application-prefer-dark-theme=1

View file

@ -0,0 +1,7 @@
[Settings]
gtk-theme-name=Adwaita-dark
gtk-icon-theme-name=Adwaita
gtk-font-name=JetBrainsMono Nerd Font 12
gtk-cursor-theme-name=Nordzy-cursors
gtk-cursor-theme-size=24
gtk-application-prefer-dark-theme=1

View file

@ -0,0 +1,27 @@
general {
lock_cmd = pidof hyprlock || hyprlock
before_sleep_cmd = loginctl lock-session
after_sleep_cmd = hyprctl dispatch dpms on
}
listener {
timeout = 300
on-timeout = brightnessctl -s s 1%
on-resume = brightnessctl -r
}
listener {
timeout = 330
on-timeout = hyprctl dispatch dpms off
on-resume = hyprctl dispatch dpms on
}
#listener {
# timeout = 600
# on-timeout = loginctl lock-session
#}
# listener {
# timeout = 900
# on-timeout = systemctl suspend
# }

View file

@ -0,0 +1,55 @@
$font = JetBrainsMono Nerd Font
general {
ignore_empty_input = true
no_fade_out = true
hide_cursor = true
}
background {
monitor =
color = rgba(0, 0, 0, 1.0)
}
label {
monitor =
text = $TIME
font_family = $font
font_size = 90
color = rgba(170, 170, 170, 1.0)
position = 0, -10%
halign = center
valign = top
}
input-field {
monitor =
size = 15%, 5%
outline_thickness = 3
inner_color = rgba(0, 0, 0, 1.0)
placeholder_text =
font_family = $font
font_color = rgba(150, 150, 150, 1.0)
fade_on_empty = false
rounding = 15
position = 0, 0
halign = center
valign = center
}
label {
monitor =
text = Failed attempts: $ATTEMPTS
font_family = $font
font_size = 12
color = rgba(100, 100, 100, 1.0)
position = 0, -3.5%
halign = center
valign = center
}

View file

@ -0,0 +1,2 @@
preload = ~/.config/wallpapers/wallpaper.png
wallpaper = , ~/.config/wallpapers/wallpaper.png

View file

@ -0,0 +1,279 @@
################
### MONITORS ###
################
xwayland {
force_zero_scaling = true
}
###################
### MY PROGRAMS ###
###################
$terminal = uwsm app -- kitty
$browser = uwsm app -- zen-browser
$hyprlock = uwsm app -- hyprlock
$hyprshot = uwsm app -- hyprshot
$menu = uwsm app -- fuzzel
#################
### AUTOSTART ###
#################
exec-once = uwsm app -- waybar
exec-once = uwsm app -- dunst
exec-once = uwsm app -- wl-paste --watch cliphist store
exec-once = uwsm app -- hypridle
exec-once = uwsm app -- hyprpaper
exec-once = uwsm app -- hyprsunset
exec-once = uwsm app -- rslsync
exec-once = [workspace 1] $terminal
exec-once = [workspace 2 silent] $browser
#############################
### ENVIRONMENT VARIABLES ###
#############################
# See https://wiki.hyprland.org/Configuring/Environment-variables/
# Environment variables stored in ~/.config/uwsm/env and ~/.config/uwsm/env-hyprland
#####################
### LOOK AND FEEL ###
#####################
# Refer to https://wiki.hyprland.org/Configuring/Variables/
# https://wiki.hyprland.org/Configuring/Variables/#general
general {
gaps_in = 1
gaps_out = 0
border_size = 2
col.active_border = rgba(00cc00ff) rgba(00aa00ff) 90deg
col.inactive_border = rgba(646464aa)
# Please see https://wiki.hyprland.org/Configuring/Tearing/ before you turn this on
allow_tearing = false
layout = dwindle
}
# https://wiki.hyprland.org/Configuring/Variables/#decoration
decoration {
rounding = 0
active_opacity = 1.0
inactive_opacity = 1.0
shadow {
enabled = false
range = 4
render_power = 3
color = rgba(151515ee)
}
# https://wiki.hyprland.org/Configuring/Variables/#blur
blur {
enabled = false
size = 3
passes = 1
vibrancy = 0.1696
}
}
# https://wiki.hyprland.org/Configuring/Variables/#animations
animations {
enabled = yes
# Default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more
bezier = easeOutQuint,0.23,1,0.32,1
bezier = easeInOutCubic,0.65,0.05,0.36,1
bezier = linear,0,0,1,1
bezier = almostLinear,0.5,0.5,0.75,1.0
bezier = quick,0.15,0,0.1,1
animation = global, 1, 10, default
animation = border, 1, 5.39, easeOutQuint
animation = windows, 1, 3.5, easeOutQuint
animation = windowsIn, 1, 2, easeOutQuint, popin 87%
animation = windowsOut, 2, 2, linear, popin 87%
animation = fadeIn, 1, 1.73, almostLinear
animation = fadeOut, 1, 1.46, almostLinear
animation = fade, 1, 3.03, quick
animation = layers, 1, 3.81, easeOutQuint
animation = layersIn, 1, 4, easeOutQuint, fade
animation = layersOut, 1, 1.5, linear, fade
animation = fadeLayersIn, 1, 1.79, almostLinear
animation = fadeLayersOut, 1, 1.39, almostLinear
animation = workspaces, 1, 1.94, almostLinear, fade
animation = workspacesIn, 1, 1.21, almostLinear, fade
animation = workspacesOut, 1, 1.94, almostLinear, fade
}
# Smart gaps: https://wiki.hyprland.org/Configuring/Workspace-Rules/#smart-gaps
# See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more
dwindle {
pseudotile = true # Master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below
preserve_split = true # You probably want this
}
# https://wiki.hyprland.org/Configuring/Variables/#misc
misc {
disable_hyprland_logo = true
vfr = true
enable_swallow = true
swallow_regex = ^(kitty)$
swallow_exception_regex = ^(xev|wev|vkcube|glxgears|kitty).*
allow_session_lock_restore = 1
new_window_takes_over_fullscreen = 2
}
#############
### INPUT ###
#############
# https://wiki.hyprland.org/Configuring/Variables/#input
input {
kb_layout = ee
kb_variant =
kb_model =
kb_options = caps:swapescape, fkeys:basic_13-24
kb_rules =
follow_mouse = 1
sensitivity = 0.0 # -1.0 - 1.0, 0 means no modification.
touchpad {
natural_scroll = true
scroll_factor = 0.6
disable_while_typing = false
}
}
device {
name = falbatech-redox
kb_layout = us
kb_options = fkeys:basic_13-24
}
device {
name = falbatech-redox-mouse
sensitivity = -0.5
accel_profile = flat
}
# https://wiki.hyprland.org/Configuring/Variables/#gestures
gestures {
gesture = 3, horizontal, workspace
gesture = 3, up, mod: SUPER, fullscreen
}
###################gesture = 3, up, mod: SUPER, scale: 1.5, fullscreen
### KEYBINDINGS ###
###################
# See https://wiki.hyprland.org/Configuring/Keywords/
$mainMod = SUPER
bind = $mainMod, RETURN, exec, $terminal
bind = $mainMod, Q, exec, $browser
bind = $mainMod, W, killactive,
bind = $mainMod CTRL SHIFT, Q, exit,
bind = $mainMod, C, togglefloating,
bind = $mainMod, SPACE, exec, $menu
bind = $mainMod SHIFT, J, togglesplit, # dwindle
bind = $mainMod, F, fullscreen, 1
# Hyprlock
bind = $mainMod SHIFT, L, exec, $hyprlock
# Cliphist
bind = $mainMod, V, exec, cliphist list | fuzzel -d -w 75 --select-index 1 | cliphist decode | wl-copy
# Hyprshot
bind = $mainMod SHIFT, S, exec, $hyprshot -m region --clipboard-only
bind = $mainMod SHIFT CTRL, S, exec, $hyprshot -m window --clipboard-only
bind = $mainMod SHIFT ALT, S, exec, $hyprshot -m output --clipboard-only
# Move focus
bind = $mainMod, H, movefocus, l
bind = $mainMod, L, movefocus, r
bind = $mainMod, K, movefocus, u
bind = $mainMod, J, movefocus, d
# Switch workspaces
bind = $mainMod, 1, workspace, 1
bind = $mainMod, 2, workspace, 2
bind = $mainMod, 3, workspace, 3
bind = $mainMod, 4, workspace, 4
bind = $mainMod, 5, workspace, 5
bind = $mainMod, 6, workspace, 6
bind = $mainMod, 7, workspace, 7
bind = $mainMod, 8, workspace, 8
bind = $mainMod, 9, workspace, 9
bind = $mainMod, 0, workspace, 10
# Move active window to a workspace
bind = $mainMod SHIFT, 1, movetoworkspace, 1
bind = $mainMod SHIFT, 2, movetoworkspace, 2
bind = $mainMod SHIFT, 3, movetoworkspace, 3
bind = $mainMod SHIFT, 4, movetoworkspace, 4
bind = $mainMod SHIFT, 5, movetoworkspace, 5
bind = $mainMod SHIFT, 6, movetoworkspace, 6
bind = $mainMod SHIFT, 7, movetoworkspace, 7
bind = $mainMod SHIFT, 8, movetoworkspace, 8
bind = $mainMod SHIFT, 9, movetoworkspace, 9
bind = $mainMod SHIFT, 0, movetoworkspace, 10
bind = $mainMod SHIFT CTRL, TAB, movecurrentworkspacetomonitor, +1
# Move/resize windows
bindm = $mainMod, mouse:272, movewindow
bindm = $mainMod, mouse:273, resizewindow
# Laptop multimedia keys for volume and LCD brightness
bindel = ,XF86AudioRaiseVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+
bindel = ,XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-
bindel = ,XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle
bindel = ,XF86AudioMicMute, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle
bindel = ,XF86MonBrightnessUp, exec, brightnessctl s 10%+
bindel = ,XF86MonBrightnessDown, exec, brightnessctl s 10%-
# Requires playerctl
bindl = , XF86AudioNext, exec, playerctl next
bindl = , XF86AudioPause, exec, playerctl play-pause
bindl = , XF86AudioPlay, exec, playerctl play-pause
bindl = , XF86AudioPrev, exec, playerctl previous
# Laptop lid
bindl = , switch:on:Lid Switch, exec, hyprctl keyword monitor "HDMI-A-1, 1920x1080@120, 0x0, 1"
bindl = , switch:on:Lid Switch, exec, hyprctl keyword monitor "eDP-1, disable"
bindl = , switch:off:Lid Switch, exec, hyprctl keyword monitor "eDP-1, 1920x1080@60, 0x0, 1.25"
bindl = , switch:off:Lid Switch, exec, hyprctl keyword monitor "HDMI-A-1, disable"
##############################
### WINDOWS AND WORKSPACES ###
##############################
# See https://wiki.hyprland.org/Configuring/Window-Rules/ for more
# See https://wiki.hyprland.org/Configuring/Workspace-Rules/ for workspace rules
# Example windowrule v1
# windowrule = float, ^(kitty)$
# Example windowrule v2
# windowrulev2 = float,class:^(kitty)$,title:^(kitty)$
# Ignore maximize requests from apps. You'll probably like this.
# windowrulev2 = suppressevent maximize, class:.*
# Fix some dragging issues with XWayland
windowrulev2 = nofocus,class:^$,title:^$,xwayland:1,floating:1,fullscreen:0,pinned:0
# Steam pop-ups
windowrulev2 = float,class:^(steam)$,title:^(Friends List)$
windowrulev2 = float,class:^(steam)$,title:^(Steam Settings)$

View file

@ -0,0 +1,9 @@
profile {
time = 7:30
identity = true
}
profile {
time = 01:00
temperature = 5500
}

File diff suppressed because it is too large Load diff

33
dot_config/mimeapps.list Normal file
View file

@ -0,0 +1,33 @@
[Default Applications]
x-scheme-handler/http=zen.desktop
x-scheme-handler/https=zen.desktop
x-scheme-handler/chrome=zen.desktop
text/html=zen.desktop
application/x-extension-htm=zen.desktop
application/x-extension-html=zen.desktop
application/x-extension-shtml=zen.desktop
application/xhtml+xml=zen.desktop
application/x-extension-xhtml=zen.desktop
application/x-extension-xht=zen.desktop
x-scheme-handler/fdm=freedownloadmanager_fdm_up.desktop
image/jpeg=feh.desktop
image/png=feh.desktop
image/avif=feh.desktop
image/bmp=feh.desktop
image/gif=feh.desktop
video/mp4=vlc.desktop
video/mkv=vlc.desktop
video/quicktime=vlc.desktop
video/webm=vlc.desktop
[Added Associations]
x-scheme-handler/http=zen.desktop;
x-scheme-handler/https=zen.desktop;
x-scheme-handler/chrome=zen.desktop;
text/html=zen.desktop;
application/x-extension-htm=zen.desktop;
application/x-extension-html=zen.desktop;
application/x-extension-shtml=zen.desktop;
application/xhtml+xml=zen.desktop;
application/x-extension-xhtml=zen.desktop;
application/x-extension-xht=zen.desktop;

View file

@ -0,0 +1 @@
require("wekuz")

View file

@ -0,0 +1,21 @@
{
"blink.cmp": { "branch": "main", "commit": "327fff91fe6af358e990be7be1ec8b78037d2138" },
"friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" },
"lazy.nvim": { "branch": "main", "commit": "1ea3c4085785f460fb0e46d2fe1ee895f5f9e7c1" },
"lazygit.nvim": { "branch": "main", "commit": "2305deed25bc61b866d5d39189e9105a45cf1cfb" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "2304ff65ecc8cb2afc2484de3e2ed9a407edf0b9" },
"mason.nvim": { "branch": "main", "commit": "ad7146aa61dcaeb54fa900144d768f040090bff0" },
"nvim-lspconfig": { "branch": "master", "commit": "52a893217b2c12e215c6851bd8813b43204416cd" },
"nvim-spectre": { "branch": "master", "commit": "72f56f7585903cd7bf92c665351aa585e150af0f" },
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "a9742cbc1f95db9eaf3293bf8cd0622ca36542bb" },
"nvim-web-devicons": { "branch": "master", "commit": "b8221e42cf7287c4dcde81f232f58d7b947c210d" },
"obsidian.nvim": { "branch": "main", "commit": "ae1f76a75c7ce36866e1d9342a8f6f5b9c2caf9b" },
"onedarkpro.nvim": { "branch": "main", "commit": "eeac8847a46a02c4de4e887c4c6d34b282060b5d" },
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" },
"telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
"todo-comments.nvim": { "branch": "main", "commit": "19d461ddd543e938eb22505fb03fa878800270b6" },
"trouble.nvim": { "branch": "main", "commit": "c098362fe603d3922095e7db595961e020bdf2d0" },
"undotree": { "branch": "master", "commit": "0f1c9816975b5d7f87d5003a19c53c6fd2ff6f7f" }
}

View file

@ -0,0 +1,13 @@
local markdown_format = vim.api.nvim_create_augroup("markdown_format", { clear = true })
vim.api.nvim_create_autocmd({"BufEnter", "BufWinEnter"}, {
group = markdown_format,
pattern = { "*.md" },
callback = function()
-- vim.opt_local.spell = true
vim.opt_local.wrap = true
vim.opt_local.linebreak = true
vim.opt_local.colorcolumn = "0"
vim.opt_local.conceallevel = 2
end
})

View file

@ -0,0 +1,5 @@
require("wekuz.opts")
require("wekuz.remap")
require("wekuz.autocmds")
require("wekuz.lazy")
require("wekuz.server")

View file

@ -0,0 +1,24 @@
-- Bootstrap lazy.nvim
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
{ out, "WarningMsg" },
{ "\nPress any key to exit..." },
}, true, { })
vim.fn.getchar()
os.exit(1)
end
end
vim.opt.rtp:prepend(lazypath)
-- Setup lazy.nvim
require("lazy").setup({
spec = {{ import = "wekuz.plugins" }},
install = { colorscheme = { "one_monokai" } },
checker = { enabled = true },
change_detection = { notify = false }
})

View file

@ -0,0 +1,22 @@
vim.o.number = true
vim.o.relativenumber = true
vim.o.cursorline = true
vim.o.colorcolumn = "110"
vim.o.tabstop = 4
vim.o.shiftwidth = 4
vim.o.expandtab = true
vim.o.smartindent = true
vim.o.wrap = false
vim.o.termguicolors = true
vim.o.hlsearch = false
vim.o.swapfile = false
vim.o.backup = false
vim.o.undodir = os.getenv("HOME") .. "/.nvim/undodir"
vim.o.undofile = true
vim.o.updatetime = 2000
vim.o.clipboard = "unnamedplus"
vim.o.spelllang= "en_us"

View file

@ -0,0 +1,374 @@
return {
{
"olimorris/onedarkpro.nvim",
lazy = false,
priority = 1000,
config = function()
require("onedarkpro").setup({
options = {
transparency = true
}
})
vim.cmd.colorscheme("onedark")
end
},
{
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
config = function()
local configs = require("nvim-treesitter.configs")
configs.setup({
ensure_installed = {
"vimdoc", "lua", "markdown", "markdown_inline", "c", "cpp", "rust", "javascript",
"typescript", "html", "python", "json", "hyprlang"
},
sync_install = false,
auto_install = true,
ignore_install = { }
})
end
},
{
"nvim-treesitter/nvim-treesitter-textobjects",
event = "VeryLazy"
},
{
"williamboman/mason-lspconfig.nvim",
dependencies = {
"williamboman/mason.nvim",
"neovim/nvim-lspconfig",
"saghen/blink.cmp"
},
event = { "BufReadPre", "BufNewFile" },
config = function()
require("mason").setup()
require("mason-lspconfig").setup({
automatic_installation = true,
ensure_installed = { "lua_ls", "clangd", "rust_analyzer", "pyright", "marksman", "tailwindcss" }
})
local lspconfig = require("lspconfig")
local blinkCapabilities = require("blink.cmp").get_lsp_capabilities()
vim.lsp.config("lua_ls", {
settings = {
Lua = {
diagnostics = {
globals = { "vim" }
},
workspace = {
library = vim.api.nvim_get_runtime_file("", true)
},
telemetry = {
enable = false
}
}
},
capabilities = blinkCapabilities
})
vim.lsp.config("clangd", { capabilities = blinkCapabilities })
vim.lsp.config("rust_analyzer", { capabilities = blinkCapabilities })
vim.lsp.config("pyright", { capabilities = blinkCapabilities })
vim.lsp.config("marksman", { capabilities = blinkCapabilities })
vim.lsp.config("tailwindcss", {
filetypes = { "html", "css", "less", "postcss", "sass", "scss", "stylus", "sugarss" },
capabilities = blinkCapabilities
})
end
},
{
"saghen/blink.cmp",
dependencies = { "rafamadriz/friendly-snippets" },
version = "*",
opts = {
enabled = function()
return not vim.tbl_contains({ "text", "markdown" }, vim.bo.filetype)
and vim.bo.buftype ~= "prompt"
and vim.b.completion ~= false
end,
keymap = { preset = "default" },
appearance = {
nerd_font_variant = "mono"
},
signature = { enabled = true },
cmdline = {
enabled = true,
keymap = { preset = 'cmdline' },
sources = function()
local type = vim.fn.getcmdtype()
if type == '/' or type == '?' then return { 'buffer' } end
if type == ':' or type == '@' then return { 'cmdline' } end
return {}
end,
completion = {
trigger = {
show_on_blocked_trigger_characters = {},
show_on_x_blocked_trigger_characters = {},
},
list = {
selection = {
preselect = true,
auto_insert = true,
},
},
menu = { auto_show = true },
ghost_text = { enabled = true }
}
}
}
},
{
"folke/trouble.nvim",
opts = { },
cmd = "Trouble",
keys = {
{
"<leader>xx",
"<cmd>Trouble diagnostics toggle<cr>",
desc = "Diagnostics (Trouble)",
},
{
"<leader>xX",
"<cmd>Trouble diagnostics toggle filter.buf=0<cr>",
desc = "Buffer Diagnostics (Trouble)"
},
{
"<leader>cs",
"<cmd>Trouble symbols toggle focus=false<cr>",
desc = "Symbols (Trouble)"
},
{
"<leader>cl",
"<cmd>Trouble lsp toggle focus=false win.position=right<cr>",
desc = "LSP Definitions / references / ... (Trouble)"
},
{
"<leader>xL",
"<cmd>Trouble loclist toggle<cr>",
desc = "Location List (Trouble)"
},
{
"<leader>xQ",
"<cmd>Trouble qflist toggle<cr>",
desc = "Quickfix List (Trouble)"
},
}
},
{
"nvim-pack/nvim-spectre",
config = function()
local spectre = require("spectre")
vim.keymap.set("n", "<leader>ss", function() spectre.toggle() end, { desc = "Spectre toggle" })
vim.keymap.set("n", "<leader>sw", function() require("spectre").open_visual({ select_word = true }) end, { desc = "Spectre search current word" })
vim.keymap.set("v", "<leader>sw", function() require("spectre").open_visual() end, { desc = "Spectre search current word" })
vim.keymap.set("n", "<leader>sf", function() require("spectre").open_file_search({ select_word = true }) end, { desc = "Spectre search current word in current file" })
vim.keymap.set("v", "<leader>sf", function() require("spectre").open_file_search() end, { desc = "Spectre search current word in current file" })
spectre.setup({
is_block_ui_break = true
})
end
},
{
"kdheepak/lazygit.nvim",
lazy = true,
cmd = {
"LazyGit",
"LazyGitConfig",
"LazyGitCurrentFile",
"LazyGitFilter",
"LazyGitFilterCurrentFile",
},
dependencies = {
"nvim-lua/plenary.nvim",
},
keys = {
{ "<leader>lg", "<cmd>LazyGit<cr>", desc = "LazyGit" }
}
},
{
"nvim-telescope/telescope.nvim",
branch = "0.1.x",
dependencies = { "nvim-lua/plenary.nvim", "nvim-telescope/telescope-fzf-native.nvim" },
config = function()
require("telescope").load_extension("fzf")
local builtin = require("telescope.builtin")
vim.keymap.set("n", "<leader>ff", builtin.find_files, { desc = "Telescope find files" })
vim.keymap.set("n", "<leader>fg", builtin.git_files, { desc = "Telescope git files" })
vim.keymap.set("n", "<leader>fs", builtin.live_grep, { desc = "Telescope live grep" })
vim.keymap.set("n", "<leader>fw", function()
local word = vim.fn.expand("<cword>")
builtin.grep_string({ search = word })
end, { desc = "Telescope grep current word" })
vim.keymap.set("n", "<leader>fW", function()
local word = vim.fn.expand("<cWORD>")
builtin.grep_string({ search = word })
end, { desc = "Telescope grep current WORD" })
end
},
{
"nvim-telescope/telescope-fzf-native.nvim",
build = "cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_POLICY_VERSION_MINIMUM=3.5 && cmake --build build --config Release"
},
{
"mbbill/undotree"
},
{
"folke/todo-comments.nvim",
dependencies = { "nvim-lua/plenary.nvim" },
config = function(_, opts)
require("todo-comments").setup(opts)
vim.keymap.set("n", "Tn", function() require("todo-comments").jump_next() end, { desc = "Next todo comment" })
vim.keymap.set("n", "TN", function() require("todo-comments").jump_prev() end, { desc = "Previous todo comment" })
end,
opts = {
signs = true, -- show icons in the signs column
sign_priority = 8, -- sign priority
keywords = {
BUG = {
icon = "", -- icon used for the sign, and in search results
color = "error", -- can be a hex color, or a named color (see below)
alt = { "FIX", "FIXME", "FIXIT", "ISSUE" }
},
TODO = { icon = "", color = "info" },
HACK = { icon = "", color = "warning" },
WARN = { icon = "", color = "warning", alt = { "WARNING", "XXX" } },
PERF = { icon = "", alt = { "OPTIM", "PERFORMANCE", "OPTIMIZE" } },
NOTE = { icon = "", color = "hint", alt = { "INFO" } },
TEST = { icon = "", color = "test", alt = { "TESTING", "PASSED", "FAILED" } }
},
gui_style = {
fg = "NONE", -- The gui style to use for the fg highlight group.
bg = "BOLD" -- The gui style to use for the bg highlight group.
},
merge_keywords = true, -- when true, custom keywords will be merged with the defaults
highlight = {
multiline = true, -- enable multine todo comments
multiline_pattern = "^.", -- lua pattern to match the next multiline from the start of the matched keyword
multiline_context = 10, -- extra lines that will be re-evaluated when changing a line
before = "", -- "fg" or "bg" or empty
keyword = "bg", -- "fg", "bg", "wide", "wide_bg", "wide_fg" or empty. (wide and wide_bg is the same as bg, but will also highlight surrounding characters, wide_fg acts accordingly but with fg)
after = "fg", -- "fg" or "bg" or empty
pattern = [[.*<(KEYWORDS)\s*:]], -- pattern or table of patterns, used for highlighting (vim regex)
comments_only = true, -- uses treesitter to match keywords in comments only
max_line_len = 400, -- ignore lines longer than this
exclude = {}, -- list of file types to exclude highlighting
},
colors = {
error = { "DiagnosticError", "ErrorMsg", "#DC2626" },
warning = { "DiagnosticWarn", "WarningMsg", "#FBBF24" },
info = { "DiagnosticInfo", "#2563EB" },
hint = { "DiagnosticHint", "#10B981" },
default = { "Identifier", "#7C3AED" },
test = { "Identifier", "#FF00FF" }
},
search = {
command = "rg",
args = {
"--color=never",
"--no-heading",
"--with-filename",
"--line-number",
"--column"
},
pattern = [[\b(KEYWORDS):]]
}
}
},
{
"nvim-tree/nvim-web-devicons",
lazy = true
},
{
"epwalsh/obsidian.nvim",
version = "*",
lazy = true,
event = {
"BufEnter " .. vim.fn.expand "~" .. "/Obsidian*"
},
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-telescope/telescope.nvim",
"nvim-treesitter/nvim-treesitter"
},
opts = {
workspaces = {
{
name = "personal",
path = "~/Obsidian/personal",
}
},
notes_subdir = "Notes",
daily_notes = {
folder = "Notes/Daily",
date_format = "%Y-%m-%d",
alias_format = "%B %-d, %Y",
default_tags = { "Daily-notes" },
template = nil
},
--completion = {
-- nvim_cmp = true,
-- min_chars = 1
--},
new_notes_location = "notes_subdir",
note_path_func = function(spec)
local path = spec.dir / spec.title
return path:with_suffix(".md")
end,
preferred_link_style = "wiki",
disable_frontmatter = true,
templates = {
folder = "Templates",
date_format = "%Y-%m-%d",
time_format = "%H:%M",
substitutions = {},
},
picker = {
name = "telescope.nvim",
note_mappings = {
new = "<C-x>",
insert_link = "<C-l>",
},
tag_mappings = {
tag_note = "<C-x>",
insert_tag = "<C-l>",
},
},
ui = {
enable = true,
update_debounce = 200,
max_file_length = 5000,
checkboxes = {
[" "] = { char = "󰄱", hl_group = "ObsidianTodo" },
["x"] = { char = "", hl_group = "ObsidianDone" },
[">"] = { char = "", hl_group = "ObsidianRightArrow" },
["~"] = { char = "󰰱", hl_group = "ObsidianTilde" },
["!"] = { char = "", hl_group = "ObsidianImportant" }
},
bullets = { char = "", hl_group = "ObsidianBullet" },
external_link_icon = { char = "", hl_group = "ObsidianExtLinkIcon" },
reference_text = { hl_group = "ObsidianRefText" },
highlight_text = { hl_group = "ObsidianHighlightText" },
tags = { hl_group = "ObsidianTag" },
block_ids = { hl_group = "ObsidianBlockID" },
hl_groups = {
ObsidianTodo = { bold = true, fg = "#f78c6c" },
ObsidianDone = { bold = true, fg = "#89ddff" },
ObsidianRightArrow = { bold = true, fg = "#f78c6c" },
ObsidianTilde = { bold = true, fg = "#ff5370" },
ObsidianImportant = { bold = true, fg = "#d73128" },
ObsidianBullet = { bold = true, fg = "#89ddff" },
ObsidianRefText = { underline = true, fg = "#c792ea" },
ObsidianExtLinkIcon = { fg = "#c792ea" },
ObsidianTag = { italic = true, fg = "#89ddff" },
ObsidianBlockID = { italic = true, fg = "#89ddff" },
ObsidianHighlightText = { bg = "#75662e" }
},
}
},
keys = {
{
"fn",
"<cmd>ObsidianQuickSwitch<cr>",
desc = "Switch between Obsidian notes"
}
}
}
}

View file

@ -0,0 +1,19 @@
vim.g.mapleader = " "
vim.g.maplocalleader = ","
vim.keymap.set("n", "<leader>ex", vim.cmd.Ex)
vim.keymap.set("n", "<leader>u", vim.cmd.UndotreeToggle)
vim.keymap.set("x", "J", ":m '>+1<CR>gv=gv")
vim.keymap.set("x", "K", ":m '<-2<CR>gv=gv")
vim.keymap.set({ "n", "x" }, "j", "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
vim.keymap.set({ "n", "x" }, "<Down>", "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
vim.keymap.set({ "n", "x" }, "k", "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
vim.keymap.set({ "n", "x" }, "<Up>", "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
vim.keymap.set({ "n", "x" }, "x", "\"_x")
vim.keymap.set({ "n", "x" }, "s", "\"_s")
vim.keymap.set("n", "dd", "\"_dd")
vim.keymap.set("x", "p", "P")

View file

@ -0,0 +1,14 @@
function start_server(args)
local address = "0.0.0.0:5656"
if args.args ~= "" then
address = args.args
end
vim.fn.serverstart(address)
print("NVim server started on " .. address)
end
vim.api.nvim_create_user_command(
"StartServer",
start_server,
{ nargs = "?" }
)

View file

@ -0,0 +1,76 @@
[user]
keyboard = redox/rev1
keymap = wekuz
[config]
[console]
[c2json]
[compile]
[docs]
[find]
keymap = default
[flash]
[format_c]
[format_python]
[format_text]
[generate_autocorrect_data]
[generate_compilation_database]
[generate_develop_pr_list]
[generate_dfu_header]
[generate_info_json]
[generate_make_dependencies]
[git_submodule]
[hello]
[info]
[license_check]
[lint]
[kle2json]
[list_keymaps]
[list_layouts]
[mass_compile]
keymap = default
[new_keyboard]
[new_keymap]
[painter_convert_graphics]
[painter_make_font_image]
[painter_convert_font_image]
[test_c]
[userspace_add]
[userspace_remove]
[userspace_compile]
[general]

View file

View file

View file

@ -0,0 +1,32 @@
[Appearance]
color_scheme_path=/usr/share/qt5ct/colors/darker.conf
custom_palette=true
icon_theme=Papirus-Dark
standard_dialogs=default
style=Adwaita-Dark
[Fonts]
fixed="JetBrainsMono Nerd Font Mono,12,-1,5,50,0,0,0,0,0,Regular"
general="JetBrainsMono Nerd Font,12,-1,5,50,0,0,0,0,0,Regular"
[Interface]
activate_item_on_single_click=1
buttonbox_layout=0
cursor_flash_time=1000
dialog_buttons_have_icons=1
double_click_interval=400
gui_effects=@Invalid()
keyboard_scheme=2
menus_have_icons=true
show_shortcuts_in_context_menus=true
stylesheets=@Invalid()
toolbutton_style=4
underline_shortcut=1
wheel_scroll_lines=3
[SettingsWindow]
geometry=@ByteArray(\x1\xd9\xd0\xcb\0\x3\0\0\0\0\0\0\0\0\0\0\0\0\x2\xa4\0\0\x3\v\0\0\0\0\0\0\0\0\0\0\x2\xa4\0\0\x3\v\0\0\0\0\x2\0\0\0\n\0\0\0\0\0\0\0\0\0\0\0\x2\xa4\0\0\x3\v)
[Troubleshooting]
force_raster_widgets=1
ignored_applications=@Invalid()

View file

View file

View file

@ -0,0 +1,32 @@
[Appearance]
color_scheme_path=/usr/share/qt6ct/colors/darker.conf
custom_palette=true
icon_theme=Papirus-Dark
standard_dialogs=default
style=Adwaita-Dark
[Fonts]
fixed="JetBrainsMono Nerd Font Mono,12,-1,5,400,0,0,0,0,0,0,0,0,0,0,1,Regular"
general="JetBrainsMono Nerd Font,12,-1,5,400,0,0,0,0,0,0,0,0,0,0,1,Regular"
[Interface]
activate_item_on_single_click=1
buttonbox_layout=0
cursor_flash_time=1000
dialog_buttons_have_icons=1
double_click_interval=400
gui_effects=@Invalid()
keyboard_scheme=2
menus_have_icons=true
show_shortcuts_in_context_menus=true
stylesheets=@Invalid()
toolbutton_style=4
underline_shortcut=1
wheel_scroll_lines=3
[SettingsWindow]
geometry=@ByteArray(\x1\xd9\xd0\xcb\0\x3\0\0\0\0\0\0\0\0\0\0\0\0\t\xfd\0\0\x5\x85\0\0\0\0\0\0\0\0\0\0\t\xfd\0\0\x5\x85\0\0\0\0\x2\0\0\0\n\0\0\0\0\0\0\0\0\0\0\0\t\xfd\0\0\x5\x85)
[Troubleshooting]
force_raster_widgets=1
ignored_applications=@Invalid()

View file

@ -0,0 +1 @@
{"email":"patrickjelsukov@gmail.com","sso_id":null,"base_url":"https://vw.wekuz.localplayer.dev","identity_url":null,"ui_url":null,"notifications_url":null,"lock_timeout":3600,"sync_interval":3600,"pinentry":"pinentry","client_cert_path":null}

View file

@ -0,0 +1 @@
hyprland-uwsm.desktop

View file

@ -0,0 +1,4 @@
export XCURSOR_THEME=Nordzy-cursors
export XCURSOR_SIZE=24
export QT_QPA_PLATFORMTHEME=qt6ct
export ELECTRON_OZONE_PLATFORM_HINT=auto

View file

@ -0,0 +1,2 @@
export HYPRCURSOR_THEME=Nordzy-cursors
export HYPRCURSOR_SIZE=24

View file

@ -0,0 +1,78 @@
// -*- mode: jsonc -*-
{
"layer": "top",
"position": "top",
"height": 24,
"spacing": 2,
"modules-left": ["hyprland/workspaces"],
"modules-center": ["hyprland/window"],
"modules-right": [ "network", "wireplumber", "cpu", "memory", "temperature", "battery", "clock" ],
"hyprland/workspaces": {
"workspace-taskbar": {
"enable": true,
"format": "{icon}",
"icon-size": 16,
"orientation": "horizontal",
},
"format": "{id} {windows}",
},
"hyprland/window": {
"icon": true,
"icon-size": 18,
},
"network": {
"interval": 15,
"format-wifi": "",
"format-ethernet": "",
"format-disconnected": "⚠",
"format-linked": "",
"tooltip-format": "{ifname}: {ipaddr}/{cidr}",
"tooltip-format-wifi": "{ifname}: {ipaddr}/{cidr}\n{essid} ({signalStrength}%)",
"tooltip-format-disconnected": "Disconnected",
"tooltip-format-linked": "No IP"
},
"wireplumber": {
"format": "{volume}% {icon}",
"format-icons": ["󰕿", "󰖀", "󰕾"],
"format-muted": "{volume}% 󰝟",
"scroll-step": 0.2,
"on-click": "pavucontrol",
"reverse-scrolling": 1
},
"cpu": {
"interval": 5,
"format": "{usage}% "
},
"memory": {
"interval": 5,
"format": "{}% "
},
"temperature": {
"interval": 5,
"hwmon-path": "/sys/class/hwmon/hwmon3/temp1_input",
"critical-threshold": 70,
"format": "{temperatureC}°C {icon}",
"format-critical": "{temperatureC}°C {icon}",
"format-icons": ["", "", "", "", ""],
},
"battery": {
"interval": 10,
"states": {
"warning": 30,
"critical": 15
},
"format": "{capacity}% {icon}",
"format-plugged": "{capacity}% 󰚥",
"format-icons": {
"default": ["󰂎", "󱊡", "󱊢", "󱊣"],
"charging": ["󰢟", "󱊤", "󱊥", "󱊦"]
},
"tooltip-format": "{time}"
},
"clock": {
"interval": 1,
"format": "{:%H:%M:%S}",
"tooltip-format": "{:%a %d/%m/%Y}"
}
}

View file

@ -0,0 +1,155 @@
* {
font-family: JetBrainsMonoNL Nerd Font Propo;
font-size: 14px;
}
window#waybar {
background: linear-gradient(#333333, rgba(34, 34, 34, 0.4));
/* background-color: #333333; */
/* border-bottom: 2px solid rgba(100, 100, 100, 0.7); */
color: #ffffff;
transition-property: background-color;
transition-duration: .5s;
}
label.module {
box-shadow: inset 0 -2px;
}
button {
/* Use box-shadow instead of border so the text isn't offset */
/* Avoid rounded borders under each button name */
border: none;
border-radius: 0;
}
/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */
button:hover {
box-shadow: inherit;
text-shadow: inherit;
background: inherit;
}
#workspaces button {
padding: 0 4px;
background-color: transparent;
color: #ffffff;
}
#workspaces button:hover {
background: rgba(0, 0, 0, 0.3);
}
#workspaces button.focused {
background: linear-gradient(#64727D, rgba(100, 114, 125, 0.7));
/* background-color: #64727D; */
}
#workspaces button.urgent {
background: linear-gradient(#ee0202, rgba(238, 2, 2, 0.7));
/* background-color: #ee0202; */
}
#workspaces button.active {
background: linear-gradient(#00aa00, rgba(0, 136, 0, 0.7));
/* background-color: #00aa00; */
}
#network,
#wireplumber,
#cpu,
#memory,
#temperature,
#battery,
#clock {
padding: 0 4px;
color: #ffffff;
}
#window {
margin: 0 40px;
}
#workspaces {
margin: 0 6px;
}
.modules-left > widget:first-child > #workspaces {
margin-left: 0;
}
.modules-right > widget:last-child > #workspaces {
margin-right: 0;
}
#clock {
background-color: transparent;
}
#clock:hover {
background: rgba(0, 0, 0, 0.3);
}
#battery {
background-color: transparent;
}
#battery:hover {
background: rgba(0, 0, 0, 0.3);
}
#battery.critical:not(.charging) {
box-shadow: inset 0 -2px;
color: #ee0202;
}
label:focus {
background-color: #000000;
}
#cpu {
background-color: transparent;
}
#cpu:hover {
background: rgba(0, 0, 0, 0.3);
}
#memory {
background-color: transparent;
}
#memory:hover {
background: rgba(0, 0, 0, 0.3);
}
#network {
background-color: transparent;
}
#network:hover {
background: rgba(0, 0, 0, 0.3);
}
#network.disconnected {
box-shadow: inset 0 -2px;
color: #ee0202;
}
#network.linked {
box-shadow: inset 0 -2px;
color: #ece81a;
}
#wireplumber {
background-color: transparent;
}
#wireplumber:hover {
background: rgba(0, 0, 0, 0.3);
}
#wireplumber.muted {
box-shadow: inset 0 -2px;
color: #ee0202;
}
#temperature {
background-color: transparent;
}
#temperature:hover {
background: rgba(0, 0, 0, 0.3);
}
#temperature.critical {
box-shadow: inset 0 -2px;
color: #ee0202;
}

View file

@ -0,0 +1,32 @@
# Sources (if empty, use all available)
sources =
# Fuzzy finder
fuzzy_finder = fzf
# Quick search mode (only by title)
quick_search = false
# AND operator mode (must contain all keywords)
and_operator = false
# Raw output (for developers)
raw_output = false
# Manpages language(s)
man_lang = en
# Wiki language(s)
wiki_lang = en
# Show previews in TUI
tui_preview = true
# Keep open after viewing a result
tui_keep_open = false
# Show source column
tui_source_column = true
# Viewer for HTML pages
tui_html = w3m

View file

@ -0,0 +1,2 @@
[mgr]
show_hidden = true

View file

@ -0,0 +1,12 @@
alias ls="lsd"
alias l="ls -l"
alias la="ls -la"
alias rp="rip"
alias rm="read -q 'choice?Use rm instead of rip? [y/N] ' && rm"
alias nv="nvim"
alias sudo="sudo "
alias umount="sync && umount"
alias kssh="kitten ssh"
eval $(thefuck --alias)
eval $(thefuck --alias fck)

View file

@ -0,0 +1,7 @@
# ssh-agent
if ! pgrep -u "$USER" ssh-agent > /dev/null; then
ssh-agent -t 2h > "$XDG_RUNTIME_DIR/ssh-agent.env"
fi
if [[ ! -f "$SSH_AUTH_SOCK" ]]; then
source "$XDG_RUNTIME_DIR/ssh-agent.env" >/dev/null
fi

View file

@ -0,0 +1,4 @@
source <(fzf --zsh)
source <(rip completions zsh)
source <(rbw gen-completions zsh)
eval "$(zoxide init zsh)"

View file

@ -0,0 +1,50 @@
# Source: https://wiki.archlinux.org/title/Zsh#Key_bindings
typeset -g -A key
key[Home]="${terminfo[khome]}"
key[End]="${terminfo[kend]}"
key[Insert]="${terminfo[kich1]}"
key[Backspace]="${terminfo[kbs]}"
key[Delete]="${terminfo[kdch1]}"
key[Up]="${terminfo[kcuu1]}"
key[Down]="${terminfo[kcud1]}"
key[Left]="${terminfo[kcub1]}"
key[Right]="${terminfo[kcuf1]}"
key[PageUp]="${terminfo[kpp]}"
key[PageDown]="${terminfo[knp]}"
key[Shift-Tab]="${terminfo[kcbt]}"
[[ -n "${key[Home]}" ]] && bindkey -- "${key[Home]}" beginning-of-line
[[ -n "${key[End]}" ]] && bindkey -- "${key[End]}" end-of-line
[[ -n "${key[Insert]}" ]] && bindkey -- "${key[Insert]}" overwrite-mode
[[ -n "${key[Backspace]}" ]] && bindkey -- "${key[Backspace]}" backward-delete-char
[[ -n "${key[Delete]}" ]] && bindkey -- "${key[Delete]}" delete-char
[[ -n "${key[Up]}" ]] && bindkey -- "${key[Up]}" up-line-or-history
[[ -n "${key[Down]}" ]] && bindkey -- "${key[Down]}" down-line-or-history
[[ -n "${key[Left]}" ]] && bindkey -- "${key[Left]}" backward-char
[[ -n "${key[Right]}" ]] && bindkey -- "${key[Right]}" forward-char
[[ -n "${key[PageUp]}" ]] && bindkey -- "${key[PageUp]}" beginning-of-buffer-or-history
[[ -n "${key[PageDown]}" ]] && bindkey -- "${key[PageDown]}" end-of-buffer-or-history
[[ -n "${key[Shift-Tab]}" ]] && bindkey -- "${key[Shift-Tab]}" reverse-menu-complete
if (( ${+terminfo[smkx]} && ${+terminfo[rmkx]} )); then
autoload -Uz add-zle-hook-widget
function zle_application_mode_start { echoti smkx }
function zle_application_mode_stop { echoti rmkx }
add-zle-hook-widget -Uz zle-line-init zle_application_mode_start
add-zle-hook-widget -Uz zle-line-finish zle_application_mode_stop
fi
autoload -Uz up-line-or-beginning-search down-line-or-beginning-search
zle -N up-line-or-beginning-search
zle -N down-line-or-beginning-search
[[ -n "${key[Up]}" ]] && bindkey -- "${key[Up]}" up-line-or-beginning-search
[[ -n "${key[Down]}" ]] && bindkey -- "${key[Down]}" down-line-or-beginning-search
key[Control-Left]="${terminfo[kLFT5]}"
key[Control-Right]="${terminfo[kRIT5]}"
[[ -n "${key[Control-Left]}" ]] && bindkey -- "${key[Control-Left]}" backward-word
[[ -n "${key[Control-Right]}" ]] && bindkey -- "${key[Control-Right]}" forward-word

View file

@ -0,0 +1,5 @@
unsetopt beep
setopt inc_append_history
setopt share_history
setopt hist_ignore_dups
setopt hist_ignore_all_dups

View file

@ -0,0 +1 @@
449a7c3d095bc8f3d78cf37b9549f8bb4c383f3d branch 'master' of https://github.com/hlissner/zsh-autopair

View file

@ -0,0 +1 @@
ref: refs/heads/master

View file

@ -0,0 +1 @@
449a7c3d095bc8f3d78cf37b9549f8bb4c383f3d

View file

@ -0,0 +1,13 @@
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[submodule]
active = .
[remote "origin"]
url = https://github.com/hlissner/zsh-autopair
fetch = +refs/heads/master:refs/remotes/origin/master
[branch "master"]
remote = origin
merge = refs/heads/master

View file

@ -0,0 +1 @@
Unnamed repository; edit this file 'description' to name the repository.

View file

@ -0,0 +1,2 @@
# pack-refs with: peeled fully-peeled sorted
449a7c3d095bc8f3d78cf37b9549f8bb4c383f3d refs/remotes/origin/master

View file

@ -0,0 +1,15 @@
#!/bin/sh
#
# An example hook script to check the commit log message taken by
# applypatch from an e-mail message.
#
# The hook should exit with non-zero status after issuing an
# appropriate message if it wants to stop the commit. The hook is
# allowed to edit the commit message file.
#
# To enable this hook, rename this file to "applypatch-msg".
. git-sh-setup
commitmsg="$(git rev-parse --git-path hooks/commit-msg)"
test -x "$commitmsg" && exec "$commitmsg" ${1+"$@"}
:

View file

@ -0,0 +1,24 @@
#!/bin/sh
#
# An example hook script to check the commit log message.
# Called by "git commit" with one argument, the name of the file
# that has the commit message. The hook should exit with non-zero
# status after issuing an appropriate message if it wants to stop the
# commit. The hook is allowed to edit the commit message file.
#
# To enable this hook, rename this file to "commit-msg".
# Uncomment the below to add a Signed-off-by line to the message.
# Doing this in a hook is a bad idea in general, but the prepare-commit-msg
# hook is more suited to it.
#
# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
# This example catches duplicate Signed-off-by lines.
test "" = "$(grep '^Signed-off-by: ' "$1" |
sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || {
echo >&2 Duplicate Signed-off-by lines.
exit 1
}

View file

@ -0,0 +1,174 @@
#!/usr/bin/perl
use strict;
use warnings;
use IPC::Open2;
# An example hook script to integrate Watchman
# (https://facebook.github.io/watchman/) with git to speed up detecting
# new and modified files.
#
# The hook is passed a version (currently 2) and last update token
# formatted as a string and outputs to stdout a new update token and
# all files that have been modified since the update token. Paths must
# be relative to the root of the working tree and separated by a single NUL.
#
# To enable this hook, rename this file to "query-watchman" and set
# 'git config core.fsmonitor .git/hooks/query-watchman'
#
my ($version, $last_update_token) = @ARGV;
# Uncomment for debugging
# print STDERR "$0 $version $last_update_token\n";
# Check the hook interface version
if ($version ne 2) {
die "Unsupported query-fsmonitor hook version '$version'.\n" .
"Falling back to scanning...\n";
}
my $git_work_tree = get_working_dir();
my $retry = 1;
my $json_pkg;
eval {
require JSON::XS;
$json_pkg = "JSON::XS";
1;
} or do {
require JSON::PP;
$json_pkg = "JSON::PP";
};
launch_watchman();
sub launch_watchman {
my $o = watchman_query();
if (is_work_tree_watched($o)) {
output_result($o->{clock}, @{$o->{files}});
}
}
sub output_result {
my ($clockid, @files) = @_;
# Uncomment for debugging watchman output
# open (my $fh, ">", ".git/watchman-output.out");
# binmode $fh, ":utf8";
# print $fh "$clockid\n@files\n";
# close $fh;
binmode STDOUT, ":utf8";
print $clockid;
print "\0";
local $, = "\0";
print @files;
}
sub watchman_clock {
my $response = qx/watchman clock "$git_work_tree"/;
die "Failed to get clock id on '$git_work_tree'.\n" .
"Falling back to scanning...\n" if $? != 0;
return $json_pkg->new->utf8->decode($response);
}
sub watchman_query {
my $pid = open2(\*CHLD_OUT, \*CHLD_IN, 'watchman -j --no-pretty')
or die "open2() failed: $!\n" .
"Falling back to scanning...\n";
# In the query expression below we're asking for names of files that
# changed since $last_update_token but not from the .git folder.
#
# To accomplish this, we're using the "since" generator to use the
# recency index to select candidate nodes and "fields" to limit the
# output to file names only. Then we're using the "expression" term to
# further constrain the results.
my $last_update_line = "";
if (substr($last_update_token, 0, 1) eq "c") {
$last_update_token = "\"$last_update_token\"";
$last_update_line = qq[\n"since": $last_update_token,];
}
my $query = <<" END";
["query", "$git_work_tree", {$last_update_line
"fields": ["name"],
"expression": ["not", ["dirname", ".git"]]
}]
END
# Uncomment for debugging the watchman query
# open (my $fh, ">", ".git/watchman-query.json");
# print $fh $query;
# close $fh;
print CHLD_IN $query;
close CHLD_IN;
my $response = do {local $/; <CHLD_OUT>};
# Uncomment for debugging the watch response
# open ($fh, ">", ".git/watchman-response.json");
# print $fh $response;
# close $fh;
die "Watchman: command returned no output.\n" .
"Falling back to scanning...\n" if $response eq "";
die "Watchman: command returned invalid output: $response\n" .
"Falling back to scanning...\n" unless $response =~ /^\{/;
return $json_pkg->new->utf8->decode($response);
}
sub is_work_tree_watched {
my ($output) = @_;
my $error = $output->{error};
if ($retry > 0 and $error and $error =~ m/unable to resolve root .* directory (.*) is not watched/) {
$retry--;
my $response = qx/watchman watch "$git_work_tree"/;
die "Failed to make watchman watch '$git_work_tree'.\n" .
"Falling back to scanning...\n" if $? != 0;
$output = $json_pkg->new->utf8->decode($response);
$error = $output->{error};
die "Watchman: $error.\n" .
"Falling back to scanning...\n" if $error;
# Uncomment for debugging watchman output
# open (my $fh, ">", ".git/watchman-output.out");
# close $fh;
# Watchman will always return all files on the first query so
# return the fast "everything is dirty" flag to git and do the
# Watchman query just to get it over with now so we won't pay
# the cost in git to look up each individual file.
my $o = watchman_clock();
$error = $output->{error};
die "Watchman: $error.\n" .
"Falling back to scanning...\n" if $error;
output_result($o->{clock}, ("/"));
$last_update_token = $o->{clock};
eval { launch_watchman() };
return 0;
}
die "Watchman: $error.\n" .
"Falling back to scanning...\n" if $error;
return 1;
}
sub get_working_dir {
my $working_dir;
if ($^O =~ 'msys' || $^O =~ 'cygwin') {
$working_dir = Win32::GetCwd();
$working_dir =~ tr/\\/\//;
} else {
require Cwd;
$working_dir = Cwd::cwd();
}
return $working_dir;
}

View file

@ -0,0 +1,8 @@
#!/bin/sh
#
# An example hook script to prepare a packed repository for use over
# dumb transports.
#
# To enable this hook, rename this file to "post-update".
exec git update-server-info

View file

@ -0,0 +1,14 @@
#!/bin/sh
#
# An example hook script to verify what is about to be committed
# by applypatch from an e-mail message.
#
# The hook should exit with non-zero status after issuing an
# appropriate message if it wants to stop the commit.
#
# To enable this hook, rename this file to "pre-applypatch".
. git-sh-setup
precommit="$(git rev-parse --git-path hooks/pre-commit)"
test -x "$precommit" && exec "$precommit" ${1+"$@"}
:

View file

@ -0,0 +1,49 @@
#!/bin/sh
#
# An example hook script to verify what is about to be committed.
# Called by "git commit" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
#
# To enable this hook, rename this file to "pre-commit".
if git rev-parse --verify HEAD >/dev/null 2>&1
then
against=HEAD
else
# Initial commit: diff against an empty tree object
against=$(git hash-object -t tree /dev/null)
fi
# If you want to allow non-ASCII filenames set this variable to true.
allownonascii=$(git config --type=bool hooks.allownonascii)
# Redirect output to stderr.
exec 1>&2
# Cross platform projects tend to avoid non-ASCII filenames; prevent
# them from being added to the repository. We exploit the fact that the
# printable range starts at the space character and ends with tilde.
if [ "$allownonascii" != "true" ] &&
# Note that the use of brackets around a tr range is ok here, (it's
# even required, for portability to Solaris 10's /usr/bin/tr), since
# the square bracket bytes happen to fall in the designated range.
test $(git diff-index --cached --name-only --diff-filter=A -z $against |
LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0
then
cat <<\EOF
Error: Attempt to add a non-ASCII file name.
This can cause problems if you want to work with people on other platforms.
To be portable it is advisable to rename the file.
If you know what you are doing you can disable this check using:
git config hooks.allownonascii true
EOF
exit 1
fi
# If there are whitespace errors, print the offending file names and fail.
exec git diff-index --check --cached $against --

View file

@ -0,0 +1,13 @@
#!/bin/sh
#
# An example hook script to verify what is about to be committed.
# Called by "git merge" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message to
# stderr if it wants to stop the merge commit.
#
# To enable this hook, rename this file to "pre-merge-commit".
. git-sh-setup
test -x "$GIT_DIR/hooks/pre-commit" &&
exec "$GIT_DIR/hooks/pre-commit"
:

View file

@ -0,0 +1,53 @@
#!/bin/sh
# An example hook script to verify what is about to be pushed. Called by "git
# push" after it has checked the remote status, but before anything has been
# pushed. If this script exits with a non-zero status nothing will be pushed.
#
# This hook is called with the following parameters:
#
# $1 -- Name of the remote to which the push is being done
# $2 -- URL to which the push is being done
#
# If pushing without using a named remote those arguments will be equal.
#
# Information about the commits which are being pushed is supplied as lines to
# the standard input in the form:
#
# <local ref> <local oid> <remote ref> <remote oid>
#
# This sample shows how to prevent push of commits where the log message starts
# with "WIP" (work in progress).
remote="$1"
url="$2"
zero=$(git hash-object --stdin </dev/null | tr '[0-9a-f]' '0')
while read local_ref local_oid remote_ref remote_oid
do
if test "$local_oid" = "$zero"
then
# Handle delete
:
else
if test "$remote_oid" = "$zero"
then
# New branch, examine all commits
range="$local_oid"
else
# Update to existing branch, examine new commits
range="$remote_oid..$local_oid"
fi
# Check for WIP commit
commit=$(git rev-list -n 1 --grep '^WIP' "$range")
if test -n "$commit"
then
echo >&2 "Found WIP commit in $local_ref, not pushing"
exit 1
fi
fi
done
exit 0

View file

@ -0,0 +1,169 @@
#!/bin/sh
#
# Copyright (c) 2006, 2008 Junio C Hamano
#
# The "pre-rebase" hook is run just before "git rebase" starts doing
# its job, and can prevent the command from running by exiting with
# non-zero status.
#
# The hook is called with the following parameters:
#
# $1 -- the upstream the series was forked from.
# $2 -- the branch being rebased (or empty when rebasing the current branch).
#
# This sample shows how to prevent topic branches that are already
# merged to 'next' branch from getting rebased, because allowing it
# would result in rebasing already published history.
publish=next
basebranch="$1"
if test "$#" = 2
then
topic="refs/heads/$2"
else
topic=`git symbolic-ref HEAD` ||
exit 0 ;# we do not interrupt rebasing detached HEAD
fi
case "$topic" in
refs/heads/??/*)
;;
*)
exit 0 ;# we do not interrupt others.
;;
esac
# Now we are dealing with a topic branch being rebased
# on top of master. Is it OK to rebase it?
# Does the topic really exist?
git show-ref -q "$topic" || {
echo >&2 "No such branch $topic"
exit 1
}
# Is topic fully merged to master?
not_in_master=`git rev-list --pretty=oneline ^master "$topic"`
if test -z "$not_in_master"
then
echo >&2 "$topic is fully merged to master; better remove it."
exit 1 ;# we could allow it, but there is no point.
fi
# Is topic ever merged to next? If so you should not be rebasing it.
only_next_1=`git rev-list ^master "^$topic" ${publish} | sort`
only_next_2=`git rev-list ^master ${publish} | sort`
if test "$only_next_1" = "$only_next_2"
then
not_in_topic=`git rev-list "^$topic" master`
if test -z "$not_in_topic"
then
echo >&2 "$topic is already up to date with master"
exit 1 ;# we could allow it, but there is no point.
else
exit 0
fi
else
not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"`
/usr/bin/perl -e '
my $topic = $ARGV[0];
my $msg = "* $topic has commits already merged to public branch:\n";
my (%not_in_next) = map {
/^([0-9a-f]+) /;
($1 => 1);
} split(/\n/, $ARGV[1]);
for my $elem (map {
/^([0-9a-f]+) (.*)$/;
[$1 => $2];
} split(/\n/, $ARGV[2])) {
if (!exists $not_in_next{$elem->[0]}) {
if ($msg) {
print STDERR $msg;
undef $msg;
}
print STDERR " $elem->[1]\n";
}
}
' "$topic" "$not_in_next" "$not_in_master"
exit 1
fi
<<\DOC_END
This sample hook safeguards topic branches that have been
published from being rewound.
The workflow assumed here is:
* Once a topic branch forks from "master", "master" is never
merged into it again (either directly or indirectly).
* Once a topic branch is fully cooked and merged into "master",
it is deleted. If you need to build on top of it to correct
earlier mistakes, a new topic branch is created by forking at
the tip of the "master". This is not strictly necessary, but
it makes it easier to keep your history simple.
* Whenever you need to test or publish your changes to topic
branches, merge them into "next" branch.
The script, being an example, hardcodes the publish branch name
to be "next", but it is trivial to make it configurable via
$GIT_DIR/config mechanism.
With this workflow, you would want to know:
(1) ... if a topic branch has ever been merged to "next". Young
topic branches can have stupid mistakes you would rather
clean up before publishing, and things that have not been
merged into other branches can be easily rebased without
affecting other people. But once it is published, you would
not want to rewind it.
(2) ... if a topic branch has been fully merged to "master".
Then you can delete it. More importantly, you should not
build on top of it -- other people may already want to
change things related to the topic as patches against your
"master", so if you need further changes, it is better to
fork the topic (perhaps with the same name) afresh from the
tip of "master".
Let's look at this example:
o---o---o---o---o---o---o---o---o---o "next"
/ / / /
/ a---a---b A / /
/ / / /
/ / c---c---c---c B /
/ / / \ /
/ / / b---b C \ /
/ / / / \ /
---o---o---o---o---o---o---o---o---o---o---o "master"
A, B and C are topic branches.
* A has one fix since it was merged up to "next".
* B has finished. It has been fully merged up to "master" and "next",
and is ready to be deleted.
* C has not merged to "next" at all.
We would want to allow C to be rebased, refuse A, and encourage
B to be deleted.
To compute (1):
git rev-list ^master ^topic next
git rev-list ^master next
if these match, topic has not merged in next at all.
To compute (2):
git rev-list master..topic
if this is empty, it is fully merged to "master".
DOC_END

View file

@ -0,0 +1,24 @@
#!/bin/sh
#
# An example hook script to make use of push options.
# The example simply echoes all push options that start with 'echoback='
# and rejects all pushes when the "reject" push option is used.
#
# To enable this hook, rename this file to "pre-receive".
if test -n "$GIT_PUSH_OPTION_COUNT"
then
i=0
while test "$i" -lt "$GIT_PUSH_OPTION_COUNT"
do
eval "value=\$GIT_PUSH_OPTION_$i"
case "$value" in
echoback=*)
echo "echo from the pre-receive-hook: ${value#*=}" >&2
;;
reject)
exit 1
esac
i=$((i + 1))
done
fi

View file

@ -0,0 +1,42 @@
#!/bin/sh
#
# An example hook script to prepare the commit log message.
# Called by "git commit" with the name of the file that has the
# commit message, followed by the description of the commit
# message's source. The hook's purpose is to edit the commit
# message file. If the hook fails with a non-zero status,
# the commit is aborted.
#
# To enable this hook, rename this file to "prepare-commit-msg".
# This hook includes three examples. The first one removes the
# "# Please enter the commit message..." help message.
#
# The second includes the output of "git diff --name-status -r"
# into the message, just before the "git status" output. It is
# commented because it doesn't cope with --amend or with squashed
# commits.
#
# The third example adds a Signed-off-by line to the message, that can
# still be edited. This is rarely a good idea.
COMMIT_MSG_FILE=$1
COMMIT_SOURCE=$2
SHA1=$3
/usr/bin/perl -i.bak -ne 'print unless(m/^. Please enter the commit message/..m/^#$/)' "$COMMIT_MSG_FILE"
# case "$COMMIT_SOURCE,$SHA1" in
# ,|template,)
# /usr/bin/perl -i.bak -pe '
# print "\n" . `git diff --cached --name-status -r`
# if /^#/ && $first++ == 0' "$COMMIT_MSG_FILE" ;;
# *) ;;
# esac
# SOB=$(git var GIT_COMMITTER_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
# git interpret-trailers --in-place --trailer "$SOB" "$COMMIT_MSG_FILE"
# if test -z "$COMMIT_SOURCE"
# then
# /usr/bin/perl -i.bak -pe 'print "\n" if !$first_line++' "$COMMIT_MSG_FILE"
# fi

View file

@ -0,0 +1,78 @@
#!/bin/sh
# An example hook script to update a checked-out tree on a git push.
#
# This hook is invoked by git-receive-pack(1) when it reacts to git
# push and updates reference(s) in its repository, and when the push
# tries to update the branch that is currently checked out and the
# receive.denyCurrentBranch configuration variable is set to
# updateInstead.
#
# By default, such a push is refused if the working tree and the index
# of the remote repository has any difference from the currently
# checked out commit; when both the working tree and the index match
# the current commit, they are updated to match the newly pushed tip
# of the branch. This hook is to be used to override the default
# behaviour; however the code below reimplements the default behaviour
# as a starting point for convenient modification.
#
# The hook receives the commit with which the tip of the current
# branch is going to be updated:
commit=$1
# It can exit with a non-zero status to refuse the push (when it does
# so, it must not modify the index or the working tree).
die () {
echo >&2 "$*"
exit 1
}
# Or it can make any necessary changes to the working tree and to the
# index to bring them to the desired state when the tip of the current
# branch is updated to the new commit, and exit with a zero status.
#
# For example, the hook can simply run git read-tree -u -m HEAD "$1"
# in order to emulate git fetch that is run in the reverse direction
# with git push, as the two-tree form of git read-tree -u -m is
# essentially the same as git switch or git checkout that switches
# branches while keeping the local changes in the working tree that do
# not interfere with the difference between the branches.
# The below is a more-or-less exact translation to shell of the C code
# for the default behaviour for git's push-to-checkout hook defined in
# the push_to_deploy() function in builtin/receive-pack.c.
#
# Note that the hook will be executed from the repository directory,
# not from the working tree, so if you want to perform operations on
# the working tree, you will have to adapt your code accordingly, e.g.
# by adding "cd .." or using relative paths.
if ! git update-index -q --ignore-submodules --refresh
then
die "Up-to-date check failed"
fi
if ! git diff-files --quiet --ignore-submodules --
then
die "Working directory has unstaged changes"
fi
# This is a rough translation of:
#
# head_has_history() ? "HEAD" : EMPTY_TREE_SHA1_HEX
if git cat-file -e HEAD 2>/dev/null
then
head=HEAD
else
head=$(git hash-object -t tree --stdin </dev/null)
fi
if ! git diff-index --quiet --cached --ignore-submodules $head --
then
die "Working directory has staged changes"
fi
if ! git read-tree -u -m "$commit"
then
die "Could not update working tree to new HEAD"
fi

View file

@ -0,0 +1,77 @@
#!/bin/sh
# An example hook script to validate a patch (and/or patch series) before
# sending it via email.
#
# The hook should exit with non-zero status after issuing an appropriate
# message if it wants to prevent the email(s) from being sent.
#
# To enable this hook, rename this file to "sendemail-validate".
#
# By default, it will only check that the patch(es) can be applied on top of
# the default upstream branch without conflicts in a secondary worktree. After
# validation (successful or not) of the last patch of a series, the worktree
# will be deleted.
#
# The following config variables can be set to change the default remote and
# remote ref that are used to apply the patches against:
#
# sendemail.validateRemote (default: origin)
# sendemail.validateRemoteRef (default: HEAD)
#
# Replace the TODO placeholders with appropriate checks according to your
# needs.
validate_cover_letter () {
file="$1"
# TODO: Replace with appropriate checks (e.g. spell checking).
true
}
validate_patch () {
file="$1"
# Ensure that the patch applies without conflicts.
git am -3 "$file" || return
# TODO: Replace with appropriate checks for this patch
# (e.g. checkpatch.pl).
true
}
validate_series () {
# TODO: Replace with appropriate checks for the whole series
# (e.g. quick build, coding style checks, etc.).
true
}
# main -------------------------------------------------------------------------
if test "$GIT_SENDEMAIL_FILE_COUNTER" = 1
then
remote=$(git config --default origin --get sendemail.validateRemote) &&
ref=$(git config --default HEAD --get sendemail.validateRemoteRef) &&
worktree=$(mktemp --tmpdir -d sendemail-validate.XXXXXXX) &&
git worktree add -fd --checkout "$worktree" "refs/remotes/$remote/$ref" &&
git config --replace-all sendemail.validateWorktree "$worktree"
else
worktree=$(git config --get sendemail.validateWorktree)
fi || {
echo "sendemail-validate: error: failed to prepare worktree" >&2
exit 1
}
unset GIT_DIR GIT_WORK_TREE
cd "$worktree" &&
if grep -q "^diff --git " "$1"
then
validate_patch "$1"
else
validate_cover_letter "$1"
fi &&
if test "$GIT_SENDEMAIL_FILE_COUNTER" = "$GIT_SENDEMAIL_FILE_TOTAL"
then
git config --unset-all sendemail.validateWorktree &&
trap 'git worktree remove -ff "$worktree"' EXIT &&
validate_series
fi

View file

@ -0,0 +1,128 @@
#!/bin/sh
#
# An example hook script to block unannotated tags from entering.
# Called by "git receive-pack" with arguments: refname sha1-old sha1-new
#
# To enable this hook, rename this file to "update".
#
# Config
# ------
# hooks.allowunannotated
# This boolean sets whether unannotated tags will be allowed into the
# repository. By default they won't be.
# hooks.allowdeletetag
# This boolean sets whether deleting tags will be allowed in the
# repository. By default they won't be.
# hooks.allowmodifytag
# This boolean sets whether a tag may be modified after creation. By default
# it won't be.
# hooks.allowdeletebranch
# This boolean sets whether deleting branches will be allowed in the
# repository. By default they won't be.
# hooks.denycreatebranch
# This boolean sets whether remotely creating branches will be denied
# in the repository. By default this is allowed.
#
# --- Command line
refname="$1"
oldrev="$2"
newrev="$3"
# --- Safety check
if [ -z "$GIT_DIR" ]; then
echo "Don't run this script from the command line." >&2
echo " (if you want, you could supply GIT_DIR then run" >&2
echo " $0 <ref> <oldrev> <newrev>)" >&2
exit 1
fi
if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then
echo "usage: $0 <ref> <oldrev> <newrev>" >&2
exit 1
fi
# --- Config
allowunannotated=$(git config --type=bool hooks.allowunannotated)
allowdeletebranch=$(git config --type=bool hooks.allowdeletebranch)
denycreatebranch=$(git config --type=bool hooks.denycreatebranch)
allowdeletetag=$(git config --type=bool hooks.allowdeletetag)
allowmodifytag=$(git config --type=bool hooks.allowmodifytag)
# check for no description
projectdesc=$(sed -e '1q' "$GIT_DIR/description")
case "$projectdesc" in
"Unnamed repository"* | "")
echo "*** Project description file hasn't been set" >&2
exit 1
;;
esac
# --- Check types
# if $newrev is 0000...0000, it's a commit to delete a ref.
zero=$(git hash-object --stdin </dev/null | tr '[0-9a-f]' '0')
if [ "$newrev" = "$zero" ]; then
newrev_type=delete
else
newrev_type=$(git cat-file -t $newrev)
fi
case "$refname","$newrev_type" in
refs/tags/*,commit)
# un-annotated tag
short_refname=${refname##refs/tags/}
if [ "$allowunannotated" != "true" ]; then
echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2
echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2
exit 1
fi
;;
refs/tags/*,delete)
# delete tag
if [ "$allowdeletetag" != "true" ]; then
echo "*** Deleting a tag is not allowed in this repository" >&2
exit 1
fi
;;
refs/tags/*,tag)
# annotated tag
if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1
then
echo "*** Tag '$refname' already exists." >&2
echo "*** Modifying a tag is not allowed in this repository." >&2
exit 1
fi
;;
refs/heads/*,commit)
# branch
if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then
echo "*** Creating a branch is not allowed in this repository" >&2
exit 1
fi
;;
refs/heads/*,delete)
# delete branch
if [ "$allowdeletebranch" != "true" ]; then
echo "*** Deleting a branch is not allowed in this repository" >&2
exit 1
fi
;;
refs/remotes/*,commit)
# tracking branch
;;
refs/remotes/*,delete)
# delete tracking branch
if [ "$allowdeletebranch" != "true" ]; then
echo "*** Deleting a tracking branch is not allowed in this repository" >&2
exit 1
fi
;;
*)
# Anything else (is there anything else?)
echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2
exit 1
;;
esac
# --- Finished
exit 0

View file

@ -0,0 +1,6 @@
# git ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~

View file

@ -0,0 +1 @@
0000000000000000000000000000000000000000 449a7c3d095bc8f3d78cf37b9549f8bb4c383f3d Wekuz <wekuz@duck.com> 1740673312 +0200 clone: from https://github.com/hlissner/zsh-autopair

View file

@ -0,0 +1 @@
0000000000000000000000000000000000000000 449a7c3d095bc8f3d78cf37b9549f8bb4c383f3d Wekuz <wekuz@duck.com> 1740673312 +0200 clone: from https://github.com/hlissner/zsh-autopair

View file

@ -0,0 +1 @@
0000000000000000000000000000000000000000 449a7c3d095bc8f3d78cf37b9549f8bb4c383f3d Wekuz <wekuz@duck.com> 1740673312 +0200 clone: from https://github.com/hlissner/zsh-autopair

View file

@ -0,0 +1 @@
449a7c3d095bc8f3d78cf37b9549f8bb4c383f3d

View file

@ -0,0 +1 @@
ref: refs/remotes/origin/master

View file

@ -0,0 +1 @@
449a7c3d095bc8f3d78cf37b9549f8bb4c383f3d

View file

@ -0,0 +1,22 @@
The MIT License (MIT)
Copyright (c) 2016-24 Henrik Lissner.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View file

@ -0,0 +1,249 @@
[![Made with Doom Emacs](https://img.shields.io/badge/Made_with-Doom_Emacs-blueviolet.svg?style=flat-square&logo=GNU%20Emacs&logoColor=white)](https://github.com/hlissner/doom-emacs)
[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](./LICENSE)
![ZSH 5.0.2+](https://img.shields.io/badge/zsh-v5.0.2-orange.svg?style=flat-square)
[![Build Status](https://img.shields.io/travis/hlissner/zsh-autopair/master.svg?label=master&style=flat-square)](https://travis-ci.org/hlissner/zsh-autopair)
# zsh-autopair
A simple plugin that auto-closes, deletes and skips over matching delimiters in
zsh intelligently. Hopefully.
> NOTE: zsh-autopair is untested for versions of Zsh below 5.0.2. Please report
> any issues you have in earlier versions!
Specifically, zsh-autopair does 5 things for you:
1. It inserts matching pairs (by default, that means brackets, quotes and
spaces):
e.g. `echo |` => <kbd>"</kbd> => `echo "|"`
2. It skips over matched pairs:
e.g. `cat ./*.{py,rb|}` => <kbd>}</kbd> => `cat ./*.{py,rb}|`
3. It auto-deletes pairs on backspace:
e.g. `git commit -m "|"` => <kbd>backspace</kbd> => `git commit -m |`
4. And does all of the above only when it makes sense to do so. e.g. when the
pair is balanced and when the cursor isn't next to a boundary character:
e.g. `echo "|""` => <kbd>backspace</kbd> => `echo |""` (doesn't aggressively eat up too many quotes)
5. Spaces between brackets are expanded and contracted.
e.g. `echo [|]` => <kbd>space</kbd> => `echo [ | ]` => <kbd>backspace</kbd> => `echo [|]`
<!-- markdown-toc start - Don't edit this section. Run M-x markdown-toc-refresh-toc -->
**Table of Contents**
- [Install](#install)
- [Antigen](#antigen)
- [zgen](#zgen)
- [zplug](#zplug)
- [Hombrew](#homebrew)
- [Oh My Zsh](#oh-my-zsh)
- [Configuration](#configuration)
- [Adding/Removing pairs](#addingremoving-pairs)
- [Troubleshooting & compatibility issues](#troubleshooting--compatibility-issues)
- [zgen & prezto compatibility](#zgen--prezto-compatibility)
- [text on right-side of cursor interfere with completion](#text-on-right-side-of-cursor-interfere-with-completion)
- [zsh-autopair & isearch?](#zsh-autopair--isearch)
- [Midnight Commander](#midnight-commander)
- [Other resources](#other-resources)
<!-- markdown-toc end -->
## Install
Download and source `autopair.zsh`
```bash
if [[ ! -d ~/.zsh-autopair ]]; then
git clone https://github.com/hlissner/zsh-autopair ~/.zsh-autopair
fi
source ~/.zsh-autopair/autopair.zsh
autopair-init
```
### Hoembrew
`brew install zsh-autopair`
``` bash
# Add to .zshrc
source $HOMEBREW_PREFIX/share/zsh-autopair/autopair.zsh
```
### Antigen
`antigen bundle hlissner/zsh-autopair`
### zgen
```bash
if ! zgen saved; then
echo "Creating a zgen save"
# ... other plugins
zgen load hlissner/zsh-autopair
zgen save
fi
```
### zplug
Load autopair _after compinit_, otherwise, the plugin won't work.
```bash
zplug "hlissner/zsh-autopair", defer:2
```
### Homebrew
For Homebrew users, you can install it through the following command
```shell
brew install zsh-autopair
```
Then source it in your `.zshrc`
```shell
source $(brew --prefix)/share/zsh-autopair/autopair.zsh
```
### Oh My Zsh
1. Clone this repository into `$ZSH_CUSTOM/plugins` (by default `~/.oh-my-zsh/custom/plugins`)
```sh
git clone https://github.com/hlissner/zsh-autopair ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autopair
```
2. Add the plugin to the list of plugins for Oh My Zsh to load (inside `~/.zshrc`):
```sh
plugins=(
# other plugins...
zsh-autopair
)
```
3. Start a new terminal session.
## Configuration
zsh-autopair sets itself up. You can prevent this by setting
`AUTOPAIR_INHIBIT_INIT`.
**Options:**
* `AUTOPAIR_BETWEEN_WHITESPACE` (default: blank): if set, regardless of whether
delimiters are unbalanced or do not meet a boundary check, pairs will be
auto-closed if surrounded by whitespace, BOL or EOL.
* `AUTOPAIR_INHIBIT_INIT` (default: blank): if set, autopair will not
automatically set up keybinds. [Check out the initialization
code](autopair.zsh#L118) if you want to know what it does.
* `AUTOPAIR_PAIRS` (default: ``('`' '`' "'" "'" '"' '"' '{' '}' '[' ']' '(' ')'
' ' ' ')``): An associative array that map pairs. Only one-character pairs are
supported. To modify this, see the "Adding/Removing pairs" section.
* `AUTOPAIR_LBOUNDS`/`AUTOPAIR_RBOUNDS` (default: see below): Associative lists
of regex character groups dictating the 'boundaries' for autopairing depending
on the delimiter. These are their default values:
```bash
AUTOPAIR_LBOUNDS=(all '[.:/\!]')
AUTOPAIR_LBOUNDS+=(quotes '[]})a-zA-Z0-9]')
AUTOPAIR_LBOUNDS+=(spaces '[^{([]')
AUTOPAIR_LBOUNDS+=(braces '')
AUTOPAIR_LBOUNDS+=('`' '`')
AUTOPAIR_LBOUNDS+=('"' '"')
AUTOPAIR_LBOUNDS+=("'" "'")
AUTOPAIR_RBOUNDS=(all '[[{(<,.:?/%$!a-zA-Z0-9]')
AUTOPAIR_RBOUNDS+=(quotes '[a-zA-Z0-9]')
AUTOPAIR_RBOUNDS+=(spaces '[^]})]')
AUTOPAIR_RBOUNDS+=(braces '')
```
For example, if `$AUTOPAIR_LBOUNDS[braces]="[a-zA-Z]"`, then braces (`{([`) won't be
autopaired if the cursor follows an alphabetical character.
Individual delimiters can be used too. Setting `$AUTOPAIR_RBOUNDS['{']="[0-9]"` will
cause <kbd>{</kbd> specifically to not be autopaired when the cursor precedes a number.
### Adding/Removing pairs
You can change the designated pairs in zsh-autopair by modifying the
`AUTOPAIR_PAIRS` envvar. This can be done _before_ initialization like so:
``` sh
typeset -gA AUTOPAIR_PAIRS
AUTOPAIR_PAIRS+=("<" ">")
```
Or after initialization; however, you'll have to bind keys to `autopair-insert`
manually:
```sh
AUTOPAIR_PAIRS+=("<" ">")
bindkey "<" autopair-insert
# prevents breakage in isearch
bindkey -M isearch "<" self-insert
```
To _remove_ pairs, use `unset 'AUTOPAIR_PAIRS[<]'`. Unbinding is optional.
## Troubleshooting & compatibility issues
### zgen & prezto compatibility
Prezto's Editor module is known to reset autopair's bindings. A workaround is to
_defer autopair from initializing_ (by setting `AUTOPAIR_INHIBIT_INIT=1`) and
initialize it manually (by calling `autopair-init`):
``` sh
source "$HOME/.zgen/zgen.zsh"
# Add this
AUTOPAIR_INHIBIT_INIT=1
if ! zgen saved; then
zgen prezto
# ...
zgen load hlissner/zsh-autopair 'autopair.zsh'
#...
zgen save
fi
# And this
autopair-init
```
### text on right-side of cursor interfere with completion
Bind <kbd>Tab</kbd> to `expand-or-complete-prefix` and completion will ignore
what's to the right of cursor:
`bindkey '^I' expand-or-complete-prefix`
This has the unfortunate side-effect of overwriting whatever's right of the
cursor, however.
### zsh-autopair & isearch?
zsh-autopair silently disables itself in isearch, as the two are incompatible.
### Midnight Commander
MC hangs when zsh-autopair tries to bind the space key. This also breaks the MC
subshell.
Disable space expansion to work around this: `unset 'AUTOPAIR_PAIRS[ ]'`
## Other resources
* Works wonderfully with [zsh-syntax-highlight] and
`ZSH_HIGHLIGHT_HIGHLIGHTERS+=brackets`, but zsh-syntax-highlight must be
loaded *after* zsh-autopair.
* Mixes well with these vi-mode zsh modules: [surround], [select-quoted], and
[select-bracketed] (they're built into zsh as of zsh-5.0.8)
* Other relevant repositories of mine:
+ [dotfiles]
+ [emacs.d]
+ [vimrc]
+ [zshrc]
[dotfiles]: https://github.com/hlissner/dotfiles
[vimrc]: https://github.com/hlissner/.vim
[emacs.d]: https://github.com/hlissner/doom-emacs
[zshrc]: https://github.com/hlissner/dotfiles/blob/master/config/zsh/.zshrc
[zsh-syntax-highlighting]: https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/docs/highlighters/pattern.md
[surround]: https://github.com/zsh-users/zsh/blob/master/Functions/Zle/surround
[select-quoted]: https://github.com/zsh-users/zsh/blob/master/Functions/Zle/select-quoted
[select-bracketed]: https://github.com/zsh-users/zsh/blob/master/Functions/Zle/select-bracketed

View file

@ -0,0 +1,4 @@
# <https://github.com/zdharma-continuum/Zsh-100-Commits-Club/blob/master/Zsh-Plugin-Standard.adoc>
0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
0="${${(M)0:#/*}:-$PWD/$0}"
source "${0:A:h}/autopair.zsh"

View file

@ -0,0 +1,227 @@
#!/usr/bin/env zsh
AUTOPAIR_INHIBIT_INIT=${AUTOPAIR_INHIBIT_INIT:-}
AUTOPAIR_BETWEEN_WHITESPACE=${AUTOPAIR_BETWEEN_WHITESPACE:-}
AUTOPAIR_SPC_WIDGET=${AUTOPAIR_SPC_WIDGET:-"$(bindkey " " | cut -c5-)"}
AUTOPAIR_BKSPC_WIDGET=${AUTOPAIR_BKSPC_WIDGET:-"$(bindkey "^?" | cut -c6-)"}
AUTOPAIR_DELWORD_WIDGET=${AUTOPAIR_DELWORD_WIDGET:-"$(bindkey "^w" | cut -c6-)"}
typeset -gA AUTOPAIR_PAIRS
AUTOPAIR_PAIRS=('`' '`' "'" "'" '"' '"' '{' '}' '[' ']' '(' ')' ' ' ' ')
typeset -gA AUTOPAIR_LBOUNDS
AUTOPAIR_LBOUNDS=(all '[.:/\!]')
AUTOPAIR_LBOUNDS+=(quotes '[]})a-zA-Z0-9]')
AUTOPAIR_LBOUNDS+=(spaces '[^{([]')
AUTOPAIR_LBOUNDS+=(braces '')
AUTOPAIR_LBOUNDS+=('`' '`')
AUTOPAIR_LBOUNDS+=('"' '"')
AUTOPAIR_LBOUNDS+=("'" "'")
typeset -gA AUTOPAIR_RBOUNDS
AUTOPAIR_RBOUNDS=(all '[[{(<,.:?/%$!a-zA-Z0-9]')
AUTOPAIR_RBOUNDS+=(quotes '[a-zA-Z0-9]')
AUTOPAIR_RBOUNDS+=(spaces '[^]})]')
AUTOPAIR_RBOUNDS+=(braces '')
### Helpers ############################
# Returns the other pair for $1 (a char), blank otherwise
_ap-get-pair() {
if [[ -n $1 ]]; then
echo ${AUTOPAIR_PAIRS[$1]}
elif [[ -n $2 ]]; then
local i
for i in ${(@k)AUTOPAIR_PAIRS}; do
[[ $2 == ${AUTOPAIR_PAIRS[$i]} ]] && echo $i && break
done
fi
}
# Return 0 if cursor's surroundings match either regexp: $1 (left) or $2 (right)
_ap-boundary-p() {
[[ -n $1 && $LBUFFER =~ "$1$" ]] || [[ -n $2 && $RBUFFER =~ "^$2" ]]
}
# Return 0 if the surrounding text matches any of the AUTOPAIR_*BOUNDS regexps
_ap-next-to-boundary-p() {
local -a groups
groups=(all)
case $1 in
\'|\"|\`) groups+=quotes ;;
\{|\[|\(|\<) groups+=braces ;;
" ") groups+=spaces ;;
esac
groups+=$1
local group
for group in $groups; do
_ap-boundary-p ${AUTOPAIR_LBOUNDS[$group]} ${AUTOPAIR_RBOUNDS[$group]} && return 0
done
return 1
}
# Return 0 if there are the same number of $1 as there are $2 (chars; a
# delimiter pair) in the buffer.
_ap-balanced-p() {
local lbuf="${LBUFFER//\\$1}"
local rbuf="${RBUFFER//\\$2}"
local llen="${#lbuf//[^$1]}"
local rlen="${#rbuf//[^$2]}"
if (( rlen == 0 && llen == 0 )); then
return 0
elif [[ $1 == $2 ]]; then
if [[ $1 == " " ]]; then
# Silence WARN_CREATE_GLOBAL errors
local match=
local mbegin=
local mend=
# Balancing spaces is unnecessary. If there is at least one space on
# either side of the cursor, it is considered balanced.
[[ $LBUFFER =~ "[^'\"]([ ]+)$" && $RBUFFER =~ "^${match[1]}" ]] && return 0
return 1
elif (( llen == rlen || (llen + rlen) % 2 == 0 )); then
return 0
fi
else
local l2len="${#lbuf//[^$2]}"
local r2len="${#rbuf//[^$1]}"
local ltotal=$((llen - l2len))
local rtotal=$((rlen - r2len))
(( ltotal < 0 )) && ltotal=0
(( ltotal < rtotal )) && return 1
return 0
fi
return 1
}
# Return 0 if the last keypress can be auto-paired.
_ap-can-pair-p() {
local rchar="$(_ap-get-pair $KEYS)"
[[ -n $rchar ]] || return 1
if [[ $rchar != " " ]]; then
# Force pair if surrounded by space/[BE]OL, regardless of
# boundaries/balance
[[ -n $AUTOPAIR_BETWEEN_WHITESPACE && \
$LBUFFER =~ "(^|[ ])$" && \
$RBUFFER =~ "^($|[ ])" ]] && return 0
# Don't pair quotes if the delimiters are unbalanced
! _ap-balanced-p $KEYS $rchar && return 1
elif [[ $RBUFFER =~ "^[ ]*$" ]]; then
# Don't pair spaces surrounded by whitespace
return 1
fi
# Don't pair when in front of characters that likely signify the start of a
# string, path or undesirable boundary.
_ap-next-to-boundary-p $KEYS $rchar && return 1
return 0
}
# Return 0 if the adjacent character (on the right) can be safely skipped over.
_ap-can-skip-p() {
if [[ -z $LBUFFER ]]; then
return 1
elif [[ $1 == $2 ]]; then
if [[ $1 == " " ]]; then
return 1
elif ! _ap-balanced-p $1 $2; then
return 1
fi
fi
if ! [[ -n $2 && ${RBUFFER[1]} == $2 && ${LBUFFER[-1]} != '\' ]]; then
return 1
fi
return 0
}
# Return 0 if the adjacent character (on the right) can be safely deleted.
_ap-can-delete-p() {
local lchar="${LBUFFER[-1]}"
local rchar="$(_ap-get-pair $lchar)"
! [[ -n $rchar && ${RBUFFER[1]} == $rchar ]] && return 1
if [[ $lchar == $rchar ]]; then
if [[ $lchar == ' ' && ( $LBUFFER =~ "[^{([] +$" || $RBUFFER =~ "^ +[^]})]" ) ]]; then
# Don't collapse spaces unless in delimiters
return 1
elif ! _ap-balanced-p $lchar $rchar; then
return 1
fi
fi
return 0
}
# Insert $1 and add $2 after the cursor
_ap-self-insert() {
LBUFFER+=$1
RBUFFER="$2$RBUFFER"
}
### Widgets ############################
autopair-insert() {
local rchar="$(_ap-get-pair $KEYS)"
if [[ $KEYS == (\'|\"|\`| ) ]] && _ap-can-skip-p $KEYS $rchar; then
zle forward-char
elif _ap-can-pair-p; then
_ap-self-insert $KEYS $rchar
elif [[ $rchar == " " ]]; then
zle ${AUTOPAIR_SPC_WIDGET:-self-insert}
else
zle self-insert
fi
}
autopair-close() {
if _ap-can-skip-p "$(_ap-get-pair "" $KEYS)" $KEYS; then
zle forward-char
else
zle self-insert
fi
}
autopair-delete() {
_ap-can-delete-p && RBUFFER=${RBUFFER:1}
zle ${AUTOPAIR_BKSPC_WIDGET:-backward-delete-char}
}
autopair-delete-word() {
_ap-can-delete-p && RBUFFER=${RBUFFER:1}
zle ${AUTOPAIR_DELWORD_WIDGET:-backward-delete-word}
}
### Initialization #####################
autopair-init() {
zle -N autopair-insert
zle -N autopair-close
zle -N autopair-delete
zle -N autopair-delete-word
local p
for p in ${(@k)AUTOPAIR_PAIRS}; do
bindkey "$p" autopair-insert
bindkey -M isearch "$p" self-insert
local rchar="$(_ap-get-pair $p)"
if [[ $p != $rchar ]]; then
bindkey "$rchar" autopair-close
bindkey -M isearch "$rchar" self-insert
fi
done
bindkey "^?" autopair-delete
bindkey "^h" autopair-delete
bindkey "^w" autopair-delete-word
bindkey -M isearch "^?" backward-delete-char
bindkey -M isearch "^h" backward-delete-char
bindkey -M isearch "^w" backward-delete-word
}
[[ -n $AUTOPAIR_INHIBIT_INIT ]] || autopair-init

View file

@ -0,0 +1,10 @@
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 4
[*.md]
indent_style = space

View file

@ -0,0 +1,35 @@
dist: trusty
sudo: required
language: generic
env:
- ZSH_VERSION=5.3.1 URL=https://downloads.sourceforge.net/project/zsh/zsh/5.3.1/zsh-5.3.1.tar.xz
- ZSH_VERSION=5.2 URL=https://downloads.sourceforge.net/project/zsh/zsh/5.2/zsh-5.2.tar.xz
- ZSH_VERSION=5.1.1 URL=https://downloads.sourceforge.net/project/zsh/zsh/5.1.1/zsh-5.1.1.tar.xz
- ZSH_VERSION=5.0.8 URL=https://downloads.sourceforge.net/project/zsh/zsh/5.0.8/zsh-5.0.8.tar.gz
addons:
apt:
packages:
- build-essential
before_install:
- export LOCAL="$(mktemp --directory --tmpdir=${TMPDIR:/tmp} local.bin.XXXXXX)"
- wget $URL
- tar -xf zsh-$ZSH_VERSION.tar.*
- cd zsh-$ZSH_VERSION
- ./configure --prefix=$LOCAL
- make
- make install
- cd -
- export PATH="$LOCAL/bin:$HOME/bin:$PATH"
before_script:
- mkdir -p ~/bin
- curl -L https://github.com/zunit-zsh/zunit/releases/download/v0.8.1/zunit > ~/bin/zunit
- curl -L https://raw.githubusercontent.com/molovo/revolver/master/revolver > ~/bin/revolver
- chmod u+x ~/bin/{revolver,zunit}
script:
- zunit --verbose

View file

@ -0,0 +1,8 @@
tap: false
directories:
tests: tests
output: tests/_output
support: tests/_support
time_limit: 0
fail_fast: false
allow_risky: false

View file

@ -0,0 +1,4 @@
# <https://github.com/zdharma-continuum/Zsh-100-Commits-Club/blob/master/Zsh-Plugin-Standard.adoc>
0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
0="${${(M)0:#/*}:-$PWD/$0}"
source "${0:A:h}/autopair.zsh"

View file

@ -0,0 +1,15 @@
#!/usr/bin/env zsh
source autopair.zsh
export KEYS=
export LBUFFER=
export RBUFFER=
assert_true() {
run $@
assert $state equals 0
}
assert_false() {
run $@
assert $state equals 1
}

View file

@ -0,0 +1,16 @@
#!/usr/bin/env zunit
@test 'basic boundary tests' {
LBUFFER="abc"
RBUFFER="123"
assert_false _ap-boundary-p " " " "
assert_true _ap-boundary-p "[^3]" "[^a]"
assert_false _ap-boundary-p "[^c]" "[^1]"
assert_true _ap-boundary-p "c" " "
assert_true _ap-boundary-p " " "1"
}
@test 'no boundary on blank line' {
LBUFFER=
RBUFFER=
assert_false _ap-next-to-boundary-p "{"
}

View file

@ -0,0 +1,24 @@
#!/usr/bin/env zunit
@test 'delete if next to space and pair' {
LBUFFER="[ " RBUFFER=" ]" assert_true _ap-can-delete-p
}
@test 'delete if next to homogeneous counter-pair' {
LBUFFER="'" RBUFFER="'" assert_true _ap-can-delete-p
}
@test 'delete if next to heterogeneous counter-pair' {
LBUFFER="(" RBUFFER=")" assert_true _ap-can-delete-p
}
@test 'do not delete if at eol' {
LBUFFER="'" assert_false _ap-can-delete-p
}
@test 'do not delete if within too many spaces' {
LBUFFER="[ " RBUFFER=" ]" assert_false _ap-can-delete-p
}
@test 'do not delete if only next to space' {
LBUFFER=" " RBUFFER=" " assert_false _ap-can-delete-p
}

View file

@ -0,0 +1,59 @@
#!/usr/bin/env zunit
@test 'pair if blank line' {
KEYS="'" LBUFFER="" RBUFFER="" assert_true _ap-can-pair-p
}
@test 'pair if next to balanced delimiter' { # {{|}}
KEYS="{" LBUFFER="{" RBUFFER="}" assert_true _ap-can-pair-p
}
@test 'pair space if next to brackets' { # { | }
KEYS=" "
LBUFFER="{" RBUFFER="}" assert_true _ap-can-pair-p
LBUFFER="[" RBUFFER="]" assert_true _ap-can-pair-p
LBUFFER="(" RBUFFER=")" assert_true _ap-can-pair-p
}
@test 'pair brackets at the end of a word' { # abc{|}
KEYS='{' LBUFFER="hello" assert_true _ap-can-pair-p
}
@test 'do not pair brackets at the beginning of a word' { # {|abc
KEYS='{' RBUFFER="hello" assert_false _ap-can-pair-p
}
@test 'do not pair quotes next to a word' {
KEYS="'"
LBUFFER="hello" assert_false _ap-can-pair-p # abc"|
RBUFFER="hello" assert_false _ap-can-pair-p # "|abc
}
@test 'do not pair the same quotes from inside quotes' { # ""|"
KEYS='"' LBUFFER='"' RBUFFER='"' assert_false _ap-can-pair-p
}
@test 'do not pair if delimiter is invalid' {
KEYS="<" LBUFFER="<" RBUFFER=">" assert_false _ap-can-pair-p
}
@test 'do not pair if next to unbalanced delimiter' { # {|}
KEYS="{" LBUFFER="" RBUFFER="}" assert_false _ap-can-pair-p
}
@test 'do not pair if next to unbalanced delimiter after space' { # {| }
AUTOPAIR_BETWEEN_WHITESPACE=
KEYS="{" LBUFFER="" RBUFFER=" }" assert_false _ap-can-pair-p
KEYS="{" LBUFFER="" RBUFFER=" }" assert_false _ap-can-pair-p
KEYS="{" LBUFFER=" " RBUFFER=" }" assert_false _ap-can-pair-p
}
@test 'do not pair space if next to non-brackets/spaces' {
KEYS=" "
LBUFFER="'" RBUFFER="'" assert_false _ap-can-pair-p # ' |'
LBUFFER="abc" RBUFFER="xyz" assert_false _ap-can-pair-p # abc |xyz'
LBUFFER="[ " RBUFFER=" ]" assert_false _ap-can-pair-p # [ | ]
}
@test 'AUTOPAIR_BETWEEN_WHITESPACE=1' {
AUTOPAIR_BETWEEN_WHITESPACE=1 KEYS='{' LBUFFER=" " RBUFFER=" }" assert_true _ap-can-pair-p
}

View file

@ -0,0 +1,25 @@
#!/usr/bin/env zunit
@test 'fail skip-check on blank line' {
LBUFFER='' RBUFFER='' assert_false _ap-can-skip-p '{' '}'
}
@test 'fail skip-check on wrong pair' {
LBUFFER='"' RBUFFER='"' assert_false _ap-can-skip-p '{' '}'
}
@test 'skip if next to homogeneous counter-pair' {
LBUFFER='"' RBUFFER='"' assert_true _ap-can-skip-p '"' '"'
}
@test 'skip if next to heterogeneous counter-pair' {
LBUFFER='{' RBUFFER='}' assert_true _ap-can-skip-p '{' '}'
}
@test 'do not skip if next to unbalanced, homogeneous counter-pair' {
LBUFFER='' RBUFFER='"' assert_false _ap-can-skip-p '"' '"'
}
@test 'do not skip if next to unbalanced, heterogeneous counter-pair' {
LBUFFER='' RBUFFER='}' assert_false _ap-can-skip-p '{' '}'
}

View file

@ -0,0 +1,26 @@
#!/usr/bin/env zunit
@test 'existing pair' {
assert $(_ap-get-pair "{") same_as "}"
}
@test 'existing right-pair' {
assert $(_ap-get-pair "" "}") same_as "{"
}
@test 'non-existent pair' {
assert $(_ap-get-pair "<") same_as ""
}
@test 'non-existent right-pair' {
assert $(_ap-get-pair "" ">") same_as ""
}
@test 'all default pairs' {
assert '"' in ${(@k)AUTOPAIR_PAIRS}
assert "'" in ${(@k)AUTOPAIR_PAIRS}
assert '`' in ${(@k)AUTOPAIR_PAIRS}
assert '{' in ${(@k)AUTOPAIR_PAIRS}
assert '[' in ${(@k)AUTOPAIR_PAIRS}
assert '(' in ${(@k)AUTOPAIR_PAIRS}
assert ' ' in ${(@k)AUTOPAIR_PAIRS}
}

100
executable_dot_zshrc Normal file
View file

@ -0,0 +1,100 @@
if [ -n "${ZSH_DEBUG_STARTUP+1}" ]; then
zmodload zsh/zprof
fi
HISTFILE=~/.histfile
HISTSIZE=10000
SAVEHIST=10000
setopt INC_APPEND_HISTORY
EDITOR=nvim
export MANPAGER='nvim +Man!'
PROMPT="
[%n@%m %~]%(?..%F{red})>%f "
zstyle :compinstall filename '/home/wekuz/.zshrc'
autoload -Uz compinit
compinit
export PATH="$PATH:/home/wekuz/.local/bin"
export PATH="$PATH:$HOME/.cargo/bin"
ZSH_CONFIG_FILES=(
fixkeys
options
aliases
completions
autostart
)
for filename in "${ZSH_CONFIG_FILES[@]}"; do
[ -r "$XDG_CONFIG_HOME/zsh/config/$filename.zsh" ] && source "$XDG_CONFIG_HOME/zsh/config/$filename.zsh"
done
function plugin-compile {
ZPLUGINDIR=${ZPLUGINDIR:-$HOME/.config/zsh/plugins}
autoload -U zrecompile
local f
for f in $ZPLUGINDIR/**/*.zsh{,-theme}(N); do
zrecompile -pq "$f"
done
}
function plugin-clone {
local repo plugdir initfile initfiles=()
ZPLUGINDIR=${ZPLUGINDIR:-${ZDOTDIR:-$HOME/.config/zsh}/plugins}
for repo in $@; do
plugdir=$ZPLUGINDIR/${repo:t}
initfile=$plugdir/${repo:t}.plugin.zsh
if [[ ! -d $plugdir ]]; then
echo "Cloning $repo..."
git clone -q --depth 1 --recursive --shallow-submodules \
https://github.com/$repo $plugdir
fi
if [[ ! -e $initfile ]]; then
initfiles=($plugdir/*.{plugin.zsh,zsh-theme,zsh,sh}(N))
(( $#initfiles )) && ln -sf $initfiles[1] $initfile
fi
done
plugin-compile
}
function plugin-source {
local plugdir
ZPLUGINDIR=${ZPLUGINDIR:-${ZDOTDIR:-$HOME/.config/zsh}/plugins}
for plugdir in $@; do
[[ $plugdir = /* ]] || plugdir=$ZPLUGINDIR/$plugdir
fpath+=$plugdir
local initfile=$plugdir/${plugdir:t}.plugin.zsh
(( $+functions[zsh-defer] )) && zsh-defer . $initfile || . $initfile
done
}
function plugin-update {
ZPLUGINDIR=${ZPLUGINDIR:-$HOME/.config/zsh/plugins}
for d in $ZPLUGINDIR/*/.git(/); do
echo "Updating ${d:h:t}..."
command git -C "${d:h}" pull --ff --recurse-submodules --depth 1 --rebase --autostash
done
plugin-compile
echo "Plugins updated"
}
ZSH_PLUGIN_REPOS=(
hlissner/zsh-autopair
zsh-users/zsh-syntax-highlighting
zsh-users/zsh-autosuggestions
)
ZSH_PLUGINS=(
zsh-autopair
zsh-syntax-highlighting
zsh-autosuggestions
)
# plugin-clone $ZSH_PLUGIN_REPOS
plugin-source $ZSH_PLUGINS
if [ -n "${ZSH_DEBUG_STARTUP+1}" ]; then
zprof
fi

14
private_dot_ssh/config Normal file
View file

@ -0,0 +1,14 @@
AddKeysToAgent yes
Match host github.com user git
IdentityFile ~/.ssh/id_ed25519_github
IdentitiesOnly yes
Match host git.wekuz.localplayer.dev user git
Port 15837
IdentityFile ~/.ssh/id_ed25519_github
IdentitiesOnly yes
Match host 192.168.1.111 user wekuz
IdentityFile ~/.ssh/id_ed25519_raspberrypie
IdentitiesOnly yes