diff --git a/.gitmodules b/.gitmodules index 38136e3..b8bbacf 100644 --- a/.gitmodules +++ b/.gitmodules @@ -22,9 +22,6 @@ [submodule "tmux/plugins/tpm"] path = tmux/plugins/tpm url = https://github.com/tmux-plugins/tpm.git -[submodule "zsh"] - path = zsh - url = https://github.com/zimfw/zimfw [submodule "tmux"] path = tmux url = https://github.com/tony/tmux-config diff --git a/.tmux.conf b/.tmux.conf new file mode 100644 index 0000000..5adb5da --- /dev/null +++ b/.tmux.conf @@ -0,0 +1,110 @@ +# https://github.com/seebi/tmux-colors-solarized/blob/master/tmuxcolors-256.conf +set-option -g status-bg colour235 #base02 +set-option -g status-fg colour136 #yellow +set-option -g status-attr default + +# set window split +bind-key v split-window -h +bind-key b split-window + +# default window title colors +set-window-option -g window-status-fg colour244 #base0 +set-window-option -g window-status-bg default +#set-window-option -g window-status-attr dim + +# active window title colors +set-window-option -g window-status-current-fg colour166 #orange +set-window-option -g window-status-current-bg default +#set-window-option -g window-status-current-attr bright + +# pane border +set-option -g pane-border-fg colour235 #base02 +set-option -g pane-active-border-fg colour240 #base01 + +# message text +set-option -g message-bg colour235 #base02 +set-option -g message-fg colour166 #orange + +# pane number display +set-option -g display-panes-active-colour colour33 #blue +set-option -g display-panes-colour colour166 #orange +# clock +set-window-option -g clock-mode-colour green #green + + +set -g status-interval 1 +set -g status-justify centre # center align window list +set -g status-left-length 20 +set -g status-right-length 140 +set -g status-left '#[fg=green]#H #[fg=black]• #[fg=green,bright]#(uname -r | cut -c 1-6)#[default]' +set -g status-right '#[fg=green,bg=default,bright]#(tmux-mem-cpu-load) #[fg=red,dim,bg=default]#(uptime | cut -f 4-5 -d " " | cut -f 1 -d ",") #[fg=white,bg=default]%a%l:%M:%S %p#[default] #[fg=blue]%Y-%m-%d' + +# C-b is not acceptable -- Vim uses it +set-option -g prefix C-a +bind-key C-a last-window + +# Start numbering at 1 +set -g base-index 1 + +# Allows for faster key repetition +set -s escape-time 0 + +# Rather than constraining window size to the maximum size of any client +# connected to the *session*, constrain window size to the maximum size of any +# client connected to *that window*. Much more reasonable. +setw -g aggressive-resize on + +# Allows us to use C-a a to send commands to a TMUX session inside +# another TMUX session +bind-key a send-prefix + +# Activity monitoring +setw -g monitor-activity on +set -g visual-activity on + +# hjkl pane traversal +bind h select-pane -L +bind j select-pane -D +bind k select-pane -U +bind l select-pane -R + +# set to main-horizontal, 66% height for main pane +bind m run-shell "~/.tmux/scripts/resize-adaptable.sh -l main-horizontal -p 66" +# Same thing for verical layouts +bind M run-shell "~/.tmux/scripts/resize-adaptable.sh -l main-vertical -p 50" + +bind-key C command-prompt -p "Name of new window: " "new-window -n '%%'" + +# reload config +bind r source-file ~/.tmux.conf \; display-message "Config reloaded..." + +# auto window rename +set-window-option -g automatic-rename + +# color +set -g default-terminal "screen-256color" + +# https://github.com/edkolev/dots/blob/master/tmux.conf +# Updates for tmux 1.9's current pane splitting paths. + +# from powerline +run-shell "tmux set-environment -g TMUX_VERSION_MAJOR $(tmux -V | cut -d' ' -f2 | cut -d'.' -f1 | sed 's/[^0-9]*//g')" +run-shell "tmux set-environment -g TMUX_VERSION_MINOR $(tmux -V | cut -d' ' -f2 | cut -d'.' -f2 | sed 's/[^0-9]*//g')" + +# Vi copypaste mode +set-window-option -g mode-keys vi +if-shell "test '\( #{$TMUX_VERSION_MAJOR} -eq 2 -a #{$TMUX_VERSION_MINOR} -ge 4 \)'" 'bind-key -Tcopy-mode-vi v send -X begin-selection; bind-key -Tcopy-mode-vi y send -X copy-selection-and-cancel' +if-shell '\( #{$TMUX_VERSION_MAJOR} -eq 2 -a #{$TMUX_VERSION_MINOR} -lt 4\) -o #{$TMUX_VERSION_MAJOR} -le 1' 'bind-key -t vi-copy v begin-selection; bind-key -t vi-copy y copy-selection' + +# status bar +if-shell '\( #{$TMUX_VERSION_MAJOR} -eq 2 -a #{$TMUX_VERSION_MINOR} -lt 2\) -o #{$TMUX_VERSION_MAJOR} -le 1' 'set-option -g status-utf8 on' + +# rm mouse mode fail +if-shell '\( #{$TMUX_VERSION_MAJOR} -eq 2 -a #{$TMUX_VERSION_MINOR} -ge 1\)' 'set -g mouse off' +if-shell '\( #{$TMUX_VERSION_MAJOR} -eq 2 -a #{$TMUX_VERSION_MINOR} -lt 1\) -o #{$TMUX_VERSION_MAJOR} -le 1' 'set -g mode-mouse off' + +# fix pane_current_path on new window and splits +if-shell "test '#{$TMUX_VERSION_MAJOR} -gt 1 -o \( #{$TMUX_VERSION_MAJOR} -eq 1 -a #{$TMUX_VERSION_MINOR} -ge 8 \)'" 'unbind c; bind c new-window -c "#{pane_current_path}"' +if-shell "test '#{$TMUX_VERSION_MAJOR} -gt 1 -o \( #{$TMUX_VERSION_MAJOR} -eq 1 -a #{$TMUX_VERSION_MINOR} -ge 8 \)'" "unbind '\"'; bind '\"' split-window -v -c '#{pane_current_path}'" +if-shell "test '#{$TMUX_VERSION_MAJOR} -gt 1 -o \( #{$TMUX_VERSION_MAJOR} -eq 1 -a #{$TMUX_VERSION_MINOR} -ge 8 \)'" 'unbind v; bind v split-window -h -c "#{pane_current_path}"' +if-shell "test '#{$TMUX_VERSION_MAJOR} -gt 1 -o \( #{$TMUX_VERSION_MAJOR} -eq 1 -a #{$TMUX_VERSION_MINOR} -ge 8 \)'" 'unbind %; bind % split-window -h -c "#{pane_current_path}"' diff --git a/.zimrc b/.zimrc index b8daa5f..b3c47fd 100644 --- a/.zimrc +++ b/.zimrc @@ -1,115 +1,38 @@ -################## -# CORE SETTINGS # -################# +# Start configuration added by Zim install {{{ +# ------- +# Modules +# ------- -# -# Zim settings -# - -# Select what modules you would like enabled. -# The second line of modules may depend on options set by modules in the first line. -# These dependencies are noted on the respective module's README.md. -zmodules=(directory environment history input utility custom \ - syntax-highlighting prompt completion \ - pacman git-info fasd autosuggestions ) - -# source ~/.zim/modules/autosuggestions/autosuggestions.zsh - -################### -# MODULE SETTINGS # -################### +# Sets sane Zsh built-in environment options. +zmodule environment +# Provides handy git aliases and functions. +zmodule git +# Applies correct bindkeys for input events. +zmodule input +# Sets a custom terminal title. +zmodule termtitle +# Utility aliases and functions. Adds colour to ls, grep and less. +zmodule utility # # Prompt # +# Exposes git repository status information to prompts. +zmodule git-info +# A customizable version of steeef's prompt theme. +zmodule steeef -# Set your desired prompt here -zprompt_theme='steeef' - -# -# Completion -# - -# set an optional host-specific filename for the completion cache file -# if none is provided, the default '.zcompdump' is used. -#zcompdump_file=".zcompdump-${HOST}-${ZSH_VERSION}" - -# -# Utility -# - -# Uncomment to enable command correction prompts -# See: http://zsh.sourceforge.net/Doc/Release/Options.html#Input_002fOutput -setopt CORRECT - -# -# Environment -# - -# Set the string below to the desired terminal title format string. -# The terminal title is redrawn upon directory change, however, variables like -# ${PWD} are only evaluated once. Use prompt expansion strings for dynamic data: -# http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html#Simple-Prompt-Escapes -# The example below uses the following format: 'username@host:/current/directory' -ztermtitle='%n@%m:%~' - -# -# Input -# - -# Uncomment to enable double-dot expansion. -# This appends '../' to your input for each '.' you type after an initial '..' -#zdouble_dot_expand='true' - -# -# Syntax-Highlighting -# - -# This determines what highlighters will be used with the syntax-highlighting module. -# Documentation of the highlighters can be found here: -# https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/docs/highlighters.md -# For (u)rxvt, termite and gnome-terminal users, -# removing the 'cursor' highlighter will fix the disappearing cursor problem -zhighlighters=(main brackets) - - -# -# SSH -# - -# Load these ssh identities with the ssh module -zssh_ids=(id_ed25519) - -# Load any helper scripts as defined here -zpacman_helper=(aur) - -# URXVT fix -autoload -Uz add-zsh-hook -function xterm_title_precmd () { - print -Pn '\e]2;%n@%m:%~\a' -} - -if [[ "$TERM" == (screen*|xterm*|rxvt*) ]]; then - add-zsh-hook -Uz precmd xterm_title_precmd -fi - - -# ALIASES -alias -g cb="xclip -selection clipboard" -alias -g tb="nc termbin.com 9999 | xclip -selection clipboard" -alias -g sshot='xfce4-screenshooter -o "$(which xclip) -i -t image/png -selection clipboard" $@' -alias -g pdf='zathura' - -# History search -bindkey -v -# bindkey '^R' history-incremental-search-backward - -export VISUAL="vim" -export PATH=/usr/local/texlive/2016/bin/x86_64-linux:$PATH -export PATH=/usr/local/texlive/2017/bin/x86_64-linux:$PATH -export PATH=$HOME/go/bin:$PATH - -# If not running interactively, do not do anything -[[ $- != *i* ]] && return -[[ -z "$TMUX" ]] && exec tmux -u - +# Additional completion definitions for Zsh. +zmodule zsh-users/zsh-completions +# Enables and configures smart and extensive tab completion. +# completion must be sourced after zsh-users/zsh-completions +zmodule completion +# Fish-like autosuggestions for Zsh. +zmodule zsh-users/zsh-autosuggestions +# Fish-like syntax highlighting for Zsh. +# zsh-users/zsh-syntax-highlighting must be sourced after completion +zmodule zsh-users/zsh-syntax-highlighting +# Fish-like history search (up arrow) for Zsh. +# zsh-users/zsh-history-substring-search must be sourced after zsh-users/zsh-syntax-highlighting +zmodule zsh-users/zsh-history-substring-search +# }}} End configuration added by Zim install diff --git a/.zshrc b/.zshrc index a2359d1..31e57c1 100644 --- a/.zshrc +++ b/.zshrc @@ -1,17 +1,134 @@ +# GPG for SSH +export GPG_TTY="$(tty)" +export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket) +gpgconf --launch gpg-agent + +# Start configuration added by Zim install {{{ # # User configuration sourced by interactive shells # -# Change default zim location -export ZIM_HOME=${ZDOTDIR:-${HOME}}/.zim +# ----------------- +# Zsh configuration +# ----------------- -# Start zim -[[ -s ${ZIM_HOME}/init.zsh ]] && source ${ZIM_HOME}/init.zsh +# +# History +# + +# Remove older command from the history if a duplicate is to be added. +setopt HIST_IGNORE_ALL_DUPS + +# +# Input/output +# + +# Set editor default keymap to emacs (`-e`) or vi (`-v`) +bindkey -e + +# Prompt for spelling correction of commands. +#setopt CORRECT + +# Customize spelling correction prompt. +#SPROMPT='zsh: correct %F{red}%R%f to %F{green}%r%f [nyae]? ' + +# Remove path separator from WORDCHARS. +WORDCHARS=${WORDCHARS//[\/]} + + +# -------------------- +# Module configuration +# -------------------- + +# +# completion +# + +# Set a custom path for the completion dump file. +# If none is provided, the default ${ZDOTDIR:-${HOME}}/.zcompdump is used. +#zstyle ':zim:completion' dumpfile "${ZDOTDIR:-${HOME}}/.zcompdump-${ZSH_VERSION}" + +# +# git +# + +# Set a custom prefix for the generated aliases. The default prefix is 'G'. +#zstyle ':zim:git' aliases-prefix 'g' + +# +# input +# + +# Append `../` to your input for each `.` you type after an initial `..` +#zstyle ':zim:input' double-dot-expand yes + +# +# termtitle +# + +# Set a custom terminal title format using prompt expansion escape sequences. +# See http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html#Simple-Prompt-Escapes +# If none is provided, the default '%n@%m: %~' is used. +#zstyle ':zim:termtitle' format '%1~' + +# +# zsh-autosuggestions +# + +# Customize the style that the suggestions are shown with. +# See https://github.com/zsh-users/zsh-autosuggestions/blob/master/README.md#suggestion-highlight-style +#ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=10' + +# +# zsh-syntax-highlighting +# + +# Set what highlighters will be used. +# See https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/docs/highlighters.md +ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets) + +# Customize the main highlighter styles. +# See https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/docs/highlighters/main.md#how-to-tweak-it +#typeset -A ZSH_HIGHLIGHT_STYLES +#ZSH_HIGHLIGHT_STYLES[comment]='fg=10' + +# ------------------ +# Initialize modules +# ------------------ + +if [[ ! ${ZIM_HOME}/init.zsh -nt ${ZDOTDIR:-${HOME}}/.zimrc ]]; then + # Update static initialization script if it does not exist or it's outdated, before sourcing it + source ${ZIM_HOME}/zimfw.zsh init -q +fi +source ${ZIM_HOME}/init.zsh + +# ------------------------------ +# Post-init module configuration +# ------------------------------ + +# +# zsh-history-substring-search +# + +# Bind ^[[A/^[[B manually so up/down works both before and after zle-line-init +bindkey '^[[A' history-substring-search-up +bindkey '^[[B' history-substring-search-down + +# Bind up and down keys +zmodload -F zsh/terminfo +p:terminfo +if [[ -n ${terminfo[kcuu1]} && -n ${terminfo[kcud1]} ]]; then + bindkey ${terminfo[kcuu1]} history-substring-search-up + bindkey ${terminfo[kcud1]} history-substring-search-down +fi + +bindkey '^P' history-substring-search-up +bindkey '^N' history-substring-search-down +bindkey -M vicmd 'k' history-substring-search-up +bindkey -M vicmd 'j' history-substring-search-down +# }}} End configuration added by Zim install export FZF_DEFAULT_COMMAND='fd --type f' source /usr/share/fzf/completion.zsh source /usr/share/fzf/key-bindings.zsh alias pdfdiff="diffpdf" -# Add RVM to PATH for scripting. Make sure this is the last PATH variable change. -export PATH="$PATH:$HOME/.rvm/bin" diff --git a/Makefile b/Makefile index efafdee..d5c8072 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,3 @@ -urlview: - rm ~/.urlview || true - ln -s ~/.dotfiles/.urlview ~/.urlview tmux: git submodule init git submodule update @@ -10,10 +7,8 @@ tmux: vim: ln -s ~/.dotfiles/vim ~/.vim ln -s ~/.dotfiles/vim/.vimrc ~/.vimrc - # sudo pip3 uninstall greenlet sudo pip3 install neovim - #sudo pip2 uninstall greenlet - sudo pacman -S python-greenlet + sudo pacman -S python-greenlet || true mkdir -p ~/.dotfiles/vim/.swp mkdir -p ~/.dotfiles/vim/.undo mkdir -p ~/.dotfiles/vim/.backup @@ -24,24 +19,15 @@ git: ln -s ~/.dotfiles/.gitconfig ~/.gitconfig ln -s ~/.dotfiles/.gitmessage ~/.gitmessage -xresources: - rm ~/.Xresources - ln -s ~/.dotfiles/.Xresources ~/.Xresources -xcompose: - rm ~/.XCompose || true - ln -s ~/.dotfiles/.XCompose ~/.XCompose +gnupg: + for i in $(ls gnupg -1); do rm ~/.gnupg/$i; ln -s ~/.dotfiles/gnupg/$i ~/.gnupg/$i; done -albert: - ln -s ~/.dotfiles/albert ~/.config/albert - -zsh: dep - cd ~/.dotfiles/zsh/ && git submodule init && git submodule update --recursive - rm ~/.zim || echo - ln -s ~/.dotfiles/zsh ~/.zim +zsh: + rm -rf ~/.zim || true cd ~/.dotfiles - zsh zimsetup.zsh - rm ~/.zimrc || echo - rm ~/.zshrc || echo + curl -fsSL https://raw.githubusercontent.com/zimfw/install/master/install.zsh | zsh + rm ~/.zimrc || true + rm ~/.zshrc || true ln -s ~/.dotfiles/.zimrc ~/.zimrc ln -s ~/.dotfiles/.zshrc ~/.zshrc @@ -52,19 +38,12 @@ i3: dep ln -s ~/.dotfiles/i3 ~/.config/i3 cd i3/conf/ && ./build.sh -.PHONY: clean zsh git vim tmux i3 albert +.PHONY: clean zsh git vim tmux i3 albert gnupg clean: rm -rf ~/.vim ~/.vimrc ~/.tmux ~/.tmux.conf ~/.gitconfig ~/.config/i3 rm -rf ~/.zshrc ~/.zimrc ~/.zim ~/.zlogin ~/.compton.conf - rm -rf ~/.mailcap ~/.zsh + rm -rf ~/.mailcap ~/.zsh rm -rf ~/.config/albert rm -rf /tmp/makedir/ -dep: - git clone https://aur.archlinux.org/powerline-fonts-git.git /tmp/makedir/powerline-font - cd /tmp/makedir/powerline-font && makepkg -Acsi - git clone https://aur.archlinux.org/bumblebee-status-git.git /tmp/makedir/bumblebee - cd /tmp/makedir/bumblebee && makepkg -Acsi - sudo pacman -S awesome-terminal-fonts perl-anyevent-i3 perl-json-xs w3m fzf fd - -all: clean i3 zsh compton xcompose xresources albert git vim tmux urlview +all: clean zsh git vim tmux diff --git a/gnupg/gpg-agent.conf b/gnupg/gpg-agent.conf new file mode 100644 index 0000000..5f48733 --- /dev/null +++ b/gnupg/gpg-agent.conf @@ -0,0 +1,7 @@ +default-cache-ttl 2 +default-cache-ttl-ssh 5 +max-cache-ttl 2 +max-cache-ttl-ssh 30 +no-allow-external-cache +enable-ssh-support +ignore-cache-for-signing diff --git a/gnupg/gpg.conf b/gnupg/gpg.conf new file mode 100644 index 0000000..ca17a09 --- /dev/null +++ b/gnupg/gpg.conf @@ -0,0 +1,8 @@ +default-key 020237017D271D4E2344D8F3FF57750B830AA3A1 +no-greeting +expert +no-emit-version +no-comments +keyid-format 0xlong +keyserver hkps://keys.openpgp.org +keyserver-options no-honor-keyserver-url diff --git a/tmux b/tmux index 5b348ee..094df60 160000 --- a/tmux +++ b/tmux @@ -1 +1 @@ -Subproject commit 5b348ee402913fae67ab51e725a2b4971ab65f3d +Subproject commit 094df60a6701a6dbd5b099e175e26c71bf4eadea diff --git a/zimsetup.zsh b/zimsetup.zsh deleted file mode 100755 index 07b8035..0000000 --- a/zimsetup.zsh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env zsh - -setopt EXTENDED_GLOB - for template_file ( ${ZDOTDIR:-${HOME}}/.zim/templates/* ); do - user_file="${ZDOTDIR:-${HOME}}/.${template_file:t}" - touch ${user_file} - ( print -rn "$(<${template_file})$(<${user_file})" >! ${user_file} ) 2>/dev/null - done -chsh -s =zsh -zsh -c 'source ${ZDOTDIR:-${HOME}}/.zlogin' - diff --git a/zsh b/zsh deleted file mode 160000 index 236eb14..0000000 --- a/zsh +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 236eb14d5904985370c9e1844fdf1b56e9ddfe0f