From 89eae8e50a99960b3ca13072ec636b698ba86f6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cyryl=20P=C5=82otnicki?= Date: Sun, 13 Nov 2016 16:48:08 +0100 Subject: [PATCH 01/11] Remove oh-my-zsh --- .gitmodules | 6 ------ .oh-my-zsh | 1 - .oh-my-zsh-plugins/zsh-syntax-highlighting | 1 - common/configure_fresh_system | 2 -- 4 files changed, 10 deletions(-) delete mode 160000 .oh-my-zsh delete mode 160000 .oh-my-zsh-plugins/zsh-syntax-highlighting diff --git a/.gitmodules b/.gitmodules index 08084abd..27368516 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,15 +1,9 @@ -[submodule ".oh-my-zsh"] - path = .oh-my-zsh - url = git://github.com/robbyrussell/oh-my-zsh.git [submodule "tools/icdiff.git"] path = tools/icdiff.git url = https://github.com/jeffkaufman/icdiff.git [submodule "tools/subuser"] path = tools/subuser url = https://github.com/subuser-security/subuser -[submodule ".oh-my-zsh-plugins/zsh-syntax-highlighting"] - path = .oh-my-zsh-plugins/zsh-syntax-highlighting - url = git://github.com/zsh-users/zsh-syntax-highlighting.git [submodule ".vim/bundle/Vundle.vim"] path = .vim/bundle/Vundle.vim url = https://github.com/VundleVim/Vundle.vim.git diff --git a/.oh-my-zsh b/.oh-my-zsh deleted file mode 160000 index cff228e3..00000000 --- a/.oh-my-zsh +++ /dev/null @@ -1 +0,0 @@ -Subproject commit cff228e342a797b6ac0da7edb431f5f66de79ae4 diff --git a/.oh-my-zsh-plugins/zsh-syntax-highlighting b/.oh-my-zsh-plugins/zsh-syntax-highlighting deleted file mode 160000 index 3dc57419..00000000 --- a/.oh-my-zsh-plugins/zsh-syntax-highlighting +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 3dc574190071ef59054f6d693132410b37aa3ae4 diff --git a/common/configure_fresh_system b/common/configure_fresh_system index c5bb9f70..e62135ca 100755 --- a/common/configure_fresh_system +++ b/common/configure_fresh_system @@ -38,8 +38,6 @@ ln -vfs "$DIR/.tmux.conf" ~/. rm -f "~/.zshrc" ln -vfs "$DIR/.zshrc" ~/. ln -vfs "$DIR/.setenv" ~/. -ln -vfs "$DIR/.oh-my-zsh" ~/. -ln -vfs "$DIR/.oh-my-zsh-plugins/zsh-syntax-highlighting" ~/.oh-my-zsh/custom/plugins/ ln -vfs "$DIR/.Slic3r" ~/. ln -vfs "$DIR/.ghci" ~/. ln -vfs "$DIR/.conkyrc" ~/. From bef5f49d079f11873e40a13acd2c90ee04ec064c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cyryl=20P=C5=82otnicki?= Date: Sun, 13 Nov 2016 17:09:48 +0100 Subject: [PATCH 02/11] Add zprezto --- .gitmodules | 3 +++ .zprezto | 1 + common/configure_fresh_system | 7 ++++++- 3 files changed, 10 insertions(+), 1 deletion(-) create mode 160000 .zprezto diff --git a/.gitmodules b/.gitmodules index 27368516..2ac16912 100644 --- a/.gitmodules +++ b/.gitmodules @@ -7,3 +7,6 @@ [submodule ".vim/bundle/Vundle.vim"] path = .vim/bundle/Vundle.vim url = https://github.com/VundleVim/Vundle.vim.git +[submodule ".zprezto"] + path = .zprezto + url = https://github.com/sorin-ionescu/prezto.git diff --git a/.zprezto b/.zprezto new file mode 160000 index 00000000..4f197009 --- /dev/null +++ b/.zprezto @@ -0,0 +1 @@ +Subproject commit 4f19700919c8ebbaf75755fc0d03716d13183f49 diff --git a/common/configure_fresh_system b/common/configure_fresh_system index e62135ca..dcbc380b 100755 --- a/common/configure_fresh_system +++ b/common/configure_fresh_system @@ -36,7 +36,12 @@ ln -vfs "$DIR/.vim" ~/. ln -vfs "$DIR/.vimrc.linux" ~/.vimrc ln -vfs "$DIR/.tmux.conf" ~/. rm -f "~/.zshrc" -ln -vfs "$DIR/.zshrc" ~/. +ln -vfs "$DIR/.zprezto" ~/. +ln -vfs "$DIR/.zprezto/runcoms/zpreztorc" ~/.zpreztorc +ln -vfs "$DIR/.zprezto/runcoms/zprofile" ~/.zprofile +ln -vfs "$DIR/.zprezto/runcoms/zshenv" ~/.zshenv +ln -vfs "$DIR/.zprezto/runcoms/zshrc" ~/.zshrc + ln -vfs "$DIR/.setenv" ~/. ln -vfs "$DIR/.Slic3r" ~/. ln -vfs "$DIR/.ghci" ~/. From fcacd43093c5a49913f230a846c1ceda9ce2c4f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cyryl=20P=C5=82otnicki?= Date: Sun, 13 Nov 2016 17:16:45 +0100 Subject: [PATCH 03/11] Add custom zprofile --- .zprofile | 82 +++++++++++++++++++++++++++++++++++ .zshrc | 6 --- common/configure_fresh_system | 2 +- 3 files changed, 83 insertions(+), 7 deletions(-) create mode 100644 .zprofile diff --git a/.zprofile b/.zprofile new file mode 100644 index 00000000..40f47552 --- /dev/null +++ b/.zprofile @@ -0,0 +1,82 @@ +# +# Executes commands at login pre-zshrc. +# +# Authors: +# Sorin Ionescu +# + +# +# Browser +# + +if [[ "$OSTYPE" == darwin* ]]; then + export BROWSER='open' +fi + +# +# Editors +# + +export EDITOR='vim' +export VISUAL='vim' +export PAGER='less' + +# +# Language +# + +if [[ -z "$LANG" ]]; then + export LANG='en_GB.UTF-8' +fi + +# +# Paths +# + +# Ensure path arrays do not contain duplicates. +typeset -gU cdpath fpath mailpath path + +# Set the the list of directories that cd searches. +# cdpath=( +# $cdpath +# ) + + +# Set the list of directories that Zsh searches for programs. +path=( + /usr/local/{bin,sbin} + $path +) + +# +# Less +# + +# Set the default Less options. +# Mouse-wheel scrolling has been disabled by -X (disable screen clearing). +# Remove -X and -F (exit if the content fits on one screen) to enable it. +export LESS='-F -g -i -M -R -S -w -X -z-4' + +# Set the Less input preprocessor. +# Try both `lesspipe` and `lesspipe.sh` as either might exist on a system. +if (( $#commands[(i)lesspipe(|.sh)] )); then + export LESSOPEN="| /usr/bin/env $commands[(i)lesspipe(|.sh)] %s 2>&-" +fi + +# +# Temporary Files +# + +if [[ ! -d "$TMPDIR" ]]; then + export TMPDIR="/tmp/$LOGNAME" + mkdir -p -m 700 "$TMPDIR" +fi + +TMPPREFIX="${TMPDIR%/}/zsh" + +# stuff that checks if it's added to the .zshrc exipliclty +export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting +[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh + +# other common env vars +source ~/.setenv diff --git a/.zshrc b/.zshrc index 4b9581e2..fa863db2 100644 --- a/.zshrc +++ b/.zshrc @@ -47,12 +47,6 @@ fi alias benice="ionice -c3 nice -n20" -# stuff that checks if it's added to the .zshrc exipliclty -export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting -[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh - -# other common env vars -source ~/.setenv # TMUX if which tmux >/dev/null 2>&1; then diff --git a/common/configure_fresh_system b/common/configure_fresh_system index dcbc380b..1688f467 100755 --- a/common/configure_fresh_system +++ b/common/configure_fresh_system @@ -38,7 +38,7 @@ ln -vfs "$DIR/.tmux.conf" ~/. rm -f "~/.zshrc" ln -vfs "$DIR/.zprezto" ~/. ln -vfs "$DIR/.zprezto/runcoms/zpreztorc" ~/.zpreztorc -ln -vfs "$DIR/.zprezto/runcoms/zprofile" ~/.zprofile +ln -vfs "$DIR/.zprofile" ~/.zprofile ln -vfs "$DIR/.zprezto/runcoms/zshenv" ~/.zshenv ln -vfs "$DIR/.zprezto/runcoms/zshrc" ~/.zshrc From fb42fc872ffbcfe2327b91848ce72c6155179b79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cyryl=20P=C5=82otnicki?= Date: Sun, 13 Nov 2016 18:38:53 +0100 Subject: [PATCH 04/11] Starting Agnoster config for prezto --- .zpreztorc | 158 +++++++++++++++++++++++++++++++++++++++++++++++++++++ .zshrc | 23 +------- 2 files changed, 161 insertions(+), 20 deletions(-) create mode 100644 .zpreztorc diff --git a/.zpreztorc b/.zpreztorc new file mode 100644 index 00000000..b86d8137 --- /dev/null +++ b/.zpreztorc @@ -0,0 +1,158 @@ +# +# General +# + +# Set case-sensitivity for completion, history lookup, etc. +# zstyle ':prezto:*:*' case-sensitive 'yes' + +# Color output (auto set to 'no' on dumb terminals). +zstyle ':prezto:*:*' color 'yes' + +# Set the Zsh modules to load (man zshmodules). +# zstyle ':prezto:load' zmodule 'attr' 'stat' + +# Set the Zsh functions to load (man zshcontrib). +# zstyle ':prezto:load' zfunction 'zargs' 'zmv' + +# Set the Prezto modules to load (browse modules). +# The order matters. +zstyle ':prezto:load' pmodule \ + 'environment' \ + 'terminal' \ + 'editor' \ + 'history' \ + 'directory' \ + 'spectrum' \ + 'utility' \ + 'completion' \ + 'prompt' + +# +# Autosuggestions +# + +# Set the query found color. +# zstyle ':prezto:module:autosuggestions:color' found '' + +# +# Editor +# + +# Set the key mapping style to 'emacs' or 'vi'. +zstyle ':prezto:module:editor' key-bindings 'vi' + +# Auto convert .... to ../.. +# zstyle ':prezto:module:editor' dot-expansion 'yes' + +# +# Git +# + +# Ignore submodules when they are 'dirty', 'untracked', 'all', or 'none'. +# zstyle ':prezto:module:git:status:ignore' submodules 'all' + +# +# GNU Utility +# + +# Set the command prefix on non-GNU systems. +# zstyle ':prezto:module:gnu-utility' prefix 'g' + +# +# History Substring Search +# + +# Set the query found color. +# zstyle ':prezto:module:history-substring-search:color' found '' + +# Set the query not found color. +# zstyle ':prezto:module:history-substring-search:color' not-found '' + +# Set the search globbing flags. +# zstyle ':prezto:module:history-substring-search' globbing-flags '' + +# +# Pacman +# + +# Set the Pacman frontend. +# zstyle ':prezto:module:pacman' frontend 'yaourt' + +# +# Prompt +# + +# Set the prompt theme to load. +# Setting it to 'random' loads a random theme. +# Auto set to 'off' on dumb terminals. +zstyle ':prezto:module:prompt' theme 'agnoster' + +# +# Ruby +# + +# Auto switch the Ruby version on directory change. +# zstyle ':prezto:module:ruby:chruby' auto-switch 'yes' + +# +# Screen +# + +# Auto start a session when Zsh is launched in a local terminal. +# zstyle ':prezto:module:screen:auto-start' local 'yes' + +# Auto start a session when Zsh is launched in a SSH connection. +# zstyle ':prezto:module:screen:auto-start' remote 'yes' + +# +# SSH +# + +# Set the SSH identities to load into the agent. +# zstyle ':prezto:module:ssh:load' identities 'id_rsa' 'id_rsa2' 'id_github' + +# +# Syntax Highlighting +# + +# Set syntax highlighters. +# By default, only the main highlighter is enabled. +# zstyle ':prezto:module:syntax-highlighting' highlighters \ +# 'main' \ +# 'brackets' \ +# 'pattern' \ +# 'line' \ +# 'cursor' \ +# 'root' +# +# Set syntax highlighting styles. +# zstyle ':prezto:module:syntax-highlighting' styles \ +# 'builtin' 'bg=blue' \ +# 'command' 'bg=blue' \ +# 'function' 'bg=blue' + +# +# Terminal +# + +# Auto set the tab and window titles. +# zstyle ':prezto:module:terminal' auto-title 'yes' + +# Set the window title format. +zstyle ':prezto:module:terminal:window-title' format '%n@%m: %s' + +# Set the tab title format. +# zstyle ':prezto:module:terminal:tab-title' format '%m: %s' + +# +# Tmux +# + +# Auto start a session when Zsh is launched in a local terminal. +zstyle ':prezto:module:tmux:auto-start' local 'yes' + +# Auto start a session when Zsh is launched in a SSH connection. +# zstyle ':prezto:module:tmux:auto-start' remote 'yes' + +# Integrate with iTerm2. +# zstyle ':prezto:module:tmux:iterm' integrate 'yes' diff --git a/.zshrc b/.zshrc index fa863db2..5cf12061 100644 --- a/.zshrc +++ b/.zshrc @@ -1,12 +1,11 @@ -ZSH=$HOME/.oh-my-zsh +if [[ -s "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" ]]; then + source "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" +fi -ZSH_THEME="agnoster" COMPLETION_WAITING_DOTS="true" plugins=(vi-mode svn git python zsh-syntax-highlighting history-substring-search) -source $ZSH/oh-my-zsh.sh - HISTFILE=~/.histfile HISTSIZE=10240 SAVEHIST=10240 @@ -40,22 +39,6 @@ fi if [[ `uname` =~ 'CYGWIN.*' ]]; then export DISPLAY=:0.0 -else - alias tssh="torsocks ssh" - alias tscp="torsocks scp" fi alias benice="ionice -c3 nice -n20" - - -# TMUX -if which tmux >/dev/null 2>&1; then - # if no session is started, start a new session - test -z ${TMUX} && tmux - - # when quitting tmux, try to attach - while test -z ${TMUX}; do - tmux attach || break - done -fi - From c46f52f44b1b87c12bff98822f32f8996a4b0792 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cyryl=20P=C5=82otnicki?= Date: Sun, 13 Nov 2016 18:58:47 +0100 Subject: [PATCH 05/11] Do not patch agnoster's prompt as the old patch breaks the visuals --- .zshrc | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.zshrc b/.zshrc index 5cf12061..a12addc8 100644 --- a/.zshrc +++ b/.zshrc @@ -26,12 +26,6 @@ bindkey -M vicmd 'k' history-substring-search-up bindkey -M vicmd 'j' history-substring-search-down bindkey "^R" history-incremental-search-backward -# override prompt builder for the dir part -# render just the last dir name -prompt_dir() { - prompt_segment blue black '%1~' -} - # aliases if [[ `uname` == 'Darwin' ]]; then alias vim=/usr/local/Cellar/vim/7.4/bin/vim From a8684bb85ebc6df014bbe2829f2edfbe86b28e83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cyryl=20P=C5=82otnicki?= Date: Sun, 13 Nov 2016 19:02:36 +0100 Subject: [PATCH 06/11] Fix prompt to have just the last dir name in path --- .zshrc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.zshrc b/.zshrc index a12addc8..936eafa4 100644 --- a/.zshrc +++ b/.zshrc @@ -26,6 +26,11 @@ bindkey -M vicmd 'k' history-substring-search-up bindkey -M vicmd 'j' history-substring-search-down bindkey "^R" history-incremental-search-backward + +prompt_dir() { + prompt_segment blue $PRIMARY_FG ' %1~ ' +} + # aliases if [[ `uname` == 'Darwin' ]]; then alias vim=/usr/local/Cellar/vim/7.4/bin/vim From 3086a292c425ff0faa1c9b9ffca490d946a889ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cyryl=20P=C5=82otnicki?= Date: Sun, 13 Nov 2016 19:13:43 +0100 Subject: [PATCH 07/11] Enable modules in prezto --- .zpreztorc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.zpreztorc b/.zpreztorc index b86d8137..56c1e39e 100644 --- a/.zpreztorc +++ b/.zpreztorc @@ -25,7 +25,17 @@ zstyle ':prezto:load' pmodule \ 'spectrum' \ 'utility' \ 'completion' \ - 'prompt' + 'prompt' \ + 'archive' \ + 'autosuggestions' \ + 'fasd' \ + 'git' \ + 'history-substring-search' \ + 'node' \ + 'python' \ + 'ssh' \ + 'tmux' + # # Autosuggestions From 658d3028c0c2af53afe180e37fd64922e96830f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cyryl=20P=C5=82otnicki?= Date: Sun, 13 Nov 2016 19:16:31 +0100 Subject: [PATCH 08/11] Move fzf init to .zshrc as this is where fzf installer checks for it --- .zprofile | 2 -- .zshrc | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.zprofile b/.zprofile index 40f47552..883160fb 100644 --- a/.zprofile +++ b/.zprofile @@ -74,9 +74,7 @@ fi TMPPREFIX="${TMPDIR%/}/zsh" -# stuff that checks if it's added to the .zshrc exipliclty export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting -[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh # other common env vars source ~/.setenv diff --git a/.zshrc b/.zshrc index 936eafa4..e0acf602 100644 --- a/.zshrc +++ b/.zshrc @@ -41,3 +41,5 @@ if [[ `uname` =~ 'CYGWIN.*' ]]; then fi alias benice="ionice -c3 nice -n20" + +[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh From 0a261d7f1cd8d24613983480731f388176be8b98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cyryl=20P=C5=82otnicki?= Date: Sun, 13 Nov 2016 19:55:32 +0100 Subject: [PATCH 09/11] Link in proper prezto configuration files --- common/configure_fresh_system | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/configure_fresh_system b/common/configure_fresh_system index 1688f467..137ba01f 100755 --- a/common/configure_fresh_system +++ b/common/configure_fresh_system @@ -37,10 +37,10 @@ ln -vfs "$DIR/.vimrc.linux" ~/.vimrc ln -vfs "$DIR/.tmux.conf" ~/. rm -f "~/.zshrc" ln -vfs "$DIR/.zprezto" ~/. -ln -vfs "$DIR/.zprezto/runcoms/zpreztorc" ~/.zpreztorc +ln -vfs "$DIR/.zpreztorc" ~/.zpreztorc ln -vfs "$DIR/.zprofile" ~/.zprofile ln -vfs "$DIR/.zprezto/runcoms/zshenv" ~/.zshenv -ln -vfs "$DIR/.zprezto/runcoms/zshrc" ~/.zshrc +ln -vfs "$DIR/.zshrc" ~/.zshrc ln -vfs "$DIR/.setenv" ~/. ln -vfs "$DIR/.Slic3r" ~/. From 7d5472627e5fa188e515a7a0727fd235d4b41375 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cyryl=20P=C5=82otnicki?= Date: Sun, 13 Nov 2016 19:59:53 +0100 Subject: [PATCH 10/11] Make ssh keyfile permissions sane on windows --- .zprofile | 2 -- .zshrc | 2 ++ windows/build_insider.sh | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.zprofile b/.zprofile index 40f47552..883160fb 100644 --- a/.zprofile +++ b/.zprofile @@ -74,9 +74,7 @@ fi TMPPREFIX="${TMPDIR%/}/zsh" -# stuff that checks if it's added to the .zshrc exipliclty export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting -[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh # other common env vars source ~/.setenv diff --git a/.zshrc b/.zshrc index 936eafa4..e0acf602 100644 --- a/.zshrc +++ b/.zshrc @@ -41,3 +41,5 @@ if [[ `uname` =~ 'CYGWIN.*' ]]; then fi alias benice="ionice -c3 nice -n20" + +[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh diff --git a/windows/build_insider.sh b/windows/build_insider.sh index 2d6bc0f1..10bb1c53 100644 --- a/windows/build_insider.sh +++ b/windows/build_insider.sh @@ -2,6 +2,8 @@ set -e +chmod ao-rwx ~/.ssh/id_rsa + DOTFILES_PATH="$HOME/dev/dotfiles" mkdir -pv $HOME/dev/ ln -vfs "$OUTER_CLONE/.gitconfig.cygwin" $HOME/.gitconfig From 7b84f772ba48cf7ab1033f02ee69e77d92c019e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cyryl=20P=C5=82otnicki?= Date: Mon, 14 Nov 2016 07:01:35 +0100 Subject: [PATCH 11/11] Do not fail on no ssh key - useful on CI --- windows/build_insider.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/windows/build_insider.sh b/windows/build_insider.sh index 10bb1c53..f56557bf 100644 --- a/windows/build_insider.sh +++ b/windows/build_insider.sh @@ -1,9 +1,11 @@ #!/bin/bash -set -e +set +e chmod ao-rwx ~/.ssh/id_rsa +set -e + DOTFILES_PATH="$HOME/dev/dotfiles" mkdir -pv $HOME/dev/ ln -vfs "$OUTER_CLONE/.gitconfig.cygwin" $HOME/.gitconfig