From b25fde08124ee52ca7ca7a6faa6ab1db939f32ea Mon Sep 17 00:00:00 2001 From: Bradley Richins Date: Tue, 7 Apr 2020 20:05:59 -0600 Subject: [PATCH] Initial commit --- README.md | 2 + files/aliases.zsh | 31 +++++ files/p10k-clean.zsh | 183 +++++++++++++++++++++++++ files/tmux-local.zsh | 8 ++ files/tmux-ssh.zsh | 13 ++ files/tmux.conf.local | 308 ++++++++++++++++++++++++++++++++++++++++++ files/tmux.conf.ssh | 23 ++++ files/zshrc | 107 +++++++++++++++ install.sh | 116 ++++++++++++++++ 9 files changed, 791 insertions(+) create mode 100644 README.md create mode 100644 files/aliases.zsh create mode 100644 files/p10k-clean.zsh create mode 100644 files/tmux-local.zsh create mode 100644 files/tmux-ssh.zsh create mode 100644 files/tmux.conf.local create mode 100644 files/tmux.conf.ssh create mode 100644 files/zshrc create mode 100755 install.sh diff --git a/README.md b/README.md new file mode 100644 index 0000000..06be040 --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# ZPower + diff --git a/files/aliases.zsh b/files/aliases.zsh new file mode 100644 index 0000000..3c7adb0 --- /dev/null +++ b/files/aliases.zsh @@ -0,0 +1,31 @@ +# Test +alias alias-test='echo Aliases are working' + +# Ubunut package manager +alias sys-update='sudo apt update && sudo apt upgrade && sudo apt autoremove' +alias get='sudo apt install' +alias get-snap='sudo snap install' +alias find-snap='snap search' + +# System power +alias restart='sudo reboot now' +alias pwroff='sudo shutdown -h' +alias offnow='sudo shutdown -h now' + +# ZSH +alias edit-alias='vim $HOME/.config/zsh/aliases.zsh' +alias zshcfg='vim $HOME/.zshrc' + +# Tmux +alias tmux='tmux -2' + +# Enhanced standard commands +alias cls='clear && ls' # Wish windows cls worked like this... +alias rmr="rm -r" # Better than rmdir... I'm that kind of lazy +alias c='clear' + +# Other +alias dl="aria2c" +alias torrent="aria2c --seed-time=0" +alias msh='mosh' +alias rs="rsync" diff --git a/files/p10k-clean.zsh b/files/p10k-clean.zsh new file mode 100644 index 0000000..1ab5a11 --- /dev/null +++ b/files/p10k-clean.zsh @@ -0,0 +1,183 @@ +if [[ -o 'aliases' ]]; then + 'builtin' 'unsetopt' 'aliases' + local p9k_classic_restore_aliases=1 +else + local p9k_classic_restore_aliases=0 +fi + +() { + emulate -L zsh + setopt no_unset + + # The list of segments shown on the left. Fill it with the most important segments. + typeset -ga POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=( + # =========================[ Line #1 ]========================= + dir # current directory + vcs + # =========================[ Line #2 ]========================= + newline + prompt_char + ) + + # The list of segments shown on the right. Fill it with less important segments. + # Right prompt on the last prompt line (where you are typing your commands) gets + # automatically hidden when the input line reaches it. Right prompt above the + # last prompt line gets hidden if it would overlap with left prompt. + typeset -ga POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=( + # =========================[ Line #1 ]========================= + background_jobs # presence of background jobs + root_indicator + context + # =========================[ Line #2 ]========================= + newline + status # exit code of the last command + #public_ip # public IP address + command_execution_time + time # current time + + ) + + typeset -g POWERLEVEL9K_MODE=powerline + typeset -g POWERLEVEL9K_BACKGROUND= # transparent background + typeset -g POWERLEVEL9K_{LEFT,RIGHT}_{LEFT,RIGHT}_WHITESPACE= # no surrounding whitespace + typeset -g POWERLEVEL9K_{LEFT,RIGHT}_SUBSEGMENT_SEPARATOR=' ' # separate segments with a space + typeset -g POWERLEVEL9K_{LEFT,RIGHT}_SEGMENT_SEPARATOR= # no end-of-line symbol + typeset -g POWERLEVEL9K_VISUAL_IDENTIFIER_EXPANSION= # disable segment icons + # Magenta prompt symbol if the last command succeeded. + typeset -g POWERLEVEL9K_PROMPT_CHAR_OK_{VIINS,VICMD,VIVIS}_FOREGROUND=yellow + # Red prompt symbol if the last command failed. + typeset -g POWERLEVEL9K_PROMPT_CHAR_ERROR_{VIINS,VICMD,VIVIS}_FOREGROUND=red + typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIINS_CONTENT_EXPANSION='> ' + + # Blue current directory. + typeset -g POWERLEVEL9K_DIR_FOREGROUND=blue + + # Make Git prompt grey in all states. Also make stale prompts appear indistinguishable from + # fresh ones. This is unlikely to be desired by anyone but that's how Pure does it. + #typeset -g POWERLEVEL9K_VCS_FOREGROUND=242 + typeset -g POWERLEVEL9K_VCS_FOREGROUND=yellow + + # Show previous command duration only if it's >= 5s. + typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=5 + # Don't show fractional seconds. Thus, 7s rather than 7.3s. + typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION=0 + # Duration format: 1d 2h 3m 4s. + typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FORMAT='d h m s' + # Yellow previous command duration. + typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FOREGROUND=yellow + + # Git status: feature:master#tag ⇣42⇡42 *42 merge ~42 +42 !42 ?42. + # We are using parameters defined by the gitstatus plugin. See reference: + # https://github.com/romkatv/gitstatus/blob/master/gitstatus.plugin.zsh. + local vcs='' + # 'feature' or '@72f5c8a' if not on a branch. + vcs+='%76F${${VCS_STATUS_LOCAL_BRANCH//\%/%%}:-%f@%76F${VCS_STATUS_COMMIT[1,8]}}' + # ':master' if the tracking branch name differs from local branch. + vcs+='${${VCS_STATUS_REMOTE_BRANCH:#$VCS_STATUS_LOCAL_BRANCH}:+%f:%76F${VCS_STATUS_REMOTE_BRANCH//\%/%%}}' + # '#tag' if on a tag. + vcs+='${VCS_STATUS_TAG:+%f#%76F${VCS_STATUS_TAG//\%/%%}}' + # ⇣42 if behind the remote. + vcs+='${${VCS_STATUS_COMMITS_BEHIND:#0}:+ %76F↓${VCS_STATUS_COMMITS_BEHIND}}' + # ⇡42 if ahead of the remote; no leading space if also behind the remote: ⇣42⇡42. + # If you want '⇣42 ⇡42' instead, replace '${${(M)VCS_STATUS_COMMITS_BEHIND:#0}:+ }' with ' '. + vcs+='${${VCS_STATUS_COMMITS_AHEAD:#0}:+${${(M)VCS_STATUS_COMMITS_BEHIND:#0}:+ }%76F↑${VCS_STATUS_COMMITS_AHEAD}}' + # *42 if have stashes. + vcs+='${${VCS_STATUS_STASHES:#0}:+ %76F*${VCS_STATUS_STASHES}}' + # 'merge' if the repo is in an unusual state. + vcs+='${VCS_STATUS_ACTION:+ %196F${VCS_STATUS_ACTION//\%/%%}}' + # ~42 if have merge conflicts. + vcs+='${${VCS_STATUS_NUM_CONFLICTED:#0}:+ %196F~${VCS_STATUS_NUM_CONFLICTED}}' + # +42 if have staged changes. + vcs+='${${VCS_STATUS_NUM_STAGED:#0}:+ %11F+${VCS_STATUS_NUM_STAGED}}' + # !42 if have unstaged changes. + vcs+='${${VCS_STATUS_NUM_UNSTAGED:#0}:+ %11F!${VCS_STATUS_NUM_UNSTAGED}}' + # ?42 if have untracked files. + vcs+='${${VCS_STATUS_NUM_UNTRACKED:#0}:+ %12F?${VCS_STATUS_NUM_UNTRACKED}}' + # If P9K_CONTENT is not empty, leave it unchanged. It's either "loading" or from vcs_info. + vcs="\${P9K_CONTENT:-$vcs}" + + # Disable the default Git status formatting. + typeset -g POWERLEVEL9K_VCS_DISABLE_GITSTATUS_FORMATTING=true + # Install our own Git status formatter. + typeset -g POWERLEVEL9K_VCS_{CLEAN,UNTRACKED,MODIFIED}_CONTENT_EXPANSION=$vcs + # When Git status is being refreshed asynchronously, display the last known repo status in grey. + typeset -g POWERLEVEL9K_VCS_LOADING_CONTENT_EXPANSION=${${vcs//\%f}//\%<->F} + typeset -g POWERLEVEL9K_VCS_LOADING_FOREGROUND=244 + # Enable counters for staged, unstaged, etc. + typeset -g POWERLEVEL9K_VCS_{STAGED,UNSTAGED,UNTRACKED,COMMITS_AHEAD,COMMITS_BEHIND}_MAX_NUM=-1 + typeset -g POWERLEVEL9K_VCS_VISUAL_IDENTIFIER_COLOR=76 + + # Show status of repositories of these types. You can add svn and/or hg if you are + # using them. If you do, your prompt may become slow even when your current directory + # isn't in an svn or hg reposotiry. + typeset -g POWERLEVEL9K_VCS_BACKENDS=(git) + + # These settings are used for respositories other than Git or when gitstatusd fails and + # Powerlevel10k has to fall back to using vcs_info. + typeset -g POWERLEVEL9K_VCS_CLEAN_FOREGROUND=76 + typeset -g POWERLEVEL9K_VCS_MODIFIED_FOREGROUND=11 + typeset -g POWERLEVEL9K_VCS_UNTRACKED_FOREGROUND=76 + typeset -g POWERLEVEL9K_VCS_REMOTE_BRANCH_ICON=':' + typeset -g POWERLEVEL9K_VCS_COMMIT_ICON='@' + typeset -g POWERLEVEL9K_VCS_INCOMING_CHANGES_ICON='↓' + typeset -g POWERLEVEL9K_VCS_OUTGOING_CHANGES_ICON='↑' + typeset -g POWERLEVEL9K_VCS_STASH_ICON='*' + typeset -g POWERLEVEL9K_VCS_TAG_ICON=$'%{\b#%}' + typeset -g POWERLEVEL9K_VCS_UNTRACKED_ICON=$'%{\b?%}' + typeset -g POWERLEVEL9K_VCS_UNSTAGED_ICON=$'%{\b!%}' + typeset -g POWERLEVEL9K_VCS_STAGED_ICON=$'%{\b+%}' + typeset -g POWERLEVEL9K_VCS_BRANCH_ICON= + + typeset -g POWERLEVEL9K_STATUS_OK=true + + # Add an empty line before each prompt. + typeset -g POWERLEVEL9K_PROMPT_ADD_NEWLINE=true + # Add a space between the prompt and the cursor. + typeset -g POWERLEVEL9K_LEFT_SEGMENT_END_SEPARATOR='' + # Align the first lines of the left and right prompt rather than the last lines. + typeset -g POWERLEVEL9K_RPROMPT_ON_NEWLINE=false + # Don't show the trailing segment separator on left prompt lines without any segments. + typeset -g POWERLEVEL9K_EMPTY_LINE_LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL='' + # Connect left prompt lines with these symbols. + typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX='┌[' + typeset -g POWERLEVEL9K_MULTILINE_NEWLINE_PROMPT_PREFIX='├[' + typeset -g POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX='└[' + # Connect right prompt lines with these symbols. + typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_SUFFIX=']┐' + typeset -g POWERLEVEL9K_MULTILINE_NEWLINE_PROMPT_SUFFIX=']┤' + typeset -g POWERLEVEL9K_MULTILINE_LAST_PROMPT_SUFFIX=']┘' + + # Enable special styling for non-writable directories. + typeset -g POWERLEVEL9K_DIR_SHOW_WRITABLE=true + # If set to true, embed a hyperlink into the directory. Useful for quickly + # opening a directory in the file manager simply by clicking the link. + # Can also be handy when the directory is shortened, as it allows you to see + # the full directory that was used in previous commands. + typeset -g POWERLEVEL9K_DIR_HYPERLINK=true + + # Enable counters for staged, unstaged, etc. in git prompt. + typeset -g POWERLEVEL9K_VCS_{STAGED,UNSTAGED,UNTRACKED,COMMITS_AHEAD,COMMITS_BEHIND}_MAX_NUM=-1 + + # Show execution time of the last command if takes longer than this many seconds. + typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=5 + # Show this many fractional digits. Zero means round to seconds. + typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION=0 + + # Context format: user@host. + typeset -g POWERLEVEL9K_CONTEXT_TEMPLATE='%n@%m' + # Don't show context unless running with privileges on via SSH. + typeset -g POWERLEVEL9K_CONTEXT_{DEFAULT,SUDO}_CONTENT_EXPANSION= + typeset -g POWERLEVEL9K_CONTEXT_{DEFAULT,SUDO}_VISUAL_IDENTIFIER_EXPANSION= + typeset -g POWERLEVEL9K_ALWAYS_SHOW_CONTEXT=true + + # Format for the current time: 09:51:02. See `man 3 strftime`. + typeset -g POWERLEVEL9K_TIME_FORMAT='%D{%H:%M:%S}' + # If set to true, time will update when you hit enter. This way prompts for the past + # commands will contain the start times of their commands as opposed to the default + # behavior where they contain the end times of their preceding commands. + typeset -g POWERLEVEL9K_TIME_UPDATE_ON_COMMAND=true + typeset -g POWERLEVEL9K_TIME_FOREGROUND=130 +} + +(( ! p9k_classic_restore_aliases )) || setopt aliases +'builtin' 'unset' 'p9k_classic_restore_aliases' diff --git a/files/tmux-local.zsh b/files/tmux-local.zsh new file mode 100644 index 0000000..e9bb8bc --- /dev/null +++ b/files/tmux-local.zsh @@ -0,0 +1,8 @@ +if [[ -z "$TMUX" ]] && [ "$SSH_CONNECTION" = "" ]; then + tmux has-session -t $(tty | sed 's/^.....//') 2>/dev/null + if [ $? != 0 ]; then + exec tmux new-session -s $(tty | sed 's/^.....//') + else + exec tmux attach-session -t $(tty | sed 's/^.....//') + fi +fi diff --git a/files/tmux-ssh.zsh b/files/tmux-ssh.zsh new file mode 100644 index 0000000..b7929f4 --- /dev/null +++ b/files/tmux-ssh.zsh @@ -0,0 +1,13 @@ +if [[ -z "$TMUX" ]] && [ "$SSH_CONNECTION" != "" ]; then + tmux has-session -t remote 2>/dev/null + if [ $? != 0 ]; then + exec tmux new-session -s remote + else + exec tmux attach-session -t remote + fi +fi +if [ "$SSH_CONNECTION" != "" ]; then + tmux source-file $HOME/.tmux.conf.ssh +else + tmux source-file $HOME/.tmux.conf +fi diff --git a/files/tmux.conf.local b/files/tmux.conf.local new file mode 100644 index 0000000..0d08788 --- /dev/null +++ b/files/tmux.conf.local @@ -0,0 +1,308 @@ +# 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=true + +# 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=false + +# 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='' # /!\ you don't need to install Powerline +#tmux_conf_theme_left_separator_sub='' # you only need fonts patched with +#tmux_conf_theme_right_separator_main='' # Powerline symbols or the standalone +#tmux_conf_theme_right_separator_sub='' # PowerlineSymbols.otf font + +# 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_d} +# - #{uptime_h} +# - #{uptime_m} +# - #{uptime_s} +# - #{username} +# - #{username_ssh} +#tmux_conf_theme_status_left=' ❐ #S | ↑#{?uptime_d, #{uptime_d}d,}#{?uptime_h, #{uptime_h}h,}#{?uptime_m, #{uptime_m}m,} ' +tmux_conf_theme_status_left=' #S | ↑#{?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 +tmux_conf_theme_clock_colour='#00afff' # light blue +tmux_conf_theme_clock_style='12' + + +# -- 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 history-limit 10000 + +# 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-b +set -g prefix C-a +bind C-a send-prefix + +# move status line to top +#set -g status-position top + +bind \ split-window -h +unbind '"' +bind -n M-Left select-pane -L +bind -n M-Right select-pane -R +bind -n M-Up select-pane -U +bind -n M-Down select-pane -D +set-option -g allow-rename off +set-option -g history-limit 30000 +set -g default-shell /bin/zsh +bind p previous-window +bind n next-window + diff --git a/files/tmux.conf.ssh b/files/tmux.conf.ssh new file mode 100644 index 0000000..06f4b1b --- /dev/null +++ b/files/tmux.conf.ssh @@ -0,0 +1,23 @@ +set-option status-position top +set default-shell /bin/zsh +set default-terminal "screen-256color" + +#unbind C-b +unbind C-a +set prefix C-b +bind C-b send-prefix +#bind-key C-b send-prefix +#set-option prefix C-b + +bind \ split-window -h +bind - split-window -v +unbind '"' +unbind % + +bind -n M-Left select-pane -L +bind -n M-Right select-pane -R +bind -n M-Up select-pane -U +bind -n M-Down select-pane -D + +set-option -g allow-rename off +set-option -g history-limit 30000 diff --git a/files/zshrc b/files/zshrc new file mode 100644 index 0000000..299bf10 --- /dev/null +++ b/files/zshrc @@ -0,0 +1,107 @@ +# If you come from bash you might have to change your $PATH. +export PATH=$PATH:$HOME/bin + +# Path to your oh-my-zsh installation. +export ZSH=$HOME/.oh-my-zsh + +# Set name of the theme to load --- if set to "random", it will +# load a random theme each time oh-my-zsh is loaded, in which case, +# to know which specific one was loaded, run: echo $RANDOM_THEME +# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes +# ZSH_THEME="mortalscumbag" +# ZSH_THEME="powerlevel9k/powerlevel9k" +ZSH_THEME="powerlevel10k/powerlevel10k" + +# Set list of themes to pick from when loading at random +# Setting this variable when ZSH_THEME=random will cause zsh to load +# a theme from this variable instead of looking in ~/.oh-my-zsh/themes/ +# If set to an empty array, this variable will have no effect. +# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" ) + +# Uncomment the following line to use case-sensitive completion. +# CASE_SENSITIVE="true" + +# Uncomment the following line to use hyphen-insensitive completion. +# Case-sensitive completion must be off. _ and - will be interchangeable. +# HYPHEN_INSENSITIVE="true" + +# Uncomment the following line to disable bi-weekly auto-update checks. +# DISABLE_AUTO_UPDATE="true" + +# Uncomment the following line to automatically update without prompting. +# DISABLE_UPDATE_PROMPT="true" + +# Uncomment the following line to change how often to auto-update (in days). +# export UPDATE_ZSH_DAYS=13 + +# Uncomment the following line if pasting URLs and other text is messed up. +# DISABLE_MAGIC_FUNCTIONS=true + +# Uncomment the following line to disable colors in ls. +# DISABLE_LS_COLORS="true" + +# Uncomment the following line to disable auto-setting terminal title. +DISABLE_AUTO_TITLE="true" + +# Uncomment the following line to enable command auto-correction. +ENABLE_CORRECTION="true" + +# Uncomment the following line to display red dots whilst waiting for completion. +COMPLETION_WAITING_DOTS="true" + +# Uncomment the following line if you want to disable marking untracked files +# under VCS as dirty. This makes repository status check for large repositories +# much, much faster. +# DISABLE_UNTRACKED_FILES_DIRTY="true" + +# Uncomment the following line if you want to change the command execution time +# stamp shown in the history command output. +# You can set one of the optional three formats: +# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd" +# or set a custom format using the strftime function format specifications, +# see 'man strftime' for details. +HIST_STAMPS="dd/mm/yyyy" + +# Would you like to use another custom folder than $ZSH/custom? +ZSH_CUSTOM=$HOME/.config/zsh + +# Which plugins would you like to load? +# Standard plugins can be found in ~/.oh-my-zsh/plugins/* +# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/ +# Example format: plugins=(rails git textmate ruby lighthouse) +# Add wisely, as too many plugins slow down shell startup. +plugins=( + git + tmux + sudo + zsh-autosuggestions + zsh-syntax-highlighting +) + +source $ZSH/oh-my-zsh.sh + +# export MANPATH="/usr/local/man:$MANPATH" + +# You may need to manually set your language environment +export LANG=en_US.UTF-8 + +# Preferred editor for local and remote sessions +# if [[ -n $SSH_CONNECTION ]]; then +# export EDITOR='vim' +# else +# export EDITOR='mvim' +# fi + +# Compilation flags +export ARCHFLAGS="-arch x86_64" + +# Set personal aliases, overriding those provided by oh-my-zsh libs, +# plugins, and themes. Aliases can be placed here, though oh-my-zsh +# users are encouraged to define aliases within the ZSH_CUSTOM folder. +# For a full list of active aliases, run `alias`. +# +# Example aliases +# alias zshconfig="mate ~/.zshrc" +# alias ohmyzsh="mate ~/.oh-my-zsh" + +export SSH_KEY_PATH=$HOME/.ssh/rsa_id diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..02acf3b --- /dev/null +++ b/install.sh @@ -0,0 +1,116 @@ +#!/bin/bash + +working() { + tskpid=$! + statustxt=$1 + echo -ne "$statustxt\r" + while kill -0 $tskpid 2>/dev/null; do + echo -ne "$statustxt [*---]\r"; sleep 0.2 + echo -ne "\r\033[K" + echo -ne "$statustxt [-*--]\r"; sleep 0.2 + echo -ne "\r\033[K" + echo -ne "$statustxt [--*-]\r"; sleep 0.2 + echo -ne "\r\033[K" + echo -ne "$statustxt [---*]\r"; sleep 0.2 + echo -ne "\r\033[K" + echo -ne "$statustxt [--*-]\r"; sleep 0.2 + echo -ne "\r\033[K" + echo -ne "$statustxt [-*--]\r"; sleep 0.2 + echo -ne "\r\033[K" + done + echo "$statustxt [Done]" +} + +userhome=$HOME +SHELL_TEST=$(basename "$SHELL") + +funcheck=(dialog --title "ZPower Installer v2" --radiolist "Select the groups they belong:" 0 0 0) +options=(1 "Desktop Edition" on 2 "Server Edition" off) +selections=$("${funcheck[@]}" "${options[@]}" 2>&1 >/dev/tty) +clear +for selection in $selections +do + case $selection in + 1) + echo "Starting Desktop edition install" + zde=1 + zse=0 + ;; + 2) + echo "Starting Server edition install" + zse=1 + zde=0 + ;; + esac +done + +# Update/upgrade ubuntu repos +echo "Updating Ubuntu repos..." +sudo apt -qq update -y && sudo apt -qq upgrade -y || echo "apt update failed" + +# Install packages from Ubuntu repos +if [ $zse -eq 1 ]; then + sudo apt -qq install -y curl git zsh tmux powerline || echo "apt install failed" +else + sudo apt -qq install -y curl git zsh powerline || echo "apt install failed" +fi + +# Create directories +mkdir -m 755 -p $usrhome/.config/zsh/ $usrhome/.config/zsh/plugins $usrhome/.config/zsh/themes & working "Creating folders" + +# Clone git repos +## Oh-My-TMUX (framework) +if [ $zse -eq 1 ]; then + git clone --quiet https://github.com/gpakosz/.tmux.git $usrhome/.tmux & working "Cloning Oh-My-TMUX" +fi + +## Oh-My-ZSH (framework) +git clone --quiet --depth=1 https://github.com/robbyrussell/oh-my-zsh.git $usrhome/.oh-my-zsh & working "Cloning Oh-My-ZSH" +## ZSH Auto-Suggestions (plugin) +git clone --quiet https://github.com/zsh-users/zsh-autosuggestions.git $usrhome/.config/zsh/plugins/zsh-autosuggestions & working "Cloning zsh-autosuggestions" +## ZSH Syntax-highlighting (plugin) +git clone --quiet https://github.com/zsh-users/zsh-syntax-highlighting.git $usrhome/.config/zsh/plugins/zsh-syntax-highlighting & working "Cloning zsh-syntax-highlighting" +## Powerlevel10k (zsh-theme) +git clone --quiet https://github.com/romkatv/powerlevel10k.git $usrhome/.config/zsh/themes/powerlevel10k & working "Cloning powerlevel10k" + +# backup .zshrc +if [ -f $usrhome/.zshrc ] || [ -h $usrhome/.zshrc ]; then + echo Backing up $usrhome/.zshrc + mv $usrhome/.zshrc $usrhome/.zshrc.backup +fi + +# copy config files +echo "Installing config files" +## zshrc > $HOME/.zshrc +cp files/zshrc $usrhome/.zshrc +## aliases.zsh > $HOME/.config/zsh/aliases.zsh +cp files/aliases.zsh $usrhome/.config/zsh/aliases.zsh +if [ $zse -eq 1 ]; then + ## tmux-local.zsh > $HOME/.config/zsh/tmux-local.zsh + cp files/tmux-local.zsh $usrhome/.config/zsh/tmux-local.zsh + ## tmux-ssh.zsh > $HOME/.config/zsh/tmux-ssh.zsh + cp files/tmux-ssh.zsh $usrhome/.config/zsh/tmux-ssh.zsh + ## symlink $HOME/.tmux/tmux.conf > $HOME/.tmux.conf + ln -s $usrhome/.tmux/.tmux.conf $usrhome/.tmux.conf + ## tmux.conf.local > $HOME/.tmux.conf.local + cp files/tmux.conf.local $usrhome/.tmux.conf.local + ## tmux.conf.ssh > $HOME/.tmux.conf.ssh + cp files/tmux.conf.ssh $usrhome/.tmux.conf.ssh +fi +## p10k-clean.zsh > $HOME/.config/zsh/p10kclean.zsh +cp files/p10k-clean.zsh $usrhome/.config/zsh/p10k-clean.zsh +echo "done" + +# Change users shell to `ZSH` +if [ "$SHELL_TEST" != "zsh" ]; then + if hash chsh >/dev/null 2>&1; then + echo "Changing shell from $SHELL_TEST to zsh" + chsh -s $(grep /zsh$ /etc/shells | tail -1) + else + echo "Unable to change shell using `chsh`, please change shell manually" + fi +fi + +dialog --title "ZPower Installer" --msgbox "Log out and back in to enable new settings\nor\nrun 'exec zsh'\nin your current shell" 0 0 +clear +exit