Compare commits

..

No commits in common. "main" and "422c836948e5392fe0903a78acf6c4ddfddf256d" have entirely different histories.

70 changed files with 675 additions and 7451 deletions

3
.deps
View File

@ -1,3 +0,0 @@
github.com/make-go-great/color-go
github.com/make-go-great/copy-go
github.com/make-go-great/diff-go

View File

@ -1,10 +0,0 @@
version: 2
updates:
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "daily"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"

View File

@ -1,16 +0,0 @@
name: gitleaks
on:
push:
pull_request:
jobs:
scan:
name: gitleaks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: gitleaks/gitleaks-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

40
.github/workflows/go.yaml vendored Normal file
View File

@ -0,0 +1,40 @@
name: Go
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: "~1.17"
- run: go test -race ./...
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: "~1.17"
- run: go build ./cmd/dot
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: golangci/golangci-lint-action@v2
with:
version: latest

View File

@ -1,58 +0,0 @@
name: Go
on:
push:
branches:
- main
paths:
- "**.go"
- "go.mod"
- "go.sum"
pull_request:
branches:
- main
paths:
- "**.go"
- "go.mod"
- "go.sum"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "stable"
- run: go test -race -coverprofile=coverage.out ./...
- uses: codecov/codecov-action@v5
with:
files: coverage.out
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "stable"
- run: go build ./cmd/dot
golangci-lint:
name: golangci-lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "stable"
- uses: golangci/golangci-lint-action@v6
with:
version: latest

7
.gitignore vendored
View File

@ -5,10 +5,7 @@
*.exe
# IntelliJ
.idea
.idea/
# VSCode
.vscode
# Go
coverage.out
.vscode/

View File

@ -1,95 +0,0 @@
run:
timeout: 5m
tests: false
output:
sort-results: true
linters:
disable-all: true
enable:
# Default
- errcheck
- gosimple
- govet
- ineffassign
- staticcheck
- typecheck
- unused
# Custom
- bodyclose
- err113
- errchkjson
- errname
- errorlint
- fatcontext
- forcetypeassert
- gocritic
- gofumpt
- gosec
- importas
- makezero
- nilnil
- noctx
- prealloc
- reassign
- sqlclosecheck
- unconvert
fast: true
linters-settings:
# Default
govet:
disable-all: true
enable:
- assign
- atomic
- bools
- buildtag
- composites
- copylocks
- fieldalignment
- httpresponse
- loopclosure
- lostcancel
- nilfunc
- printf
- unmarshal
- unreachable
- unusedresult
staticcheck:
checks: ["all", "-SA1019"]
# Custom
gocritic:
disabled-checks:
- ifElseChain
- singleCaseSwitch
- unnamedResult
- whyNoLint
enabled-tags:
- diagnostic
- style
gosec:
excludes:
- G101
- G112
- G115
- G204
- G402
- G404
- G501
- G505
exclude-generated: true
reassign:
patterns:
- ".*"
issues:
exclude-dirs:
- ".*test.*"
- ".*mock.*"
- ".*example.*"
- ".*utils.*"
exclude-files:
- ".*Mock.*"
- ".*_mock.*"

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2022 Hau Nguyen
Copyright (c) 2021 Nguyen Tran Hau
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -1,11 +1,6 @@
# Dotfiles
[![Go](https://github.com/haunt98/dotfiles/actions/workflows/go.yml/badge.svg)](https://github.com/haunt98/dotfiles/actions/workflows/go.yml)
[![gitleaks](https://github.com/haunt98/dotfiles/actions/workflows/gitleaks.yml/badge.svg)](https://github.com/haunt98/dotfiles/actions/workflows/gitleaks.yml)
<a href="https://dotfyle.com/haunt98/dotfiles-data-nvim"><img src="https://dotfyle.com/haunt98/dotfiles-data-nvim/badges/plugins?style=flat" /></a>
<a href="https://dotfyle.com/haunt98/dotfiles-data-nvim"><img src="https://dotfyle.com/haunt98/dotfiles-data-nvim/badges/leaderkey?style=flat" /></a>
<a href="https://dotfyle.com/haunt98/dotfiles-data-nvim"><img src="https://dotfyle.com/haunt98/dotfiles-data-nvim/badges/plugin-manager?style=flat" /></a>
[![Latest Version](https://img.shields.io/github/v/tag/haunt98/dotfiles)](https://github.com/haunt98/dotfiles/tags)
[![Go](https://github.com/haunt98/dotfiles/workflows/Go/badge.svg?branch=main)](https://github.com/actions/setup-go)
## Usage
@ -19,27 +14,6 @@ go build ./cmd/dot
# Update dotfiles with user config
./dot update
# Diff dotfiles with user config
./dot diff
# Download internet themes, ...
./dot download
# Compare dotfiles with user config
./dot compare
```
## Support
- [neovim](https://github.com/neovim/neovim)
- [kitty](https://github.com/kovidgoyal/kitty)
- [wezterm](https://github.com/wez/wezterm)
- [ghostty](https://github.com/ghostty-org/ghostty)
- [fd](https://github.com/sharkdp/fd)
- [bat](https://github.com/sharkdp/bat)
- [delta](https://github.com/dandavison/delta)
- [ripgrep](https://github.com/BurntSushi/ripgrep)
- [zellij](https://github.com/zellij-org/zellij)
- [starship](https://github.com/starship/starship)
- [zed](https://github.com/zed-industries/zed)
- [btop](https://github.com/aristocratos/btop)
- [newsboat](https://github.com/newsboat/newsboat)
- [typos](https://github.com/crate-ci/typos)
- [daktilo](https://github.com/orhun/daktilo)

View File

@ -0,0 +1,8 @@
import:
- ~/.config/alacritty/nord.yml
font:
normal:
family: Cascadia Code
style: Regular
size: 14.0

49
data/alacritty/nord.yml Normal file
View File

@ -0,0 +1,49 @@
# https://github.com/arcticicestudio/nord-alacritty
colors:
primary:
background: "#2e3440"
foreground: "#d8dee9"
dim_foreground: "#a5abb6"
cursor:
text: "#2e3440"
cursor: "#d8dee9"
vi_mode_cursor:
text: "#2e3440"
cursor: "#d8dee9"
selection:
text: CellForeground
background: "#4c566a"
search:
matches:
foreground: CellBackground
background: "#88c0d0"
bar:
background: "#434c5e"
foreground: "#d8dee9"
normal:
black: "#3b4252"
red: "#bf616a"
green: "#a3be8c"
yellow: "#ebcb8b"
blue: "#81a1c1"
magenta: "#b48ead"
cyan: "#88c0d0"
white: "#e5e9f0"
bright:
black: "#4c566a"
red: "#bf616a"
green: "#a3be8c"
yellow: "#ebcb8b"
blue: "#81a1c1"
magenta: "#b48ead"
cyan: "#8fbcbb"
white: "#eceff4"
dim:
black: "#373e4d"
red: "#94545d"
green: "#809575"
yellow: "#b29e75"
blue: "#68809a"
magenta: "#8c738c"
cyan: "#6d96a5"
white: "#aeb3bb"

View File

@ -0,0 +1,22 @@
# https://github.com/alacritty/alacritty/wiki/Color-schemes
# Colors (One Dark - https://github.com/atom/atom/tree/master/packages/one-dark-syntax)
colors:
primary:
background: "#282c34"
foreground: "#abb2bf"
cursor:
text: CellBackground
cursor: "#528bff" # syntax-cursor-color
selection:
text: CellForeground
background: "#3e4451" # syntax-selection-color
normal:
black: "#5c6370" # mono-3
red: "#e06c75" # red 1
green: "#98c379"
yellow: "#e5c07b" # orange 2
blue: "#61afef"
magenta: "#c678dd"
cyan: "#56b6c2"
white: "#828997" # mono-2

View File

@ -1,2 +1,2 @@
--theme="Catppuccin Mocha"
--theme=ansi
--style=plain

File diff suppressed because it is too large Load Diff

View File

@ -1,83 +0,0 @@
# Main background, empty for terminal default, need to be empty if you want transparent background
theme[main_bg]="#1e1e2e"
# Main text color
theme[main_fg]="#cdd6f4"
# Title color for boxes
theme[title]="#cdd6f4"
# Highlight color for keyboard shortcuts
theme[hi_fg]="#89b4fa"
# Background color of selected item in processes box
theme[selected_bg]="#45475a"
# Foreground color of selected item in processes box
theme[selected_fg]="#89b4fa"
# Color of inactive/disabled text
theme[inactive_fg]="#7f849c"
# Color of text appearing on top of graphs, i.e uptime and current network graph scaling
theme[graph_text]="#f5e0dc"
# Background color of the percentage meters
theme[meter_bg]="#45475a"
# Misc colors for processes box including mini cpu graphs, details memory graph and details status text
theme[proc_misc]="#f5e0dc"
# CPU, Memory, Network, Proc box outline colors
theme[cpu_box]="#cba6f7" #Mauve
theme[mem_box]="#a6e3a1" #Green
theme[net_box]="#eba0ac" #Maroon
theme[proc_box]="#89b4fa" #Blue
# Box divider line and small boxes line color
theme[div_line]="#6c7086"
# Temperature graph color (Green -> Yellow -> Red)
theme[temp_start]="#a6e3a1"
theme[temp_mid]="#f9e2af"
theme[temp_end]="#f38ba8"
# CPU graph colors (Teal -> Lavender)
theme[cpu_start]="#94e2d5"
theme[cpu_mid]="#74c7ec"
theme[cpu_end]="#b4befe"
# Mem/Disk free meter (Mauve -> Lavender -> Blue)
theme[free_start]="#cba6f7"
theme[free_mid]="#b4befe"
theme[free_end]="#89b4fa"
# Mem/Disk cached meter (Sapphire -> Lavender)
theme[cached_start]="#74c7ec"
theme[cached_mid]="#89b4fa"
theme[cached_end]="#b4befe"
# Mem/Disk available meter (Peach -> Red)
theme[available_start]="#fab387"
theme[available_mid]="#eba0ac"
theme[available_end]="#f38ba8"
# Mem/Disk used meter (Green -> Sky)
theme[used_start]="#a6e3a1"
theme[used_mid]="#94e2d5"
theme[used_end]="#89dceb"
# Download graph colors (Peach -> Red)
theme[download_start]="#fab387"
theme[download_mid]="#eba0ac"
theme[download_end]="#f38ba8"
# Upload graph colors (Green -> Sky)
theme[upload_start]="#a6e3a1"
theme[upload_mid]="#94e2d5"
theme[upload_end]="#89dceb"
# Process box color gradient for threads, mem and cpu usage (Sapphire -> Mauve)
theme[process_start]="#74c7ec"
theme[process_mid]="#b4befe"
theme[process_end]="#cba6f7"

View File

@ -1,4 +0,0 @@
# https://github.com/johnthagen/min-sized-rust
[profile.release]
strip = true
lto = true

View File

@ -1,89 +0,0 @@
# git pull all those repos first
# cd ~/.config/daktilo && daktilo --preset holy_panda
[[sound_preset]]
name = "holy_panda"
key_config = [
{ event = "press", keys = "Return", files = [
{ path = "github.com/nathan-fiscaletti/keyboardsounds/keyboardsounds/profiles/holy-panda/press_enter.mp3", volume = 1.0 },
] },
{ event = "press", keys = "Backspace", files = [
{ path = "github.com/nathan-fiscaletti/keyboardsounds/keyboardsounds/profiles/holy-panda/press_back.mp3", volume = 1.0 },
] },
{ event = "press", keys = "Space", files = [
{ path = "github.com/nathan-fiscaletti/keyboardsounds/keyboardsounds/profiles/holy-panda/press_space.mp3", volume = 1.0 },
] },
{ event = "press", keys = ".*", files = [
{ path = "github.com/nathan-fiscaletti/keyboardsounds/keyboardsounds/profiles/holy-panda/press_key1.mp3", volume = 1.0 },
{ path = "github.com/nathan-fiscaletti/keyboardsounds/keyboardsounds/profiles/holy-panda/press_key2.mp3", volume = 1.0 },
{ path = "github.com/nathan-fiscaletti/keyboardsounds/keyboardsounds/profiles/holy-panda/press_key3.mp3", volume = 1.0 },
{ path = "github.com/nathan-fiscaletti/keyboardsounds/keyboardsounds/profiles/holy-panda/press_key4.mp3", volume = 1.0 },
{ path = "github.com/nathan-fiscaletti/keyboardsounds/keyboardsounds/profiles/holy-panda/press_key5.mp3", volume = 1.0 },
], strategy = "random" },
]
[[sound_preset]]
name = "alpaca"
key_config = [
{ event = "press", keys = "Return", files = [
{ path = "github.com/nathan-fiscaletti/keyboardsounds/keyboardsounds/profiles/alpaca/press_enter.mp3", volume = 1.0 },
] },
{ event = "press", keys = "Backspace", files = [
{ path = "github.com/nathan-fiscaletti/keyboardsounds/keyboardsounds/profiles/alpaca/press_back.mp3", volume = 1.0 },
] },
{ event = "press", keys = "Space", files = [
{ path = "github.com/nathan-fiscaletti/keyboardsounds/keyboardsounds/profiles/alpaca/press_space.mp3", volume = 1.0 },
] },
{ event = "press", keys = ".*", files = [
{ path = "github.com/nathan-fiscaletti/keyboardsounds/keyboardsounds/profiles/alpaca/press_key1.mp3", volume = 1.0 },
{ path = "github.com/nathan-fiscaletti/keyboardsounds/keyboardsounds/profiles/alpaca/press_key2.mp3", volume = 1.0 },
{ path = "github.com/nathan-fiscaletti/keyboardsounds/keyboardsounds/profiles/alpaca/press_key3.mp3", volume = 1.0 },
{ path = "github.com/nathan-fiscaletti/keyboardsounds/keyboardsounds/profiles/alpaca/press_key4.mp3", volume = 1.0 },
{ path = "github.com/nathan-fiscaletti/keyboardsounds/keyboardsounds/profiles/alpaca/press_key5.mp3", volume = 1.0 },
], strategy = "random" },
{ event = "release", keys = "Return", files = [
{ path = "github.com/nathan-fiscaletti/keyboardsounds/keyboardsounds/profiles/alpaca/release_enter.mp3", volume = 1.0 },
] },
{ event = "release", keys = "Backspace", files = [
{ path = "github.com/nathan-fiscaletti/keyboardsounds/keyboardsounds/profiles/alpaca/release_back.mp3", volume = 1.0 },
] },
{ event = "release", keys = "Space", files = [
{ path = "github.com/nathan-fiscaletti/keyboardsounds/keyboardsounds/profiles/alpaca/release_space.mp3", volume = 1.0 },
] },
{ event = "release", keys = ".*", files = [
{ path = "github.com/nathan-fiscaletti/keyboardsounds/keyboardsounds/profiles/alpaca/release_key.mp3", volume = 1.0 },
] },
]
[[sound_preset]]
name = "topre"
key_config = [
{ event = "press", keys = "Return", files = [
{ path = "github.com/tplai/kbsim/src/assets/audio/topre/press/ENTER.mp3", volume = 1.0 },
] },
{ event = "press", keys = "Backspace", files = [
{ path = "github.com/tplai/kbsim/src/assets/audio/topre/press/BACKSPACE.mp3", volume = 1.0 },
] },
{ event = "press", keys = "Space", files = [
{ path = "github.com/tplai/kbsim/src/assets/audio/topre/press/SPACE.mp3", volume = 1.0 },
] },
{ event = "press", keys = ".*", files = [
{ path = "github.com/tplai/kbsim/src/assets/audio/topre/press/GENERIC_R0.mp3", volume = 1.0 },
{ path = "github.com/tplai/kbsim/src/assets/audio/topre/press/GENERIC_R1.mp3", volume = 1.0 },
{ path = "github.com/tplai/kbsim/src/assets/audio/topre/press/GENERIC_R2.mp3", volume = 1.0 },
{ path = "github.com/tplai/kbsim/src/assets/audio/topre/press/GENERIC_R3.mp3", volume = 1.0 },
{ path = "github.com/tplai/kbsim/src/assets/audio/topre/press/GENERIC_R4.mp3", volume = 1.0 },
], strategy = "random" },
{ event = "release", keys = "Return", files = [
{ path = "github.com/tplai/kbsim/src/assets/audio/topre/release/ENTER.mp3", volume = 1.0 },
] },
{ event = "release", keys = "Backspace", files = [
{ path = "github.com/tplai/kbsim/src/assets/audio/topre/release/BACKSPACE.mp3", volume = 1.0 },
] },
{ event = "release", keys = "Space", files = [
{ path = "github.com/tplai/kbsim/src/assets/audio/topre/release/SPACE.mp3", volume = 1.0 },
] },
{ event = "release", keys = ".*", files = [
{ path = "github.com/tplai/kbsim/src/assets/audio/topre/release/GENERIC.mp3", volume = 1.0 },
] },
]

52
data/data.json Normal file
View File

@ -0,0 +1,52 @@
{
"apps": {
"nvim": {
"paths": [
{
"internal": "data/nvim/init.vim",
"external": "~/.config/nvim/init.vim"
}
]
},
"tmux": {
"paths": [
{
"internal": "data/tmux/tmux.conf",
"external": "~/.config/tmux/tmux.conf"
}
]
},
"alacritty": {
"paths": [
{
"internal": "data/alacritty",
"external": "~/.config/alacritty"
}
]
},
"kitty": {
"paths": [
{
"internal": "data/kitty",
"external": "~/.config/kitty"
}
]
},
"bat": {
"paths": [
{
"internal": "data/bat/config",
"external": "~/.config/bat/config"
}
]
},
"fd": {
"paths": [
{
"internal": "data/fd/.ignore",
"external": "~/.ignore"
}
]
}
}
}

View File

@ -1,151 +0,0 @@
[[apps.git.paths]]
internal = "data/git/ignore"
external = "~/.config/git/ignore"
[[apps.zsh.paths]]
internal = "data/zsh/top-zshrc"
external = "~/.config/zsh/top-zshrc"
[[apps.zsh.paths]]
internal = "data/zsh/bottom-zshrc"
external = "~/.config/zsh/bottom-zshrc"
[[apps.zsh.paths]]
internal = "data/zsh/themes/catppuccin_mocha-zsh-syntax-highlighting.zsh"
external = "~/.config/zsh/themes/catppuccin_mocha-zsh-syntax-highlighting.zsh"
[[apps.zsh.paths]]
internal = "data/zsh/themes/catppuccin_mocha-zsh-syntax-highlighting.zsh"
url = "https://raw.githubusercontent.com/catppuccin/zsh-syntax-highlighting/refs/heads/main/themes/catppuccin_mocha-zsh-syntax-highlighting.zsh"
[[apps.nvim.paths]]
internal = "data/nvim/init.lua"
external = "~/.config/nvim/init.lua"
[[apps.kitty.paths]]
internal = "data/kitty/kitty.conf"
external = "~/.config/kitty/kitty.conf"
[[apps.kitty.paths]]
internal = "data/kitty/mocha.conf"
external = "~/.config/kitty/mocha.conf"
[[apps.kitty.paths]]
internal = "data/kitty/latte.conf"
external = "~/.config/kitty/latte.conf"
[[apps.kitty.paths]]
internal = "data/kitty/kitty-dark.icns"
external = "~/.config/kitty/kitty.app.icns"
[[apps.kitty.paths]]
internal = "data/kitty/mocha.conf"
url = "https://raw.githubusercontent.com/catppuccin/kitty/main/themes/mocha.conf"
[[apps.kitty.paths]]
internal = "data/kitty/latte.conf"
url = "https://raw.githubusercontent.com/catppuccin/kitty/main/themes/latte.conf"
[[apps.kitty.paths]]
internal = "data/kitty/kitty-dark.icns"
url = "https://github.com/DinkDonk/kitty-icon/blob/main/kitty-dark.icns?raw=true"
[[apps.kitty.paths]]
internal = "data/kitty/kitty-light.icns"
url = "https://github.com/DinkDonk/kitty-icon/blob/main/kitty-light.icns?raw=true"
[[apps.wezterm.paths]]
internal = "data/wezterm"
external = "~/.config/wezterm"
[[apps.ghostty.paths]]
internal = "data/ghostty/config"
external = "~/.config/ghostty/config"
[[apps.ghostty.paths]]
internal = "data/ghostty/catppuccin-mocha.conf"
external = "~/.config/ghostty/catppuccin-mocha.conf"
[[apps.ghostty.paths]]
internal = "data/ghostty/catppuccin-mocha.conf"
url = "https://raw.githubusercontent.com/catppuccin/ghostty/refs/heads/main/themes/catppuccin-mocha.conf"
[[apps.fd.paths]]
internal = "data/fd/.ignore"
external = "~/.ignore"
[[apps.bat.paths]]
internal = "data/bat"
external = "~/.config/bat"
[[apps.bat.paths]]
internal = "data/bat/themes/Catppuccin Mocha.tmTheme"
url = "https://raw.githubusercontent.com/catppuccin/bat/main/themes/Catppuccin%20Mocha.tmTheme"
[[apps.delta.paths]]
internal = "data/delta/themes/catppuccin.gitconfig"
external = "~/.config/delta/themes/catppuccin.gitconfig"
[[apps.delta.paths]]
internal = "data/delta/themes/catppuccin.gitconfig"
url = "https://raw.githubusercontent.com/catppuccin/delta/main/catppuccin.gitconfig"
[[apps.ripgrep.paths]]
internal = "data/ripgrep"
external = "~/.config/ripgrep"
[[apps.zellij.paths]]
internal = "data/zellij"
external = "~/.config/zellij"
[[apps.starship.paths]]
internal = "data/starship/starship.toml"
external = "~/.config/starship/starship.toml"
[[apps.zed.paths]]
internal = "data/zed/settings.json"
external = "~/.config/zed/settings.json"
[[apps.zed.paths]]
internal = "data/zed/keymap.json"
external = "~/.config/zed/keymap.json"
[[apps.btop.paths]]
internal = "data/btop/themes"
external = "~/.config/btop/themes"
[[apps.btop.paths]]
internal = "data/btop/themes/catppuccin_mocha.theme"
url = "https://raw.githubusercontent.com/catppuccin/btop/main/themes/catppuccin_mocha.theme"
[[apps.newsboat.paths]]
internal = "data/newsboat/config"
external = "~/.config/newsboat/config"
[[apps.newsboat.paths]]
internal = "data/newsboat/urls"
external = "~/.config/newsboat/urls"
[[apps.newsboat.paths]]
internal = "data/newsboat/tiny_urls"
external = "~/.config/newsboat/tiny_urls"
[[apps.newsboat.paths]]
internal = "data/newsboat/dark"
external = "~/.config/newsboat/dark"
[[apps.newsboat.paths]]
internal = "data/newsboat/dark"
url = "https://raw.githubusercontent.com/catppuccin/newsboat/main/themes/dark"
[[apps.typos.paths]]
internal = "data/typos/typos.toml"
external = "~/.config/typos/typos.toml"
[[apps.daktilo.paths]]
internal = "data/daktilo/daktilo.toml"
external = "~/.config/daktilo/daktilo.toml"
[[apps.cargo.paths]]
internal = "data/cargo/config.toml"
external = "~/.cargo/config.toml"

View File

@ -1,123 +0,0 @@
[delta "catppuccin-latte"]
blame-palette = "#eff1f5 #e6e9ef #dce0e8 #ccd0da #bcc0cc"
commit-decoration-style = "#9ca0b0" bold box ul
light = true
file-decoration-style = "#9ca0b0"
file-style = "#4c4f69"
hunk-header-decoration-style = "#9ca0b0" box ul
hunk-header-file-style = bold
hunk-header-line-number-style = bold "#6c6f85"
hunk-header-style = file line-number syntax
line-numbers-left-style = "#9ca0b0"
line-numbers-minus-style = bold "#d20f39"
line-numbers-plus-style = bold "#40a02b"
line-numbers-right-style = "#9ca0b0"
line-numbers-zero-style = "#9ca0b0"
# 25% red 75% base
minus-emph-style = bold syntax "#e8b9c6"
# 10% red 90% base
minus-style = syntax "#ecdae2"
# 25% green 75% base
plus-emph-style = bold syntax "#c3ddc3"
# 10% green 90% base
plus-style = syntax "#dee8e0"
map-styles = \
bold purple => syntax "#d5c3f4", \
bold blue => syntax "#bbcff5", \
bold cyan => syntax "#b4def1", \
bold yellow => syntax "#ebd9bf"
# Should match the name of the bat theme
syntax-theme = Catppuccin Latte
[delta "catppuccin-frappe"]
blame-palette = "#303446 #292c3c #232634 #414559 #51576d"
commit-decoration-style = "#737994" bold box ul
dark = true
file-decoration-style = "#737994"
file-style = "#c6d0f5"
hunk-header-decoration-style = "#737994" box ul
hunk-header-file-style = bold
hunk-header-line-number-style = bold "#a5adce"
hunk-header-style = file line-number syntax
line-numbers-left-style = "#737994"
line-numbers-minus-style = bold "#e78284"
line-numbers-plus-style = bold "#a6d189"
line-numbers-right-style = "#737994"
line-numbers-zero-style = "#737994"
# 25% red 75% base
minus-emph-style = bold syntax "#5e4855"
# 10% red 90% base
minus-style = syntax "#433c4c"
# 25% green 75% base
plus-emph-style = bold syntax "#4e5b56"
# 10% green 90% base
plus-style = syntax "#3c444d"
map-styles = \
bold purple => syntax "#574f6e", \
bold blue => syntax "#475270", \
bold cyan => syntax "#4a5b6b", \
bold yellow => syntax "#5d5958"
# Should match the name of the bat theme
syntax-theme = Catppuccin Frappe
[delta "catppuccin-macchiato"]
blame-palette = "#24273a #1e2030 #181926 #363a4f #494d64"
commit-decoration-style = "#6e738d" bold box ul
dark = true
file-decoration-style = "#6e738d"
file-style = "#cad3f5"
hunk-header-decoration-style = "#6e738d" box ul
hunk-header-file-style = bold
hunk-header-line-number-style = bold "#a5adcb"
hunk-header-style = file line-number syntax
line-numbers-left-style = "#6e738d"
line-numbers-minus-style = bold "#ed8796"
line-numbers-plus-style = bold "#a6da95"
line-numbers-right-style = "#6e738d"
line-numbers-zero-style = "#6e738d"
# 25% red 75% base
minus-emph-style = bold syntax "#563f51"
# 10% red 90% base
minus-style = syntax "#383143"
# 25% green 75% base
plus-emph-style = bold syntax "#455450"
# 10% green 90% base
plus-style = syntax "#313943"
map-styles = \
bold purple => syntax "#4d4569", \
bold blue => syntax "#3e4868", \
bold cyan => syntax "#3f5364", \
bold yellow => syntax "#575253"
# Should match the name of the bat theme
syntax-theme = Catppuccin Macchiato
[delta "catppuccin-mocha"]
blame-palette = "#1e1e2e #181825 #11111b #313244 #45475a"
commit-decoration-style = "#6c7086" bold box ul
dark = true
file-decoration-style = "#6c7086"
file-style = "#cdd6f4"
hunk-header-decoration-style = "#6c7086" box ul
hunk-header-file-style = bold
hunk-header-line-number-style = bold "#a6adc8"
hunk-header-style = file line-number syntax
line-numbers-left-style = "#6c7086"
line-numbers-minus-style = bold "#f38ba8"
line-numbers-plus-style = bold "#a6e3a1"
line-numbers-right-style = "#6c7086"
line-numbers-zero-style = "#6c7086"
# 25% red 75% base
minus-emph-style = bold syntax "#53394c"
# 10% red 90% base
minus-style = syntax "#34293a"
# 25% green 75% base
plus-emph-style = bold syntax "#404f4a"
# 10% green 90% base
plus-style = syntax "#2c3239"
map-styles = \
bold purple => syntax "#494060", \
bold blue => syntax "#384361", \
bold cyan => syntax "#384d5d", \
bold yellow => syntax "#544f4e"
# Should match the name of the bat theme
syntax-theme = Catppuccin Mocha

View File

@ -1,54 +1,23 @@
# macOS
Applications
Desktop
Documents
Library
Movies
Music
Pictures
.DS_Store
# Window
*.exe
# IntelliJ
.idea
# VSCode
.vscode
# Obsidian
.obsidian
# Git
.git
# Node
node_modules
node
# Go
mod
sumdb
vendor
mock
generated
test
*generated*.go
*mock*.go
coverage.out
# Python
venv
.venv
ruff_cache
__pycache__
# Java
*.class
# Wild chaos
*.out
# Software
~/qmk_firmware
# Work
submodules
# ThacSi
*.tsv

View File

@ -1,21 +0,0 @@
palette = 0=#45475a
palette = 1=#f38ba8
palette = 2=#a6e3a1
palette = 3=#f9e2af
palette = 4=#89b4fa
palette = 5=#f5c2e7
palette = 6=#94e2d5
palette = 7=#bac2de
palette = 8=#585b70
palette = 9=#f38ba8
palette = 10=#a6e3a1
palette = 11=#f9e2af
palette = 12=#89b4fa
palette = 13=#f5c2e7
palette = 14=#94e2d5
palette = 15=#a6adc8
background = 1e1e2e
foreground = cdd6f4
cursor-color = f5e0dc
selection-background = 353749
selection-foreground = cdd6f4

View File

@ -1,46 +0,0 @@
config-file = catppuccin-mocha.conf
font-family = ""
font-family = Iosevka Pacman
font-family = Symbols Nerd Font Mono
font-size = 18
font-thicken = true
adjust-cell-height = 20%
cursor-style-blink = false
mouse-hide-while-typing = true
background-opacity = 0.95
background-blur-radius = 20
window-padding-x = 16
window-padding-y = 16
window-height = 24
window-width = 72
window-save-state = never
window-colorspace = display-p3
clipboard-trim-trailing-spaces = true
clipboard-paste-protection = true
quit-after-last-window-closed = true
macos-option-as-alt = true
macos-auto-secure-input = true
macos-secure-input-indication = true
bold-is-bright = true
# Inspire from Zellij
keybind = alt+n=new_split:right
keybind = alt+m=new_split:down
keybind = alt+p=goto_split:next
keybind = alt+[=previous_tab
keybind = alt+]=next_tab
keybind = ctrl+shift+left=previous_tab
keybind = ctrl+shift+right=next_tab
# https://github.com/ghostty-org/ghostty/pull/3107
keybind = alt+left=unbind
keybind = alt+right=unbind

View File

@ -1,11 +0,0 @@
# macOS
.DS_Store
# Window
*.exe
# IntelliJ
.idea
# VSCode
.vscode

View File

@ -0,0 +1,47 @@
background #403e41
foreground #fcfcfa
cursor #fcfcfa
cursor_text_color #000000
selection_foreground #403e41
selection_background #fcfcfa
# dull black
color0 #403e41
# light black
color8 #727072
# dull red
color1 #ff6188
# light red
color9 #ff6188
# dull green
color2 #a9dc76
# light green
color10 #a9dc76
# yellow
color3 #ffd866
# light yellow
color11 #ffd866
# blue
color4 #fc9867
# light blue
color12 #fc9867
# magenta
color5 #ab9df2
# light magenta
color13 #ab9df2
# cyan
color6 #78dce8
# light cyan
color14 #78dce8
# dull white
color7 #fcfcfa
# bright white
color15 #fcfcfa

Binary file not shown.

Binary file not shown.

View File

@ -1,64 +1,22 @@
# https://github.com/catppuccin/kitty
include mocha.conf
include Monokai Pro.conf
# https://sw.kovidgoyal.net/kitty/conf/#fonts
font_family Iosevka Pacman Regular
font_size 18.0
modify_font cell_height 120%
# https://sw.kovidgoyal.net/kitty/conf/#cursor-customization
cursor_shape beam
cursor_blink_interval 0
cursor_trail 3
# https://sw.kovidgoyal.net/kitty/conf/#scrollback
scrollback_pager_history_size 16
# https://sw.kovidgoyal.net/kitty/conf/#mouse
strip_trailing_spaces smart
font_family Rec Mono Casual
font_size 14.0
# https://sw.kovidgoyal.net/kitty/conf/#terminal-bell
enable_audio_bell no
# https://sw.kovidgoyal.net/kitty/conf/#window-layout
remember_window_size no
initial_window_width 720
initial_window_height 480
window_padding_width 16
enabled_layouts splits:split_axis=horizontal
# https://sw.kovidgoyal.net/kitty/conf/#tab-bar
tab_bar_align center
tab_bar_style powerline
tab_powerline_style round
# https://sw.kovidgoyal.net/kitty/conf/#color-scheme
background_opacity 0.95
background_blur 20
initial_window_width 640
initial_window_height 400
# https://sw.kovidgoyal.net/kitty/conf/#advanced
# https://github.com/jarun/nnn/blob/master/plugins/preview-tui
allow_remote_control yes
listen_on unix:$TMPDIR/kitty
listen_on unix:/tmp/kitty
# https://sw.kovidgoyal.net/kitty/conf/#os-specific-tweaks
macos_option_as_alt both
macos_quit_when_last_window_closed yes
macos_menubar_title_max_length 64
macos_colorspace displayp3
# https://sw.kovidgoyal.net/kitty/conf/#keyboard-shortcuts
# https://sw.kovidgoyal.net/kitty/actions/
action_alias launch_tab launch --cwd=oldest --type=tab --location=neighbor
map kitty_mod+t launch_tab
map super+t launch_tab
# Inspire from Zellij
map alt+n launch --cwd=oldest --location=vsplit
map alt+m launch --cwd=oldest --location=hsplit
map alt+p next_window
map alt+[ previous_tab
map alt+] next_tab
# Remove default
map cmd+r no_op

View File

@ -1,80 +0,0 @@
# vim:ft=kitty
## name: Catppuccin Kitty Latte
## author: Catppuccin Org
## license: MIT
## upstream: https://github.com/catppuccin/kitty/blob/main/themes/latte.conf
## blurb: Soothing pastel theme for the high-spirited!
# The basic colors
foreground #4c4f69
background #eff1f5
selection_foreground #eff1f5
selection_background #dc8a78
# Cursor colors
cursor #dc8a78
cursor_text_color #eff1f5
# URL underline color when hovering with mouse
url_color #dc8a78
# Kitty window border colors
active_border_color #7287fd
inactive_border_color #9ca0b0
bell_border_color #df8e1d
# OS Window titlebar colors
wayland_titlebar_color system
macos_titlebar_color system
# Tab bar colors
active_tab_foreground #eff1f5
active_tab_background #8839ef
inactive_tab_foreground #4c4f69
inactive_tab_background #9ca0b0
tab_bar_background #bcc0cc
# Colors for marks (marked text in the terminal)
mark1_foreground #eff1f5
mark1_background #7287fd
mark2_foreground #eff1f5
mark2_background #8839ef
mark3_foreground #eff1f5
mark3_background #209fb5
# The 16 terminal colors
# black
color0 #5c5f77
color8 #6c6f85
# red
color1 #d20f39
color9 #d20f39
# green
color2 #40a02b
color10 #40a02b
# yellow
color3 #df8e1d
color11 #df8e1d
# blue
color4 #1e66f5
color12 #1e66f5
# magenta
color5 #ea76cb
color13 #ea76cb
# cyan
color6 #179299
color14 #179299
# white
color7 #acb0be
color15 #bcc0cc

View File

@ -1,80 +0,0 @@
# vim:ft=kitty
## name: Catppuccin Kitty Mocha
## author: Catppuccin Org
## license: MIT
## upstream: https://github.com/catppuccin/kitty/blob/main/themes/mocha.conf
## blurb: Soothing pastel theme for the high-spirited!
# The basic colors
foreground #cdd6f4
background #1e1e2e
selection_foreground #1e1e2e
selection_background #f5e0dc
# Cursor colors
cursor #f5e0dc
cursor_text_color #1e1e2e
# URL underline color when hovering with mouse
url_color #f5e0dc
# Kitty window border colors
active_border_color #b4befe
inactive_border_color #6c7086
bell_border_color #f9e2af
# OS Window titlebar colors
wayland_titlebar_color system
macos_titlebar_color system
# Tab bar colors
active_tab_foreground #11111b
active_tab_background #cba6f7
inactive_tab_foreground #cdd6f4
inactive_tab_background #181825
tab_bar_background #11111b
# Colors for marks (marked text in the terminal)
mark1_foreground #1e1e2e
mark1_background #b4befe
mark2_foreground #1e1e2e
mark2_background #cba6f7
mark3_foreground #1e1e2e
mark3_background #74c7ec
# The 16 terminal colors
# black
color0 #45475a
color8 #585b70
# red
color1 #f38ba8
color9 #f38ba8
# green
color2 #a6e3a1
color10 #a6e3a1
# yellow
color3 #f9e2af
color11 #f9e2af
# blue
color4 #89b4fa
color12 #89b4fa
# magenta
color5 #f5c2e7
color13 #f5c2e7
# cyan
color6 #94e2d5
color14 #94e2d5
# white
color7 #bac2de
color15 #a6adc8

44
data/kitty/nord.conf Normal file
View File

@ -0,0 +1,44 @@
# https://github.com/connorholyday/nord-kitty
# Nord Colorscheme for Kitty
# Based on:
# - https://gist.github.com/marcusramberg/64010234c95a93d953e8c79fdaf94192
# - https://github.com/arcticicestudio/nord-hyper
foreground #D8DEE9
background #2E3440
selection_foreground #000000
selection_background #FFFACD
url_color #0087BD
cursor #81A1C1
# black
color0 #3B4252
color8 #4C566A
# red
color1 #BF616A
color9 #BF616A
# green
color2 #A3BE8C
color10 #A3BE8C
# yellow
color3 #EBCB8B
color11 #EBCB8B
# blue
color4 #81A1C1
color12 #81A1C1
# magenta
color5 #B48EAD
color13 #B48EAD
# cyan
color6 #88C0D0
color14 #8FBCBB
# white
color7 #E5E9F0
color15 #ECEFF4

23
data/kitty/one-dark.conf Normal file
View File

@ -0,0 +1,23 @@
# https://github.com/dexpota/kitty-themes
# One Dark
foreground #979eab
background #282c34
cursor #cccccc
color0 #282c34
color1 #e06c75
color2 #98c379
color3 #e5c07b
color4 #61afef
color5 #be5046
color6 #56b6c2
color7 #979eab
color8 #393e48
color9 #d19a66
color10 #56b6c2
color11 #e5c07b
color12 #61afef
color13 #be5046
color14 #56b6c2
color15 #abb2bf
selection_foreground #282c34
selection_background #979eab

View File

@ -1,27 +0,0 @@
# https://wiki.archlinux.org/title/Newsboat
include ~/.config/newsboat/dark
confirm-mark-all-feeds-read no
confirm-mark-feed-read no
display-article-progress yes
download-retries 4
keep-articles-days 120
max-items 100
reload-threads 8
scrolloff 4
text-width 120
# https://m-chrzan.xyz/blog/vim-keybindings-for-newsboat.html
unbind-key g
unbind-key G
bind-key g home
bind-key G end
unbind-key j
unbind-key k
bind-key j down
bind-key k up
# https://github.com/newsboat/newsboat/issues/1295
browser "open %u"

View File

@ -1,18 +0,0 @@
color listnormal color15 default
color listnormal_unread color2 default
color listfocus_unread color2 color0
color listfocus default color0
color background default default
color article default default
color end-of-text-marker color8 default
color info color4 color8
color hint-separator default color8
color hint-description default color8
color title color14 color8
highlight article "^(Feed|Title|Author|Link|Date): .+" color4 default bold
highlight article "^(Feed|Title|Author|Link|Date):" color14 default bold
highlight article "\\((link|image|video)\\)" color8 default
highlight article "https?://[^ ]+" color4 default
highlight article "\[[0-9]+\]" color6 default bold

View File

@ -1,12 +0,0 @@
https://golangweekly.com/rss/
http://feeds.feedburner.com/ThePragmaticEngineer
https://brandur.org/articles.atom
https://brandur.org/fragments.atom
https://dave.cheney.net/feed/atom
https://michael.stapelberg.ch/feed.xml
https://mitchellh.com/feed.xml
https://registerspill.thorstenball.com/feed
https://kbd.news/rss.php
https://www.theremingoat.com/blog?format=rss

View File

@ -1,70 +0,0 @@
https://github.com/golang/go/commits/master.atom "~go"
https://github.com/golang/tools/commits/master.atom "~go/tools"
https://github.com/IBM/sarama/commits/main.atom "~sarama"
https://github.com/gin-gonic/gin/commits/master.atom "~gin"
https://github.com/go-gorm/gorm/commits/master.atom "~gorm"
https://github.com/go-gorm/mysql/commits/master.atom "~gorm/mysql"
https://github.com/go-sql-driver/mysql/commits/master.atom "~mysql"
https://github.com/grpc-ecosystem/grpc-gateway/commits/main.atom "~grpc-gateway"
https://github.com/grpc/grpc-go/commits/master.atom "~grpc-go"
https://github.com/protocolbuffers/protobuf-go/commits/master.atom "~protobuf-go"
https://github.com/redis/go-redis/commits/master.atom "~go-redis"
https://github.com/serengil/deepface/commits/master.atom "~deepface"
https://github.com/sourcegraph/conc/commits/main.atom "~conc"
https://github.com/tidwall/gjson/commits/master.atom "~gjson"
https://github.com/uber-go/zap/commits/master.atom "~zap"
https://github.com/be5invis/Iosevka/commits/main.atom "~Iosevka"
https://github.com/kovidgoyal/kitty/commits/master.atom "~kitty"
https://github.com/wez/wezterm/commits/main.atom "~wezterm"
https://github.com/ghostty-org/ghostty/commits/main.atom "~ghostty"
https://github.com/AsahiLinux/linux/commits/asahi.atom "~AsahiLinux/linux"
https://github.com/AsahiLinux/m1n1/commits/main.atom "~AsahiLinux/m1n1"
http://antirez.com/rss
http://feeds.feedburner.com/ThePragmaticEngineer
https://0pointer.net/blog/index.atom
https://andrewkelley.me/rss.xml
https://apenwarr.ca/log/rss.php
https://blog.codinghorror.com/rss/
https://brandur.org/articles.atom
https://brandur.org/fragments.atom
https://code.dblock.org/feed.xml
https://daniel.haxx.se/blog/feed/
https://dave.cheney.net/feed/atom
https://dotat.at/@/blog.atom
https://drewdevault.com/blog/index.xml
https://jvns.ca/atom.xml
https://matklad.github.io/feed.xml
https://matthewstrom.com/feed.xml
https://michael.stapelberg.ch/feed.xml
https://mitchellh.com/feed.xml
https://registerspill.thorstenball.com/feed
https://research.swtch.com/feed.atom
https://rosenzweig.io/feed.xml
https://stephango.com/feed.xml
https://tonsky.me/atom.xml
https://words.filippo.io/rss
https://go.dev/blog/feed.atom
https://golangweekly.com/rss/
https://tigerbeetle.com/blog/atom.xml
https://asahilinux.org/blog/index.xml
https://kbd.news/rss.php
https://neovim.io/news.xml
https://developer.apple.com/news/releases/rss/releases.rss
https://rsshub.app/amazon/kindle/software-updates
https://github.com/caksoylar/keymap-drawer/commits/main.atom "~keymap-drawer"
https://github.com/qmk/qmk_firmware/commits/develop.atom "~qmk_firmware/develop"
https://github.com/qmk/qmk_firmware/commits/master.atom "~qmk_firmware"
https://nyaa.si/?f=0&c=1_2&q=doraemon+movie&page=rss "~Doraemon movie"
https://nyaa.si/?f=0&c=1_4&q=doraemon+movie&page=rss "~Doraemon movie raw"
https://nyaa.si/?f=0&c=1_2&q=conan+movie&page=rss "~Conan movie"
https://nyaa.si/?f=0&c=1_4&q=conan+movie&page=rss "~Conan movie raw"
https://nyaa.si/?f=0&c=3_1&q=Detective+Conan&page=rss "~Conan manga"
https://nyaa.si/?f=0&c=3_1&q=one+piece&page=rss "~One Piece manga"
http://fitgirl-repacks.site/feed/

View File

@ -1,648 +0,0 @@
-- https://neovim.io/doc/user/lua-guide.html
vim.opt.completeopt = { "menuone", "noinsert", "noselect" }
vim.opt.swapfile = false
vim.opt.title = true
vim.opt.virtualedit = "block"
vim.opt.whichwrap = "<,>,[,]"
-- Case character
vim.opt.ignorecase = true
vim.opt.smartcase = true
-- Line number
vim.opt.number = true
vim.opt.relativenumber = true
vim.opt.scrolloff = 4
vim.opt.signcolumn = "number"
-- Tab
vim.opt.tabstop = 4
vim.opt.shiftwidth = 4
vim.opt.expandtab = true
-- Wrap
vim.opt.breakindent = true
-- Clipboard support
vim.opt.clipboard = "unnamedplus"
-- Mouse support
vim.opt.mouse = "a"
vim.opt.mousemodel = "popup"
vim.opt.mousescroll = "ver:4,hor:6"
-- Annoying
vim.cmd([[aunmenu PopUp.How-to\ disable\ mouse]])
vim.cmd([[aunmenu PopUp.-1-]])
-- Workaround
-- https://github.com/neovim/neovim/issues/16416
-- https://github.com/rafamadriz/dotfiles/commit/1298a91558a7def5866ebee3a0b13899a6d1a78e
vim.keymap.set("i", "<C-c>", "<C-c>")
-- Typo
vim.cmd("command W w")
vim.cmd("command Q q")
vim.cmd("command WQ wq")
vim.cmd("command Wq wq")
vim.cmd("command QA qa")
vim.cmd("command Qa qa")
-- Leader
vim.g.mapleader = ";"
vim.keymap.set("n", "'", "<Leader>", { remap = true })
-- Keymap
vim.keymap.set("n", "<Leader>w", ":w<CR>")
vim.keymap.set("n", "n", "nzz")
vim.keymap.set("n", "N", "Nzz")
vim.keymap.set("n", "{", "{zz")
vim.keymap.set("n", "}", "}zz")
-- Unnamed register aka black hole to not push to register aka trigger yank
vim.keymap.set({ "n", "v" }, "<Leader>d", '"_d')
vim.keymap.set({ "n", "v" }, "<Leader>c", '"_c')
vim.keymap.set({ "n", "v" }, "<Leader>x", '"_x')
-- Conflict with :q
-- https://neovim.io/doc/user/cmdline.html#c_CTRL-F
vim.keymap.set({ "n", "v" }, "q:", "<Nop>")
-- Conflict with QMK Space Cadet
vim.keymap.set({ "n", "v" }, "(", "<Nop>")
vim.keymap.set({ "n", "v" }, ")", "<Nop>")
-- Disable scrolling
-- https://neovim.io/doc/user/scroll.html
vim.keymap.set({ "n", "v" }, "<C-e>", "<Nop>")
vim.keymap.set({ "n", "v" }, "<C-d>", "<Nop>")
vim.keymap.set({ "n", "v" }, "<C-f>", "<Nop>")
vim.keymap.set({ "n", "v" }, "<C-y>", "<Nop>")
vim.keymap.set({ "n", "v" }, "<C-u>", "<Nop>")
vim.keymap.set({ "n", "v" }, "<C-b>", "<Nop>")
-- Disable more
vim.g.loaded_python3_provider = 0
vim.g.loaded_ruby_provider = 0
vim.g.loaded_node_provider = 0
vim.g.loaded_perl_provider = 0
-- https://github.com/folke/lazy.nvim
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable",
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
require("lazy").setup({
-- Colorschemes
-- https://github.com/catppuccin/nvim
{
"catppuccin/nvim",
name = "catppuccin",
priority = 1000,
config = function()
-- https://github.com/nyoom-engineering/oxocarbon.nvim
local color_oxocarbon = {
pink = "#ff7eb6",
purple = "#be95ff",
}
require("catppuccin").setup({
flavour = "mocha",
transparent_background = true,
color_overrides = {
mocha = {
-- https://github.com/catppuccin/nvim/blob/main/lua/catppuccin/palettes/mocha.lua
flamingo = color_oxocarbon.pink,
pink = color_oxocarbon.pink,
mauve = color_oxocarbon.purple,
red = color_oxocarbon.pink,
maroon = color_oxocarbon.pink,
},
},
custom_highlights = function(colors)
return {
-- Help my eyes
Comment = {
fg = colors.overlay2,
},
LineNr = {
fg = colors.overlay1,
},
markdownLinkText = {
style = {},
},
EndOfBuffer = {
link = "NonText",
},
-- Support mini.statusline
MiniStatuslineFilename = {
link = "StatusLine",
},
MiniStatuslineInactive = {
link = "StatusLine",
},
}
end,
integrations = {
treesitter_context = false,
},
})
vim.cmd("colorscheme catppuccin")
end,
},
-- https://github.com/ibhagwan/fzf-lua
{
"ibhagwan/fzf-lua",
dependencies = {
"neovim/nvim-lspconfig",
},
opts = {
winopts = {
preview = {
default = "bat",
wrap = "wrap",
},
},
files = {
path_shorten = 1,
},
grep = {
multiline = 1,
},
fzf_colors = true,
},
config = function()
vim.keymap.set({ "n", "v" }, "<Leader>f", ":FzfLua files<CR>")
vim.keymap.set({ "n", "v" }, "<Leader>l", ":FzfLua blines<CR>")
vim.keymap.set({ "n", "v" }, "<Leader>rg", ":FzfLua live_grep_resume<CR>")
vim.keymap.set({ "n", "v" }, "<Space>s", ":FzfLua lsp_document_symbols<CR>")
vim.keymap.set({ "n", "v" }, "<Space>r", ":FzfLua lsp_references<CR>")
vim.keymap.set({ "n", "v" }, "gr", ":FzfLua lsp_references<CR>")
vim.keymap.set({ "n", "v" }, "<Space>i", ":FzfLua lsp_implementations<CR>")
vim.keymap.set({ "n", "v" }, "<Space>ca", ":FzfLua lsp_code_actions previewer=false<CR>")
vim.keymap.set({ "n", "v" }, "<Space>d", ":FzfLua diagnostics_document<CR>")
end,
},
-- https://github.com/Saghen/blink.cmp
{
"saghen/blink.cmp",
version = "v0.*",
opts = {
keymap = {
preset = "none",
["<C-space>"] = { "show", "show_documentation", "hide_documentation", "fallback" },
["<CR>"] = { "select_and_accept", "fallback" },
["<Up>"] = { "select_prev", "fallback" },
["<Down>"] = { "select_next", "fallback" },
},
completion = {
trigger = {
show_in_snippet = false,
show_on_keyword = false,
show_on_trigger_character = false,
},
},
},
},
-- https://github.com/tpope/vim-projectionist
{
"tpope/vim-projectionist",
ft = "go",
init = function()
vim.g.projectionist_heuristics = {
["*.go"] = {
["*.go"] = {
alternate = "{}_test.go",
type = "source",
},
["*_generated.go"] = {
alternate = "{}_test.go",
type = "source",
},
["*_test.go"] = {
alternate = { "{}.go", "{}_generated.go" },
type = "test",
},
},
}
end,
config = function()
vim.keymap.set("n", "<Leader>a", ":A<CR>")
end,
},
-- https://github.com/neovim/neovim/issues/12374
-- https://github.com/svban/YankAssassin.nvim
{
"svban/YankAssassin.nvim",
opts = {
auto_normal = true,
auto_visual = true,
},
},
-- https://github.com/echasnovski/mini.nvim
{
"echasnovski/mini.nvim",
config = function()
-- https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-bracketed.md
require("mini.bracketed").setup({
{
buffer = { suffix = "", options = {} },
file = { suffix = "", options = {} },
indent = { suffix = "", options = {} },
jump = { suffix = "", options = {} },
location = { suffix = "", options = {} },
oldfile = { suffix = "", options = {} },
undo = { suffix = "", options = {} },
window = { suffix = "", options = {} },
yank = { suffix = "", options = {} },
},
})
-- https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-cursorword.md
require("mini.cursorword").setup()
-- https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-files.md
require("mini.files").setup({
mappings = {
go_in = "",
go_in_plus = "<CR>",
go_out = "",
go_out_plus = "<BS>",
reset = "",
},
})
vim.keymap.set("n", "<C-n>", ":lua MiniFiles.open(nil, false)<CR>")
vim.keymap.set("n", "<Leader>n", ":lua MiniFiles.open(vim.api.nvim_buf_get_name(0), false)<CR>")
-- https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-hipatterns.md
local hipatterns = require("mini.hipatterns")
hipatterns.setup({
highlighters = {
hex_color = hipatterns.gen_highlighter.hex_color(),
},
})
-- https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-diff.md
require("mini.diff").setup({
options = {
wrap_goto = true,
},
})
-- https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-git.md
require("mini.git").setup()
-- https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-icons.md
require("mini.icons").setup()
-- https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-pairs.md
require("mini.pairs").setup()
-- https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-statusline.md
require("mini.statusline").setup()
-- https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-surround.md
require("mini.surround").setup()
-- My Sofle V2 do not have map `[`, `]` directly
vim.keymap.set("n", ")d", "]d", { remap = true })
vim.keymap.set("n", "(d", "[d", { remap = true })
vim.keymap.set("n", ")D", "]D", { remap = true })
vim.keymap.set("n", "(D", "[D", { remap = true })
vim.keymap.set("n", ")c", "]c", { remap = true })
vim.keymap.set("n", "(c", "[c", { remap = true })
vim.keymap.set("n", ")C", "]C", { remap = true })
vim.keymap.set("n", "(C", "[C", { remap = true })
vim.keymap.set("n", ")x", "]x", { remap = true })
vim.keymap.set("n", "(x", "[x", { remap = true })
vim.keymap.set("n", ")X", "]X", { remap = true })
vim.keymap.set("n", "(X", "[X", { remap = true })
vim.keymap.set("n", ")t", "]t", { remap = true })
vim.keymap.set("n", "(t", "[t", { remap = true })
vim.keymap.set("n", ")T", "]T", { remap = true })
vim.keymap.set("n", "(T", "[T", { remap = true })
vim.keymap.set("n", ")h", "]h", { remap = true })
vim.keymap.set("n", "(h", "[h", { remap = true })
vim.keymap.set("n", ")H", "]H", { remap = true })
vim.keymap.set("n", "(H", "[H", { remap = true })
-- Use cl instead of s
vim.keymap.set({ "n", "x" }, "s", "<Nop>")
end,
},
-- Programming languages
-- https://github.com/aklt/plantuml-syntax
{
"aklt/plantuml-syntax",
ft = {
"plantuml",
},
},
-- https://github.com/NoahTheDuke/vim-just
{
"NoahTheDuke/vim-just",
ft = {
"just",
},
},
-- https://github.com/stevearc/conform.nvim
{
"stevearc/conform.nvim",
config = function()
local conform = require("conform")
conform.setup({
formatters_by_ft = {
["_"] = { "trim_whitespace" },
bash = { "shfmt" },
go = { "gofumpt" },
javascript = { "deno_fmt" },
json = { "deno_fmt" },
just = { "just" },
lua = { "stylua" },
markdown = { "deno_fmt" },
proto = { "buf" },
python = { "ruff_fix", "ruff_format" },
sh = { "shfmt" },
sql = { "sqlfluff" },
toml = { "trim_whitespace", "taplo" },
typst = { "typstyle" },
yaml = { "prettier" },
zsh = { "shfmt" },
},
formatters = {
-- https://github.com/stevearc/conform.nvim/blob/master/lua/conform/formatters/gofumpt.lua
gofumpt = {
prepend_args = { "-extra" },
},
-- https://github.com/stevearc/conform.nvim/blob/master/lua/conform/formatters/shfmt.lua
shfmt = {
prepend_args = { "-s", "-i", "4" },
},
-- https://github.com/stevearc/conform.nvim/blob/master/lua/conform/formatters/taplo.lua
taplo = {
args = { "fmt", "-o", "indent_string= ", "-o", "allowed_blank_lines=1", "-" },
},
-- https://github.com/stevearc/conform.nvim/blob/master/lua/conform/formatters/sqlfluff.lua
sqlfluff = {
args = { "fix", "--dialect=mysql", "-" },
},
-- https://github.com/stevearc/conform.nvim/blob/master/lua/conform/formatters/ruff_format.lua
ruff_format = {
args = {
"format",
"--force-exclude",
"--line-length",
"120",
"--stdin-filename",
"$FILENAME",
"-",
},
},
},
})
vim.keymap.set("n", "<Space>f", function()
conform.format()
end)
end,
},
-- https://github.com/nvim-treesitter/nvim-treesitter
{
"nvim-treesitter/nvim-treesitter",
build = {
":TSUpdate",
},
opts = {
ensure_installed = {
"bash",
"dockerfile",
"git_config",
"gitcommit",
"go",
"json",
"just",
"lua",
"make",
"markdown",
"markdown_inline",
"proto",
"python",
"sql",
"toml",
"typst",
"yaml",
},
highlight = {
enabled = true,
disable = function(lang, bufnr)
-- Skip big files with many lines
return vim.api.nvim_buf_line_count(bufnr) > 10000
end,
},
incremental_selection = { enable = false },
textobjects = { enable = false },
indent = { enable = false },
},
},
-- https://github.com/nvim-treesitter/nvim-treesitter-context
{
"nvim-treesitter/nvim-treesitter-context",
dependencies = {
"nvim-treesitter/nvim-treesitter",
},
opts = {
enable = true,
max_lines = 2,
},
},
-- https://github.com/nvim-treesitter/nvim-treesitter-textobjects
{
"nvim-treesitter/nvim-treesitter-textobjects",
dependencies = {
"nvim-treesitter/nvim-treesitter",
},
},
-- https://github.com/neovim/nvim-lspconfig
{
"neovim/nvim-lspconfig",
ft = {
"go",
"markdown",
"python",
"typst",
},
config = function()
local lspconfig = require("lspconfig")
-- Go
-- https://github.com/golang/tools/blob/master/gopls/doc/vim.md
-- https://github.com/golang/tools/blob/master/gopls/doc/settings.md
-- https://github.com/neovim/nvim-lspconfig/blob/master/doc/configs.md#gopls
-- https://github.com/neovim/nvim-lspconfig/issues/2542
lspconfig.gopls.setup({})
-- Protobuf
lspconfig.buf_ls.setup({})
-- Python
-- https://github.com/neovim/nvim-lspconfig/blob/master/doc/configs.md#pyright
lspconfig.pyright.setup({
settings = {
pyright = {
-- Conflicts with Ruff
disableOrganizeImports = true,
},
python = {
analysis = {
-- Conflicts with Ruff
ignore = { "*" },
},
},
},
})
-- https://docs.astral.sh/ruff/editors/setup/#neovim
-- https://github.com/neovim/nvim-lspconfig/blob/master/doc/configs.md#ruff
lspconfig.ruff.setup({
on_init = function(client, initialization_result)
if client.server_capabilities then
-- Conflicts with pyright
client.server_capabilities.hoverProvider = false
end
end,
})
-- Markdown
-- https://github.com/artempyanykh/marksman
-- https://github.com/neovim/nvim-lspconfig/blob/master/doc/configs.md#marksman
lspconfig.marksman.setup({})
-- Typst
-- https://github.com/Myriad-Dreamin/tinymist
-- https://github.com/neovim/nvim-lspconfig/blob/master/doc/configs.md#tinymist
lspconfig.tinymist.setup({})
-- General
vim.keymap.set("n", "<Space>e", vim.diagnostic.open_float)
vim.keymap.set("n", "<Space>lr", ":LspRestart<CR>")
local augroup = vim.api.nvim_create_augroup("UserLspConfig", {})
vim.api.nvim_create_autocmd("LspAttach", {
group = augroup,
callback = function(ev)
vim.bo[ev.buf].omnifunc = "v:lua.vim.lsp.omnifunc"
local opts = { buffer = ev.buf }
vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts)
vim.keymap.set("n", "<Space>k", vim.lsp.buf.hover, opts)
vim.keymap.set("n", "gk", vim.lsp.buf.hover, opts)
vim.keymap.set("n", "<F2>", vim.lsp.buf.rename, opts)
end,
})
-- Chaos
-- https://www.reddit.com/r/neovim/comments/18teetv/one_day_you_will_wake_up_and_choose_the_chaos
-- https://github.com/neovim/nvim-lspconfig/wiki/UI-Customization
-- https://neovim.io/doc/user/diagnostic.html#diagnostic-highlights
-- https://emojipedia.org/
local signs = {
Error = "🔥",
Warn = "😤",
Info = "🤔",
Hint = "🐼",
}
for type, icon in pairs(signs) do
local hl = "DiagnosticSign" .. type
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
end
-- https://neovim.io/doc/user/diagnostic.html#diagnostic-api
vim.diagnostic.config({
underline = false,
virtual_text = false,
})
end,
},
-- https://github.com/github/copilot.vim
{
"github/copilot.vim",
init = function()
vim.g.copilot_filetypes = {
["*"] = false,
asciidoc = true,
dockerfile = true,
gitcommit = true,
go = true,
json = true,
just = true,
lua = true,
make = true,
markdown = true,
plantuml = true,
proto = true,
python = true,
sql = true,
toml = true,
typst = true,
yaml = true,
zsh = true,
}
vim.g.copilot_no_tab_map = true
end,
config = function()
-- Largely copy from GitHub
vim.keymap.set("i", "<M-Right>", 'copilot#Accept("\\<CR>")', {
expr = true,
replace_keycodes = false,
})
end,
},
}, {
performance = {
rtp = {
disabled_plugins = {
"editorconfig",
"gzip",
"spellfile",
"tarPlugin",
"tohtml",
"tutor",
"zipPlugin",
},
},
},
rocks = { enabled = false },
throttle = { enabled = true },
git = {
-- Seconds
cooldown = 5 * 60,
},
})

44
data/nvim/init.vim Normal file
View File

@ -0,0 +1,44 @@
set breakindent
set completeopt=menuone,noinsert,noselect
set noswapfile
set number
set relativenumber
set scrolloff=4
set virtualedit=block
set whichwrap=<,>,[,]
" tabstop
" https://www.reddit.com/r/vim/wiki/tabstop
set tabstop=8
set softtabstop=4
set shiftwidth=4
set expandtab
" Mouse support
set mouse=a
" Clipboard support
set clipboard+=unnamedplus
" FZF
set rtp+=~/.fzf
" Plugins config
let g:lightline={'colorscheme':'onedark'}
" vim-plug
" https://github.com/junegunn/vim-plug
call plug#begin()
" Should use
Plug 'preservim/nerdtree'
Plug 'itchyny/lightline.vim'
Plug 'tpope/vim-fugitive'
" Colorschemes
Plug 'joshdick/onedark.vim'
call plug#end()
set background=dark
colorscheme onedark

View File

@ -1,6 +0,0 @@
--max-columns=120
--max-columns-preview
--context=3
--pretty
--smart-case
--engine=auto

View File

@ -1,27 +0,0 @@
"$schema" = 'https://starship.rs/config-schema.json'
add_newline = false
format = """
$username\
$hostname\
$localip\
$shlvl\
$directory\
$git_branch\
$git_commit\
$git_state\
$git_status\
$package\
$golang\
$env_var\
$custom\
$sudo\
$cmd_duration\
$line_break\
$jobs\
$time\
$status\
$os\
$shell\
$character"""

17
data/tmux/tmux.conf Normal file
View File

@ -0,0 +1,17 @@
# Change prefix
set -g prefix C-a
unbind C-b
bind C-a send-prefix
# Split panes using | and -
bind | split-window -h
bind - split-window -v
# Switch panes using Alt
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
# Color
set -g default-terminal "tmux-256color"

View File

@ -1,9 +0,0 @@
[files]
extend-exclude = [
"CHANGELOG.md",
"*/generated/*",
"generated/*",
"*/external/proto/*",
"external/proto/*",
"*.html",
]

View File

@ -1,102 +0,0 @@
local wezterm = require("wezterm")
local act = wezterm.action
-- Custom fonts config
-- wezterm ls-fonts --list-system
local function font_with_fallback(main_font)
local fonts = {
main_font,
{
family = "Apple Color Emoji",
assume_emoji_presentation = true,
},
"Symbols Nerd Font Mono",
}
return wezterm.font_with_fallback(fonts)
end
-- https://github.com/be5invis/Iosevka
local font_iosevka = {
font = font_with_fallback({
family = "Iosevka Pacman",
}),
font_size = 18.0,
line_height = 1.2,
default_cursor_style = "SteadyBar",
}
local current_font = font_iosevka
local current_color_scheme = "Catppuccin Mocha"
return {
font = current_font.font,
font_rules = current_font.font_rules,
font_size = current_font.font_size,
line_height = current_font.line_height,
use_cap_height_to_scale_fallback_fonts = true,
color_scheme = current_color_scheme,
window_padding = {
left = 16,
right = 16,
top = 16,
bottom = 16,
},
use_fancy_tab_bar = false,
hide_tab_bar_if_only_one_tab = true,
tab_bar_at_bottom = true,
tab_and_split_indices_are_zero_based = true,
tab_max_width = 24,
window_background_opacity = 0.95,
macos_window_background_blur = 20,
native_macos_fullscreen_mode = true,
default_cursor_style = current_font.default_cursor_style,
audible_bell = "Disabled",
front_end = "WebGpu",
max_fps = 120,
keys = {
{
key = "LeftArrow",
mods = "CTRL|SHIFT",
action = act.ActivateTabRelative(-1),
},
{
key = "RightArrow",
mods = "CTRL|SHIFT",
action = act.ActivateTabRelative(1),
},
-- Inspire from Zellij
{
key = "n",
mods = "ALT",
action = act.SplitHorizontal({ domain = "CurrentPaneDomain" }),
},
{
key = "m",
mods = "ALT",
action = act.SplitVertical({ domain = "CurrentPaneDomain" }),
},
{
key = "p",
mods = "ALT",
action = act.ActivatePaneDirection("Next"),
},
{
key = "[",
mods = "ALT",
action = act.ActivateTabRelative(-1),
},
{
key = "]",
mods = "ALT",
action = act.ActivateTabRelative(1),
},
},
}

View File

@ -1,18 +0,0 @@
[
{
"context": "Editor && inline_completion && !showing_completions",
"bindings": {
"tab": "zed::NoAction",
"alt-right": "editor::AcceptInlineCompletion"
}
},
{
"context": "Editor && (vim_mode == normal || vim_mode == visual)",
"bindings": {
"; d": ["workspace::SendKeystrokes", "\" _ d"],
"; c": ["workspace::SendKeystrokes", "\" _ c"],
"; x": ["workspace::SendKeystrokes", "\" _ x"],
"space f": "editor::Format"
}
}
]

View File

@ -1,25 +0,0 @@
{
"ui_font_size": 18,
"ui_font_family": "Shantell Sans Normal",
"buffer_font_size": 18,
"buffer_font_family": "Iosevka Pacman",
"soft_wrap": "bounded",
"preferred_line_length": 120,
"toolbar": {
"breadcrumbs": false,
"quick_actions": false
},
"theme": {
"mode": "system",
"dark": "Catppuccin Mocha",
"light": "Catppuccin Latte"
},
"vim_mode": true,
"assistant": {
"enabled": false,
"version": "2"
},
"show_call_status_icon": false,
"projects_online_by_default": false,
"restore_on_startup": "none"
}

View File

@ -1,33 +0,0 @@
theme "catppuccin-mocha"
default_layout "compact"
default_mode "locked"
on_force_close "quit"
simplified_ui true
pane_frames false
ui {
pane_frames {
hide_session_name true
}
}
keybinds {
shared {
bind "Alt p" {
SwitchFocus
}
bind "Alt o" {
NewTab
}
bind "Alt ]" {
GoToNextTab
}
bind "Alt [" {
GoToPreviousTab
}
bind "Alt n" {
NewPane
}
bind "Alt m" {
NewPane "Down"
}
}
}

View File

@ -1,238 +0,0 @@
# vim: set filetype=zsh:
# Put this on bottom of ~/.zshrc
# https://blog.izissise.net/posts/env-path/
typeset -U path PATH
# Alias
alias g="git"
alias moe="make"
alias meo="make"
# https://wiki.archlinux.org/title/XDG_Base_Directory
export XDG_CONFIG_HOME=~/.config
export XDG_CACHE_HOME=~/.cache
export XDG_DATA_HOME=~/.local/share
# https://github.com/ohmyzsh/ohmyzsh/blob/master/lib/completion.zsh
# https://thevaluable.dev/zsh-completion-guide-examples/
# https://damn.engineer/2022/09/28/zsh-case-insensitive
zstyle ':completion:*' use-cache on
zstyle ':completion:*' cache-path "$XDG_CACHE_HOME/zsh/.zcompcache"
zstyle ':completion:*' matcher-list 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}' 'r:|=*' 'l:|=* r:|=*'
zstyle ':completion:*' special-dirs true
# zsh plugins
# https://github.com/zsh-users/zsh-syntax-highlighting
if [[ -f /opt/homebrew/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh ]]; then
# https://github.com/catppuccin/zsh-syntax-highlighting
source ~/.config/zsh/themes/catppuccin_mocha-zsh-syntax-highlighting.zsh
source /opt/homebrew/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
typeset -A ZSH_HIGHLIGHT_STYLES
# Remove underline from catppuccin mocha theme
ZSH_HIGHLIGHT_STYLES[path]='fg=#cdd6f4'
ZSH_HIGHLIGHT_STYLES[path_pathseparator]='fg=#f38ba8'
ZSH_HIGHLIGHT_STYLES[path_prefix]='fg=#cdd6f4'
ZSH_HIGHLIGHT_STYLES[path_prefix_pathseparator]='fg=#f38ba8'
fi
# https://github.com/zsh-users/zsh-autosuggestions
if [[ -f /opt/homebrew/share/zsh-autosuggestions/zsh-autosuggestions.zsh ]]; then
source /opt/homebrew/share/zsh-autosuggestions/zsh-autosuggestions.zsh
export ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE=20
export ZSH_AUTOSUGGEST_MANUAL_REBIND=true
export ZSH_AUTOSUGGEST_HISTORY_IGNORE=$HISTORY_IGNORE
fi
# https://unix.stackexchange.com/q/621606
# https://github.com/zsh-users/zsh-history-substring-search
if [[ -f /opt/homebrew/share/zsh-history-substring-search/zsh-history-substring-search.zsh ]]; then
source /opt/homebrew/share/zsh-history-substring-search/zsh-history-substring-search.zsh
bindkey '^[[A' history-substring-search-up
bindkey '^[[B' history-substring-search-down
export HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND=''
export HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND=''
export HISTORY_SUBSTRING_SEARCH_PREFIXED=true
fi
# https://www.topbug.net/blog/2016/09/27/make-gnu-less-more-powerful/
export LESS="-RF -i -K -s -x2 --wordwrap"
# git
# https://stackoverflow.com/a/43747486
export GIT_COMPLETION_CHECKOUT_NO_GUESS=1
# nvim
if command -v nvim &>/dev/null; then
export EDITOR=nvim
export VISUAL=nvim
export GIT_EDITOR=nvim
alias vi="nvim"
alias vim="nvim"
fi
# go
# https://stackoverflow.com/a/13542854
if command -v go &>/dev/null; then
if [[ -d $HOME/go ]]; then
export GOPATH=$HOME/go
path=($path $GOPATH/bin)
fi
# Depend on your company
# export GOPRIVATE=example.company.com
fi
# fzf
# https://github.com/junegunn/fzf
if command -v fzf &>/dev/null; then
export FZF_COMPLETION_TRIGGER='~~'
# https://github.com/catppuccin/fzf
# Remove bg for transparent terminal
export FZF_DEFAULT_OPTS="\
--ansi \
--pointer='🔫' --prompt='🪓 ' \
--color=bg+:#313244,spinner:#f5e0dc,hl:#f38ba8 \
--color=fg:#cdd6f4,header:#f38ba8,info:#cba6f7,pointer:#f5e0dc \
--color=marker:#b4befe,fg+:#cdd6f4,prompt:#cba6f7,hl+:#f38ba8 \
--color=selected-bg:#45475a"
if command -v fd &>/dev/null; then
_fzf_compgen_path() {
fd --type file . "$1"
}
_fzf_compgen_dir() {
fd --type directory . "$1"
}
export FZF_DEFAULT_COMMAND="fd --type file --color=always"
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
export FZF_ALT_C_COMMAND="fd --type directory --color=always"
fi
if command -v bat &>/dev/null; then
export FZF_CTRL_T_OPTS="--preview 'bat --color=always --line-range=:500 {}'"
fi
if command -v eza &>/dev/null; then
export FZF_ALT_C_OPTS="--preview 'eza --tree --level 1 {}'"
fi
source <(fzf --zsh)
# https://github.com/Aloxaf/fzf-tab
if [[ -f $HOME/.zsh-plugins/fzf-tab/fzf-tab.plugin.zsh ]]; then
source /Users/anon/.zsh-plugins/fzf-tab/fzf-tab.plugin.zsh
zstyle ':completion:*' menu no
zstyle ':fzf-tab:*' fzf-flags \
--ansi \
--pointer='🔫' --prompt='🪓 ' \
--color=bg+:#313244,spinner:#f5e0dc,hl:#f38ba8 \
--color=fg:#cdd6f4,header:#f38ba8,info:#cba6f7,pointer:#f5e0dc \
--color=marker:#b4befe,fg+:#cdd6f4,prompt:#cba6f7,hl+:#f38ba8 \
--color=selected-bg:#45475a
fi
fi
# https://github.com/BurntSushi/ripgrep
if command -v rg &>/dev/null; then
export RIPGREP_CONFIG_PATH="$HOME/.config/ripgrep/ripgreprc"
fi
# https://github.com/eza-community/eza
if command -v eza &>/dev/null; then
alias ls="eza"
alias la="eza -la"
alias lt="eza --tree"
fi
# https://github.com/kovidgoyal/kitty
if command -v kitten &>/dev/null; then
alias kssh="kitten ssh"
fi
# https://github.com/dandavison/delta
if command -v delta &>/dev/null; then
alias da="delta"
eval "$(delta --generate-completion zsh)"
fi
# https://github.com/wilfred/difftastic
if command -v difft &>/dev/null; then
export DFT_DISPLAY=inline
export DFT_TAB_WIDTH=2
fi
# https://restic.readthedocs.io/en/latest/manual_rest.html
if command -v restic &>/dev/null; then
export RESTIC_PASSWORD_FILE=$HOME/.restic_password_file
fi
# https://github.com/sharkdp/vivid
if command -v vivid &>/dev/null; then
export LS_COLORS="$(vivid generate catppuccin-mocha)"
fi
# https://github.com/ajeetdsouza/zoxide
if command -v zoxide &>/dev/null; then
export _ZO_ECHO=1
eval "$(zoxide init zsh)"
fi
# https://github.com/walles/moar
if command -v moar &>/dev/null; then
export MOAR="-no-linenumbers -no-statusbar -quit-if-one-screen -wrap"
export PAGER=moar
fi
# https://github.com/Schniz/fnm
if command -v fnm &>/dev/null; then
eval "$(fnm env --use-on-cd)"
fi
# https://github.com/oven-sh/bun
if command -v bun &>/dev/null; then
if [[ -d $HOME/.cache/.bun/bin ]]; then
path=($path $HOME/.cache/.bun/bin)
fi
fi
# https://github.com/casey/just
if command -v just &>/dev/null; then
alias jst="just"
eval "$(just --completions zsh)"
fi
# https://github.com/rclone/rclone
if command -v rclone &>/dev/null; then
export RCLONE_PROGRESS=true
export RCLONE_EXCLUDE=".DS_Store"
fi
# https://github.com/crate-ci/typos
if command -v typos &>/dev/null; then
alias typo="typos --config ~/.config/typos/typos.toml"
fi
# https://github.com/orhun/daktilo
if command -v daktilo &>/dev/null; then
export DAKTILO_CONFIG="$HOME/.config/daktilo/daktilo.toml"
fi
# https://github.com/starship/starship
if command -v starship &>/dev/null; then
export STARSHIP_CONFIG="$HOME/.config/starship/starship.toml"
eval "$(starship init zsh)"
fi
# https://ryuuta.net/blog/diagnosing-an-unsual-wifi-issue/
export QT_BEARER_POLL_TIMEOUT=-1
export PATH

View File

@ -1,74 +0,0 @@
# Catppuccin Mocha Theme (for zsh-syntax-highlighting)
#
# Paste this files contents inside your ~/.zshrc before you activate zsh-syntax-highlighting
ZSH_HIGHLIGHT_HIGHLIGHTERS=(main cursor)
typeset -gA ZSH_HIGHLIGHT_STYLES
# Main highlighter styling: https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/docs/highlighters/main.md
#
## General
### Diffs
### Markup
## Classes
## Comments
ZSH_HIGHLIGHT_STYLES[comment]='fg=#585b70'
## Constants
## Entitites
## Functions/methods
ZSH_HIGHLIGHT_STYLES[alias]='fg=#a6e3a1'
ZSH_HIGHLIGHT_STYLES[suffix-alias]='fg=#a6e3a1'
ZSH_HIGHLIGHT_STYLES[global-alias]='fg=#a6e3a1'
ZSH_HIGHLIGHT_STYLES[function]='fg=#a6e3a1'
ZSH_HIGHLIGHT_STYLES[command]='fg=#a6e3a1'
ZSH_HIGHLIGHT_STYLES[precommand]='fg=#a6e3a1,italic'
ZSH_HIGHLIGHT_STYLES[autodirectory]='fg=#fab387,italic'
ZSH_HIGHLIGHT_STYLES[single-hyphen-option]='fg=#fab387'
ZSH_HIGHLIGHT_STYLES[double-hyphen-option]='fg=#fab387'
ZSH_HIGHLIGHT_STYLES[back-quoted-argument]='fg=#cba6f7'
## Keywords
## Built ins
ZSH_HIGHLIGHT_STYLES[builtin]='fg=#a6e3a1'
ZSH_HIGHLIGHT_STYLES[reserved-word]='fg=#a6e3a1'
ZSH_HIGHLIGHT_STYLES[hashed-command]='fg=#a6e3a1'
## Punctuation
ZSH_HIGHLIGHT_STYLES[commandseparator]='fg=#f38ba8'
ZSH_HIGHLIGHT_STYLES[command-substitution-delimiter]='fg=#cdd6f4'
ZSH_HIGHLIGHT_STYLES[command-substitution-delimiter-unquoted]='fg=#cdd6f4'
ZSH_HIGHLIGHT_STYLES[process-substitution-delimiter]='fg=#cdd6f4'
ZSH_HIGHLIGHT_STYLES[back-quoted-argument-delimiter]='fg=#f38ba8'
ZSH_HIGHLIGHT_STYLES[back-double-quoted-argument]='fg=#f38ba8'
ZSH_HIGHLIGHT_STYLES[back-dollar-quoted-argument]='fg=#f38ba8'
## Serializable / Configuration Languages
## Storage
## Strings
ZSH_HIGHLIGHT_STYLES[command-substitution-quoted]='fg=#f9e2af'
ZSH_HIGHLIGHT_STYLES[command-substitution-delimiter-quoted]='fg=#f9e2af'
ZSH_HIGHLIGHT_STYLES[single-quoted-argument]='fg=#f9e2af'
ZSH_HIGHLIGHT_STYLES[single-quoted-argument-unclosed]='fg=#eba0ac'
ZSH_HIGHLIGHT_STYLES[double-quoted-argument]='fg=#f9e2af'
ZSH_HIGHLIGHT_STYLES[double-quoted-argument-unclosed]='fg=#eba0ac'
ZSH_HIGHLIGHT_STYLES[rc-quote]='fg=#f9e2af'
## Variables
ZSH_HIGHLIGHT_STYLES[dollar-quoted-argument]='fg=#cdd6f4'
ZSH_HIGHLIGHT_STYLES[dollar-quoted-argument-unclosed]='fg=#eba0ac'
ZSH_HIGHLIGHT_STYLES[dollar-double-quoted-argument]='fg=#cdd6f4'
ZSH_HIGHLIGHT_STYLES[assign]='fg=#cdd6f4'
ZSH_HIGHLIGHT_STYLES[named-fd]='fg=#cdd6f4'
ZSH_HIGHLIGHT_STYLES[numeric-fd]='fg=#cdd6f4'
## No category relevant in spec
ZSH_HIGHLIGHT_STYLES[unknown-token]='fg=#eba0ac'
ZSH_HIGHLIGHT_STYLES[path]='fg=#cdd6f4,underline'
ZSH_HIGHLIGHT_STYLES[path_pathseparator]='fg=#f38ba8,underline'
ZSH_HIGHLIGHT_STYLES[path_prefix]='fg=#cdd6f4,underline'
ZSH_HIGHLIGHT_STYLES[path_prefix_pathseparator]='fg=#f38ba8,underline'
ZSH_HIGHLIGHT_STYLES[globbing]='fg=#cdd6f4'
ZSH_HIGHLIGHT_STYLES[history-expansion]='fg=#cba6f7'
#ZSH_HIGHLIGHT_STYLES[command-substitution]='fg=?'
#ZSH_HIGHLIGHT_STYLES[command-substitution-unquoted]='fg=?'
#ZSH_HIGHLIGHT_STYLES[process-substitution]='fg=?'
#ZSH_HIGHLIGHT_STYLES[arithmetic-expansion]='fg=?'
ZSH_HIGHLIGHT_STYLES[back-quoted-argument-unclosed]='fg=#eba0ac'
ZSH_HIGHLIGHT_STYLES[redirection]='fg=#cdd6f4'
ZSH_HIGHLIGHT_STYLES[arg0]='fg=#cdd6f4'
ZSH_HIGHLIGHT_STYLES[default]='fg=#cdd6f4'
ZSH_HIGHLIGHT_STYLES[cursor]='fg=#cdd6f4'

View File

@ -1,30 +0,0 @@
# vim: set filetype=zsh:
# Put this on top of ~/.zshrc
# See https://wiki.archlinux.org/title/Zsh
# https://lgug2z.com/articles/sensible-wordchars-for-most-developers/
export WORDCHARS='*?[]~&;!#$%^(){}<>'
# https://zsh.sourceforge.io/Doc/Release/Parameters.html#Parameters-Used-By-The-Shell
export HISTORY_IGNORE="(l[sal]|cd|pwd|exit|z)"
export HISTSIZE=100000000
export SAVEHIST=$HISTSIZE
# https://zsh.sourceforge.io/Doc/Release/Options.html
setopt AUTO_CD
setopt HIST_EXPIRE_DUPS_FIRST
setopt HIST_FIND_NO_DUPS
setopt HIST_IGNORE_ALL_DUPS
setopt HIST_NO_FUNCTIONS
setopt HIST_NO_STORE
setopt HIST_REDUCE_BLANKS
setopt HIST_SAVE_NO_DUPS
setopt INC_APPEND_HISTORY_TIME
# https://stackoverflow.com/q/12382499
bindkey "^[[1;3C" forward-word
bindkey "^[[1;3D" backward-word
autoload -Uz compinit
compinit

29
go.mod
View File

@ -1,30 +1,19 @@
module github.com/haunt98/dotfiles
go 1.20
go 1.17
require (
github.com/BurntSushi/toml v1.4.0
github.com/bytedance/sonic v1.12.6
github.com/make-go-great/color-go v0.5.0
github.com/make-go-great/copy-go v0.9.0
github.com/make-go-great/diff-go v0.0.6
github.com/urfave/cli/v2 v2.27.5
golang.org/x/sync v0.10.0
github.com/make-go-great/color-go v0.3.0
github.com/make-go-great/copy-go v0.8.0
github.com/urfave/cli/v2 v2.3.0
)
require (
github.com/bytedance/sonic/loader v0.2.0 // indirect
github.com/cloudwego/base64x v0.1.4 // indirect
github.com/cloudwego/iasm v0.2.0 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.5 // indirect
github.com/fatih/color v1.16.0 // indirect
github.com/klauspost/cpuid/v2 v2.0.9 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.1 // indirect
github.com/fatih/color v1.13.0 // indirect
github.com/mattn/go-colorable v0.1.9 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 // indirect
golang.org/x/arch v0.0.0-20210923205945-b76863e36670 // indirect
golang.org/x/sys v0.14.0 // indirect
golang.org/x/sys v0.0.0-20210818153620-00dd8d7831e7 // indirect
)

84
go.sum
View File

@ -1,65 +1,31 @@
github.com/BurntSushi/toml v1.4.0 h1:kuoIxZQy2WRRk1pttg9asf+WVv6tWQuBNVmK8+nqPr0=
github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
github.com/bytedance/sonic v1.12.6 h1:/isNmCUF2x3Sh8RAp/4mh4ZGkcFAX/hLrzrK3AvpRzk=
github.com/bytedance/sonic v1.12.6/go.mod h1:B8Gt/XvtZ3Fqj+iSKMypzymZxw/FVwgIGKzMzT9r/rk=
github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU=
github.com/bytedance/sonic/loader v0.2.0 h1:zNprn+lsIP06C/IqCHs3gPQIvnvpKbbxyXQP1iU4kWM=
github.com/bytedance/sonic/loader v0.2.0/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU=
github.com/cloudwego/base64x v0.1.4 h1:jwCgWpFanWmN8xoIUHa2rtzmkd5J2plF/dnLS6Xd/0Y=
github.com/cloudwego/base64x v0.1.4/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w=
github.com/cloudwego/iasm v0.2.0 h1:1KNIy1I1H9hNNFEEH3DVnI4UujN+1zjpuk6gwHLTssg=
github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY=
github.com/cpuguy83/go-md2man/v2 v2.0.5 h1:ZtcqGrnekaHpVLArFSe4HK5DoKx1T0rq2DwVB0alcyc=
github.com/cpuguy83/go-md2man/v2 v2.0.5/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM=
github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE=
github.com/klauspost/cpuid/v2 v2.0.9 h1:lgaqFMSdTdQYdZ04uHyN2d/eKdOMyi2YLSvlQIBFYa4=
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M=
github.com/make-go-great/color-go v0.5.0 h1:iCSIBybwoo+ctK3QdSWPJPAl05/a3tBrxvOURZRT1qA=
github.com/make-go-great/color-go v0.5.0/go.mod h1:GoWscSdNNxjxsQdQCgGlUoADdRHqjmuBMsdr+Rb/QQM=
github.com/make-go-great/copy-go v0.9.0 h1:RTqVypNIa6liItFg6kORP93ZhgSck8+pupvGrnSzrSI=
github.com/make-go-great/copy-go v0.9.0/go.mod h1:J1ihIqaX3O/lGAaL23d+1GXSQwJX3RpStmUIUdh4xyw=
github.com/make-go-great/diff-go v0.0.6 h1:DgeFgtYF2dfdjIYPuUq5d3qptsoD3lTMU/6Xt95V7u8=
github.com/make-go-great/diff-go v0.0.6/go.mod h1:eAfYedYs5AX24DteegUMZbOZ8aUUIk9j+KfbG1oxi+w=
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/cpuguy83/go-md2man/v2 v2.0.1 h1:r/myEWzV9lfsM1tFLgDyu0atFtJ1fXn261LKYj/3DxU=
github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w=
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
github.com/make-go-great/color-go v0.3.0 h1:ZVtVk/wVVsZZwSJG7PZpsY5zwIyGao5VoN48yKfSzYA=
github.com/make-go-great/color-go v0.3.0/go.mod h1:G5G8IJ3PUo+vSQ+UvnfaswF8O/piVIhFJKv1mQjBGpI=
github.com/make-go-great/copy-go v0.8.0 h1:AgMSCm4E6+2oZPQv9UR59nc0y1Q0TaYl88ypPJxjA4k=
github.com/make-go-great/copy-go v0.8.0/go.mod h1:QQii7A48OAcQMloNG5YV0USARmxHf3JLS9ieONO1WQA=
github.com/mattn/go-colorable v0.1.9 h1:sqDoxXbdeALODt0DAeJCVp38ps9ZogZEAXjus69YV3U=
github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y=
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e h1:aoZm08cpOy4WuID//EZDgcC4zIxODThtZNPirFr42+A=
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI=
github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=
github.com/urfave/cli/v2 v2.27.5 h1:WoHEJLdsXr6dDWoJgMq/CboDmyY/8HMMH1fTECbih+w=
github.com/urfave/cli/v2 v2.27.5/go.mod h1:3Sevf16NykTbInEnD0yKkjDAeZDS0A6bzhBH5hrMvTQ=
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 h1:gEOO8jv9F4OT7lGCjxCBTO/36wtF6j2nSip77qHd4x4=
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1/go.mod h1:Ohn+xnUBiLI6FVj/9LpzZWtj1/D6lUovWYBkxHVV3aM=
golang.org/x/arch v0.0.0-20210923205945-b76863e36670 h1:18EFjUmQOcUvxNYSkA6jO9VAiXCnxFY6NyDX0bHDmkU=
golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ=
golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q=
golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/urfave/cli/v2 v2.3.0 h1:qph92Y649prgesehzOrQjdWyxFOp/QVM+6imKHad91M=
github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210818153620-00dd8d7831e7 h1:/bmDWM82ZX7TawqxuI8kVjKI0TXHdSY6pHJArewwHtU=
golang.org/x/sys v0.0.0-20210818153620-00dd8d7831e7/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50=
gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=

View File

@ -4,16 +4,14 @@ import (
"fmt"
"log"
"github.com/urfave/cli/v2"
"github.com/haunt98/dotfiles/internal/config"
"github.com/urfave/cli/v2"
)
type action struct {
flags struct {
appNames []string
verbose bool
dryRun bool
verbose bool
dryRun bool
}
}
@ -23,100 +21,85 @@ func (a *action) runHelp(c *cli.Context) error {
}
func (a *action) runInstall(c *cli.Context) error {
cfg, err := a.loadConfig(c, commandInstallName)
a.getFlags(c)
a.log("start %s\n", installCommand)
cfg, err := a.loadConfig()
if err != nil {
return err
}
if err := cfg.Install(a.flags.appNames...); err != nil {
return fmt.Errorf("config: failed to install: %w", err)
if err := cfg.Install(); err != nil {
return fmt.Errorf("failed to install config: %w", err)
}
return nil
}
func (a *action) runUpdate(c *cli.Context) error {
cfg, err := a.loadConfig(c, commandUpdateName)
a.getFlags(c)
a.log("start %s\n", updateCommand)
cfg, err := a.loadConfig()
if err != nil {
return err
}
if err := cfg.Update(a.flags.appNames...); err != nil {
return fmt.Errorf("config: failed to update: %w", err)
}
return nil
}
func (a *action) runDownload(c *cli.Context) error {
cfg, err := a.loadConfig(c, commandDownloadName)
if err != nil {
return err
}
if err := cfg.Download(a.flags.appNames...); err != nil {
return fmt.Errorf("config: failed to download: %w", err)
if err := cfg.Update(); err != nil {
return fmt.Errorf("failed to update config: %w", err)
}
return nil
}
func (a *action) runClean(c *cli.Context) error {
cfg, err := a.loadConfig(c, commandCleanName)
a.getFlags(c)
a.log("start %s\n", cleanCommand)
cfg, err := a.loadConfig()
if err != nil {
return err
}
if err := cfg.Clean(); err != nil {
return fmt.Errorf("config: failed to clean: %w", err)
return fmt.Errorf("failed to clean config: %w", err)
}
return nil
}
func (a *action) runDiff(c *cli.Context) error {
cfg, err := a.loadConfig(c, commandDiffName)
if err != nil {
return err
}
if err := cfg.Diff(a.flags.appNames...); err != nil {
return fmt.Errorf("config: failed to compare: %w", err)
}
return nil
}
func (a *action) runValidate(c *cli.Context) error {
cfg, err := a.loadConfig(c, commandValidateName)
if err != nil {
return err
}
if err := cfg.Validate(a.flags.appNames...); err != nil {
return fmt.Errorf("config: failed to validate: %w", err)
}
return nil
}
func (a *action) loadConfig(c *cli.Context, command string) (config.Config, error) {
func (a *action) runCompare(c *cli.Context) error {
a.getFlags(c)
a.log("Start command [%s] with flags [%+v]\n", command, a.flags)
a.log("start %s\n", compareCommand)
cfg, err := config.LoadConfig(currentDir, a.flags.dryRun)
cfg, err := a.loadConfig()
if err != nil {
return nil, fmt.Errorf("config: failed to load: %w", err)
return err
}
a.log("Config apps %+v\n", cfg.List())
return cfg, nil
if err := cfg.Compare(); err != nil {
return fmt.Errorf("failed to compare config: %w", err)
}
return nil
}
func (a *action) loadConfig() (config.Config, error) {
cfgReal, cfgDemo, err := config.LoadConfig(currentDir)
if err != nil {
return nil, fmt.Errorf("failed to load config: %w", err)
}
if a.flags.dryRun {
return cfgDemo, nil
}
return cfgReal, nil
}
func (a *action) getFlags(c *cli.Context) {
a.flags.verbose = c.Bool(flagVerboseName)
a.flags.dryRun = c.Bool(flagDryRunName)
a.flags.appNames = c.StringSlice(flagAppName)
a.flags.verbose = c.Bool(verboseFlag)
a.flags.dryRun = c.Bool(dryRunFlag)
}
func (a *action) log(format string, v ...interface{}) {

View File

@ -5,52 +5,43 @@ import (
"os"
"runtime"
"github.com/urfave/cli/v2"
"github.com/make-go-great/color-go"
"github.com/urfave/cli/v2"
)
const (
name = "dotfiles"
usage = "managing dotfiles"
appName = "dotfiles"
appUsage = "managing dotfiles"
commandInstallName = "install"
commandInstallUsage = "install user configs from dotfiles"
// flags
verboseFlag = "verbose"
dryRunFlag = "dry-run"
commandUpdateName = "update"
commandUpdateUsage = "update dotfiles from user configs"
// commands
installCommand = "install"
updateCommand = "update"
cleanCommand = "clean"
compareCommand = "compare"
commandDownloadName = "download"
commandDownloadUsage = "download configs from internet (theme for example)"
// flag usages
verboseUsage = "show what is going on"
dryRunUsage = "demo mode without actually changing anything"
commandCleanName = "clean"
commandCleanUsage = "clean unused dotfiles"
commandDiffName = "diff"
commandDiffUsage = "diff dotfiles with user configs"
commandValidateName = "validate"
commonValidateUsage = "validate config"
flagVerboseName = "verbose"
flagVerboseUsage = "show what is going on"
flagDryRunName = "dry-run"
flagDryRunUsage = "demo mode without actually changing anything"
flagAppName = "app"
flagAppUsage = "specific app to operate"
// command usages
installUsage = "install user configs from dotfiles"
updateUsage = "update dotfiles from user configs"
cleanUsage = "clean unused dotfiles"
compareUsage = "compare dotfiles with user configs"
currentDir = "."
)
var (
installAliases = []string{"ins"}
updateAliases = []string{"upd"}
downloadAliases = []string{"dl"}
cleanAliases = []string{"cl"}
diffAliases = []string{"df"}
validateAliases = []string{"vl"}
// command aliases
installAliases = []string{"i"}
updateAliases = []string{"u"}
cleanAliases = []string{"c"}
compareAliases = []string{"cmp"}
)
// denyOSes contains OS which is not supported
@ -67,116 +58,68 @@ func NewApp() *App {
a := &action{}
cliApp := &cli.App{
Name: name,
Usage: usage,
Name: appName,
Usage: appUsage,
Commands: []*cli.Command{
{
Name: commandInstallName,
Name: installCommand,
Aliases: installAliases,
Usage: commandInstallUsage,
Usage: installUsage,
Flags: []cli.Flag{
&cli.BoolFlag{
Name: flagVerboseName,
Usage: flagVerboseUsage,
Name: verboseFlag,
Usage: verboseUsage,
},
&cli.BoolFlag{
Name: flagDryRunName,
Usage: flagDryRunUsage,
},
&cli.StringSliceFlag{
Name: flagAppName,
Usage: flagAppUsage,
Name: dryRunFlag,
Usage: dryRunUsage,
},
},
Action: a.runInstall,
},
{
Name: commandUpdateName,
Name: updateCommand,
Aliases: updateAliases,
Usage: commandUpdateUsage,
Usage: updateUsage,
Flags: []cli.Flag{
&cli.BoolFlag{
Name: flagVerboseName,
Usage: flagVerboseUsage,
Name: verboseFlag,
Usage: verboseUsage,
},
&cli.BoolFlag{
Name: flagDryRunName,
Usage: flagDryRunUsage,
},
&cli.StringSliceFlag{
Name: flagAppName,
Usage: flagAppUsage,
Name: dryRunFlag,
Usage: dryRunUsage,
},
},
Action: a.runUpdate,
},
{
Name: commandDownloadName,
Aliases: downloadAliases,
Usage: commandDownloadUsage,
Flags: []cli.Flag{
&cli.BoolFlag{
Name: flagVerboseName,
Usage: flagVerboseUsage,
},
&cli.BoolFlag{
Name: flagDryRunName,
Usage: flagDryRunUsage,
},
&cli.StringSliceFlag{
Name: flagAppName,
Usage: flagAppUsage,
},
},
Action: a.runDownload,
},
{
Name: commandCleanName,
Name: cleanCommand,
Aliases: cleanAliases,
Usage: commandCleanUsage,
Usage: cleanUsage,
Flags: []cli.Flag{
&cli.BoolFlag{
Name: flagVerboseName,
Usage: flagVerboseUsage,
Name: verboseFlag,
Usage: verboseUsage,
},
&cli.BoolFlag{
Name: flagDryRunName,
Usage: flagDryRunUsage,
Name: dryRunFlag,
Usage: dryRunUsage,
},
},
Action: a.runClean,
},
{
Name: commandDiffName,
Aliases: diffAliases,
Usage: commandDiffUsage,
Name: compareCommand,
Aliases: compareAliases,
Usage: compareUsage,
Flags: []cli.Flag{
&cli.BoolFlag{
Name: flagVerboseName,
Usage: flagVerboseUsage,
},
&cli.StringSliceFlag{
Name: flagAppName,
Usage: flagAppUsage,
Name: verboseFlag,
Usage: verboseUsage,
},
},
Action: a.runDiff,
},
{
Name: commandValidateName,
Aliases: validateAliases,
Usage: commonValidateUsage,
Flags: []cli.Flag{
&cli.BoolFlag{
Name: flagVerboseName,
Usage: flagVerboseUsage,
},
&cli.StringSliceFlag{
Name: flagAppName,
Usage: flagAppUsage,
},
},
Action: a.runValidate,
Action: a.runCompare,
},
},
Action: a.runHelp,
@ -190,11 +133,11 @@ func NewApp() *App {
func (a *App) Run() {
// Prevent running at runtime
if _, ok := denyOSes[runtime.GOOS]; ok {
color.PrintAppError(name, fmt.Sprintf("OS [%s] is not supported right now", runtime.GOOS))
color.PrintAppError(appName, fmt.Sprintf("OS %s is not supported right now", runtime.GOOS))
return
}
if err := a.cliApp.Run(os.Args); err != nil {
color.PrintAppError(name, err.Error())
color.PrintAppError(appName, err.Error())
}
}

View File

@ -1,363 +1,58 @@
package config
import (
"errors"
"encoding/json"
"fmt"
"io"
"net/http"
"os"
"path/filepath"
"sort"
"github.com/BurntSushi/toml"
"github.com/bytedance/sonic"
"golang.org/x/sync/errgroup"
"github.com/make-go-great/copy-go"
"github.com/make-go-great/diff-go"
)
const (
configDirPath = "data"
configFileJSON = "data.json"
configFileTOML = "data.toml"
)
var (
ErrConfigNotFound = errors.New("config not found")
ErrConfigInvalid = errors.New("config invalid")
configDirPath = "data"
configFile = "data.json"
)
type Config interface {
Install(appNames ...string) error
Update(appNames ...string) error
Install() error
Update() error
Clean() error
Diff(appNames ...string) error
Download(appNames ...string) error
Validate(appNames ...string) error
List() []string
Compare() error
}
type cfg struct {
cfgApps ConfigApps
isDryRun bool
type configApps struct {
Apps map[string]App `json:"apps"`
}
// Read from file
type App struct {
Paths []Path `json:"paths"`
}
type Path struct {
Internal string `json:"internal"`
External string `json:"external"`
}
// LoadConfig return config, configDemo
func LoadConfig(path string, isDryRun bool) (Config, error) {
configPathJSON := filepath.Clean(filepath.Join(path, configDirPath, configFileJSON))
bytes, err := os.ReadFile(configPathJSON)
if err == nil {
return loadConfig(bytes, isDryRun, sonic.Unmarshal)
}
configPathTOML := filepath.Clean(filepath.Join(path, configDirPath, configFileTOML))
bytes, err = os.ReadFile(configPathTOML)
if err == nil {
return loadConfig(bytes, isDryRun, toml.Unmarshal)
}
return nil, ErrConfigNotFound
}
func loadConfig(bytes []byte, isDryRun bool, unmarshalFn func(data []byte, v any) error) (Config, error) {
var cfgApps ConfigApps
if err := unmarshalFn(bytes, &cfgApps); err != nil {
return nil, fmt.Errorf("failed to unmarshal: %w", err)
}
// Sort version
apps2 := make([]string, 0, len(cfgApps.Apps))
for appName := range cfgApps.Apps {
apps2 = append(apps2, appName)
}
sort.Strings(apps2)
cfgApps.Apps2 = apps2
return &cfg{
cfgApps: cfgApps,
isDryRun: isDryRun,
}, nil
}
// Install internal -> external
func (c *cfg) Install(appNames ...string) error {
var eg errgroup.Group
mAppNames := slice2map(appNames)
for appName, app := range c.cfgApps.Apps {
if len(appNames) > 0 {
if _, ok := mAppNames[appName]; !ok {
continue
}
}
for _, p := range app.Paths {
if p.External == "" {
continue
}
p := Path{
Internal: p.Internal,
External: p.External,
URL: p.URL,
}
eg.Go(func() error {
if c.isDryRun {
fmt.Printf("Replace [%s] -> [%s]\n", p.Internal, p.External)
return nil
}
if err := copy.Replace(p.Internal, p.External); err != nil {
return fmt.Errorf("copy: failed to replace [%s] -> [%s]: %w", p.Internal, p.External, err)
}
return nil
})
}
}
if err := eg.Wait(); err != nil {
return err
}
return nil
}
// Update external -> internal
func (c *cfg) Update(appNames ...string) error {
var eg errgroup.Group
mAppNames := slice2map(appNames)
for appName, app := range c.cfgApps.Apps {
if len(appNames) > 0 {
if _, ok := mAppNames[appName]; !ok {
continue
}
}
for _, p := range app.Paths {
if p.External == "" {
continue
}
p := Path{
Internal: p.Internal,
External: p.External,
URL: p.URL,
}
eg.Go(func() error {
if c.isDryRun {
fmt.Printf("Replace [%s] -> [%s]\n", p.External, p.Internal)
return nil
}
if err := copy.Replace(p.External, p.Internal); err != nil {
return fmt.Errorf("copy: failed to replace [%s] -> [%s]: %w", p.External, p.Internal, err)
}
return nil
})
}
}
if err := eg.Wait(); err != nil {
return err
}
return nil
}
func (c *cfg) Download(appNames ...string) error {
var eg errgroup.Group
mAppNames := slice2map(appNames)
for appName, app := range c.cfgApps.Apps {
if len(appNames) > 0 {
if _, ok := mAppNames[appName]; !ok {
continue
}
}
for _, p := range app.Paths {
if p.URL == "" {
continue
}
p := Path{
Internal: p.Internal,
External: p.External,
URL: p.URL,
}
httpClient := &http.Client{}
eg.Go(func() error {
if c.isDryRun {
fmt.Printf("Download [%s] -> [%s]\n", p.URL, p.Internal)
return nil
}
// nolint:noctx,gosec
httpRsp, err := httpClient.Get(p.URL)
if err != nil {
return fmt.Errorf("http client: failed to get: %w", err)
}
data, err := io.ReadAll(httpRsp.Body)
if err != nil {
return fmt.Errorf("io: failed to read all: %w", err)
}
// Copy from github.com/make-go-great/copy-go
// Make sure nested dir is exist before copying file
dstDir := filepath.Dir(p.Internal)
if err := os.MkdirAll(dstDir, 0o750); err != nil {
return fmt.Errorf("os: failed to mkdir all [%s]: %w", dstDir, err)
}
if err := os.WriteFile(p.Internal, data, 0o600); err != nil {
return fmt.Errorf("os: failed to write file: %w", err)
}
if err := httpRsp.Body.Close(); err != nil {
return fmt.Errorf("http client: failed to close body: %w", err)
}
return nil
})
}
}
if err := eg.Wait(); err != nil {
return err
}
return nil
}
// Clean remove unused config inside config dir
func (c *cfg) Clean() error {
unusedDirs, err := getUnusedDirs(c.cfgApps.Apps)
func LoadConfig(path string) (*configReal, *configDemo, error) {
configPath := filepath.Join(path, configDirPath, configFile)
bytes, err := os.ReadFile(configPath)
if err != nil {
return err
return nil, nil, fmt.Errorf("failed to read file%s: %w", configPath, err)
}
// Delete unused dirs to save some space
for dir := range unusedDirs {
if c.isDryRun {
fmt.Printf("Remove [%s]\n", dir)
continue
}
dirPath := filepath.Join(configDirPath, dir)
if err := os.RemoveAll(dirPath); err != nil {
return fmt.Errorf("os: failed to remove all [%s]: %w", dir, err)
}
var cfgApps configApps
if err = json.Unmarshal(bytes, &cfgApps); err != nil {
return nil, nil, fmt.Errorf("failed to unmarshal: %w", err)
}
return nil
}
func getUnusedDirs(apps map[string]App) (map[string]struct{}, error) {
files, err := os.ReadDir(configDirPath)
if err != nil {
return nil, fmt.Errorf("os: failed to read dir [%s]: %w", configDirPath, err)
}
// Get all dirs inside config dir
unusedDirs := make(map[string]struct{})
for _, file := range files {
// Ignore config file
if file.Name() == configFileJSON ||
file.Name() == configFileTOML {
continue
}
unusedDirs[file.Name()] = struct{}{}
}
// Removed used dirs
for name := range apps {
delete(unusedDirs, name)
}
return unusedDirs, nil
}
func (c *cfg) Diff(appNames ...string) error {
mAppNames := slice2map(appNames)
for appName, app := range c.cfgApps.Apps {
if len(appNames) > 0 {
if _, ok := mAppNames[appName]; !ok {
continue
}
}
for _, p := range app.Paths {
if p.External == "" {
continue
}
if err := diff.Diff(p.Internal, p.External); err != nil {
return fmt.Errorf("diff: failed to compare [%s] with [%s]: %w", p.Internal, p.External, err)
}
}
}
return nil
}
func (c *cfg) Validate(appNames ...string) error {
var eg errgroup.Group
mAppNames := slice2map(appNames)
for appName, app := range c.cfgApps.Apps {
if len(appNames) > 0 {
if _, ok := mAppNames[appName]; !ok {
continue
}
}
for _, p := range app.Paths {
app := app
p := Path{
Internal: p.Internal,
External: p.External,
URL: p.URL,
}
eg.Go(func() error {
if p.Internal == "" {
return fmt.Errorf("empty internal app [%s]: %w", app, ErrConfigInvalid)
}
if p.External == "" && p.URL == "" {
return fmt.Errorf("empty external and url app [%s]: %w", app, ErrConfigInvalid)
}
return nil
})
}
}
if err := eg.Wait(); err != nil {
return err
}
return nil
}
func (c *cfg) List() []string {
return c.cfgApps.Apps2
cfgReal := configReal{
configApps: cfgApps,
}
cfgDemo := configDemo{
configApps: cfgApps,
}
return &cfgReal, &cfgDemo, nil
}

View File

@ -0,0 +1,46 @@
package config
import "fmt"
type configDemo struct {
configApps
}
var _ Config = (*configDemo)(nil)
func (c *configDemo) Install() error {
for _, app := range c.Apps {
for _, p := range app.Paths {
fmt.Printf("Replace %s -> %s\n", p.Internal, p.External)
}
}
return nil
}
func (c *configDemo) Update() error {
for _, app := range c.Apps {
for _, p := range app.Paths {
fmt.Printf("Replace %s -> %s\n", p.External, p.Internal)
}
}
return nil
}
func (c *configDemo) Clean() error {
unusedDirs, err := getUnusedDirs(c.Apps)
if err != nil {
return err
}
for dir := range unusedDirs {
fmt.Printf("Remove %s\n", dir)
}
return nil
}
func (c *configDemo) Compare() error {
return nil
}

View File

@ -0,0 +1,96 @@
package config
import (
"fmt"
"os"
"path/filepath"
"github.com/make-go-great/copy-go"
)
type configReal struct {
configApps
}
var _ Config = (*configReal)(nil)
// Install internal -> external
func (c *configReal) Install() error {
for _, app := range c.Apps {
for _, p := range app.Paths {
if err := copy.Replace(p.Internal, p.External); err != nil {
return fmt.Errorf("failed to replace %s -> %s: %w", p.Internal, p.External, err)
}
}
}
return nil
}
// Update external -> internal
func (c *configReal) Update() error {
for _, app := range c.Apps {
for _, p := range app.Paths {
if err := copy.Replace(p.External, p.Internal); err != nil {
return fmt.Errorf("failed to replace %s -> %s: %w", p.External, p.Internal, err)
}
}
}
return nil
}
// Clean remove unused config inside config dir
func (c *configReal) Clean() error {
unusedDirs, err := getUnusedDirs(c.Apps)
if err != nil {
return err
}
// Delete ununsed dirs to save some space
for dir := range unusedDirs {
dirPath := filepath.Join(configDirPath, dir)
if err := os.RemoveAll(dirPath); err != nil {
return fmt.Errorf("failed to remove %s: %w", dir, err)
}
}
return nil
}
func (c *configReal) Compare() error {
for _, app := range c.Apps {
for _, p := range app.Paths {
if err := copy.Compare(p.Internal, p.External); err != nil {
return fmt.Errorf("failed to compare %s with %s: %w", p.Internal, p.External, err)
}
}
}
return nil
}
func getUnusedDirs(apps map[string]App) (map[string]struct{}, error) {
files, err := os.ReadDir(configDirPath)
if err != nil {
return nil, fmt.Errorf("failed to read dir %s: %w", configDirPath, err)
}
// Get all dirs inside config dir
unusedDirs := make(map[string]struct{})
for _, file := range files {
// Ignore config file
if file.Name() == configFile {
continue
}
unusedDirs[file.Name()] = struct{}{}
}
// Removed used dirs
for name := range apps {
delete(unusedDirs, name)
}
return unusedDirs, nil
}

View File

@ -1,27 +0,0 @@
package config
type ConfigApps struct {
Apps map[string]App `json:"apps" toml:"apps"`
// Sort version
Apps2 []string `json:"-" toml:"-"`
}
// Read from file
type App struct {
Paths []Path `json:"paths" toml:"paths"`
}
type Path struct {
Internal string `json:"internal" toml:"internal"`
External string `json:"external,omitempty" toml:"external"`
URL string `json:"url,omitempty" toml:"url"`
}
// Helper
func slice2map(vs []string) map[string]struct{} {
m := make(map[string]struct{}, len(vs))
for _, v := range vs {
m[v] = struct{}{}
}
return m
}

View File

@ -1,51 +0,0 @@
all: tidy format test-color lint build clean
tidy:
go mod tidy
test:
go test -race -failfast ./...
test-color:
# go install github.com/haunt98/go-test-color@latest
go-test-color -race -failfast ./...
coverage:
go test -coverprofile=coverage.out ./...
coverage-cli: coverage
go tool cover -func=coverage.out
coverage-html: coverage
go tool cover -html=coverage.out
lint:
golangci-lint run ./...
format:
# go install github.com/haunt98/gofimports/cmd/gofimports@latest
# go install mvdan.cc/gofumpt@latest
# go install mvdan.cc/sh/v3/cmd/shfmt@latest
gofimports -w --company github.com/make-go-great,github.com/haunt98 .
gofumpt -w -extra .
shfmt -w -s -i 4 ./scripts \
./data/zsh/top-zshrc \
./data/zsh/bottom-zshrc
build:
go build ./cmd/dot
clean:
rm -rf dot
dot-upd:
go run ./cmd/dot upd
dot-ins:
go run ./cmd/dot ins
dot-dl:
go run ./cmd/dot dl
dot-df:
go run ./cmd/dot df

View File

@ -1,15 +0,0 @@
#!/usr/bin/env bash
brew install \
libgit2 pcre2 xz telnet \
starship zsh-autosuggestions \
git neovim \
bat-extras \
rsync rclone restic fclones f2 wcurl ncdu \
tlrc vivid zellij totp-cli \
yt-dlp newsboat vips btop \
fnm oven-sh/bun/bun deno uv \
just typst asciidoctor clang-format stylua sqlfluff taplo typos-cli typstyle marksman tinymist \
yq gojq fx ollama gitleaks gh glab k1LoW/tap/tbls ghz k6 \
qmk/qmk/qmk daktilo asciinema qpdf \
redis mysql-client

View File

@ -1,7 +0,0 @@
#!/usr/bin/env bash
brew update
brew upgrade
brew autoremove
brew cleanup
brew doctor

View File

@ -1,3 +0,0 @@
#!/usr/bin/env bash
bun install --global --production prettier

View File

@ -1,3 +0,0 @@
#!/usr/bin/env bash
bun update --global --latest prettier

View File

@ -1,11 +0,0 @@
#!/usr/bin/env bash
rustup update
cargo install \
fd-find bat git-delta eza sd \
difftastic zoxide
cargo install --git https://github.com/BurntSushi/ripgrep ripgrep --features 'pcre2'
bat cache --build

View File

@ -1,9 +0,0 @@
# Need to run this once in a while
# go clean -cache -testcache -modcache -fuzzcache -x
# sudo cargo +nightly clean gc -Z gc --max-download-age=1hour
# uv cache clean
# bun pm cache rm --global
# docker system prune --all --force --volumes
# rm -rf ~/.ollama/models/blobs/sha256-*
# sudo truncate -s 0 /private/var/log/ovpnagent.log
# rm -rf ~/pprof

View File

@ -1,74 +1,20 @@
#!/usr/bin/env bash
# Clean state
truncate -s 0 ~/.gitconfig
# Global aliases
git config --global alias.ass add
# Aliases
git config --global alias.br branch
git config --global alias.brv "branch -v --sort=-committerdate"
git config --global alias.ci commit
git config --global alias.cl clone
git config --global alias.co checkout
git config --global alias.df "diff -w"
git config --global alias.dfc "diff -w --cached"
git config --global alias.df diff
git config --global alias.fe "fetch --all --tags"
git config --global alias.lg "log --stat --abbrev-commit"
git config --global alias.lg1 "log --graph --abbrev-commit --pretty=format:'%Cred%h%Creset %C(yellow)%d%Creset %Cblue%an%Creset %s %Cgreen(%cr)%Creset'"
git config --global alias.me merge
git config --global alias.lg "log --stat"
git config --global alias.pl "pull --tags"
git config --global alias.ps push
git config --global alias.psa "!git remote | xargs -L1 -P8 git push"
git config --global alias.psaf "!git remote | xargs -L1 -P8 git push --force-with-lease"
git config --global alias.psf "push --force-with-lease"
git config --global alias.rank "shortlog -nse --no-merges"
git config --global alias.rst restore
git config --global alias.sh show
git config --global alias.st status
git config --global alias.stcl "stash clear"
git config --global alias.sth stash
git config --global alias.stp "stash pop"
git config --global alias.sw switch
git config --global alias.tg "tag --sort=-version:refname"
# Misc
git config --global commit.verbose true
git config --global core.excludesfile "~/.config/git/ignore"
git config --global core.fsmonitor true
git config --global diff.algorithm histogram
git config --global diff.colorMoved no
git config --global diff.submodule log
git config --global pull.rebase true
git config --global fetch.prune true
git config --global http.postBuffer 500000000
git config --global init.defaultBranch main
git config --global log.date iso
git config --global merge.conflictstyle zdiff3
git config --global pull.rebase false
git config --global pull.twohead ort
git config --global push.autoSetupRemote true
git config --global rebase.stat true
git config --global rerere.enabled true
git config --global status.submoduleSummary true
git config --global submodule.recurse true
# https://github.com/dandavison/delta
git config --global core.pager delta
git config --global delta.file-decoration-style none
git config --global delta.hunk-header-decoration-style none
git config --global delta.commit-decoration-style none
git config --global delta.navigate true
# https://github.com/catppuccin/delta
git config --global --add include.path "~/.config/delta/themes/catppuccin.gitconfig"
git config --global delta.features catppuccin-mocha
git config --global delta.catppuccin-mocha.file-decoration-style none
git config --global delta.catppuccin-mocha.hunk-header-decoration-style none
git config --global delta.catppuccin-mocha.commit-decoration-style none
# https://github.com/Wilfred/difftastic
git config --global alias.dftc "difftool --cached"
git config --global alias.dft "difftool"
git config --global diff.tool difftastic
git config --global difftool.difftastic.cmd 'difft "$LOCAL" "$REMOTE"'
git config --global difftool.prompt false
git config --global pager.difftool true

View File

@ -1,23 +0,0 @@
#!/usr/bin/env bash
go install mvdan.cc/sh/v3/cmd/shfmt@latest
go install golang.org/x/tools/gopls@latest
go install golang.org/x/tools/cmd/goimports@latest
go install github.com/walles/moar@latest
go install golang.org/x/telemetry/cmd/gotelemetry@latest
gotelemetry on
go install mvdan.cc/gofumpt@latest
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
go install golang.org/x/vuln/cmd/govulncheck@latest
go install github.com/securego/gosec/v2/cmd/gosec@latest
go install golang.org/x/tools/go/analysis/passes/fieldalignment/cmd/fieldalignment@latest
go install github.com/dkorunic/betteralign/cmd/betteralign@latest
go install github.com/maruel/panicparse/v2@latest
go install gotest.tools/gotestsum@latest
go install github.com/bufbuild/buf/cmd/buf@latest
go install github.com/google/pprof@latest
go install github.com/sudorandom/fauxrpc/cmd/fauxrpc@latest

View File

@ -1,5 +0,0 @@
#!/usr/bin/env bash
git -C ~/.zsh-plugins/fzf-tab pull origin master
fnm install --lts

View File

@ -1,7 +0,0 @@
#!/usr/bin/env bash
uv tool update-shell
uv tool install ruff
uv tool install pyright
uv tool install keymap-drawer

View File

@ -1,3 +0,0 @@
#!/usr/bin/env bash
uv tool upgrade --all