From 3a5cb0cc4b81c6b5e7b62bb11b74b52ec853c194 Mon Sep 17 00:00:00 2001 From: Devon Tingley Date: Mon, 24 Jan 2022 21:32:52 -0500 Subject: [PATCH] Switch to fish, fix script for dotfiles, update install list --- .zshrc | 33 ---- {.config => dotfiles}/alacritty/alacritty.yml | 0 dotfiles/fish/config.fish | 3 + dotfiles/fish/fish_variables | 31 ++++ dotfiles/fish/functions/fish_greeting.fish | 3 + dotfiles/fish/functions/fish_prompt.fish | 90 +++++++++++ {.config => dotfiles}/i3/config | 0 .../i3status-rust/config.toml | 0 {.config => dotfiles}/nvim/init.vim | 0 dotfiles/rofi/config.rasi | 151 ++++++++++++++++++ setup.sh | 29 ++-- 11 files changed, 288 insertions(+), 52 deletions(-) delete mode 100644 .zshrc rename {.config => dotfiles}/alacritty/alacritty.yml (100%) create mode 100644 dotfiles/fish/config.fish create mode 100644 dotfiles/fish/fish_variables create mode 100644 dotfiles/fish/functions/fish_greeting.fish create mode 100644 dotfiles/fish/functions/fish_prompt.fish rename {.config => dotfiles}/i3/config (100%) rename {.config => dotfiles}/i3status-rust/config.toml (100%) rename {.config => dotfiles}/nvim/init.vim (100%) create mode 100644 dotfiles/rofi/config.rasi diff --git a/.zshrc b/.zshrc deleted file mode 100644 index 50704a0..0000000 --- a/.zshrc +++ /dev/null @@ -1,33 +0,0 @@ -if [[ "$(uname)" == "Darwin" ]]; then - export ZSH="/Users/$(whoami)/.oh-my-zsh" -elif [[ "$(expr substr $(uname -s) 1 5)" == "Linux" ]]; then - export ZSH="/home/$(whoami)/.oh-my-zsh" -fi - -ZSH_THEME="robbyrussell" -ZSH_DISABLE_COMPFIX="true" - -plugins=( - git - z - zsh-autosuggestions - sudo - thefuck - redis-cli - golang - docker - docker-compose - rust - python - yarn -) - -export GDK_SCALE=1.5 -export GDK_DPI_SCALE=1.5 -export QT_AUTO_SCREEN_SCALE_FACTOR=1.5 - -source $ZSH/oh-my-zsh.sh -export PATH=$PATH:/opt/texlive/2021/bin/x86_64-linux -export CHROME_EXECUTABLE=/usr/bin/chromium - -# export $(grep -v '^#' .env | tr -d '"' | xargs -d '\n') diff --git a/.config/alacritty/alacritty.yml b/dotfiles/alacritty/alacritty.yml similarity index 100% rename from .config/alacritty/alacritty.yml rename to dotfiles/alacritty/alacritty.yml diff --git a/dotfiles/fish/config.fish b/dotfiles/fish/config.fish new file mode 100644 index 0000000..52a5b3a --- /dev/null +++ b/dotfiles/fish/config.fish @@ -0,0 +1,3 @@ +if status is-interactive + zoxide init fish | source +end diff --git a/dotfiles/fish/fish_variables b/dotfiles/fish/fish_variables new file mode 100644 index 0000000..c76e98a --- /dev/null +++ b/dotfiles/fish/fish_variables @@ -0,0 +1,31 @@ +# This file contains fish universal variable definitions. +# VERSION: 3.0 +SETUVAR __fish_initialized:3100 +SETUVAR fish_color_autosuggestion:585858 +SETUVAR fish_color_cancel:\x2dr +SETUVAR fish_color_command:a1b56c +SETUVAR fish_color_comment:f7ca88 +SETUVAR fish_color_cwd:green +SETUVAR fish_color_cwd_root:red +SETUVAR fish_color_end:ba8baf +SETUVAR fish_color_error:ab4642 +SETUVAR fish_color_escape:86c1b9 +SETUVAR fish_color_history_current:\x2d\x2dbold +SETUVAR fish_color_host:normal +SETUVAR fish_color_host_remote:yellow +SETUVAR fish_color_match:7cafc2 +SETUVAR fish_color_normal:normal +SETUVAR fish_color_operator:7cafc2 +SETUVAR fish_color_param:d8d8d8 +SETUVAR fish_color_quote:f7ca88 +SETUVAR fish_color_redirection:d8d8d8 +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 +SETUVAR fish_pager_color_prefix:normal\x1e\x2d\x2dbold\x1e\x2d\x2dunderline +SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan diff --git a/dotfiles/fish/functions/fish_greeting.fish b/dotfiles/fish/functions/fish_greeting.fish new file mode 100644 index 0000000..d4b85c2 --- /dev/null +++ b/dotfiles/fish/functions/fish_greeting.fish @@ -0,0 +1,3 @@ +function fish_greeting + date +end diff --git a/dotfiles/fish/functions/fish_prompt.fish b/dotfiles/fish/functions/fish_prompt.fish new file mode 100644 index 0000000..8b1d19c --- /dev/null +++ b/dotfiles/fish/functions/fish_prompt.fish @@ -0,0 +1,90 @@ +function fish_prompt + set -l __last_command_exit_status $status + + if not set -q -g __fish_arrow_functions_defined + set -g __fish_arrow_functions_defined + function _git_branch_name + set -l branch (git symbolic-ref --quiet HEAD 2>/dev/null) + if set -q branch[1] + echo (string replace -r '^refs/heads/' '' $branch) + else + echo (git rev-parse --short HEAD 2>/dev/null) + end + end + + function _is_git_dirty + not command git diff-index --cached --quiet HEAD -- &>/dev/null + or not command git diff --no-ext-diff --quiet --exit-code &>/dev/null + end + + function _is_git_repo + type -q git + or return 1 + git rev-parse --git-dir >/dev/null 2>&1 + end + + function _hg_branch_name + echo (hg branch 2>/dev/null) + end + + function _is_hg_dirty + set -l stat (hg status -mard 2>/dev/null) + test -n "$stat" + end + + function _is_hg_repo + fish_print_hg_root >/dev/null + end + + function _repo_branch_name + _$argv[1]_branch_name + end + + function _is_repo_dirty + _is_$argv[1]_dirty + end + + function _repo_type + if _is_hg_repo + echo hg + return 0 + else if _is_git_repo + echo git + return 0 + end + return 1 + end + end + + set -l cyan (set_color -o cyan) + set -l yellow (set_color -o yellow) + set -l red (set_color -o red) + set -l green (set_color -o green) + set -l blue (set_color -o blue) + set -l normal (set_color normal) + + set -l arrow_color "$green" + if test $__last_command_exit_status != 0 + set arrow_color "$red" + end + + set -l arrow "$arrow_color➜ " + if fish_is_root_user + set arrow "$arrow_color# " + end + + set -l cwd $cyan(basename (prompt_pwd)) + + set -l repo_info + if set -l repo_type (_repo_type) + set -l repo_branch $red(_repo_branch_name $repo_type) + set repo_info "$blue $repo_type:($repo_branch$blue)" + + if _is_repo_dirty $repo_type + set -l dirty "$yellow ✗" + set repo_info "$repo_info$dirty" + end + end + + echo -n -s $arrow ' '$cwd $repo_info $normal ' ' +end diff --git a/.config/i3/config b/dotfiles/i3/config similarity index 100% rename from .config/i3/config rename to dotfiles/i3/config diff --git a/.config/i3status-rust/config.toml b/dotfiles/i3status-rust/config.toml similarity index 100% rename from .config/i3status-rust/config.toml rename to dotfiles/i3status-rust/config.toml diff --git a/.config/nvim/init.vim b/dotfiles/nvim/init.vim similarity index 100% rename from .config/nvim/init.vim rename to dotfiles/nvim/init.vim diff --git a/dotfiles/rofi/config.rasi b/dotfiles/rofi/config.rasi new file mode 100644 index 0000000..b2bd231 --- /dev/null +++ b/dotfiles/rofi/config.rasi @@ -0,0 +1,151 @@ +configuration { + modi: "drun,window,run,ssh"; +/* font: "mono 12";*/ +/* location: 0;*/ +/* yoffset: 0;*/ +/* xoffset: 0;*/ +/* fixed-num-lines: true;*/ + show-icons: true; +/* terminal: "rofi-sensible-terminal";*/ +/* ssh-client: "ssh";*/ +/* ssh-command: "{terminal} -e {ssh-client} {host} [-p {port}]";*/ +/* run-command: "{cmd}";*/ +/* run-list-command: "";*/ +/* run-shell-command: "{terminal} -e {cmd}";*/ +/* window-command: "wmctrl -i -R {window}";*/ +/* window-match-fields: "all";*/ + icon-theme: "Papirus"; +/* drun-match-fields: "name,generic,exec,categories,keywords";*/ +/* drun-categories: ;*/ +/* drun-show-actions: false;*/ +/* drun-display-format: "{name} [({generic})]";*/ +/* drun-url-launcher: "xdg-open";*/ +/* disable-history: false;*/ +/* ignored-prefixes: "";*/ +/* sort: false;*/ +/* sorting-method: "normal";*/ +/* case-sensitive: false;*/ +/* cycle: true;*/ +/* sidebar-mode: false;*/ +/* hover-select: false;*/ +/* eh: 1;*/ +/* auto-select: false;*/ +/* parse-hosts: false;*/ +/* parse-known-hosts: true;*/ +/* combi-modi: "window,run";*/ +/* matching: "normal";*/ +/* tokenize: true;*/ +/* m: "-5";*/ +/* filter: ;*/ +/* dpi: -1;*/ +/* threads: 0;*/ +/* scroll-method: 0;*/ +/* window-format: "{w} {c} {t}";*/ +/* click-to-exit: true;*/ +/* max-history-size: 25;*/ +/* combi-hide-mode-prefix: false;*/ +/* matching-negate-char: '-' /* unsupported */;*/ +/* cache-dir: ;*/ +/* window-thumbnail: false;*/ +/* drun-use-desktop-cache: false;*/ +/* drun-reload-desktop-cache: false;*/ +/* normalize-match: false;*/ +/* steal-focus: false;*/ +/* application-fallback-icon: ;*/ +/* pid: "/run/user/1000/rofi.pid";*/ +/* display-window: ;*/ +/* display-windowcd: ;*/ +/* display-run: ;*/ +/* display-ssh: ;*/ +/* display-drun: ;*/ +/* display-combi: ;*/ +/* display-keys: ;*/ +/* display-filebrowser: ;*/ +/* kb-primary-paste: "Control+V,Shift+Insert";*/ +/* kb-secondary-paste: "Control+v,Insert";*/ +/* kb-clear-line: "Control+w";*/ +/* kb-move-front: "Control+a";*/ +/* kb-move-end: "Control+e";*/ +/* kb-move-word-back: "Alt+b,Control+Left";*/ +/* kb-move-word-forward: "Alt+f,Control+Right";*/ +/* kb-move-char-back: "Left,Control+b";*/ +/* kb-move-char-forward: "Right,Control+f";*/ +/* kb-remove-word-back: "Control+Alt+h,Control+BackSpace";*/ +/* kb-remove-word-forward: "Control+Alt+d";*/ +/* kb-remove-char-forward: "Delete,Control+d";*/ +/* kb-remove-char-back: "BackSpace,Shift+BackSpace,Control+h";*/ +/* kb-remove-to-eol: "Control+k";*/ +/* kb-remove-to-sol: "Control+u";*/ +/* kb-accept-entry: "Control+j,Control+m,Return,KP_Enter";*/ +/* kb-accept-custom: "Control+Return";*/ +/* kb-accept-custom-alt: "Control+Shift+Return";*/ +/* kb-accept-alt: "Shift+Return";*/ +/* kb-delete-entry: "Shift+Delete";*/ +/* kb-mode-next: "Shift+Right,Control+Tab";*/ +/* kb-mode-previous: "Shift+Left,Control+ISO_Left_Tab";*/ +/* kb-mode-complete: "Control+l";*/ +/* kb-row-left: "Control+Page_Up";*/ +/* kb-row-right: "Control+Page_Down";*/ +/* kb-row-up: "Up,Control+p,ISO_Left_Tab";*/ +/* kb-row-down: "Down,Control+n";*/ +/* kb-row-tab: "Tab";*/ +/* kb-page-prev: "Page_Up";*/ +/* kb-page-next: "Page_Down";*/ +/* kb-row-first: "Home,KP_Home";*/ +/* kb-row-last: "End,KP_End";*/ +/* kb-row-select: "Control+space";*/ +/* kb-screenshot: "Alt+S";*/ +/* kb-ellipsize: "Alt+period";*/ +/* kb-toggle-case-sensitivity: "grave,dead_grave";*/ +/* kb-toggle-sort: "Alt+grave";*/ +/* kb-cancel: "Escape,Control+g,Control+bracketleft";*/ +/* kb-custom-1: "Alt+1";*/ +/* kb-custom-2: "Alt+2";*/ +/* kb-custom-3: "Alt+3";*/ +/* kb-custom-4: "Alt+4";*/ +/* kb-custom-5: "Alt+5";*/ +/* kb-custom-6: "Alt+6";*/ +/* kb-custom-7: "Alt+7";*/ +/* kb-custom-8: "Alt+8";*/ +/* kb-custom-9: "Alt+9";*/ +/* kb-custom-10: "Alt+0";*/ +/* kb-custom-11: "Alt+exclam";*/ +/* kb-custom-12: "Alt+at";*/ +/* kb-custom-13: "Alt+numbersign";*/ +/* kb-custom-14: "Alt+dollar";*/ +/* kb-custom-15: "Alt+percent";*/ +/* kb-custom-16: "Alt+dead_circumflex";*/ +/* kb-custom-17: "Alt+ampersand";*/ +/* kb-custom-18: "Alt+asterisk";*/ +/* kb-custom-19: "Alt+parenleft";*/ +/* kb-select-1: "Super+1";*/ +/* kb-select-2: "Super+2";*/ +/* kb-select-3: "Super+3";*/ +/* kb-select-4: "Super+4";*/ +/* kb-select-5: "Super+5";*/ +/* kb-select-6: "Super+6";*/ +/* kb-select-7: "Super+7";*/ +/* kb-select-8: "Super+8";*/ +/* kb-select-9: "Super+9";*/ +/* kb-select-10: "Super+0";*/ +/* ml-row-left: "ScrollLeft";*/ +/* ml-row-right: "ScrollRight";*/ +/* ml-row-up: "ScrollUp";*/ +/* ml-row-down: "ScrollDown";*/ +/* me-select-entry: "MousePrimary";*/ +/* me-accept-entry: "MouseDPrimary";*/ +/* me-accept-custom: "Control+MouseDPrimary";*/ + timeout { + action: "kb-cancel"; + delay: 0; + } + filebrowser { + directories-first: true; + sorting-method: "name"; + } + show { + icons: "-icon-theme"; + } +} + +@theme "gruvbox-dark" diff --git a/setup.sh b/setup.sh index c4b0b4f..b6aa47d 100755 --- a/setup.sh +++ b/setup.sh @@ -1,21 +1,13 @@ -# Install ohmyzsh -sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" -sudo chown -R $(whoami) $HOME/.oh-my-zsh $HOME/.zshrc - -# Install thefuck, zsh-suggestion -sudo python3 -m pip install thefuck -git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions - -# Copy dotfiles -ln -sn $PWD/.config $HOME/.config -ln -s $PWD/.zshrc $HOME/.zshrc -touch $HOME/.z - +#!/bin/bash setup_macos() { # Install Homebrew /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"; } +for conf in $(ls dotfiles); do + ln -sn $PWD/dotfiles/$conf $HOME/.config/$conf +done + # Determine which OS is in use case "$(uname)" in Linux*) INSTALL_CMD="yay -S";; @@ -23,16 +15,15 @@ case "$(uname)" in esac # Install software -$INSTALL_CMD git cloc htop -$INSTALL_CMD neovim +$INSTALL_CMD fish git cloc htop ncdu tree +$INSTALL_CMD alacritty neovim zellij zoxide $INSTALL_CMD rustup rust-analyzer $INSTALL_CMD go gopls $INSTALL_CMD nodejs yarn +$INSTALL_CMD obsidian if [[ "$(uname)" == "Linux" ]]; then - $INSTALL_CMD lxappearance - $INSTALL_CMD adapta-gtk-theme papirus-icon-theme nerd-fonts-complete - $INSTALL_CMD evince neofetch feh + $INSTALL_CMD rofi + $INSTALL_CMD lxappearance adapta-gtk-theme papirus-icon-theme nerd-fonts-complete $INSTALL_CMD docker docker-compose - $INSTALL_CMD texlive-full fi