1
0

Compare commits

...

42 Commits

Author SHA1 Message Date
f100cffb79 chore: sync work config 2025-11-03 20:42:28 +01:00
eaea388f20 add go support 2025-07-15 17:15:49 +02:00
ff9efcca0d add-latest-changes 2025-07-14 09:27:56 +02:00
88b5c27c67 remove legacy 2025-07-13 12:39:58 +02:00
34b1fce40a update submodules 2025-07-12 21:05:23 +02:00
5f0e53aee1 adjust README 2025-07-12 20:55:22 +02:00
dce5c22157 import changes from workstation 2025-07-12 18:51:44 +02:00
6e48cdf319 fix new pane shortcut 2025-04-30 17:53:21 +02:00
8f2d9fb72b fix new window keybind 2025-04-25 17:43:49 +02:00
7ee84040fa update dotfiles 2025-04-25 17:20:28 +02:00
d372b7c89b fix alias and copy-mode 2025-04-03 19:20:29 +02:00
3993cd733e add terraform snippets 2025-04-02 20:42:40 +02:00
7d3ef607c2 add snippets for common languages 2025-04-02 20:01:11 +02:00
d4e4eaefa3 fix script and update tmux config 2025-04-02 19:28:34 +02:00
8ac127dd4d optimize zsh prompt 2025-04-01 21:28:27 +02:00
77e38d6fb1 add wallpapers 2025-04-01 20:44:54 +02:00
ef5a97eb61 Improve README 2025-04-01 20:22:37 +02:00
b0cbc93c8a switch to rose pine to cover both light and dark themes 2025-04-01 18:41:25 +02:00
2c50bc303b add tmux-continuum config 2025-03-31 20:37:32 +02:00
fd9bc93cd2 add COPYFILE_DISABLE option 2025-03-31 20:26:27 +02:00
35a41eee57 remove redundant files 2025-03-31 20:23:46 +02:00
7c500df9f3 more refinement 2025-03-31 20:18:34 +02:00
cfb96ceb85 prepare for custom snippets 2025-03-30 13:38:38 +02:00
d96bee448e add base snippets config 2025-03-30 10:50:36 +02:00
81c3491c57 adjust completion in zsh 2025-03-30 10:37:32 +02:00
e5bfcdac99 remove broken module 2025-03-29 22:29:07 +01:00
a35a4793e3 minor commit 2025-03-29 22:27:32 +01:00
7d43d9abd3 improve workflow with shell 2025-03-29 22:03:15 +01:00
38f64e9fab remove dead code 2025-03-29 21:39:09 +01:00
ba2b1aa855 generalize iac aliases 2025-03-29 21:05:05 +01:00
bffcdd8460 improve nvim folding and update alacritty config 2025-03-29 19:39:46 +01:00
407f9c2c96 update nvim config for 0.11 2025-03-29 13:54:48 +01:00
d0660edf21 add native completion 2025-03-26 20:17:54 +01:00
73d2dc6774 add gotmpl settings 2025-03-14 22:27:46 +01:00
df72baf7b8 remove animation 2025-02-20 18:35:09 +01:00
4b33fbac0b add some stuff 2025-02-18 20:50:08 +01:00
e7fcc5a5e3 remove bloat 2025-02-16 14:11:58 +01:00
3ff5bf0258 add cbonsai to readme 2025-02-15 12:40:20 +01:00
b98eaae996 fixes and tmux config structure 2025-02-15 11:31:51 +01:00
c9e2eeed50 add dashboard and goodies 2025-02-14 17:04:16 +01:00
51c4fb6166 improvements and font change 2025-02-14 03:50:37 +01:00
5adbb64c2b add alacritty config 2025-02-14 02:14:03 +01:00
54 changed files with 3135 additions and 553 deletions

3
.gitignore vendored
View File

@@ -1 +1,4 @@
lazy-lock.json
.gitconfig.local
k9s/.config/k9s/clusters

6
.gitmodules vendored
View File

@@ -1,3 +1,9 @@
[submodule "zsh/zsh-completions"]
path = zsh/zsh-completions
url = https://github.com/zsh-users/zsh-completions.git
[submodule "scripts/pokemon-colorscripts"]
path = scripts/pokemon-colorscripts
url = https://gitlab.com/phoneybadger/pokemon-colorscripts.git
[submodule "zsh/zsh-autosuggestions"]
path = zsh/zsh-autosuggestions
url = https://github.com/zsh-users/zsh-autosuggestions

189
README.md
View File

@@ -1,21 +1,174 @@
# DOTFILES
# Dotfiles
A cross-platform dotfiles repository managed with GNU Stow, compatible with both
Debian Trixie and macOS. This repository contains configuration files for
various development tools and applications to create a consistent environment
across different systems.
## Overview
This dotfiles repository uses [GNU Stow](https://www.gnu.org/software/stow/) to
manage symlinks.
## Directory Structure
```
dotfiles/
├── alacritty/ # Alacritty terminal emulator config
├── curl/ # curl configuration
├── git/ # Git configuration
├── nvim/ # Neovim configuration
├── scripts/ # Utility scripts
├── tmux/ # tmux configuration
└── zsh/ # ZSH shell configuration
```
## Dependencies
- zsh
- homebrew/linuxbrew
- stow
- rust toolchain
- starship
- tmux
- tmux-plugin-manager
- neovim
- stylua
- luacheck
- prettier
- rust-analyzer
- shfmt
- bash-language-server
- terraform
- tflint
- ruff
### Fonts
- [Jetbrains Mono Nerd Font](https://www.nerdfonts.com/font-downloads)
### Core Tools
- **Terminal**: [Alacritty](https://github.com/alacritty/alacritty)
- **Shell**: [ZSH](https://www.zsh.org/)
- [zsh-syntax-highlighting](https://github.com/zsh-users/zsh-syntax-highlighting)
- [zsh-autosuggestions](https://github.com/zsh-users/zsh-autosuggestions)
(submodule)
- [zsh-completions](https://github.com/zsh-users/zsh-completions)
(submodule)
- **Package Manager**: [Homebrew/Linuxbrew](https://brew.sh/)
- **Dotfile Management**: [GNU Stow](https://www.gnu.org/software/stow/)
### Development Tools
- [Rust](https://www.rust-lang.org/) toolchain (including rust-analyzer)
- [Go](https://go.dev/)
- [Neovim](https://neovim.io/)
- [tmux](https://github.com/tmux/tmux) +
[tmux-plugin-manager](https://github.com/tmux-plugins/tpm)
- [Terraform](https://www.terraform.io/)
- python3-libtmux
- Installed via `apt` in Debian. Remember to run `brew unlink python3` to
prevent conflicting Python environments.
- reattach-to-user-namespace (macOS only)
### Language Servers & Linters
- Lua: lua-language-server, stylua, luacheck
- JavaScript/TypeScript: prettier, prettier-plugin-go-template
- Shell: shfmt, shellcheck, bash-language-server
- Terraform: terraform-ls, tflint
- Python: ruff
- Go: gopls, golangci-lint (v1.64), gofumpt
### Extras
- lesspipe
- cbonsai
## Installation
### Prerequisites
1. **Install Rust**
```bash
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
rustup component add rust-analyzer
```
2. **Install Homebrew**
```bash
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
```
3. **Install tmux-plugin-manager**
```bash
mkdir -p ~/.tmux/plugins
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
```
### Platform-Specific Setup
#### Debian Trixie
1. **Install Terraform**
```bash
wget -O - https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com bookworm main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
sudo apt update && sudo apt install terraform
```
2. **Install Dependencies**
```bash
# System packages
sudo apt install alacritty zsh tmux stow zsh-syntax-highlighting less python3-libtmux cbonsai shfmt shellcheck lua-check
# Homebrew packages
brew install neovim stylua lua-language-server bash-language-server prettier terraform-ls tflint ruff
# Node packages
npm install --save-dev prettier prettier-plugin-go-template
# Prevent Python conflicts
brew unlink python3
```
#### macOS
```bash
# Core tools
brew install curl git alacritty zsh tmux stow zsh-syntax-highlighting lesspipe cbonsai reattach-to-user-namespace
# Development tools
brew install neovim stylua lua-language-server bash-language-server prettier terraform-ls tflint ruff
# Node packages
npm install --save-dev prettier prettier-plugin-go-template
```
### Setup
1. **Clone this repository**:
```bash
git clone --recurse-submodules https://github.com/yourusername/dotfiles.git ~/dotfiles
cd ~/dotfiles
```
2. **Deploy configurations using Stow**:
```bash
stow zsh tmux git nvim curl alacritty wallpaper
```
3. Change the default shell
```bash
chsh -s /bin/zsh
```
4. **Set up tmux plugins**:
- Start a tmux session
- Press `C-b I` to install plugins
5. **Git configuration**:
- Create a `~/.gitconfig.local` file with personal config
- See `~/.gitconfig.local.example` for reference
## Updating
To update the dotfiles repository and all submodules:
```bash
cd ~/dotfiles
git pull
git submodule update --init --recursive
```

View File

@@ -0,0 +1,21 @@
[font]
size = 13.0
[font.bold]
family = "jetbrainsmono nerd font"
style = "Bold"
[font.bold_italic]
family = "jetbrainsmono nerd font"
style = "Bold Italic"
[font.italic]
family = "jetbrainsmono nerd font"
style = "Italic"
[font.normal]
family = "jetbrainsmono nerd font"
style = "Regular"
[general]
import = ["~/.config/alacritty/colors/rose-pine.toml"]

View File

@@ -0,0 +1,76 @@
# Dracula theme for Alacritty
# https://draculatheme.com/alacritty
#
# Color palette
# https://spec.draculatheme.com
#
# Instructions
# https://github.com/alacritty/alacritty/blob/master/extra/man/alacritty.5.scd
[colors.primary]
background = "#282a36"
foreground = "#f8f8f2"
bright_foreground = "#ffffff"
[colors.cursor]
text = "#282a36"
cursor = "#f8f8f2"
[colors.vi_mode_cursor]
text = "CellBackground"
cursor = "CellForeground"
[colors.selection]
text = "CellForeground"
background = "#44475a"
[colors.normal]
black = "#21222c"
red = "#ff5555"
green = "#50fa7b"
yellow = "#f1fa8c"
blue = "#bd93f9"
magenta = "#ff79c6"
cyan = "#8be9fd"
white = "#f8f8f2"
[colors.bright]
black = "#6272a4"
red = "#ff6e6e"
green = "#69ff94"
yellow = "#ffffa5"
blue = "#d6acff"
magenta = "#ff92df"
cyan = "#a4ffff"
white = "#ffffff"
[colors.search.matches]
foreground = "#44475a"
background = "#50fa7b"
[colors.search.focused_match]
foreground = "#44475a"
background = "#ffb86c"
[colors.footer_bar]
background = "#282a36"
foreground = "#f8f8f2"
[colors.hints.start]
foreground = "#282a36"
background = "#f1fa8c"
[colors.hints.end]
foreground = "#f1fa8c"
background = "#282a36"

View File

@@ -0,0 +1,75 @@
# Colors section of "Alacritty - TOML configuration file format"
# https://github.com/alacritty/alacritty/blob/master/extra/man/alacritty.5.scd#colors
[colors.primary]
foreground = "#575279"
background = "#faf4ed"
dim_foreground = "#797593"
bright_foreground = "#575279"
[colors.cursor]
text = "#575279"
cursor = "#cecacd"
[colors.vi_mode_cursor]
text = "#575279"
cursor = "#cecacd"
[colors.search.matches]
foreground = "#797593"
background = "#f2e9e1"
[colors.search.focused_match]
foreground = "#faf4ed"
background = "#d7827e"
[colors.hints.start]
foreground = "#797593"
background = "#fffaf3"
[colors.hints.end]
foreground = "#9893a5"
background = "#fffaf3"
[colors.line_indicator]
foreground = "None"
background = "None"
[colors.footer_bar]
foreground = "#575279"
background = "#fffaf3"
[colors.selection]
text = "#575279"
background = "#dfdad9"
[colors.normal]
black = "#f2e9e1"
red = "#b4637a"
green = "#286983"
yellow = "#ea9d34"
blue = "#56949f"
magenta = "#907aa9"
cyan = "#d7827e"
white = "#575279"
[colors.bright]
black = "#9893a5"
red = "#b4637a"
green = "#286983"
yellow = "#ea9d34"
blue = "#56949f"
magenta = "#907aa9"
cyan = "#d7827e"
white = "#575279"
[colors.dim]
black = "#9893a5"
red = "#b4637a"
green = "#286983"
yellow = "#ea9d34"
blue = "#56949f"
magenta = "#907aa9"
cyan = "#d7827e"
white = "#575279"

View File

@@ -0,0 +1,75 @@
# Colors section of "Alacritty - TOML configuration file format"
# https://github.com/alacritty/alacritty/blob/master/extra/man/alacritty.5.scd#colors
[colors.primary]
foreground = "#e0def4"
background = "#191724"
dim_foreground = "#908caa"
bright_foreground = "#e0def4"
[colors.cursor]
text = "#e0def4"
cursor = "#524f67"
[colors.vi_mode_cursor]
text = "#e0def4"
cursor = "#524f67"
[colors.search.matches]
foreground = "#908caa"
background = "#26233a"
[colors.search.focused_match]
foreground = "#191724"
background = "#ebbcba"
[colors.hints.start]
foreground = "#908caa"
background = "#1f1d2e"
[colors.hints.end]
foreground = "#6e6a86"
background = "#1f1d2e"
[colors.line_indicator]
foreground = "None"
background = "None"
[colors.footer_bar]
foreground = "#e0def4"
background = "#1f1d2e"
[colors.selection]
text = "#e0def4"
background = "#403d52"
[colors.normal]
black = "#26233a"
red = "#eb6f92"
green = "#31748f"
yellow = "#f6c177"
blue = "#9ccfd8"
magenta = "#c4a7e7"
cyan = "#ebbcba"
white = "#e0def4"
[colors.bright]
black = "#6e6a86"
red = "#eb6f92"
green = "#31748f"
yellow = "#f6c177"
blue = "#9ccfd8"
magenta = "#c4a7e7"
cyan = "#ebbcba"
white = "#e0def4"
[colors.dim]
black = "#6e6a86"
red = "#eb6f92"
green = "#31748f"
yellow = "#f6c177"
blue = "#9ccfd8"
magenta = "#c4a7e7"
cyan = "#ebbcba"
white = "#e0def4"

8
curl/.curl-format.txt Normal file
View File

@@ -0,0 +1,8 @@
time_namelookup: %{time_namelookup}s\n
time_connect: %{time_connect}s\n
time_appconnect: %{time_appconnect}s\n
time_pretransfer: %{time_pretransfer}s\n
time_redirect: %{time_redirect}s\n
time_starttransfer: %{time_starttransfer}s\n
----------\n
time_total: %{time_total}s\n

23
git/.gitconfig Normal file
View File

@@ -0,0 +1,23 @@
[include]
path = ~/.gitconfig.local
[alias]
st = status
logg = log --graph --decorate --oneline --all
cm = commit
df = diff
dfs = diff --staged
[core]
editor = nvim
[pull]
rebase = true
[init]
templateDir = ~/.git-template
[filter "lfs"]
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true
clean = git-lfs clean -- %f

View File

@@ -0,0 +1,5 @@
# This is Git's per-user configuration file.
[user]
# Please adapt and uncomment the following lines:
name = Full Name
email = user.name@email.com

View File

@@ -0,0 +1,9 @@
aliases:
dp: deployments
sec: v1/secrets
jo: jobs
cr: clusterroles
crb: clusterrolebindings
ro: roles
rb: rolebindings
np: networkpolicies

View File

@@ -0,0 +1,42 @@
k9s:
liveViewAutoRefresh: false
screenDumpDir: ~/.config/k9s/screen-dumps
refreshRate: 2
maxConnRetry: 5
readOnly: false
noExitOnCtrlC: false
ui:
enableMouse: false
headless: false
logoless: false
crumbsless: false
reactive: false
noIcons: false
defaultsToFullScreen: false
skin: rose-pine # => All clusters will use this skin unless otherwise specified in the context configuration file
skipLatestRevCheck: false
disablePodCounting: false
shellPod:
image: busybox:1.35.0
namespace: default
limits:
cpu: 100m
memory: 100Mi
imageScans:
enable: false
exclusions:
namespaces: []
labels: {}
logger:
tail: 100
buffer: 5000
sinceSeconds: -1
textWrap: false
showTime: false
thresholds:
cpu:
critical: 90
warn: 70
memory:
critical: 90
warn: 70

View File

@@ -0,0 +1,115 @@
# -----------------------------------------------------------------------------
# Dracula skin
# -----------------------------------------------------------------------------
# Styles...
foreground: &foreground "#f8f8f2"
background: &background "#282a36"
current_line: &current_line "#44475a"
selection: &selection "#44475a"
comment: &comment "#6272a4"
cyan: &cyan "#8be9fd"
green: &green "#50fa7b"
orange: &orange "#ffb86c"
pink: &pink "#ff79c6"
purple: &purple "#bd93f9"
red: &red "#ff5555"
yellow: &yellow "#f1fa8c"
# Skin...
k9s:
# General K9s styles
body:
fgColor: *foreground
bgColor: *background
logoColor: *purple
# Command prompt styles
prompt:
fgColor: *foreground
bgColor: *background
suggestColor: *purple
# ClusterInfoView styles.
info:
fgColor: *pink
sectionColor: *foreground
# Dialog styles.
dialog:
fgColor: *foreground
bgColor: *background
buttonFgColor: *foreground
buttonBgColor: *purple
buttonFocusFgColor: *yellow
buttonFocusBgColor: *pink
labelFgColor: *orange
fieldFgColor: *foreground
frame:
# Borders styles.
border:
fgColor: *selection
focusColor: *current_line
menu:
fgColor: *foreground
keyColor: *pink
# Used for favorite namespaces
numKeyColor: *pink
# CrumbView attributes for history navigation.
crumbs:
fgColor: *foreground
bgColor: *current_line
activeColor: *current_line
# Resource status and update styles
status:
newColor: *cyan
modifyColor: *purple
addColor: *green
errorColor: *red
highlightColor: *orange
killColor: *comment
completedColor: *comment
# Border title styles.
title:
fgColor: *foreground
bgColor: *current_line
highlightColor: *orange
counterColor: *purple
filterColor: *pink
views:
# Charts skins...
charts:
bgColor: default
defaultDialColors:
- *purple
- *red
defaultChartColors:
- *purple
- *red
# TableView attributes.
table:
fgColor: *foreground
bgColor: *background
# Header row styles.
header:
fgColor: *foreground
bgColor: *background
sorterColor: *cyan
# Xray view attributes.
xray:
fgColor: *foreground
bgColor: *background
cursorColor: *current_line
graphicColor: *purple
showIcons: false
# YAML info styles.
yaml:
keyColor: *pink
colonColor: *purple
valueColor: *foreground
# Logs styles.
logs:
fgColor: *foreground
bgColor: *background
indicator:
fgColor: *foreground
bgColor: *purple
toggleOnColor: *green
toggleOffColor: *cyan

View File

@@ -0,0 +1,100 @@
k9s:
body:
fgColor: "#575279"
bgColor: "#faf4ed"
logoColor: "#907aa9"
prompt:
fgColor: "#575279"
bgColor: "#fffaf3"
suggestColor: "#56949f"
help:
fgColor: "#575279"
bgColor: "#faf4ed"
sectionColor: "#286983"
keyColor: "#56949f"
numKeyColor: "#d7827e"
frame:
title:
fgColor: "#286983"
bgColor: "#faf4ed"
highlightColor: "#907aa9"
counterColor: "#ea9d34"
filterColor: "#286983"
border:
fgColor: "#907aa9"
focusColor: "#56949f"
menu:
fgColor: "#575279"
keyColor: "#56949f"
numKeyColor: "#d7827e"
crumbs:
fgColor: "#faf4ed"
bgColor: "#907aa9"
activeColor: "#d7827e"
status:
newColor: "#56949f"
modifyColor: "#56949f"
addColor: "#286983"
pendingColor: "#b4637a"
errorColor: "#b4637a"
highlightColor: "#d7827e"
killColor: "#907aa9"
completedColor: "#797593"
info:
fgColor: "#b4637a"
sectionColor: "#575279"
views:
table:
fgColor: "#575279"
bgColor: "#faf4ed"
cursorFgColor: "#fffaf3"
cursorBgColor: "#faf4ed"
markColor: "#907aa9"
header:
fgColor: "#ea9d34"
bgColor: "#faf4ed"
sorterColor: "#d7827e"
xray:
fgColor: "#575279"
bgColor: "#faf4ed"
cursorColor: "#cecacd"
cursorTextColor: "#faf4ed"
graphicColor: "#907aa9"
charts:
bgColor: "#faf4ed"
chartBgColor: "#faf4ed"
dialBgColor: "#faf4ed"
defaultDialColors:
- "#286983"
- "#b4637a"
defaultChartColors:
- "#286983"
- "#b4637a"
resourceColors:
cpu:
- "#907aa9"
- "#56949f"
mem:
- "#ea9d34"
- "#b4637a"
yaml:
keyColor: "#56949f"
valueColor: "#575279"
colonColor: "#797593"
logs:
fgColor: "#575279"
bgColor: "#faf4ed"
indicator:
fgColor: "#56949f"
bgColor: "#faf4ed"
toggleOnColor: "#286983"
toggleOffColor: "#797593"
dialog:
fgColor: "#ea9d34"
bgColor: "#9893a5"
buttonFgColor: "#faf4ed"
buttonBgColor: "#575279"
buttonFocusFgColor: "#faf4ed"
buttonFocusBgColor: "#907aa9"
labelFgColor: "#d7827e"
fieldFgColor: "#575279"

View File

@@ -0,0 +1,100 @@
k9s:
body:
fgColor: "#e0def4"
bgColor: "#191724"
logoColor: "#c4a7e7"
prompt:
fgColor: "#e0def4"
bgColor: "#1f1d2e"
suggestColor: "#9ccfd8"
help:
fgColor: "#e0def4"
bgColor: "#191724"
sectionColor: "#31748f"
keyColor: "#9ccfd8"
numKeyColor: "#ebbcba"
frame:
title:
fgColor: "#31748f"
bgColor: "#191724"
highlightColor: "#c4a7e7"
counterColor: "#f6c177"
filterColor: "#31748f"
border:
fgColor: "#c4a7e7"
focusColor: "#9ccfd8"
menu:
fgColor: "#e0def4"
keyColor: "#9ccfd8"
numKeyColor: "#ebbcba"
crumbs:
fgColor: "#191724"
bgColor: "#c4a7e7"
activeColor: "#ebbcba"
status:
newColor: "#9ccfd8"
modifyColor: "#9ccfd8"
addColor: "#31748f"
pendingColor: "#eb6f92"
errorColor: "#eb6f92"
highlightColor: "#ebbcba"
killColor: "#c4a7e7"
completedColor: "#908caa"
info:
fgColor: "#eb6f92"
sectionColor: "#e0def4"
views:
table:
fgColor: "#e0def4"
bgColor: "#191724"
cursorFgColor: "#1f1d2e"
cursorBgColor: "#191724"
markColor: "#c4a7e7"
header:
fgColor: "#f6c177"
bgColor: "#191724"
sorterColor: "#ebbcba"
xray:
fgColor: "#e0def4"
bgColor: "#191724"
cursorColor: "#524f67"
cursorTextColor: "#191724"
graphicColor: "#c4a7e7"
charts:
bgColor: "#191724"
chartBgColor: "#191724"
dialBgColor: "#191724"
defaultDialColors:
- "#31748f"
- "#eb6f92"
defaultChartColors:
- "#31748f"
- "#eb6f92"
resourceColors:
cpu:
- "#c4a7e7"
- "#9ccfd8"
mem:
- "#f6c177"
- "#eb6f92"
yaml:
keyColor: "#9ccfd8"
valueColor: "#e0def4"
colonColor: "#908caa"
logs:
fgColor: "#e0def4"
bgColor: "#191724"
indicator:
fgColor: "#9ccfd8"
bgColor: "#191724"
toggleOnColor: "#31748f"
toggleOffColor: "#908caa"
dialog:
fgColor: "#f6c177"
bgColor: "#6e6a86"
buttonFgColor: "#191724"
buttonBgColor: "#e0def4"
buttonFocusFgColor: "#191724"
buttonFocusBgColor: "#c4a7e7"
labelFgColor: "#ebbcba"
fieldFgColor: "#e0def4"

View File

@@ -0,0 +1,15 @@
-- Rerun tests only if their modification time changed.
cache = true
ignore = {
"122", -- Setting a read-only field of a global variable.
"212", -- Unused argument, In the case of callback function, _arg_name is easier to understand than _, so this option is set to off.
}
-- Global objects defined by the C code
read_globals = {
"vim",
"Snacks",
}
files["snippets/*.lua"] = { ignore = { "211", "631" } }

View File

@@ -0,0 +1,21 @@
local bufnr = vim.api.nvim_get_current_buf()
-- vim.keymap.set("n", "<leader>a", function()
-- vim.cmd.RustLsp("codeAction") -- supports rust-analyzer's grouping
-- -- or vim.lsp.buf.codeAction() if you don't want grouping.
-- end, { silent = true, buffer = bufnr })
-- vim.keymap.set(
-- "n",
-- "K", -- Override Neovim's built-in hover keymap with rustaceanvim's hover actions
-- function()
-- vim.cmd.RustLsp({ "hover", "actions" })
-- end,
-- { silent = true, buffer = bufnr }
-- )
-- vim.keymap.set(
-- "n",
-- "<leader>?", -- Override Neovim's built-in hover keymap with rustaceanvim's hover actions
-- function()
-- vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled())
-- end,
-- { buffer = bufnr }
-- )

View File

@@ -0,0 +1,5 @@
return {
cmd = { "bash-language-server" },
filetypes = { "sh", "bash", "zsh" },
settings = {},
}

View File

@@ -0,0 +1,22 @@
return {
cmd = { "gopls" },
root_markers = { "go.mod" },
filetypes = { "go", "golang" },
settings = {
gopls = {
completeUnimported = true,
usePlaceholders = true,
analyses = {
unusedparams = true,
},
["ui.inlayhint.hints"] = {
compositeLiteralFields = true,
constantValues = true,
parameterNames = true,
assignVariableTypes = true,
functionTypeParameters = true,
rangeVariableTypes = true,
},
},
},
}

View File

@@ -0,0 +1,17 @@
return {
cmd = { "lua-language-server" },
root_markers = { ".luarc.json", ".luarc.jsonc" },
filetypes = { "lua" },
settings = {
Lua = {
completion = { callSnippet = "Both" },
hint = { enable = true },
workspace = {
library = {
vim.env.VIMRUNTIME,
},
},
runtime = { version = "LuaJIT" },
},
},
}

View File

@@ -0,0 +1,24 @@
return {
cmd = { "rust-analyzer" },
root_markers = { "Cargo.toml" },
filetypes = { "rust" },
settings = {
["rust-analyzer"] = {
cargo = {
allFeatures = true,
loadOutDirsFromCheck = true,
runBuildScripts = true,
},
-- Add clippy lints for Rust
checkOnSave = true,
procMacro = {
enable = true,
ignored = {
["async-trait"] = { "async_trait" },
["napi-derive"] = { "napi" },
["async-recursion"] = { "async_recursion" },
},
},
},
},
}

View File

@@ -0,0 +1,6 @@
return {
cmd = { "terraform-ls", "serve" },
root_markers = { ".terraform.lock", "backend.tf" },
filetypes = { "terraform", "tf" },
settings = {},
}

View File

@@ -29,7 +29,7 @@ require("lazy").setup({
},
-- Configure any other settings here. See the documentation for more details.
-- colorscheme that will be used when installing plugins.
install = { colorscheme = { "dracula" } },
install = { colorscheme = { "rose-pine" } },
-- automatically check for plugin updates
checker = {
enabled = false,

View File

@@ -1,4 +1,6 @@
require("ink.remap")
require("ink.lsp")
require("ink.tabline")
vim.opt.hlsearch = false -- do not highlight matches
vim.wo.number = true
@@ -13,12 +15,15 @@ vim.w.signcolumn = "yes" -- Keep signcolumn on by default
vim.opt.updatetime = 250 -- Decrease update time
vim.opt.timeoutlen = 300 -- time to wait for a mapped sequence to complete (in milliseconds)
vim.opt.backup = false -- creates a backup file
vim.opt.writebackup = false -- if a file is being edited by another program (or was written to file while editing with another program), it is not allowed to be edited
vim.opt.completeopt = "menuone,noselect" -- Set completeopt to have a better completion experience
-- if a file is being edited by another program (or was written to file while editing with another program), it is not
-- allowed to be edited
vim.opt.writebackup = false
vim.o.completeopt = "menuone,noinsert,popup,fuzzy"
vim.opt.termguicolors = true -- set termguicolors to enable highlight groups
vim.opt.whichwrap = "bs<>[]hl" -- which "horizontal" keys are allowed to travel to prev/next line
vim.opt.wrap = false -- display lines as one long line
vim.opt.linebreak = true -- companion to wrap don't split words
vim.o.wrap = true -- 1. Enable line wrapping by default
vim.o.linebreak = true -- 2. Break lines at word boundaries (improves readability)
vim.o.showbreak = "" -- 3. Add a visual indicator for wrapped lines
vim.opt.scrolloff = 4 -- minimal number of screen lines to keep above and below the cursor
vim.opt.sidescrolloff = 8 -- minimal number of screen columns either side of cursor if wrap is `false`
vim.opt.numberwidth = 2 -- set number column width to 2 {default 4}
@@ -41,15 +46,20 @@ vim.opt.autoindent = true
vim.opt.shortmess:append("c") -- don't give |ins-completion-menu| messages
vim.opt.iskeyword:append("-") -- hyphenated words recognized by searches
vim.opt.formatoptions:remove({ "c", "r", "o" }) -- don't insert the current comment leader automatically for auto-wrapping comments using 'textwidth', hitting <Enter> in insert mode, or hitting 'o' or 'O' in normal mode.
-- don't insert the current comment leader automatically for auto-wrapping comments using 'textwidth', hitting <Enter>
-- in insert mode, or hitting 'o' or 'O' in normal mode.
vim.opt.formatoptions:remove({ "c", "r", "o" })
vim.opt.runtimepath:remove("/usr/share/vim/vimfiles") -- separate vim plugins from neovim in case vim still in use
vim.opt.foldmethod = "expr"
vim.opt.foldexpr = "v:lua.vim.treesitter.foldexpr()"
vim.opt.foldtext = ""
-- Nice and simple folding:
vim.opt.foldenable = true
vim.opt.foldlevel = 99
vim.opt.foldlevelstart = 99
vim.opt.foldnestmax = 6
vim.opt.foldmethod = "expr"
-- Default to treesitter folding
vim.opt.foldexpr = "v:lua.vim.treesitter.foldexpr()"
-- vim.opt.foldtext = "> "
vim.opt.fillchars:append({ fold = ">" })
vim.opt.incsearch = true -- search as characters are entered
-- remove trailing whitespace
@@ -63,6 +73,11 @@ vim.api.nvim_create_autocmd({ "BufWritePre" }, {
vim.fn.setpos(".", save_cursor)
end,
})
--
-- Set a keymap to toggle the 'wrap' option
vim.keymap.set("n", "<leader>w", function()
vim.opt.wrap:toggle()
end, { desc = "Toggle line wrapping" })
-- local uv = vim.uv
local uv = vim.loop
@@ -78,6 +93,17 @@ vim.api.nvim_create_autocmd({ "VimEnter", "VimLeave" }, {
-- Filetypes to enable spellcheck
local spell_types = { "text", "plaintex", "typst", "gitcommit", "markdown" }
-- add gotmpl filetypes for blueprint repos
vim.filetype.add({
extension = {
gotmpl = "gotmpl",
},
pattern = {
[".*/recipes/.*%.ya?ml"] = "gotmpl",
[".*%.sh.tmpl"] = "bash",
},
})
-- Set global spell option to false initially to disable it for all file types
vim.opt.spell = false

View File

@@ -0,0 +1,43 @@
--- [[ LSP setup]]
---
vim.lsp.enable("luals")
vim.lsp.enable("rust")
vim.lsp.enable("gopls")
vim.lsp.enable("bashls")
vim.lsp.enable("terraform")
vim.lsp.config("*", {
capabilities = {
textDocument = {
semanticTokens = {
multilineTokenSupport = true,
},
},
},
})
-- [[FOLDING SETUP
-- Prefer LSP folding if client supports it
vim.api.nvim_create_autocmd("LspAttach", {
callback = function(args)
local client = vim.lsp.get_client_by_id(args.data.client_id)
if client ~= nil then
if client:supports_method("textDocument/foldingRange") then
local win = vim.api.nvim_get_current_win()
vim.wo[win][0].foldexpr = "v:lua.vim.lsp.foldexpr()"
end
end
end,
})
-- ]]
-- [[INLAY HINTS
vim.api.nvim_create_autocmd("LspAttach", {
callback = function(args)
local client = assert(vim.lsp.get_client_by_id(args.data.client_id))
if client.server_capabilities.inlayHintProvider then
vim.lsp.inlay_hint.enable(true, { bufnr = vim.fn.bufnr() })
end
end,
})

View File

@@ -41,6 +41,11 @@ map("v", "p", '"_dP', { desc = "Paste without yanking underlying text" })
map("n", "gl", "`.", { desc = "Jump to the last change in the file" })
map("n", "C-d", "<C-d>zz")
map("n", "C-u", "<C-u>zz")
map("n", "C-f", "<C-f>zz")
map("n", "C-b", "<C-b>zz")
-- map('n', '<C-f>', 'za', { desc = 'Toggle cursor fold' })
-- map('n', '<C-down>', 'zm', { desc = 'Toggle all folds at cursor' })
-- map('n', '<C-S-down>', 'zM', { desc = 'Close all open folds' })

View File

@@ -0,0 +1,27 @@
--- @return string
local function tab_info()
local fname = vim.fn.expand("%:p")
if fname == "" then
return ""
end
return "%#WildMenu# " .. fname .. " %*"
end
--- @return string
local function filestatus()
if vim.bo.modified == true then
return "%#Error# ● %*"
end
if vim.bo.readonly == true then
return "%#Error#  %*"
end
return ""
end
function _G.TabLine()
return table.concat({
tab_info(),
filestatus(),
})
end
vim.opt.tabline = "%!v:lua.TabLine()"

View File

@@ -1,18 +1,4 @@
return {
{ -- highlight and search TODO commends
"folke/todo-comments.nvim",
cmd = { "TodoTrouble", "TodoTelescope" },
opts = {},
-- stylua: ignore
keys = {
{ "]t", function() require("todo-comments").jump_next() end, desc = "Next Todo Comment" },
{ "[t", function() require("todo-comments").jump_prev() end, desc = "Previous Todo Comment" },
{ "<leader>xt", "<cmd>Trouble todo toggle<cr>", desc = "Todo (Trouble)" },
{ "<leader>xT", "<cmd>Trouble todo toggle filter = {tag = {TODO,FIX,FIXME}}<cr>", desc = "Todo/Fix/Fixme (Trouble)" },
{ "<leader>st", "<cmd>TodoTelescope<cr>", desc = "Todo" },
{ "<leader>sT", "<cmd>TodoTelescope keywords=TODO,FIX,FIXME<cr>", desc = "Todo/Fix/Fixme" },
},
},
-- keymap helper
{ "folke/which-key.nvim", opts = {} },
{ -- undo tree
@@ -45,10 +31,51 @@ return {
},
},
{
"echasnovski/mini.surround",
version = false,
config = function()
require("mini.surround").setup()
"folke/flash.nvim",
event = "VeryLazy",
---@type Flash.Config
opts = {},
keys = {
{
"zk",
mode = { "n", "x", "o" },
function()
require("flash").jump()
end,
desc = "Flash",
},
{
"Zk",
mode = { "n", "x", "o" },
function()
require("flash").treesitter()
end,
desc = "Flash Treesitter",
},
{
"r",
mode = "o",
function()
require("flash").remote()
end,
desc = "Remote Flash",
},
{
"R",
mode = { "o", "x" },
function()
require("flash").treesitter_search()
end,
desc = "Treesitter Search",
},
{
"<c-s>",
mode = { "c" },
function()
require("flash").toggle()
end,
desc = "Toggle Flash Search",
},
},
},
}

View File

@@ -1,260 +1,111 @@
return {
{
"folke/lazydev.nvim",
ft = "lua", -- only load on lua files
opts = {
library = {
-- See the configuration section for more details
-- Load luvit types when the `vim.uv` word is found
{ path = "${3rd}/luv/library", words = { "vim%.uv" } },
},
"L3MON4D3/LuaSnip",
version = "v2.*",
dependencies = {
"rafamadriz/friendly-snippets",
},
-- install jsregexp (optional!).
build = "make install_jsregexp",
config = function()
local ls = require("luasnip")
local snippets_folder = vim.fn.stdpath("config") .. "/snippets"
-- Load all Lua files in the snippets directory except init.lua
local files = vim.fn.glob(snippets_folder .. "/*.lua", false, true)
for _, file in ipairs(files) do
local filename = vim.fn.fnamemodify(file, ":t")
-- Remove .lua extension to get the filetype
local ft = filename:match("(.+)%.lua$")
if ft then
-- Load the file which should return a table of snippets
local ok, snippets = pcall(dofile, file)
if ok and type(snippets) == "table" then
ls.add_snippets(ft, snippets)
end
end
end
end,
},
{
"saghen/blink.cmp",
-- optional: provides snippets for the snippet source
dependencies = {
"rafamadriz/friendly-snippets",
"Kaiser-Yang/blink-cmp-dictionary",
"moyiz/blink-emoji.nvim",
"mikavilpas/blink-ripgrep.nvim",
dependencies = { "nvim-lua/plenary.nvim" },
},
-- use a release tag to download pre-built binaries
version = "*",
-- AND/OR build from source, requires nightly:
-- https://rust-lang.github.io/rustup/concepts/channels.html#working-with-nightly-rust
-- build = 'cargo build --release',
-- If you use nix, you can build from source using latest nightly rust with:
-- build = 'nix run .#build-plugin',
version = "1.*",
dependencies = {
"moyiz/blink-emoji.nvim",
},
---@module 'blink.cmp'
---@type blink.cmp.Config
opts = {
-- 'default' for mappings similar to built-in completion
-- 'super-tab' for mappings similar to vscode (tab to accept, arrow keys to navigate)
-- 'enter' for mappings similar to 'super-tab' but with 'enter' to accept
-- See the full "keymap" documentation for information on defining your own keymap.
keymap = {
preset = "enter",
},
completion = {
list = {
selection = {
preselect = function(ctx)
return ctx.mode ~= "cmdline"
end,
},
},
menu = {
-- nvim-cmp style menu
draw = {
columns = {
{ "label", "label_description", gap = 1 },
{ "kind_icon", "kind" },
},
},
},
documentation = { auto_show = true, auto_show_delay_ms = 500 },
ghost_text = { enabled = false },
},
-- 'default' (recommended) for mappings similar to built-in completions (C-y to accept)
-- 'super-tab' for mappings similar to vscode (tab to accept)
-- 'enter' for enter to accept
-- 'none' for no mappings
--
-- All presets have the following mappings:
-- C-space: Open menu or open docs if already open
-- C-n/C-p or Up/Down: Select next/previous item
-- C-e: Hide menu
-- C-k: Toggle signature help (if signature.enabled = true)
--
-- See :h blink-cmp-config-keymap for defining your own keymap
keymap = { preset = "default" },
appearance = {
-- Sets the fallback highlight groups to nvim-cmp's highlight groups
-- Useful for when your theme doesn't support blink.cmp
-- Will be removed in a future release
use_nvim_cmp_as_default = true,
-- Set to 'mono' for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
-- Adjusts spacing to ensure icons are aligned
nerd_font_variant = "mono",
},
-- (Default) Only show the documentation popup when manually triggered
completion = { documentation = { auto_show = true } },
cmdline = {
keymap = {
-- recommended, as the default keymap will only show and select the next item
["<Tab>"] = { "show", "accept" },
},
completion = {
menu = { auto_show = true },
ghost_text = { enabled = true },
},
},
snippets = { preset = "luasnip" },
-- Default list of enabled providers defined so that you can extend it
-- elsewhere in your config, without redefining it, due to `opts_extend`
sources = {
--default = { 'lsp', 'path', 'snippets', 'buffer', 'ctags' },
default = { "lazydev", "lsp", "path", "snippets", "buffer", "ripgrep", "emoji" },
default = { "lsp", "path", "snippets", "buffer", "emoji" },
providers = {
lazydev = {
name = "LazyDev",
module = "lazydev.integrations.blink",
-- make lazydev completions top priority (see `:h blink.cmp`)
score_offset = 100,
cmdline = {
min_keyword_length = function(ctx)
-- when typing a command, only show when the keyword is 3 characters or longer
if ctx.mode == "cmdline" and string.find(ctx.line, " ") == nil then
return 3
end
return 0
end,
},
emoji = {
module = "blink-emoji",
name = "Emoji",
score_offset = 15, -- Tune by preference
opts = { insert = true }, -- Insert emoji (default) or complete its name
-- should_show_items = function()
-- return vim.tbl_contains(
-- -- Enable emoji completion only for git commits and markdown.
-- -- By default, enabled for all file-types.
-- { "gitcommit", "markdown" },
-- vim.o.filetype
-- )
-- end,
},
ripgrep = {
module = "blink-ripgrep",
name = "Ripgrep",
-- the options below are optional, some default values are shown
---@module "blink-ripgrep"
---@type blink-ripgrep.Options
opts = {
-- For many options, see `rg --help` for an exact description of
-- the values that ripgrep expects.
-- the minimum length of the current word to start searching
-- (if the word is shorter than this, the search will not start)
prefix_min_len = 3,
-- The number of lines to show around each match in the preview
-- (documentation) window. For example, 5 means to show 5 lines
-- before, then the match, and another 5 lines after the match.
context_size = 5,
-- The maximum file size of a file that ripgrep should include in
-- its search. Useful when your project contains large files that
-- might cause performance issues.
-- Examples:
-- "1024" (bytes by default), "200K", "1M", "1G", which will
-- exclude files larger than that size.
max_filesize = "1M",
-- Specifies how to find the root of the project where the ripgrep
-- search will start from. Accepts the same options as the marker
-- given to `:h vim.fs.root()` which offers many possibilities for
-- configuration. If none can be found, defaults to Neovim's cwd.
--
-- Examples:
-- - ".git" (default)
-- - { ".git", "package.json", ".root" }
project_root_marker = { ".git", ".terraform", "requirements.txt", "lazy-lock.json" },
-- Enable fallback to neovim cwd if project_root_marker is not
-- found. Default: `true`, which means to use the cwd.
project_root_fallback = true,
-- The casing to use for the search in a format that ripgrep
-- accepts. Defaults to "--ignore-case". See `rg --help` for all the
-- available options ripgrep supports, but you can try
-- "--case-sensitive" or "--smart-case".
search_casing = "--ignore-case",
-- (advanced) Any additional options you want to give to ripgrep.
-- See `rg -h` for a list of all available options. Might be
-- helpful in adjusting performance in specific situations.
-- If you have an idea for a default, please open an issue!
--
-- Not everything will work (obviously).
additional_rg_options = {},
-- When a result is found for a file whose filetype does not have a
-- treesitter parser installed, fall back to regex based highlighting
-- that is bundled in Neovim.
fallback_to_regex_highlighting = true,
-- Absolute root paths where the rg command will not be executed.
-- Usually you want to exclude paths using gitignore files or
-- ripgrep specific ignore files, but this can be used to only
-- ignore the paths in blink-ripgrep.nvim, maintaining the ability
-- to use ripgrep for those paths on the command line. If you need
-- to find out where the searches are executed, enable `debug` and
-- look at `:messages`.
ignore_paths = {},
-- Any additional paths to search in, in addition to the project
-- root. This can be useful if you want to include dictionary files
-- (/usr/share/dict/words), framework documentation, or any other
-- reference material that is not available within the project
-- root.
additional_paths = {},
-- Features that are not yet stable and might change in the future.
-- You can enable these to try them out beforehand, but be aware
-- that they might change. Nothing is enabled by default.
future_features = {
-- Keymaps to toggle features on/off. This can be used to alter
-- the behavior of the plugin without restarting Neovim. Nothing
-- is enabled by default.
toggles = {
-- The keymap to toggle the plugin on and off from blink
-- completion results. Example: "<leader>tg"
on_off = "<leader>tg",
},
},
-- Show debug information in `:messages` that can help in
-- diagnosing issues with the plugin.
debug = false,
},
-- (optional) customize how the results are displayed. Many options
-- are available - make sure your lua LSP is set up so you get
-- autocompletion help
transform_items = function(_, items)
for _, item in ipairs(items) do
-- example: append a description to easily distinguish rg results
item.labelDetails = {
description = "(rg)",
}
end
return items
should_show_items = function()
return vim.tbl_contains(
-- Enable emoji completion only for git commits and markdown.
-- By default, enabled for all file-types.
{ "gitcommit", "markdown" },
vim.o.filetype
)
end,
},
},
},
-- (Default) Rust fuzzy matcher for typo resistance and significantly better performance
-- You may use a lua implementation instead by using `implementation = "lua"` or fallback to the lua implementation,
-- when the Rust fuzzy matcher is not available, by using `implementation = "prefer_rust"`
--
-- See the fuzzy documentation for more information
fuzzy = { implementation = "prefer_rust_with_warning" },
},
opts_extend = { "sources.default" },
},
{
"neovim/nvim-lspconfig",
dependencies = {
"saghen/blink.cmp",
-- "netmute/ctags-lsp.nvim"
},
-- example using `opts` for defining servers
opts = {
servers = {
-- brew install rust-analyzer
rust_analyzer = {
settings = {
["rust-analyzer"] = {},
},
},
-- brew install bash-language-server
bashls = {},
-- lua_ls = {
-- settings = {
-- Lua = {
-- diagnostics = {
-- globals = { "vim" },
-- undefined_global = false, -- remove this from diag!
-- missing_parameters = false, -- missing fields :)
-- },
-- },
-- },
-- },
-- ctags_lsp = {},
},
},
config = function(_, opts)
local lspconfig = require("lspconfig")
--- brew install netmute/tap/ctags-lsp
-- require("lspconfig").ctags_lsp.setup({})
for server, config in pairs(opts.servers) do
-- passing config.capabilities to blink.cmp merges with the capabilities in your
-- `opts[server].capabilities, if you've defined it
config.capabilities = require("blink.cmp").get_lsp_capabilities(config.capabilities)
lspconfig[server].setup(config)
end
end,
},
}

View File

@@ -10,11 +10,13 @@ return {
configs.setup({
ensure_installed = {
"bash",
--"zsh",
"c",
"cmake",
"dockerfile",
"gitignore",
"go",
"gotmpl",
"java",
"json",
"lua",
@@ -87,22 +89,26 @@ return {
-- install rust
rust = { "rustfmt" },
-- brew install prettier
markdown = { "prettierd", "prettier" },
markdown = { "markdownlint-cli2" },
json = { "prettierd", "prettier" },
yaml = { "prettierd", "prettier" },
yaml = { "yamlfmt" },
-- install terraform
terraform = { "terraform_fmt" },
-- brew install shfmt
bash = { "shfmt" },
zsh = { "shfmt" },
sh = { "shfmt" },
-- brew install ruff
python = { "ruff" },
-- go install mvdan.cc/gofumpt@latest
go = { "gofumpt" },
},
formatters = {
prettier = {
prepend_args = { "--prose-wrap", "always" },
},
shfmt = {
prepend_args = { "-i", "4" },
prepend_args = { "-i", "4", "-ci" },
},
ruff = {
prepend_args = { "--extend-select", "I" },
@@ -111,7 +117,7 @@ return {
format_on_save = {
lsp_fallback = true,
async = false,
timeout_ms = 500,
timeout_ms = 3000,
},
})
@@ -119,7 +125,7 @@ return {
conform.format({
lsp_fallback = true,
async = false,
timeout_ms = 500,
timeout_ms = 5000,
})
end, { desc = "Format file or range (in visual mode)" })
end,

View File

@@ -7,9 +7,14 @@ return {
lint.linters_by_ft = {
-- brew install luacheck
lua = { "luacheck" },
bash = { "bash" },
bash = { "shellcheck" },
sh = { "shellcheck" },
-- brew install tflint
terraform = { "tflint" },
-- brew install markdownlint-cli2
markdown = { "markdownlint-cli2" },
-- go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.64.0
go = { "golangcilint" },
}
local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true })
@@ -22,6 +27,13 @@ return {
vim.keymap.set("n", "<leader>l", function()
lint.try_lint()
end, { desc = "Trigger linting for current file" })
vim.keymap.set("n", "<leader>d", function()
if vim.diagnostic.config().virtual_lines then
vim.diagnostic.config({ virtual_lines = false })
else
vim.diagnostic.config({ virtual_lines = { current_line = true } })
end
end, { desc = "Toggle inline diagnostics" })
end,
},
}

View File

@@ -43,10 +43,22 @@ return {
"node_modules",
"target",
".terraform",
".git",
".venv",
".git",
-- Ignore git submodules
"^./.git/",
"^./*/.git/",
".gitmodules",
".gitignore",
".*/%.git/.*", -- Ignore any .git directories in subdirectories
},
hidden = true,
-- Ignore git submodules
follow = true,
},
git_files = {
recurse_submodules = false,
show_untracked = true,
},
buffers = {
initial_mode = "normal",

View File

@@ -1,31 +1,30 @@
return {
{ -- colorscheme
"Mofiqul/dracula.nvim",
{
"zaldih/themery.nvim",
lazy = false,
name = "dracula",
priority = 1000,
config = function()
local dracula = require("dracula")
dracula.setup({
colors = {
visual = "#5a5e77",
},
-- show the '~' characters after the end of buffers
show_end_of_buffer = true, -- default false
-- use transparent background
transparent_bg = false, -- default false
-- set custom lualine background color
lualine_bg_color = "#44475a", -- default nil
-- set italic comment
italic_comment = true, -- default false
-- overrides the default highlights with table see `:h synIDattr`
overrides = {
CursorLine = { bg = "#3e4153" },
CursorLineNr = { fg = "DarkOrange", bold = true },
},
require("themery").setup({
-- add the config here
themes = { "rose-pine-dawn", "rose-pine-main" }, -- Your list of installed colorschemes.
livePreview = true, -- Apply theme while picking. Default to true.
})
vim.cmd [[colorscheme dracula-soft]]
vim.keymap.set("n", "<leader>tt", function()
local themery = require("themery")
local currentTheme = themery.getCurrentTheme()
if currentTheme and currentTheme.name == "rose-pine-dawn" then
themery.setThemeByName("rose-pine-main", true)
else
themery.setThemeByName("rose-pine-dawn", true)
end
end, { noremap = true, desc = "Alternate between light and dark mode" })
end,
},
{
"rose-pine/neovim",
name = "rose-pine",
config = function()
-- vim.cmd("colorscheme rose-pine")
end,
},
-- highlight color hex codes
{
@@ -34,7 +33,7 @@ return {
config = function()
local highlight = require("nvim-highlight-colors")
highlight.setup()
end
end,
},
{ --statusline
"nvim-lualine/lualine.nvim",
@@ -44,7 +43,7 @@ return {
options = {
section_separators = "",
component_separators = "",
theme = "dracula-nvim"
theme = "rose-pine",
},
-- extensions = { "neo-tree", "lazy", "fzf" },
extensions = { "fugitive", "lazy" },
@@ -69,6 +68,29 @@ return {
},
},
},
{
"f-person/git-blame.nvim",
-- load the plugin at startup
event = "VeryLazy",
keys = {
{ "<leader>gk", "<cmd>GitBlameToggle<cr>", desc = "Toggle git-blame" },
},
config = function()
vim.g.gitblame_display_virtual_text = false
-- schedule_event = "CursorHold"
-- clear_event = "CursorHoldI"
vim.g.gitblame_delay = 50 -- miliseconds
local git_blame = require("gitblame")
require("lualine").setup({
sections = {
lualine_c = {
{ "filename" },
{ git_blame.get_current_blame_text, cond = git_blame.is_blame_text_available },
},
},
})
end,
},
{ -- cosmetic indent lines
"lukas-reineke/indent-blankline.nvim",
main = "ibl",
@@ -95,10 +117,91 @@ return {
},
},
{ -- colorful mode indicators
'mvllow/modes.nvim',
tag = 'v0.2.1',
"mvllow/modes.nvim",
tag = "v0.2.1",
config = function()
require('modes').setup()
end
require("modes").setup()
end,
},
{ -- dashboard snack
"folke/snacks.nvim",
priority = 1000,
lazy = false,
---@type snacks.Config
opts = {
-- your configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
dashboard = {
preset = {
header = [[
███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗
████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║
██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║
██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║
██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║
╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝
]],
},
sections = {
{ section = "header" },
{
pane = 2,
section = "terminal",
cmd = "pokemon-colorscripts -n snorlax --no-title; sleep .1",
height = 20,
padding = 0,
},
{ section = "keys", gap = 1, padding = 1 },
{
pane = 2,
icon = "",
title = "Recent Files",
section = "recent_files",
indent = 2,
padding = 1,
},
{ pane = 2, icon = "", title = "Projects", section = "projects", indent = 2, padding = 1 },
{
pane = 2,
icon = "",
title = "Git Status",
section = "terminal",
enabled = function()
return Snacks.git.get_root() ~= nil
end,
cmd = "git status --short --branch --renames",
height = 5,
padding = 1,
ttl = 5 * 60,
indent = 3,
},
{ section = "startup" },
},
},
},
},
{
"MeanderingProgrammer/render-markdown.nvim",
dependencies = { "nvim-treesitter/nvim-treesitter", "nvim-tree/nvim-web-devicons" },
---@module 'render-markdown'
---@type render.md.UserConfig
opts = {},
config = function()
require("render-markdown").setup({
completions = { lsp = { enabled = true } },
})
end,
},
}

View File

@@ -0,0 +1,3 @@
((text) @injection.content
(#set! injection.language "yaml")
(#set! injection.combined))

View File

@@ -0,0 +1,353 @@
-- Lua snippets
local ls = require("luasnip")
local s = ls.snippet
local t = ls.text_node
local i = ls.insert_node
local f = ls.function_node
local c = ls.choice_node
local d = ls.dynamic_node
local sn = ls.snippet_node
local fmt = require("luasnip.extras.fmt").fmt
local rep = require("luasnip.extras").rep
-- Return a table of snippets for Bash
-- stylua: ignore start
return {
-- Shebang
s("shebang", {
t("#!/usr/bin/env bash"),
}),
-- Bash strict mode
s("strict", fmt([[
set -euo pipefail
IFS=$'\n\t'
]], {})),
-- Function definition
s("func", fmt([[
{}() {{
{}
}}
]], {
i(1, "function_name"),
i(2, "# function body"),
})),
-- If statement
s("if", fmt([[
if [ {} ]; then
{}
fi
]], {
i(1, "condition"),
i(2, "# code"),
})),
-- If-else statement
s("ifelse", fmt([[
if [ {} ]; then
{}
else
{}
fi
]], {
i(1, "condition"),
i(2, "# if code"),
i(3, "# else code"),
})),
-- If-elif-else statement
s("ifelif", fmt([[
if [ {} ]; then
{}
elif [ {} ]; then
{}
else
{}
fi
]], {
i(1, "condition1"),
i(2, "# if code"),
i(3, "condition2"),
i(4, "# elif code"),
i(5, "# else code"),
})),
-- For loop
s("for", fmt([[
for {} in {}; do
{}
done
]], {
i(1, "item"),
i(2, "items"),
i(3, "# loop body"),
})),
-- For loop with range
s("fori", fmt([[
for ((i={}; i<{}; i++)); do
{}
done
]], {
i(1, "0"),
i(2, "10"),
i(3, "# loop body"),
})),
-- While loop
s("while", fmt([[
while [ {} ]; do
{}
done
]], {
i(1, "condition"),
i(2, "# loop body"),
})),
-- Until loop
s("until", fmt([[
until [ {} ]; do
{}
done
]], {
i(1, "condition"),
i(2, "# loop body"),
})),
-- Case statement
s("case", fmt([[
case {} in
{})
{}
;;
{})
{}
;;
*)
{}
;;
esac
]], {
i(1, "variable"),
i(2, "pattern1"),
i(3, "# code for pattern1"),
i(4, "pattern2"),
i(5, "# code for pattern2"),
i(6, "# default code"),
})),
-- Read input
s("read", fmt([[
read -p "{}" {}
]], {
i(1, "Enter value: "),
i(2, "variable"),
})),
-- Command substitution
s("cmd", fmt([[
{}=$({}$)
]], {
i(1, "result"),
i(2, "command"),
})),
-- Variable declaration
s("var", fmt([[
{}="{}"
]], {
i(1, "variable"),
i(2, "value"),
})),
-- Array declaration
s("array", fmt([[
{}=({})
]], {
i(1, "array"),
i(2, "item1 item2 item3"),
})),
-- Check if command exists
s("cmdexists", fmt([[
if command -v {} &> /dev/null; then
{}
else
{}
fi
]], {
i(1, "command"),
i(2, "# command exists"),
i(3, "# command does not exist"),
})),
-- Check if file exists
s("fileexists", fmt([[
if [ -f {} ]; then
{}
else
{}
fi
]], {
i(1, "file"),
i(2, "# file exists"),
i(3, "# file does not exist"),
})),
-- Check if directory exists
s("direxists", fmt([[
if [ -d {} ]; then
{}
else
{}
fi
]], {
i(1, "directory"),
i(2, "# directory exists"),
i(3, "# directory does not exist"),
})),
-- Check if variable is empty
s("isempty", fmt([[
if [ -z "${{{}}}" ]; then
{}
else
{}
fi
]], {
i(1, "variable"),
i(2, "# variable is empty"),
i(3, "# variable is not empty"),
})),
-- Check if variable is not empty
s("isnotempty", fmt([[
if [ -n "${{{}}}" ]; then
{}
else
{}
fi
]], {
i(1, "variable"),
i(2, "# variable is not empty"),
i(3, "# variable is empty"),
})),
-- Error handling
s("error", fmt([[
error() {{
echo "[ERROR] $1" >&2
exit 1
}}
]], {})),
-- Parse command line arguments
s("getopts", fmt([[
while getopts ":{}:" opt; do
case $opt in
{})
{}
;;
{})
{}
;;
\?)
echo "Invalid option: -$OPTARG" >&2
exit 1
;;
:)
echo "Option -$OPTARG requires an argument." >&2
exit 1
;;
esac
done
shift $((OPTIND-1))
]], {
i(1, "ab:c:"),
i(2, "a"),
i(3, "# handle option a"),
i(4, "b"),
i(5, "# handle option b with value in $OPTARG"),
})),
-- Trap signals
s("trap", fmt([[
trap '{}' {}
]], {
i(1, "echo 'Caught signal, cleaning up...; exit 1'"),
i(2, "SIGINT SIGTERM"),
})),
-- Cleanup function with trap
s("cleanup", fmt([[
cleanup() {{
{}
}}
trap cleanup EXIT
]], {
i(1, "# cleanup code here"),
})),
-- Redirect stdout and stderr to file
s("redirect", fmt([[
{} > {} 2>&1
]], {
i(1, "command"),
i(2, "logfile.log"),
})),
-- Check exit status
s("checkstatus", fmt([[
if [ $? -eq 0 ]; then
{}
else
{}
fi
]], {
i(1, "# success"),
i(2, "# failure"),
})),
-- Here document
s("heredoc", fmt([[
cat << EOF > {}
{}
EOF
]], {
i(1, "output.txt"),
i(2, "content goes here"),
})),
-- Here string
s("herestring", fmt([[
{} <<< "{}"
]], {
i(1, "command"),
i(2, "string"),
})),
-- Script usage/help
s("usage", fmt([[
usage() {{
cat << EOF
Usage: $(basename $0) [options] <arguments>
Options:
-h, --help Show this help message and exit
-v, --verbose Enable verbose output
{}
Examples:
$(basename $0) {}
EOF
exit ${1:-0}
}}
]], {
i(1, "-o, --option Description of option"),
i(2, "example_argument"),
})),
}
-- stylua: ignore end

View File

@@ -0,0 +1,79 @@
-- Lua snippets
local ls = require("luasnip")
local s = ls.snippet
local t = ls.text_node
local i = ls.insert_node
local f = ls.function_node
local c = ls.choice_node
local d = ls.dynamic_node
local sn = ls.snippet_node
local fmt = require("luasnip.extras.fmt").fmt
local rep = require("luasnip.extras").rep
-- Return a table of snippets for Lua
-- stylua: ignore start
return {
-- Basic print statement
s("pr", {
t('print("'),
i(1, "text"),
t('")'),
}),
-- Function definition
s("fn", fmt([[
local function {}({})
{}
end
]], {
i(1, "name"),
i(2, ""),
i(3, "-- TODO: implement"),
})),
-- Module pattern
s("mod", fmt([[
local {} = {{}}
function {}:new(o)
o = o or {{}}
setmetatable(o, self)
self.__index = self
return o
end
{}
return {}
]], {
i(1, "ModuleName"),
rep(1),
i(2, "-- TODO: add methods"),
rep(1),
})),
-- For loop
s("for", fmt([[
for {} = {}, {} do
{}
end
]], {
i(1, "i"),
i(2, "1"),
i(3, "10"),
i(4, "-- TODO: loop body"),
})),
-- For pairs loop
s("forp", fmt([[
for {}, {} in pairs({}) do
{}
end
]], {
i(1, "k"),
i(2, "v"),
i(3, "table"),
i(4, "-- TODO: loop body"),
})),
}
-- stylua: ignore end

View File

@@ -0,0 +1,75 @@
-- Python snippets
local ls = require("luasnip")
local s = ls.snippet
local t = ls.text_node
local i = ls.insert_node
local f = ls.function_node
local c = ls.choice_node
local d = ls.dynamic_node
local sn = ls.snippet_node
local fmt = require("luasnip.extras.fmt").fmt
local rep = require("luasnip.extras").rep
-- Return a table of snippets for Python
-- stylua: ignore start
return {
-- Print statement
s("pr", {
t("print("),
i(1, "text"),
t(")"),
}),
-- Function definition
s("def", fmt([[
def {}({}):
{}
]], {
i(1, "function_name"),
i(2, ""),
i(3, "pass"),
})),
-- Class definition
s("class", fmt([[
class {}:
def __init__(self, {}):
{}
]], {
i(1, "ClassName"),
i(2, ""),
i(3, "pass"),
})),
-- For loop
s("for", fmt([[
for {} in {}:
{}
]], {
i(1, "item"),
i(2, "iterable"),
i(3, "pass"),
})),
-- If statement
s("if", fmt([[
if {}:
{}
]], {
i(1, "condition"),
i(2, "pass"),
})),
-- Try/except
s("try", fmt([[
try:
{}
except {}:
{}
]], {
i(1, "# code"),
i(2, "Exception"),
i(3, "pass"),
})),
}
-- stylua: ignore end

View File

@@ -0,0 +1,340 @@
-- Lua snippets
local ls = require("luasnip")
local s = ls.snippet
local t = ls.text_node
local i = ls.insert_node
local f = ls.function_node
local c = ls.choice_node
local d = ls.dynamic_node
local sn = ls.snippet_node
local fmt = require("luasnip.extras.fmt").fmt
local rep = require("luasnip.extras").rep
-- Return a table of snippets for Rust
-- stylua: ignore start
return {
-- Basic main function
s("main", fmt([[
fn main() {{
{}
}}
]], {
i(1, "// Your code here"),
})),
-- Function definition
s("fn", fmt([[
fn {}({}) {} {{
{}
}}
]], {
i(1, "function_name"),
i(2, ""),
c(3, {
t(""),
t("-> ()"),
sn(nil, {t("-> "), i(1, "ReturnType")}),
}),
i(4, "// Function body"),
})),
-- Public function
s("pfn", fmt([[
pub fn {}({}) {} {{
{}
}}
]], {
i(1, "function_name"),
i(2, ""),
c(3, {
t(""),
t("-> ()"),
sn(nil, {t("-> "), i(1, "ReturnType")}),
}),
i(4, "// Function body"),
})),
-- Struct definition
s("struct", fmt([[
struct {} {{
{}
}}
]], {
i(1, "StructName"),
i(2, "// fields"),
})),
-- Public struct
s("pstruct", fmt([[
pub struct {} {{
{}
}}
]], {
i(1, "StructName"),
i(2, "// fields"),
})),
-- Struct implementation
s("impl", fmt([[
impl {} {{
{}
}}
]], {
i(1, "StructName"),
i(2, "// methods"),
})),
-- Trait implementation
s("implfor", fmt([[
impl {} for {} {{
{}
}}
]], {
i(1, "Trait"),
i(2, "Type"),
i(3, "// trait implementation"),
})),
-- Trait definition
s("trait", fmt([[
trait {} {{
{}
}}
]], {
i(1, "TraitName"),
i(2, "// trait methods"),
})),
-- Public trait
s("ptrait", fmt([[
pub trait {} {{
{}
}}
]], {
i(1, "TraitName"),
i(2, "// trait methods"),
})),
-- Enum definition
s("enum", fmt([[
enum {} {{
{},
}}
]], {
i(1, "EnumName"),
i(2, "// variants"),
})),
-- Public enum
s("penum", fmt([[
pub enum {} {{
{},
}}
]], {
i(1, "EnumName"),
i(2, "// variants"),
})),
-- Match expression
s("match", fmt([[
match {} {{
{} => {},
_ => {},
}}
]], {
i(1, "expression"),
i(2, "pattern"),
i(3, "result"),
i(4, "default_result"),
})),
-- If let expression
s("iflet", fmt([[
if let {} = {} {{
{}
}}
]], {
i(1, "pattern"),
i(2, "expression"),
i(3, "// code"),
})),
-- While let loop
s("whilelet", fmt([[
while let {} = {} {{
{}
}}
]], {
i(1, "pattern"),
i(2, "expression"),
i(3, "// loop body"),
})),
-- For loop
s("for", fmt([[
for {} in {} {{
{}
}}
]], {
i(1, "item"),
i(2, "iterator"),
i(3, "// loop body"),
})),
-- Loop
s("loop", fmt([[
loop {{
{}
{}
}}
]], {
i(1, "// loop body"),
i(2, "break;"),
})),
-- Closure
s("closure", fmt([[
|{}| {} {{
{}
}}
]], {
i(1, "args"),
c(2, {
t(""),
sn(nil, {t("-> "), i(1, "ReturnType")}),
}),
i(3, "// closure body"),
})),
-- Derive attribute
s("derive", fmt([[
#[derive({})]
]], {
i(1, "Debug, Clone"),
})),
-- Module
s("mod", fmt([[
mod {} {{
{}
}}
]], {
i(1, "module_name"),
i(2, "// module contents"),
})),
-- Public module
s("pmod", fmt([[
pub mod {} {{
{}
}}
]], {
i(1, "module_name"),
i(2, "// module contents"),
})),
-- Use statement
s("use", fmt([[
use {};
]], {
i(1, "path::to::module"),
})),
-- Test module
s("testmod", fmt([[
#[cfg(test)]
mod tests {{
use super::*;
#[test]
fn {}() {{
{}
}}
}}
]], {
i(1, "test_name"),
i(2, "// test code"),
})),
-- Test function
s("test", fmt([[
#[test]
fn {}() {{
{}
}}
]], {
i(1, "test_name"),
i(2, "// test code"),
})),
-- Async function
s("async", fmt([[
async fn {}({}) {} {{
{}
}}
]], {
i(1, "function_name"),
i(2, ""),
c(3, {
t(""),
t("-> ()"),
sn(nil, {t("-> "), i(1, "ReturnType")}),
}),
i(4, "// async function body"),
})),
-- Result type
s("result", fmt([[
Result<{}, {}>
]], {
i(1, "T"),
i(2, "Error"),
})),
-- Option type
s("option", fmt([[
Option<{}>
]], {
i(1, "T"),
})),
-- Unwrap with error message
s("expect", fmt([[
.expect("{}")
]], {
i(1, "Failed to unwrap value"),
})),
-- Print debug
s("dbg", fmt([[
dbg!({});
]], {
i(1, "expression"),
})),
-- Print
s("print", fmt([[
println!("{}", {});
]], {
i(1, "{}"),
i(2, "expression"),
})),
-- Let statement
s("let", fmt([[
let {} = {};
]], {
i(1, "variable"),
i(2, "value"),
})),
-- Let mut statement
s("letmut", fmt([[
let mut {} = {};
]], {
i(1, "variable"),
i(2, "value"),
})),
}
-- stylua: ignore end

View File

@@ -0,0 +1,297 @@
-- Terraform snippets
local ls = require("luasnip")
local s = ls.snippet
local t = ls.text_node
local i = ls.insert_node
local f = ls.function_node
local c = ls.choice_node
local d = ls.dynamic_node
local sn = ls.snippet_node
local fmt = require("luasnip.extras.fmt").fmt
local rep = require("luasnip.extras").rep
-- Return a table of snippets for Terraform
-- stylua: ignore start
return {
-- Terraform block
s("terraform", fmt([[
terraform {{
required_version = ">= {}"
required_providers {{
{}
}}
{}
}}
]], {
i(1, "1.0.0"),
i(2, 'aws = {\n source = "hashicorp/aws"\n version = "~> 4.0"\n }'),
i(3, ""),
})),
-- Provider block
s("provider", fmt([[
provider "{}" {{
{}
}}
]], {
i(1, "aws"),
i(2, 'region = "us-west-2"'),
})),
-- AWS Provider with profile
s("aws", fmt([[
provider "aws" {{
region = "{}"
profile = "{}"
}}
]], {
i(1, "us-west-2"),
i(2, "default"),
})),
-- Resource block
s("resource", fmt([[
resource "{}" "{}" {{
{}
}}
]], {
i(1, "aws_s3_bucket"),
i(2, "example"),
i(3, ""),
})),
-- Data source block
s("data", fmt([[
data "{}" "{}" {{
{}
}}
]], {
i(1, "aws_ami"),
i(2, "example"),
i(3, 'owners = ["amazon"]'),
})),
-- Variable block
s("variable", fmt([[
variable "{}" {{
description = "{}"
type = {}
default = {}
{}
}}
]], {
i(1, "example"),
i(2, "Example variable"),
c(3, {
t("string"),
t("number"),
t("bool"),
t("list(string)"),
t("map(string)"),
t("object({})"),
sn(nil, {t("list(object({"), i(1, "name = string, value = string"), t("}))")}),
}),
c(4, {
t('null'),
sn(nil, {t('"'), i(1, "default_value"), t('"')}),
sn(nil, {t('true')}),
sn(nil, {t('false')}),
sn(nil, {t('123')}),
sn(nil, {t('['), i(1, '"item1", "item2"'), t(']')}),
sn(nil, {t('{'), i(1, 'key = "value"'), t('}')}),
}),
i(5, ""),
})),
-- Output block
s("output", fmt([[
output "{}" {{
description = "{}"
value = {}
{}
}}
]], {
i(1, "example"),
i(2, "Example output"),
i(3, "aws_instance.example.id"),
c(4, {
t(""),
t("sensitive = true"),
}),
})),
-- Local block
s("locals", fmt([[
locals {{
{} = {}
}}
]], {
i(1, "example"),
i(2, '"value"'),
})),
-- Module block
s("module", fmt([[
module "{}" {{
source = "{}"
{}
}}
]], {
i(1, "example"),
i(2, "./modules/example"),
i(3, "# Module inputs"),
})),
-- Backend block
s("backend", fmt([[
backend "{}" {{
{}
}}
]], {
i(1, "s3"),
i(2, 'bucket = "terraform-state"\nkey = "path/to/state.tfstate"\nregion = "us-west-2"'),
})),
-- Conditional expression
s("condition", fmt([[
{} ? {} : {}
]], {
i(1, "var.environment == \"prod\""),
i(2, "\"production\""),
i(3, "\"development\""),
})),
-- For expression
s("for", fmt([[
[for {} in {} : {}]
]], {
i(1, "item"),
i(2, "var.list"),
i(3, "item.name"),
})),
-- For expression with index
s("fori", fmt([[
[for {}, {} in {} : {}]
]], {
i(1, "index"),
i(2, "item"),
i(3, "var.list"),
i(4, "\"${index}-${item.name}\""),
})),
-- For expression with map
s("formap", fmt([[
{{for {} in {} : {} => {}}}
]], {
i(1, "item"),
i(2, "var.list"),
i(3, "item.key"),
i(4, "item.value"),
})),
-- Count parameter
s("count", fmt([[
count = {}
{}[count.index]
]], {
i(1, "var.create_resource ? 1 : 0"),
i(2, "# Reference this resource elsewhere using aws_instance.example"),
})),
-- For each parameter
s("foreach", fmt([[
for_each = {}
{}
]], {
c(1, {
sn(nil, {t("toset(["), i(1, "\"item1\", \"item2\""), t("])")}),
sn(nil, {t("{"), i(1, "key1 = \"value1\", key2 = \"value2\""), t("}")}),
sn(nil, {t("var."), i(1, "map_variable")}),
}),
i(2, "# Reference this resource elsewhere using aws_instance.example[each.key]"),
})),
-- Dynamic block
s("dynamic", fmt([[
dynamic "{}" {{
for_each = {}
content {{
{}
}}
}}
]], {
i(1, "ingress"),
i(2, "var.ingress_rules"),
i(3, "from_port = ingress.value.from_port\n to_port = ingress.value.to_port\n protocol = ingress.value.protocol\n cidr_blocks = ingress.value.cidr_blocks"),
})),
-- Lifecycle block
s("lifecycle", fmt([[
lifecycle {{
{}
}}
]], {
c(1, {
t("create_before_destroy = true"),
t("prevent_destroy = true"),
t("ignore_changes = [tags]"),
sn(nil, {t("ignore_changes = ["), i(1, "attribute"), t("]")}),
t("create_before_destroy = true\n prevent_destroy = true\n ignore_changes = [tags]"),
}),
})),
-- Terraform workspace
s("workspace", fmt([[
terraform.workspace
]], {})),
-- Depends on
s("depends", fmt([[
depends_on = [
{},
]
]], {
i(1, "aws_iam_role_policy.example"),
})),
-- Provisioner
s("provisioner", fmt([[
provisioner "{}" {{
{}
}}
]], {
c(1, {
t("local-exec"),
t("remote-exec"),
t("file"),
}),
c(2, {
sn(nil, {t('command = "'), i(1, "echo hello"), t('"')}),
sn(nil, {t('inline = [\n "'), i(1, "echo hello"), t('",\n ]')}),
sn(nil, {t('source = "'), i(1, "scripts/setup.sh"), t('"\n destination = "'), i(2, "/tmp/setup.sh"), t('"')}),
}),
})),
-- Null resource
s("null", fmt([[
resource "null_resource" "{}" {{
triggers = {{
{} = {}
}}
{}
}}
]], {
i(1, "example"),
i(2, "trigger"),
i(3, "uuid()"),
i(4, "# Provisioners or depends_on go here"),
})),
}
-- stylua: ignore end

View File

@@ -0,0 +1,61 @@
#!/bin/bash
# Script to package all git changes and untracked files into a single archive
#
# ./package_repo_changes [ARCHIVE_NAME]
set -euo pipefail
cleanup() {
local exit_code=$?
echo "Cleaning up temporary files..."
[[ -d "${TEMP_DIR:-}" ]] && rm -rf "$TEMP_DIR"
exit $exit_code
}
trap cleanup EXIT
# Get the repository root directory
REPO_DIR=$(git rev-parse --show-toplevel)
cd "$REPO_DIR"
TEMP_DIR=$(mktemp -d)
echo "Creating temporary directory: $TEMP_DIR"
# Check if there are any changes to package
if git diff --quiet && [[ -z "$(git ls-files --others --exclude-standard)" ]]; then
echo "No changes detected in the repository. Nothing to package."
exit 0
fi
echo "Generating patch file for tracked changes..."
git diff >"$TEMP_DIR/changes.patch"
# Include staged changes as well
if ! git diff --staged --quiet; then
echo "Including staged changes..."
git diff --staged >>"$TEMP_DIR/changes.patch"
fi
echo "Packaging untracked files..."
git ls-files --others --exclude-standard >"$TEMP_DIR/untracked_files.txt"
if [[ -s "$TEMP_DIR/untracked_files.txt" ]]; then
COPYFILE_DISABLE=1 tar -czf "$TEMP_DIR/untracked.tar.gz" -T "$TEMP_DIR/untracked_files.txt"
echo "Untracked files packaged successfully."
else
echo "No untracked files found."
touch "$TEMP_DIR/untracked.tar.gz"
fi
# Allow custom archive name with default fallback
ARCHIVE_NAME=${1:-"changes_$(date +%Y%m%d_%H%M%S).tar.gz"}
echo "Creating final archive: $ARCHIVE_NAME"
COPYFILE_DISABLE=1 tar -czf "$ARCHIVE_NAME" -C "$TEMP_DIR" changes.patch untracked.tar.gz
echo "Archive created successfully at: $REPO_DIR/$ARCHIVE_NAME"
echo ""
echo "To apply these changes elsewhere:"
echo "1. Extract the archive: tar -xzf $ARCHIVE_NAME"
echo "2. Apply the patch: git apply changes.patch"
echo "3. Extract untracked files: tar -xzf untracked.tar.gz"

75
scripts/hcf/rose_pine_switch Executable file
View File

@@ -0,0 +1,75 @@
#!/bin/bash
# Script to switch the alacritty theme between rose-pine and rose-pine-dawn
#
# ./rose_pine_switch
set -euo pipefail
case "$(uname -s)" in
Linux*)
sed_i() { sed -i "$@"; }
;;
Darwin*)
sed_i() { sed -i '' "$@"; }
;;
*)
echo "Unknown platform"
return 1
;;
esac
function switch_alacritty_colors() {
local config_file
config_file="$DOTFILES/alacritty/.config/alacritty/alacritty.toml"
if ! grep -q 'colors' "$config_file"; then
echo "Error, could not find import from colors directory"
return 1
fi
if grep -q 'dawn' "$config_file"; then
sed_i 's/rose-pine-dawn\.toml/rose-pine.toml/g' "$config_file"
else
sed_i 's/rose-pine\.toml/rose-pine-dawn.toml/g' "$config_file"
fi
}
function switch_tmux_colors() {
local config_file
config_file="$DOTFILES/tmux/.tmux.conf"
if ! grep -q 'rose_pine_variant' "$config_file"; then
echo "Error, could not find rose pine settings in config file"
return 1
fi
if grep -q '@rose_pine_variant '\''dawn'\''' "$config_file"; then
sed_i 's/rose_pine_variant '\''dawn'\''/rose_pine_variant '\''main'\''/g' "$config_file"
tmux source-file ~/.tmux.conf
else
sed_i 's/rose_pine_variant '\''main'\''/rose_pine_variant '\''dawn'\''/g' "$config_file"
tmux source-file ~/.tmux.conf
fi
}
function switch_k9s_colors() {
local config_file
config_file="$DOTFILES/k9s/.config/k9s/config.yaml"
if ! grep -q 'rose-pine' "$config_file"; then
echo "Error, could not find rose pine settings in config file"
return 1
fi
if grep -q 'rose-pine-dawn' "$config_file"; then
sed_i 's/rose-pine-dawn/rose-pine/g' "$config_file"
else
sed_i 's/rose-pine/rose-pine-dawn/g' "$config_file"
fi
}
function switch_colors() {
# Only work if the DOTFILES variable is set
if [ -n "$DOTFILES" ]; then
switch_alacritty_colors
switch_tmux_colors
switch_k9s_colors
fi
}
switch_colors

View File

@@ -0,0 +1,5 @@
[Desktop Entry]
Type=Application
Name=org.telegram.desktop
Exec=bash -c "flatpak run --command=telegram-desktop org.telegram.desktop -startintray"
X-Flatpak=org.telegram.desktop

View File

@@ -4,18 +4,16 @@
tty=$1
# Construct process tree.
children=();
children=()
pids=($(ps -o pid= -t $tty))
while read -r pid ppid
do
[[ -n pid && pid -ne ppid ]] && children[ppid]+=" $pid"
while read -r pid ppid; do
[[ -n $pid && $pid -ne $ppid ]] && children[ppid]+=" $pid"
done <<<"$(ps -Ao pid=,ppid=)"
# Get all descendant pids of processes in $tty with BFS
idx=0
while (( ${#pids[@]} > idx ))
do
while ((${#pids[@]} > idx)); do
pid=${pids[idx++]}
pids+=(${children[pid]-})
done

View File

@@ -1,42 +1,14 @@
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
###############################################################################
###############################################################################
### general config ###
###############################################################################
###############################################################################
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @continuum-boot 'on'
set -g @continuum-boot-options 'iterm,fullscreen'
set -g @plugin 'dracula/tmux'
# set -Fg 'status-format[1]' '#{status-format[0]}'
# set -g 'status-format[0]' ''
# set -g status 2
set -g @dracula-plugins "git weather time battery"
set -g @dracula-show-fahrenheit false
set -g @dracula-fixed-location "Madrid"
set -g @dracula-show-powerline false
set -g @dracula-transparent-powerline-bg true
set -g @dracula-military-time true
set -g @dracula-day-month true
set -g @plugin 'ofirgall/tmux-window-name'
set -g @tmux_window_name_substitute_sets "[('.+bash', 'bash')]"
set -g @tmux_window_name_shells "['bash', 'fish', 'sh', 'zsh']"
set -g @tmux_window_dir_programs "['nvim', 'vim', 'vi', 'git']"
set -g @tmux_window_name_use_tilde "True"
set -g @tmux_window_name_max_name_len "100"
# set-option -g default-shell $SHELL
# set -g default-command "$SHELL -i"
# Other examples:
# set -g @plugin 'github_username/plugin_name'
# set -g @plugin 'github_username/plugin_name#branch'
# set -g @plugin 'git@github.com:user/plugin'
# set -g @plugin 'git@bitbucket.com:user/plugin'
bind r source-file ~/.tmux.conf \; display "Reloaded!" # Reload with ctrl-r
set -sg escape-time 1 # quicker responses
@@ -47,26 +19,127 @@ set -g mouse on
set-option -gw xterm-keys on
bind-key -n C-t new-window
bind-key -n C-S-t new-window -c '#{pane_current_path}'
bind-key -n C-n new-window -c "#{pane_current_path}"
# Pane splits should open to the same path as the current pane
bind '"' split-window -v -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
### set-environment -g PATH "$HOMEBREW_PREFIX/bin:$PATH"
bind C-o popup -E -E -d "#{pane_current_path}" -w 90% -h 90% "opencode"
bind-key -n C-S-Down next-window
bind-key -n C-S-Up previous-window
bind-key -n C-S-Left swap-window -t -1\; select-window -t -1
bind-key -n C-S-Right swap-window -t +1\; select-window -t +1
# Smart pane switching with awareness of Vim splits.
# See: https://github.com/christoomey/vim-tmux-navigator
setw -g mode-keys vi
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cancel
set -g set-clipboard on
set -g focus-events on
# Increase scrollback buffer size
set -g history-limit 50000
# Improve terminal scrolling
set -ga terminal-overrides ',*:smcup@:rmcup@'
set-option -g default-shell $SHELL
set-option -g allow-rename off
set-option -sa terminal-features ',alacritty:RGB'
set-option -ga terminal-features ",alacritty:usstyle"
set-option -ga terminal-overrides ',alacritty:Tc'
set -g default-terminal "alacritty"
###############################################################################
###############################################################################
### theme and misc plugins ###
###############################################################################
###############################################################################
set -g @plugin 'rose-pine/tmux'
set -g @rose_pine_variant 'main' # Options are 'main', 'moon' or 'dawn'
set -g @rose_pine_date_time '%Y-%m-%d %H:%M '
set -g @rose_pine_directory 'on'
set -g @rose_pine_disable_active_window_menu 'on'
set -g @plugin 'MunifTanjim/tmux-mode-indicator'
set -g @rose_pine_status_left_prepend_section '#{tmux_mode_indicator}'
# bind F5 to theme switch
bind-key . run-shell "$DOTFILES/scripts/hcf/rose_pine_switch"
set -g @plugin 'ofirgall/tmux-window-name'
set -g @tmux_window_name_substitute_sets "[('.+bash', 'bash'), ('cbonsai.+', 'cbonsai')]"
set -g @tmux_window_name_shells "['bash', 'fish', 'sh', 'zsh']"
set -g @tmux_window_dir_programs "['nvim', 'vim', 'vi', 'git', 'cbonsai']"
set -g @tmux_window_name_use_tilde "True"
set -g @tmux_window_name_max_name_len "100"
set -g @plugin 'tmux-plugins/tmux-open'
set -g @plugin 'pschmitt/tmux-ssh-split'
set-option -g @ssh-split-keep-cwd "true"
set-option -g @ssh-split-keep-remote-cwd "true"
set-option -g @ssh-split-fail "true"
set-option -g @ssh-split-no-env "false"
set-option -g @ssh-split-no-shell "false"
set-option -g @ssh-split-strip-cmd "true"
set-option -g @ssh-split-verbose "true"
set-option -g @ssh-split-debug "false"
set-option -g @ssh-split-h-key "V"
set-option -g @ssh-split-v-key 'H'
set-option -g @ssh-split-w-key "N"
set-option -g @ssh-split-r-key "R"
set -g @plugin 'Morantron/tmux-fingers'
###############################################################################
###############################################################################
### tmux-continuum ###
###############################################################################
###############################################################################
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @resurrect-capture-pane-contents 'on'
set -g @resurrect-dir '~/.tmux/resurrect/'
set -g @continuum-save-interval '15'
set -g @continuum-restore 'on'
set -g @continuum-boot 'on'
### tmux-resurrect
set -g @resurrect-save 'S' # prefix + Shift-s - save
set -g @resurrect-restore 'R' # prefix + Shift-r - restore
# for neovim
set -g @resurrect-strategy-nvim 'session'
# Platform-specific settings
if-shell "uname | grep -q Darwin" {
# macOS specific settings
set -g @continuum-boot-options 'alacritty,fullscreen'
set -g default-command "reattach-to-user-namespace -l $SHELL"
} {
# Linux specific settings
set -g @continuum-boot-options 'alacritty,fullscreen'
}
###############################################################################
###############################################################################
### Nvim-tmux-navigation setup ###
###############################################################################
###############################################################################
# decide whether we're in a Vim process
is_vim="~/.is_vim.sh '#{pane_tty}'"
bind-key -n 'S-Left' if-shell "$is_vim" 'send-keys S-Left' 'select-pane -L'
bind-key -n 'S-Down' if-shell "$is_vim" 'send-keys S-Down' 'select-pane -D'
bind-key -n 'S-Up' if-shell "$is_vim" 'send-keys S-Up' 'select-pane -U'

Binary file not shown.

After

Width:  |  Height:  |  Size: 1024 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

15
zsh/.zprofile Normal file
View File

@@ -0,0 +1,15 @@
export PATH=~/.local/bin:$PATH
export PATH=$DOTFILES/scripts/hcf/:$PATH
case "$(uname -s)" in
Linux*) {
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
} ;;
Darwin*) {
eval "$(/opt/homebrew/bin/brew shellenv)"
export PATH="/opt/homebrew/bin/bash/bin:$PATH"
} ;;
*) ;;
esac
export PATH="$(go env GOPATH)/bin:$PATH"

View File

@@ -1,4 +1,8 @@
alias tree='tree -CF --du -h'
alias cbonsai='cbonsai --live --infinite --time 0.3 --base 2 --wait 2 --leaf "&,#,$,*,@"'
alias tmux_main='tmux new-session -s main'
alias tmux_secondary_win='tmux new-session -t main -s secondary'
# enable color support of ls and also add handy aliases
alias ls='ls --color=auto'
@@ -7,25 +11,151 @@ alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
alias d='dirs -v'
# shfmt needs to ignore this because it is a zsh specific syntax
# shfmt:ignore:start
for index ({1..9}) alias "c$index"="cd +${index}"; unset index
# shfmt:ignore:end
# alias tf="aws-vault exec feedzai-main -d 8h -- terraform"
# alias tfi="aws-vault exec feedzai-main -d 8h -- terraform init"
# alias tfp="aws-vault exec feedzai-main -d 8h -- terraform plan -lock=false"
# alias tfa="aws-vault exec feedzai-main -d 8h -- terraform apply"
# alias tfu="aws-vault exec feedzai-main -d 8h -- terraform get -update"
_get_aws_config_path() {
local config_path="${AWS_CONFIG_FILE:-$HOME/.aws/config}"
echo "$config_path"
}
# This label will be set in a comment in the ~/.aws/config file right before
# the definition of the profile we want to use as the default.
# The format will be `#[<label value>]`
# Example, using "admin" as the default profile:
#
# alias tg="aws-vault exec feedzai-main -d 8h -- terragrunt"
# alias tgi="aws-vault exec feedzai-main -d 8h -- terragrunt init"
# alias tgp="aws-vault exec feedzai-main -d 8h -- terragrunt plan -lock=false"
# alias tga="aws-vault exec feedzai-main -d 8h -- terragrunt apply"
# alias tgu="aws-vault exec feedzai-main -d 8h -- terragrunt get -update"
# alias tgg="aws-vault exec feedzai-main -d 8h -- terragrunt graph-dependencies"
# > [default]
# > region = eu-south-2
# >
# > #[<label value>] ---> Marking the profile with the label
# > [profile admin]
# > source_profile=default
# > region = eu-south-2
# > role_arn=arn:aws:iam::<account id>:role/MyAdminRole
# >
# > [profile readonly]
# > source_profile=default
# > region = eu-south-2
# > role_arn=arn:aws:iam::<account id>:role/MyReadOnlyRole
#
DEFAULT_AWS_PROFILE_LABEL="aws-vault-default"
alias idot='dot -Tsvg -Goverlap=scale -Grankdir=RL -Gbgcolor="#282a36" -Ncolor="#f8f8f2" -Ecolor="#f8f8f2" -Nfontcolor="#f8f8f2" -Gfontname="PragmataPro Mono Liga Regular" -Gfontsize=13 -Nfontname="PragmataPro" -Nfontsize=13 -Nshape=box -Earrowhead=normal'
alias icat="kitty +kitten icat"
_get_default_aws_profile() {
local profile="default"
if grep -q "^#\[$DEFAULT_AWS_PROFILE_LABEL\]" "$(_get_aws_config_path)"; then
profile="$(grep -A3 "^#\[$DEFAULT_AWS_PROFILE_LABEL\]" "$(_get_aws_config_path)" |
grep '^\[profile' |
sed -E 's/\[profile (.+)\]/\1/')"
fi
echo $profile
}
_terra_cmd() {
local aws_vault_profile="$(_get_default_aws_profile)"
local cmd_args=()
if [[ -z "$1" ]]; then
echo "Error: Missing required first argument"
echo "Usage: _terra_cmd [terraform|terragrunt] [additional args]"
return 1
fi
if [[ "$1" != "terraform" && "$1" != "terragrunt" ]]; then
echo "Error: First argument must be either 'terraform' or 'terragrunt'"
echo "Usage: _terra_cmd [terraform|terragrunt] [additional args]"
return 1
fi
# If we get here, the first argument is valid
local -r cmd="$1"
shift
while [[ $# -gt 0 ]]; do
case $1 in
-p | --profile)
if [[ $# -gt 1 ]]; then
aws_vault_profile="$2"
shift 2
else
echo "Error: -p|--profile requires a profile name"
return 1
fi
;;
*)
cmd_args+=("$1")
shift
;;
esac
done
aws-vault exec "$aws_vault_profile" -d 8h -- "$cmd" ${cmd_args[@]}
}
alias tf="_terra_cmd terraform"
alias tfi="tf init"
alias tfp="tf plan -lock=false"
alias tfa="tf apply"
alias tfu="tf get -update"
alias tg="_terra_cmd terragrunt"
alias tgi="tg init"
alias tgp="tg plan -lock=false"
alias tga="tg apply"
alias tgu="tg get -update"
alias curltime="curl -w \"@$HOME/.curl-format.txt\" -o /dev/null -s "
alias vi=nvim
alias vim=nvim
git_root() {
# Check if we're in a git repository
if ! git rev-parse --is-inside-work-tree &>/dev/null; then
echo "Error: Not in a git repository" >&2
return 1
fi
# Get the root of the git repository
local git_root
git_root=$(git rev-parse --show-toplevel)
if [ -n "$git_root" ]; then
echo "Changing directory to git root: $git_root"
cd "$git_root"
return 0
else
echo "Error: Could not determine git root directory" >&2
return 1
fi
}
alias groot="git_root"
git_push() {
# Check if we're in a git repository
if ! git rev-parse --is-inside-work-tree &>/dev/null; then
echo "Error: Not in a git repository" >&2
return 1
fi
local branch
branch=$(git branch --show-current)
git push origin "$branch" $@
}
alias gpush="git_push"
passgen() {
length=${1:-"12"}
if [[ "$length" == <-> ]]; then
echo $(cat /dev/urandom| base64 | head -c "$length")
else
echo "passgen() takes a positive integer as first argument"
echo "got $length"
return 1
fi
}

View File

@@ -8,6 +8,7 @@ export SAVEHIST=$HISTSIZE
export CLICOLOR=1
export DOTFILES="$HOME/dotfiles"
export K9S_CONFIG_DIR="$HOME/.config/k9s"
# colored GCC warnings and errors
export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
@@ -17,17 +18,8 @@ export MANPAGER='nvim +Man!'
export SSH_ENV="$HOME/.ssh/agent-environment"
export PATH=~/.local/bin:$PATH
case "$(uname -s)" in
Linux* ) {
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
};;
Darwin* ) {
eval "$(/opt/homebrew/bin/brew shellenv)"
export PATH="/opt/homebrew/opt/make/libexec/gnubin:$PATH"
};;
* ) ;;
esac
export GOPRIVATE="gitlab.feedzai.com,git.hcf.zone"
. "$HOME/.cargo/env"
export PATH

View File

@@ -8,60 +8,128 @@ setopt HIST_IGNORE_SPACE # Do not record an event starting with a space.
unsetopt HIST_SAVE_NO_DUPS # Do not write a duplicate event to the history file.
setopt SHARE_HISTORY # Share history between all sessions.
bindkey -e
bindkey '^R' history-incremental-search-backward
bindkey '^A' beginning-of-line
bindkey '^E' end-of-line
bindkey '^K' kill-line
bindkey "^[[1;5C" forward-word
bindkey "^[[1;5D" backward-word
setopt AUTO_PUSHD # Push the current directory visited on the stack.
setopt PUSHD_IGNORE_DUPS # Do not store duplicates in the stack.
setopt PUSHD_SILENT # Do not print the directory stack after pushd or popd.
DISABLE_AUTO_TITLE="true"
# install zsh-syntax-highlighting
case "$(uname -s)" in
Linux*) {
source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
# make less more friendly for non-text input files, see lesspipe(1)
local lesspipe_bin_location
lesspipe_bin_location=$(which lesspipe)
if [ $? -eq 0 ]; then
[ -x $lesspipe_bin_location ] && eval "$(lesspipe)"
fi
} ;;
Darwin*) {
source $(brew --prefix)/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
source "$(brew --prefix)/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
# make less more friendly for non-text input files, see lesspipe(1)
export LESSOPEN="|$(brew --prefix)/bin/lesspipe.sh %s"
} ;;
*) ;;
esac
bindkey "^[[1;5C" forward-word
bindkey "^[[1;5D" backward-word
source $DOTFILES/zsh/completion.zsh
fpath=($DOTFILES/zsh/zsh-completions/src $fpath)
# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
function start_ssh_agent {
echo "Initialising new SSH agent..."
/usr/bin/ssh-agent | sed 's/^echo/#echo/' >"${SSH_ENV}"
echo succeeded
chmod 600 "${SSH_ENV}"
. "${SSH_ENV}" >/dev/null
/usr/bin/ssh-add
}
# Source SSH settings, if applicable
#if [ -f "${SSH_ENV}" ]; then
# SSH_AGENT_PID="$(echo $(($(cat /proc/sys/kernel/pid_max) + 1)))"
# . "${SSH_ENV}" > /dev/null
# ps -ef | grep ${SSH_AGENT_PID} | grep 'ssh-agent$' > /dev/null || {
# start_ssh_agent;
# }
#else
# start_ssh_agent;
#fi
if [ -f ~/.zsh_aliases ]; then
. ~/.zsh_aliases
fi
function set_win_title(){
echo -ne "\033]0; $(basename "$PWD") \007"
# Set fpath before sourcing completion.zsh
fpath=("$DOTFILES/zsh/zsh-completions/src" $fpath)
# Source completion configuration
source "$DOTFILES/zsh/completion.zsh"
source "$DOTFILES/zsh/zsh-autosuggestions/zsh-autosuggestions.zsh"
# export starship_precmd_user_func="set_win_title"
#
# eval "$(starship init zsh)"
autoload -Uz vcs_info
setopt prompt_subst
zstyle ':vcs_info:*' enable git
zstyle ':vcs_info:*' max-exports 3
zstyle ':vcs_info:*+*:*' debug false
zstyle ':vcs_info:git:*' check-for-changes true
zstyle ':vcs_info:git:*' get-revision false
zstyle ':vcs_info:git:*' stagedstr '+'
zstyle ':vcs_info:git:*' unstagedstr '!'
zstyle ':vcs_info:git*:*' use-simple true
zstyle ':vcs_info:git*:*' cache-ttl 30 # Cache for 30 seconds
function preexec() {
# Command execution timer
timer=${timer:-$SECONDS}
# Check if the command is a git command
if [[ "$1" == git* || "$1" == "g "* ]]; then
__GIT_COMMAND_EXECUTED=1
else
__GIT_COMMAND_EXECUTED=0
fi
}
starship_precmd_user_func="set_win_title"
precmd() {
if [[ $__GIT_COMMAND_EXECUTED -eq 1 ]]; then
zstyle ':vcs_info:git*:*' cache-ttl 0
__GIT_COMMAND_EXECUTED=0
fi
vcs_info
zstyle ':vcs_info:git*:*' cache-ttl 30
eval "$(starship init zsh)"
PS1=$'%B%(?.%F{240}--.%F{red}!%?)%f '
if [[ -z ${vcs_info_msg_0_} ]]; then
PS1+=$'%F{cyan}%5~%f%b '
else
PS1+=$'%F{cyan}%3~%f%b ${vcs_info_msg_0_} '
fi
if [ $timer ]; then
timer_show=$(($SECONDS - $timer))
if [ $timer_show -gt 3 ]; then
PS1+=$'%F{240}-- %ftook %F{red}${timer_show}s %f'
fi
unset timer
fi
PS1+=$'\n;; '
}
zstyle ':vcs_info:git*' formats "%F{red}⎇ %b %F{blue}[%c%u] %F{240}(%F{red}%m%F{240})%f" # branch [staged unstaged(+untracked)] (misc(ahead/behind))
zstyle ':vcs_info:git*+set-message:*' hooks git-extra
function +vi-git-extra() {
# Only run these expensive operations in git repositories
if [[ -n ${hook_com[branch]} ]]; then
# Check if upstream exists before trying to get ahead/behind counts
if git rev-parse --verify ${hook_com[branch]}@{upstream} >/dev/null 2>&1; then
local ahead_behind=$(git rev-list --left-right --count HEAD...${hook_com[branch]}@{upstream} 2>/dev/null)
local ahead=$(echo $ahead_behind | awk '{print $1}')
local behind=$(echo $ahead_behind | awk '{print $2}')
[[ $ahead -gt 0 ]] && hook_com[misc]+="+"${ahead}
[[ $behind -gt 0 ]] && hook_com[misc]+=${hook_com[misc]:+"/"}"-"${behind}
fi
if [[ -n $(git ls-files --others --exclude-standard 2>/dev/null) ]]; then
hook_com[unstaged]+='?'
fi
fi
}

View File

@@ -1,26 +1,9 @@
# ____ ___ __ __ ____ _ _____ _____ ___ ___ _ _
# / ___/ _ \| \/ | _ \| | | ____|_ _|_ _/ _ \| \ | |
# | | | | | | |\/| | |_) | | | _| | | | | | | | \| |
# | |__| |_| | | | | __/| |___| |___ | | | | |_| | |\ |
# \____\___/|_| |_|_| |_____|_____| |_| |___\___/|_| \_|
#
# +---------+
# | General |
# +---------+
# source ./gambit.zsh
# Should be called before compinit
zmodload zsh/complist
autoload -U compinit; compinit
_comp_options+=(globdots) # With hidden files
# Only work with the Zsh function vman
# See $DOTFILES/zsh/scripts.zsh
compdef vman="man"
# +---------+
# | Options |
# +---------+