diff --git a/.gitmodules b/.gitmodules index 1ce5c11..f76fc5c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "dotbot"] - path = dotbot + path = submodules/dotbot url = https://github.com/anishathalye/dotbot +[submodule "fisher"] + path = submodules/fisher + url = https://github.com/jorgebucaran/fisher diff --git a/README.md b/README.md index a05206c..ca0ce06 100644 --- a/README.md +++ b/README.md @@ -16,12 +16,10 @@ pacman -S fish git curl # Do the dance git clone https://git.inhji.de/inhji/dotfiles.git .dotfiles -# Normal desktop +# Base install, rn installs only fish ~/.dotfiles/install # If installing on MNT Reform ~/.dotfiles/install -c install-reform.conf.yaml -# If installing on a headless server -~/.dotfiles/install -c install-headless.conf.yaml # Switch shells chsh -s /usr/bin/fish @@ -31,15 +29,8 @@ Install fisher ---------------- ```bash -# Debian/Ubuntu -curl -sL https://git.io/fisher | source && fisher install jorgebucaran/fisher - -# Arch Linux -yay -S fisher - -# Now install plugins -fisher install pure-fish/pure -fisher install jethrokuan/z +# Temporarily load fisher and then install all plugins in fish_plugins +curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish | source && fisher update ``` Tips diff --git a/config/fish/config.fish b/config/fish/config.fish index 0ab53ba..07ad222 100644 --- a/config/fish/config.fish +++ b/config/fish/config.fish @@ -2,6 +2,7 @@ set -x -U GOPATH $HOME/.go set PATH $PATH $HOME/.local/bin $HOME/.mix $HOME/.mix/escripts $HOME/.cargo/bin $GOPATH/bin +## Variables set DOTFILES $HOME/.dotfiles set NOTES $HOME/Documents/Sync/Notes/MyVault set TERMINAL 'alacritty' @@ -10,14 +11,11 @@ set -gx EDITOR 'nano' alias r='source ~/.config/fish/config.fish && echo "Fish config reloaded."' -if test -e /usr/bin/lsd - alias ls="lsd" - alias ll="lsd -lh" - alias la="lsd -A" -else - alias ls="ls" - alias ll="ls -lh" - alias la="ls -A" +## Environment setup + +# Apply .profile: use this to put fish compatible .profile stuff in +if test -f ~/.fish_profile + source ~/.fish_profile end if test -d $HOME/.asdf @@ -27,8 +25,47 @@ end alias up="sudo apt update && sudo apt list --upgradable" alias ug="sudo apt upgrade" +# Hide welcome message +set fish_greeting +set VIRTUAL_ENV_DISABLE_PROMPT "1" +set -x MANPAGER "sh -c 'col -bx | bat -l man -p'" + +## Functions + +function backup --argument filename + cp $filename $filename.bak +end + +## Useful aliases + +# Reload fish config +alias r='clear && source ~/.config/fish/config.fish' + +# Nicer ls if nothing els is available +alias ls="ls" +alias ll="ls -lh" +alias la="ls -A" +alias lt="ls -ald .*" + +# Replace ls with exa +if test -e /usr/bin/exa + alias ls='exa -al --color=always --group-directories-first --icons' # preferred listing + alias la='exa -a --color=always --group-directories-first --icons' # all files and dirs + alias ll='exa -l --color=always --group-directories-first --icons' # long format + alias lt='exa -aT --color=always --group-directories-first --icons' # tree listing + alias l.='exa -ald --color=always --group-directories-first --icons .*' # show only dotfiles +end + +# Add apt aliases for updating / upgrading if available +if test -e (whereis apt) + alias up="sudo apt update && sudo apt list --upgradable" + alias ug="sudo apt upgrade" +end + +# Elixir / phoenix aliases alias phx="iex -S mix phx.server" +# Systemd alias alias start="sudo systemctl start" alias restart="sudo systemctl restart" alias stop="sudo systemctl stop" @@ -36,11 +73,31 @@ alias enable="sudo systemctl enable" alias disable="sudo systemctl disable" alias sta="sudo systemctl status" -alias dot="hx $DOTFILES" -alias notes="hx $NOTES" +## Helpers +# Generate SSH key +alias sshkey='ssh-keygen -t ed25519 -f $HOME/.ssh/id_ed25519 -C "(whoami)@(hostname)-(date +'%y%m%d')"' + +# Get the error messages from journalctl +alias jctl="journalctl -p 3 -xb" + +# Recent installed packages +alias rip="expac --timefmt='%Y-%m-%d %T' '%l\t%n %v' | sort | tail -200 | nl" + +# Cleanup orphaned packages +alias cleanup='sudo pacman -Rns (pacman -Qtdq)' alias cal="ncal -3Mb" if status is-interactive # Commands to run in interactive sessions can go here end + +## Load asdf if available +if test -e ~/.asdf/asdf.fish + source ~/.asdf/asdf.fish +end + +## Run fastfetch if session is interactive +if status --is-interactive && type -q fastfetch + fastfetch --load-config neofetch +end \ No newline at end of file diff --git a/config/fish/fish_variables b/config/fish/fish_variables new file mode 100644 index 0000000..f2ea8ed --- /dev/null +++ b/config/fish/fish_variables @@ -0,0 +1,44 @@ +# This file contains fish universal variable definitions. +# VERSION: 3.0 +SETUVAR ZO_CMD:zo +SETUVAR Z_CMD:z +SETUVAR Z_DATA:/home/inhji/\x2elocal/share/z/data +SETUVAR Z_DATA_DIR:/home/inhji/\x2elocal/share/z +SETUVAR Z_EXCLUDE:\x5e/home/inhji\x24 +SETUVAR __fish_initialized:3400 +SETUVAR _fisher_danhper_2F_fish_2D_ssh_2D_agent_files:\x7e/\x2econfig/fish/functions/__ssh_agent_is_started\x2efish\x1e\x7e/\x2econfig/fish/functions/__ssh_agent_start\x2efish\x1e\x7e/\x2econfig/fish/conf\x2ed/fish\x2dssh\x2dagent\x2efish +SETUVAR _fisher_franciscolourenco_2F_done_files:\x7e/\x2econfig/fish/conf\x2ed/done\x2efish +SETUVAR _fisher_jethrokuan_2F_z_files:\x7e/\x2econfig/fish/functions/__z\x2efish\x1e\x7e/\x2econfig/fish/functions/__z_add\x2efish\x1e\x7e/\x2econfig/fish/functions/__z_clean\x2efish\x1e\x7e/\x2econfig/fish/functions/__z_complete\x2efish\x1e\x7e/\x2econfig/fish/conf\x2ed/z\x2efish +SETUVAR _fisher_jorgebucaran_2F_fisher_files:\x7e/\x2econfig/fish/functions/fisher\x2efish\x1e\x7e/\x2econfig/fish/completions/fisher\x2efish +SETUVAR _fisher_jorgebucaran_2F_hydro_files:\x7e/\x2econfig/fish/functions/fish_mode_prompt\x2efish\x1e\x7e/\x2econfig/fish/functions/fish_prompt\x2efish\x1e\x7e/\x2econfig/fish/conf\x2ed/hydro\x2efish +SETUVAR _fisher_plugins:jorgebucaran/fisher\x1ejethrokuan/z\x1efranciscolourenco/done\x1ejorgebucaran/hydro\x1edanhper/fish\x2dssh\x2dagent +SETUVAR _fisher_upgraded_to_4_4:\x1d +SETUVAR _hydro_git_58137:main\u2022\x20 +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:bryellow\x1e\x2d\x2dbackground\x3dbrblack +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:normal\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/git/gitconfig b/config/git/gitconfig index b4abfa8..2090c65 100644 --- a/config/git/gitconfig +++ b/config/git/gitconfig @@ -5,4 +5,6 @@ [core] excludesfile = ~/.gitignore [init] - defaultBranch = main \ No newline at end of file + defaultBranch = main +[pull] + ff = true diff --git a/docs/POSTINSTALL-REFORM.md b/docs/POSTINSTALL-REFORM.md deleted file mode 100644 index 9dc03d7..0000000 --- a/docs/POSTINSTALL-REFORM.md +++ /dev/null @@ -1,2 +0,0 @@ -# Postinstall for MNT Reform - diff --git a/install b/install index b1baa33..77a571b 100755 --- a/install +++ b/install @@ -3,7 +3,7 @@ set -e CONFIG="install.conf.yaml" -DOTBOT_DIR="dotbot" +DOTBOT_DIR="submodules/dotbot" DOTBOT_BIN="bin/dotbot" BASEDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" diff --git a/install-headless.conf.yaml b/install-headless.conf.yaml deleted file mode 100644 index bad62bb..0000000 --- a/install-headless.conf.yaml +++ /dev/null @@ -1,9 +0,0 @@ -- shell: - - [git submodule update --init --recursive, Updating submodules] - -- create: - - ~/.config - - ~/.config/fish - -- link: - ~/.config/fish/config.fish: config/fish/config.fish \ No newline at end of file diff --git a/install.conf.yaml b/install.conf.yaml new file mode 100644 index 0000000..6afb86d --- /dev/null +++ b/install.conf.yaml @@ -0,0 +1,19 @@ +- shell: + - [git submodule update --init --recursive, Updating submodules] + +- create: + - ~/.config + - ~/.config/fish + +- link: + ~/.gitconfig: config/git/gitconfig + ~/.gitignore: config/git/gitignore + ~/.ssh/config: config/ssh/config + ~/.config/fish: + glob: true + path: config/fish/* + +- shell: + - + command: ./scripts/fisher.sh + stdout: true \ No newline at end of file diff --git a/scripts/fisher.sh b/scripts/fisher.sh new file mode 100755 index 0000000..10142f9 --- /dev/null +++ b/scripts/fisher.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env fish +source ./submodules/fisher/functions/fisher.fish +fisher update \ No newline at end of file diff --git a/dotbot b/submodules/dotbot similarity index 100% rename from dotbot rename to submodules/dotbot diff --git a/submodules/fisher b/submodules/fisher new file mode 160000 index 0000000..ed7c28e --- /dev/null +++ b/submodules/fisher @@ -0,0 +1 @@ +Subproject commit ed7c28ea78515bebd368da3374db00dd5077afd5