diff --git a/.editorconfig b/.editorconfig index 846525b..b193834 100644 --- a/.editorconfig +++ b/.editorconfig @@ -14,7 +14,7 @@ max_line_length = 100 [*.lua] max_line_length = 120 -[*.php] +[*.{php,fish}] indent_size = 4 [.git{ignore,modules}] diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ce66432..2f2cfb9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -57,3 +57,9 @@ repos: rev: v2.0.2 hooks: - id: stylua # or stylua-system / stylua-github + + - repo: https://github.com/hugoh/pre-commit-fish.git + rev: v1.2 + hooks: + - id: fish_syntax + - id: fish_indent diff --git a/config/fish/alias.fish b/config/fish/alias.fish index 25484ee..05af302 100644 --- a/config/fish/alias.fish +++ b/config/fish/alias.fish @@ -3,70 +3,106 @@ alias vim='vim -u "$XDG_CONFIG_HOME/vim/vimrc"' # eza aliases if eza is installed -if type -q eza > /dev/null +if type -q eza >/dev/null + function eza_git -d "Use eza and its git options if in a git repo" + if git rev-parse --is-inside-work-tree &>/dev/null + eza --group-directories-first --icons=always --smart-group --git $argv + else + eza --group-directories-first --icons=always --smart-group $argv + end + end - function eza_git -d "Use eza and its git options if in a git repo" - if git rev-parse --is-inside-work-tree &>/dev/null - eza --group-directories-first --icons=always --smart-group --git $argv - else - eza --group-directories-first --icons=always --smart-group $argv - end - end + function lsa --wraps='eza_git -al' --description 'eza -al' + eza_git -al $argv + end - function lsa --wraps='eza_git -al' --description 'eza -al' - eza_git -al $argv - end + function ls --wraps='eza_git' --description eza + eza_git $argv + end - function ls --wraps='eza_git' --description 'eza' - eza_git $argv - end + function ll --wraps='eza_git -l' --description 'eza -l' + eza_git -l $argv + end - function ll --wraps='eza_git -l' --description 'eza -l' - eza_git -l $argv - end - - function l --wraps='eza_git' --description 'eza' - eza_git $argv - end + function l --wraps='eza_git' --description eza + eza_git $argv + end end # Edit fish alias file -function .a --wraps='nvim ~/.dotfiles/config/fish/alias.fish' --description 'alias .a=nvim ~/.dotfiles/config/fish/alias.fish' - nvim ~/.dotfiles/config/fish/alias.fish $argv - +function .a --wraps='nvim ~/.dotfiles/config/fish/alias.fish' --description 'edit alias.fish' + nvim ~/.dotfiles/config/fish/alias.fish $argv end # Go to the directory where my projects are stored function .c --wraps='cd ~/Code' --description 'cd ~/Code' - cd ~/Code $argv - + cd ~/Code $argv end # Go to the directory where the dotfiles are stored function .d --wraps='cd ~/.dotfiles' --description 'cd ~/.dotfiles' - cd ~/.dotfiles $argv - + cd ~/.dotfiles $argv end +# Go to the directory where my work codes are stored function .s --wraps='cd ~/Code/s' --description 'cd ~/Code/s' - cd ~/Code/s $argv + cd ~/Code/s $argv +end +# Go to the directory where my personal codes are stored +function .p --wraps='cd ~/Code/ivuorinen' --description 'cd ~/Code/ivuorinen' + cd ~/Code/ivuorinen $argv end # shortcut to commit with a message function commit --wraps='git commit -a -m "chore: automated commit"' --description 'commit shortcut' - set -l commitMessage $argv - git add . + set -l commitMessage $argv + git add . - if test -z "$commitMessage" - if type -q aicommits - aicommits --type conventional - else - git commit -a -m "chore: automated commit" + if test -z "$commitMessage" + if type -q aicommits + aicommits --type conventional + else + git commit -a -m "chore: automated commit" + end + return end - return - end - git commit -a -m "$commitMessage" - end + git commit -a -m "$commitMessage" +end +function configure_tide --description 'Configure tide with the lean style and my preferences' + tide configure \ + --auto \ + --style=Lean \ + --prompt_colors='True color' \ + --show_time=No \ + --lean_prompt_height='Two lines' \ + --prompt_connection=Disconnected \ + --prompt_spacing=Sparse \ + --icons='Many icons' \ + --transient=Yes +end + +# Abbreviations for git +abbr --add gau git add -u +abbr --add gaa git add -A +abbr --add gcv git commit -v + +# Abbreviations for composer +abbr --add c composer +abbr --add cu composer update +abbr --add ci composer install + +# Abbreviations for php artisan +abbr --add .pa php artisan +abbr --add .paf php artisan fresh +abbr --add .pam php artisan migrate +abbr --add .pams php artisan migrate --seed +abbr --add .pat php artisan test + +# Abbreviations for npm +abbr --add .n npm +abbr --add .nt npm test --if-present +abbr --add .nb npm run build --if-present +abbr --add .ns npm run start --if-present diff --git a/config/fish/config.fish b/config/fish/config.fish index bcbaf16..b95c062 100644 --- a/config/fish/config.fish +++ b/config/fish/config.fish @@ -3,10 +3,10 @@ # ╰──────────────────────────────────────────────────────────╯ test -e "$HOME/.config/fish/alias.fish" && - source "$HOME/.config/fish/alias.fish" + source "$HOME/.config/fish/alias.fish" test -e "$HOME/.config/fish/exports.fish" && - source "$HOME/.config/fish/exports.fish" + source "$HOME/.config/fish/exports.fish" if status is-interactive # Commands to run in interactive sessions can go here diff --git a/config/fish/exports.fish b/config/fish/exports.fish index 03957a0..2e18021 100644 --- a/config/fish/exports.fish +++ b/config/fish/exports.fish @@ -12,8 +12,8 @@ set -q XDG_RUNTIME_DIR; or set -x XDG_RUNTIME_DIR "$HOME/.local/run" set -q DOTFILES; or set -x DOTFILES "$HOME/.dotfiles" # Editor settings -set -q EDITOR; or set -x EDITOR "nvim" -set -q VISUAL; or set -x VISUAL "code" +set -q EDITOR; or set -x EDITOR nvim +set -q VISUAL; or set -x VISUAL code set -q HOSTNAME; or set -x HOSTNAME (hostname -s) # Add local bin to path @@ -58,19 +58,19 @@ set -q AWS_CONFIG_FILE; or set -x AWS_CONFIG_FILE "$XDG_STATE_HOME/aws/config" set -q AWS_SHARED_CREDENTIALS_FILE; or set -x AWS_SHARED_CREDENTIALS_FILE "$XDG_STATE_HOME/aws/credentials" set -q AWS_SESSION_TOKEN; or set -x AWS_SESSION_TOKEN "$XDG_STATE_HOME/aws/session_token" set -q AWS_DATA_PATH; or set -x AWS_DATA_PATH "$XDG_DATA_HOME/aws" -set -q AWS_DEFAULT_OUTPUT; or set -x AWS_DEFAULT_OUTPUT "table" -set -q AWS_CONFIGURE_KEYS; or set -x AWS_CONFIGURE_KEYS "true" -set -q AWS_CONFIGURE_SESSION; or set -x AWS_CONFIGURE_SESSION "true" -set -q AWS_CONFIGURE_SESSION_DURATION; or set -x AWS_CONFIGURE_SESSION_DURATION "7200" -set -q AWS_CONFIGURE_SESSION_MFA; or set -x AWS_CONFIGURE_SESSION_MFA "true" -set -q AWS_CONFIGURE_PROFILE; or set -x AWS_CONFIGURE_PROFILE "true" -set -q AWS_CONFIGURE_PROMPT; or set -x AWS_CONFIGURE_PROMPT "true" -set -q AWS_CONFIGURE_PROMPT_DEFAULT; or set -x AWS_CONFIGURE_PROMPT_DEFAULT "true" +set -q AWS_DEFAULT_OUTPUT; or set -x AWS_DEFAULT_OUTPUT table +set -q AWS_CONFIGURE_KEYS; or set -x AWS_CONFIGURE_KEYS true +set -q AWS_CONFIGURE_SESSION; or set -x AWS_CONFIGURE_SESSION true +set -q AWS_CONFIGURE_SESSION_DURATION; or set -x AWS_CONFIGURE_SESSION_DURATION 7200 +set -q AWS_CONFIGURE_SESSION_MFA; or set -x AWS_CONFIGURE_SESSION_MFA true +set -q AWS_CONFIGURE_PROFILE; or set -x AWS_CONFIGURE_PROFILE true +set -q AWS_CONFIGURE_PROMPT; or set -x AWS_CONFIGURE_PROMPT true +set -q AWS_CONFIGURE_PROMPT_DEFAULT; or set -x AWS_CONFIGURE_PROMPT_DEFAULT true # Brew configuration -set -q HOMEBREW_NO_ANALYTICS; or set -x HOMEBREW_NO_ANALYTICS "true" -set -q HOMEBREW_NO_ENV_HINTS; or set -x HOMEBREW_NO_ENV_HINTS "true" -set -q HOMEBREW_BUNDLE_MAS_SKIP; or set -x HOMEBREW_BUNDLE_MAS_SKIP "true" +set -q HOMEBREW_NO_ANALYTICS; or set -x HOMEBREW_NO_ANALYTICS true +set -q HOMEBREW_NO_ENV_HINTS; or set -x HOMEBREW_NO_ENV_HINTS true +set -q HOMEBREW_BUNDLE_MAS_SKIP; or set -x HOMEBREW_BUNDLE_MAS_SKIP true set -q HOMEBREW_BUNDLE_FILE; or set -x HOMEBREW_BUNDLE_FILE "$XDG_CONFIG_HOME/homebrew/Brewfile" # Composer configuration @@ -84,8 +84,8 @@ set -q DIRENV_LOG_FORMAT; or set -x DIRENV_LOG_FORMAT '' # Docker configuration set -q DOCKER_CONFIG; or set -x DOCKER_CONFIG "$XDG_CONFIG_HOME/docker" x-dc "$DOCKER_CONFIG" -set -q DOCKER_HIDE_LEGACY_COMMANDS; or set -x DOCKER_HIDE_LEGACY_COMMANDS "true" -set -q DOCKER_SCAN_SUGGEST; or set -x DOCKER_SCAN_SUGGEST "false" +set -q DOCKER_HIDE_LEGACY_COMMANDS; or set -x DOCKER_HIDE_LEGACY_COMMANDS true +set -q DOCKER_SCAN_SUGGEST; or set -x DOCKER_SCAN_SUGGEST false # fzf configuration set -q FZF_BASE; or set -x FZF_BASE "$XDG_CONFIG_HOME/fzf" @@ -113,7 +113,7 @@ set -q WORKON_HOME; or set -x WORKON_HOME "$XDG_DATA_HOME/virtualenvs" set -q PYENV_ROOT; or set -x PYENV_ROOT "$XDG_DATA_HOME/pyenv" fish_add_path "$PYENV_ROOT/bin" if x-have pyenv; and not functions -q pyenv - status --is-interactive; and source (pyenv init - | psub) + status --is-interactive; and source (pyenv init - | psub) end # Poetry configuration @@ -151,7 +151,7 @@ set -q TMUX_PLUGIN_MANAGER_PATH; or set -x TMUX_PLUGIN_MANAGER_PATH "$TMUX_PLUGI # Source tmux theme activation script for Fish shell if test -f "$DOTFILES/config/tmux/theme-activate.fish" - source "$DOTFILES/config/tmux/theme-activate.fish" + source "$DOTFILES/config/tmux/theme-activate.fish" end # tms configuration @@ -162,20 +162,20 @@ set -q WAKATIME_HOME; or set -x WAKATIME_HOME "$XDG_STATE_HOME/wakatime" x-dc "$WAKATIME_HOME" # Miscellaneous configuration -set -q CHEAT_USE_FZF; or set -x CHEAT_USE_FZF "true" +set -q CHEAT_USE_FZF; or set -x CHEAT_USE_FZF true set -q SQLITE_HISTORY; or set -x SQLITE_HISTORY "$XDG_CACHE_HOME/sqlite/sqlite_history" # Source additional configuration files if they exist if test -f "$DOTFILES/config/fish/exports-secret.fish" - source "$DOTFILES/config/fish/exports-secret.fish" + source "$DOTFILES/config/fish/exports-secret.fish" end if test -f "$DOTFILES/hosts/$HOSTNAME/config/fish/exports.fish" - source "$DOTFILES/hosts/$HOSTNAME/config/fish/exports.fish" + source "$DOTFILES/hosts/$HOSTNAME/config/fish/exports.fish" end if test -f "$DOTFILES/hosts/$HOSTNAME/config/fish/exports-secret.fish" - source "$DOTFILES/hosts/$HOSTNAME/config/fish/exports-secret.fish" + source "$DOTFILES/hosts/$HOSTNAME/config/fish/exports-secret.fish" end # Configure tide prompt