mirror of
https://github.com/chenasraf/dotfiles.git
synced 2026-05-17 17:28:07 +00:00
refactor!: use stow
This commit is contained in:
@@ -284,9 +284,9 @@ local function nope()
|
|||||||
vim.keymap.set("n", "<leader>x", "<cmd>!chmod +x %<CR>", { silent = true, desc = "Make file executable" })
|
vim.keymap.set("n", "<leader>x", "<cmd>!chmod +x %<CR>", { silent = true, desc = "Make file executable" })
|
||||||
vim.keymap.set("n", "<leader>X", "<cmd>!chmod -x %<CR>", { silent = true, desc = "Make file not executable" })
|
vim.keymap.set("n", "<leader>X", "<cmd>!chmod -x %<CR>", { silent = true, desc = "Make file not executable" })
|
||||||
|
|
||||||
vim.keymap.set("n", "<leader>vpp", "<cmd>e ~/.dotfiles/.config/nvim/lua/casraf/packer.lua<CR>",
|
vim.keymap.set("n", "<leader>vpp", "<cmd>e ~/.config/nvim/lua/casraf/plugins/init.lua<CR>",
|
||||||
{ desc = "Edit packer config" });
|
{ desc = "Edit plugins config" });
|
||||||
vim.keymap.set("n", "<leader>vpr", "<cmd>e ~/.dotfiles/.config/nvim/lua/casraf/remap.lua<CR>",
|
vim.keymap.set("n", "<leader>vpr", "<cmd>e ~/.config/nvim/lua/casraf/plugins/remap.lua<CR>",
|
||||||
{ desc = "Edit remaps" });
|
{ desc = "Edit remaps" });
|
||||||
-- vim.keymap.set("n", "<leader>mir", "<cmd>CellularAutomaton make_it_rain<CR>", { desc = "Make it rain" });
|
-- vim.keymap.set("n", "<leader>mir", "<cmd>CellularAutomaton make_it_rain<CR>", { desc = "Make it rain" });
|
||||||
-- vim.keymap.set("n", "<leader>gol", "<cmd>CellularAutomaton game_of_life<CR>", { desc = "Game of life" });
|
-- vim.keymap.set("n", "<leader>gol", "<cmd>CellularAutomaton game_of_life<CR>", { desc = "Game of life" });
|
||||||
|
|||||||
@@ -25,35 +25,6 @@ install:
|
|||||||
# - category: 🧰 Configs & Dotfiles
|
# - category: 🧰 Configs & Dotfiles
|
||||||
# desc: Installers that sync dotfiles or apply local system configurations.
|
# desc: Installers that sync dotfiles or apply local system configurations.
|
||||||
|
|
||||||
- name: .config
|
|
||||||
type: rsync
|
|
||||||
tags: config dotfiles sofmani-config
|
|
||||||
skip_summary:
|
|
||||||
update: true
|
|
||||||
opts:
|
|
||||||
source: $DOTFILES/.config/
|
|
||||||
destination: ~/.config/
|
|
||||||
flags: --exclude lazygit.yml --exclude nvim --exclude .git --exclude .DS_Store --exclude 'tmux_*.yml'
|
|
||||||
|
|
||||||
- name: editorconfig
|
|
||||||
type: rsync
|
|
||||||
tags: config dotfiles
|
|
||||||
skip_summary:
|
|
||||||
update: true
|
|
||||||
opts:
|
|
||||||
source: $DOTFILES/.editorconfig.global
|
|
||||||
destination: ~/.editorconfig
|
|
||||||
|
|
||||||
- name: nvim-config
|
|
||||||
type: rsync
|
|
||||||
tags: config nvim-config
|
|
||||||
skip_summary:
|
|
||||||
update: true
|
|
||||||
opts:
|
|
||||||
source: $DOTFILES/.config/nvim/
|
|
||||||
destination: ~/.config/nvim/
|
|
||||||
flags: --delete --exclude .git --exclude .DS_Store
|
|
||||||
|
|
||||||
- name: tmux-config
|
- name: tmux-config
|
||||||
type: shell
|
type: shell
|
||||||
tags: config tmux
|
tags: config tmux
|
||||||
@@ -69,21 +40,22 @@ install:
|
|||||||
- name: tx-config
|
- name: tx-config
|
||||||
type: shell
|
type: shell
|
||||||
tags: config tmux
|
tags: config tmux
|
||||||
enabled: test -f "$DOTFILES/.config/tmux_{{ .DeviceIDAlias }}.yml"
|
enabled: test -f "$HOME/.config/tmux_{{ .DeviceIDAlias }}.yml"
|
||||||
check_installed: test -f ~/.config/tmux_local.yml
|
check_installed: test -f ~/.config/tmux_local.yml
|
||||||
check_has_update: '! diff -q "$DOTFILES/.config/tmux_{{ .DeviceIDAlias }}.yml" ~/.config/tmux_local.yml > /dev/null 2>&1'
|
check_has_update: '! diff -q "$HOME/.config/tmux_{{ .DeviceIDAlias }}.yml" ~/.config/tmux_local.yml > /dev/null 2>&1'
|
||||||
opts:
|
opts:
|
||||||
command: cp "$DOTFILES/.config/tmux_{{ .DeviceIDAlias }}.yml" ~/.config/tmux_local.yml
|
command: cp "$HOME/.config/tmux_{{ .DeviceIDAlias }}.yml" ~/.config/tmux_local.yml
|
||||||
update_command: cp "$DOTFILES/.config/tmux_{{ .DeviceIDAlias }}.yml" ~/.config/tmux_local.yml
|
update_command: cp "$HOME/.config/tmux_{{ .DeviceIDAlias }}.yml" ~/.config/tmux_local.yml
|
||||||
|
|
||||||
- name: lazygit-config
|
- name: lazygit-config
|
||||||
type: rsync
|
type: shell
|
||||||
tags: lazygit lazygit-config config
|
tags: lazygit lazygit-config config
|
||||||
skip_summary:
|
skip_summary:
|
||||||
update: true
|
update: true
|
||||||
opts:
|
opts:
|
||||||
source: $DOTFILES/.config/lazygit.yml
|
check_installed: test -L "$LAZYGIT_HOME/config.yml"
|
||||||
destination: $LAZYGIT_HOME/config.yml
|
command: ln -sf "$HOME/.config/lazygit.yml" "$LAZYGIT_HOME/config.yml"
|
||||||
|
update_command: ln -sf "$HOME/.config/lazygit.yml" "$LAZYGIT_HOME/config.yml"
|
||||||
|
|
||||||
- name: osx-defaults
|
- name: osx-defaults
|
||||||
type: shell
|
type: shell
|
||||||
@@ -150,7 +122,7 @@ install:
|
|||||||
git config --global gpg.format "ssh"
|
git config --global gpg.format "ssh"
|
||||||
git config --global gpg.ssh.allowedSignersFile "~/.ssh/allowed_signers"
|
git config --global gpg.ssh.allowedSignersFile "~/.ssh/allowed_signers"
|
||||||
git config --global commit.gpgsign true
|
git config --global commit.gpgsign true
|
||||||
git config --global maintenance.repo "~/.dotfiles"
|
git config --global maintenance.repo "$HOME/.dotfiles.git"
|
||||||
git config --global fetch.writeCommitGraph true
|
git config --global fetch.writeCommitGraph true
|
||||||
git config --global log.showSignature true
|
git config --global log.showSignature true
|
||||||
git config --global core.excludesfile ~/.config/.gitignore
|
git config --global core.excludesfile ~/.config/.gitignore
|
||||||
@@ -500,7 +472,7 @@ install:
|
|||||||
opts:
|
opts:
|
||||||
bin_name: tx
|
bin_name: tx
|
||||||
command: |
|
command: |
|
||||||
cd $DOTFILES/utils
|
cd $HOME/.config/dotfiles/utils
|
||||||
pnpm i && pnpm build && pnpm ginst
|
pnpm i && pnpm build && pnpm ginst
|
||||||
|
|
||||||
- name: pandoc
|
- name: pandoc
|
||||||
@@ -755,15 +727,7 @@ install:
|
|||||||
# - category: 🔌 Zsh & Tmux Plugins
|
# - category: 🔌 Zsh & Tmux Plugins
|
||||||
# desc: Git-based plugins and themes for Zsh shell and Tmux.
|
# desc: Git-based plugins and themes for Zsh shell and Tmux.
|
||||||
|
|
||||||
- name: local-plugins
|
# local-plugins: no longer needed — tracked in-place by bare repo at ~/.local/share/zsh/plugins/local/
|
||||||
type: rsync
|
|
||||||
tags: plugin config
|
|
||||||
post_install: source "$DOTFILES/plugins/loader.zsh"
|
|
||||||
post_update: source "$DOTFILES/plugins/loader.zsh"
|
|
||||||
opts:
|
|
||||||
source: ~/.dotfiles/plugins/
|
|
||||||
destination: ~/.local/share/zsh/plugins/local/
|
|
||||||
flags: --delete
|
|
||||||
|
|
||||||
- name: mfaerevaag/wd
|
- name: mfaerevaag/wd
|
||||||
type: git
|
type: git
|
||||||
|
|||||||
@@ -1,9 +1,39 @@
|
|||||||
|
root = true
|
||||||
|
|
||||||
[*]
|
[*]
|
||||||
tab_width = 2
|
charset = utf-8
|
||||||
indent_size = 2
|
end_of_line = lf
|
||||||
indent_style = space
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
tab_width = 2
|
||||||
insert_final_newline = true
|
insert_final_newline = true
|
||||||
trim_trailing_whitespace = true
|
trim_trailing_whitespace = true
|
||||||
|
|
||||||
[*.md]
|
[*.{md,markdown}]
|
||||||
trim_trailing_whitespace = false
|
trim_trailing_whitespace = false
|
||||||
|
|
||||||
|
[Makefile]
|
||||||
|
indent_style = tab
|
||||||
|
indent_size = 4
|
||||||
|
tab_width = 4
|
||||||
|
|
||||||
|
[*.py]
|
||||||
|
indent_size = 4
|
||||||
|
|
||||||
|
[*.go]
|
||||||
|
indent_style = tab
|
||||||
|
|
||||||
|
[*.gd]
|
||||||
|
indent_style = tab
|
||||||
|
indent_size = 4
|
||||||
|
tab_width = 4
|
||||||
|
|
||||||
|
[*.cs]
|
||||||
|
indent_size = 4
|
||||||
|
|
||||||
|
[*.{java,kt,kts}]
|
||||||
|
indent_size = 4
|
||||||
|
|
||||||
|
[*.{yml,yaml}]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
|||||||
@@ -1,39 +0,0 @@
|
|||||||
root = true
|
|
||||||
|
|
||||||
[*]
|
|
||||||
charset = utf-8
|
|
||||||
end_of_line = lf
|
|
||||||
indent_style = space
|
|
||||||
indent_size = 2
|
|
||||||
tab_width = 2
|
|
||||||
insert_final_newline = true
|
|
||||||
trim_trailing_whitespace = true
|
|
||||||
|
|
||||||
[*.{md,markdown}]
|
|
||||||
trim_trailing_whitespace = false
|
|
||||||
|
|
||||||
[Makefile]
|
|
||||||
indent_style = tab
|
|
||||||
indent_size = 4
|
|
||||||
tab_width = 4
|
|
||||||
|
|
||||||
[*.py]
|
|
||||||
indent_size = 4
|
|
||||||
|
|
||||||
[*.go]
|
|
||||||
indent_style = tab
|
|
||||||
|
|
||||||
[*.gd]
|
|
||||||
indent_style = tab
|
|
||||||
indent_size = 4
|
|
||||||
tab_width = 4
|
|
||||||
|
|
||||||
[*.cs]
|
|
||||||
indent_size = 4
|
|
||||||
|
|
||||||
[*.{java,kt,kts}]
|
|
||||||
indent_size = 4
|
|
||||||
|
|
||||||
[*.{yml,yaml}]
|
|
||||||
indent_style = space
|
|
||||||
indent_size = 2
|
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -11,3 +11,4 @@ plugins/.cache
|
|||||||
.config/local.tmux
|
.config/local.tmux
|
||||||
var/log/sofmani
|
var/log/sofmani
|
||||||
.config/tmux_local.yml
|
.config/tmux_local.yml
|
||||||
|
/_plugins/.cache
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
ascii-text() {
|
ascii-text() {
|
||||||
# ascii-font() {
|
# ascii-font() {
|
||||||
dir="$DOTFILES/plugins/ascii_font"
|
dir="${0:A:h}"
|
||||||
font="$dir/fonts/Big-Money-ne"
|
font="$dir/fonts/Big-Money-ne"
|
||||||
size=1
|
size=1
|
||||||
color=""
|
color=""
|
||||||
@@ -55,7 +55,7 @@ all_colors() {
|
|||||||
echo "Display all 256 terminal colors. Use -f to force regenerate the cache."
|
echo "Display all 256 terminal colors. Use -f to force regenerate the cache."
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
cache_file="$DOTFILES/plugins/.cache/colors.cache"
|
cache_file="$PLUGINS_DIR/local/.cache/colors.cache"
|
||||||
if [[ "$1" == "-f" ]]; then
|
if [[ "$1" == "-f" ]]; then
|
||||||
rm -f $cache_file
|
rm -f $cache_file
|
||||||
fi
|
fi
|
||||||
@@ -40,7 +40,7 @@ hscl() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Get the plugins directory (directory of this script)
|
# Get the plugins directory (directory of this script)
|
||||||
local plugins_dir="$DOTFILES/plugins"
|
local plugins_dir="$PLUGINS_DIR/local"
|
||||||
|
|
||||||
# Find all script files in plugins directory and subdirectories
|
# Find all script files in plugins directory and subdirectories
|
||||||
local script_files=("${plugins_dir}"/**/*.zsh(N))
|
local script_files=("${plugins_dir}"/**/*.zsh(N))
|
||||||
@@ -36,7 +36,7 @@ mdp() {
|
|||||||
done
|
done
|
||||||
|
|
||||||
filename=${1:-README.md}
|
filename=${1:-README.md}
|
||||||
html_file="$DOTFILES/plugins/assets/mdp-template.html"
|
html_file="$PLUGINS_DIR/local/assets/mdp-template.html"
|
||||||
title=$(basename $filename)
|
title=$(basename $filename)
|
||||||
filewoext="$(basename ${filename%.*})"
|
filewoext="$(basename ${filename%.*})"
|
||||||
|
|
||||||
24
.stow-local-ignore
Normal file
24
.stow-local-ignore
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
\.git
|
||||||
|
\.gitignore
|
||||||
|
\.stow-local-ignore
|
||||||
|
\.claude
|
||||||
|
\.DS_Store
|
||||||
|
\.device_uid
|
||||||
|
\.github
|
||||||
|
exports\.zsh
|
||||||
|
aliases\.zsh
|
||||||
|
_local\.zsh
|
||||||
|
autoload_completions\.zsh
|
||||||
|
completions
|
||||||
|
_plugins
|
||||||
|
utils
|
||||||
|
brew
|
||||||
|
node_modules
|
||||||
|
pnpm-lock\.yaml
|
||||||
|
README\.md
|
||||||
|
\.prettierrc
|
||||||
|
\.prettierignore
|
||||||
|
\.eslintignore
|
||||||
|
\.shellcheckrc
|
||||||
|
\.config/tmux_m1\.yml
|
||||||
|
\.config/tmux_planck\.yml
|
||||||
4
.zshrc
4
.zshrc
@@ -25,14 +25,14 @@ export DOTBIN_META="$HOME/.config/.bin"
|
|||||||
|
|
||||||
# Load sofmani-managed zsh plugins
|
# Load sofmani-managed zsh plugins
|
||||||
|
|
||||||
source "$DOTFILES/plugins/loader.zsh"
|
source "$DOTFILES/_plugins/loader.zsh"
|
||||||
|
|
||||||
wd() { . ~/.local/share/zsh/plugins/wd/wd.sh }
|
wd() { . ~/.local/share/zsh/plugins/wd/wd.sh }
|
||||||
|
|
||||||
source "$DOTFILES/exports.zsh"
|
source "$DOTFILES/exports.zsh"
|
||||||
|
|
||||||
if [[ -t 0 && -t 1 ]]; then
|
if [[ -t 0 && -t 1 ]]; then
|
||||||
[[ "$1" == "-q" ]] || run-parts "$DOTFILES/plugins/motd"
|
[[ "$1" == "-q" ]] || run-parts "$DOTFILES/_plugins/motd"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
|
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
|
||||||
|
|||||||
46
README.md
46
README.md
@@ -78,26 +78,60 @@ Some (but not all) of the plugins/modifications are listed here:
|
|||||||
|
|
||||||
## How to install
|
## How to install
|
||||||
|
|
||||||
1. Install zsh
|
1. Install zsh and [GNU Stow](https://www.gnu.org/software/stow/)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
brew install stow
|
||||||
|
```
|
||||||
|
|
||||||
2. Clone this repository into `~/.dotfiles`:
|
2. Clone this repository into `~/.dotfiles`:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git clone git@github.com:chenasraf/dotfiles.git --depth 1 ~/.dotfiles
|
git clone git@github.com:chenasraf/dotfiles.git --depth 1 ~/.dotfiles
|
||||||
```
|
```
|
||||||
|
|
||||||
3. Replace entire contents of `~/.zshrc` to the new version using (`ln -s` does **not** work):
|
3. Symlink configs into your home directory using stow:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
echo 'source "$HOME/.dotfiles/.zshrc"' > ~/.zshrc
|
cd ~/.dotfiles
|
||||||
|
stow -t ~ .
|
||||||
```
|
```
|
||||||
|
|
||||||
4. Run install scripts:
|
This creates symlinks for `.zshrc`, `.editorconfig`, `.config/*`, `.local/share/zsh/plugins/local/*`, etc.
|
||||||
|
Files listed in `.stow-local-ignore` (scripts, utilities, repo metadata) are excluded.
|
||||||
|
|
||||||
|
To restow after pulling changes:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
source ~/.dotfiles/install.zsh
|
cd ~/.dotfiles
|
||||||
|
stow -R -t ~ .
|
||||||
```
|
```
|
||||||
|
|
||||||
And reload the terminal
|
4. Install tools via [sofmani](https://github.com/chenasraf/sofmani):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sofmani
|
||||||
|
```
|
||||||
|
|
||||||
|
This handles brew packages, git plugins, language runtimes, and other dependencies.
|
||||||
|
|
||||||
|
### Structure
|
||||||
|
|
||||||
|
```
|
||||||
|
~/.dotfiles/
|
||||||
|
├── .config/ # App configs (aerospace, alacritty, ghostty, lazygit, nvim, tmux, wezterm, ...)
|
||||||
|
├── .local/ # Zsh plugins (stowed to ~/.local/share/zsh/plugins/local/)
|
||||||
|
├── .editorconfig # Global editorconfig (stowed to ~/.editorconfig)
|
||||||
|
├── .zshrc # Shell config (stowed to ~/.zshrc)
|
||||||
|
├── exports.zsh # Environment variables (sourced by .zshrc)
|
||||||
|
├── aliases.zsh # Shell aliases (sourced by .zshrc)
|
||||||
|
├── completions/ # Zsh completions (added to fpath by .zshrc)
|
||||||
|
├── _plugins/ # Plugin loader and MOTD scripts (sourced from $DOTFILES)
|
||||||
|
├── utils/ # Build utilities
|
||||||
|
└── .stow-local-ignore
|
||||||
|
```
|
||||||
|
|
||||||
|
Stow symlinks everything in the repo root into `~`, except items in `.stow-local-ignore` (scripts, utilities, and repo metadata that are sourced directly from `$DOTFILES`).
|
||||||
|
|
||||||
## My Other Stuff
|
## My Other Stuff
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env zsh
|
#!/usr/bin/env zsh
|
||||||
|
|
||||||
source "$DOTFILES/aliases.zsh"
|
source "$DOTFILES/aliases.zsh"
|
||||||
source $DOTFILES/plugins/ascii_font/ascii_font.plugin.zsh
|
source $DOTFILES/_plugins/ascii_font/ascii_font.plugin.zsh
|
||||||
|
|
||||||
if [[ $(hostname) == 'spider.casraf.dev' || $(hostname) == 'spider' ]]; then
|
if [[ $(hostname) == 'spider.casraf.dev' || $(hostname) == 'spider' ]]; then
|
||||||
text='spider'
|
text='spider'
|
||||||
@@ -87,9 +87,9 @@ alias hdiff="home git diff"
|
|||||||
alias hdiff1="home git diff HEAD~1"
|
alias hdiff1="home git diff HEAD~1"
|
||||||
alias hf="home git fetch"
|
alias hf="home git fetch"
|
||||||
alias hp="home push"
|
alias hp="home push"
|
||||||
alias hl="home pull && cp ~/.dotfiles/.config/sofmani.yml ~/.config/"
|
alias hl="home pull && stow -R -t ~ ."
|
||||||
alias hlog="home git log"
|
alias hlog="home git log"
|
||||||
alias motd="run-parts \$DOTFILES/plugins/motd"
|
alias motd="run-parts \$DOTFILES/_plugins/motd"
|
||||||
alias spider="ssh root@spider.casraf.dev"
|
alias spider="ssh root@spider.casraf.dev"
|
||||||
|
|
||||||
# docker
|
# docker
|
||||||
|
|||||||
@@ -15,10 +15,10 @@ export PLUGINS_DIR="$HOME/.local/share/zsh/plugins"
|
|||||||
export TMUX_PLUGINS_DIR="$HOME/.tmux/plugins"
|
export TMUX_PLUGINS_DIR="$HOME/.tmux/plugins"
|
||||||
|
|
||||||
# Lazygit
|
# Lazygit
|
||||||
if [[ -d "$HOME/Library/ApplicationSupport/lazygit" ]]; then
|
if [[ -d "$HOME/.config/lazygit" ]]; then
|
||||||
export LAZYGIT_HOME="$HOME/Library/ApplicationSupport/lazygit"
|
|
||||||
elif [[ -d "$HOME/.config/lazygit" ]]; then
|
|
||||||
export LAZYGIT_HOME="$HOME/.config/lazygit"
|
export LAZYGIT_HOME="$HOME/.config/lazygit"
|
||||||
|
elif [[ -d "$HOME/Library/ApplicationSupport/lazygit" ]]; then
|
||||||
|
export LAZYGIT_HOME="$HOME/Library/ApplicationSupport/lazygit"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Postgres.app
|
# Postgres.app
|
||||||
|
|||||||
Reference in New Issue
Block a user