mirror of
https://github.com/ivuorinen/dotfiles.git
synced 2026-02-02 09:48:01 +00:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| cd0fff756e | |||
| f8bde72337 | |||
|
|
afd28f8469 |
4
.yamlfmt
4
.yamlfmt
@@ -18,7 +18,7 @@ include:
|
|||||||
- ./**/*.{yml,yaml}
|
- ./**/*.{yml,yaml}
|
||||||
|
|
||||||
exclude:
|
exclude:
|
||||||
- ./dotbot/**
|
- ./tools/dotbot/**
|
||||||
- ./dotbot-*/**
|
- ./tools/dotbot-*/**
|
||||||
- ./config/astronvim/**
|
- ./config/astronvim/**
|
||||||
- ./config/nvim/**
|
- ./config/nvim/**
|
||||||
|
|||||||
54
base/zshrc
54
base/zshrc
@@ -3,60 +3,8 @@
|
|||||||
# this is my zsh config. there are many like it, but this one is mine.
|
# this is my zsh config. there are many like it, but this one is mine.
|
||||||
# shellcheck shell=bash
|
# shellcheck shell=bash
|
||||||
|
|
||||||
export ZDOTDIR="$HOME/.local/state/zsh"
|
export ZDOTDIR="$HOME/.config/zsh/"
|
||||||
mkdir -p "$ZDOTDIR"
|
mkdir -p "$ZDOTDIR"
|
||||||
|
|
||||||
autoload -U colors zsh/terminfo
|
|
||||||
colors
|
|
||||||
setopt correct
|
|
||||||
|
|
||||||
# Add completion scripts to zsh path
|
|
||||||
FPATH="~/.config/zsh/completion:$FPATH"
|
|
||||||
autoload -Uz compinit && compinit -i
|
|
||||||
compinit -d "$XDG_CACHE_HOME"/zsh/zcompdump-"$ZSH_VERSION"
|
|
||||||
|
|
||||||
# Defaults
|
|
||||||
export DOTFILES="$HOME/.dotfiles"
|
|
||||||
# shellcheck source=shared.sh
|
|
||||||
source "$DOTFILES/scripts/shared.sh"
|
|
||||||
|
|
||||||
# Run x-load-configs in your terminal to reload the files.
|
|
||||||
function x-load-configs()
|
|
||||||
{
|
|
||||||
# Load the shell dotfiles, and then some:
|
|
||||||
for file in $DOTFILES/config/{exports,alias,functions}; do
|
|
||||||
[ -f "$file" ] && source "$file"
|
|
||||||
[ -f "$file-secret" ] && source "$file-secret"
|
|
||||||
[ -f "$file-$HOSTNAME" ] && source "$file-$HOSTNAME"
|
|
||||||
[ -f "$file-$HOSTNAME-secret" ] && source "$file-$HOSTNAME-secret"
|
|
||||||
done
|
|
||||||
}
|
|
||||||
x-load-configs
|
|
||||||
|
|
||||||
# Import ssh keys in keychain
|
|
||||||
ssh-add -A 2>/dev/null;
|
|
||||||
|
|
||||||
# Try to load antigen, if present
|
|
||||||
ANTIGEN_ZSH_PATH="$XDG_BIN_HOME/antigen.zsh"
|
|
||||||
[[ -f "$ANTIGEN_ZSH_PATH" ]] && source "$ANTIGEN_ZSH_PATH"
|
|
||||||
|
|
||||||
# antigen is present
|
|
||||||
have antigen && {
|
|
||||||
antigen use oh-my-zsh
|
|
||||||
|
|
||||||
# config/functions
|
|
||||||
x-default-antigen-bundles
|
|
||||||
|
|
||||||
antigen apply
|
|
||||||
}
|
|
||||||
|
|
||||||
# starship is present
|
|
||||||
have starship && eval "$(starship init zsh)"
|
|
||||||
|
|
||||||
[ -f "${XDG_CONFIG_HOME:-$HOME/.config}"/fzf/fzf.zsh ] \
|
|
||||||
&& source "${XDG_CONFIG_HOME:-$HOME/.config}"/fzf/fzf.zsh
|
|
||||||
|
|
||||||
export LESSHISTFILE="$XDG_CACHE_HOME"/less_history
|
|
||||||
|
|
||||||
# Fig post block. Keep at the bottom of this file.
|
# Fig post block. Keep at the bottom of this file.
|
||||||
[[ -f "$HOME/.fig/shell/zshrc.post.zsh" ]] && builtin source "$HOME/.fig/shell/zshrc.post.zsh"
|
[[ -f "$HOME/.fig/shell/zshrc.post.zsh" ]] && builtin source "$HOME/.fig/shell/zshrc.post.zsh"
|
||||||
|
|||||||
@@ -31,10 +31,10 @@ digga()
|
|||||||
dig +nocmd "$1" any +multiline +noall +answer
|
dig +nocmd "$1" any +multiline +noall +answer
|
||||||
}
|
}
|
||||||
|
|
||||||
# Rector project to php version 8.0 by default.
|
# Rector project to php version 8.2 by default.
|
||||||
rector()
|
rector()
|
||||||
{
|
{
|
||||||
local php="${1:-80}"
|
local php="${1:-82}"
|
||||||
docker run -v "$(pwd)":/project rector/rector:latest process \
|
docker run -v "$(pwd)":/project rector/rector:latest process \
|
||||||
"/project/$1" \
|
"/project/$1" \
|
||||||
--set "php${php}" \
|
--set "php${php}" \
|
||||||
@@ -100,7 +100,7 @@ x-default-antigen-bundles()
|
|||||||
have docker-compose && antigen bundle sroze/docker-compose-zsh-plugin
|
have docker-compose && antigen bundle sroze/docker-compose-zsh-plugin
|
||||||
have jq && antigen bundle reegnz/jq-zsh-plugin
|
have jq && antigen bundle reegnz/jq-zsh-plugin
|
||||||
have nvm && antigen bundle nvm
|
have nvm && antigen bundle nvm
|
||||||
have nvm && antigen bundle $DOTFILES/config/zsh/plugins/nvm-auto-use
|
have nvm && antigen bundle "$DOTFILES/config/zsh/plugins/nvm-auto-use"
|
||||||
have php && antigen bundle php
|
have php && antigen bundle php
|
||||||
have python && antigen bundle MichaelAquilina/zsh-autoswitch-virtualenv
|
have python && antigen bundle MichaelAquilina/zsh-autoswitch-virtualenv
|
||||||
have rvm && antigen bundle unixorn/rvm-plugin
|
have rvm && antigen bundle unixorn/rvm-plugin
|
||||||
|
|||||||
Submodule config/nvim updated: 8fe945f07a...d749be33f6
52
config/zsh/.zshrc
Normal file
52
config/zsh/.zshrc
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
autoload -U colors zsh/terminfo
|
||||||
|
colors
|
||||||
|
setopt correct
|
||||||
|
|
||||||
|
# Add completion scripts to zsh path
|
||||||
|
FPATH="~/.config/zsh/completion:$FPATH"
|
||||||
|
autoload -Uz compinit && compinit -i
|
||||||
|
compinit -d "$XDG_CACHE_HOME"/zsh/zcompdump-"$ZSH_VERSION"
|
||||||
|
|
||||||
|
# Defaults
|
||||||
|
export DOTFILES="$HOME/.dotfiles"
|
||||||
|
# shellcheck source=shared.sh
|
||||||
|
source "$DOTFILES/scripts/shared.sh"
|
||||||
|
|
||||||
|
# Run x-load-configs in your terminal to reload the files.
|
||||||
|
function x-load-configs()
|
||||||
|
{
|
||||||
|
# Load the shell dotfiles, and then some:
|
||||||
|
for file in $DOTFILES/config/{exports,alias,functions}; do
|
||||||
|
[ -f "$file" ] && source "$file"
|
||||||
|
[ -f "$file-secret" ] && source "$file-secret"
|
||||||
|
[ -f "$file-$HOSTNAME" ] && source "$file-$HOSTNAME"
|
||||||
|
[ -f "$file-$HOSTNAME-secret" ] && source "$file-$HOSTNAME-secret"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
x-load-configs
|
||||||
|
|
||||||
|
# Import ssh keys in keychain
|
||||||
|
ssh-add -A 2>/dev/null;
|
||||||
|
|
||||||
|
# Try to load antigen, if present
|
||||||
|
ANTIGEN_ZSH_PATH="$XDG_BIN_HOME/antigen.zsh"
|
||||||
|
[[ -f "$ANTIGEN_ZSH_PATH" ]] && source "$ANTIGEN_ZSH_PATH"
|
||||||
|
|
||||||
|
# antigen is present
|
||||||
|
have antigen && {
|
||||||
|
antigen use oh-my-zsh
|
||||||
|
|
||||||
|
# config/functions
|
||||||
|
x-default-antigen-bundles
|
||||||
|
|
||||||
|
antigen apply
|
||||||
|
}
|
||||||
|
|
||||||
|
# starship is present
|
||||||
|
have starship && eval "$(starship init zsh)"
|
||||||
|
|
||||||
|
[ -f "${XDG_CONFIG_HOME:-$HOME/.config}"/fzf/fzf.zsh ] \
|
||||||
|
&& source "${XDG_CONFIG_HOME:-$HOME/.config}"/fzf/fzf.zsh
|
||||||
|
|
||||||
|
export LESSHISTFILE="$XDG_CACHE_HOME"/less_history
|
||||||
|
|
||||||
@@ -1,174 +0,0 @@
|
|||||||
#compdef nb
|
|
||||||
###############################################################################
|
|
||||||
# __ _
|
|
||||||
# \ \ _ __ | |__
|
|
||||||
# \ \ | '_ \| '_ \
|
|
||||||
# / / | | | | |_) |
|
|
||||||
# /_/ |_| |_|_.__/
|
|
||||||
#
|
|
||||||
# [nb] Command line and local web note-taking, bookmarking, and archiving with
|
|
||||||
# plain text data storage, encryption, filtering and search, pinning, #tagging,
|
|
||||||
# Git-backed versioning and syncing, Pandoc-backed conversion, global and local
|
|
||||||
# notebooks, customizable color themes, [[wiki-style linking]], plugins, and
|
|
||||||
# more in a single portable, user-friendly script.
|
|
||||||
#
|
|
||||||
# https://github.com/xwmx/nb
|
|
||||||
###############################################################################
|
|
||||||
_nb_subcommands() {
|
|
||||||
# _nb_cache_completions()
|
|
||||||
#
|
|
||||||
# Usage:
|
|
||||||
# _nb_cache_completions <path>
|
|
||||||
#
|
|
||||||
# Description:
|
|
||||||
# Cache completions for `nb`. Generating completions can be slow and
|
|
||||||
# native shell caching doesn't appear to help.
|
|
||||||
_nb_cache_completions() {
|
|
||||||
local _cache_path="${1:-}"
|
|
||||||
|
|
||||||
[[ -z "${_cache_path:-}" ]] && return 0
|
|
||||||
|
|
||||||
# Remove outdated cache files.
|
|
||||||
|
|
||||||
local _base_cache_path="${_cache_path%-*}"
|
|
||||||
|
|
||||||
local __suffix=
|
|
||||||
for __suffix in "zsh" "v1"
|
|
||||||
do
|
|
||||||
if [[ -e "${_base_cache_path:?}-${__suffix:?}" ]]
|
|
||||||
then
|
|
||||||
rm -f "${_base_cache_path:?}-${__suffix:?}"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
# Rebuild completion cache.
|
|
||||||
|
|
||||||
local _commands=
|
|
||||||
IFS=$'\n' _commands=($(nb subcommands))
|
|
||||||
|
|
||||||
local _notebooks=
|
|
||||||
IFS=$'\n' _notebooks=($(nb notebooks --names --no-color --unarchived))
|
|
||||||
|
|
||||||
local _completions=()
|
|
||||||
IFS=$'\n' _completions=(${_commands[@]})
|
|
||||||
|
|
||||||
local _commands_cached=
|
|
||||||
local _notebooks_cached=
|
|
||||||
|
|
||||||
if [[ -e "${_cache_path}" ]]
|
|
||||||
then
|
|
||||||
local _counter=0
|
|
||||||
|
|
||||||
local __line=
|
|
||||||
while IFS= read -r __line
|
|
||||||
do
|
|
||||||
_counter=$((_counter+1))
|
|
||||||
|
|
||||||
if [[ "${_counter}" == 1 ]]
|
|
||||||
then
|
|
||||||
_commands_cached="${__line}"
|
|
||||||
elif [[ "${_counter}" == 2 ]]
|
|
||||||
then
|
|
||||||
_notebooks_cached="${__line}"
|
|
||||||
else
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done < "${_cache_path}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "${_commands_cached}" != "${_commands[*]:-}" ]] ||
|
|
||||||
[[ "${_notebooks_cached}" != "${_notebooks[*]:-}" ]]
|
|
||||||
then
|
|
||||||
# Construct <notebook>:<subcommand> completions.
|
|
||||||
local __notebook=
|
|
||||||
for __notebook in "${_notebooks[@]}"
|
|
||||||
do
|
|
||||||
local __command=
|
|
||||||
for __command in "${_commands[@]}"
|
|
||||||
do
|
|
||||||
if [[ -n "${__notebook:-}" ]] &&
|
|
||||||
[[ -n "${__command:-}" ]]
|
|
||||||
then
|
|
||||||
_completions+=("${__notebook}:${__command}")
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
done
|
|
||||||
|
|
||||||
local _directory_path=
|
|
||||||
_directory_path="$(dirname "${_cache_path}")"
|
|
||||||
|
|
||||||
mkdir -p "${_directory_path}"
|
|
||||||
|
|
||||||
if [[ -f "${_cache_path:?}" ]]
|
|
||||||
then
|
|
||||||
rm -f "${_cache_path:?}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
touch "${_cache_path:?}"
|
|
||||||
|
|
||||||
{
|
|
||||||
(IFS=$' '; printf "%s\\n" "${_commands[*]}")
|
|
||||||
(IFS=$' '; printf "%s\\n" "${_notebooks[*]}")
|
|
||||||
printf "%s\\n" "${_completions[@]}"
|
|
||||||
} >> "${_cache_path}"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
local _nb_dir=
|
|
||||||
_nb_dir="$(nb env | grep 'NB_DIR' | cut -d = -f 2)"
|
|
||||||
|
|
||||||
if [[ -z "${_nb_dir:?}" ]] ||
|
|
||||||
[[ ! -e "${_nb_dir}" ]]
|
|
||||||
then
|
|
||||||
return 0
|
|
||||||
elif [[ -L "${_nb_dir}" ]]
|
|
||||||
then
|
|
||||||
if hash "realpath" 2>/dev/null
|
|
||||||
then
|
|
||||||
_nb_dir="$(realpath "${_nb_dir}")"
|
|
||||||
else
|
|
||||||
_nb_dir="$(readlink "${_nb_dir}")"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ ! -d "${_nb_dir}" ]]
|
|
||||||
then
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
local _cache_path="${_nb_dir:?}/.cache/nb-completion-cache-v2"
|
|
||||||
local _completions_cached=()
|
|
||||||
|
|
||||||
if [[ ! -e "${_cache_path}" ]]
|
|
||||||
then
|
|
||||||
_nb_cache_completions "${_cache_path}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -e "${_cache_path}" ]]
|
|
||||||
then
|
|
||||||
local _counter=0
|
|
||||||
|
|
||||||
local __line=
|
|
||||||
while IFS= read -r __line
|
|
||||||
do
|
|
||||||
_counter=$((_counter+1))
|
|
||||||
|
|
||||||
if [[ "${_counter}" -gt 2 ]]
|
|
||||||
then
|
|
||||||
_completions_cached+=("${__line}")
|
|
||||||
fi
|
|
||||||
done < "${_cache_path}"
|
|
||||||
|
|
||||||
(_nb_cache_completions "${_cache_path}" &)
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "${?}" -eq 0 ]]
|
|
||||||
then
|
|
||||||
compadd -- "${_completions_cached[@]}"
|
|
||||||
return 0
|
|
||||||
else
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
_nb_subcommands "$@"
|
|
||||||
Reference in New Issue
Block a user