From c1d1b3177831645a76da8bdacc98f18c8963b1f9 Mon Sep 17 00:00:00 2001 From: bretello Date: Mon, 17 Jul 2017 01:28:35 +0200 Subject: [PATCH] Added brethil-mobile.zsh-theme. Minor bugfixes --- README.md | 14 +++++++++----- aliases.sh | 10 +++------- brethil-minimal.zsh-theme | 8 ++++++++ brethil_dotfile.sh | 2 +- functions.sh | 17 +++++++---------- install.sh | 13 ++++++++----- 6 files changed, 36 insertions(+), 28 deletions(-) create mode 100644 brethil-minimal.zsh-theme diff --git a/README.md b/README.md index 16198ff..ed5841c 100644 --- a/README.md +++ b/README.md @@ -17,9 +17,10 @@ Copy the dotfiles folder to the location where you want to keep it and then run Installs oh-my-zsh and sources aliases.sh, functions.sh and colors.sh, as well as installing a a few utilities (see `install.sh`). -### Installed programs ### +### Installed ### 0. oh-my-zsh (zsh config framework, lots of plugins available at https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins) + Two zsh themes: brethil and brethil-minimal. 1. byobu (wrapper/config for tmux, a screen multiplexer) 2. grc/ccze (output colorizers, color output of any command). Usage: $ grc programname @@ -28,7 +29,6 @@ a a few utilities (see `install.sh`). 4. rmate remote for Textmate (can be called with `mate`/`rmate`) 5. mtr (my traceroute, traceroute+ping network utility) - ### Available Functions ### 0. `cheat`, show cheat sheet for commands using cheat.sh (`cheat commandname`) @@ -52,7 +52,7 @@ creates a 4GB RAM disk ### Files/Folders ### -1. `~/bin`, `~/python`, `~/projects` folders +1. `~/bin`, `~/git`, `~/projects` folders 2. ssh config (`~/.ssh/config`): * Create ssh keys if not defined already * Keep connections alive by increasing timeout time @@ -60,14 +60,18 @@ creates a 4GB RAM disk * (Optional: Compression, this should allow more responsive shells with slow connections, but will slow things down when copying large files. My suggestion is to have compression enabled on a by-host basis in `~/.ssh/config`) -3. brethil.zsh-theme, theme for oh-my-zsh, symlinked in ~/.oh-my-zsh/custom/themes +3. brethil.zsh-theme, brethil-minimal.zsh-themes, themes for oh-my-zsh, symlinked in `$ZSH/custom/themes` ($ZSH=~/.oh-my-zsh) 4. ~/.dotfiles_functions, ~/.dotfiles_aliases are sourced by this dotfiles, allowing for custom functions/aliases 5. useful_commands contains a list of useful commands (the first rule of the tautology club...) + ### Misc ### -1. Colored output for: `diff`, `configure`, `make`, `gcc`, `g`, `as`, `gas`, `ld`, `netstat`, `ping`, `traceroute`, `head`, `tail`, `dig`, `mount`, `ps`, `mtr` +1. Colored output (via `grc`) for: `diff`, `configure`, `make`, `gcc`, `g`, `as`, `gas`, `ld`, `netstat`, `ping`, `traceroute`, `head`, `tail`, `dig`, `mount`, `ps`, `mtr` 2. Easy names for ANSI color escapes (Black, Red, Green, Yellow, Blue, Cyan, Purple, White, CLEAR), for example: `echo -e "${Green}This text will be green${CLEAR}"` will result in green text. Use `$CLEAR` to clear previous escape sequences add B before the variable (check colors.sh) name to use **bold** and U to underline (examples: $BRed, $UBlack for bold red and underlined black) +3. Type `esc` twice to add `sudo` before the current command +4. Autoupdate script running every two weeks, autoupdate function: dotfiles_selfupdate (or `git pull` from `$DOTFILES` folder) +5. \ No newline at end of file diff --git a/aliases.sh b/aliases.sh index 090af77..ca8b938 100755 --- a/aliases.sh +++ b/aliases.sh @@ -57,10 +57,6 @@ alias upcd='. upcd.sh' ## Show the last 10 modified files alias lsrt="ls -lrt | tail -10" -##################### -#### New features -##################### - ## List open connections, TCP and UDP alias listconnections="lsof -n -i TCP -i UDP" ## Stress (run stress &>/dev/null &) @@ -78,9 +74,9 @@ alias ssh1="ssh -o ControlMaster=no" # Some colorizing options for grc GRC=`which grc` -if [ "$TERM" != dumb ] && [ -n "$GRC" ] -then - alias colourify="$GRC -es --colour=auto" +if [ "$TERM" != dumb ] && [ -n "$GRC" ]; then + #alias colourify="$GRC -es --colour=auto" + alias colourify="$GRC --colour=auto" alias configure='colourify ./configure' alias diff='colourify diff' alias make='colourify make' diff --git a/brethil-minimal.zsh-theme b/brethil-minimal.zsh-theme new file mode 100644 index 0000000..2dc563f --- /dev/null +++ b/brethil-minimal.zsh-theme @@ -0,0 +1,8 @@ +ret_status="%(?:%{$fg_bold[green]%}➜%{$reset_color%}:%{$fg[red]%}➜%{$reset_color%})" +user="%(#:[root]:)" +PROMPT='%{$fg[red]%}${user}%{$reset_color%}[:%{$fg[green]%}%c%{$reset_color%}]$(git_prompt_info) ${ret_status} ' + +ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[yellow]%}git:(" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$fg[yellow]%})%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[white]%} %{$fg[red]%}✗%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[white]%} %{$fg[green]%}√%{$reset_color%}" \ No newline at end of file diff --git a/brethil_dotfile.sh b/brethil_dotfile.sh index d545a5a..2104b67 100755 --- a/brethil_dotfile.sh +++ b/brethil_dotfile.sh @@ -2,7 +2,7 @@ env ZSH=$ZSH DISABLE_UPDATE_PROMPT=$DISABLE_UPDATE_PROMPT zsh -f $DOTFILES/check_for_update.sh # oh-my-zsh plugins (some of these have to be installed by running install.sh or install_zsh_plugins, found in install.sh) -shared_plugins=(git common-aliases fast-syntax-highlighting zsh-autosuggestions colored-man-pages zsh-navigation-tools zsh_reload cheat) +shared_plugins=(git brew common-aliases fast-syntax-highlighting zsh-autosuggestions colored-man-pages zsh-navigation-tools zsh_reload sudo alias-tips) uname=$(uname -a) if [[ $uname == *"Darwin"* ]]; then diff --git a/functions.sh b/functions.sh index 37876dd..83cdc28 100755 --- a/functions.sh +++ b/functions.sh @@ -157,13 +157,11 @@ function list_functions ## MAC SPECIFIC # ########################### -if [[ "$(uname)" == "Darwin" ]]; -then +if [[ "$(uname)" == "Darwin" ]]; then ## Create a RAM disk. Default size 1GB. If supplied, first argument defines the RAM disk size in GB function ramdisk { - if [[ -e $1 ]]; - then + if [[ -e $1 ]]; then sizeingb=$1 else sizeingb=1 @@ -199,16 +197,15 @@ function man2pdf ## Open Man in separate (different-looking) window function nman { - if [ $# -eq 1 ] ; - then open x-man-page://$1 ; - elif [ $# -eq 2 ] ; - then open x-man-page://$1/$2 ; + if [ $# -eq 1 ] ; then + open x-man-page://$1 ; + elif [ $# -eq 2 ] ; then + open x-man-page://$1/$2 ; fi } fi # end of mac-specific functions -if [[ -f ~/.dotfiles_functions ]]; -then +if [[ -f ~/.dotfiles_functions ]]; then source ~/.dotfiles_functions fi diff --git a/install.sh b/install.sh index 2371008..731440f 100755 --- a/install.sh +++ b/install.sh @@ -59,17 +59,17 @@ function create_ssh_config { echo "Enter ssh-key comment (leave empty for default: user@host)" read comment - if [[ $comment ]]; + if [[ $comment ]]; then ssh-keygen -t rsa -b 4096 -C $comment else ssh-keygen -t rsa -b 4096 - done + fi # fix permissions chmod 0700 "$HOME/.ssh" fi if [[ -f $ssh_config ]]; then - until [[ $modifyssh == "y" ]] or [[ $modifyssh == "n" ]]; do + until [[ $modifyssh == "y" || $modifyssh == "n" ]]; do echo "Do you want to modify the existing ssh config? (New values will be appended) (y/n)" read modifyssh done @@ -137,12 +137,13 @@ function brethil_dotfiles_setup { done if [[ $yn == "y" ]]; then echo "Launching an interactive shell. Type exit after installing sudo." - /bin/bash + # Launch bash + $(which bash) else echo "Quitting." exit 0 fi - else [[ -f $(which sudo) ]]; then + elif [[ -f $(which sudo) ]]; then sudo="sudo " fi fi @@ -205,6 +206,8 @@ function brethil_dotfiles_setup { # Symlink brethil.zsh-theme ln -s $DOTFILES/brethil.zsh-theme $HOME/.oh-my-zsh/themes/ + # Symlink brethil-minimal.zsh-theme + ln -s $DOTFILES/brethil-minimal.zsh-theme $HOME/.oh-my-zsh/themes/ # Set brethil theme if [[ $(uname) == "Darwin" ]]; then # MacOS has a different syntax for sed