From 4586b9e67604997b539997e6ba00fbd486ffdffc Mon Sep 17 00:00:00 2001 From: tblyler Date: Mon, 25 May 2020 13:36:22 -0400 Subject: [PATCH] Update to new tmux conf. Support mac and arch --- home/.Xmodmap | 4 - home/.config/nvim/init.vim | 3 - home/.my.cnf | 11 -- home/.myclirc | 121 ------------ home/.tmux.conf | 41 ---- home/.tmux.conf.local | 296 +++++++++++++++++++++++++++++ home/.zshrc | 60 ++++-- home/.zshrc.d/00_go.sh | 5 +- home/.zshrc.d/01_update_go_apps.sh | 28 +-- home/.zshrc.d/02_upgrade_system.sh | 64 +++++-- home/.zshrc.d/weather.sh | 17 -- install.sh | 73 +++---- 12 files changed, 428 insertions(+), 295 deletions(-) delete mode 100644 home/.Xmodmap delete mode 100644 home/.my.cnf delete mode 100644 home/.myclirc delete mode 100755 home/.tmux.conf create mode 100644 home/.tmux.conf.local delete mode 100755 home/.zshrc.d/weather.sh diff --git a/home/.Xmodmap b/home/.Xmodmap deleted file mode 100644 index 52f86ef..0000000 --- a/home/.Xmodmap +++ /dev/null @@ -1,4 +0,0 @@ -clear Lock -keysym Caps_Lock = Escape -keysym Escape = Caps_Lock -add Lock = Caps_Lock diff --git a/home/.config/nvim/init.vim b/home/.config/nvim/init.vim index 19c1626..84f76f6 100644 --- a/home/.config/nvim/init.vim +++ b/home/.config/nvim/init.vim @@ -102,9 +102,6 @@ let g:go_metalinter_command = "golangci-lint" " Lint Go on save let g:go_metalinter_autosave = 1 -" make sure errcheck is enabled for autosave -let g:go_metalinter_autosave_enabled = ['govet', 'golint', 'errcheck', 'deadcode', 'errcheck', 'gosimple', 'ineffassign', 'staticcheck', 'structcheck', 'typecheck', 'unused', 'varcheck'] - " enable autocompletion for Go call deoplete#custom#option('omni_patterns', { 'go': '[^. *\t]\.\w*' }) diff --git a/home/.my.cnf b/home/.my.cnf deleted file mode 100644 index b2249d8..0000000 --- a/home/.my.cnf +++ /dev/null @@ -1,11 +0,0 @@ -[client] - -# Turn on the LOAD DATA INFILE statement -local-infile = on - -# Another local infile alias. -# Use it if the previous one clashes with other MySQL tools. -loose-local-infile = on - -# Configure the pager -pager = 'vim -' diff --git a/home/.myclirc b/home/.myclirc deleted file mode 100644 index 2081335..0000000 --- a/home/.myclirc +++ /dev/null @@ -1,121 +0,0 @@ -# vi: ft=dosini -[main] - -# Enables context sensitive auto-completion. If this is disabled the all -# possible completions will be listed. -smart_completion = True - -# Multi-line mode allows breaking up the sql statements into multiple lines. If -# this is set to True, then the end of the statements must have a semi-colon. -# If this is set to False then sql statements can't be split into multiple -# lines. End of line (return) is considered as the end of the statement. -multi_line = False - -# Destructive warning mode will alert you before executing a sql statement -# that may cause harm to the database such as "drop table", "drop database" -# or "shutdown". -destructive_warning = True - -# log_file location. -log_file = ~/.mycli.log - -# Default log level. Possible values: "CRITICAL", "ERROR", "WARNING", "INFO" -# and "DEBUG". "NONE" disables logging. -log_level = INFO - -# Log every query and its results to a file. Enable this by uncommenting the -# line below. -# audit_log = ~/.mycli-audit.log - -# Timing of sql statments and table rendering. -timing = True - -# Table format. Possible values: ascii, double, github, -# psql, plain, simple, grid, fancy_grid, pipe, orgtbl, rst, mediawiki, html, -# latex, latex_booktabs, textile, moinmoin, jira, vertical, tsv, csv. -# Recommended: ascii -table_format = ascii - -# Syntax coloring style. Possible values (many support the "-dark" suffix): -# manni, igor, xcode, vim, autumn, vs, rrt, native, perldoc, borland, tango, emacs, -# friendly, monokai, paraiso, colorful, murphy, bw, pastie, paraiso, trac, default, -# fruity. -# Screenshots at http://mycli.net/syntax -syntax_style = default - -# Keybindings: Possible values: emacs, vi. -# Emacs mode: Ctrl-A is home, Ctrl-E is end. All emacs keybindings are available in the REPL. -# When Vi mode is enabled you can use modal editing features offered by Vi in the REPL. -key_bindings = emacs - -# Enabling this option will show the suggestions in a wider menu. Thus more items are suggested. -wider_completion_menu = False - -# MySQL prompt -# \D - The full current date -# \d - Database name -# \h - Hostname of the server -# \m - Minutes of the current time -# \n - Newline -# \P - AM/PM -# \p - Port -# \R - The current time, in 24-hour military time (0–23) -# \r - The current time, standard 12-hour time (1–12) -# \s - Seconds of the current time -# \t - Product type (Percona, MySQL, MariaDB) -# \u - Username -prompt = '\t \u@\h:\d> ' -prompt_continuation = '-> ' - -# Skip intro info on startup and outro info on exit -less_chatty = False - -# Use alias from --login-path instead of host name in prompt -login_path_as_host = False - -# Cause result sets to be displayed vertically if they are too wide for the current window, -# and using normal tabular format otherwise. (This applies to statements terminated by ; or \G.) -auto_vertical_output = True - -# keyword casing preference. Possible values "lower", "upper", "auto" -keyword_casing = upper - -# Custom colors for the completion menu, toolbar, etc. -[colors] -# Completion menus. -Token.Menu.Completions.Completion.Current = 'bg:#00aaaa #000000' -Token.Menu.Completions.Completion = 'bg:#008888 #ffffff' -Token.Menu.Completions.MultiColumnMeta = 'bg:#aaffff #000000' -Token.Menu.Completions.ProgressButton = 'bg:#003333' -Token.Menu.Completions.ProgressBar = 'bg:#00aaaa' - -# Query results -Token.Output.Header = 'bold' -Token.Output.OddRow = '' -Token.Output.EvenRow = '' - -# Selected text. -Token.SelectedText = '#ffffff bg:#6666aa' - -# Search matches. (reverse-i-search) -Token.SearchMatch = '#ffffff bg:#4444aa' -Token.SearchMatch.Current = '#ffffff bg:#44aa44' - -# The bottom toolbar. -Token.Toolbar = 'bg:#222222 #aaaaaa' -Token.Toolbar.Off = 'bg:#222222 #888888' -Token.Toolbar.On = 'bg:#222222 #ffffff' - -# Search/arg/system toolbars. -Token.Toolbar.Search = 'noinherit bold' -Token.Toolbar.Search.Text = 'nobold' -Token.Toolbar.System = 'noinherit bold' -Token.Toolbar.Arg = 'noinherit bold' -Token.Toolbar.Arg.Text = 'nobold' - -# Favorite queries. -[favorite_queries] - -# DNS to call by -d option -[alias_dsn] -# example_dsn = mysql://[user[:password]@][netloc][:port][/dbname] diff --git a/home/.tmux.conf b/home/.tmux.conf deleted file mode 100755 index 812256c..0000000 --- a/home/.tmux.conf +++ /dev/null @@ -1,41 +0,0 @@ -set-window-option -g mode-keys vi - -set -g default-terminal "screen-256color" - -set -g base-index 1 -set -g bell-action any -set -g visual-bell on -set -g history-limit 10000 -set -g renumber-windows on -set -g allow-rename off -set -g escape-time 0 - -set -g message-bg default -set -g message-fg green -set -g pane-active-border-bg default -set -g pane-active-border-fg green -set -g pane-border-bg default -set -g pane-border-fg white -set -g status-bg default -set -g status-fg green -set -g status-position top -set -g window-status-bg default -set -g window-status-fg green -set -g window-status-current-bg default -set -g window-status-current-fg '#5B92E5' -set -g window-status-bell-bg red -set -g window-status-bell-fg green - -# List of plugins -set -g @tpm_plugins '\ - tmux-plugins/tmux-pain-control \ - tmux-plugins/tmux-prefix-highlight \ - tmux-plugins/tmux-sensible \ - tmux-plugins/tmux-yank \ - tmux-plugins/tpm \ - tmux-plugins/vim-tmux-focus-events \ - tmux-plugins/tmux-pain-control \ -' - -# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf) - run '~/.tmux/plugins/tpm/tpm' diff --git a/home/.tmux.conf.local b/home/.tmux.conf.local new file mode 100644 index 0000000..4b95959 --- /dev/null +++ b/home/.tmux.conf.local @@ -0,0 +1,296 @@ +# https://github.com/gpakosz/.tmux +# (‑●‑●)> dual licensed under the WTFPL v2 license and the MIT license, +# without any warranty. +# Copyright 2012— Gregory Pakosz (@gpakosz). + + +# -- navigation ---------------------------------------------------------------- + +# if you're running tmux within iTerm2 +# - and tmux is 1.9 or 1.9a +# - and iTerm2 is configured to let option key act as +Esc +# - and iTerm2 is configured to send [1;9A -> [1;9D for option + arrow keys +# then uncomment the following line to make Meta + arrow keys mapping work +#set -ga terminal-overrides "*:kUP3=\e[1;9A,*:kDN3=\e[1;9B,*:kRIT3=\e[1;9C,*:kLFT3=\e[1;9D" + + +# -- windows & pane creation --------------------------------------------------- + +# new window retains current path, possible values are: +# - true +# - false (default) +tmux_conf_new_window_retain_current_path=false + +# new pane retains current path, possible values are: +# - true (default) +# - false +tmux_conf_new_pane_retain_current_path=true + +# new pane tries to reconnect ssh sessions (experimental), possible values are: +# - true +# - false (default) +tmux_conf_new_pane_reconnect_ssh=false + +# prompt for session name when creating a new session, possible values are: +# - true +# - false (default) +tmux_conf_new_session_prompt=false + + +# -- display ------------------------------------------------------------------- + +# RGB 24-bit colour support (tmux >= 2.2), possible values are: +# - true +# - false (default) +tmux_conf_theme_24b_colour=true + +# window style +tmux_conf_theme_window_fg='default' +tmux_conf_theme_window_bg='default' + +# highlight focused pane (tmux >= 2.1), possible values are: +# - true +# - false (default) +tmux_conf_theme_highlight_focused_pane=false + +# focused pane colours: +tmux_conf_theme_focused_pane_fg='default' +tmux_conf_theme_focused_pane_bg='#0087d7' # light blue + +# pane border style, possible values are: +# - thin (default) +# - fat +tmux_conf_theme_pane_border_style=thin + +# pane borders colours: +tmux_conf_theme_pane_border='#444444' # gray +tmux_conf_theme_pane_active_border='#00afff' # light blue + +# pane indicator colours +tmux_conf_theme_pane_indicator='#00afff' # light blue +tmux_conf_theme_pane_active_indicator='#00afff' # light blue + +# status line style +tmux_conf_theme_message_fg='#000000' # black +tmux_conf_theme_message_bg='#ffff00' # yellow +tmux_conf_theme_message_attr='bold' + +# status line command style ( : Escape) +tmux_conf_theme_message_command_fg='#ffff00' # yellow +tmux_conf_theme_message_command_bg='#000000' # black +tmux_conf_theme_message_command_attr='bold' + +# window modes style +tmux_conf_theme_mode_fg='#000000' # black +tmux_conf_theme_mode_bg='#ffff00' # yellow +tmux_conf_theme_mode_attr='bold' + +# status line style +tmux_conf_theme_status_fg='#8a8a8a' # light gray +tmux_conf_theme_status_bg='#080808' # dark gray +tmux_conf_theme_status_attr='none' + +# terminal title +# - built-in variables are: +# - #{circled_window_index} +# - #{circled_session_name} +# - #{hostname} +# - #{hostname_ssh} +# - #{username} +# - #{username_ssh} +tmux_conf_theme_terminal_title='#h ❐ #S ● #I #W' + +# window status style +# - built-in variables are: +# - #{circled_window_index} +# - #{circled_session_name} +# - #{hostname} +# - #{hostname_ssh} +# - #{username} +# - #{username_ssh} +tmux_conf_theme_window_status_fg='#8a8a8a' # light gray +tmux_conf_theme_window_status_bg='#080808' # dark gray +tmux_conf_theme_window_status_attr='none' +tmux_conf_theme_window_status_format='#I #W' +#tmux_conf_theme_window_status_format='#{circled_window_index} #W' +#tmux_conf_theme_window_status_format='#I #W#{?window_bell_flag,🔔,}#{?window_zoomed_flag,🔍,}' + +# window current status style +# - built-in variables are: +# - #{circled_window_index} +# - #{circled_session_name} +# - #{hostname} +# - #{hostname_ssh} +# - #{username} +# - #{username_ssh} +tmux_conf_theme_window_status_current_fg='#000000' # black +tmux_conf_theme_window_status_current_bg='#00afff' # light blue +tmux_conf_theme_window_status_current_attr='bold' +tmux_conf_theme_window_status_current_format='#I #W' +#tmux_conf_theme_window_status_current_format='#{circled_window_index} #W' +#tmux_conf_theme_window_status_current_format='#I #W#{?window_zoomed_flag,🔍,}' + +# window activity status style +tmux_conf_theme_window_status_activity_fg='default' +tmux_conf_theme_window_status_activity_bg='default' +tmux_conf_theme_window_status_activity_attr='underscore' + +# window bell status style +tmux_conf_theme_window_status_bell_fg='#ffff00' # yellow +tmux_conf_theme_window_status_bell_bg='default' +tmux_conf_theme_window_status_bell_attr='blink,bold' + +# window last status style +tmux_conf_theme_window_status_last_fg='#00afff' # light blue +tmux_conf_theme_window_status_last_bg='default' +tmux_conf_theme_window_status_last_attr='none' + +# status left/right sections separators +tmux_conf_theme_left_separator_main='' +tmux_conf_theme_left_separator_sub='|' +tmux_conf_theme_right_separator_main='' +tmux_conf_theme_right_separator_sub='|' +#tmux_conf_theme_left_separator_main='\uE0B0' # /!\ you don't need to install Powerline +#tmux_conf_theme_left_separator_sub='\uE0B1' # you only need fonts patched with +#tmux_conf_theme_right_separator_main='\uE0B2' # Powerline symbols or the standalone +#tmux_conf_theme_right_separator_sub='\uE0B3' # PowerlineSymbols.otf font, see README.md + +# status left/right content: +# - separate main sections with '|' +# - separate subsections with ',' +# - built-in variables are: +# - #{battery_bar} +# - #{battery_hbar} +# - #{battery_percentage} +# - #{battery_status} +# - #{battery_vbar} +# - #{circled_session_name} +# - #{hostname_ssh} +# - #{hostname} +# - #{loadavg} +# - #{pairing} +# - #{prefix} +# - #{root} +# - #{synchronized} +# - #{uptime_y} +# - #{uptime_d} (modulo 365 when #{uptime_y} is used) +# - #{uptime_h} +# - #{uptime_m} +# - #{uptime_s} +# - #{username} +# - #{username_ssh} +tmux_conf_theme_status_left=' ❐ #S | ↑#{?uptime_y, #{uptime_y}y,}#{?uptime_d, #{uptime_d}d,}#{?uptime_h, #{uptime_h}h,}#{?uptime_m, #{uptime_m}m,} ' +tmux_conf_theme_status_right='#{prefix}#{pairing}#{synchronized} #{?battery_status, #{battery_status},}#{?battery_bar, #{battery_bar},}#{?battery_percentage, #{battery_percentage},} , %R , %d %b | #{username}#{root} | #{hostname} ' + +# status left style +tmux_conf_theme_status_left_fg='#000000,#e4e4e4,#e4e4e4' # black, white , white +tmux_conf_theme_status_left_bg='#ffff00,#ff00af,#00afff' # yellow, pink, white blue +tmux_conf_theme_status_left_attr='bold,none,none' + +# status right style +tmux_conf_theme_status_right_fg='#8a8a8a,#e4e4e4,#000000' # light gray, white, black +tmux_conf_theme_status_right_bg='#080808,#d70000,#e4e4e4' # dark gray, red, white +tmux_conf_theme_status_right_attr='none,none,bold' + +# pairing indicator +tmux_conf_theme_pairing='👓 ' # U+1F453 +tmux_conf_theme_pairing_fg='none' +tmux_conf_theme_pairing_bg='none' +tmux_conf_theme_pairing_attr='none' + +# prefix indicator +tmux_conf_theme_prefix='⌨ ' # U+2328 +tmux_conf_theme_prefix_fg='none' +tmux_conf_theme_prefix_bg='none' +tmux_conf_theme_prefix_attr='none' + +# root indicator +tmux_conf_theme_root='!' +tmux_conf_theme_root_fg='none' +tmux_conf_theme_root_bg='none' +tmux_conf_theme_root_attr='bold,blink' + +# synchronized indicator +tmux_conf_theme_synchronized='🔒' # U+1F512 +tmux_conf_theme_synchronized_fg='none' +tmux_conf_theme_synchronized_bg='none' +tmux_conf_theme_synchronized_attr='none' + +# battery bar symbols +tmux_conf_battery_bar_symbol_full='◼' +tmux_conf_battery_bar_symbol_empty='◻' +#tmux_conf_battery_bar_symbol_full='♥' +#tmux_conf_battery_bar_symbol_empty='·' + +# battery bar length (in number of symbols), possible values are: +# - auto +# - a number, e.g. 5 +tmux_conf_battery_bar_length='auto' + +# battery bar palette, possible values are: +# - gradient (default) +# - heat +# - 'colour_full_fg,colour_empty_fg,colour_bg' +tmux_conf_battery_bar_palette='gradient' +#tmux_conf_battery_bar_palette='#d70000,#e4e4e4,#000000' # red, white, black + +# battery hbar palette, possible values are: +# - gradient (default) +# - heat +# - 'colour_low,colour_half,colour_full' +tmux_conf_battery_hbar_palette='gradient' +#tmux_conf_battery_hbar_palette='#d70000,#ff5f00,#5fff00' # red, orange, green + +# battery vbar palette, possible values are: +# - gradient (default) +# - heat +# - 'colour_low,colour_half,colour_full' +tmux_conf_battery_vbar_palette='gradient' +#tmux_conf_battery_vbar_palette='#d70000,#ff5f00,#5fff00' # red, orange, green + +# symbols used to indicate whether battery is charging or discharging +#tmux_conf_battery_status_charging='↑' # U+2191 +#tmux_conf_battery_status_discharging='↓' # U+2193 +#tmux_conf_battery_status_charging='⚡ ' # U+26A1 +tmux_conf_battery_status_charging='🔌 ' # U+1F50C +tmux_conf_battery_status_discharging='🔋 ' # U+1F50B + +# clock style (when you hit + t) +# you may want to use %I:%M %p in place of %R in tmux_conf_theme_status_right +tmux_conf_theme_clock_colour='#00afff' # light blue +tmux_conf_theme_clock_style='24' + + +# -- clipboard ----------------------------------------------------------------- + +# in copy mode, copying selection also copies to the OS clipboard +# - true +# - false (default) +# on macOS, this requires installing reattach-to-user-namespace, see README.md +# on Linux, this requires xsel or xclip +tmux_conf_copy_to_os_clipboard=false + + +# -- user customizations ------------------------------------------------------- +# this is the place to override or undo settings + +# increase history size +set -g history-limit 100000 + +# start with mouse mode enabled +#set -g mouse on + +# force Vi mode +# really you should export VISUAL or EDITOR environment variable, see manual +#set -g status-keys vi +#set -g mode-keys vi + +# replace C-b by C-a instead of using both prefixes +set -gu prefix2 +unbind C-a +# unbind C-b +# set -g prefix C-a +# bind C-a send-prefix + +# move status line to top +set -g status-position top diff --git a/home/.zshrc b/home/.zshrc index 99eee24..e83a1fa 100644 --- a/home/.zshrc +++ b/home/.zshrc @@ -1,4 +1,7 @@ export PATH="/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:${PATH}" +if [ -d "${HOME}/bin" ]; then + export PATH="${HOME}/bin:${PATH}" +fi # oh-my-zsh { export ZSH="${HOME}/.oh-my-zsh" @@ -8,7 +11,39 @@ HYPHEN_INSENSITIVE="true" export UPDATE_ZSH_DAYS=7 DISABLE_UPDATE_PROMPT="true" HIST_STAMPS="mm/dd/yyyy" -plugins=(battery catimg docker fzf git go golang grunt helm kube-ps1 kubectl minikube node npm pip ssh-agent sudo tmux) +plugins=( + autojump + battery + brew + catimg + common-aliases + copydir + copyfile + docker + encode64 + fzf + git + git-extras + go + golang + grunt + helm + kube-ps1 + kubectl + minikube + node + npm + osx + pip + pod + ssh-agent + sudo + tmux + xcode + zsh-autosuggestions + zsh-syntax-highlighting +) + source $ZSH/oh-my-zsh.sh # } @@ -45,7 +80,7 @@ fi export VISUAL="${EDITOR}" # use reflink cp if supported (yay CoW) -if cp --help | grep -q reflink; then +if 2>&1 cp --help | grep -q reflink; then alias cp='cp -i --reflink=auto' else alias cp='cp -i' @@ -59,11 +94,6 @@ alias kns='kubens' REPOS="${HOME}/repos" -PHPCS_BIN="${REPOS}/phpcs/scripts" -if [ -d "${PHPCS_BIN}" ]; then - export PATH="${PHPCS_BIN}:${PATH}" -fi - CARGO_ENV="${HOME}/.cargo/env" if [ -f "${CARGO_ENV}" ]; then source "${CARGO_ENV}" @@ -109,13 +139,13 @@ export GOAPPS=( 'github.com/google/huproxy/huproxyclient' 'github.com/jedisct1/piknik' 'github.com/junegunn/fzf' - 'github.com/schachmat/wego' 'github.com/tomnomnom/gron' 'github.com/wallix/awless' 'google.golang.org/grpc' ) +export GO111MODULE=on -case `uname` in +case "$(uname)" in "Darwin") pdf_join() { join_py="/System/Library/Automator/Combine PDF Pages.action/Contents/Resources/join.py" @@ -126,21 +156,9 @@ case `uname` in if command -v gtar &> /dev/null; then alias tar='gtar' fi - - export VISUAL='nvim' - - #archey -c ;; "Linux") - #screenfetch alias open="xdg-open" - - # swap escape and caps lock keys if gnome - if command -v dconf &> /dev/null; then - if ! dconf read /org/gnome/desktop/input-sources/xkb-options | grep -q 'caps:swapescape'; then - dconf write /org/gnome/desktop/input-sources/xkb-options "['caps:swapescape']" - fi - fi ;; esac # } diff --git a/home/.zshrc.d/00_go.sh b/home/.zshrc.d/00_go.sh index b3bb4b7..29366d5 100755 --- a/home/.zshrc.d/00_go.sh +++ b/home/.zshrc.d/00_go.sh @@ -1,7 +1,4 @@ #!/bin/bash -export GOROOT="${HOME}/.goroot" -export PATH="${GOROOT}/bin:${PATH}" - if command -v go &> /dev/null; then GOPATH="$(go env GOPATH)" if [ -n "${GOPATH}" ]; then @@ -9,5 +6,5 @@ if command -v go &> /dev/null; then export PATH="${GOPATH}/bin:${PATH}" fi else - >&2 echo '"go" is missing from the PATH, you should run "install.sh"' + >&2 echo '"go" is missing from the PATH' fi diff --git a/home/.zshrc.d/01_update_go_apps.sh b/home/.zshrc.d/01_update_go_apps.sh index 768b176..cd269c1 100755 --- a/home/.zshrc.d/01_update_go_apps.sh +++ b/home/.zshrc.d/01_update_go_apps.sh @@ -4,19 +4,23 @@ # if the GOAPPS environment variable is set, it is expected to be # an array update_go_apps() { - local APPS=("${@}") + ( + cd || exit $? - if [ -z "${APPS[0]}" ]; then - if [ -z "${GOAPPS}" ]; then - return + local APPS=("${@}") + + if [ -z "${APPS[0]}" ]; then + if [ -z "${GOAPPS}" ]; then + exit 0 + fi + + APPS=("${GOAPPS[@]}") fi - APPS=("${GOAPPS[@]}") - fi - - local APP - for APP in "${APPS[@]}"; do - echo "Updating ${APP}" - go get -u "${APP}" || return $? - done + local APP + for APP in "${APPS[@]}"; do + echo "Updating ${APP}" + go get -u "${APP}" || exit $? + done + ) || return $? } diff --git a/home/.zshrc.d/02_upgrade_system.sh b/home/.zshrc.d/02_upgrade_system.sh index a2063ec..ce5921a 100755 --- a/home/.zshrc.d/02_upgrade_system.sh +++ b/home/.zshrc.d/02_upgrade_system.sh @@ -1,13 +1,33 @@ #!/bin/bash upgrade_system() { - if command -v apt &> /dev/null; then - sudo sh -c 'apt update && apt upgrade' || return $? - fi + case "$(uname | tr '[:upper:]' '[:lower:]')" in + 'darwin') + if command -v brew &> /dev/null; then + brew update || return $? + brew upgrade || return $? + fi + ;; - if command -v dnf &> /dev/null; then - sudo dnf upgrade || return $? - fi + 'linux') + # Debian/Ubuntu + if command -v apt &> /dev/null; then + sudo sh -c 'apt update && apt upgrade' || return $? + fi + + # Fedora + if command -v dnf &> /dev/null; then + sudo dnf upgrade || return $? + fi + + # Arch + if command -v yay &> /dev/null; then + yay -Syu || return $? + elif command -v pacman &> /dev/null; then + sudo pacman -Syu || return $? + fi + ;; + esac if command -v update_go_apps &> /dev/null; then update_go_apps || return $? @@ -19,17 +39,29 @@ upgrade_system() { fi ( - cd "${HOME}/.tmux/plugins/tpm" || exit 0 - if [ -x ./clean_plugins ]; then - ./clean_plugins || exit $? - fi + set -e - if [ -x ./install_plugins ]; then - ./install_plugins || exit $? - fi + cd "${ZSH}/custom/plugins" - if [ -x ./update_plugins ]; then - ./update_plugins all || exit $? + for FILE in *; do + if ! [ -d "${FILE}" ]; then + continue + fi + + ( + cd "${FILE}" + [ -d .git ] || exit 0 + git pull + ) + done + ) || return $? + + ( + set -e + + cd "${HOME}/.tmux" + git pull + if [ -n "${TMUX}" ]; then + tmux source-file "${HOME}/.tmux.conf" fi ) || return $? -} diff --git a/home/.zshrc.d/weather.sh b/home/.zshrc.d/weather.sh deleted file mode 100755 index 02d3216..0000000 --- a/home/.zshrc.d/weather.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -weather() { - if ! command -v wego &> /dev/null; then - return 1 - fi - - local -r LOCK_DATE="/tmp/wego-$(date '+%F-%H')" - if [ -e "${LOCK_DATE}" ]; then - return 0 - fi - - touch "${LOCK_DATE}" - wego -} - -weather diff --git a/install.sh b/install.sh index 173f9ce..842feaf 100755 --- a/install.sh +++ b/install.sh @@ -1,4 +1,6 @@ #!/bin/bash +readonly HOMESHICK_DIR="${HOME}/.homesick/repos/homeshick" + check_required_cmds() { local -r REQUIRED_CMDS=( 'curl' @@ -23,7 +25,6 @@ check_required_cmds() { } install_homeshick() { - local -r HOMESHICK_DIR="${HOME}/.homesick/repos/homeshick" if [ -d "${HOMESHICK_DIR}" ]; then echo 'homeshick is already installed' return @@ -41,63 +42,45 @@ install_ohmyzsh() { /bin/bash -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" } -install_tpm() { - local -r TPM="${HOME}/.tmux/plugins/tpm" - if [ -d "${TPM}" ]; then - echo 'tpm is already installed' - return - fi +install_custom_ohmyzsh_plugins() { + local REPOS=( + https://github.com/zsh-users/zsh-autosuggestions + ) - git clone https://github.com/tmux-plugins/tpm "${TPM}" + local REPO + for REPO in ${REPOS[*]}; do + git clone \ + "${REPO}" \ + "${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions" || exit $? + done } -install_go() { - local -r GO_VERSION='1.13.5' - local -r GO_SHA256='512103d7ad296467814a6e3f635631bd35574cab3369a97a323c9a585ccaa569' - source "./home/.zshrc.d/00_go.sh" - - if command -v go &> /dev/null; then - echo 'go is already installed' +install_tmux_conf() { + if [ -d "${HOME}/.tmux" ]; then + echo '.tmux already exists' return fi - echo 'Installing Go 1.13.5, ensure that this is the version you want' - local -r GO_TAR_FILE="$(mktemp)" - if ! [ -f "${GO_TAR_FILE}" ]; then - >&2 echo 'failed to create a file for the go tar' - return 1 - fi - - if ! curl -L "https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz" | - tee "${GO_TAR_FILE}" | - sha256sum | - grep -Fq "${GO_SHA256}"; then - - >&2 echo 'failed to download go tar' - return 2 - fi - - mkdir -p "${GOROOT}" || return $? - ( - cd "${GOROOT}" || exit $? - tar -xzf "${GO_TAR_FILE}" || exit $? - mv go/* ./ || exit $? - rmdir go || exit $? - ) || return $? - - rm "${GO_TAR_FILE}" || true + set -e + cd + git clone https://github.com/gpakosz/.tmux.git + ) } check_required_cmds || exit $? echo 'installing homeshick' -install_homeshick -echo 'installing go' -install_go || exit $? -echo 'installing tpm' -install_tpm || exit $? +install_homeshick || exit $? echo 'installing oh-my-zsh' install_ohmyzsh || exit $? +echo 'installing custom ohmyzsh plugins' +install_custom_ohmyzsh_plugins || exit $? +echo 'installing tmux config' +install_tmux_conf || exit $? + +source "${HOMESHICK_DIR}/homeshick.sh" + +homeshick clone https://github.com/tblyler/tb-dotfiles echo 'now in zsh, run "upgrade_system"'