Moved all backups in a dedicated folder for better organization and updated the dot script with wipes, colors and non-home path support

master
Wynd 2026-01-18 01:03:12 +02:00
parent 8c973bf185
commit 0b0157c642
45 changed files with 160 additions and 398 deletions

View File

@ -1,12 +0,0 @@
local port = os.getenv("GDScript_Port") or "6005"
local cmd = vim.lsp.rpc.connect("127.0.0.1", port)
local pipe = "/tmp/godot.pipe"
vim.lsp.start({
name = "Godot",
cmd = cmd,
root_dir = vim.fs.dirname(vim.fs.find({ "project.godot", ".git" }, { upward = true })[1]),
on_attach = function(client, bufnr)
vim.api.nvim_command('echo serverstart("' .. pipe .. '")')
end,
})

View File

@ -1,11 +0,0 @@
return {
{
"folke/twilight.nvim",
opts = {},
},
{
"folke/zen-mode.nvim",
opts = {},
},
}

View File

@ -1,323 +0,0 @@
;; NOTE In this file later patterns are assumed to have priority!
;; Punctuation
["(" ")" "[" "]" "{" "}" "(<" ">)" "[<" ">]" "{|" "|}"] @punctuation.bracket
[";" "," ":" "::"] @punctuation.delimiter
;; Constant
(const_ident) @constant
["true" "false"] @boolean
["null"] @constant.builtin
;; Variable
[(ident) (ct_ident)] @variable
;; 1) Member
(field_expr field: (access_ident (ident) @variable.member))
(struct_member_declaration (ident) @variable.member)
(struct_member_declaration (identifier_list (ident) @variable.member))
(bitstruct_member_declaration (ident) @variable.member)
(initializer_list (arg (param_path (param_path_element (ident) @variable.member))))
;; 2) Parameter
(parameter name: (_) @variable.parameter)
(call_invocation (arg (param_path (param_path_element [(ident) (ct_ident)] @variable.parameter))))
(enum_param_declaration (ident) @variable.parameter)
;; 3) Declaration
(global_declaration (ident) @variable.declaration)
(local_decl_after_type name: [(ident) (ct_ident)] @variable.declaration)
(var_decl name: [(ident) (ct_ident)] @variable.declaration)
(try_unwrap (ident) @variable.declaration)
(catch_unwrap (ident) @variable.declaration)
;; Keyword (from `c3c --list-keywords`)
[
"assert"
"asm"
"catch"
"defer"
"try"
"var"
] @keyword
[
"$alignof"
"$and"
"$append"
"$assert"
"$assignable"
"$case"
"$concat"
"$default"
"$defined"
"$echo"
"$else"
"$embed"
"$endfor"
"$endforeach"
"$endif"
"$endswitch"
"$eval"
"$evaltype"
"$error"
"$exec"
"$extnameof"
"$feature"
"$for"
"$foreach"
"$if"
"$include"
"$is_const"
"$nameof"
"$offsetof"
"$or"
"$qnameof"
"$sizeof"
"$stringify"
"$switch"
"$typefrom"
"$typeof"
"$vacount"
"$vatype"
"$vaconst"
"$varef"
"$vaarg"
"$vaexpr"
"$vasplat"
] @keyword.directive
"fn" @keyword.function
"macro" @keyword.function
"return" @keyword.return
"import" @keyword.import
"module" @keyword.module
[
"bitstruct"
"def"
"distinct"
"enum"
"fault"
"interface"
"struct"
"union"
] @keyword.type
[
"case"
"default"
"else"
"if"
"nextcase"
"switch"
] @keyword.conditional
[
"break"
"continue"
"do"
"for"
"foreach"
"foreach_r"
"while"
] @keyword.repeat
[
"const"
"extern"
"inline"
"static"
"tlocal"
] @keyword.modifier
;; Operator (from `c3c --list-operators`)
[
"&"
"!"
"~"
"|"
"^"
;; ":"
;; ","
;; ";"
"="
">"
"/"
"."
;; "#"
"<"
;; "{"
;; "["
;; "("
"-"
"%"
"+"
"?"
;; "}"
;; "]"
;; ")"
"*"
;; "_"
"&&"
;; "->"
"!!"
"&="
"|="
"^="
"/="
".."
"?:"
"=="
">="
"=>"
"<="
;; "{|"
;; "(<"
;; "[<"
"-="
"--"
"%="
"*="
"!="
"||"
"+="
"++"
;; "|}"
;; ">)"
;; ">]"
"??"
;; "::"
"<<"
">>"
"..."
"<<="
">>="
] @operator
(range_expr ":" @operator)
(foreach_cond ":" @operator)
(ternary_expr
[
"?"
":"
] @keyword.conditional.ternary)
(elvis_orelse_expr
[
"?:"
"??"
] @keyword.conditional.ternary)
;; Literal
(integer_literal) @number
(real_literal) @number.float
(char_literal) @character
(bytes_literal) @number
;; String
(string_literal) @string
(raw_string_literal) @string
;; Escape Sequence
(escape_sequence) @string.escape
;; Builtin (constants)
((builtin) @constant.builtin (#match? @constant.builtin "_*[A-Z][_A-Z0-9]*"))
;; Type Property (from `c3c --list-type-properties`)
(type_access_expr (access_ident [(ident) "typeid"] @variable.builtin
(#any-of? @variable.builtin
"alignof"
"associated"
"elements"
"extnameof"
"inf"
"is_eq"
"is_ordered"
"is_substruct"
"len"
"max"
"membersof"
"min"
"nan"
"inner"
"kindof"
"names"
"nameof"
"params"
"parentof"
"qnameof"
"returns"
"sizeof"
"values"
;; Extra token
"typeid")))
;; Label
[
(label)
(label_target)
] @label
;; Module
(module_resolution (ident) @module)
(module (path_ident (ident) @module))
(import_declaration (path_ident (ident) @module))
;; Attribute
(attribute name: (_) @attribute)
(define_attribute name: (_) @attribute)
(call_inline_attributes (at_ident) @attribute)
(asm_block_stmt (at_ident) @attribute)
;; Type
[
(type_ident)
(ct_type_ident)
] @type
(base_type_name) @type.builtin
;; Function Definition
(func_header name: (_) @function)
(func_header method_type: (_) name: (_) @function.method)
;; NOTE macro_declaration can also have a func_header
(macro_header name: (_) @function)
(macro_header method_type: (_) name: (_) @function.method)
;; Function Call
(call_expr function: [(ident) (at_ident)] @function.call)
(call_expr function: [(builtin)] @function.builtin.call)
(call_expr function: (module_ident_expr ident: (_) @function.call))
(call_expr function: (trailing_generic_expr argument: (module_ident_expr ident: (_) @function.call)))
(call_expr function: (field_expr field: (access_ident [(ident) (at_ident)] @function.method.call))) ; NOTE Ambiguous, could be calling a method or function pointer
;; Method on type
(call_expr function: (type_access_expr field: (access_ident [(ident) (at_ident)] @function.method.call)))
;; Assignment
;; (assignment_expr left: (ident) @variable.member)
;; (assignment_expr left: (module_ident_expr (ident) @variable.member))
;; (assignment_expr left: (field_expr field: (_) @variable.member))
;; (assignment_expr left: (unary_expr operator: "*" @variable.member))
;; (assignment_expr left: (subscript_expr ["[" "]"] @variable.member))
;; (update_expr argument: (ident) @variable.member)
;; (update_expr argument: (module_ident_expr ident: (ident) @variable.member))
;; (update_expr argument: (field_expr field: (_) @variable.member))
;; (update_expr argument: (unary_expr operator: "*" @variable.member))
;; (update_expr argument: (subscript_expr ["[" "]"] @variable.member))
;; (unary_expr operator: ["--" "++"] argument: (ident) @variable.member)
;; (unary_expr operator: ["--" "++"] argument: (module_ident_expr (ident) @variable.member))
;; (unary_expr operator: ["--" "++"] argument: (field_expr field: (access_ident (ident)) @variable.member))
;; (unary_expr operator: ["--" "++"] argument: (subscript_expr ["[" "]"] @variable.member))
;; Asm
(asm_instr [(ident) "int"] @function.builtin)
(asm_expr [(ct_ident) (ct_const_ident)] @variable.builtin)
;; Comment
[
(line_comment)
(block_comment)
] @comment @spell
(doc_comment) @comment.documentation @spell

View File

@ -1,16 +0,0 @@
#!/bin/bash
(
for FOLDER in ./*/; do
# gio set "$FOLDER" -t unset metadata::custom-icon
for img in ./"$FOLDER"/*; do
if [[ ${img##*.} == "jpg" ]] || [[ ${img##*.} == "png" ]] || [[ ${img##*.} == "webp" ]]; then
IMAGENAME="$(basename "$img")"
break
fi
done
if [[ -n $IMAGENAME ]]; then
gio set "$FOLDER" -t string metadata::custom-icon "$IMAGENAME"
unset IMAGENAME
fi
done
)

View File

@ -9,3 +9,4 @@
127.0.0.1 food.wynd.local 127.0.0.1 food.wynd.local
127.0.0.1 firefly.wynd.local 127.0.0.1 firefly.wynd.local
127.0.0.1 vault.wynd.local 127.0.0.1 vault.wynd.local
127.0.0.1 test.wynd.local

View File

@ -2,32 +2,33 @@
## plugins used ## plugins used
- [telescope-fzf-native.nvim](https://github.com/nvim-telescope/telescope-fzf-native.nvim.git)
- [luvit-meta](https://github.com/Bilal2453/luvit-meta.git)
- [neo-tree.nvim](https://github.com/nvim-neo-tree/neo-tree.nvim.git) - [neo-tree.nvim](https://github.com/nvim-neo-tree/neo-tree.nvim.git)
- [nvim-notify](https://github.com/rcarriga/nvim-notify.git)
- [nvim-web-devicons](https://github.com/nvim-tree/nvim-web-devicons.git) - [nvim-web-devicons](https://github.com/nvim-tree/nvim-web-devicons.git)
- [hurl.nvim](https://github.com/jellydn/hurl.nvim.git) - [lualine.nvim](https://github.com/nvim-lualine/lualine.nvim.git)
- [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim.git)
- [nui.nvim](https://github.com/MunifTanjim/nui.nvim.git) - [nui.nvim](https://github.com/MunifTanjim/nui.nvim.git)
- [mini.map](https://github.com/echasnovski/mini.map.git)
- [plenary.nvim](https://github.com/nvim-lua/plenary.nvim.git)
- [which-key.nvim](https://github.com/folke/which-key.nvim.git)
- [lazy.nvim](https://github.com/folke/lazy.nvim.git)
- [git-conflict.nvim](https://github.com/akinsho/git-conflict.nvim.git) - [git-conflict.nvim](https://github.com/akinsho/git-conflict.nvim.git)
- [friendly-snippets](https://github.com/rafamadriz/friendly-snippets.git)
- [hurl.nvim](https://github.com/jellydn/hurl.nvim.git)
- [outline.nvim](https://github.com/hedyhli/outline.nvim.git)
- [vim-cool](https://github.com/romainl/vim-cool.git)
- [trouble.nvim](https://github.com/folke/trouble.nvim.git)
- [conform.nvim](https://github.com/stevearc/conform.nvim.git)
- [Comment.nvim](https://github.com/numToStr/Comment.nvim.git)
- [todo-comments.nvim](https://github.com/folke/todo-comments.nvim.git)
- [nvim-ts-autotag](https://github.com/windwp/nvim-ts-autotag.git)
- [dressing.nvim](https://github.com/stevearc/dressing.nvim.git) - [dressing.nvim](https://github.com/stevearc/dressing.nvim.git)
- [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig.git) - [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig.git)
- [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim.git)
- [which-key.nvim](https://github.com/folke/which-key.nvim.git)
- [fidget.nvim](https://github.com/j-hui/fidget.nvim.git)
- [lualine.nvim](https://github.com/nvim-lualine/lualine.nvim.git)
- [lazydev.nvim](https://github.com/folke/lazydev.nvim.git)
- [plenary.nvim](https://github.com/nvim-lua/plenary.nvim.git)
- [luvit-meta](https://github.com/Bilal2453/luvit-meta.git)
- [mini.map](https://github.com/echasnovski/mini.map.git)
- [nvim-ts-autotag](https://github.com/windwp/nvim-ts-autotag.git)
- [lazy.nvim](https://github.com/folke/lazy.nvim.git)
- [vim-cool](https://github.com/romainl/vim-cool.git)
- [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter.git)
- [conform.nvim](https://github.com/stevearc/conform.nvim.git)
- [todo-comments.nvim](https://github.com/folke/todo-comments.nvim.git)
- [catppuccin](https://github.com/catppuccin/nvim.git)
- [Comment.nvim](https://github.com/numToStr/Comment.nvim.git)
- [nvim-notify](https://github.com/rcarriga/nvim-notify.git)
- [nvim-surround](https://github.com/kylechui/nvim-surround.git) - [nvim-surround](https://github.com/kylechui/nvim-surround.git)
- [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter.git)
- [fidget.nvim](https://github.com/j-hui/fidget.nvim.git)
- [catppuccin](https://github.com/catppuccin/nvim.git)
- [lazydev.nvim](https://github.com/folke/lazydev.nvim.git)
- [blink.cmp](https://github.com/saghen/blink.cmp.git) - [blink.cmp](https://github.com/saghen/blink.cmp.git)
- [trouble.nvim](https://github.com/folke/trouble.nvim.git)
- [telescope-fzf-native.nvim](https://github.com/nvim-telescope/telescope-fzf-native.nvim.git)
- [friendly-snippets](https://github.com/rafamadriz/friendly-snippets.git)

View File

@ -16,10 +16,12 @@ autocmd("BufEnter", {
user_command("ExportPlugins", function() user_command("ExportPlugins", function()
local plugins = require("lazy").plugins() local plugins = require("lazy").plugins()
local f, err = io.open("plugins", "w+") local f, err = io.open("README.md", "w+")
if f then if f then
f:write("# neovim config\n\n")
f:write("## plugins used\n\n")
for _, v in ipairs(plugins) do for _, v in ipairs(plugins) do
local plugin = string.format("[%s](%s)\n", v.name, v.url) local plugin = string.format("- [%s](%s)\n", v.name, v.url)
f:write(plugin) f:write(plugin)
end end

View File

@ -0,0 +1,5 @@
(
ROOT="$(pwd)"
clear
git-heatmap -a="Wynd" --root-dir "$ROOT" --split-months --months-per-row 7 --format numbers --use-author-time $@
)

View File

@ -0,0 +1,10 @@
#!/usr/bin/env bash
(
ROOT="$(pwd)"
clear
git-heatmap \
-r "$ROOT" -b "" \
-a "Wynd" --since $(date -d "5 years ago" +%Y-%m-%d) --until today \
--months-per-row 12 --split-months --use-author-time $@
)

View File

@ -0,0 +1,19 @@
#!/usr/bin/env bash
(
paths=(
"/home/wynd/Programming/Archive"
"/home/wynd/Programming/Active"
"/home/wynd/Lab"
)
root_dir=""
for f in ${paths[@]}; do
root_dir="$root_dir--root-dir $f "
done
clear
git-heatmap \
$root_dir \
-a="Wynd" --split-months --use-author-time $@
)

View File

@ -0,0 +1,20 @@
#!/usr/bin/env bash
(
paths=(
"/home/wynd/Programming/Archive"
"/home/wynd/Programming/Active"
"/home/wynd/Lab"
)
root_dir=""
for f in ${paths[@]}; do
root_dir="$root_dir--root-dir $f "
done
clear
git-heatmap \
$root_dir \
-a "Wynd" --since $(date -d "5 years ago" +%Y-%m-%d) --until today \
--months-per-row 12 --split-months --use-author-time $@
)

View File

@ -0,0 +1,19 @@
#!/usr/bin/env bash
(
paths=(
"/home/wynd/Programming/Archive"
"/home/wynd/Programming/Active"
"/home/wynd/Lab"
)
root_dir=""
for f in ${paths[@]}; do
root_dir="$root_dir--root-dir $f "
done
clear
git-heatmap \
$root_dir \
-a="Wynd" --split-months --months-per-row 7 --format numbers --use-author-time $@
)

49
dot.py
View File

@ -2,18 +2,37 @@
import os import os
import re import re
from shutil import copyfile import shutil
from toml import load from toml import load
from glob import glob from glob import glob
from argparse import ArgumentParser from argparse import ArgumentParser
FG_GREEN = "\x1b[32m"
FG_RED = "\x1b[31m"
BACKUP_FOLDER = "./backup"
def is_root() -> bool:
"""
Not the most "correct" way but since this is for personal usage I don't care
"""
return os.geteuid() == 0
def manage_dot_files(dots, deploy=False, wipe=False):
if wipe:
# Nuke everything and bring the new stuff in
# Easy way to remove old stuff thats no longer linked in dot.toml
if not deploy:
shutil.rmtree(BACKUP_FOLDER)
os.makedirs(BACKUP_FOLDER, exist_ok=True)
def manage_dot_files(dots, deploy=False):
home_path = os.path.expanduser("~/")
for dot in dots: for dot in dots:
path = os.path.expanduser(dot["path"]) path = os.path.expanduser(dot["path"])
if deploy: if deploy:
path = str(path).replace(home_path, "./") path = BACKUP_FOLDER + path
ignore_list = dot["ignore"] if "ignore" in dot else [] ignore_list = dot["ignore"] if "ignore" in dot else []
for file in glob(path, recursive=True): for file in glob(path, recursive=True):
exp_pass = True exp_pass = True
@ -22,14 +41,18 @@ def manage_dot_files(dots, deploy=False):
if match is not None: if match is not None:
exp_pass = False exp_pass = False
break break
if exp_pass and os.path.isfile(file): if exp_pass and os.path.isfile(file):
if deploy: if deploy:
dest_path = file.replace("./", home_path) dest_path = file.replace(BACKUP_FOLDER, "")
else: else:
dest_path = file.replace(home_path, "./") dest_path = BACKUP_FOLDER + file
os.makedirs(os.path.dirname(dest_path), exist_ok=True) os.makedirs(os.path.dirname(dest_path), exist_ok=True)
copyfile(file, dest_path) try:
print(f"{file} -> {dest_path}") shutil.copy(file, dest_path)
print(f"{FG_GREEN}{file} -> {dest_path}")
except OSError:
print(f"{FG_RED}{file} requires root access to write, skipping")
if __name__ == "__main__": if __name__ == "__main__":
@ -52,10 +75,18 @@ if __name__ == "__main__":
default=False, default=False,
dest="deploy", dest="deploy",
) )
parser.add_argument(
"--wipe",
action="store_true",
help="Wipes the backup folder before bringing in the new backups, only works with --init flag",
required=False,
default=True,
dest="wipe",
)
args = parser.parse_args() args = parser.parse_args()
if args.init: if args.init:
manage_dot_files(config) manage_dot_files(config, False, args.wipe)
elif args.deploy: elif args.deploy:
manage_dot_files(config, True) manage_dot_files(config, True)
else: else:

View File

@ -15,7 +15,6 @@ path = "~/.config/tmux/tmux.conf"
[[dots]] [[dots]]
path = "~/.config/nvim/**/*" path = "~/.config/nvim/**/*"
ignore = ["README.md$", "/plugins$"]
[[dots]] [[dots]]
path = "~/.config/mpv/*.conf" path = "~/.config/mpv/*.conf"
@ -38,6 +37,23 @@ path = "~/.local/bin/best-gif.sh"
[[dots]] [[dots]]
path = "~/.local/bin/make-gif.sh" path = "~/.local/bin/make-gif.sh"
# [[dots]] [[dots]]
# path = "~/.config/nushell/*" path = "~/.local/bin/repos.sh"
# ignore = ["history.txt", "/completions$"]
[[dots]]
path = "~/.local/bin/reposn.sh"
[[dots]]
path = "~/.local/bin/repos5y.sh"
[[dots]]
path = "~/.local/bin/repoc.sh"
[[dots]]
path = "~/.local/bin/repoc5y.sh"
[[dots]]
path = "/etc/hosts"
[[dots]]
path = "/etc/fstab"