From e4581635db0dfdf7094426fb26b788ae3f7f47d4 Mon Sep 17 00:00:00 2001 From: Nulo Date: Thu, 19 Jan 2023 23:42:07 -0300 Subject: [PATCH] fish --- .config/fish/conf.d/0001-profile.fish | 35 +++++++++++++++++++++++++ .config/fish/conf.d/git-alias.fish | 23 ++++++++++++++++ .config/fish/conf.d/gpg-ssh.fish | 8 ++++++ .config/fish/conf.d/sway.fish | 17 ++++++++++++ .config/fish/config.fish | 10 +++++++ .config/fish/fish_variables | 31 ++++++++++++++++++++++ .config/fish/functions/e.fish | 3 +++ .config/fish/functions/fish_prompt.fish | 30 +++++++++++++++++++++ 8 files changed, 157 insertions(+) create mode 100644 .config/fish/conf.d/0001-profile.fish create mode 100644 .config/fish/conf.d/git-alias.fish create mode 100644 .config/fish/conf.d/gpg-ssh.fish create mode 100644 .config/fish/conf.d/sway.fish create mode 100644 .config/fish/config.fish create mode 100644 .config/fish/fish_variables create mode 100644 .config/fish/functions/e.fish create mode 100644 .config/fish/functions/fish_prompt.fish diff --git a/.config/fish/conf.d/0001-profile.fish b/.config/fish/conf.d/0001-profile.fish new file mode 100644 index 0000000..6c8473b --- /dev/null +++ b/.config/fish/conf.d/0001-profile.fish @@ -0,0 +1,35 @@ +ulimit -c unlimited + +export PNPM_HOME="$HOME/.local/share/pnpm" + +export PATH="$HOME/.local/bin:$PATH" +export PATH="$HOME/go/bin:$PATH" +export PATH="$PNPM_HOME:$PATH" + +export ZEIT_DB=~/Sync/zeit.db + +export EDITOR=hx + +export FZF_DEFAULT_COMMAND='rg -L --hidden --files' +export FZF_DEFAULT_OPTS='--multi --layout=reverse --preview-window=down:60%' +export FZF_CTRL_T_COMMAND='rg -L --hidden --files' + +export MOZ_ENABLE_WAYLAND=1 + +export QT_WAYLAND_DISABLE_WINDOWDECORATION=1 + +export XKB_DEFAULT_LAYOUT=us +export XKB_DEFAULT_VARIANT=altgr-intl +export XKB_DEFAULT_OPTIONS=caps:escape + +export XCURSOR_THEME=Adwaita + +export SVDIR="$HOME/.local/share/service" + +if test (hostname) = x69 + set -gx REMOTE false +end + +if test "$REMOTE" = "" + set -gx REMOTE true +end diff --git a/.config/fish/conf.d/git-alias.fish b/.config/fish/conf.d/git-alias.fish new file mode 100644 index 0000000..484a81d --- /dev/null +++ b/.config/fish/conf.d/git-alias.fish @@ -0,0 +1,23 @@ +alias g='git' +alias gc='git commit' +alias gcp='git commit -p' +alias gr='git restore' +alias grp='git restore -p' +alias gco='git checkout' +alias gl='git log' +alias gs='git status' +alias ga='git add' +alias gap='git add -p' +alias gt='git tag' +alias gp='git push' +alias gpo='git push origin' # Para tags: git push origin 1.0.2 / gpo 1.0.2 + +alias gitdf='git --git-dir=$HOME/.config/dotfiles/ --work-tree=$HOME' +alias gd='gitdf' +alias gdc='gitdf commit' +alias gdcp='gitdf commit -p' +alias gdl='git log' +alias gda='gitdf add' +alias gdap='gitdf add -p' +alias gds='gitdf status' +alias gdp='gitdf push' diff --git a/.config/fish/conf.d/gpg-ssh.fish b/.config/fish/conf.d/gpg-ssh.fish new file mode 100644 index 0000000..a3c927d --- /dev/null +++ b/.config/fish/conf.d/gpg-ssh.fish @@ -0,0 +1,8 @@ +if ! "$REMOTE" + set --erase SSH_AGENT_PID + # if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then + # Start if not started + gpg-agent --daemon 2>/dev/null + export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)" + # fi +end diff --git a/.config/fish/conf.d/sway.fish b/.config/fish/conf.d/sway.fish new file mode 100644 index 0000000..afd0e84 --- /dev/null +++ b/.config/fish/conf.d/sway.fish @@ -0,0 +1,17 @@ +if ! "$REMOTE" && test "$(tty)" = /dev/tty1 + doas mkdir -p /run/user + doas chmod 777 /run/user + set -gx XDG_RUNTIME_DIR "/run/user/$(id -u)" + mkdir -p "$XDG_RUNTIME_DIR" + chmod 700 "$XDG_RUNTIME_DIR" + mkdir -p "$HOME/.local/share/sway" + set log "$HOME/.local/share/sway/$(date +%Y-%m-%d@%H:%M:%S).log" + + pgrep -U "$(id -u)" runsv >/dev/null || { nohup runsvdir ~/.local/share/service ............. >/dev/null & } + + exec env \ + XDG_RUNTIME_DIR="$XDG_RUNTIME_DIR" \ + XDG_CURRENT_DESKTOP=sway \ + XDG_SESSION_DESKTOP=sway \ + dbus-run-session sway >"$log" 2>&1 +end diff --git a/.config/fish/config.fish b/.config/fish/config.fish new file mode 100644 index 0000000..2151f20 --- /dev/null +++ b/.config/fish/config.fish @@ -0,0 +1,10 @@ +source /usr/share/fzf/fzf-key-bindings.fish +fzf_key_bindings + +if status is-interactive + # Commands to run in interactive sessions can go here +end + +# tabtab source for packages +# uninstall by removing these lines +[ -f ~/.config/tabtab/fish/__tabtab.fish ]; and . ~/.config/tabtab/fish/__tabtab.fish; or true diff --git a/.config/fish/fish_variables b/.config/fish/fish_variables new file mode 100644 index 0000000..6085766 --- /dev/null +++ b/.config/fish/fish_variables @@ -0,0 +1,31 @@ +# This file contains fish universal variable definitions. +# VERSION: 3.0 +SETUVAR __fish_initialized:3400 +SETUVAR fish_color_autosuggestion:555\x1ebrblack +SETUVAR fish_color_cancel:\x2dr +SETUVAR fish_color_command:blue +SETUVAR fish_color_comment:red +SETUVAR fish_color_cwd:green +SETUVAR fish_color_cwd_root:red +SETUVAR fish_color_end:green +SETUVAR fish_color_error:brred +SETUVAR fish_color_escape:brcyan +SETUVAR fish_color_history_current:\x2d\x2dbold +SETUVAR fish_color_host:normal +SETUVAR fish_color_host_remote:yellow +SETUVAR fish_color_normal:normal +SETUVAR fish_color_operator:brcyan +SETUVAR fish_color_param:cyan +SETUVAR fish_color_quote:yellow +SETUVAR fish_color_redirection:cyan\x1e\x2d\x2dbold +SETUVAR fish_color_search_match:\x2d\x2dbackground\x3d111 +SETUVAR fish_color_selection:white\x1e\x2d\x2dbold\x1e\x2d\x2dbackground\x3dbrblack +SETUVAR fish_color_status:red +SETUVAR fish_color_user:brgreen +SETUVAR fish_color_valid_path:\x2d\x2dunderline +SETUVAR fish_key_bindings:fish_default_key_bindings +SETUVAR fish_pager_color_completion:normal +SETUVAR fish_pager_color_description:B3A06D\x1eyellow\x1e\x2di +SETUVAR fish_pager_color_prefix:cyan\x1e\x2d\x2dbold\x1e\x2d\x2dunderline +SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan +SETUVAR fish_pager_color_selected_background:\x2dr diff --git a/.config/fish/functions/e.fish b/.config/fish/functions/e.fish new file mode 100644 index 0000000..71b97bf --- /dev/null +++ b/.config/fish/functions/e.fish @@ -0,0 +1,3 @@ +function e --wraps=$EDITOR --description 'alias e=$EDITOR' + $EDITOR $argv; +end diff --git a/.config/fish/functions/fish_prompt.fish b/.config/fish/functions/fish_prompt.fish new file mode 100644 index 0000000..d58bf64 --- /dev/null +++ b/.config/fish/functions/fish_prompt.fish @@ -0,0 +1,30 @@ +function fish_prompt --description 'Write out the prompt' + set -l last_status $status + set -l normal (set_color normal) + set -l status_color (set_color brgreen) + set -l cwd_color (set_color $fish_color_cwd) + set -l vcs_color (set_color brpurple) + set -l prompt_status "" + + # Since we display the prompt on a new line allow the directory names to be longer. + set -q fish_prompt_pwd_dir_length + or set -lx fish_prompt_pwd_dir_length 0 + + # Color the prompt differently when we're root + set -l suffix '❯' + if functions -q fish_is_root_user; and fish_is_root_user + if set -q fish_color_cwd_root + set cwd_color (set_color $fish_color_cwd_root) + end + set suffix '#' + end + + # Color the prompt in red on error + if test $last_status -ne 0 + set status_color (set_color $fish_color_error) + set prompt_status $status_color "[" $last_status "]" $normal + end + + echo -s (prompt_login) ' ' $cwd_color (prompt_pwd) $vcs_color (fish_vcs_prompt) $normal ' ' $prompt_status + echo -n -s $status_color $suffix ' ' $normal +end