Compare commits
30 Commits
bffcdd8460
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| f100cffb79 | |||
| eaea388f20 | |||
| ff9efcca0d | |||
| 88b5c27c67 | |||
| 34b1fce40a | |||
| 5f0e53aee1 | |||
| dce5c22157 | |||
| 6e48cdf319 | |||
| 8f2d9fb72b | |||
| 7ee84040fa | |||
| d372b7c89b | |||
| 3993cd733e | |||
| 7d3ef607c2 | |||
| d4e4eaefa3 | |||
| 8ac127dd4d | |||
| 77e38d6fb1 | |||
| ef5a97eb61 | |||
| b0cbc93c8a | |||
| 2c50bc303b | |||
| fd9bc93cd2 | |||
| 35a41eee57 | |||
| 7c500df9f3 | |||
| cfb96ceb85 | |||
| d96bee448e | |||
| 81c3491c57 | |||
| e5bfcdac99 | |||
| a35a4793e3 | |||
| 7d43d9abd3 | |||
| 38f64e9fab | |||
| ba2b1aa855 |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1 +1,4 @@
|
||||
lazy-lock.json
|
||||
.gitconfig.local
|
||||
|
||||
k9s/.config/k9s/clusters
|
||||
|
||||
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -4,3 +4,6 @@
|
||||
[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
|
||||
|
||||
190
README.md
190
README.md
@@ -1,26 +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
|
||||
|
||||
- alacritty
|
||||
- zsh
|
||||
- homebrew/linuxbrew
|
||||
- stow
|
||||
- rust toolchain
|
||||
- starship
|
||||
- tmux
|
||||
- tmux-plugin-manager
|
||||
### 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
|
||||
- neovim
|
||||
- lua-language-server
|
||||
- stylua
|
||||
- luacheck
|
||||
- prettier
|
||||
- prettier-plugin-go-template
|
||||
- rust-analyzer
|
||||
- shfmt
|
||||
- bash-language-server
|
||||
- terraform
|
||||
- tflint
|
||||
- ruff
|
||||
- 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
|
||||
```
|
||||
|
||||
@@ -18,4 +18,4 @@ family = "jetbrainsmono nerd font"
|
||||
style = "Regular"
|
||||
|
||||
[general]
|
||||
import = ["~/.config/alacritty/dracula.toml"]
|
||||
import = ["~/.config/alacritty/colors/rose-pine.toml"]
|
||||
|
||||
75
alacritty/.config/alacritty/colors/rose-pine-dawn.toml
Normal file
75
alacritty/.config/alacritty/colors/rose-pine-dawn.toml
Normal 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"
|
||||
|
||||
75
alacritty/.config/alacritty/colors/rose-pine.toml
Normal file
75
alacritty/.config/alacritty/colors/rose-pine.toml
Normal 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"
|
||||
|
||||
23
git/.gitconfig
Normal file
23
git/.gitconfig
Normal 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
|
||||
5
git/.gitconfig.local.example
Normal file
5
git/.gitconfig.local.example
Normal 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
|
||||
9
k9s/.config/k9s/aliases.yaml
Normal file
9
k9s/.config/k9s/aliases.yaml
Normal file
@@ -0,0 +1,9 @@
|
||||
aliases:
|
||||
dp: deployments
|
||||
sec: v1/secrets
|
||||
jo: jobs
|
||||
cr: clusterroles
|
||||
crb: clusterrolebindings
|
||||
ro: roles
|
||||
rb: rolebindings
|
||||
np: networkpolicies
|
||||
42
k9s/.config/k9s/config.yaml
Normal file
42
k9s/.config/k9s/config.yaml
Normal 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
|
||||
115
k9s/.config/k9s/skins/dracula.yaml
Normal file
115
k9s/.config/k9s/skins/dracula.yaml
Normal file
@@ -0,0 +1,115 @@
|
||||
# -----------------------------------------------------------------------------
|
||||
# Dracula skin
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
# Styles...
|
||||
foreground: &foreground "#f8f8f2"
|
||||
background: &background "#282a36"
|
||||
current_line: ¤t_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
|
||||
100
k9s/.config/k9s/skins/rose-pine-dawn.yaml
Normal file
100
k9s/.config/k9s/skins/rose-pine-dawn.yaml
Normal 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"
|
||||
100
k9s/.config/k9s/skins/rose-pine.yaml
Normal file
100
k9s/.config/k9s/skins/rose-pine.yaml
Normal 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"
|
||||
@@ -1,6 +1,15 @@
|
||||
globals = {
|
||||
"vim",
|
||||
-- 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" } }
|
||||
|
||||
@@ -1,21 +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 }
|
||||
)
|
||||
-- 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 }
|
||||
-- )
|
||||
|
||||
5
nvim/.config/nvim/lsp/bashls.lua
Normal file
5
nvim/.config/nvim/lsp/bashls.lua
Normal file
@@ -0,0 +1,5 @@
|
||||
return {
|
||||
cmd = { "bash-language-server" },
|
||||
filetypes = { "sh", "bash", "zsh" },
|
||||
settings = {},
|
||||
}
|
||||
22
nvim/.config/nvim/lsp/gopls.lua
Normal file
22
nvim/.config/nvim/lsp/gopls.lua
Normal 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,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -10,11 +10,7 @@ return {
|
||||
runBuildScripts = true,
|
||||
},
|
||||
-- Add clippy lints for Rust
|
||||
checkOnSave = {
|
||||
allFeatures = true,
|
||||
command = "clippy",
|
||||
extraArgs = { "--no-deps" },
|
||||
},
|
||||
checkOnSave = true,
|
||||
procMacro = {
|
||||
enable = true,
|
||||
ignored = {
|
||||
|
||||
6
nvim/.config/nvim/lsp/terraform.lua
Normal file
6
nvim/.config/nvim/lsp/terraform.lua
Normal file
@@ -0,0 +1,6 @@
|
||||
return {
|
||||
cmd = { "terraform-ls", "serve" },
|
||||
root_markers = { ".terraform.lock", "backend.tf" },
|
||||
filetypes = { "terraform", "tf" },
|
||||
settings = {},
|
||||
}
|
||||
@@ -1,17 +1,17 @@
|
||||
-- Bootstrap lazy.nvim
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
|
||||
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
|
||||
if vim.v.shell_error ~= 0 then
|
||||
vim.api.nvim_echo({
|
||||
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
|
||||
{ out, "WarningMsg" },
|
||||
{ "\nPress any key to exit..." },
|
||||
}, true, {})
|
||||
vim.fn.getchar()
|
||||
os.exit(1)
|
||||
end
|
||||
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
|
||||
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
|
||||
if vim.v.shell_error ~= 0 then
|
||||
vim.api.nvim_echo({
|
||||
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
|
||||
{ out, "WarningMsg" },
|
||||
{ "\nPress any key to exit..." },
|
||||
}, true, {})
|
||||
vim.fn.getchar()
|
||||
os.exit(1)
|
||||
end
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
@@ -23,19 +23,19 @@ vim.g.maplocalleader = "\\"
|
||||
|
||||
-- Setup lazy.nvim
|
||||
require("lazy").setup({
|
||||
spec = {
|
||||
-- import your plugins
|
||||
{ import = "plugins" },
|
||||
},
|
||||
-- Configure any other settings here. See the documentation for more details.
|
||||
-- colorscheme that will be used when installing plugins.
|
||||
install = { colorscheme = { "dracula" } },
|
||||
-- automatically check for plugin updates
|
||||
checker = {
|
||||
enabled = false,
|
||||
concurrency = nil,
|
||||
notify = false,
|
||||
frequency = 3600,
|
||||
check_pinned = false,
|
||||
},
|
||||
spec = {
|
||||
-- import your plugins
|
||||
{ import = "plugins" },
|
||||
},
|
||||
-- Configure any other settings here. See the documentation for more details.
|
||||
-- colorscheme that will be used when installing plugins.
|
||||
install = { colorscheme = { "rose-pine" } },
|
||||
-- automatically check for plugin updates
|
||||
checker = {
|
||||
enabled = false,
|
||||
concurrency = nil,
|
||||
notify = false,
|
||||
frequency = 3600,
|
||||
check_pinned = false,
|
||||
},
|
||||
})
|
||||
|
||||
@@ -18,11 +18,12 @@ vim.opt.backup = false -- creates a backup file
|
||||
-- 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.opt.completeopt = "menuone,noselect" -- Set completeopt to have a better completion experience
|
||||
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}
|
||||
@@ -72,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
|
||||
@@ -94,6 +100,7 @@ vim.filetype.add({
|
||||
},
|
||||
pattern = {
|
||||
[".*/recipes/.*%.ya?ml"] = "gotmpl",
|
||||
[".*%.sh.tmpl"] = "bash",
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
@@ -1,4 +1,12 @@
|
||||
--- [[ 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 = {
|
||||
@@ -9,13 +17,6 @@ vim.lsp.config("*", {
|
||||
},
|
||||
})
|
||||
|
||||
vim.lsp.config("rust", {
|
||||
filetypes = { "rust" },
|
||||
})
|
||||
|
||||
vim.lsp.enable("luals")
|
||||
vim.lsp.enable("rust")
|
||||
|
||||
-- [[FOLDING SETUP
|
||||
-- Prefer LSP folding if client supports it
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
@@ -31,59 +32,12 @@ vim.api.nvim_create_autocmd("LspAttach", {
|
||||
})
|
||||
-- ]]
|
||||
|
||||
---[[AUTOCOMPLETION SETUP
|
||||
vim.o.completeopt = "menuone,noinsert,popup,fuzzy"
|
||||
-- [[INLAY HINTS
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
callback = function(args)
|
||||
local client = assert(vim.lsp.get_client_by_id(args.data.client_id))
|
||||
client.server_capabilities.completionProvider.triggerCharacters = vim.split("qwertyuiopasdfghjklzxcvbnm. ", "")
|
||||
vim.api.nvim_create_autocmd({ "TextChangedI" }, {
|
||||
buffer = args.buf,
|
||||
callback = function()
|
||||
vim.lsp.completion.get()
|
||||
end,
|
||||
})
|
||||
-- if client:supports_method("textDocument/implementation") then
|
||||
-- Create a keymap for vim.lsp.buf.implementation ...
|
||||
-- end
|
||||
if client.server_capabilities.inlayHintProvider then
|
||||
vim.lsp.inlay_hint.enable(true, { bufnr = vim.fn.bufnr() })
|
||||
end
|
||||
vim.lsp.completion.enable(true, client.id, args.buf, { autotrigger = true })
|
||||
---
|
||||
---[[Code required to add documentation popup for an item
|
||||
local _, cancel_prev = nil, function() end
|
||||
vim.api.nvim_create_autocmd("CompleteChanged", {
|
||||
buffer = args.buf,
|
||||
callback = function()
|
||||
if client:supports_method("textDocument/implementation") then
|
||||
cancel_prev()
|
||||
local info = vim.fn.complete_info({ "selected" })
|
||||
local completionItem =
|
||||
vim.tbl_get(vim.v.completed_item, "user_data", "nvim", "lsp", "completion_item")
|
||||
if nil == completionItem then
|
||||
return
|
||||
end
|
||||
_, cancel_prev = vim.lsp.buf_request(
|
||||
args.buf,
|
||||
vim.lsp.protocol.Methods.completionItem_resolve,
|
||||
completionItem,
|
||||
function(err, item, ctx)
|
||||
if not item then
|
||||
return
|
||||
end
|
||||
local docs = (item.documentation or {}).value
|
||||
local win = vim.api.nvim__complete_set(info["selected"], { info = docs })
|
||||
if win.winid and vim.api.nvim_win_is_valid(win.winid) then
|
||||
vim.treesitter.start(win.bufnr, "markdown")
|
||||
vim.wo[win.winid].conceallevel = 3
|
||||
end
|
||||
end
|
||||
)
|
||||
end
|
||||
end,
|
||||
})
|
||||
---]]
|
||||
end,
|
||||
})
|
||||
---AUTOCOMPLETION SETUP END]]
|
||||
|
||||
111
nvim/.config/nvim/lua/plugins/completion.lua
Normal file
111
nvim/.config/nvim/lua/plugins/completion.lua
Normal file
@@ -0,0 +1,111 @@
|
||||
return {
|
||||
{
|
||||
"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",
|
||||
-- use a release tag to download pre-built binaries
|
||||
version = "1.*",
|
||||
dependencies = {
|
||||
"moyiz/blink-emoji.nvim",
|
||||
},
|
||||
---@module 'blink.cmp'
|
||||
---@type blink.cmp.Config
|
||||
opts = {
|
||||
-- '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 = {
|
||||
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", "emoji" },
|
||||
providers = {
|
||||
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,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- (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" },
|
||||
},
|
||||
}
|
||||
@@ -10,6 +10,7 @@ return {
|
||||
configs.setup({
|
||||
ensure_installed = {
|
||||
"bash",
|
||||
--"zsh",
|
||||
"c",
|
||||
"cmake",
|
||||
"dockerfile",
|
||||
@@ -88,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" },
|
||||
|
||||
@@ -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 })
|
||||
|
||||
|
||||
@@ -43,11 +43,22 @@ return {
|
||||
"node_modules",
|
||||
"target",
|
||||
".terraform",
|
||||
".git",
|
||||
".venv",
|
||||
"Cargo.toml",
|
||||
".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",
|
||||
|
||||
@@ -1,30 +1,29 @@
|
||||
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
|
||||
@@ -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",
|
||||
@@ -170,4 +192,16 @@ return {
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"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,
|
||||
},
|
||||
}
|
||||
|
||||
353
nvim/.config/nvim/snippets/bash.lua
Normal file
353
nvim/.config/nvim/snippets/bash.lua
Normal 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
|
||||
79
nvim/.config/nvim/snippets/lua.lua
Normal file
79
nvim/.config/nvim/snippets/lua.lua
Normal 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
|
||||
75
nvim/.config/nvim/snippets/python.lua
Normal file
75
nvim/.config/nvim/snippets/python.lua
Normal 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
|
||||
340
nvim/.config/nvim/snippets/rust.lua
Normal file
340
nvim/.config/nvim/snippets/rust.lua
Normal 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
|
||||
297
nvim/.config/nvim/snippets/terraform.lua
Normal file
297
nvim/.config/nvim/snippets/terraform.lua
Normal 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
|
||||
61
scripts/hcf/package_repo_changes
Executable file
61
scripts/hcf/package_repo_changes
Executable 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
75
scripts/hcf/rose_pine_switch
Executable 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
|
||||
5
telegram/.config/autostart/org.telegram.desktop.desktop
Executable file
5
telegram/.config/autostart/org.telegram.desktop.desktop
Executable 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
|
||||
@@ -4,20 +4,18 @@
|
||||
tty=$1
|
||||
|
||||
# Construct process tree.
|
||||
children=();
|
||||
pids=( $(ps -o pid= -t $tty) )
|
||||
children=()
|
||||
pids=($(ps -o pid= -t $tty))
|
||||
|
||||
while read -r pid ppid
|
||||
do
|
||||
[[ -n pid && pid -ne ppid ]] && children[ppid]+=" $pid"
|
||||
done <<< "$(ps -Ao pid=,ppid=)"
|
||||
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
|
||||
pid=${pids[idx++]}
|
||||
pids+=( ${children[pid]-} )
|
||||
while ((${#pids[@]} > idx)); do
|
||||
pid=${pids[idx++]}
|
||||
pids+=(${children[pid]-})
|
||||
done
|
||||
|
||||
# Check whether any child pids are vim
|
||||
|
||||
@@ -19,20 +19,34 @@ 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}"
|
||||
|
||||
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
|
||||
|
||||
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 -g default-command "$SHELL -i"
|
||||
set-option -g allow-rename off
|
||||
|
||||
set-option -sa terminal-features ',alacritty:RGB'
|
||||
set-option -ga terminal-features ",alacritty:usstyle"
|
||||
@@ -45,15 +59,18 @@ set -g default-terminal "alacritty"
|
||||
###############################################################################
|
||||
###############################################################################
|
||||
|
||||
set -g @plugin 'dracula/tmux'
|
||||
set -g @plugin 'rose-pine/tmux'
|
||||
set -g @rose_pine_variant 'main' # Options are 'main', 'moon' or 'dawn'
|
||||
|
||||
set -g @dracula-plugins "git weather time continuum 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 @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'
|
||||
|
||||
@@ -65,6 +82,23 @@ 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 ###
|
||||
@@ -78,9 +112,8 @@ 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'
|
||||
set -g @dracula-continuum-mode countdown
|
||||
set -g @continuum-restore 'on'
|
||||
set -g @continuum-boot 'on'
|
||||
|
||||
### tmux-resurrect
|
||||
set -g @resurrect-save 'S' # prefix + Shift-s - save
|
||||
@@ -88,7 +121,15 @@ set -g @resurrect-restore 'R' # prefix + Shift-r - restore
|
||||
# for neovim
|
||||
set -g @resurrect-strategy-nvim 'session'
|
||||
|
||||
set -g @continuum-boot-options 'alacritty,fullscreen'
|
||||
# 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'
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
###############################################################################
|
||||
|
||||
BIN
wallpaper/.wallpapers/blockwavemoon.png
Normal file
BIN
wallpaper/.wallpapers/blockwavemoon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1024 KiB |
BIN
wallpaper/.wallpapers/rosepine-birb.png
Normal file
BIN
wallpaper/.wallpapers/rosepine-birb.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 39 KiB |
15
zsh/.zprofile
Normal file
15
zsh/.zprofile
Normal 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"
|
||||
151
zsh/.zsh_aliases
151
zsh/.zsh_aliases
@@ -11,24 +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"
|
||||
}
|
||||
|
||||
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"
|
||||
# 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:
|
||||
#
|
||||
# > [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'
|
||||
_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
|
||||
}
|
||||
|
||||
16
zsh/.zshenv
16
zsh/.zshenv
@@ -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
|
||||
|
||||
165
zsh/.zshrc
165
zsh/.zshrc
@@ -1,72 +1,135 @@
|
||||
setopt INC_APPEND_HISTORY
|
||||
setopt EXTENDED_HISTORY # Write the history file in the ':start:elapsed;command' format.
|
||||
setopt HIST_EXPIRE_DUPS_FIRST # Expire a duplicate event first when trimming history.
|
||||
setopt HIST_FIND_NO_DUPS # Do not display a previously found event.
|
||||
setopt HIST_IGNORE_ALL_DUPS # Delete an old recorded event if a new event is a duplicate.
|
||||
setopt HIST_IGNORE_DUPS # Do not record an event that was just recorded again.
|
||||
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.
|
||||
setopt EXTENDED_HISTORY # Write the history file in the ':start:elapsed;command' format.
|
||||
setopt HIST_EXPIRE_DUPS_FIRST # Expire a duplicate event first when trimming history.
|
||||
setopt HIST_FIND_NO_DUPS # Do not display a previously found event.
|
||||
setopt HIST_IGNORE_ALL_DUPS # Delete an old recorded event if a new event is a duplicate.
|
||||
setopt HIST_IGNORE_DUPS # Do not record an event that was just recorded again.
|
||||
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
|
||||
|
||||
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.
|
||||
|
||||
# install zsh-syntax-highlighting
|
||||
case "$(uname -s)" in
|
||||
Linux* ) {
|
||||
source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
|
||||
};;
|
||||
Darwin* ) {
|
||||
source $(brew --prefix)/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
|
||||
};;
|
||||
* ) ;;
|
||||
esac
|
||||
|
||||
bindkey "^[[1;5C" forward-word
|
||||
bindkey "^[[1;5D" backward-word
|
||||
|
||||
source $DOTFILES/zsh/completion.zsh
|
||||
fpath=($DOTFILES/zsh/zsh-completions/src $fpath)
|
||||
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.
|
||||
|
||||
# make less more friendly for non-text input files, see lesspipe(1)
|
||||
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
|
||||
DISABLE_AUTO_TITLE="true"
|
||||
|
||||
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
|
||||
# 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"
|
||||
# make less more friendly for non-text input files, see lesspipe(1)
|
||||
export LESSOPEN="|$(brew --prefix)/bin/lesspipe.sh %s"
|
||||
} ;;
|
||||
*) ;;
|
||||
esac
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
@@ -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 |
|
||||
# +---------+
|
||||
|
||||
1
zsh/zsh-autosuggestions
Submodule
1
zsh/zsh-autosuggestions
Submodule
Submodule zsh/zsh-autosuggestions added at 85919cd1ff
Submodule zsh/zsh-completions updated: 7f0a0c4451...922abfe707
Reference in New Issue
Block a user