commit d2f06576291d5c212b7ada7601ab9dd76f1cc33b Author: Jakobus Schürz Date: Tue Jan 14 10:11:36 2020 +0100 transition from HOSTCONFIG to MYSHELLCONFIG and use the same pathes for vim plugin repos on git.schuerz.at as on github.com diff --git a/.gitconfig b/.gitconfig new file mode 100755 index 0000000..a7a23a6 --- /dev/null +++ b/.gitconfig @@ -0,0 +1,33 @@ +[credential] + helper = cache --timeout=1200 +[user] + name = Jakobus Schürz + email = jakobus.schuerz@schuerz.at +[push] + default = simple +[core] + editor = vim +[diff] + submodule = log +[alias] + last = log -1 HEAD + unstage = reset HEAD -- + visual = !gitk + tree = log --oneline --decorate --graph --all + treefull = log --graph --all + hist = log --pretty=format:'%h %ad | %s%d [%an : %cn]' --graph --date=short + fixcached = rm -r --cached . + delete-last-commit = reset --soft HEAD~1 + purge-last-commit = reset --hard HEAD~1 + pushdetachedhead = push origin HEAD:master +[merge] + conflictstyle = diff3 + tool = vimdiff +[mergetool] + prompt = false + +[alias] + pushup = "!gitbranchname() { git symbolic-ref --short HEAD; }; gitpushupstream() { git push --set-upstream origin `gitbranchname`; }; gitpushupstream" + +[include] + path = ~/.gitconfig_local diff --git a/.githooks/post-merge b/.githooks/post-merge new file mode 100755 index 0000000..3cf77d3 --- /dev/null +++ b/.githooks/post-merge @@ -0,0 +1,24 @@ +#!/bin/bash + +set -e + +printf '\npost-checkout hook\n\n' + +prevHEAD=$1 +newHEAD=$2 +checkoutType=$3 + +[[ $checkoutType == 1 ]] && checkoutType='branch' || + checkoutType='file' ; + +echo 'Checkout type: '$checkoutType +echo ' prev HEAD: '`git name-rev --name-only $prevHEAD` +echo ' new HEAD: '`git name-rev --name-only $newHEAD` + +pwd +REPODIR=$(git rev-parse --show-toplevel) +. ./functions.sh +create_symlinks ${REPODIR} + +# Check if local scripts exists and source it +[ -e .local_scripts/post-merge ] && . .local_scripts/post-merge diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a38e50e --- /dev/null +++ b/.gitignore @@ -0,0 +1,11 @@ +vim/.netrwhist +vim/.VimballRecord +vim/bundle/* +!vim/bundle/Vundle.vim +*.log +*.swp +*.orig +serverconfig.local.conf +bashrc_local +.local_scripts +.git-token diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..75dd45a --- /dev/null +++ b/.gitmodules @@ -0,0 +1,15 @@ +[submodule "vim/bundle/Vundle.vim"] + path = vim/bundle/Vundle.vim + url = http://git.schuerz.at/public/Vim/Vundle.vim.git +[submodule "tmux/plugins/tpm"] + path = tmux/plugins/tpm + url = http://git.schuerz.at/public/tmux-plugins/tpm.git +[submodule "tmux/plugins/tmux-themepack"] + path = tmux/plugins/tmux-themepack + url = http://git.schuerz.at/public/tmux-plugins/tmux-themepack.git +[submodule "tmux/plugins/tmux-sensible"] + path = tmux/plugins/tmux-sensible + url = http://git.schuerz.at/public/tmux-plugins/tmux-sensible.git +[submodule "git-credential-pass"] + path = git-credential-pass + url = http://git.schuerz.at/public/git-credential-pass.git diff --git a/PS1 b/PS1 new file mode 100644 index 0000000..9748245 --- /dev/null +++ b/PS1 @@ -0,0 +1,147 @@ +# /etc/profile.d/PS1.sh: executed by Bourne-compatible login shells. + +parse_git_branch() { + + git branch 2>/dev/null | sed -ne 's/* \(.*\)/ (\1)/p' + #git symbolic-ref --short HEAD 2> /dev/null | sed -ne 's/\(.*\)/ (\1)/p' +} + +if [ -x "/usr/bin/getsyssubvol" ]; then + if [ "$(/usr/bin/getsyssubvol /)" = "/" ] ; then + SYSSUBVOL="" + else + SYSSUBVOL="[$(/usr/bin/getsyssubvol /)]" + fi +else + SYSSUBVOL="" +fi + +# Reset +Color_Off='\e[0m' # Text Reset + +# Regular Colors +Black='\e[0;30m' # Black +Red='\e[0;31m' # Red +Green='\e[0;32m' # Green +Yellow='\e[0;33m' # Yellow +Blue='\e[0;34m' # Blue +Purple='\e[0;35m' # Purple +Cyan='\e[0;36m' # Cyan +White='\e[0;37m' # White + +# Bold +BBlack='\e[1;30m' # Black +BRed='\e[1;31m' # Red +BGreen='\e[1;32m' # Green +BYellow='\e[1;33m' # Yellow +BBlue='\e[1;34m' # Blue +BPurple='\e[1;35m' # Purple +BCyan='\e[1;36m' # Cyan +BWhite='\e[1;37m' # White + +# Underline +UBlack='\e[4;30m' # Black +URed='\e[4;31m' # Red +UGreen='\e[4;32m' # Green +UYellow='\e[4;33m' # Yellow +UBlue='\e[4;34m' # Blue +UPurple='\e[4;35m' # Purple +UCyan='\e[4;36m' # Cyan +UWhite='\e[4;37m' # White + +# Blinking +BLBlack='\e[5;30m' # Black +BLRed='\e[5;31m' # Red +BLGreen='\e[5;32m' # Green +BLYellow='\e[5;33m' # Yellow +BLBlue='\e[5;34m' # Blue +BLPurple='\e[5;35m' # Purple +BLCyan='\e[5;36m' # Cyan +BLWhite='\e[5;37m' # White + +# Background +On_Black='\e[40m' # Black +On_Red='\e[41m' # Red +On_Green='\e[42m' # Green +On_Yellow='\e[43m' # Yellow +On_Blue='\e[44m' # Blue +On_Purple='\e[45m' # Purple +On_Cyan='\e[46m' # Cyan +On_White='\e[47m' # White + +# High Intensity +IBlack='\e[0;90m' # Black +IRed='\e[0;91m' # Red +IGreen='\e[0;92m' # Green +IYellow='\e[0;93m' # Yellow +IBlue='\e[0;94m' # Blue +IPurple='\e[0;95m' # Purple +ICyan='\e[0;96m' # Cyan +IWhite='\e[0;97m' # White + +# Bold High Intensity +BIBlack='\e[1;90m' # Black +BIRed='\e[1;91m' # Red +BIGreen='\e[1;92m' # Green +BIYellow='\e[1;93m' # Yellow +BIBlue='\e[1;94m' # Blue +BIPurple='\e[1;95m' # Purple +BICyan='\e[1;96m' # Cyan +BIWhite='\e[1;97m' # White + +# High Intensity backgrounds +On_IBlack='\e[0;100m' # Black +On_IRed='\e[0;101m' # Red +On_IGreen='\e[0;102m' # Green +On_IYellow='\e[0;103m' # Yellow +On_IBlue='\e[0;104m' # Blue +On_IPurple='\e[0;105m' # Purple +On_ICyan='\e[0;106m' # Cyan +On_IWhite='\e[0;107m' # White + +case "$TERM" in + xterm*|rxvt*|screen*) + case "$TERM" in + screen*) SCREEN="(SCREEN) ";; + *) SCREEN="";; + esac + + # Labels: remote, tmpconfig, screen... + if [ ! -z ${SSH_TTY+x} ]; then + LABEL="${LABEL} \[$On_IRed\]\[$BBlack\]remote\[$Color_Off\]" + fi + if $SSHS ; then + LABEL="${LABEL} \[$On_IWhite\]\[$BBlack\]tmpconfig\[$Color_Off\]" + fi + + # Base prompt + if [ "`id -u`" -eq 0 ]; then + PS1="\[$BRed\]$SCREEN\u@\h \[$BRed\]\[\e[m\]\[$IPurple\](\A)\[\e[m\]$LABEL\n\[$BRed\]${SYSSUBVOL}\w:\$(parse_git_branch) \[\e[m\]\[$BRed\]# " + else + PS1="\[$BIBlue\]$SCREEN\u@\h \[$BIBlue\]\[\e[m\]\[$IPurple\](\A)\[\e[m\]$LABEL\n\[$BIBlue\]${SYSSUBVOL}\w:\$(parse_git_branch) \[\e[m\]\[$BIBlue\]\$ " + fi + RETVAL0="\342\234\223" + RETVALN0="\342\234\227 " + ;; + *) + # Labels: remote, tmpconfig, screen... + if [ ! -z ${SSH_TTY+x} ]; then + LABEL="${LABEL} \[$On_Red\]\[$BWhite\]remote\[$Color_Off\]" + fi + if $SSHS ; then + LABEL="${LABEL} \[$On_White\]\[$BBlack\]tmpconfig\[$Color_Off\]" + fi + + # Base prompt + if [ "`id -u`" -eq 0 ]; then + PS1="\[$BRed\][$SYSSUBVOL]\u@\h \[$BIBlue\]\[\e[m\]\[$BIPurple\](\A)\[\e[m\]\[$BBlue\]$LABEL\n\[$BRed\]${SYSSUBVOL}\w:\$(parse_git_branch) \$ \[\e[m\]\[$Blue\]" + else + PS1="\[$BBlue\][$SYSSUBVOL]\u@\h \[$BIBlue\]\[\e[m\]\[$BIPurple\](\A)\[\e[m\]\[$BBlue\]$LABEL\n\[$BIBlue\]${SYSSUBVOL}\w:\$(parse_git_branch) \$ \[\e[m\]\[$Blue\]" + fi + RETVAL0=":)" + RETVALN0=":(" + ;; +esac +PS1="( \$? \$(if [[ \$? == 0 ]]; then echo \"\[$Green\]${RETVAL0}\"; else echo \"\[$Red\]${RETVALN0}\"; fi )\[\e[m\]) ${PS1}\[\e[m\]" + +#trap 'echo -ne "\e[0m"' DEBUG diff --git a/README.md b/README.md new file mode 100644 index 0000000..cdc2624 --- /dev/null +++ b/README.md @@ -0,0 +1,85 @@ +# server-config + +Am Einfachsten ist es, das github-Repo zu forken und in .gitconfig den Namen und die Emailadresse an die eigenen Werte anzupassen. Das Repo ist öffentlich, also keine Passwörter speicher!!! + +.gitconfig wird von diesem Repo beim Einrichten nach ~/.gitconfig gelinkt. Bitte beachten, dass damit eine schon vorhandene eigene Datei überschrieben wird! + +Soll ein Proxy zum Einsatz kommen, so ist dieser mittels +``` +git config http.proxy "http://proxy.to.use:prot/" +``` +local für jedes Repo zu konfigurieren. Die globale gitconfig für den User wird auf allen eingesetzten Instanzen verteilt und versioniert! + +## Installation +Damit auf einem neuen Server meine persönlichen Alias und Bash-Promt, wie auch verschiedene andere Befehle (vim in sudo mit der vimrc des Benutzers) zur Verfügung stehen, muss als erstes nach dem ersten Login folgendes ausgeführt werden: + +Download von github +``` +curl -o bashrc\_add "https://raw.githubusercontent.com/xundeenergie/server-config/master/bashrc\_add" +``` +oder Download von git.schuerz.at +``` +curl -o bashrc\_add "https://git.schuerz.at/?p=server-config.git;a=blob\_plain;f=bashrc\_add;hb=HEAD" +``` + +## Lokale Configuration +in ~/.bashrc werden vor der Zeile zum Einbinden der Serverconfig die Variablen eingefügt um damit ein hostspezifisches Verhalten zu steuern +MYSHELLCONFIG\_GIT\_CHECKOUTSCRIPT\_OPTIONS= +Mögliche Optionen: + * -h +Verwendung: Damit kann man angeben, ob ein headless Repo erzeugt wird. Ohne -h folgt das Repo origin/master +MYSHELLCONFIG\_GIT\_REMOTE\_PROTOCOL=git # git ist default +MYSHELLCONFIG\_GIT\_REMOTE\_PUSH\_PROTOCOL=$MYSHELLCONFIG\_GIT\_REMOTE\_PROTOCOL # MYSHELLCONFIG\_GIT\_REMOTE\_PROTOCOL ist default +Mögliche Optionen: + * git - (default) Gitprotokoll ist git (Auf manchen Umgebungen kann der dazu notwenidge Port gesperrt sein) + * http - wenn git nicht möglich ist, kann das http/https Protokoll verwendet werden. (ist langsamer als git, jedoch ist fast überall Port 80 oder 440 freigeschaltet) + * ssh - Wenn auch schreibend auf das Repo zugegriffen werden soll, so muss Privatekey, Pubkey (und wenn konfiguriert Certifikate mit den notwendigen Principals) vorhanden sein, dann kann das ssh-Prodokoll verwendet werden. + + +## Einbinden von bashrc\_add in die bash + +Die Default .bashrc muss am Ende um folgende Zeilen ergänzt werden: +``` +vi .bashrc + +# User specific aliases and function +[ -f bashrc\_add ] && . bashrc\_add +``` +damit diese heruntergeladene Datei beim nächsten Login oder aufruf von bash gesourced wird. +Diese Datei clont dieses Repo nach $HOME oder pullt es, wenn das Repo schon vorhanden ist. + +Damit ist auch schon alles erledigt + +# Über ~/.bashrc manuell festlegbare Variablen und ihre Default-Werte, wenn nicht manuell gesetzt: +MYSHELLCONFIG\_SUBPATH=server-config +MYSHELLCONFIG\_BASE="${HOME}/${MYSHELLCONFIG\_SUBPATH}" +MYSHELLCONFIG\_LOGDIR="${MYSHELLCONFIG\_BASE}/logs" +MYSHELLCONFIG\_LOGFILE="${MYSHELLCONFIG\_LOGDIR}/git.log" +MYSHELLCONFIG\_GIT\_TIMEOUT=5s + +MYSHELLCONFIG\_GIT\_SERVER="git.schuerz.at" +MYSHELLCONFIG\_GIT\_REPO\_NAME="server-config.git" +MYSHELLCONFIG\_GIT\_REPO\_PATH\_HTTP="/public/" +MYSHELLCONFIG\_GIT\_REPO\_PATH\_SSH=":public/" +MYSHELLCONFIG\_GIT\_REPO\_PATH\_GIT="/public/" + + +# Modifizierung mit Skript +Wenn das auf mehreren Hosts ausgeführt werden muss, kann man auch das in diesem Repo in bin abgelegte Skript configserver.sh verwenden. +Am besten dieses Skript nach ${HOME}/bin kopieren und ausführbar machen. + +``` +cp bin/configserver.sh ${HOME}/bin +chmod +x ${HOME}/bin/configserver.sh +``` + +Usage: +configserver.sh [@] [port] [ssh-options] + +ein Hostname muss angegeben werden +Wenn kein Username angegeben wird, fragt das Skript nach einem Username. Ist der Username leer, bricht das Programm ab. + +Wenn kein Port angegeben wird, wird der Standardport 22 verwendet. + +Weitere ssh-Optionen sind wie in der Notation für ssh anzugeben. + z.B.: -i /path/to/private.key -o https://git.ebcont.com/jakobus.schuerz/server-config.git diff --git a/aliases b/aliases new file mode 100644 index 0000000..b785f5d --- /dev/null +++ b/aliases @@ -0,0 +1,148 @@ +#Persönliche Aliases + +# usefull commands +alias fuck='sudo $(history -p \!\!)' +alias wosis='which $(history -p \!\!)' +alias fix='reset; stty sane; tput rs1; clear; echo -e "\033c"' # Fix terminal aber binary output + + + +# paketmanagement +# -- apt +alias aptupgrade='sudo /usr/bin/apt update && sudo /usr/bin/apt dist-upgrade' +alias apt-get-key='sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys' +# -- dnf +alias dnfupgrade='sudo dnf upgrade' + +# docker and docker-compose +alias dcdown='docker-compose down' +alias dclogs='docker-compose logs -f' +alias dcup='docker-compose up --build -d' +alias dcpull='docker-compose pull' +alias dcbuild='docker-compose build --pull' +alias dcrestartcollabora='docker-compose restart collabora-code' +alias dcrestart='docker-compose down && docker-compose pull && docker-compose up --build -d' +alias diclean='docker images | grep '\'''\'' | grep -P '\''[1234567890abcdef]{12}'\'' -o | xargs -L1 docker rmi' +alias dclean='docker ps -a | grep -v '\''CONTAINER\|_config\|_data\|_run'\'' | cut -c-12 | xargs docker rm' +# Kill all running containers. +alias dockerkillall='docker kill $(docker ps -q)' +# Delete all stopped containers. +alias dockercleanc='printf "\n>>> Deleting stopped containers\n\n" && docker rm $(docker ps -a -q)' +# Delete all untagged images. +alias dockercleani='printf "\n>>> Deleting untagged images\n\n" && docker rmi $(docker images -q -f dangling=true)' +# Delete all stopped containers and untagged images. +alias dockerclean='dockercleanc || true && dockercleani' + +# git +alias git-getbranchauthors="git for-each-ref --format='%(committerdate) %09 %(authorname) %09 %(refname)' | sort -k5n -k2M -k3n -k4n" +alias gcm='git checkout master' + +# xdg-user-dirs +alias godesktop='[ -e $(xdg-user-dir DESKTOP) ] && cd $(xdg-user-dir DESKTOP)' +alias godoc='[ -e $(xdg-user-dir DOCUMENTS) ] && cd $(xdg-user-dir DOCUMENTS)' +alias godownload='[ -e $(xdg-user-dir DOWNLOAD) ] && cd $(xdg-user-dir DOWNLOAD' +alias gomusic='[ -e $(xdg-user-dir MUSIC) ] && cd $(xdg-user-dir MUSIC)' +alias gopublic='[ -e $(xdg-user-dir PUBLICSHARE) ] && cd $(xdg-user-dir PUBLICSHARE)' +alias gotempl='[ -e $(xdg-user-dir TEMPLATES) ] && cd $(xdg-user-dir TEMPLATES)' +alias govideo='[ -e $(xdg-user-dir VIDEOS) ] && cd $(xdg-user-dir VIDEOS)' + +# some special locations +alias godebian='cd ~/debian' +alias gofvwm='cd /home/jakob/src/fvwmverve/' +alias gofvwmsys='cd /usr/share/fvwm-verve/' +alias goserverconfig='cd $MYSHELLCONFIG_BASE' +alias goxund='cd /home/jakob/xundeenergie.at/' + +# system-dirs +alias gosystemd='cd /etc/systemd/system/' +alias goudevrules='cd /etc/udev/rules.d/' +alias gousrlocal='cd /usr/local/bin/' + +# btrfs-backup +alias golocbak='cd /var/cache/btrfs_pool_SYSTEM/' +alias gorembak='cd /var/cache/backup/$HOSTNAME/' +alias lslocbak='ls -alF /var/cache/btrfs_pool_SYSTEM/' +alias lsrembak='ls -alF /var/cache/backup/$HOSTNAME/' + +# common commands +alias ....='cd ../../..' +alias ...='cd ../..' +alias ..='cd ..' +alias cd..='cd ..' +alias cp='cp -i --reflink=auto' +alias dir='ls -l $LS_OPTIONS' +alias grep='grep --color' +alias la='ls -la $LS_OPTIONS' +alias ll='ls -l $LS_OPTIONS' +alias l='ls -alF $LS_OPTIONS' +alias ls-l='ls -l $LS_OPTIONS' +alias md='mkdir -p' +alias rd=rmdir +alias rmbrokenlinks='for f in $(find -L . -maxdepth 1 -type l); do unlink "$f";done' + +# tests +alias testmail='echo testemail von ${USER}@${HOSTNAME} am $(date)|mail -s "TESTEMAIL ${USER}@${HOSTNAME} $(date)"' + +# logging +alias tailmail='sudo tail -f /var/log/mail.log /var/log/exim4/mainlog /var/log/exim4/rejectlog /var/log/exim4/paniclog' +alias taildemsg='sudo watch -n1 "dmesg|tail -n20"' +alias tailsys='sudo tail -f /var/log/syslog /var/log/dmesg' + +# infos, stati +alias getrelease='cat /etc/*release' +alias mkbackupinfo='mkbackup -Vi list SNP BKP SRC' +alias myip='curl "http://icanhazip.com/"' +alias netzwerk='watch "route; echo iwconfig; iwconfig 2> /dev/null ;echo; echo ifconfig; ifconfig 2> /dev/null; echo; echo arp -a; arp -a; echo EOF"' + +# Applications +alias jq='jq -C' +alias ncmpcpp='ncmpcpp -h "${MPD_HOST}" -p "${MPD_PORT}"' +alias nedit='LC_ALL=ISO-8850-15;export LC_ALL;nedit -fn win8x15 -xrm "*fontList:win8x15"' +alias o='less -r' +alias totem='VDPAU_DRIVER=va_gl totem' +alias unetbootin='export QT_X11_NO_MITSHM=1 unetbootin' +alias vi='/usr/bin/vim' +alias vlc='VDPAU_DRIVER=va_gl vlc' +alias tmux='tmux -f ~/.tmux.conf' + +# mount/unmount +alias me='owndisk mount' +alias m=mount +#alias mxxx='encfs ~/.x ~/X && xdg-open ~/X' +alias ue='owndisk umount' +#alias umxx='fusermount -u ~/X' +alias u=umount + +# rock64 +alias rock64='sudo minicom -D /dev/ttyUSB0 --color=on' +alias rock64='sudo minicom -D /dev/ttyUSB0 -b 1500000--color=on' + +# openvpn +alias ovpnrestart='sudo systemctl restart openvpn-client@${HOSTNAME}.service' +alias ovpnstart='sudo systemctl start openvpn-client@${HOSTNAME}.service' +alias ovpnstatus='sudo systemctl status openvpn-client@${HOSTNAME}.service' +alias ovpnstop='sudo systemctl stop openvpn-client@${HOSTNAME}.service' + +# systemd +alias scdr='systemctl --system daemon-reload' +alias scpo='systemctl poweroff' +alias scrb='systemctl reboot' +alias scrl='systemctl reload' +alias scrs='systemctl restart' +alias scs='systemctl start' +alias scstp='systemctl stop' +alias scst='systemctl status' +alias sc='systemctl' +alias sda='systemd-analyze plot > /tmp/bootchart.svg && eog /tmp/bootchart.svg&' + +# remote control +alias virgooff='ssh virgo sudo systemctl poweroff' +alias virgoreboot='ssh virgo sudo systemctl reboot' +alias aldebaranoff='ssh aldebaran sudo systemctl poweroff' +alias aldebaransuspend='ssh aldebaran sudo systemctl suspend' +alias aldebaranreboot='ssh aldebaran sudo systemctl reboot' + + +# nextcloud +alias nextcloud-add-missing-indices='docker exec -ti nc_app_1 php occ db:add-missing-indices' +alias nextcloud-upgrade='docker-compose down && docker image rm nc_app:latest nc_web:latest && docker-compose pull && docker-compose up --build -d' diff --git a/bash_completion.d/kinit-custom b/bash_completion.d/kinit-custom new file mode 100644 index 0000000..baf5390 --- /dev/null +++ b/bash_completion.d/kinit-custom @@ -0,0 +1,22 @@ +#!/bin/bash + + +function _kerberosconfig() { + KEYS="" + for KEY_DIR in ${KERBEROS_CONFIG_DIRS[*]};do + KEYS="${KEYS} $(find ${KERBEROS_CONFIG_DIRS[*]} -type f -name "*.conf" -exec basename {} \; 2>/dev/null |sed 's/\.conf$//' )" + done + echo $KEYS +# echo $(find ${KERBEROS_CONFIG_DIRS[*]} -type f -name "*.conf" -exec basename {} \; -exec sed 's/\.conf$//' \; 2>/dev/null ) + +} + +function _kerberosfiles() { + COMPREPLY=() + local CUR KEYS + CUR="${COMP_WORDS[COMP_CWORD]}" + KEYS=$(_kerberosconfig) + COMPREPLY=( $(compgen -W "${KEYS}" -- ${CUR}) ) + return 0 +} +complete -F _kerberosfiles kinit-custom diff --git a/bash_completion.d/mencfs b/bash_completion.d/mencfs new file mode 100644 index 0000000..a9a0136 --- /dev/null +++ b/bash_completion.d/mencfs @@ -0,0 +1,21 @@ +#!/bin/bash + + +function _encfsconfig() { + KEYS="" + for KEY_DIR in ${ENCFS_CONFIG_DIRS[*]};do + KEYS="${KEYS} $(find ${ENCFS_CONFIG_DIRS[*]} -type f -name "*.conf" -exec basename {} \; 2>/dev/null |sed 's/\.conf$//' )" + done + echo $KEYS + +} + +function _encfsfiles() { + COMPREPLY=() + local CUR KEYS + CUR="${COMP_WORDS[COMP_CWORD]}" + KEYS=$(_encfsconfig) + COMPREPLY=( $(compgen -W "${KEYS}" -- ${CUR}) ) + return 0 +} +complete -F _encfsfiles mencfs diff --git a/bash_completion.d/setproxy b/bash_completion.d/setproxy new file mode 100644 index 0000000..09a0285 --- /dev/null +++ b/bash_completion.d/setproxy @@ -0,0 +1,21 @@ +#!/bin/bash + + +function _proxycreds() { + KEYS="" + for KEY_DIR in ${SETPROXY_CREDS_DIRS[*]};do + KEYS="${KEYS} $(find ${KEY_DIR} -type f -name "*.conf" -exec basename {} \; 2>/dev/null |sed 's/\.conf$//')" + done + echo $KEYS +} + +function _proxyfiles() { + COMPREPLY=() + local CUR KEYS + CUR="${COMP_WORDS[COMP_CWORD]}" + #KEYS="$(find ${KEY_DIR}/* -type f|awk -F ${KEY_DIR}/ '{print $2}'|sed 's/\.session$//')" + KEYS=$(_proxycreds) + COMPREPLY=( $(compgen -W "${KEYS}" -- ${CUR}) ) + return 0 +} +complete -F _proxyfiles setproxy diff --git a/bash_completion.d/sshs b/bash_completion.d/sshs new file mode 100644 index 0000000..1b8e5fb --- /dev/null +++ b/bash_completion.d/sshs @@ -0,0 +1,2 @@ +#. /usr/share/bash-completion/completions/ssh +shopt -u hostcomplete && complete -F _ssh sshs diff --git a/bash_completion.d/sshserverconfig b/bash_completion.d/sshserverconfig new file mode 100644 index 0000000..d82c490 --- /dev/null +++ b/bash_completion.d/sshserverconfig @@ -0,0 +1 @@ +shopt -u hostcomplete && complete -F _ssh sshserverconfig diff --git a/bash_completion.d/tmuxx b/bash_completion.d/tmuxx new file mode 100644 index 0000000..1c1bad4 --- /dev/null +++ b/bash_completion.d/tmuxx @@ -0,0 +1,22 @@ +#!/bin/bash + + +function _keys() { + KEYS="" + for KEY_DIR in ${TMUX_SESSION_DIRS[*]};do + #KEYS=${KEYS}" $(find ${KEY_DIR}/* -type f|awk -F ${KEY_DIR}/ '{print $2}'|sed 's/\.session$//')" + KEYS=$(find ${TMUX_SESSION_DIRS[*]} -type f -name "*.session" -exec basename {} \; 2>/dev/null |sed 's/\.session$//') + done + echo $KEYS +} + +function _keyfiles() { + COMPREPLY=() + local CUR KEYS + CUR="${COMP_WORDS[COMP_CWORD]}" + #KEYS="$(find ${KEY_DIR}/* -type f|awk -F ${KEY_DIR}/ '{print $2}'|sed 's/\.session$//')" + KEYS=$(_keys) + COMPREPLY=( $(compgen -W "${KEYS}" -- ${CUR}) ) + return 0 +} +complete -F _keyfiles tmuxx diff --git a/bash_completion.d/uencfs b/bash_completion.d/uencfs new file mode 100644 index 0000000..804d581 --- /dev/null +++ b/bash_completion.d/uencfs @@ -0,0 +1,11 @@ +#!/bin/bash + +function _uencfsfiles() { + COMPREPLY=() + local CUR KEYS + CUR="${COMP_WORDS[COMP_CWORD]}" + KEYS=$(mount|grep encfs|sed -e 's/^encfs on \(.*\)\ type.*$/\1/') + COMPREPLY=( $(compgen -W "${KEYS}" -- ${CUR}) ) + return 0 +} +complete -F _uencfsfiles uencfs diff --git a/bashrc_add b/bashrc_add new file mode 100755 index 0000000..4fed518 --- /dev/null +++ b/bashrc_add @@ -0,0 +1,316 @@ +#!/bin/bash +#debug + +# set SSHS to false, if not set +if [ -z ${SSHS+x} ]; then SSHS=false;fi + +# check if we are a interactive shell +if [ -n "$PS1" ] ;then + #echo "interactive shell" >&2 + + + # define variables + + [ -z "${USERNAME+x}" ] && USERNAME="$USER" + [ -z "${USEREMAIL+x}" ] && USEREMAIL="$USER@$(domainname -f)" + [ -z "${FULLNAME+x}" ] && FULLNAME="$(getent passwd $USER | cut -d ":" -f 5 | cut -d ',' -f 1)" + [ -z "${GIT_AUTHOR_NAME+x}" ] && GIT_AUTHOR_NAME=$FULLNAME + [ -z "${GIT_AUTHOR_EMAIL+x}" ] && GIT_AUTHOR_EMAIL=$FULLNAME + [ -z "${GIT_COMMITTER_NAME+x}" ] && GIT_COMMITTER_NAME=$FULLNAME + [ -z "${GIT_COMMITTER_EMAIL+x}" ] && GIT_COMMITTER_EMAIL=$FULLNAME + + [ -z "${MYSHELLCONFIG_SUBPATH+x}" ] && MYSHELLCONFIG_SUBPATH=".local/hostconfig" + [ -z "${MYSHELLCONFIG_BASE+x}" ] && MYSHELLCONFIG_BASE="${HOME}/${MYSHELLCONFIG_SUBPATH}" + [ -z "${MYSHELLCONFIG_LOGDIR+x}" ] && MYSHELLCONFIG_LOGDIR="${MYSHELLCONFIG_BASE}/logs" + [ -z "${MYSHELLCONFIG_LOGFILE+x}" ] && MYSHELLCONFIG_LOGFILE="${MYSHELLCONFIG_LOGDIR}/git.log" + [ -z "${MYSHELLCONFIG_GIT_TIMEOUT+x}" ] && MYSHELLCONFIG_GIT_TIMEOUT=5s + [ -z "${MYSHELLCONFIG_GIT_CHECKOUT_TIMEOUT+x}" ] && MYSHELLCONFIG_GIT_CHECKOUT_TIMEOUT=20s + MYSHELLCONFIG_BASH_COMPLETION="${HOME}/${MYSHELLCONFIG_SUBPATH}/bash_completion.d" + + SGIT="git -C ${MYSHELLCONFIG_BASE}" + export MYSHELLCONFIG_BASE MYSHELLCONFIG_LOGDIR MYSHELLCONFIG_LOGFILE SGIT + + # define functions + + ckrepo () { + # check if remote repo is reachable + if $( timeout --foreground "${MYSHELLCONFIG_GIT_TIMEOUT}" $SGIT ls-remote >/dev/null 2>&1) ;then + return 0 + else + return 1 + fi + + } + + sync_config () { + local nok="" + local gco="" + if which git >/dev/null; then + echo -n "Sync config with ${MYSHELLCONFIG_GIT_SERVER}: " 1>&2 + # MYSHELLCONFIG_GITCHECKOUTSCRIPT_OPTIONS are options for bin/git-myshellconfig-checkout + # this are now: + # -h for headless repo + if [ -z ${MYSHELLCONFIG_GIT_CHECKOUTSCRIPT_OPTIONS+x} ]; then + gco="-h" + else + gco="$MYSHELLCONFIG_GIT_CHECKOUTSCRIPT_OPTIONS" + fi + ${MYSHELLCONFIG_BASE}/bin/git-myshellconfig-checkout ${gco}|| nok="not " 1>>"${MYSHELLCONFIG_LOGFILE}" 2>&1 #|tee -a ./logs/git.log 1>&2 + printf '%s\n' "${nok}synced" 1>&2 + + # If you want, put a greeting message after sync here +# cat << EOF >&2 +# +#--------------------------------------------------- +#if you want to update submodules, change dir an run +#cd $MYSHELLCONFIG_BASE +#git submodule update --remote --merge +#cd ~ +#--------------------------------------------------- +#EOF + + else + echo "git not installed, no configuration possible, please install git" >&2 + fi + } + + if ! $SSHS; then +# echo "do not source bashrc_add" >&2 +# else +# echo "source bashrc_add" >&2 + # Uncomment the following line if you don't like systemctl's auto-paging feature: + # export SYSTEMD_PAGER= + + ### set userspecific variables ####### + [ -z "$PDSH_RCMD_TYPE" ] && PDSH_RCMD_TYPE=ssh + [ -z "$XDG_RUNTIME_DIR" ] && export XDG_RUNTIME_DIR=/run/user/$(id -u $USER) + + ###################################### + + MYSHELLCONFIG_GIT_PROTOCOL_GIT="git://" + MYSHELLCONFIG_GIT_PROTOCOL_HTTP="http://" + MYSHELLCONFIG_GIT_PROTOCOL_SSH="git@" + [ -z "${MYSHELLCONFIG_GIT_SERVER+x}" ] && MYSHELLCONFIG_GIT_SERVER="git.schuerz.at" + [ -z "${MYSHELLCONFIG_GIT_REPO_NAME+x}" ] && MYSHELLCONFIG_GIT_REPO_NAME="$(basename $MYSHELLCONFIG_BASE).git" + [ -z "${MYSHELLCONFIG_GIT_REPO_PATH_HTTP+x}" ] && MYSHELLCONFIG_GIT_REPO_PATH_HTTP="/public/" + [ -z "${MYSHELLCONFIG_GIT_REPO_PATH_SSH+x}" ] && MYSHELLCONFIG_GIT_REPO_PATH_SSH=":public/" + [ -z "${MYSHELLCONFIG_GIT_REPO_PATH_GIT+x}" ] && MYSHELLCONFIG_GIT_REPO_PATH_GIT="/public/" + + MYSHELLCONFIG_GIT_REMOTE_PUBLIC_GIT="${MYSHELLCONFIG_GIT_PROTOCOL_GIT}${MYSHELLCONFIG_GIT_SERVER}${MYSHELLCONFIG_GIT_REPO_PATH_GIT}" + MYSHELLCONFIG_GIT_REMOTE_PUBLIC_SSH="${MYSHELLCONFIG_GIT_PROTOCOL_SSH}${MYSHELLCONFIG_GIT_SERVER}${MYSHELLCONFIG_GIT_REPO_PATH_SSH}" + MYSHELLCONFIG_GIT_REMOTE_PUBLIC_HTTP="${MYSHELLCONFIG_GIT_PROTOCOL_HTTP}${MYSHELLCONFIG_GIT_SERVER}${MYSHELLCONFIG_GIT_REPO_PATH_HTTP}" + MYSHELLCONFIG_GIT_REMOTE_PUBLIC_DEFAULT="${MYSHELLCONFIG_GIT_REMOTE_PUBLIC_GIT}" + + MYSHELLCONFIG_GIT_REMOTE_DEFAULT="${MYSHELLCONFIG_GIT_PROTOCOL_GIT}${MYSHELLCONFIG_GIT_SERVER}${MYSHELLCONFIG_GIT_REPO_PATH_GIT}" + + # If MYSHELLCONFIG_GIT_REMOTE is set in ~/.bashrc before sourcing this file, take value from ~/.bashrc + # If set MYSHELLCONFIG_GIT_REMOTE_PROTOCOL in ~/.bashrc before sourcing this file, you cange choose one of the above + # defined values for a specific host + + if [ -z ${MYSHELLCONFIG_GIT_REMOTE+x} ]; then + case $MYSHELLCONFIG_GIT_REMOTE_PROTOCOL in + git) + MYSHELLCONFIG_GIT_REMOTE_PUBLIC="${MYSHELLCONFIG_GIT_REMOTE_PUBLIC_GIT}" + ;; + ssh) + MYSHELLCONFIG_GIT_REMOTE_PUBLIC="${MYSHELLCONFIG_GIT_REMOTE_PUBLIC_SSH}" + ;; + http) + MYSHELLCONFIG_GIT_REMOTE_PUBLIC="${MYSHELLCONFIG_GIT_REMOTE_PUBLIC_HTTP}" + ;; + *) + MYSHELLCONFIG_GIT_REMOTE_PUBLIC="${MYSHELLCONFIG_GIT_REMOTE_DEFAULT}" + ;; + esac + MYSHELLCONFIG_GIT_REMOTE="${MYSHELLCONFIG_GIT_REMOTE_PUBLIC}${MYSHELLCONFIG_GIT_REPO_NAME}" + fi + + if [ -z ${MYSHELLCONFIG_GIT_REMOTE_PUSH+x} ]; then + case $MYSHELLCONFIG_GIT_REMOTE_PUSH_PROTOCOL in + git) + MYSHELLCONFIG_GIT_REMOTE_PUSH_PUBLIC="${MYSHELLCONFIG_GIT_REMOTE_PUBLIC_GIT}" + ;; + ssh) + MYSHELLCONFIG_GIT_REMOTE_PUSH_PUBLIC="${MYSHELLCONFIG_GIT_REMOTE_PUBLIC_SSH}" + ;; + http) + MYSHELLCONFIG_GIT_REMOTE_PUSH_PUBLIC="${MYSHELLCONFIG_GIT_REMOTE_PUBLIC_HTTP}" + ;; + *) + MYSHELLCONFIG_GIT_REMOTE_PUSH_PUBLIC="${MYSHELLCONFIG_GIT_REMOTE_PUBLIC_DEFAULT}" + ;; + esac + MYSHELLCONFIG_GIT_REMOTE_PUSH=${MYSHELLCONFIG_GIT_REMOTE_PUSH_PUBLIC}${MYSHELLCONFIG_GIT_REPO_NAME} + fi + + #GIT_SSH_PATH="/srv/repos" + + case $TERM in + *term*) + + if [ -d "${MYSHELLCONFIG_BASE}" -a $($SGIT status 1>/dev/null 2>&1; echo $?) -eq 0 ]; then + [ -d "${MYSHELLCONFIG_LOGDIR}" ] || mkdir -p "${MYSHELLCONFIG_LOGDIR}" + if ! $SGIT rev-parse --git-dir > /dev/null 2>&1 ; then + echo "Init ${MYSHELLCONFIG_BASE} as git-repo" >&2 + $SGIT init + fi + + # Update Userinformations for git + $SGIT config user.email "${USERNAME}" + $SGIT config user.name "${FULLNAME}" + + # set upstream only if not detached + [ $($SGIT rev-parse --abbrev-ref HEAD) != "HEAD" ] && $SGIT branch --set-upstream-to=origin/$($SGIT rev-parse --abbrev-ref HEAD) + + # sync repo with origin if git is reachable + if ckrepo ; then + sync_config + . ${MYSHELLCONFIG_BASE}/functions.sh + create_symlinks "$MYSHELLCONFIG_BASE" + else + echo "${MYSHELLCONFIG_GIT_SERVER}" not reachable >&2; + echo profile not syncing >&2; + fi + + else + echo "Clone ${MYSHELLCONFIG_GIT_REMOTE} and configure git" >&2 + + if $( timeout --foreground "${MYSHELLCONFIG_GIT_CHECKOUT_TIMEOUT}" git -C ${HOME} clone "${MYSHELLCONFIG_GIT_REMOTE}" "${MYSHELLCONFIG_BASE}" ); then + : + else + MYSHELLCONFIG_GIT_REMOTE="${MYSHELLCONFIG_GIT_REMOTE_PUBLIC_HTTP}${MYSHELLCONFIG_GIT_REPO_NAME}" + echo "Clone ${MYSHELLCONFIG_GIT_REMOTE} and configure git" >&2 + timeout --foreground "${MYSHELLCONFIG_GIT_CHECKOUT_TIMEOUT}" git -C ${HOME} clone "${MYSHELLCONFIG_GIT_REMOTE}" "${MYSHELLCONFIG_BASE}" || exit 1 + fi + + + + [ -d "${MYSHELLCONFIG_BASE}" ] && { echo create ${MYSHELLCONFIG_LOGDIR} >&2; mkdir -p "${MYSHELLCONFIG_LOGDIR}"; } + + $SGIT config user.email "${USERNAME}" + $SGIT config user.name "${FULLNAME}" + + # Initialize Vundle as preconfigured Submodule + #$SGIT submodule update --init --recursive + #$SGIT submodule foreach 'git checkout master' + + echo "sync config" >&2 + sync_config + . ${MYSHELLCONFIG_BASE}/functions.sh + echo "config synced, functions.sh sourced" >&2 + create_symlinks "$MYSHELLCONFIG_BASE" + + # Install vim Plugins + #echo "Run Vim, and in Vim run :PluginInstall to install all Plugins" + vim -c "PluginInstall" -c ":qa!" + fi + [ -z ${MYSHELLCONFIG_GIT_REMOTE_PUSH+x} ] || $SGIT remote set-url --push origin "${MYSHELLCONFIG_GIT_REMOTE_PUSH}" + # cd ${HOME} + ;; + *screen*) + echo "I'm in sceen/tmux now" >&2 + ;; + *dumb*) + echo "Run with dumb terminal" 1>&2 + ;; + esac + + if [ -e ${MYSHELLCONFIG_BASE}/functions.sh ]; then + . ${MYSHELLCONFIG_BASE}/functions.sh + else + return + fi + + + + ###################################################################################### + # ls is not in color on all systems + export LS_OPTIONS='--color=auto' + eval "`dircolors`" + + ####################################################################################### + # User specific aliases and function + + + if [ -d "${HOME}/bin" ] ; then + pathmunge "${HOME}/bin" + export PATH + fi + + if [ -d "${MYSHELLCONFIG_BASE}/bin" ] ; then + pathmunge "${MYSHELLCONFIG_BASE}/bin" + export PATH + fi + + if [ -d "${MYSHELLCONFIG_BASE}/git-credential-pass" ] ; then + pathmunge "${MYSHELLCONFIG_BASE}/git-credential-pass" + export PATH + fi + + if [ -f "${MYSHELLCONFIG_BASE}/aliases" ]; then + . "${MYSHELLCONFIG_BASE}/aliases" + fi + + if [ -f ~/.aliases ]; then + . ~/.aliases + fi + + if [ -f "${MYSHELLCONFIG_BASE}/PS1" ]; then + . "${MYSHELLCONFIG_BASE}/PS1" + fi + + if [ -e "${MYSHELLCONFIG_BASH_COMPLETION}" ]; then + for i in $( ls "${MYSHELLCONFIG_BASH_COMPLETION}" ); do + . "${MYSHELLCONFIG_BASH_COMPLETION}/${i}" + done + fi + + + ######################################################################################### + + + # Go HOME + #cd ${HOME} + + + echo "bashrc_add sourced" 1>&2 + + if test ! $TMUX && test $SSH_TTY && test $TERM != screen && test $(systemctl status tmux@${USER}.service 1>/dev/null 2>&1; echo $? ) -eq 0; then + cat << EOF + + "User: $USER - $UID" + + Starting or resuming screen session + Press CTRL+C to cancel screen startup + +EOF + sleep 1 + #screen -UxR + tmux attach-session + fi + + unset -f pathmunge + + else + + case $TERM in + *screen*) + echo BASHRC: $BASHRC -> source it + #[ -e $BASHRC ] && . "$BASHRC" + if [ ! -z ${BASHRC+x} ]; then + if [ -e $BASHRC ] ; then + exec bash --rcfile "$BASHRC" -i /dev/null + else + exec bash -i + fi + else + exec bash -i + fi + + ;; + esac + + fi + +fi + diff --git a/bin/configserver.sh b/bin/configserver.sh new file mode 100755 index 0000000..69eb240 --- /dev/null +++ b/bin/configserver.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +if [[ $1 = *"@"* ]]; then + USERNAME=${1%@*} + SERVER=${1#*@} +else + SERVER="$1" + echo -n "Username (@${SERVER}): " + read USERNAME +fi +[ -z "${USERNAME}" ] && { echo "Username not set"; exit 1; } +shift + +if [ $# -ge 1 ]; then + PORT=$1 +else + PORT=22 +fi +shift + +OPTIONS="$@" + +SSH="/usr/bin/ssh" +CMD="$SSH ${OPTIONS} -p ${PORT} ${USERNAME}@${SERVER}" + +echo "Configure new Server (${SERVER}) for personal use" + +$CMD /bin/bash << EOF + test -e "~/bashrc_add" && { echo "Server ${SERVER} configured"; exit 0; } + rm -rf ~/bashrc_add + #wget "https://git.schuerz.at/?p=public/server-config.git;a=blob_plain;f=bashrc_add;hb=HEAD" -O ~/bashrc_add + git clone https://git.schuerz.at/public/server-config.git + ln -s server-config/bashrc_add bashrc_add + echo "modify ~/.bashrc" + if grep -q bashrc_add .bashrc ;then + sed -i -e '/bashrc_add/d' .bashrc + fi + echo + printf "%s" "[ -f bashrc_add ] && . bashrc_add" | tee -a .bashrc + echo +EOF +$CMD diff --git a/bin/flip.pl b/bin/flip.pl new file mode 100755 index 0000000..e2655b2 --- /dev/null +++ b/bin/flip.pl @@ -0,0 +1,87 @@ +#!/usr/bin/perl + +use strict; +use warnings; +use utf8; + +binmode(STDOUT, ":utf8"); + +my %flipTable = ( + "a" => "\x{0250}", + "b" => "q", + "c" => "\x{0254}", + "d" => "p", + "e" => "\x{01DD}", + "f" => "\x{025F}", + "g" => "\x{0183}", + "h" => "\x{0265}", + "i" => "\x{0131}", + "j" => "\x{027E}", + "k" => "\x{029E}", + "l" => "|", + "m" => "\x{026F}", + "n" => "u", + "o" => "o", + "p" => "d", + "q" => "b", + "r" => "\x{0279}", + "s" => "s", + "t" => "\x{0287}", + "u" => "n", + "v" => "\x{028C}", + "w" => "\x{028D}", + "x" => "x", + "y" => "\x{028E}", + "z" => "z", + "A" => "\x{0250}", + "B" => "q", + "C" => "\x{0254}", + "D" => "p", + "E" => "\x{01DD}", + "F" => "\x{025F}", + "G" => "\x{0183}", + "H" => "\x{0265}", + "I" => "\x{0131}", + "J" => "\x{027E}", + "K" => "\x{029E}", + "L" => "|", + "M" => "\x{026F}", + "N" => "u", + "O" => "o", + "P" => "d", + "Q" => "b", + "R" => "\x{0279}", + "S" => "s", + "T" => "\x{0287}", + "U" => "n", + "V" => "\x{028C}", + "W" => "\x{028D}", + "X" => "x", + "Y" => "\x{028E}", + "Z" => "z", + "." => "\x{02D9}", + "[" => "]", + "'" => ",", + "," => "'", + "(" => ")", + "{" => "}", + "?" => "\x{00BF}", + "!" => "\x{00A1}", + "\"" => ",", + "<" => ">", + "_" => "\x{203E}", + ";" => "\x{061B}", + "\x{203F}" => "\x{2040}", + "\x{2045}" => "\x{2046}", + "\x{2234}" => "\x{2235}", + "\r" => "\n", + " " => " " +); + +while ( <> ) { + my $string = reverse( $_ ); + while ($string =~ /(.)/g) { + print $flipTable{$1}; + } + print qq(\n); +} diff --git a/bin/git-myshellconfig-checkout b/bin/git-myshellconfig-checkout new file mode 100755 index 0000000..a155727 --- /dev/null +++ b/bin/git-myshellconfig-checkout @@ -0,0 +1,99 @@ +#!/bin/bash +################################################################################################# +# title :git-myshellconfig-checkout # +# description :checkout git detached HEAD # +# author :Jakobus Schürz # +# changes by :Jakobus Schürz # +# created :17.01.2019 # +# updated : # +# version :1.0 # +# usage :./git-checkout # +# notes : # +################################################################################################# + +[ -z "${SGIT+x}" ] && SGIT=git +MYSHELLCONFIG_LOGDIR="./logs" +MYSHELLCONFIG_LOGFILE="${MYSHELLCONFIG_LOGDIR}/git.log" +[ -d "${MYSHELLCONFIG_LOGDIR}" ] || mkdir -p "${MYSHELLCONFIG_LOGDIR}" + +cat << EOF >> "${MYSHELLCONFIG_LOGFILE}" ++-----BEGINN $(date) -------------------------------+ +EOF + +case $1 in + -h) + # Headless repo local + PRE="origin/" + ;; + *) + PRE="" + ;; +esac +$SGIT fetch origin -p 2>>"${MYSHELLCONFIG_LOGFILE}"|| { echo fetch failed; exit 1; } + +if $SGIT diff-index --ignore-submodules --exit-code HEAD -- >> "${MYSHELLCONFIG_LOGFILE}" ; then + cat << EOF >> "${MYSHELLCONFIG_LOGFILE}" +Check for local changes: + no changes in local repo + $SGIT checkout repo ${PRE}master +EOF + #echo "checkout origin/master as detached HEAD" + $SGIT checkout ${PRE}master 1>>"${MYSHELLCONFIG_LOGFILE}" 2>>"${MYSHELLCONFIG_LOGFILE}"|| exit 2 + $SGIT merge FETCH_HEAD 1>>"${MYSHELLCONFIG_LOGFILE}" 2>>"${MYSHELLCONFIG_LOGFILE}"|| exit 3 +else + cat << EOF >> "${MYSHELLCONFIG_LOGFILE}" +Check for local changes: + Ich habe lokale Änderungen festgestellt + um die Änderung zurückzusetzen bitte + + $SGIT checkout \$FILENAME + + oder um alle lokalen Änderungen auf einmal zurückzusetzen: + + $SGIT checkout . + + ausführen + + Die Änderungen sind: +EOF + $SGIT diff-index HEAD --|awk '{print $5, $6}' >> "${MYSHELLCONFIG_LOGFILE}" + $SGIT diff-index -p HEAD -- >> "${MYSHELLCONFIG_LOGFILE}" + + echo "Lokale Änderungen festgestellt: Siehe Logfile ${MYSHELLCONFIG_LOGFILE}" >&2 +cat << EOF >> "${MYSHELLCONFIG_LOGFILE}" + ++-----ENDE $(date) ---------------------------------+ + +EOF + exit 4 + +fi + +cat << EOF >> "${MYSHELLCONFIG_LOGFILE}" + ++-----update submodules $(date) ---------------------------------+ + +EOF +rc=0 +## Update/init submodules +#$SGIT submodule update --remote --merge 2>>"${MYSHELLCONFIG_LOGFILE}"|| { echo update submodules failed: continue ; } +#$SGIT submodule init 1>>"${MYSHELLCONFIG_LOGFILE}" 2>&1|| { echo update submodules failed; exit 1; } +#$SGIT submodule sync 1>>"${MYSHELLCONFIG_LOGFILE}" 2>&1|| { echo sync submodules failed; exit 1; } +#$SGIT submodule foreach "$SGIT branch -u origin/master master" 1>>"${MYSHELLCONFIG_LOGFILE}" 2>&1|| { echo set-upstream submodules failed; exit 1; } +#$SGIT submodule update --recursive --remote --merge 1>>"${MYSHELLCONFIG_LOGFILE}" 2>&1|| { echo update submodules failed; exit 1; } + +#echo "update submodules" >&2 +$SGIT submodule init 1>>"${MYSHELLCONFIG_LOGFILE}" 2>&1|| { echo update submodules failed on ini; rc=5; } +$SGIT submodule sync 1>>"${MYSHELLCONFIG_LOGFILE}" 2>&1|| { echo sync submodules failed on sync; rc=6; } +$SGIT submodule foreach "git checkout master" 1>>"${MYSHELLCONFIG_LOGFILE}" 2>&1|| { echo checkout master submodules failed on set upstream; rc=7; } +$SGIT submodule foreach "git branch -u origin/master master" 1>>"${MYSHELLCONFIG_LOGFILE}" 2>&1|| { echo set-upstream submodules failed on set upstream; rc=8; } +$SGIT submodule update --recursive --remote --merge 1>>"${MYSHELLCONFIG_LOGFILE}" 2>&1|| { echo update submodules failed on update; rc=9; } +#echo "submodules updated" >&2 + +cat << EOF >> "${MYSHELLCONFIG_LOGFILE}" + ++-----ENDE $(date) ---------------------------------+ + +EOF +exit $rc + diff --git a/functions.sh b/functions.sh new file mode 100644 index 0000000..e47525a --- /dev/null +++ b/functions.sh @@ -0,0 +1,458 @@ +# Initialize variables, if not set +[ -z ${TMUX_SESSION_DIRS+x} ] && TMUX_SESSION_DIRS=( ~/.config/tmux/sessions ~/.local/share/tmux/sessions ~/.tmux/sessions) +[ -z ${SETPROXY_CREDS_DIRS+x} ] && SETPROXY_CREDS_DIRS=(~/.config/proxycreds) +[ -z ${KERBEROS_CONFIG_DIRS+x} ] && KERBEROS_CONFIG_DIRS=(~/.config/kinit) +[ -z ${ENCFS_CONFIG_DIRS+x} ] && ENCFS_CONFIG_DIRS=(~/.config/encfs) + +export TMUX_SESSION_DIRS SETPROXY_CREDS_DIRS KERBEROS_CONFIG_DIRS + +sudo() { + local SUDO + SUDO=$( if [ -e /bin/sudo ]; then echo /bin/sudo; else echo /usr/bin/sudo; fi ) + $SUDO TMUX=$TMUX SSHS=$SSHS SSH_TTY=$SSH_TTY "$@" + +} +create_symlinks() { + + #echo MYSHELLCONFIG_BASE: $MYSHELLCONFIG_BASE +# MYSHELLCONFIG_BASEDIR="$1" +# DIR="$(basename ${MYSHELLCONFIG_BASEDIR})" +# cd "${MYSHELLCONFIG_BASEDIR}" + cd ${MYSHELLCONFIG_BASE} + #echo "DIR MYSHELLCONFIG_BASEDIR $DIR $MYSHELLCONFIG_BASEDIR" + git config credential.helper 'cache --timeout=300' + #Anlegen von Symlinks + rm -rf ~/.vimrc ~/.vim ~/bashrc_add ~/.gitconfig ~/.tmux.conf ~/.tmux + ln -sf "${MYSHELLCONFIG_BASE}/vimrc" ~/.vimrc + ln -sf "${MYSHELLCONFIG_BASE}/vim" ~/.vim + ln -sf "${MYSHELLCONFIG_BASE}/.gitconfig" ~/.gitconfig + ln -sf "${MYSHELLCONFIG_BASE}/bashrc_add" ~/bashrc_add + ln -sf "${MYSHELLCONFIG_BASE}/tmux" ~/.tmux + ln -sf "${MYSHELLCONFIG_BASE}/tmux/tmux.conf" ~/.tmux.conf + + # Configure to use githooks in .githooks, not in standardlocation .git/hooks + $SGIT config core.hooksPath .githooks + # remove all old symlinks in .githooks and relink files from .githooks to .git/hooks + # don't know, why i do it here. TODO: Check it + find .git/hooks -type l -exec rm {} \; && find .githooks -type f -exec ln -sf ../../{} .git/hooks/ \; + + cd ~- + +} + +setproxy () { + + local CONFIG + case $# in + 0) + echo too few arguments + return + ;; + *) + if [ -z ${SETPROXY_CREDS_DIRS+x} ] ; then + echo "are you sure, SETPROXY_CREDS_DIRS is defined?" + return 1 + else + CONFIG=$(find ${SETPROXY_CREDS_DIRS[*]} -mindepth 1 -name "$1.conf" -print -quit 2>/dev/null ) + fi + ;; + esac + + if [ -e ${CONFIG} ]; then + echo -n "${CONFIG} existing: " + source "${CONFIG}" + echo "sourced" + export PROXY_CREDS="${PROXY_USER}:${PROXY_PASS}@" + else + echo "${CONFIG} not existing" + export PROXY_CREDS="" + fi + export {http,https,ftp}_proxy="http://${PROXY_CREDS}${PROXY_SERVER}:${PROXY_PORT}" +} + +mencfs () { + + [ $# -eq 0 ] && { echo "too few arguments" >&2; return 1; } + local PKEY + local ENCDIR + local DESTDIR + local PASS=$(which pass 2>/dev/null || exit 127 ) + local ENCFS=$(which encfs 2>/dev/null || exit 127 ) + local CONFIG + if [ -z ${ENCFS_CONFIG_DIRS+x} ] ; then + echo "are you sure, ENCFS_CONFIG_DIRS is defined?" + return 1 + else + CONFIG=$(find ${ENCFS_CONFIG_DIRS[*]} -mindepth 1 -name "$1.conf" -print -quit 2>/dev/null ) + fi + + if [ -e ${CONFIG} ]; then + echo -n "${CONFIG} existing: " + source "${CONFIG}" + echo "sourced" + else + echo "${CONFIG} not existing" + return 2 + fi + + [ -z ${PKEY+x} ] && return 3 + [ -z ${ENCDIR+x} ] && return 4 + [ -z ${DESTDIR+x} ] && DESTDIR="$(dirname $ENCDIR)/$(basename $ENCDIR| tr '[:lower:]' '[:upper:]'| sed -e 's/^\.//')" + $PASS "${PKEY}" 1>/dev/null 2>&1 || { echo entry $PKEY does not exist in passwordsotre; return 5; } + local ENCFS_PASSWORD=$($PASS "${PKEY}" | head -n1) + + if [ -z ${ENCDIR+x} -a -d ${ENCDIR} ];then + echo "no encrypted directory found -> exit" + return 4 + else + echo mount encrypted directory $ENCDIR on $DESTDIR + $ENCFS -S $ENCDIR $DESTDIR </dev/null || exit 127 ) + [ -z ${FUSERMOUNT+x} ] && return 127 + if [ $# -eq 1 ]; then + if [ ! -d ${1} ];then + echo "encrypted directory ${1} not found -> exit" >&2 + return 128 + else + echo umount encrypted directory $1 >&2 + $FUSERMOUNT -u "$1" + fi + else + echo "no arguments given. Umount all mounted encfs-dirs" >&2 + for i in $(mount|grep encfs|sed -e 's/^encfs on \(.*\)\ type.*$/\1/');do + echo $FUSERMOUNT -u "$i" + $FUSERMOUNT -u "$i" + done + return 1 + fi +} + +kinit-custom () { + + local PKEY + local REALM + local PASS=$(which pass 2>/dev/null || exit 127 ) + local KINIT=$(which kinit 2>/dev/null || exit 127 ) + local CONFIG + if [ -z ${KERBEROS_CONFIG_DIRS+x} ] ; then + echo "are you sure, KERBEROS_CONFIG_DIRS is defined?" + return 1 + else + CONFIG=$(find ${KERBEROS_CONFIG_DIRS[*]} -mindepth 1 -name "$1.conf" -print -quit 2>/dev/null ) + fi + + if [ -e ${CONFIG} ]; then + echo -n "${CONFIG} existing: " + source "${CONFIG}" + echo "sourced" + else + echo "${CONFIG} not existing" + return 2 + fi + + [ -z ${PKEY+x} ] && return 3 + $PASS "${PKEY}" 1>/dev/null 2>&1 || return 3 + local KERBEROS_PASSWORD=$($PASS "${PKEY}" | head -n1) + local KERBEROS_USER=$($PASS "${PKEY}" | grep login | sed -e 's/^login: //' ) + #echo KERBEROS_PASSWORD: $KERBEROS_PASSWORD + echo Get kerberos-ticket for: $KERBEROS_USER@$REALM + + if [ -z ${KERBEROS_USER+x} ];then + echo "no kerberos user found -> exit" + return 4 + else + $KINIT -R "${KERBEROS_USER}@${REALM}" < ~/bashrc_add" < "${MYSHELLCONFIG_BASE}/bashrc_add" + #[ -e ${HOME}/.gitconfig ] && $SSH -T -o VisualHostKey=no $@ "cat > ~/.gitconfig" < "${HOME}/.gitconfig" + #[ -e ${HOME}/.gitconfig_local ] && $SSH -T -o VisualHostKey=no $@ "cat > ~/.gitconfig_local" < "${HOME}/.gitconfig_local" + local CMD="$SSH -T $@" + $CMD /bin/bash << EOF + [ -e /etc/bashrc ] && . /etc/bashrc + [ -e /etc/bash.bashrc ] && . /etc/bash.bashrc + echo "modify ~/.bashrc" + if grep -q bashrc_add ~/.bashrc ;then + sed -i -e '/bashrc_add/d' ~/.bashrc + fi + echo + printf "%s" "[ -f bashrc_add ] && . bashrc_add" | tee -a ~/.bashrc + echo + +EOF + +} +sshs() { + +# MKTMPCMD='mktemp $(echo ${XDG_RUNTIME_DIR}/bashrc.XXXXXXXX.conf)' +# VIMMKTMPCMD="mktemp ${XDG_RUNTIME_DIR}/vimrc.XXXXXXXX.conf" + + local TMPBASHCONFIG=$(mktemp -p ${XDG_RUNTIME_DIR} -t bashrc.XXXXXXXX --suffix=.conf) + local FILELIST=( "${MYSHELLCONFIG_BASE}/functions.sh" "${MYSHELLCONFIG_BASE}/aliases" "${HOME}/.aliases" "${MYSHELLCONFIG_BASE}/PS1" "${MYSHELLCONFIG_BASE}/bash_completion.d/*" ) + + # Read /etc/bashrc or /etc/bash.bashrc (depending on distribution) and /etc/profile.d/*.sh first + cat << EOF >> "${TMPBASHCONFIG}" +[ -e /etc/bashrc ] && BASHRC=/etc/bashrc +[ -e /etc/bash.bashrc ] && BASHRC=/etc/bash.bashrc +. \$BASHRC + +for i in /etc/profile.d/*.sh; do + if [ -r "$i" ];then + if [ "$PS1" ]; then + . "$i" + else + . "$i" >/dev/null + fi + fi +done +EOF + + for f in ${FILELIST[*]}; do + if [ -e $f ]; then + #echo add $f to tmpconfig + cat "$f" >> "${TMPBASHCONFIG}"; + fi + done + + if [ $# -ge 1 ]; then + if [ -e "${TMPBASHCONFIG}" ] ; then + local RCMD="/bin/bash --noprofile --norc -c " + local REMOTETMPBASHCONFIG=$(ssh -T -o VisualHostKey=no $@ "mktemp -p \${XDG_RUNTIME_DIR} -t bashrc.XXXXXXXX --suffix=.conf"| tr -d '[:space:]' ) + local REMOTETMPVIMCONFIG=$(ssh -T -o VisualHostKey=no $@ "mktemp -p \${XDG_RUNTIME_DIR} -t vimrc.XXXXXXXX --suffix=.conf"| tr -d '[:space:]') + + # Add additional aliases to bashrc for remote-machine + cat << EOF >> "${TMPBASHCONFIG}" +alias vi='vim -u ${REMOTETMPVIMCONFIG}' +alias vim='vim -u ${REMOTETMPVIMCONFIG}' +alias vimdiff='vimdiff -u ${REMOTETMPVIMCONFIG}' +export LS_OPTIONS="${LS_OPTIONS}" +export VIMRC="${REMOTETMPVIMCONFIG}" +export BASHRC="${REMOTETMPBASHCONFIG}" +title "\$USER@\$HOSTNAME: \$PWD" +echo "This bash runs with temporary config from \$BASHRC" +EOF + + ssh -T -o VisualHostKey=no $@ "cat > ${REMOTETMPBASHCONFIG}" < "${TMPBASHCONFIG}" + ssh -T -o VisualHostKey=no $@ "cat > ${REMOTETMPVIMCONFIG}" < "${MYSHELLCONFIG_BASE}/vimrc" + RCMD=" + trap \"rm -f ${REMOTETMPBASHCONFIG} ${REMOTETMPVIMCONFIG}\" EXIT " ; + ssh -t $@ "$RCMD; SSHS=true bash -c \"function bash () { /bin/bash --rcfile ${REMOTETMPBASHCONFIG} -i ; } ; export -f bash; exec bash --rcfile ${REMOTETMPBASHCONFIG}\"" + rm "${TMPBASHCONFIG}" + else + echo "${TMPBASHCONFIG} does not exist. Use »ssh $@«" >&2 + ssh -t "$@" + fi + else + echo "too few arguments for sshs" >&2 + ssh + fi +} + +VIMRC="${MYSHELLCONFIG_BASE}/vimrc" + +svi () { + if [ -f ${VIMRC} ]; then + sudo vim -u "${VIMRC}" $@; + else + sudo vim $@ + fi +} + +vim-plugins-update () { + vim -c "PluginUpdate" -c ":qa!" + +} + +vim-plugins-install () { + vim -c "PluginInstall" -c ":qa!" + +} + +vim-repair-vundle () { + if [ -z ${MYSHELLCONFIG_BASE+x} ]; then + echo "MYSHELLCONFIG_BASE nicht gesetzt. Eventuell noch einmal ausloggen und wieder einloggen" + else + cd $MYSHELLCONFIG_BASE + cd vim/bundle + rm -rf Vundle.vim + git clone "${MYSHELLCONFIG_GIT_REMOTE_PUBLIC}Vim/Vundle.vim.git" + cd ~- + fi +} + +getbashrcfile () { + if [ -z ${BASHRC+x} ] ; then + echo "bash uses default" + else + cat /proc/$$/cmdline | xargs -0 echo|awk '{print $3}' + fi +} + +catbashrcfile () { + if [ -z ${BASHRC+x} ] ; then + echo "bash uses default" + else + #cat $(cat /proc/$$/cmdline | xargs -0 echo|awk '{print $3}') + cat $(getbashrcfile) + fi +} + +getvimrcfile () { + if [ -z ${VIMRC+x} ] ; then + echo "vim uses default" + else + echo $VIMRC + fi +} + +catvimrcfile () { + if [ -z ${VIMRC+x} ] ; then + echo "vim uses default" + else + #cat $VIMRC + cat $(getvimrcfile) + fi +} + + +# Functions to set the correct title of the terminal +function title() +{ + # change the title of the current window or tab + echo -ne "\033]0;$*\007" +} + +function sshx() +{ + /usr/bin/ssh "$@" + # revert the window title after the ssh command + title $USER@$HOST +} + +function su() +{ + /bin/su "$@" + # revert the window title after the su command + title $USER@$HOST +} + +function usage() +{ +cat << EOF + Keyboard-shortcuts: + + # tmux: + C+Cursor tmux window change size + M+[hjkl] tmux change splitted windows + + # vim: + C+[hjkl] vim change splitted windows +EOF +} + +function pdsh-update-hetzner() +{ + curl -s -H "Authorization: Bearer $(pass hetzner.com/api-token | head -n1)" \ + https://api.hetzner.cloud/v1/servers \ + | /usr/bin/jq '.servers[].public_net.ipv4.ip'|sed -e 's/\"//g' \ + |while read i; do + dig -x $i | awk '$0 !~ /^;/ && $4 == "PTR" {print $5}' + done |sed -s -e 's/\.$//' > ~/.dsh/group/hetzner-servers +} + +function tmuxx() { + case $# in + 1) + SESS=($(find ${TMUX_SESSION_DIRS[*]} -mindepth 1 -name "$1.session" 2>/dev/null )) + ;; + *) + echo no session specified return + ;; + esac + TMUX='/usr/bin/tmux' + $TMUX -f ~/.tmux.conf new-session -d + [ -e ${SESS[0]} ] && $TMUX source-file ${SESS[0]} + $TMUX attach-session -d +} + + +gnome-shell-extensions-enable-defaults () { + if [ -f ~/.config/gnome-shell-extensions-default.list ]; then + for i in $(cat ~/.config/gnome-shell-extensions-default.list); do + #gnome-shell-extension-tool -e $i; + gnome-extensions enable $i; + done; + fi +} + +checkbkp () { + if ping -c 1 backup.vpn >/dev/null 2>&1 ; then + local SSH="/usr/bin/ssh" + local CMD="$SSH -T backup.vpn" + $CMD /bin/bash << EOF + sudo find /srv/nfs/backup -mindepth 1 -maxdepth 1|grep -v -e "git$\|git-backup-repos"|while read i;do printf "%-30s%s\\n" "\$i" \$(ls \$i|tail -n1);done +EOF + which pdsh 1>/dev/null 2>&1 && pdsh -g hetzner-servers sudo systemctl status backup.service + + else + echo "backup.vpn is not reachable -> exit" + return 1 + + fi +} diff --git a/tmux/plugins/tmux-sensible/.gitattributes b/tmux/plugins/tmux-sensible/.gitattributes new file mode 100644 index 0000000..4cde323 --- /dev/null +++ b/tmux/plugins/tmux-sensible/.gitattributes @@ -0,0 +1,2 @@ +# Force text files to have unix eols, so Windows/Cygwin does not break them +*.* eol=lf diff --git a/tmux/plugins/tmux-sensible/CHANGELOG.md b/tmux/plugins/tmux-sensible/CHANGELOG.md new file mode 100644 index 0000000..579c0db --- /dev/null +++ b/tmux/plugins/tmux-sensible/CHANGELOG.md @@ -0,0 +1,43 @@ +# Changelog + +### master +- remove `detach-on-destroy` +- do not set `aggressive-resize` on iTerm terminal +- disable `detach-on-destroy` + +### v3.0.0, 2015-06-24 +- remove 'almost sensible' feature + +### v2.3.0, 2015-06-24 +- update to support \*THE\* latest tmux version +- bugfix for `prefix + R` key binding +- fix for tmux 2.0 `default-terminal` option (thanks @kwbr) + +### v2.2.0, 2015-02-10 +- bugfix in `key_binding_not_set`: the regex is now properly detecting key + bindings with `-r` flag. +- enable `aggressive-resize` + +### v2.1.0, 2014-12-12 +- check before binding `prefix + prefix` (@m1foley) +- enable `focus-events` +- deprecate 'almost sensible' feature. The reason for this is to focus the + plugin on doing just one thing. + +### v2.0.0, 2014-10-03 +- bugfix: prevent exiting tmux if 'reattach-to-user-namespace' is not installed +- remove all mouse-related options +- introduce 'almost sensible' setting and options + +### v1.1.0, 2014-08-30 +- bugfix: determine the default shell from the $SHELL env var on OS X +- set `mode-mouse on` by default +- do not make any decision about the prefix, just enhance it +- update `README.md`. List options set in the plugin. +- do *not* set `mode-mouse on` by default because some users don't like it +- if a user changes default prefix but binds `C-b` to something else, do not + unbind `C-b` + +### v1.0.0, 2014-07-30 +- initial work on the plugin +- add readme diff --git a/tmux/plugins/tmux-sensible/LICENSE.md b/tmux/plugins/tmux-sensible/LICENSE.md new file mode 100644 index 0000000..40f6ddd --- /dev/null +++ b/tmux/plugins/tmux-sensible/LICENSE.md @@ -0,0 +1,19 @@ +Copyright (C) 2014 Bruno Sutic + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE +OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tmux/plugins/tmux-sensible/README.md b/tmux/plugins/tmux-sensible/README.md new file mode 100644 index 0000000..7185b67 --- /dev/null +++ b/tmux/plugins/tmux-sensible/README.md @@ -0,0 +1,114 @@ +# Tmux sensible + +A set of tmux options that should be acceptable to everyone. + +Inspired by [vim-sensible](https://github.com/tpope/vim-sensible). + +Tested and working on Linux, OSX and Cygwin. + +### Principles + +- `tmux-sensible` options should be acceptable to **every** tmux user!
+ If any of the options bothers you, please open an issue and it will probably + be updated (or removed). +- if you think a new option should be added, feel free to open a pull request. +- **no overriding** of user defined settings.
+ Your existing `.tmux.conf` settings are respected and they won't be changed. + That way you can use `tmux-sensible` if you have a few specific options. + +### Goals + +- group standard tmux community options in one place +- remove clutter from your `.tmux.conf` +- educate new tmux users about basic options + +### Options + + # utf8 is on + set -g utf8 on + set -g status-utf8 on + + # address vim mode switching delay (http://superuser.com/a/252717/65504) + set -s escape-time 0 + + # increase scrollback buffer size + set -g history-limit 50000 + + # tmux messages are displayed for 4 seconds + set -g display-time 4000 + + # refresh 'status-left' and 'status-right' more often + set -g status-interval 5 + + # set only on OS X where it's required + set -g default-command "reattach-to-user-namespace -l $SHELL" + + # upgrade $TERM + set -g default-terminal "screen-256color" + + # emacs key bindings in tmux command prompt (prefix + :) are better than + # vi keys, even for vim users + set -g status-keys emacs + + # focus events enabled for terminals that support them + set -g focus-events on + + # super useful when using "grouped sessions" and multi-monitor setup + setw -g aggressive-resize on + +### Key bindings + + # easier and faster switching between next/prev window + bind C-p previous-window + bind C-n next-window + +Above bindings enhance the default `prefix + p` and `prefix + n` bindings by +allowing you to hold `Ctrl` and repeat `a + p`/`a + n` (if your prefix is +`C-a`), which is a lot quicker. + + # source .tmux.conf as suggested in `man tmux` + bind R source-file '~/.tmux.conf' + +"Adaptable" key bindings that build upon your `prefix` value: + + # if prefix is 'C-a' + bind C-a send-prefix + bind a last-window + +If prefix is `C-b`, above keys will be `C-b` and `b`.
+If prefix is `C-z`, above keys will be `C-z` and `z`... you get the idea. + +### Installation with [Tmux Plugin Manager](https://github.com/tmux-plugins/tpm) (recommended) + +Add plugin to the list of TPM plugins in `.tmux.conf`: + + set -g @plugin 'tmux-plugins/tmux-sensible' + +Hit `prefix + I` to fetch the plugin and source it. That's it! + +### Manual Installation + +Clone the repo: + + $ git clone https://github.com/tmux-plugins/tmux-sensible ~/clone/path + +Add this line to the bottom of `.tmux.conf`: + + run-shell ~/clone/path/sensible.tmux + +Reload TMUX environment with `$ tmux source-file ~/.tmux.conf`, and that's it. + +### Other goodies + +You might also find these useful: + +- [copycat](https://github.com/tmux-plugins/tmux-copycat) + improve tmux search and reduce mouse usage +- [pain control](https://github.com/tmux-plugins/tmux-pain-control) + useful standard bindings for controlling panes +- [resurrect](https://github.com/tmux-plugins/tmux-resurrect) + persists tmux environment across system restarts + +### License + +[MIT](LICENSE.md) diff --git a/tmux/plugins/tmux-sensible/sensible.tmux b/tmux/plugins/tmux-sensible/sensible.tmux new file mode 100755 index 0000000..5cf2af6 --- /dev/null +++ b/tmux/plugins/tmux-sensible/sensible.tmux @@ -0,0 +1,161 @@ +#!/usr/bin/env bash + +CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +# used to match output from `tmux list-keys` +KEY_BINDING_REGEX="bind-key[[:space:]]\+\(-r[[:space:]]\+\)\?\(-T prefix[[:space:]]\+\)\?" + +is_osx() { + local platform=$(uname) + [ "$platform" == "Darwin" ] +} + +iterm_terminal() { + [[ "$TERM_PROGRAM" =~ ^iTerm ]] +} + +command_exists() { + local command="$1" + type "$command" >/dev/null 2>&1 +} + +# returns prefix key, e.g. 'C-a' +prefix() { + tmux show-option -gv prefix +} + +# if prefix is 'C-a', this function returns 'a' +prefix_without_ctrl() { + local prefix="$(prefix)" + echo "$prefix" | cut -d '-' -f2 +} + +option_value_not_changed() { + local option="$1" + local default_value="$2" + local option_value=$(tmux show-option -gv "$option") + [ "$option_value" == "$default_value" ] +} + +server_option_value_not_changed() { + local option="$1" + local default_value="$2" + local option_value=$(tmux show-option -sv "$option") + [ "$option_value" == "$default_value" ] +} + +key_binding_not_set() { + local key="$1" + if $(tmux list-keys | grep -q "${KEY_BINDING_REGEX}${key}[[:space:]]"); then + return 1 + else + return 0 + fi +} + +key_binding_not_changed() { + local key="$1" + local default_value="$2" + if $(tmux list-keys | grep -q "${KEY_BINDING_REGEX}${key}[[:space:]]\+${default_value}"); then + # key still has the default binding + return 0 + else + return 1 + fi +} + +main() { + # OPTIONS + + # enable utf8 (option removed in tmux 2.2) + tmux set-option -g utf8 on 2>/dev/null + + # enable utf8 in tmux status-left and status-right (option removed in tmux 2.2) + tmux set-option -g status-utf8 on 2>/dev/null + + # address vim mode switching delay (http://superuser.com/a/252717/65504) + if server_option_value_not_changed "escape-time" "500"; then + tmux set-option -s escape-time 0 + fi + + # increase scrollback buffer size + if option_value_not_changed "history-limit" "2000"; then + tmux set-option -g history-limit 50000 + fi + + # tmux messages are displayed for 4 seconds + if option_value_not_changed "display-time" "750"; then + tmux set-option -g display-time 4000 + fi + + # refresh 'status-left' and 'status-right' more often + if option_value_not_changed "status-interval" "15"; then + tmux set-option -g status-interval 5 + fi + + # required (only) on OS X + if is_osx && command_exists "reattach-to-user-namespace" && option_value_not_changed "default-command" ""; then + tmux set-option -g default-command "reattach-to-user-namespace -l $SHELL" + fi + + # upgrade $TERM, tmux 1.9 + if option_value_not_changed "default-terminal" "screen"; then + tmux set-option -g default-terminal "screen-256color" + fi + # upgrade $TERM, tmux 2.0+ + if server_option_value_not_changed "default-terminal" "screen"; then + tmux set-option -s default-terminal "screen-256color" + fi + + # emacs key bindings in tmux command prompt (prefix + :) are better than + # vi keys, even for vim users + tmux set-option -g status-keys emacs + + # focus events enabled for terminals that support them + tmux set-option -g focus-events on + + # super useful when using "grouped sessions" and multi-monitor setup + if ! iterm_terminal; then + tmux set-window-option -g aggressive-resize on + fi + + # DEFAULT KEY BINDINGS + + local prefix="$(prefix)" + local prefix_without_ctrl="$(prefix_without_ctrl)" + + # if C-b is not prefix + if [ $prefix != "C-b" ]; then + # unbind obsolete default binding + if key_binding_not_changed "C-b" "send-prefix"; then + tmux unbind-key C-b + fi + + # pressing `prefix + prefix` sends to the shell + if key_binding_not_set "$prefix"; then + tmux bind-key "$prefix" send-prefix + fi + fi + + # If Ctrl-a is prefix then `Ctrl-a + a` switches between alternate windows. + # Works for any prefix character. + if key_binding_not_set "$prefix_without_ctrl"; then + tmux bind-key "$prefix_without_ctrl" last-window + fi + + # easier switching between next/prev window + if key_binding_not_set "C-p"; then + tmux bind-key C-p previous-window + fi + if key_binding_not_set "C-n"; then + tmux bind-key C-n next-window + fi + + # source `.tmux.conf` file - as suggested in `man tmux` + if key_binding_not_set "R"; then + tmux bind-key R run-shell ' \ + tmux source-file ~/.tmux.conf > /dev/null; \ + tmux display-message "Sourced .tmux.conf!"' + fi +} +main diff --git a/tmux/plugins/tmux-themepack/README.md b/tmux/plugins/tmux-themepack/README.md new file mode 100644 index 0000000..fc25902 --- /dev/null +++ b/tmux/plugins/tmux-themepack/README.md @@ -0,0 +1,201 @@ +# Tmux Themepack + +A pack of various themes for Tmux. + + +## Installation + +### Install manually + +1. Clone repo to local machine: + + git clone https://github.com/jimeh/tmux-themepack.git ~/.tmux-themepack + +2. Source desired theme in your `~/.tmux.conf`: + + source-file "${HOME}/.tmux-themepack/powerline/block/green.tmuxtheme" + + In some linux distributions you might have to remove the quotation marks from the + `source-file` command to avoid a `no such file or directory` error: + + source-file ${HOME}/.tmux-themepack/powerline/block/green.tmuxtheme + +### Install using [Tmux Plugin Manager](https://github.com/tmux-plugins/tpm) + +1. Add plugin to the list of TPM plugins in `.tmux.conf`: + + set -g @plugin 'jimeh/tmux-themepack' + +2. Hit `prefix + I` to fetch the plugin and source it. The plugin should now be working. + +You can pick and choose a theme via `.tmux.conf` option: + +- `set -g @themepack 'basic'` (default) +- `set -g @themepack 'powerline/block/blue'` +- `set -g @themepack 'powerline/block/cyan'` +- `set -g @themepack 'powerline/default/gray'` +- `set -g @themepack 'powerline/double/magenta'` +- `...` + +## Themes + +### Basic Themes + +**Default:** + +![basic](https://raw.github.com/jimeh/tmux-themepack-previews/master/default-preview.png) + +**Basic:** + +![basic](https://raw.github.com/jimeh/tmux-themepack-previews/master/basic-preview.png) + +### Powerline Themes + +Inspired by the [Powerline][] VIM plugin, +and requires the use of a powerline compatible font in your terminal. You can +find a number of such fonts in the +[powerline-fonts][] project. + +If your preferred font isn't available there, please refer to Powerline's +documentation on [Font Patching][] to patch the font yourself. + +[powerline]: https://github.com/Lokaltog/powerline +[powerline-fonts]: https://github.com/Lokaltog/powerline-fonts +[font patching]: https://powerline.readthedocs.org/en/latest/fontpatching.html#font-patching + +**Powerline Blue:** + +![powerline-default-blue](https://raw.github.com/jimeh/tmux-themepack-previews/master/powerline/default/blue-preview.png) + +**Powerline Cyan:** + +![powerline-default-cyan](https://raw.github.com/jimeh/tmux-themepack-previews/master/powerline/default/cyan-preview.png) + +**Powerline Gray:** + +![powerline-default-gray](https://raw.github.com/jimeh/tmux-themepack-previews/master/powerline/default/gray-preview.png) + +**Powerline Green:** + +![powerline-default-green](https://raw.github.com/jimeh/tmux-themepack-previews/master/powerline/default/green-preview.png) + +**Powerline Magenta:** + +![powerline-default-magenta](https://raw.github.com/jimeh/tmux-themepack-previews/master/powerline/default/magenta-preview.png) + +**Powerline Orange:** + +![powerline-default-orange](https://raw.github.com/jimeh/tmux-themepack-previews/master/powerline/default/orange-preview.png) + +**Powerline Red:** + +![powerline-default-red](https://raw.github.com/jimeh/tmux-themepack-previews/master/powerline/default/red-preview.png) + +**Powerline Yellow:** + +![powerline-default-yellow](https://raw.github.com/jimeh/tmux-themepack-previews/master/powerline/default/yellow-preview.png) + +#### Block + +Currently selected window is indicated by a colored block. + +**Powerline Blue Block:** + +![powerline-block-blue](https://raw.github.com/jimeh/tmux-themepack-previews/master/powerline/block/blue-preview.png) + +**Powerline Cyan Block:** + +![powerline-block-cyan](https://raw.github.com/jimeh/tmux-themepack-previews/master/powerline/block/cyan-preview.png) + +**Powerline Gray Block:** + +![powerline-block-gray](https://raw.github.com/jimeh/tmux-themepack-previews/master/powerline/block/gray-preview.png) + +**Powerline Green Block:** + +![powerline-block-green](https://raw.github.com/jimeh/tmux-themepack-previews/master/powerline/block/green-preview.png) + +**Powerline Magenta Block:** + +![powerline-block-magenta](https://raw.github.com/jimeh/tmux-themepack-previews/master/powerline/block/magenta-preview.png) + +**Powerline Orange Block:** + +![powerline-block-orange](https://raw.github.com/jimeh/tmux-themepack-previews/master/powerline/block/orange-preview.png) + +**Powerline Red Block:** + +![powerline-block-red](https://raw.github.com/jimeh/tmux-themepack-previews/master/powerline/block/red-preview.png) + +**Powerline Yellow Block:** + +![powerline-block-yellow](https://raw.github.com/jimeh/tmux-themepack-previews/master/powerline/block/yellow-preview.png) + +#### Double + +Both left and right far sides of the statusbar are colored, rather than just +the left side. + +**Powerline Double Blue:** + +![powerline-double-blue](https://raw.github.com/jimeh/tmux-themepack-previews/master/powerline/double/blue-preview.png) + +**Powerline Double Cyan:** + +![powerline-double-cyan](https://raw.github.com/jimeh/tmux-themepack-previews/master/powerline/double/cyan-preview.png) + +**Powerline Double Green:** + +![powerline-double-green](https://raw.github.com/jimeh/tmux-themepack-previews/master/powerline/double/green-preview.png) + +**Powerline Double Magenta:** + +![powerline-double-magenta](https://raw.github.com/jimeh/tmux-themepack-previews/master/powerline/double/magenta-preview.png) + +**Powerline Double Orange:** + +![powerline-double-orange](https://raw.github.com/jimeh/tmux-themepack-previews/master/powerline/double/orange-preview.png) + +**Powerline Double Red:** + +![powerline-double-red](https://raw.github.com/jimeh/tmux-themepack-previews/master/powerline/double/red-preview.png) + +**Powerline Double Yellow:** + +![powerline-double-yellow](https://raw.github.com/jimeh/tmux-themepack-previews/master/powerline/double/yellow-preview.png) + + +## Tips + +- Use different themes/colors on different machines by using some sort of + wrapper around launching Tmux. + + +## Contributing + +If you decide to contribute your own tmux themes, please try to base it on the +`default.tmuxtheme` theme. This ensures that switching between themes works as +it should and completely overwrites all settings from previous themes. + +If it's not possible to base your theme on my default one, something is +probably missing from it. So please contribute a fix to the default theme too +in that case :) + + +## License + +``` + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + Version 2, December 2004 + + Copyright (C) 2013 Jim Myhrberg + + Everyone is permitted to copy and distribute verbatim or modified + copies of this license document, and changing it is allowed as long + as the name is changed. + + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. You just DO WHAT THE FUCK YOU WANT TO. +``` diff --git a/tmux/plugins/tmux-themepack/basic.tmuxtheme b/tmux/plugins/tmux-themepack/basic.tmuxtheme new file mode 100644 index 0000000..c99652c --- /dev/null +++ b/tmux/plugins/tmux-themepack/basic.tmuxtheme @@ -0,0 +1,54 @@ +# Status update interval +set -g status-interval 1 + +# Basic status bar colors +set -g status-style bg=black,fg=cyan + +# Left side of status bar +set -g status-left-style bg=black,fg=green +set -g status-left-length 40 +set -g status-left "#S #[fg=white]» #[fg=yellow]#I #[fg=cyan]#P" + +# Right side of status bar +set -g status-right-style bg=black,fg=cyan +set -g status-right-length 40 +set -g status-right "#H #[fg=white]« #[fg=yellow]%H:%M:%S #[fg=green]%d-%b-%y" + +# Window status +set -g window-status-format " #I:#W#F " +set -g window-status-current-format " #I:#W#F " + +# Current window status +set -g window-status-current-style bg=red,fg=black + +# Window with activity status +set -g window-status-activity-style bg=black,fg=yellow + +# Window separator +set -g window-status-separator "" + +# Window status alignment +set -g status-justify centre + +# Pane border +set -g pane-border-style bg=default,fg=default + +# Active pane border +set -g pane-active-border-style bg=default,fg=green + +# Pane number indicator +set -g display-panes-colour default +set -g display-panes-active-colour default + +# Clock mode +set -g clock-mode-colour red +set -g clock-mode-style 24 + +# Message +set -g message-style bg=default,fg=default + +# Command message +set -g message-command-style bg=default,fg=default + +# Mode +set -g mode-style bg=red,fg=default diff --git a/tmux/plugins/tmux-themepack/default.tmuxtheme b/tmux/plugins/tmux-themepack/default.tmuxtheme new file mode 100644 index 0000000..6dda2f7 --- /dev/null +++ b/tmux/plugins/tmux-themepack/default.tmuxtheme @@ -0,0 +1,62 @@ +# +# Default Tmux Theme +# + +# This theme matches Tmux's default style as closely as possible. It functions +# as a template for creating new themes, and as a way to reset a running Tmux +# server's style to it's defaults. + +# Status update interval +set -g status-interval 15 + +# Basic status bar colors +set -g status-style bg=green,fg=black + +# Left side of status bar +set -g status-left-style bg=green,fg=black +set -g status-left-length 10 +set -g status-left "[#S]" + +# Right side of status bar +set -g status-right-style bg=green,fg=black +set -g status-right-length 40 +set -g status-right "\"#H\" %H:%M %d-%b-%y" + +# Window status +set -g window-status-format "#I:#W#F" +set -g window-status-current-format "#I:#W#F" + +# Current window status +set -g window-status-current-style bg=green,fg=black + +# Window with activity status +set -g window-status-activity-style bg=black,fg=green + +# Window separator +set -g window-status-separator " " + +# Window status alignment +set -g status-justify left + +# Pane border +set -g pane-border-style bg=default,fg=white + +# Active pane border +set -g pane-active-border-style bg=default,fg=green + +# Pane number indicator +set -g display-panes-colour blue +set -g display-panes-active-colour red + +# Clock mode +set -g clock-mode-colour blue +set -g clock-mode-style 24 + +# Message +set -g message-style bg=yellow,fg=black + +# Command message +set -g message-command-style bg=green,fg=black + +# Mode +set -g mode-style bg=yellow,fg=black diff --git a/tmux/plugins/tmux-themepack/powerline/block/blue.tmuxtheme b/tmux/plugins/tmux-themepack/powerline/block/blue.tmuxtheme new file mode 100644 index 0000000..8a804a3 --- /dev/null +++ b/tmux/plugins/tmux-themepack/powerline/block/blue.tmuxtheme @@ -0,0 +1,64 @@ +# +# Powerline Blue Block - Tmux Theme +# Created by Jim Myhrberg . +# +# Inspired by vim-powerline: https://github.com/Lokaltog/powerline +# +# Requires terminal to be using a powerline compatible font, find one here: +# https://github.com/Lokaltog/powerline-fonts +# + +# Status update interval +set -g status-interval 1 + +# Basic status bar colors +set -g status-style fg=colour240,bg=colour233 + +# Left side of status bar +set -g status-left-style bg=colour233,fg=colour243 +set -g status-left-length 40 +set -g status-left "#[fg=colour232,bg=colour24,bold] #S #[fg=colour24,bg=colour240,nobold]#[fg=colour233,bg=colour240] #(whoami) #[fg=colour240,bg=colour235]#[fg=colour240,bg=colour235] #I:#P #[fg=colour235,bg=colour233,nobold]" + +# Right side of status bar +set -g status-right-style bg=colour233,fg=colour243 +set -g status-right-length 150 +set -g status-right "#[fg=colour235,bg=colour233]#[fg=colour240,bg=colour235] %H:%M:%S #[fg=colour240,bg=colour235]#[fg=colour233,bg=colour240] %d-%b-%y #[fg=colour245,bg=colour240]#[fg=colour232,bg=colour245,bold] #H " + +# Window status +set -g window-status-format " #I:#W#F " +set -g window-status-current-format " #I:#W#F " + +# Current window status +set -g window-status-current-style bg=colour24,fg=colour232 + +# Window with activity status +set -g window-status-activity-style bg=colour233,fg=colour31 + +# Window separator +set -g window-status-separator "" + +# Window status alignment +set -g status-justify centre + +# Pane border +set -g pane-border-style bg=default,fg=colour238 + +# Active pane border +set -g pane-active-border-style bg=default,fg=colour24 + +# Pane number indicator +set -g display-panes-colour colour233 +set -g display-panes-active-colour colour245 + +# Clock mode +set -g clock-mode-colour colour24 +set -g clock-mode-style 24 + +# Message +set -g message-style bg=colour24,fg=black + +# Command message +set -g message-command-style bg=colour233,fg=black + +# Mode +set -g mode-style bg=colour24,fg=colour231 diff --git a/tmux/plugins/tmux-themepack/powerline/block/cyan.tmuxtheme b/tmux/plugins/tmux-themepack/powerline/block/cyan.tmuxtheme new file mode 100644 index 0000000..893bab0 --- /dev/null +++ b/tmux/plugins/tmux-themepack/powerline/block/cyan.tmuxtheme @@ -0,0 +1,65 @@ +# +# Powerline Cyan Block - Tmux Theme +# Created by Jim Myhrberg . +# +# Inspired by vim-powerline: https://github.com/Lokaltog/powerline +# +# Requires terminal to be using a powerline compatible font, find one here: +# https://github.com/Lokaltog/powerline-fonts +# + +# Status update interval +set -g status-interval 1 + +# Basic status bar colors +set -g status-style fg=colour240,bg=colour233 + +# Left side of status bar +set -g status-left-style bg=colour233,fg=colour243 +set -g status-left-length 40 +set -g status-left "#[fg=colour232,bg=colour39,bold] #S #[fg=colour39,bg=colour240,nobold]#[fg=colour233,bg=colour240] #(whoami) #[fg=colour240,bg=colour235]#[fg=colour240,bg=colour235] #I:#P #[fg=colour235,bg=colour233,nobold]" + +# Right side of status bar +set -g status-right-style bg=colour233,fg=colour243 +set -g status-right-length 150 +set -g status-right "#[fg=colour235,bg=colour233]#[fg=colour240,bg=colour235] %H:%M:%S #[fg=colour240,bg=colour235]#[fg=colour233,bg=colour240] %d-%b-%y #[fg=colour245,bg=colour240]#[fg=colour232,bg=colour245,bold] #H " + +# Window status +set -g window-status-format " #I:#W#F " +set -g window-status-current-format " #I:#W#F " + +# Current window status +set -g window-status-current-style bg=colour39,fg=colour232 + +# Window with activity status +set -g window-status-activity-style bg=colour233,fg=colour75 + +# Window separator +set -g window-status-separator "" + +# Window status alignment +set -g status-justify centre + +# Pane border +set -g pane-border-style bg=default,fg=colour238 + +# Active pane border +set -g pane-active-border-style bg=default,fg=colour39 + +# Pane number indicator +set -g display-panes-colour colour233 +set -g display-panes-active-colour colour245 + +# Clock mode +set -g clock-mode-colour colour39 +set -g clock-mode-style 24 + +# Message +set -g message-style bg=colour39,fg=black + +# Command message +set -g message-command-style bg=colour233,fg=black + +# Mode +set -g mode-style bg=colour39,fg=colour232 + diff --git a/tmux/plugins/tmux-themepack/powerline/block/gray.tmuxtheme b/tmux/plugins/tmux-themepack/powerline/block/gray.tmuxtheme new file mode 100644 index 0000000..ba03f56 --- /dev/null +++ b/tmux/plugins/tmux-themepack/powerline/block/gray.tmuxtheme @@ -0,0 +1,64 @@ +# +# Powerline Gray Block - Tmux Theme +# Created by Jim Myhrberg . +# +# Inspired by vim-powerline: https://github.com/Lokaltog/powerline +# +# Requires terminal to be using a powerline compatible font, find one here: +# https://github.com/Lokaltog/powerline-fonts +# + +# Status update interval +set -g status-interval 1 + +# Basic status bar colors +set -g status-style fg=colour238,bg=colour233 + +# Left side of status bar +set -g status-left-style bg=colour233,fg=colour243 +set -g status-left-length 40 +set -g status-left "#[fg=colour232,bg=colour245,bold] #S #[fg=colour245,bg=colour240,nobold]#[fg=colour233,bg=colour240] #(whoami) #[fg=colour240,bg=colour235]#[fg=colour240,bg=colour235] #I:#P #[fg=colour235,bg=colour233,nobold]" + +# Right side of status bar +set -g status-right-style bg=colour233,fg=colour243 +set -g status-right-length 150 +set -g status-right "#[fg=colour235,bg=colour233]#[fg=colour240,bg=colour235] %H:%M:%S #[fg=colour240,bg=colour235]#[fg=colour233,bg=colour240] %d-%b-%y #[fg=colour245,bg=colour240]#[fg=colour232,bg=colour245,bold] #H " + +# Window status +set -g window-status-format " #I:#W#F " +set -g window-status-current-format " #I:#W#F " + +# Current window status +set -g window-status-current-style bg=colour245,fg=colour232 + +# Window with activity status +set -g window-status-activity-style bg=colour233,fg=colour245 + +# Window separator +set -g window-status-separator "" + +# Window status alignment +set -g status-justify centre + +# Pane border +set -g pane-border-style bg=default,fg=colour235 + +# Active pane border +set -g pane-active-border-style bg=default,fg=colour240 + +# Pane number indicator +set -g display-panes-colour colour233 +set -g display-panes-active-colour colour245 + +# Clock mode +set -g clock-mode-colour colour240 +set -g clock-mode-style 24 + +# Message +set -g message-style bg=colour245,fg=colour232 + +# Command message +set -g message-command-style bg=colour233,fg=colour250 + +# Mode +set -g mode-style bg=colour243,fg=colour232 diff --git a/tmux/plugins/tmux-themepack/powerline/block/green.tmuxtheme b/tmux/plugins/tmux-themepack/powerline/block/green.tmuxtheme new file mode 100644 index 0000000..53f2966 --- /dev/null +++ b/tmux/plugins/tmux-themepack/powerline/block/green.tmuxtheme @@ -0,0 +1,64 @@ +# +# Powerline Green Block - Tmux Theme +# Created by Jim Myhrberg . +# +# Inspired by vim-powerline: https://github.com/Lokaltog/powerline +# +# Requires terminal to be using a powerline compatible font, find one here: +# https://github.com/Lokaltog/powerline-fonts +# + +# Status update interval +set -g status-interval 1 + +# Basic status bar colors +set -g status-style fg=colour240,bg=colour233 + +# Left side of status bar +set -g status-left-style bg=colour233,fg=colour243 +set -g status-left-length 40 +set -g status-left "#[fg=colour232,bg=colour100,bold] #S #[fg=colour100,bg=colour240,nobold]#[fg=colour233,bg=colour240] #(whoami) #[fg=colour240,bg=colour235]#[fg=colour240,bg=colour235] #I:#P #[fg=colour235,bg=colour233,nobold]" + +# Right side of status bar +set -g status-right-style bg=colour233,fg=colour243 +set -g status-right-length 150 +set -g status-right "#[fg=colour235,bg=colour233]#[fg=colour240,bg=colour235] %H:%M:%S #[fg=colour240,bg=colour235]#[fg=colour233,bg=colour240] %d-%b-%y #[fg=colour245,bg=colour240]#[fg=colour232,bg=colour245,bold] #H " + +# Window status +set -g window-status-format " #I:#W#F " +set -g window-status-current-format " #I:#W#F " + +# Current window status +set -g window-status-current-style bg=colour100,fg=colour232 + +# Window with activity status +set -g window-status-activity-style bg=colour233,fg=colour107 + +# Window separator +set -g window-status-separator "" + +# Window status alignment +set -g status-justify centre + +# Pane border +set -g pane-border-style bg=default,fg=colour238 + +# Active pane border +set -g pane-active-border-style bg=default,fg=colour100 + +# Pane number indicator +set -g display-panes-colour colour233 +set -g display-panes-active-colour colour245 + +# Clock mode +set -g clock-mode-colour colour100 +set -g clock-mode-style 24 + +# Message +set -g message-style bg=colour100,fg=black + +# Command message +set -g message-command-style bg=colour233,fg=black + +# Mode +set -g mode-style bg=colour100,fg=colour235 diff --git a/tmux/plugins/tmux-themepack/powerline/block/magenta.tmuxtheme b/tmux/plugins/tmux-themepack/powerline/block/magenta.tmuxtheme new file mode 100644 index 0000000..cdd005a --- /dev/null +++ b/tmux/plugins/tmux-themepack/powerline/block/magenta.tmuxtheme @@ -0,0 +1,64 @@ +# +# Powerline Magenta Block - Tmux Theme +# Created by Jim Myhrberg . +# +# Inspired by vim-powerline: https://github.com/Lokaltog/powerline +# +# Requires terminal to be using a powerline compatible font, find one here: +# https://github.com/Lokaltog/powerline-fonts +# + +# Status update interval +set -g status-interval 1 + +# Basic status bar colors +set -g status-style fg=colour240,bg=colour233 + +# Left side of status bar +set -g status-left-style bg=colour233,fg=colour243 +set -g status-left-length 40 +set -g status-left "#[fg=colour232,bg=colour125,bold] #S #[fg=colour125,bg=colour240,nobold]#[fg=colour233,bg=colour240] #(whoami) #[fg=colour240,bg=colour235]#[fg=colour240,bg=colour235] #I:#P #[fg=colour235,bg=colour233,nobold]" + +# Right side of status bar +set -g status-right-style bg=colour233,fg=colour243 +set -g status-right-length 150 +set -g status-right "#[fg=colour235,bg=colour233]#[fg=colour240,bg=colour235] %H:%M:%S #[fg=colour240,bg=colour235]#[fg=colour233,bg=colour240] %d-%b-%y #[fg=colour245,bg=colour240]#[fg=colour232,bg=colour245,bold] #H " + +# Window status +set -g window-status-format " #I:#W#F " +set -g window-status-current-format " #I:#W#F " + +# Current window status +set -g window-status-current-style bg=colour90,fg=colour232 + +# Window with activity status +set -g window-status-activity-style bg=colour233,fg=colour141 + +# Window separator +set -g window-status-separator "" + +# Window status alignment +set -g status-justify centre + +# Pane border +set -g pane-border-style bg=default,fg=colour238 + +# Active pane border +set -g pane-active-border-style bg=default,fg=colour90 + +# Pane number indicator +set -g display-panes-colour colour233 +set -g display-panes-active-colour colour245 + +# Clock mode +set -g clock-mode-colour colour90 +set -g clock-mode-style 24 + +# Message +set -g message-style bg=colour90,fg=black + +# Command message +set -g message-command-style bg=colour233,fg=black + +# Mode +set -g mode-style bg=colour125,fg=colour231 diff --git a/tmux/plugins/tmux-themepack/powerline/block/orange.tmuxtheme b/tmux/plugins/tmux-themepack/powerline/block/orange.tmuxtheme new file mode 100644 index 0000000..2f5a08d --- /dev/null +++ b/tmux/plugins/tmux-themepack/powerline/block/orange.tmuxtheme @@ -0,0 +1,64 @@ +# +# Powerline Orange Block - Tmux Theme +# Created by Jim Myhrberg . +# +# Inspired by vim-powerline: https://github.com/Lokaltog/powerline +# +# Requires terminal to be using a powerline compatible font, find one here: +# https://github.com/Lokaltog/powerline-fonts +# + +# Status update interval +set -g status-interval 1 + +# Basic status bar colors +set -g status-style fg=colour240,bg=colour233 + +# Left side of status bar +set -g status-left-style bg=colour233,fg=colour243 +set -g status-left-length 40 +set -g status-left "#[fg=colour232,bg=colour130,bold] #S #[fg=colour130,bg=colour240,nobold]#[fg=colour233,bg=colour240] #(whoami) #[fg=colour240,bg=colour235]#[fg=colour240,bg=colour235] #I:#P #[fg=colour235,bg=colour233,nobold]" + +# Right side of status bar +set -g status-right-style bg=colour233,fg=colour243 +set -g status-right-length 150 +set -g status-right "#[fg=colour235,bg=colour233]#[fg=colour240,bg=colour235] %H:%M:%S #[fg=colour240,bg=colour235]#[fg=colour233,bg=colour240] %d-%b-%y #[fg=colour245,bg=colour240]#[fg=colour232,bg=colour245,bold] #H " + +# Window status +set -g window-status-format " #I:#W#F " +set -g window-status-current-format " #I:#W#F " + +# Current window status +set -g window-status-current-style bg=colour130,fg=colour232 + +# Window with activity status +set -g window-status-activity-style bg=colour233,fg=colour130 + +# Window separator +set -g window-status-separator "" + +# Window status alignment +set -g status-justify centre + +# Pane border +set -g pane-border-style bg=default,fg=colour238 + +# Active pane border +set -g pane-active-border-style bg=default,fg=colour130 + +# Pane number indicator +set -g display-panes-colour colour233 +set -g display-panes-active-colour colour245 + +# Clock mode +set -g clock-mode-colour colour130 +set -g clock-mode-style 24 + +# Message +set -g message-style bg=colour130,fg=black + +# Command message +set -g message-command-style bg=colour233,fg=black + +# Mode +set -g mode-style bg=colour130,fg=colour232 diff --git a/tmux/plugins/tmux-themepack/powerline/block/red.tmuxtheme b/tmux/plugins/tmux-themepack/powerline/block/red.tmuxtheme new file mode 100644 index 0000000..aebf1fb --- /dev/null +++ b/tmux/plugins/tmux-themepack/powerline/block/red.tmuxtheme @@ -0,0 +1,64 @@ +# +# Powerline Red Block - Tmux Theme +# Created by Jim Myhrberg . +# +# Inspired by vim-powerline: https://github.com/Lokaltog/powerline +# +# Requires terminal to be using a powerline compatible font, find one here: +# https://github.com/Lokaltog/powerline-fonts +# + +# Status update interval +set -g status-interval 1 + +# Basic status bar colors +set -g status-style fg=colour240,bg=colour233 + +# Left side of status bar +set -g status-left-style bg=colour233,fg=colour243 +set -g status-left-length 40 +set -g status-left "#[fg=colour16,bg=colour88,bold] #S #[fg=colour88,bg=colour240,nobold]#[fg=colour233,bg=colour240] #(whoami) #[fg=colour240,bg=colour235]#[fg=colour240,bg=colour235] #I:#P #[fg=colour235,bg=colour233,nobold]" + +# Right side of status bar +set -g status-right-style bg=colour233,fg=colour243 +set -g status-right-length 150 +set -g status-right "#[fg=colour235,bg=colour233]#[fg=colour240,bg=colour235] %H:%M:%S #[fg=colour240,bg=colour235]#[fg=colour233,bg=colour240] %d-%b-%y #[fg=colour245,bg=colour240]#[fg=colour232,bg=colour245,bold] #H " + +# Window status +set -g window-status-format " #I:#W#F " +set -g window-status-current-format " #I:#W#F " + +# Current window status +set -g window-status-current-style bg=colour124,fg=colour16 + +# Window with activity status +set -g window-status-activity-style bg=colour233,fg=colour88 + +# Window separator +set -g window-status-separator "" + +# Window status alignment +set -g status-justify centre + +# Pane border +set -g pane-border-style bg=default,fg=colour238 + +# Active pane border +set -g pane-active-border-style bg=default,fg=colour88 + +# Pane number indicator +set -g display-panes-colour colour233 +set -g display-panes-active-colour colour245 + +# Clock mode +set -g clock-mode-colour colour88 +set -g message-style bg=colour24 + +# Message +set -g message-style bg=colour88,fg=black + +# Command message +set -g message-command-style bg=colour88,fg=black + +# Mode +set -g mode-style bg=colour124,fg=colour231 diff --git a/tmux/plugins/tmux-themepack/powerline/block/yellow.tmuxtheme b/tmux/plugins/tmux-themepack/powerline/block/yellow.tmuxtheme new file mode 100644 index 0000000..a0115ae --- /dev/null +++ b/tmux/plugins/tmux-themepack/powerline/block/yellow.tmuxtheme @@ -0,0 +1,64 @@ +# +# Powerline Yellow Block - Tmux Theme +# Created by Jim Myhrberg . +# +# Inspired by vim-powerline: https://github.com/Lokaltog/powerline +# +# Requires terminal to be using a powerline compatible font, find one here: +# https://github.com/Lokaltog/powerline-fonts +# + +# Status update interval +set -g status-interval 1 + +# Basic status bar colors +set -g status-style fg=colour240,bg=colour233 + +# Left side of status bar +set -g status-left-style bg=colour233,fg=colour243 +set -g status-left-length 40 +set -g status-left "#[fg=colour232,bg=colour227,bold] #S #[fg=colour227,bg=colour240,nobold]#[fg=colour233,bg=colour240] #(whoami) #[fg=colour240,bg=colour235]#[fg=colour240,bg=colour235] #I:#P #[fg=colour235,bg=colour233,nobold]" + +# Right side of status bar +set -g status-right-style bg=colour233,fg=colour243 +set -g status-right-length 150 +set -g status-right "#[fg=colour235,bg=colour233]#[fg=colour240,bg=colour235] %H:%M:%S #[fg=colour240,bg=colour235]#[fg=colour233,bg=colour240] %d-%b-%y #[fg=colour245,bg=colour240]#[fg=colour232,bg=colour245,bold] #H " + +# Window status +set -g window-status-format " #I:#W#F " +set -g window-status-current-format " #I:#W#F " + +# Current window status +set -g window-status-current-style bg=colour227,fg=colour232 + +# Window with activity status +set -g window-status-activity-style bg=colour233,fg=colour229 + +# Window separator +set -g window-status-separator "" + +# Window status alignment +set -g status-justify centre + +# Pane border +set -g pane-border-style bg=default,fg=colour238 + +# Active pane border +set -g pane-active-border-style bg=default,fg=colour227 + +# Pane number indicator +set -g display-panes-colour colour233 +set -g display-panes-active-colour colour245 + +# Clock mode +set -g clock-mode-colour colour227 +set -g clock-mode-style 24 + +# Message +set -g message-style bg=colour227,fg=black + +# Command message +set -g message-command-style bg=colour233,fg=black + +# Mode +set -g mode-style bg=colour227,fg=colour235 diff --git a/tmux/plugins/tmux-themepack/powerline/default/blue.tmuxtheme b/tmux/plugins/tmux-themepack/powerline/default/blue.tmuxtheme new file mode 100644 index 0000000..2c4bfeb --- /dev/null +++ b/tmux/plugins/tmux-themepack/powerline/default/blue.tmuxtheme @@ -0,0 +1,64 @@ +# +# Powerline Blue - Tmux Theme +# Created by Jim Myhrberg . +# +# Inspired by vim-powerline: https://github.com/Lokaltog/powerline +# +# Requires terminal to be using a powerline compatible font, find one here: +# https://github.com/Lokaltog/powerline-fonts +# + +# Status update interval +set -g status-interval 1 + +# Basic status bar colors +set -g status-style fg=colour238,bg=colour233 + +# Left side of status bar +set -g status-left-style bg=colour233,fg=colour243 +set -g status-left-length 40 +set -g status-left "#[fg=colour232,bg=colour24,bold] #S #[fg=colour24,bg=colour240,nobold]#[fg=colour233,bg=colour240] #(whoami) #[fg=colour240,bg=colour235]#[fg=colour240,bg=colour235] #I:#P #[fg=colour235,bg=colour233,nobold]" + +# Right side of status bar +set -g status-right-style bg=colour233,fg=colour243 +set -g status-right-length 150 +set -g status-right "#[fg=colour235,bg=colour233]#[fg=colour240,bg=colour235] %H:%M:%S #[fg=colour240,bg=colour235]#[fg=colour233,bg=colour240] %d-%b-%y #[fg=colour245,bg=colour240]#[fg=colour232,bg=colour245,bold] #H " + +# Window status +set -g window-status-format " #I:#W#F " +set -g window-status-current-format "#[fg=colour233,bg=black]#[fg=colour33,nobold] #I:#W#F #[fg=colour233,bg=black,nobold]" + +# Current window status +set -g window-status-current-style bg=colour100,fg=colour235 + +# Window with activity status +set -g window-status-activity-style bg=colour233,fg=colour245 + +# Window separator +set -g window-status-separator "" + +# Window status alignment +set -g status-justify centre + +# Pane border +set -g pane-border-style bg=default,fg=colour238 + +# Active pane border +set -g pane-active-border-style bg=default,fg=colour24 + +# Pane number indicator +set -g display-panes-colour colour233 +set -g display-panes-active-colour colour245 + +# Clock mode +set -g clock-mode-colour colour24 +set -g clock-mode-style 24 + +# Message +set -g message-style bg=colour24,fg=black + +# Command message +set -g message-command-style bg=colour233,fg=black + +# Mode +set -g mode-style bg=colour24,fg=colour231 diff --git a/tmux/plugins/tmux-themepack/powerline/default/cyan.tmuxtheme b/tmux/plugins/tmux-themepack/powerline/default/cyan.tmuxtheme new file mode 100644 index 0000000..52fab19 --- /dev/null +++ b/tmux/plugins/tmux-themepack/powerline/default/cyan.tmuxtheme @@ -0,0 +1,64 @@ +# +# Powerline Cyan - Tmux Theme +# Created by Jim Myhrberg . +# +# Inspired by vim-powerline: https://github.com/Lokaltog/powerline +# +# Requires terminal to be using a powerline compatible font, find one here: +# https://github.com/Lokaltog/powerline-fonts +# + +# Status update interval +set -g status-interval 1 + +# Basic status bar colors +set -g status-style fg=colour240,bg=colour233 + +# Left side of status bar +set -g status-left-style bg=colour233,fg=colour243 +set -g status-left-length 40 +set -g status-left "#[fg=colour232,bg=colour39,bold] #S #[fg=colour39,bg=colour240,nobold]#[fg=colour233,bg=colour240] #(whoami) #[fg=colour240,bg=colour235]#[fg=colour240,bg=colour235] #I:#P #[fg=colour235,bg=colour233,nobold]" + +# Right side of status bar +set -g status-right-style bg=colour233,fg=colour243 +set -g status-right-length 150 +set -g status-right "#[fg=colour235,bg=colour233]#[fg=colour240,bg=colour235] %H:%M:%S #[fg=colour240,bg=colour235]#[fg=colour233,bg=colour240] %d-%b-%y #[fg=colour245,bg=colour240]#[fg=colour232,bg=colour245,bold] #H " + +# Window status +set -g window-status-format " #I:#W#F " +set -g window-status-current-format "#[fg=colour233,bg=black]#[fg=colour81,nobold] #I:#W#F #[fg=colour233,bg=black,nobold]" + +# Current window status +set -g window-status-current-style bg=colour39,fg=colour235 + +# Window with activity status +set -g window-status-activity-style bg=colour233,fg=colour245 + +# Window separator +set -g window-status-separator "" + +# Window status alignment +set -g status-justify centre + +# Pane border +set -g pane-border-style bg=default,fg=colour238 + +# Active pane border +set -g pane-active-border-style bg=default,fg=colour39 + +# Pane number indicator +set -g display-panes-colour colour233 +set -g display-panes-active-colour colour245 + +# Clock mode +set -g clock-mode-colour colour39 +set -g clock-mode-style 24 + +# Message +set -g message-style bg=colour39,fg=black + +# Command message +set -g message-command-style bg=colour233,fg=black + +# Mode +set -g mode-style bg=colour39,fg=colour232 diff --git a/tmux/plugins/tmux-themepack/powerline/default/gray.tmuxtheme b/tmux/plugins/tmux-themepack/powerline/default/gray.tmuxtheme new file mode 100644 index 0000000..23c61bf --- /dev/null +++ b/tmux/plugins/tmux-themepack/powerline/default/gray.tmuxtheme @@ -0,0 +1,64 @@ +# +# Powerline Gray - Tmux Theme +# Created by Jim Myhrberg . +# +# Inspired by vim-powerline: https://github.com/Lokaltog/powerline +# +# Requires terminal to be using a powerline compatible font, find one here: +# https://github.com/Lokaltog/powerline-fonts +# + +# Status update interval +set -g status-interval 1 + +# Basic status bar colors +set -g status-style fg=colour238,bg=colour233 + +# Left side of status bar +set -g status-left-style bg=colour233,fg=colour243 +set -g status-left-length 40 +set -g status-left "#[fg=colour232,bg=colour245,bold] #S #[fg=colour245,bg=colour240,nobold]#[fg=colour233,bg=colour240] #(whoami) #[fg=colour240,bg=colour235]#[fg=colour240,bg=colour235] #I:#P #[fg=colour235,bg=colour233,nobold]" + +# Right side of status bar +set -g status-right-style bg=colour233,fg=colour243 +set -g status-right-length 150 +set -g status-right "#[fg=colour235,bg=colour233]#[fg=colour240,bg=colour235] %H:%M:%S #[fg=colour240,bg=colour235]#[fg=colour233,bg=colour240] %d-%b-%y #[fg=colour245,bg=colour240]#[fg=colour232,bg=colour245,bold] #H " + +# Window status +set -g window-status-format " #I:#W#F " +set -g window-status-current-format "#[fg=colour233,bg=black]#[fg=colour250,nobold] #I:#W#F #[fg=colour233,bg=black,nobold]" + +# Current window status +set -g window-status-current-style bg=black,fg=colour250 + +# Window with activity status +set -g window-status-activity-style bg=colour233,fg=colour243 + +# Window separator +set -g window-status-separator "" + +# Window status alignment +set -g status-justify centre + +# Pane border +set -g pane-border-style bg=default,fg=colour235 + +# Active pane border +set -g pane-active-border-style bg=default,fg=colour240 + +# Pane number indicator +set -g display-panes-colour colour233 +set -g display-panes-active-colour colour245 + +# Clock mode +set -g clock-mode-colour colour240 +set -g clock-mode-style 24 + +# Message +set -g message-style bg=colour245,fg=colour232 + +# Command message +set -g message-command-style bg=colour233,fg=colour250 + +# Mode +set -g mode-style bg=colour243,fg=colour232 diff --git a/tmux/plugins/tmux-themepack/powerline/default/green.tmuxtheme b/tmux/plugins/tmux-themepack/powerline/default/green.tmuxtheme new file mode 100644 index 0000000..8e372f2 --- /dev/null +++ b/tmux/plugins/tmux-themepack/powerline/default/green.tmuxtheme @@ -0,0 +1,64 @@ +# +# Powerline Green - Tmux Theme +# Created by Jim Myhrberg . +# +# Inspired by vim-powerline: https://github.com/Lokaltog/powerline +# +# Requires terminal to be using a powerline compatible font, find one here: +# https://github.com/Lokaltog/powerline-fonts +# + +# Status update interval +set -g status-interval 1 + +# Basic status bar colors +set -g status-style fg=colour240,bg=colour233 + +# Left side of status bar +set -g status-left-style bg=colour233,fg=colour243 +set -g status-left-length 40 +set -g status-left "#[fg=colour232,bg=colour100,bold] #S #[fg=colour100,bg=colour240,nobold]#[fg=colour233,bg=colour240] #(whoami) #[fg=colour240,bg=colour235]#[fg=colour240,bg=colour235] #I:#P #[fg=colour235,bg=colour233,nobold]" + +# Right side of status bar +set -g status-right-style bg=colour233,fg=colour243 +set -g status-right-length 150 +set -g status-right "#[fg=colour235,bg=colour233]#[fg=colour240,bg=colour235] %H:%M:%S #[fg=colour240,bg=colour235]#[fg=colour233,bg=colour240] %d-%b-%y #[fg=colour245,bg=colour240]#[fg=colour232,bg=colour245,bold] #H " + +# Window status +set -g window-status-format " #I:#W#F " +set -g window-status-current-format "#[fg=colour233,bg=black]#[fg=colour190,nobold] #I:#W#F #[fg=colour233,bg=black,nobold]" + +# Current window status +set -g window-status-current-style bg=colour100,fg=colour235 + +# Window with activity status +set -g window-status-activity-style bg=colour233,fg=colour245 + +# Window separator +set -g window-status-separator "" + +# Window status alignment +set -g status-justify centre + +# Pane border +set -g pane-border-style bg=default,fg=colour238 + +# Active pane border +set -g pane-active-border-style bg=default,fg=colour100 + +# Pane number indicator +set -g display-panes-colour colour233 +set -g display-panes-active-colour colour245 + +# Clock mode +set -g clock-mode-colour colour100 +set -g clock-mode-style 24 + +# Message +set -g message-style bg=colour100,fg=black + +# Command message +set -g message-command-style bg=colour233,fg=black + +# Mode +set -g mode-style bg=colour100,fg=colour235 diff --git a/tmux/plugins/tmux-themepack/powerline/default/magenta.tmuxtheme b/tmux/plugins/tmux-themepack/powerline/default/magenta.tmuxtheme new file mode 100644 index 0000000..ee2c11d --- /dev/null +++ b/tmux/plugins/tmux-themepack/powerline/default/magenta.tmuxtheme @@ -0,0 +1,64 @@ +# +# Powerline Magenta - Tmux Theme +# Created by Jim Myhrberg . +# +# Inspired by vim-powerline: https://github.com/Lokaltog/powerline +# +# Requires terminal to be using a powerline compatible font, find one here: +# https://github.com/Lokaltog/powerline-fonts +# + +# Status update interval +set -g status-interval 1 + +# Basic status bar colors +set -g status-style fg=colour240,bg=colour233 + +# Left side of status bar +set -g status-left-style bg=colour233,fg=colour243 +set -g status-left-length 40 +set -g status-left "#[fg=colour232,bg=colour125,bold] #S #[fg=colour125,bg=colour240,nobold]#[fg=colour233,bg=colour240] #(whoami) #[fg=colour240,bg=colour235]#[fg=colour240,bg=colour235] #I:#P #[fg=colour235,bg=colour233,nobold]" + +# Right side of status bar +set -g status-right-style bg=colour233,fg=colour243 +set -g status-right-length 150 +set -g status-right "#[fg=colour235,bg=colour233]#[fg=colour240,bg=colour235] %H:%M:%S #[fg=colour240,bg=colour235]#[fg=colour233,bg=colour240] %d-%b-%y #[fg=colour245,bg=colour240]#[fg=colour232,bg=colour245,bold] #H " + +# Window status +set -g window-status-format " #I:#W#F " +set -g window-status-current-format "#[fg=colour233,bg=black]#[fg=colour129,nobold] #I:#W#F #[fg=colour233,bg=black,nobold]" + +# Current window status +set -g window-status-current-style bg=colour125,fg=colour235 + +# Window with activity status +set -g window-status-activity-style bg=colour233,fg=colour245 + +# Window separator +set -g window-status-separator "" + +# Window status alignment +set -g status-justify centre + +# Pane border +set -g pane-border-style bg=default,fg=colour238 + +# Active pane border +set -g pane-active-border-style bg=default,fg=colour125 + +# Pane number indicator +set -g display-panes-colour colour233 +set -g display-panes-active-colour colour245 + +# Clock mode +set -g clock-mode-colour colour125 +set -g clock-mode-style 24 + +# Message +set -g message-style bg=colour125,fg=black + +# Command message +set -g message-command-style bg=colour233,fg=black + +# Mode +set -g mode-style bg=colour125,fg=colour231 diff --git a/tmux/plugins/tmux-themepack/powerline/default/orange.tmuxtheme b/tmux/plugins/tmux-themepack/powerline/default/orange.tmuxtheme new file mode 100644 index 0000000..66acf13 --- /dev/null +++ b/tmux/plugins/tmux-themepack/powerline/default/orange.tmuxtheme @@ -0,0 +1,64 @@ +# +# Powerline Orange - Tmux Theme +# Created by Jim Myhrberg . +# +# Inspired by vim-powerline: https://github.com/Lokaltog/powerline +# +# Requires terminal to be using a powerline compatible font, find one here: +# https://github.com/Lokaltog/powerline-fonts +# + +# Status update interval +set -g status-interval 1 + +# Basic status bar colors +set -g status-style fg=colour240,bg=colour233 + +# Left side of status bar +set -g status-left-style bg=colour233,fg=colour243 +set -g status-left-length 40 +set -g status-left "#[fg=colour232,bg=colour130,bold] #S #[fg=colour130,bg=colour240,nobold]#[fg=colour233,bg=colour240] #(whoami) #[fg=colour240,bg=colour235]#[fg=colour240,bg=colour235] #I:#P #[fg=colour235,bg=colour233,nobold]" + +# Right side of status bar +set -g status-right-style bg=colour233,fg=colour243 +set -g status-right-length 150 +set -g status-right "#[fg=colour235,bg=colour233]#[fg=colour240,bg=colour235] %H:%M:%S #[fg=colour240,bg=colour235]#[fg=colour233,bg=colour240] %d-%b-%y #[fg=colour245,bg=colour240]#[fg=colour232,bg=colour245,bold] #H " + +# Window status +set -g window-status-format " #I:#W#F " +set -g window-status-current-format "#[fg=colour233,bg=black]#[fg=colour166,nobold] #I:#W#F #[fg=colour233,bg=black,nobold]" + +# Current window status +set -g window-status-current-style bg=colour130,fg=colour235 + +# Window with activity status +set -g window-status-activity-style bg=colour233,fg=colour245 + +# Window separator +set -g window-status-separator "" + +# Window status alignment +set -g status-justify centre + +# Pane border +set -g pane-border-style bg=default,fg=colour238 + +# Active pane border +set -g pane-active-border-style bg=default,fg=colour130 + +# Pane number indicator +set -g display-panes-colour colour233 +set -g display-panes-active-colour colour245 + +# Clock mode +set -g clock-mode-colour colour130 +set -g clock-mode-style 24 + +# Message +set -g message-style bg=colour130,fg=black + +# Command message +set -g message-command-style bg=colour233,fg=black + +# Mode +set -g mode-style bg=colour130,fg=colour232 diff --git a/tmux/plugins/tmux-themepack/powerline/default/red.tmuxtheme b/tmux/plugins/tmux-themepack/powerline/default/red.tmuxtheme new file mode 100644 index 0000000..06a8117 --- /dev/null +++ b/tmux/plugins/tmux-themepack/powerline/default/red.tmuxtheme @@ -0,0 +1,64 @@ +# +# Powerline Red - Tmux Theme +# Created by Jim Myhrberg . +# +# Inspired by vim-powerline: https://github.com/Lokaltog/powerline +# +# Requires terminal to be using a powerline compatible font, find one here: +# https://github.com/Lokaltog/powerline-fonts +# + +# Status update interval +set -g status-interval 1 + +# Basic status bar colors +set -g status-style fg=colour238,bg=colour233 + +# Left side of status bar +set -g status-left-style bg=colour233,fg=colour243 +set -g status-left-length 40 +set -g status-left "#[fg=colour16,bg=colour88,bold] #S #[fg=colour88,bg=colour240,nobold]#[fg=colour233,bg=colour240] #(whoami) #[fg=colour240,bg=colour235]#[fg=colour240,bg=colour235] #I:#P #[fg=colour235,bg=colour233,nobold]" + +# Right side of status bar +set -g status-right-style bg=colour233,fg=colour243 +set -g status-right-length 150 +set -g status-right "#[fg=colour235,bg=colour233]#[fg=colour240,bg=colour235] %H:%M:%S #[fg=colour240,bg=colour235]#[fg=colour233,bg=colour240] %d-%b-%y #[fg=colour245,bg=colour240]#[fg=colour232,bg=colour245,bold] #H " + +# Window status +set -g window-status-format " #I:#W#F " +set -g window-status-current-format "#[fg=colour233,bg=black]#[fg=colour160,bold] #I:#W#F #[fg=colour233,bg=black,nobold]" + +# Current window status +set -g window-status-current-style bg=colour88,fg=colour16 + +# Window with activity status +set -g window-status-activity-style bg=colour233,fg=colour245 + +# Window separator +set -g window-status-separator "" + +# Window status alignment +set -g status-justify centre + +# Pane border +set -g pane-border-style bg=default,fg=colour238 + +# Active pane border +set -g pane-active-border-style bg=default,fg=colour88 + +# Pane number indicator +set -g display-panes-colour colour233 +set -g display-panes-active-colour colour245 + +# Clock mode +set -g clock-mode-colour colour88 +set -g clock-mode-style 24 + +# Message +set -g message-style bg=colour88,fg=black + +# Command message +set -g message-command-style bg=colour88,fg=black + +# Mode +set -g mode-style bg=colour124,fg=colour231 diff --git a/tmux/plugins/tmux-themepack/powerline/default/yellow.tmuxtheme b/tmux/plugins/tmux-themepack/powerline/default/yellow.tmuxtheme new file mode 100644 index 0000000..5bf2d60 --- /dev/null +++ b/tmux/plugins/tmux-themepack/powerline/default/yellow.tmuxtheme @@ -0,0 +1,64 @@ +# +# Powerline Yellow - Tmux Theme +# Created by Jim Myhrberg . +# +# Inspired by vim-powerline: https://github.com/Lokaltog/powerline +# +# Requires terminal to be using a powerline compatible font, find one here: +# https://github.com/Lokaltog/powerline-fonts +# + +# Status update interval +set -g status-interval 1 + +# Basic status bar colors +set -g status-style fg=colour240,bg=colour233 + +# Left side of status bar +set -g status-left-style bg=colour233,fg=colour243 +set -g status-left-length 40 +set -g status-left "#[fg=colour232,bg=colour227,bold] #S #[fg=colour227,bg=colour240,nobold]#[fg=colour233,bg=colour240] #(whoami) #[fg=colour240,bg=colour235]#[fg=colour240,bg=colour235] #I:#P #[fg=colour235,bg=colour233,nobold]" + +# Right side of status bar +set -g status-right-style bg=colour233,fg=colour243 +set -g status-right-length 150 +set -g status-right "#[fg=colour235,bg=colour233]#[fg=colour240,bg=colour235] %H:%M:%S #[fg=colour240,bg=colour235]#[fg=colour233,bg=colour240] %d-%b-%y #[fg=colour245,bg=colour240]#[fg=colour232,bg=colour245,bold] #H " + +# Window status +set -g window-status-format " #I:#W#F " +set -g window-status-current-format "#[fg=colour233,bg=black]#[fg=colour227,nobold] #I:#W#F #[fg=colour233,bg=black,nobold]" + +# Current window status +set -g window-status-current-style bg=colour227,fg=colour235 + +# Window with activity status +set -g window-status-activity-style bg=colour233,fg=colour245 + +# Window separator +set -g window-status-separator "" + +# Window status alignment +set -g status-justify centre + +# Pane border +set -g pane-border-style bg=default,fg=colour238 + +# Active pane border +set -g pane-active-border-style bg=default,fg=colour227 + +# Pane number indicator +set -g display-panes-colour colour233 +set -g display-panes-active-colour colour245 + +# Clock mode +set -g clock-mode-colour colour227 +set -g clock-mode-style 24 + +# Message +set -g message-style bg=colour227,fg=black + +# Command message +set -g message-command-style bg=colour233,fg=black + +# Mode +set -g mode-style bg=colour227,fg=colour235 diff --git a/tmux/plugins/tmux-themepack/powerline/double/blue.tmuxtheme b/tmux/plugins/tmux-themepack/powerline/double/blue.tmuxtheme new file mode 100644 index 0000000..0c6dfc9 --- /dev/null +++ b/tmux/plugins/tmux-themepack/powerline/double/blue.tmuxtheme @@ -0,0 +1,64 @@ +# +# Powerline Double Blue - Tmux Theme +# Created by Jim Myhrberg . +# +# Inspired by vim-powerline: https://github.com/Lokaltog/powerline +# +# Requires terminal to be using a powerline compatible font, find one here: +# https://github.com/Lokaltog/powerline-fonts +# + +# Status update interval +set -g status-interval 1 + +# Basic status bar colors +set -g status-style fg=colour238,bg=colour233 + +# Left side of status bar +set -g status-left-style bg=colour233,fg=colour243 +set -g status-left-length 40 +set -g status-left "#[fg=colour232,bg=colour24,bold] #S #[fg=colour24,bg=colour240,nobold]#[fg=colour233,bg=colour240] #(whoami) #[fg=colour240,bg=colour235]#[fg=colour240,bg=colour235] #I:#P #[fg=colour235,bg=colour233,nobold]" + +# Right side of status bar +set -g status-right-style bg=colour233,fg=colour243 +set -g status-right-length 150 +set -g status-right "#[fg=colour235,bg=colour233]#[fg=colour240,bg=colour235] %H:%M:%S #[fg=colour240,bg=colour235]#[fg=colour233,bg=colour240] %d-%b-%y #[fg=colour24,bg=colour240]#[fg=colour232,bg=colour24,bold] #H " + +# Window status +set -g window-status-format " #I:#W#F " +set -g window-status-current-format "#[fg=colour233,bg=black]#[fg=colour33,nobold] #I:#W#F #[fg=colour233,bg=black,nobold]" + +# Current window status +set -g window-status-current-style bg=colour24,fg=colour233 + +# Window with activity status +set -g window-status-activity-style bg=colour233,fg=colour245 + +# Window separator +set -g window-status-separator "" + +# Window status alignment +set -g status-justify centre + +# Pane border +set -g pane-border-style bg=default,fg=colour238 + +# Active pane border +set -g pane-active-border-style bg=default,fg=colour24 + +# Pane number indicator +set -g display-panes-colour colour233 +set -g display-panes-active-colour colour245 + +# Clock mode +set -g clock-mode-colour colour24 +set -g clock-mode-style 24 + +# Message +set -g message-style bg=colour24,fg=black + +# Command message +set -g message-command-style bg=colour233,fg=black + +# Mode +set -g mode-style bg=colour24,fg=colour231 diff --git a/tmux/plugins/tmux-themepack/powerline/double/cyan.tmuxtheme b/tmux/plugins/tmux-themepack/powerline/double/cyan.tmuxtheme new file mode 100644 index 0000000..f78c2ce --- /dev/null +++ b/tmux/plugins/tmux-themepack/powerline/double/cyan.tmuxtheme @@ -0,0 +1,64 @@ +# +# Powerline Double Cyan - Tmux Theme +# Created by Jim Myhrberg . +# +# Inspired by vim-powerline: https://github.com/Lokaltog/powerline +# +# Requires terminal to be using a powerline compatible font, find one here: +# https://github.com/Lokaltog/powerline-fonts +# + +# Status update interval +set -g status-interval 1 + +# Basic status bar colors +set -g status-style fg=colour240,bg=colour233 + +# Left side of status bar +set -g status-left-style bg=colour233,fg=colour243 +set -g status-left-length 40 +set -g status-left "#[fg=colour233,bg=colour39,bold] #S #[fg=colour39,bg=colour240,nobold]#[fg=colour233,bg=colour240] #(whoami) #[fg=colour240,bg=colour235]#[fg=colour240,bg=colour235] #I:#P #[fg=colour235,bg=colour233,nobold]" + +# Right side of status bar +set -g status-right-style bg=colour233,fg=colour243 +set -g status-right-length 150 +set -g status-right "#[fg=colour235,bg=colour233]#[fg=colour240,bg=colour235] %H:%M:%S #[fg=colour240,bg=colour235]#[fg=colour233,bg=colour240] %d-%b-%y #[fg=colour39,bg=colour240]#[fg=colour233,bg=colour39,bold] #H " + +# Window status +set -g window-status-format " #I:#W#F " +set -g window-status-current-format "#[fg=colour233,bg=black]#[fg=colour81,nobold] #I:#W#F #[fg=colour233,bg=black,nobold]" + +# Current window status +set -g window-status-current-style bg=colour39,fg=colour235 + +# Window with activity status +set -g window-status-activity-style bg=colour233,fg=colour245 + +# Window separator +set -g window-status-separator "" + +# Window status alignment +set -g status-justify centre + +# Pane border +set -g pane-border-style bg=default,fg=colour238 + +# Active pane border +set -g pane-active-border-style bg=default,fg=colour39 + +# Pane number indicator +set -g display-panes-colour colour233 +set -g display-panes-active-colour colour245 + +# Clock mode +set -g clock-mode-colour colour39 +set -g clock-mode-style 24 + +# Message +set -g message-style bg=colour39,fg=black + +# Command message +set -g message-command-style bg=colour233,fg=black + +# Mode +set -g mode-style bg=colour39,fg=colour232 diff --git a/tmux/plugins/tmux-themepack/powerline/double/green.tmuxtheme b/tmux/plugins/tmux-themepack/powerline/double/green.tmuxtheme new file mode 100644 index 0000000..7cf0f39 --- /dev/null +++ b/tmux/plugins/tmux-themepack/powerline/double/green.tmuxtheme @@ -0,0 +1,64 @@ +# +# Powerline Double Green - Tmux Theme +# Created by Jim Myhrberg . +# +# Inspired by vim-powerline: https://github.com/Lokaltog/powerline +# +# Requires terminal to be using a powerline compatible font, find one here: +# https://github.com/Lokaltog/powerline-fonts +# + +# Status update interval +set -g status-interval 1 + +# Basic status bar colors +set -g status-style fg=colour240,bg=colour233 + +# Left side of status bar +set -g status-left-style bg=colour233,fg=colour243 +set -g status-left-length 40 +set -g status-left "#[fg=colour233,bg=colour100,bold] #S #[fg=colour100,bg=colour240,nobold]#[fg=colour233,bg=colour240] #(whoami) #[fg=colour240,bg=colour235]#[fg=colour240,bg=colour235] #I:#P #[fg=colour235,bg=colour233,nobold]" + +# Right side of status bar +set -g status-right-style bg=colour233,fg=colour243 +set -g status-right-length 150 +set -g status-right "#[fg=colour235,bg=colour233]#[fg=colour240,bg=colour235] %H:%M:%S #[fg=colour240,bg=colour235]#[fg=colour233,bg=colour240] %d-%b-%y #[fg=colour100,bg=colour240]#[fg=colour233,bg=colour100,bold] #H " + +# Window status +set -g window-status-format " #I:#W#F " +set -g window-status-current-format "#[fg=colour233,bg=black]#[fg=colour190,nobold] #I:#W#F #[fg=colour233,bg=black,nobold]" + +# Current window status +set -g window-status-current-style bg=colour100,fg=colour235 + +# Window with activity status +set -g window-status-activity-style bg=colour233,fg=colour245 + +# Window separator +set -g window-status-separator "" + +# Window status alignment +set -g status-justify centre + +# Pane border +set -g pane-border-style bg=default,fg=colour238 + +# Active pane border +set -g pane-active-border-style bg=default,fg=colour100 + +# Pane number indicator +set -g display-panes-colour colour233 +set -g display-panes-active-colour colour245 + +# Clock mode +set -g clock-mode-colour colour100 +set -g clock-mode-style 24 + +# Message +set -g message-style bg=colour100,fg=black + +# Command message +set -g message-command-style bg=colour233,fg=black + +# Mode +set -g mode-style bg=colour100,fg=colour235 diff --git a/tmux/plugins/tmux-themepack/powerline/double/magenta.tmuxtheme b/tmux/plugins/tmux-themepack/powerline/double/magenta.tmuxtheme new file mode 100644 index 0000000..bef3e7a --- /dev/null +++ b/tmux/plugins/tmux-themepack/powerline/double/magenta.tmuxtheme @@ -0,0 +1,64 @@ +# +# Powerline Double Magenta - Tmux Theme +# Created by Jim Myhrberg . +# +# Inspired by vim-powerline: https://github.com/Lokaltog/powerline +# +# Requires terminal to be using a powerline compatible font, find one here: +# https://github.com/Lokaltog/powerline-fonts +# + +# Status update interval +set -g status-interval 1 + +# Basic status bar colors +set -g status-style fg=colour240,bg=colour233 + +# Left side of status bar +set -g status-left-style bg=colour233,fg=colour243 +set -g status-left-length 40 +set -g status-left "#[fg=colour233,bg=colour125,bold] #S #[fg=colour125,bg=colour240,nobold]#[fg=colour233,bg=colour240] #(whoami) #[fg=colour240,bg=colour235]#[fg=colour240,bg=colour235] #I:#P #[fg=colour235,bg=colour233,nobold]" + +# Right side of status bar +set -g status-right-style bg=colour233,fg=colour243 +set -g status-right-length 150 +set -g status-right "#[fg=colour235,bg=colour233]#[fg=colour240,bg=colour235] %H:%M:%S #[fg=colour240,bg=colour235]#[fg=colour233,bg=colour240] %d-%b-%y #[fg=colour125,bg=colour240]#[fg=colour233,bg=colour125,bold] #H " + +# Window status +set -g window-status-format " #I:#W#F " +set -g window-status-current-format "#[fg=colour233,bg=black]#[fg=colour129,nobold] #I:#W#F #[fg=colour233,bg=black,nobold]" + +# Current window status +set -g window-status-current-style bg=colour125,fg=colour235 + +# Window with activity status +set -g window-status-activity-style bg=colour233,fg=colour245 + +# Window separator +set -g window-status-separator "" + +# Window status alignment +set -g status-justify centre + +# Pane border +set -g pane-border-style bg=default,fg=colour238 + +# Active pane border +set -g pane-active-border-style bg=default,fg=colour125 + +# Pane number indicator +set -g display-panes-colour colour233 +set -g display-panes-active-colour colour245 + +# Clock mode +set -g clock-mode-colour colour125 +set -g clock-mode-style 24 + +# Message +set -g message-style bg=colour125,fg=black + +# Command message +set -g message-command-style bg=colour233,fg=black + +# Mode +set -g mode-style bg=colour125,fg=colour231 diff --git a/tmux/plugins/tmux-themepack/powerline/double/orange.tmuxtheme b/tmux/plugins/tmux-themepack/powerline/double/orange.tmuxtheme new file mode 100644 index 0000000..f38eaf3 --- /dev/null +++ b/tmux/plugins/tmux-themepack/powerline/double/orange.tmuxtheme @@ -0,0 +1,64 @@ +# +# Powerline Double Orange - Tmux Theme +# Created by Jim Myhrberg . +# +# Inspired by vim-powerline: https://github.com/Lokaltog/powerline +# +# Requires terminal to be using a powerline compatible font, find one here: +# https://github.com/Lokaltog/powerline-fonts +# + +# Status update interval +set -g status-interval 1 + +# Basic status bar colors +set -g status-style fg=colour240,bg=colour233 + +# Left side of status bar +set -g status-left-style bg=colour233,fg=colour243 +set -g status-left-length 40 +set -g status-left "#[fg=colour233,bg=colour130,bold] #S #[fg=colour130,bg=colour240,nobold]#[fg=colour233,bg=colour240] #(whoami) #[fg=colour240,bg=colour235]#[fg=colour240,bg=colour235] #I:#P #[fg=colour235,bg=colour233,nobold]" + +# Right side of status bar +set -g status-right-style bg=colour233,fg=colour243 +set -g status-right-length 150 +set -g status-right "#[fg=colour235,bg=colour233]#[fg=colour240,bg=colour235] %H:%M:%S #[fg=colour240,bg=colour235]#[fg=colour233,bg=colour240] %d-%b-%y #[fg=colour130,bg=colour240]#[fg=colour233,bg=colour130,bold] #H " + +# Window status +set -g window-status-format " #I:#W#F " +set -g window-status-current-format "#[fg=colour233,bg=black]#[fg=colour166,nobold] #I:#W#F #[fg=colour233,bg=black,nobold]" + +# Current window status +set -g window-status-current-style bg=colour130,fg=colour235 + +# Window with activity status +set -g window-status-activity-style bg=colour233,fg=colour245 + +# Window separator +set -g window-status-separator "" + +# Window status alignment +set -g status-justify centre + +# Pane border +set -g pane-border-style bg=default,fg=colour238 + +# Active pane border +set -g pane-active-border-style bg=default,fg=colour130 + +# Pane number indicator +set -g display-panes-colour colour233 +set -g display-panes-active-colour colour245 + +# Clock mode +set -g clock-mode-colour colour130 +set -g clock-mode-style 24 + +# Message +set -g message-style bg=colour130,fg=black + +# Command message +set -g message-command-style bg=colour233,fg=black + +# Mode +set -g mode-style bg=colour130,fg=colour232 diff --git a/tmux/plugins/tmux-themepack/powerline/double/red.tmuxtheme b/tmux/plugins/tmux-themepack/powerline/double/red.tmuxtheme new file mode 100644 index 0000000..ea7d53c --- /dev/null +++ b/tmux/plugins/tmux-themepack/powerline/double/red.tmuxtheme @@ -0,0 +1,64 @@ +# +# Powerline Double Red - Tmux Theme +# Created by Jim Myhrberg . +# +# Inspired by vim-powerline: https://github.com/Lokaltog/powerline +# +# Requires terminal to be using a powerline compatible font, find one here: +# https://github.com/Lokaltog/powerline-fonts +# + +# Status update interval +set -g status-interval 1 + +# Basic status bar colors +set -g status-style fg=colour238,bg=colour233 + +# Left side of status bar +set -g status-left-style bg=colour233,fg=colour243 +set -g status-left-length 40 +set -g status-left "#[fg=colour232,bg=colour88,bold] #S #[fg=colour88,bg=colour240,nobold]#[fg=colour233,bg=colour240] #(whoami) #[fg=colour240,bg=colour235]#[fg=colour240,bg=colour235] #I:#P #[fg=colour235,bg=colour233,nobold]" + +# Right side of status bar +set -g status-right-style bg=colour233,fg=colour243 +set -g status-right-length 150 +set -g status-right "#[fg=colour235,bg=colour233]#[fg=colour240,bg=colour235] %H:%M:%S #[fg=colour240,bg=colour235]#[fg=colour233,bg=colour240] %d-%b-%y #[fg=colour88,bg=colour240]#[fg=colour232,bg=colour88,bold] #H " + +# Window status +set -g window-status-format " #I:#W#F " +set -g window-status-current-format "#[fg=colour233,bg=black]#[fg=colour160,bold] #I:#W#F #[fg=colour233,bg=black,nobold]" + +# Current window status +set -g window-status-current-style bg=colour88,fg=colour16 + +# Window with activity status +set -g window-status-activity-style bg=colour233,fg=colour245 + +# Window separator +set -g window-status-separator "" + +# Window status alignment +set -g status-justify centre + +# Pane border +set -g pane-border-style bg=default,fg=colour238 + +# Active pane border +set -g pane-active-border-style bg=default,fg=colour88 + +# Pane number indicator +set -g display-panes-colour colour233 +set -g display-panes-active-colour colour245 + +# Clock mode +set -g clock-mode-colour colour88 +set -g clock-mode-style 24 + +# Message +set -g message-style bg=colour88,fg=black + +# Command message +set -g message-command-style bg=colour88,fg=black + +# Mode +set -g mode-style bg=colour124,fg=colour231 diff --git a/tmux/plugins/tmux-themepack/powerline/double/yellow.tmuxtheme b/tmux/plugins/tmux-themepack/powerline/double/yellow.tmuxtheme new file mode 100644 index 0000000..451a940 --- /dev/null +++ b/tmux/plugins/tmux-themepack/powerline/double/yellow.tmuxtheme @@ -0,0 +1,64 @@ +# +# Powerline Double Yellow - Tmux Theme +# Created by Jim Myhrberg . +# +# Inspired by vim-powerline: https://github.com/Lokaltog/powerline +# +# Requires terminal to be using a powerline compatible font, find one here: +# https://github.com/Lokaltog/powerline-fonts +# + +# Status update interval +set -g status-interval 1 + +# Basic status bar colors +set -g status-style fg=colour240,bg=colour233 + +# Left side of status bar +set -g status-left-style bg=colour233,fg=colour243 +set -g status-left-length 40 +set -g status-left "#[fg=colour233,bg=colour227,bold] #S #[fg=colour227,bg=colour240,nobold]#[fg=colour233,bg=colour240] #(whoami) #[fg=colour240,bg=colour235]#[fg=colour240,bg=colour235] #I:#P #[fg=colour235,bg=colour233,nobold]" + +# Right side of status bar +set -g status-right-style bg=colour233,fg=colour243 +set -g status-right-length 150 +set -g status-right "#[fg=colour235,bg=colour233]#[fg=colour240,bg=colour235] %H:%M:%S #[fg=colour240,bg=colour235]#[fg=colour233,bg=colour240] %d-%b-%y #[fg=colour227,bg=colour240]#[fg=colour233,bg=colour227,bold] #H " + +# Window status +set -g window-status-format " #I:#W#F " +set -g window-status-current-format "#[fg=colour233,bg=black]#[fg=colour227,nobold] #I:#W#F #[fg=colour233,bg=black,nobold]" + +# Current window status +set -g window-status-current-style bg=colour227,fg=colour235 + +# Window with activity status +set -g window-status-activity-style bg=colour233,fg=colour245 + +# Window separator +set -g window-status-separator "" + +# Window status alignment +set -g status-justify centre + +# Pane border +set -g pane-border-style bg=default,fg=colour238 + +# Active pane border +set -g pane-active-border-style bg=default,fg=colour227 + +# Pane number indicator +set -g display-panes-colour colour233 +set -g display-panes-active-colour colour245 + +# Clock mode +set -g clock-mode-colour colour227 +set -g clock-mode-style 24 + +# Message +set -g message-style bg=colour227,fg=black + +# Command message +set -g message-command-style bg=colour233,fg=black + +# Mode +set -g mode-style bg=colour227,fg=colour235 diff --git a/tmux/plugins/tmux-themepack/themepack.tmux b/tmux/plugins/tmux-themepack/themepack.tmux new file mode 100755 index 0000000..dd2a455 --- /dev/null +++ b/tmux/plugins/tmux-themepack/themepack.tmux @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +theme_option="@themepack" +default_theme='basic' + +get_tmux_option() { + local option="$1" + local default_value="$2" + local option_value="$(tmux show-option -gqv "$option")" + + if [ -n "$option_value" ]; then + echo "$option_value" + else + echo "$default_value" + fi +} + +main() { + local theme="$(get_tmux_option "$theme_option" "$default_theme")" + if [ -f "$CURRENT_DIR/${theme}.tmuxtheme" ]; then + tmux source-file "$CURRENT_DIR/${theme}.tmuxtheme" + else + tmux source-file "$CURRENT_DIR/powerline/${theme}.tmuxtheme" + fi +} + +main diff --git a/tmux/plugins/tpm/.gitattributes b/tmux/plugins/tpm/.gitattributes new file mode 100644 index 0000000..80772e4 --- /dev/null +++ b/tmux/plugins/tpm/.gitattributes @@ -0,0 +1,9 @@ +# Force text files to have unix eols, so Windows/Cygwin does not break them +*.* eol=lf + +# These files are unfortunately not recognized as text files so +# explicitly listing them here +tpm eol=lf +bin/* eol=lf +bindings/* eol=lf +tests/* eol=lf diff --git a/tmux/plugins/tpm/.gitignore b/tmux/plugins/tpm/.gitignore new file mode 100644 index 0000000..8a94156 --- /dev/null +++ b/tmux/plugins/tpm/.gitignore @@ -0,0 +1,4 @@ +**/.vagrant/ +run_tests +tests/run_tests_in_isolation +tests/helpers/helpers.sh diff --git a/tmux/plugins/tpm/.gitmodules b/tmux/plugins/tpm/.gitmodules new file mode 100644 index 0000000..5e44e3c --- /dev/null +++ b/tmux/plugins/tpm/.gitmodules @@ -0,0 +1,3 @@ +[submodule "lib/tmux-test"] + path = lib/tmux-test + url = https://github.com/tmux-plugins/tmux-test.git diff --git a/tmux/plugins/tpm/.travis.yml b/tmux/plugins/tpm/.travis.yml new file mode 100644 index 0000000..ac45d8b --- /dev/null +++ b/tmux/plugins/tpm/.travis.yml @@ -0,0 +1,19 @@ +# generic packages and tmux +before_install: + - sudo apt-get update + - sudo apt-get install -y git-core expect + - sudo apt-get install -y python-software-properties software-properties-common + - sudo apt-get install -y libevent-dev libncurses-dev + - git clone https://github.com/tmux/tmux.git + - cd tmux + - git checkout 2.0 + - sh autogen.sh + - ./configure && make && sudo make install + +install: + - git fetch --unshallow --recurse-submodules || git fetch --recurse-submodules + # manual `git clone` required for testing `tmux-test` plugin itself + - git clone https://github.com/tmux-plugins/tmux-test lib/tmux-test; true + - lib/tmux-test/setup + +script: ./tests/run_tests_in_isolation diff --git a/tmux/plugins/tpm/CHANGELOG.md b/tmux/plugins/tpm/CHANGELOG.md new file mode 100644 index 0000000..394758d --- /dev/null +++ b/tmux/plugins/tpm/CHANGELOG.md @@ -0,0 +1,83 @@ +# Changelog + +### master +- upgrade to new version of `tmux-test` +- bug: when using `emacs` copy mode, Enter does not quit screen after tpm + installation/update. Fix by making `Escape` the key for emacs mode. +- add a doc with troubleshooting instructions +- add `.gitattributes` file that forces linefeed characters (classic `\n`) as + line endings - helps with misconfigured git on windows/cygwin +- readme update: announce Cygwin support +- un-deprecate old plugin definition syntax: `set -g @tpm_plugins` + +### v3.0.0, 2015-08-03 +- refactor `shared_set_tpm_path_constant` function +- move all instructions to `docs/` dir +- add `bin/install_plugins` cli executable script +- improved test runner function +- switch to using [tmux-test](https://github.com/tmux-plugins/tmux-test) + framework +- add `bin/update_plugins` cli executable script +- refactor test `expect` scripts, make them simpler and ensure they properly + assert expectations +- refactor code that sets 'TMUX_PLUGIN_MANAGER_PATH' global env var +- stop using global variable for 'tpm path' +- support defining plugins via `set -g @plugin` in sourced files as well + +### v2.0.0, 2015-07-07 +- enable overriding default key bindings +- start using `C-c` to clear screen +- add uninstall/clean procedure and keybinding (prefix+alt+u) (@chilicuil) +- add new `set @plugin 'repo'` plugin definition syntax (@chilicuil) +- revert back to using `-g` flag in new plugin definition syntax +- permit leading whitespace with new plugin definition syntax (thanks @chilicuil) +- make sure `TMUX_PLUGIN_MANAGER_PATH` always has trailng slash +- ensure old/deprecated plugin syntax `set -g @tpm_plugins` works alongside new + `set -g @plugin` syntax + +### v1.2.2, 2015-02-08 +- set GIT_TERMINAL_PROMPT=0 when doing `git clone`, `pull` or `submodule update` + to ensure git does not prompt for username/password in any case + +### v1.2.1, 2014-11-21 +- change the way plugin name is expanded. It now uses the http username + and password by default, like this: `https://git::@github.com/`. This prevents + username and password prompt (and subsequently tmux install hanging) with old + git versions. Fixes #7. + +### v1.2.0, 2014-11-20 +- refactor tests so they can be used on travis +- add travis.yml, add travis badge to the readme + +### v1.1.0, 2014-11-19 +- if the plugin is not downloaded do not source it +- remove `PLUGINS.md`, an obsolete list of plugins +- update readme with instructions about uninstalling plugins +- tilde char and `$HOME` in `TMUX_SHARED_MANAGER_PATH` couldn't be used because + they are just plain strings. Fixing the problem by manually expanding them. +- bugfix: fragile `*.tmux` file globbing (@majutsushi) + +### v1.0.0, 2014-08-05 +- update readme because of github organization change to + [tmux-plugins](https://github.com/tmux-plugins) +- update tests to pass +- update README to suggest different first plugin +- update list of plugins in the README +- remove README 'about' section +- move key binding to the main file. Delete `key_binding.sh`. +- rename `display_message` -> `echo_message` +- installing plugins installs just new plugins. Already installed plugins aren't + updated. +- add 'update plugin' binding and functionality +- add test for updating a plugin + +### v0.0.2, 2014-07-17 +- run all *.tmux plugin files as executables +- fix all redirects to /dev/null +- fix bug: TPM shared path is created before sync (cloning plugins from github + is done) +- add test suite running in Vagrant +- add Tmux version check. `TPM` won't run if Tmux version is less than 1.9. + +### v0.0.1, 2014-05-21 +- get TPM up and running diff --git a/tmux/plugins/tpm/HOW_TO_PLUGIN.md b/tmux/plugins/tpm/HOW_TO_PLUGIN.md new file mode 100644 index 0000000..9901619 --- /dev/null +++ b/tmux/plugins/tpm/HOW_TO_PLUGIN.md @@ -0,0 +1,2 @@ +Instructions moved to +[docs/how_to_create_plugin.md](docs/how_to_create_plugin.md). diff --git a/tmux/plugins/tpm/LICENSE.md b/tmux/plugins/tpm/LICENSE.md new file mode 100644 index 0000000..1222865 --- /dev/null +++ b/tmux/plugins/tpm/LICENSE.md @@ -0,0 +1,20 @@ +MIT license +Copyright (C) 2014 Bruno Sutic + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE +OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tmux/plugins/tpm/README.md b/tmux/plugins/tpm/README.md new file mode 100644 index 0000000..9fb8232 --- /dev/null +++ b/tmux/plugins/tpm/README.md @@ -0,0 +1,113 @@ +# Tmux Plugin Manager + +[![Build Status](https://travis-ci.org/tmux-plugins/tpm.svg?branch=master)](https://travis-ci.org/tmux-plugins/tpm) + +Installs and loads `tmux` plugins. + +Tested and working on Linux, OSX, and Cygwin. + +### Installation + +Requirements: `tmux` version 1.9 (or higher), `git`, `bash`. + +Clone TPM: + +```bash +$ git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm +``` + +Put this at the bottom of `~/.tmux.conf` (`$XDG_CONFIG_HOME/tmux/tmux.conf` +works too): + +```bash +# List of plugins +set -g @plugin 'tmux-plugins/tpm' +set -g @plugin 'tmux-plugins/tmux-sensible' + +# Other examples: +# set -g @plugin 'github_username/plugin_name' +# set -g @plugin 'git@github.com/user/plugin' +# set -g @plugin 'git@bitbucket.com/user/plugin' + +# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf) +run -b '~/.tmux/plugins/tpm/tpm' +``` + +Reload TMUX environment so TPM is sourced: + +```bash +# type this in terminal if tmux is already running +$ tmux source ~/.tmux.conf +``` + +That's it! + +### Installing plugins + +1. Add new plugin to `~/.tmux.conf` with `set -g @plugin '...'` +2. Press `prefix` + I (capital i, as in **I**nstall) to fetch the plugin. + +You're good to go! The plugin was cloned to `~/.tmux/plugins/` dir and sourced. + +### Uninstalling plugins + +1. Remove (or comment out) plugin from the list. +2. Press `prefix` + alt + u (lowercase u as in **u**ninstall) to remove the plugin. + +All the plugins are installed to `~/.tmux/plugins/` so alternatively you can +find plugin directory there and remove it. + +### Key bindings + +`prefix` + I +- Installs new plugins from GitHub or any other git repository +- Refreshes TMUX environment + +`prefix` + U +- updates plugin(s) + +`prefix` + alt + u +- remove/uninstall plugins not on the plugin list + +### More plugins + +For more plugins, check [here](https://github.com/tmux-plugins). + +### Docs + +- [Help, tpm not working](docs/tpm_not_working.md) - problem solutions + +More advanced features and instructions, regular users probably do not need +this: + +- [How to create a plugin](docs/how_to_create_plugin.md). It's easy. +- [Managing plugins via the command line](docs/managing_plugins_via_cmd_line.md) +- [Changing plugins install dir](docs/changing_plugins_install_dir.md) +- [Automatic TPM installation on a new machine](docs/automatic_tpm_installation.md) + +### Tests + +Tests for this project run on [Travis CI](https://travis-ci.org/tmux-plugins/tpm). + +When run locally, [vagrant](https://www.vagrantup.com/) is required. +Run tests with: + +```bash +# within project directory +$ ./run_tests +``` + +### Other goodies + +- [tmux-copycat](https://github.com/tmux-plugins/tmux-copycat) - a plugin for + regex searches in tmux and fast match selection +- [tmux-yank](https://github.com/tmux-plugins/tmux-yank) - enables copying + highlighted text to system clipboard +- [tmux-open](https://github.com/tmux-plugins/tmux-open) - a plugin for quickly + opening highlighted file or a url +- [tmux-continuum](https://github.com/tmux-plugins/tmux-continuum) - automatic + restoring and continuous saving of tmux env + +### License + +[MIT](LICENSE.md) diff --git a/tmux/plugins/tpm/bin/clean_plugins b/tmux/plugins/tpm/bin/clean_plugins new file mode 100755 index 0000000..12f8730 --- /dev/null +++ b/tmux/plugins/tpm/bin/clean_plugins @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +# Script intended for use via the command line. +# +# `.tmux.conf` needs to be set for TPM. Tmux has to be installed on the system, +# but does not need to be started in order to run this script. + +CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +SCRIPTS_DIR="$CURRENT_DIR/../scripts" + +main() { + "$SCRIPTS_DIR/clean_plugins.sh" # has correct exit code +} +main diff --git a/tmux/plugins/tpm/bin/install_plugins b/tmux/plugins/tpm/bin/install_plugins new file mode 100755 index 0000000..c66b15b --- /dev/null +++ b/tmux/plugins/tpm/bin/install_plugins @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +# Script intended for use via the command line. +# +# `.tmux.conf` needs to be set for TPM. Tmux has to be installed on the system, +# but does not need to be started in order to run this script. + +CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +SCRIPTS_DIR="$CURRENT_DIR/../scripts" + +main() { + "$SCRIPTS_DIR/install_plugins.sh" # has correct exit code +} +main diff --git a/tmux/plugins/tpm/bin/update_plugins b/tmux/plugins/tpm/bin/update_plugins new file mode 100755 index 0000000..30a5646 --- /dev/null +++ b/tmux/plugins/tpm/bin/update_plugins @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +# Script intended for use via the command line. +# +# `.tmux.conf` needs to be set for TPM. Tmux has to be installed on the system, +# but does not need to be started in order to run this script. + +CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +SCRIPTS_DIR="$CURRENT_DIR/../scripts" +PROGRAM_NAME="$0" + +if [ $# -eq 0 ]; then + echo "usage:" + echo " $PROGRAM_NAME all update all plugins" + echo " $PROGRAM_NAME tmux-foo update plugin 'tmux-foo'" + echo " $PROGRAM_NAME tmux-bar tmux-baz update multiple plugins" + exit 1 +fi + +main() { + "$SCRIPTS_DIR/update_plugin.sh" --shell-echo "$*" # has correct exit code +} +main "$*" + diff --git a/tmux/plugins/tpm/bindings/clean_plugins b/tmux/plugins/tpm/bindings/clean_plugins new file mode 100755 index 0000000..9a0d5d7 --- /dev/null +++ b/tmux/plugins/tpm/bindings/clean_plugins @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +# Tmux key-binding script. +# Scripts intended to be used via the command line are in `bin/` directory. + +CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +SCRIPTS_DIR="$CURRENT_DIR/../scripts" +HELPERS_DIR="$SCRIPTS_DIR/helpers" + +source "$HELPERS_DIR/tmux_echo_functions.sh" +source "$HELPERS_DIR/tmux_utils.sh" + +main() { + reload_tmux_environment + "$SCRIPTS_DIR/clean_plugins.sh" --tmux-echo >/dev/null 2>&1 + reload_tmux_environment + end_message +} +main diff --git a/tmux/plugins/tpm/bindings/install_plugins b/tmux/plugins/tpm/bindings/install_plugins new file mode 100755 index 0000000..3ade3c4 --- /dev/null +++ b/tmux/plugins/tpm/bindings/install_plugins @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +# Tmux key-binding script. +# Scripts intended to be used via the command line are in `bin/` directory. + +CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +SCRIPTS_DIR="$CURRENT_DIR/../scripts" +HELPERS_DIR="$SCRIPTS_DIR/helpers" + +source "$HELPERS_DIR/tmux_echo_functions.sh" +source "$HELPERS_DIR/tmux_utils.sh" + +main() { + reload_tmux_environment + "$SCRIPTS_DIR/install_plugins.sh" --tmux-echo >/dev/null 2>&1 + reload_tmux_environment + end_message +} +main diff --git a/tmux/plugins/tpm/bindings/update_plugins b/tmux/plugins/tpm/bindings/update_plugins new file mode 100755 index 0000000..28cc281 --- /dev/null +++ b/tmux/plugins/tpm/bindings/update_plugins @@ -0,0 +1,49 @@ +#!/usr/bin/env bash + +# Tmux key-binding script. +# Scripts intended to be used via the command line are in `bin/` directory. + +# This script: +# - shows a list of installed plugins +# - starts a prompt to enter the name of the plugin that will be updated + +CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +SCRIPTS_DIR="$CURRENT_DIR/../scripts" +HELPERS_DIR="$SCRIPTS_DIR/helpers" + +source "$HELPERS_DIR/plugin_functions.sh" +source "$HELPERS_DIR/tmux_echo_functions.sh" +source "$HELPERS_DIR/tmux_utils.sh" + +display_plugin_update_list() { + local plugins="$(tpm_plugins_list_helper)" + tmux_echo "Installed plugins:" + tmux_echo "" + + for plugin in $plugins; do + # displaying only installed plugins + if plugin_already_installed "$plugin"; then + local plugin_name="$(plugin_name_helper "$plugin")" + tmux_echo " $plugin_name" + fi + done + + tmux_echo "" + tmux_echo "Type plugin name to update it." + tmux_echo "" + tmux_echo "- \"all\" - updates all plugins" + tmux_echo "- ENTER - cancels" +} + +update_plugin_prompt() { + tmux command-prompt -p 'plugin update:' " \ + send-keys C-c; \ + run-shell '$SCRIPTS_DIR/update_plugin_prompt_handler.sh %1'" +} + +main() { + reload_tmux_environment + display_plugin_update_list + update_plugin_prompt +} +main diff --git a/tmux/plugins/tpm/docs/automatic_tpm_installation.md b/tmux/plugins/tpm/docs/automatic_tpm_installation.md new file mode 100644 index 0000000..630573f --- /dev/null +++ b/tmux/plugins/tpm/docs/automatic_tpm_installation.md @@ -0,0 +1,12 @@ +# Automatic tpm installation + +One of the first things we do on a new machine is cloning our dotfiles. Not everything comes with them though, so for example `tpm` most likely won't be installed. + +If you want to install `tpm` and plugins automatically when tmux is started, put the following snippet in `.tmux.conf` before the final `run '~/.tmux/plugins/tpm/tpm'`: + +``` +if "test ! -d ~/.tmux/plugins/tpm" \ + "run 'git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm && ~/.tmux/plugins/tpm/bin/install_plugins'" +``` + +This useful tip was submitted by @acr4 and narfman0. diff --git a/tmux/plugins/tpm/docs/changing_plugins_install_dir.md b/tmux/plugins/tpm/docs/changing_plugins_install_dir.md new file mode 100644 index 0000000..93af675 --- /dev/null +++ b/tmux/plugins/tpm/docs/changing_plugins_install_dir.md @@ -0,0 +1,14 @@ +# Changing plugins install dir + +By default, TPM installs plugins to `~/.tmux/plugins/`. + +You can change the install path by putting this in `.tmux.conf`: + + set-environment -g TMUX_PLUGIN_MANAGER_PATH '/some/other/path/' + +Tmux plugin manager initialization in `.tmux.conf` should also be updated: + + # initializes TMUX plugin manager in a new path + run /some/other/path/tpm/tpm + +Please make sure that the `run` line is at the very bottom of `.tmux.conf`. diff --git a/tmux/plugins/tpm/docs/how_to_create_plugin.md b/tmux/plugins/tpm/docs/how_to_create_plugin.md new file mode 100644 index 0000000..b1a68f9 --- /dev/null +++ b/tmux/plugins/tpm/docs/how_to_create_plugin.md @@ -0,0 +1,108 @@ +# How to create Tmux plugins + +Creating a new plugin is easy. + +For demonstration purposes we'll create a simple plugin that lists all +installed TPM plugins. Yes, a plugin that lists plugins :) We'll bind that to +`prefix + T`. + +The source code for this example plugin can be found +[here](https://github.com/tmux-plugins/tmux-example-plugin). + +### 1. create a new git project + +TPM depends on git for downloading and updating plugins. + +To create a new git project: + + $ mkdir tmux_my_plugin + $ cd tmux_my_plugin + $ git init + +### 2. create a `*.tmux` plugin run file + +When it sources a plugin, TPM executes all `*.tmux` files in your plugins' +directory. That's how plugins are run. + +Create a plugin run file in plugin directory: + + $ touch my_plugin.tmux + $ chmod u+x my_plugin.tmux + +You can have more than one `*.tmux` file, and all will get executed. However, usually +you'll need just one. + +### 3. create a plugin key binding + +We want the behavior of the plugin to trigger when a user hits `prefix + T`. + +Key `T` is chosen because: + - it's "kind of" a mnemonic for `TPM` + - the key is not used by Tmux natively. Tmux man page, KEY BINDINGS section + contains a list of all the bindings Tmux uses. There's plenty of unused keys + and we don't want to override any of Tmux default key bindings. + +Open the plugin run file in your favorite text editor: + + $ vim my_plugin.tmux + # or + $ subl my_plugin.tmux + +Put the following content in the file: + + #!/usr/bin/env bash + + CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + tmux bind-key T run-shell "$CURRENT_DIR/scripts/tmux_list_plugins.sh" + +As you can see, plugin run file is a simple bash script that sets up the binding. + +When pressed, `prefix + T` will execute another shell script: +`tmux_list_plugins.sh`. That script should be in `scripts/` directory - +relative to the plugin run file. + + +### 4. listing plugins + +Now that we have the binding, let's create a script that's invoked with +`prefix + T`. + + $ mkdir scripts + $ touch scripts/tmux_list_plugins.sh + $ chmod u+x scripts/tmux_list_plugins.sh + +And here's the script content: + + #!/usr/bin/env bash + + # fetching the directory where plugins are installed + plugin_path="$(tmux show-env -g TMUX_PLUGIN_MANAGER_PATH | cut -f2 -d=)" + + # listing installed plugins + ls -1 "$plugin_path" + +### 5. try it out + +To see if this works, execute the plugin run file: + + $ ./my_plugin.tmux + +That should set up the key binding. Now hit `prefix + T` and see if it works. + +### 6. publish the plugin + +When everything is ready, push the plugin to an online git repository, +preferably Github. + +Other users can install your plugin by just adding plugin git URL to the +`@plugin` list in their `.tmux.conf`. + +If the plugin is on Github, your users will be able to use the shorthand of +`github_username/repository`. + +### Conclusion + +Hopefully, that was easy. As you can see, it's mostly shell scripting. + +You can use other scripting languages (ruby, python etc) but plain old shell +is preferred because of portability. diff --git a/tmux/plugins/tpm/docs/managing_plugins_via_cmd_line.md b/tmux/plugins/tpm/docs/managing_plugins_via_cmd_line.md new file mode 100644 index 0000000..7aefd7d --- /dev/null +++ b/tmux/plugins/tpm/docs/managing_plugins_via_cmd_line.md @@ -0,0 +1,36 @@ +# Managing plugins via the command line + +Aside from tmux key bindings, TPM provides shell interface for managing plugins +via scripts located in [bin/](../bin/) directory. + +Tmux does not need to be started in order to run scripts (but it's okay if it +is). If you [changed tpm install dir](../docs/changing_plugins_install_dir.md) +in `.tmux.conf` that should work fine too. + +Prerequisites: + +- tmux installed on the system (doh) +- `.tmux.conf` set up for TPM + +### Installing plugins + +As usual, plugins need to be specified in `.tmux.conf`. Run the following +command to install plugins: + + ~/.tmux/plugins/tpm/bin/install_plugins + +### Updating plugins + +To update all installed plugins: + + ~/.tmux/plugins/tpm/bin/update_plugins all + +or update a single plugin: + + ~/.tmux/plugins/tpm/bin/update_plugins tmux-sensible + +### Removing plugins + +To remove plugins not on the plugin list: + + ~/.tmux/plugins/tpm/bin/clean_plugins diff --git a/tmux/plugins/tpm/docs/tpm_not_working.md b/tmux/plugins/tpm/docs/tpm_not_working.md new file mode 100644 index 0000000..bfa14ac --- /dev/null +++ b/tmux/plugins/tpm/docs/tpm_not_working.md @@ -0,0 +1,96 @@ +# Help, tpm not working! + +Here's the list of issues users had with `tpm`: + +
+ +> Nothing works. `tpm` key bindings `prefix + I`, `prefix + U` not even + defined. + +Related [issue #22](https://github.com/tmux-plugins/tpm/issues/22) + +- Do you have required `tmux` version to run `tpm`?
+ Check `tmux` version with `$ tmux -V` command and make sure it's higher or + equal to the required version for `tpm` as stated in the readme. + +- ZSH tmux plugin might be causing issues.
+ If you have it installed, try disabling it and see if `tpm` works then. + +
+ +> Help, I'm using custom config file with `tmux -f /path/to/my_tmux.conf` +to start Tmux and for some reason plugins aren't loaded!? + +Related [issue #57](https://github.com/tmux-plugins/tpm/issues/57) + +`tpm` has a known issue when using custom config file with `-f` option. +The solution is to use alternative plugin definition syntax. Here are the steps +to make it work: + +1. remove all `set -g @plugin` lines from tmux config file +2. in the config file define the plugins in the following way: + + # List of plugins + set -g @tpm_plugins ' \ + tmux-plugins/tpm \ + tmux-plugins/tmux-sensible \ + tmux-plugins/tmux-resurrect \ + ' + + # Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf) + run '~/.tmux/plugins/tpm/tpm' + +3. Reload TMUX environment so TPM is sourced: `$ tmux source /path/to/my_tmux.conf` + +The plugins should now be working. + +
+ +> Weird sequence of characters show up when installing or updating plugins + +Related: [issue #25](https://github.com/tmux-plugins/tpm/issues/25) + +- This could be caused by [tmuxline.vim](https://github.com/edkolev/tmuxline.vim) + plugin. Uninstall it and see if things work. + +
+ +> "failed to connect to server" error when sourcing .tmux.conf + +Related: [issue #48](https://github.com/tmux-plugins/tpm/issues/48) + +- Make sure `tmux source ~/.tmux.conf` command is ran from inside `tmux`. + +
+ +> tpm not working: '~/.tmux/plugins/tpm/tpm' returned 2 (Windows / Cygwin) + +Related: [issue #81](https://github.com/tmux-plugins/tpm/issues/81) + +This issue is most likely caused by Windows line endings. For example, if you +have git's `core.autocrlf` option set to `true`, git will automatically convert +all the files to Windows line endings which might cause a problem. + +The solution is to convert all line ending to Unix newline characters. This +command handles that for all files under `.tmux/` dir (skips `.git` +subdirectories): + +```bash +find ~/.tmux -type d -name '.git*' -prune -o -type f -print0 | xargs -0 dos2unix +``` + +
+ +> '~/.tmux/plugins/tpm/tpm' returned 127 (on macOS, w/ tmux installed using brew) + +Related: [issue #67](https://github.com/tmux-plugins/tpm/issues/67) + +This problem is because tmux's `run-shell` command runs a shell which doesn't read from user configs, thus tmux installed in `/usr/local/bin` will not be found. + +The solution is to insert the following line: + +``` +set-environment -g PATH "/usr/local/bin:/bin:/usr/bin" +``` + +before any `run-shell`/`run` commands in `~/.tmux.conf`. diff --git a/tmux/plugins/tpm/lib/tmux-test/.gitignore b/tmux/plugins/tpm/lib/tmux-test/.gitignore new file mode 100644 index 0000000..27281b5 --- /dev/null +++ b/tmux/plugins/tpm/lib/tmux-test/.gitignore @@ -0,0 +1,2 @@ +.vagrant/ +lib/ diff --git a/tmux/plugins/tpm/lib/tmux-test/.travis.yml b/tmux/plugins/tpm/lib/tmux-test/.travis.yml new file mode 100644 index 0000000..fea6850 --- /dev/null +++ b/tmux/plugins/tpm/lib/tmux-test/.travis.yml @@ -0,0 +1,19 @@ +# generic packages and tmux +before_install: + - sudo apt-get update + - sudo apt-get install -y git-core expect + - sudo apt-get install -y python-software-properties software-properties-common + - sudo apt-get install -y libevent-dev libncurses-dev + - git clone https://github.com/tmux/tmux.git + - cd tmux + - git checkout 2.5 + - sh autogen.sh + - ./configure && make && sudo make install + +install: + - git fetch --unshallow --recurse-submodules || git fetch --recurse-submodules + # manual `git clone` required for testing `tmux-test` plugin itself + - git clone https://github.com/tmux-plugins/tmux-test lib/tmux-test; true + - lib/tmux-test/setup + +script: ./tests/run_tests_in_isolation diff --git a/tmux/plugins/tpm/lib/tmux-test/CHANGELOG.md b/tmux/plugins/tpm/lib/tmux-test/CHANGELOG.md new file mode 100644 index 0000000..094834f --- /dev/null +++ b/tmux/plugins/tpm/lib/tmux-test/CHANGELOG.md @@ -0,0 +1,46 @@ +# Changelog + +### master +- move `setup` task to `.travis.yml` for travis tests +- "merge" travis.yml and travis_for_plugins.yml files (no need to keep em + separate) +- add more useful helper functions +- remove tmux-test repo as a submodule from self, this causes issues with + `$ git submodule update --recursive --init` command that some users use for + managing other plugins +- add new helper `teardown_helper` +- add `run_tests` helper +- change CLI syntax for choosing vagrant machine to run the tests on +- enable running just a single test via `run_tests` cli interface +- add `--keep-running` cli option to continue running vagrant after the tests + are done executing +- start using tmux 2.0 for tests +- use tmux 2.5 for tests + +### v0.2.0, 2015-02-22 +- `setup` script gitignores `tests/helpers.sh` +- move `tests/helpers.sh` to `tests/helpers/helpers.sh` +- `setup` undo removes added lines from gitignore file + +### v0.1.0, 2015-02-22 +- changes so that 'tmux-test' can be included with tmux plugins +- do not gitignore submodules directory +- add installation and usage instructions +- copy `.travis.yml` to the project root when running `setup` script +- add a brief mention of travis CI to the readme +- add test helpers +- `setup` script symlinks helpers file to `tests/` directory +- `setup` script can undo most of its actions +- add a tmux scripting test +- `tmux-test` uses `tmux-test` to test itself +- update `tmux-test` submodule +- a different `travis.yml` for `tmux-test` and for plugins + +### v0.0.1, 2015-02-21 +- git init +- add vagrant provisioning scripts for ubuntu and debian +- add a ".travis.yml" file +- generic "run_tests" script +- "run_tests_in_isolation" script +- add "Vagrantfile" +- enable passing VM names as arguments to "run_tests" script diff --git a/tmux/plugins/tpm/lib/tmux-test/LICENSE.md b/tmux/plugins/tpm/lib/tmux-test/LICENSE.md new file mode 100644 index 0000000..e6e7350 --- /dev/null +++ b/tmux/plugins/tpm/lib/tmux-test/LICENSE.md @@ -0,0 +1,19 @@ +Copyright (C) Bruno Sutic + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE +OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tmux/plugins/tpm/lib/tmux-test/README.md b/tmux/plugins/tpm/lib/tmux-test/README.md new file mode 100644 index 0000000..44443ee --- /dev/null +++ b/tmux/plugins/tpm/lib/tmux-test/README.md @@ -0,0 +1,131 @@ +# tmux-test + +[![Build Status](https://travis-ci.org/tmux-plugins/tmux-test.png?branch=master)](https://travis-ci.org/tmux-plugins/tmux-test) + +A small framework for isolated testing of tmux plugins. Isolation is achieved by +running the tests in `Vagrant`. Works on [travis](travis-ci.org) too. + +Extracted from [tmux plugin manager](https://github.com/tmux-plugins/tpm) and +[tmux-copycat](https://github.com/tmux-plugins/tmux-copycat). + +Dependencies: `Vagrant` (not required when running on travis). + +### Setup + +Let's say you made tmux plugin with the following file hierarchy: + +```text +/tmux-plugin +|-- plugin.tmux +`-- scripts + `-- plugin_script.sh +``` + +From your project root directory (tmux-plugin/) execute the following shell +command to fetch `tmux-test` and add it as a submodule: + + $ git submodule add https://github.com/tmux-plugins/tmux-test.git lib/tmux-test + +Run the `setup` script: + + $ lib/tmux-test/setup + +The project directory will now look like this (additions have comments): + +```text +/tmux-plugin +|-- plugin.tmux +|-- run_tests # symlink, gitignored +|-- .gitignore # 2 lines appended to gitignore +|-- .travis.yml # added +|-- lib/tmux-test/ # git submodule +|-- scripts +| `-- plugin_script.sh +`-- tests # dir to put the tests in + `-- run_tests_in_isolation.sh # symlink, gitignored + `-- helpers + `-- helpers.sh # symlinked bash helpers, gitignored +``` + +`tmux-test` is now set up. You are ok to commit the additions to the repo. + +### Writing and running tests + +A test is any executable with a name starting with `test_` in `tests/` +directory. + +Now that you installed `tmux-test` let's create an example test. + +- create a `tests/test_example.sh` file with the following content (it's a + `bash` script but it can be any executable): + + #/usr/bin/env bash + + CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + + # bash helpers provided by 'tmux-test' + source $CURRENT_DIR/helpers/helpers.sh + + # installs plugin from current repo in Vagrant (or on Travis) + install_tmux_plugin_under_test_helper + + # start tmux in background (plugin under test is sourced) + tmux new -d + + # get first session name + session_name="$(tmux list-sessions -F "#{session_name}")" + + # fail the test if first session name is not "0" + if [ "$session_name" == "0" ]; then + # fail_helper is also provided by 'tmux-test' + fail_helper "First session name is not '0' by default" + fi + + # sets the right script exit code ('tmux-test' helper) + exit_helper + +- make the test file executable with `$ chmod +x tests/test_example.sh` +- run the test by executing `./run_tests` from the project root directory +- the first invocation might take some time because Vagrant's ubuntu virtual + machine is downloading. You should see `Success, tests pass!` message when it's + done. + +Check out more example test scripts in this project's [tests/ directory](tests/). + +### Continuous integration + +The setup script (`lib/tmux-test/setup`) added a `.travis.yml` file to the +project root. To setup continuous integration, just add/enable the project on +[travis](travis-ci.org). + +### Notes + +- The `tests/` directory for tests and `lib/tmux-test/` for cloning `tmux-test` + into cannot be changed currently +- Don't run `tests/run_tests_in_isolation` script on your local development + environment. That's an internal test runner meant to be executed in an + isolated environment like `vagrant` or `travis`.
+ Use `./run_tests` script. +- You can use `KEEP_RUNNING=true ./run_tests` for faster test running cycle. + If this case `Vagrant` will keep running even after the tests are done. +- You can use `VAGRANT_CWD=lib/tmux-test/ vagrant ssh ubuntu` for ssh login to + `Vagrant`. + +### Running `tmux-test` framework tests + +`tmux-test` uses itself to test itself. To run framework tests: + +- clone this project `$ git clone git@github.com:tmux-plugins/tmux-test.git` +- `$ cd tmux-test` +- run `$ ./run_framework_tests` + +### Other goodies + +- [tmux-copycat](https://github.com/tmux-plugins/tmux-copycat) - a plugin for + regex searches in tmux and fast match selection +- [tmux-continuum](https://github.com/tmux-plugins/tmux-continuum) - automatic + restoring and continuous saving of tmux env + +### License + +[MIT](LICENSE.md) diff --git a/tmux/plugins/tpm/lib/tmux-test/Vagrantfile b/tmux/plugins/tpm/lib/tmux-test/Vagrantfile new file mode 100644 index 0000000..04b3eba --- /dev/null +++ b/tmux/plugins/tpm/lib/tmux-test/Vagrantfile @@ -0,0 +1,17 @@ +VAGRANTFILE_API_VERSION = "2" + +Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| + + config.vm.synced_folder "../../", "/vagrant" + + config.vm.define :ubuntu do |ubuntu| + ubuntu.vm.box = "hashicorp/precise64" + ubuntu.vm.provision "shell", path: "vagrant_ubuntu_provisioning.sh" + end + + config.vm.define :centos do |centos| + centos.vm.box = "chef/centos-6.5" + centos.vm.provision "shell", path: "vagrant_centos_provisioning.sh" + end + +end diff --git a/tmux/plugins/tpm/lib/tmux-test/run_framework_tests b/tmux/plugins/tpm/lib/tmux-test/run_framework_tests new file mode 100755 index 0000000..fc0620c --- /dev/null +++ b/tmux/plugins/tpm/lib/tmux-test/run_framework_tests @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +# This file is used to run "tmux-test" framework tests. + +# "setup" script is needed to run the tests, but it overrides some working dir +# files. To address that, "setup" is run before the tests and its actions are +# undone after. + +main() { + git clone https://github.com/tmux-plugins/tmux-test lib/tmux-test + lib/tmux-test/setup + ./run_tests + local exit_value=$? + lib/tmux-test/setup "undo" + exit "$exit_value" +} +main diff --git a/tmux/plugins/tpm/lib/tmux-test/setup b/tmux/plugins/tpm/lib/tmux-test/setup new file mode 100755 index 0000000..575a8a3 --- /dev/null +++ b/tmux/plugins/tpm/lib/tmux-test/setup @@ -0,0 +1,93 @@ +#!/usr/bin/env bash + +# invoke this script from your projects root directory + +CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +# pass "undo" as a script arg to undo most of the setup actions +UNDO_SETUP="$1" +undo() { + [ "$UNDO_SETUP" == "undo" ] +} + +restore() { + local file="$1" + rm -f "$file" + git checkout -- "$file" 2>/dev/null +} + +gitignore() { + local file="$1" + grep -q "^${file}$" .gitignore 2>/dev/null || echo "$file" >> .gitignore +} + +remove_from_gitignore() { + local file="$1" + local escaped_filename="$(echo "$file" | sed "s,/,\\\/,g")" + sed -i"" "/^${escaped_filename}$/d" .gitignore +} + +add_files_to_gitignore() { + if ! undo; then + gitignore "run_tests" + gitignore "tests/run_tests_in_isolation" + gitignore "tests/helpers/helpers.sh" + else + remove_from_gitignore "run_tests" + remove_from_gitignore "tests/run_tests_in_isolation" + remove_from_gitignore "tests/helpers/helpers.sh" + fi +} + +symlink_user_test_runner() { + local file="run_tests" + if ! undo; then + ln -sf "lib/tmux-test/${file}" "$file" + else + restore "$file" + fi +} + +create_directory_for_tests() { + if ! undo; then + mkdir -p tests/helpers/ + fi +} + +symlink_internal_test_runner() { + local file="tests/run_tests_in_isolation" + if ! undo; then + ln -sf "../lib/tmux-test/${file}" "$file" + else + restore "$file" + fi +} + +symlink_test_helpers() { + local file="tests/helpers/helpers.sh" + if ! undo; then + ln -sf "../../lib/tmux-test/${file}" "$file" + else + restore "$file" + fi +} + +copy_travis_yml() { + local file=".travis.yml" + if ! undo; then + cp "lib/tmux-test/${file}" "$file" + else + restore "$file" + fi +} + +main() { + add_files_to_gitignore + symlink_user_test_runner + create_directory_for_tests + symlink_internal_test_runner + symlink_test_helpers + copy_travis_yml +} +main + diff --git a/tmux/plugins/tpm/lib/tmux-test/tests/helpers/helpers.sh b/tmux/plugins/tpm/lib/tmux-test/tests/helpers/helpers.sh new file mode 100644 index 0000000..32b1ee4 --- /dev/null +++ b/tmux/plugins/tpm/lib/tmux-test/tests/helpers/helpers.sh @@ -0,0 +1,68 @@ +# This file is a symlink from 'tmux-test' plugin. +# You probably don't want to edit it. + + +# Global variable that keeps the value of test status (success/fail). +# Suggested usage is via `fail_helper` and `exit_helper` functions. +TEST_STATUS="success" + +# PRIVATE FUNCTIONS + +_clone_the_plugin() { + local plugin_path="${HOME}/.tmux/plugins/tmux-plugin-under-test/" + rm -rf "$plugin_path" + git clone --recursive "${CURRENT_DIR}/../" "$plugin_path" >/dev/null 2>&1 +} + +_add_plugin_to_tmux_conf() { + set_tmux_conf_helper<<-HERE + run-shell '~/.tmux/plugins/tmux-plugin-under-test/*.tmux' + HERE +} + +# PUBLIC HELPER FUNCTIONS + +teardown_helper() { + rm -f ~/.tmux.conf + rm -rf ~/.tmux/ + tmux kill-server >/dev/null 2>&1 +} + +set_tmux_conf_helper() { + > ~/.tmux.conf # empty tmux.conf file + while read line; do + echo "$line" >> ~/.tmux.conf + done +} + +fail_helper() { + local message="$1" + echo "$message" >&2 + TEST_STATUS="fail" +} + +exit_helper() { + teardown_helper + if [ "$TEST_STATUS" == "fail" ]; then + echo "FAIL!" + echo + exit 1 + else + echo "SUCCESS" + echo + exit 0 + fi +} + +install_tmux_plugin_under_test_helper() { + _clone_the_plugin + _add_plugin_to_tmux_conf +} + +run_tests() { + # get all the functions starting with 'test_' and invoke them + for test in $(compgen -A function | grep "^test_"); do + "$test" + done + exit_helper +} diff --git a/tmux/plugins/tpm/lib/tmux-test/tests/run_tests_in_isolation b/tmux/plugins/tpm/lib/tmux-test/tests/run_tests_in_isolation new file mode 100755 index 0000000..fa39ebe --- /dev/null +++ b/tmux/plugins/tpm/lib/tmux-test/tests/run_tests_in_isolation @@ -0,0 +1,47 @@ +#!/usr/bin/env bash + +# This file is a symlink from 'tmux-test' plugin. +# You probably don't want to edit it. + +# This script should be run within an isolated enviroment (Vagrant, travis). +# Depending on what the tests do, it might NOT be safe to run this script +# directly on the development machine. + +CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +EXIT_VALUE=0 # running a test suite is successful by default + +all_test_files() { + ls -1 "$CURRENT_DIR" | # test files are in the current dir + \grep -i "^test" | # test file names start with "test" + xargs # file names in a single line +} + +set_exit_val_to_false() { + EXIT_VALUE=1 +} + +run_tests() { + local test_file tests_files + if [ "$#" -gt 0 ]; then + test_files="${@//tests\//}" # remove 'tests/' directory prefix + else + test_files="$(all_test_files)" + fi + for test_file in $test_files; do + echo "Running test: $test_file" + "${CURRENT_DIR}/${test_file}" + + # handling exit value + local test_exit_value="$?" + if [ "$test_exit_value" -ne 0 ]; then + set_exit_val_to_false + fi + done +} + +main() { + run_tests "$@" + exit "$EXIT_VALUE" +} +main "$@" diff --git a/tmux/plugins/tpm/lib/tmux-test/tests/test_basic_script_execution.sh b/tmux/plugins/tpm/lib/tmux-test/tests/test_basic_script_execution.sh new file mode 100755 index 0000000..0fdcf09 --- /dev/null +++ b/tmux/plugins/tpm/lib/tmux-test/tests/test_basic_script_execution.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +exit 0 diff --git a/tmux/plugins/tpm/lib/tmux-test/tests/test_default_session_name.sh b/tmux/plugins/tpm/lib/tmux-test/tests/test_default_session_name.sh new file mode 100755 index 0000000..c761b93 --- /dev/null +++ b/tmux/plugins/tpm/lib/tmux-test/tests/test_default_session_name.sh @@ -0,0 +1,24 @@ +#/usr/bin/env bash + +CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +# bash helpers provided by 'tmux-test' +source $CURRENT_DIR/helpers/helpers.sh + +# installs plugin from current repo in Vagrant (or on Travis) +install_tmux_plugin_under_test_helper + +# start tmux in background (plugin under test is sourced) +tmux new -d + +# get first session name +session_name="$(tmux list-sessions -F "#{session_name}")" + +# fail the test if first session name is not "0" +if ! [ "$session_name" == "0" ]; then + # fail_helper is also provided by 'tmux-test' + fail_helper "First session name is not '0' by default" +fi + +# sets the right script exit code ('tmux-test' helper) +exit_helper diff --git a/tmux/plugins/tpm/lib/tmux-test/tests/test_tmux_scripting.sh b/tmux/plugins/tpm/lib/tmux-test/tests/test_tmux_scripting.sh new file mode 100755 index 0000000..3b4bece --- /dev/null +++ b/tmux/plugins/tpm/lib/tmux-test/tests/test_tmux_scripting.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +source $CURRENT_DIR/helpers/helpers.sh + +number_of_windows() { + tmux list-windows | + wc -l | + sed "s/ //g" +} + +main() { + # start tmux in the background + tmux new -d + tmux new-window + + local number_of_windows="$(number_of_windows)" + if ! [ "$number_of_windows" -eq 2 ]; then + fail_helper "Incorrect number of windows. Expected 2, got $number_of_windows" + fi + exit_helper +} +main diff --git a/tmux/plugins/tpm/lib/tmux-test/vagrant_centos_provisioning.sh b/tmux/plugins/tpm/lib/tmux-test/vagrant_centos_provisioning.sh new file mode 100644 index 0000000..6902d9c --- /dev/null +++ b/tmux/plugins/tpm/lib/tmux-test/vagrant_centos_provisioning.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +# libevent2 installation instructions from here +# https://gist.github.com/rschuman/6168833 + +sudo su - + +yum -y install gcc kernel-devel make automake autoconf ncurses-devel +yum -y install git-core expect vim ruby ruby-devel ruby-irb + +# install libevent2 from source +curl http://sourceforge.net/projects/levent/files/latest/download?source=files -L -o libevent2.tar.gz -w 'Last URL was: %{url_effective}' +cd ~/downloads +tar zxvf libevent2.tar.gz +cd ./libevent-* +./configure --prefix=/usr/local +make +make install + +# compile tmux +git clone https://github.com/tmux/tmux.git ~/tmux_source +cd ~/tmux_source +git checkout 2.5 +sh autogen.sh +LDFLAGS="-L/usr/local/lib -Wl,-rpath=/usr/local/lib" ./configure --prefix=/usr/local +make && sudo make install diff --git a/tmux/plugins/tpm/lib/tmux-test/vagrant_ubuntu_provisioning.sh b/tmux/plugins/tpm/lib/tmux-test/vagrant_ubuntu_provisioning.sh new file mode 100644 index 0000000..2a0d9e5 --- /dev/null +++ b/tmux/plugins/tpm/lib/tmux-test/vagrant_ubuntu_provisioning.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +sudo apt-get update +sudo apt-get install -y git-core expect vim +sudo apt-get install -y python-software-properties software-properties-common +sudo apt-get install -y build-essential libtool autotools-dev autoconf +sudo apt-get install -y pkg-config libevent-dev libncurses-dev +sudo apt-get install -y man-db + +# install tmux 2.5 +git clone https://github.com/tmux/tmux.git ~/tmux_source +cd ~/tmux_source +git checkout 2.5 +sh autogen.sh +./configure && make && sudo make install diff --git a/tmux/plugins/tpm/scripts/check_tmux_version.sh b/tmux/plugins/tpm/scripts/check_tmux_version.sh new file mode 100755 index 0000000..b0aedec --- /dev/null +++ b/tmux/plugins/tpm/scripts/check_tmux_version.sh @@ -0,0 +1,78 @@ +#!/usr/bin/env bash + +VERSION="$1" +UNSUPPORTED_MSG="$2" + +get_tmux_option() { + local option=$1 + local default_value=$2 + local option_value=$(tmux show-option -gqv "$option") + if [ -z "$option_value" ]; then + echo "$default_value" + else + echo "$option_value" + fi +} + +# Ensures a message is displayed for 5 seconds in tmux prompt. +# Does not override the 'display-time' tmux option. +display_message() { + local message="$1" + + # display_duration defaults to 5 seconds, if not passed as an argument + if [ "$#" -eq 2 ]; then + local display_duration="$2" + else + local display_duration="5000" + fi + + # saves user-set 'display-time' option + local saved_display_time=$(get_tmux_option "display-time" "750") + + # sets message display time to 5 seconds + tmux set-option -gq display-time "$display_duration" + + # displays message + tmux display-message "$message" + + # restores original 'display-time' value + tmux set-option -gq display-time "$saved_display_time" +} + +# this is used to get "clean" integer version number. Examples: +# `tmux 1.9` => `19` +# `1.9a` => `19` +get_digits_from_string() { + local string="$1" + local only_digits="$(echo "$string" | tr -dC '[:digit:]')" + echo "$only_digits" +} + +tmux_version_int() { + local tmux_version_string=$(tmux -V) + echo "$(get_digits_from_string "$tmux_version_string")" +} + +unsupported_version_message() { + if [ -n "$UNSUPPORTED_MSG" ]; then + echo "$UNSUPPORTED_MSG" + else + echo "Error, Tmux version unsupported! Please install Tmux version $VERSION or greater!" + fi +} + +exit_if_unsupported_version() { + local current_version="$1" + local supported_version="$2" + if [ "$current_version" -lt "$supported_version" ]; then + display_message "$(unsupported_version_message)" + exit 1 + fi +} + +main() { + local supported_version_int="$(get_digits_from_string "$VERSION")" + local current_version_int="$(tmux_version_int)" + exit_if_unsupported_version "$current_version_int" "$supported_version_int" +} +main diff --git a/tmux/plugins/tpm/scripts/clean_plugins.sh b/tmux/plugins/tpm/scripts/clean_plugins.sh new file mode 100755 index 0000000..a025524 --- /dev/null +++ b/tmux/plugins/tpm/scripts/clean_plugins.sh @@ -0,0 +1,41 @@ +#!/usr/bin/env bash + +CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +HELPERS_DIR="$CURRENT_DIR/helpers" + +source "$HELPERS_DIR/plugin_functions.sh" +source "$HELPERS_DIR/utility.sh" + +if [ "$1" == "--tmux-echo" ]; then # tmux-specific echo functions + source "$HELPERS_DIR/tmux_echo_functions.sh" +else # shell output functions + source "$HELPERS_DIR/shell_echo_functions.sh" +fi + +clean_plugins() { + local plugins plugin plugin_directory + plugins="$(tpm_plugins_list_helper)" + + for plugin_directory in "$(tpm_path)"/*; do + [ -d "${plugin_directory}" ] || continue + plugin="$(plugin_name_helper "${plugin_directory}")" + case "${plugins}" in + *"${plugin}"*) : ;; + *) + [ "${plugin}" = "tpm" ] && continue + echo_ok "Removing \"$plugin\"" + rm -rf "${plugin_directory}" >/dev/null 2>&1 + [ -d "${plugin_directory}" ] && + echo_err " \"$plugin\" clean fail" || + echo_ok " \"$plugin\" clean success" + ;; + esac + done +} + +main() { + ensure_tpm_path_exists + clean_plugins + exit_value_helper +} +main diff --git a/tmux/plugins/tpm/scripts/helpers/plugin_functions.sh b/tmux/plugins/tpm/scripts/helpers/plugin_functions.sh new file mode 100644 index 0000000..cbd1b55 --- /dev/null +++ b/tmux/plugins/tpm/scripts/helpers/plugin_functions.sh @@ -0,0 +1,104 @@ +# using @tpm_plugins is now deprecated in favor of using @plugin syntax +tpm_plugins_variable_name="@tpm_plugins" + +# manually expanding tilde char or `$HOME` variable. +_manual_expansion() { + local path="$1" + local expanded_tilde="${path/#\~/$HOME}" + echo "${expanded_tilde/#\$HOME/$HOME}" +} + +_tpm_path() { + local string_path="$(tmux start-server\; show-environment -g TMUX_PLUGIN_MANAGER_PATH | cut -f2 -d=)/" + _manual_expansion "$string_path" +} + +_CACHED_TPM_PATH="$(_tpm_path)" + +# Get the absolute path to the users configuration file of TMux. +# This includes a prioritized search on different locations. +# +_get_user_tmux_conf() { + # Define the different possible locations. + xdg_location="$XDG_CONFIG_HOME/tmux/tmux.conf" + default_location="$HOME/.tmux.conf" + + # Search for the correct configuration file by priority. + if [ -f "$xdg_location" ]; then + echo "$xdg_location" + + else + echo "$default_location" + fi +} + +_tmux_conf_contents() { + user_config=$(_get_user_tmux_conf) + cat /etc/tmux.conf "$user_config" 2>/dev/null + if [ "$1" == "full" ]; then # also output content from sourced files + local file + for file in $(_sourced_files); do + cat $(_manual_expansion "$file") 2>/dev/null + done + fi +} + +# return files sourced from tmux config files +_sourced_files() { + _tmux_conf_contents | + awk '/^[ \t]*source(-file)? +/ { gsub(/'\''/,""); gsub(/'\"'/,""); print $2 }' +} + +# Want to be able to abort in certain cases +trap "exit 1" TERM +export TOP_PID=$$ + +_fatal_error_abort() { + echo >&2 "Aborting." + kill -s TERM $TOP_PID +} + +# PUBLIC FUNCTIONS BELOW + +tpm_path() { + if [ "$_CACHED_TPM_PATH" == "/" ]; then + echo >&2 "FATAL: Tmux Plugin Manager not configured in tmux.conf" + _fatal_error_abort + fi + echo "$_CACHED_TPM_PATH" +} + +tpm_plugins_list_helper() { + # lists plugins from @tpm_plugins option + echo "$(tmux start-server\; show-option -gqv "$tpm_plugins_variable_name")" + + # read set -g @plugin "tmux-plugins/tmux-example-plugin" entries + _tmux_conf_contents "full" | + awk '/^[ \t]*set(-option)? +-g +@plugin/ { gsub(/'\''/,""); gsub(/'\"'/,""); print $4 }' +} + +# Allowed plugin name formats: +# 1. "git://github.com/user/plugin_name.git" +# 2. "user/plugin_name" +plugin_name_helper() { + local plugin="$1" + # get only the part after the last slash, e.g. "plugin_name.git" + local plugin_basename="$(basename "$plugin")" + # remove ".git" extension (if it exists) to get only "plugin_name" + local plugin_name="${plugin_basename%.git}" + echo "$plugin_name" +} + +plugin_path_helper() { + local plugin="$1" + local plugin_name="$(plugin_name_helper "$plugin")" + echo "$(tpm_path)${plugin_name}/" +} + +plugin_already_installed() { + local plugin="$1" + local plugin_path="$(plugin_path_helper "$plugin")" + [ -d "$plugin_path" ] && + cd "$plugin_path" && + git remote >/dev/null 2>&1 +} diff --git a/tmux/plugins/tpm/scripts/helpers/shell_echo_functions.sh b/tmux/plugins/tpm/scripts/helpers/shell_echo_functions.sh new file mode 100644 index 0000000..ecaa37e --- /dev/null +++ b/tmux/plugins/tpm/scripts/helpers/shell_echo_functions.sh @@ -0,0 +1,7 @@ +echo_ok() { + echo "$*" +} + +echo_err() { + fail_helper "$*" +} diff --git a/tmux/plugins/tpm/scripts/helpers/tmux_echo_functions.sh b/tmux/plugins/tpm/scripts/helpers/tmux_echo_functions.sh new file mode 100644 index 0000000..7a6ef0a --- /dev/null +++ b/tmux/plugins/tpm/scripts/helpers/tmux_echo_functions.sh @@ -0,0 +1,28 @@ +_has_emacs_mode_keys() { + $(tmux show -gw mode-keys | grep -q emacs) +} + +tmux_echo() { + local message="$1" + tmux run-shell "echo '$message'" +} + +echo_ok() { + tmux_echo "$*" +} + +echo_err() { + tmux_echo "$*" +} + +end_message() { + if _has_emacs_mode_keys; then + local continue_key="ESCAPE" + else + local continue_key="ENTER" + fi + tmux_echo "" + tmux_echo "TMUX environment reloaded." + tmux_echo "" + tmux_echo "Done, press $continue_key to continue." +} diff --git a/tmux/plugins/tpm/scripts/helpers/tmux_utils.sh b/tmux/plugins/tpm/scripts/helpers/tmux_utils.sh new file mode 100644 index 0000000..e39946a --- /dev/null +++ b/tmux/plugins/tpm/scripts/helpers/tmux_utils.sh @@ -0,0 +1,3 @@ +reload_tmux_environment() { + tmux source-file ~/.tmux.conf >/dev/null 2>&1 +} diff --git a/tmux/plugins/tpm/scripts/helpers/utility.sh b/tmux/plugins/tpm/scripts/helpers/utility.sh new file mode 100644 index 0000000..de6eb35 --- /dev/null +++ b/tmux/plugins/tpm/scripts/helpers/utility.sh @@ -0,0 +1,17 @@ +ensure_tpm_path_exists() { + mkdir -p "$(tpm_path)" +} + +fail_helper() { + local message="$1" + echo "$message" >&2 + FAIL="true" +} + +exit_value_helper() { + if [ "$FAIL" == "true" ]; then + exit 1 + else + exit 0 + fi +} diff --git a/tmux/plugins/tpm/scripts/install_plugins.sh b/tmux/plugins/tpm/scripts/install_plugins.sh new file mode 100755 index 0000000..7958ab5 --- /dev/null +++ b/tmux/plugins/tpm/scripts/install_plugins.sh @@ -0,0 +1,66 @@ +#!/usr/bin/env bash + +CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +HELPERS_DIR="$CURRENT_DIR/helpers" + +source "$HELPERS_DIR/plugin_functions.sh" +source "$HELPERS_DIR/utility.sh" + +if [ "$1" == "--tmux-echo" ]; then # tmux-specific echo functions + source "$HELPERS_DIR/tmux_echo_functions.sh" +else # shell output functions + source "$HELPERS_DIR/shell_echo_functions.sh" +fi + +clone() { + local plugin="$1" + cd "$(tpm_path)" && + GIT_TERMINAL_PROMPT=0 git clone --recursive "$plugin" >/dev/null 2>&1 +} + +# tries cloning: +# 1. plugin name directly - works if it's a valid git url +# 2. expands the plugin name to point to a github repo and tries cloning again +clone_plugin() { + local plugin="$1" + clone "$plugin" || + clone "https://git::@github.com/$plugin" +} + +# clone plugin and produce output +install_plugin() { + local plugin="$1" + local plugin_name="$(plugin_name_helper "$plugin")" + + if plugin_already_installed "$plugin"; then + echo_ok "Already installed \"$plugin_name\"" + else + echo_ok "Installing \"$plugin_name\"" + clone_plugin "$plugin" && + echo_ok " \"$plugin_name\" download success" || + echo_err " \"$plugin_name\" download fail" + fi +} + +install_plugins() { + local plugins="$(tpm_plugins_list_helper)" + for plugin in $plugins; do + install_plugin "$plugin" + done +} + +verify_tpm_path_permissions() { + local path="$(tpm_path)" + # check the write permission flag for all users to ensure + # that we have proper access + [ -w "$path" ] || + echo_err "$path is not writable!" +} + +main() { + ensure_tpm_path_exists + verify_tpm_path_permissions + install_plugins + exit_value_helper +} +main diff --git a/tmux/plugins/tpm/scripts/source_plugins.sh b/tmux/plugins/tpm/scripts/source_plugins.sh new file mode 100755 index 0000000..bb79c26 --- /dev/null +++ b/tmux/plugins/tpm/scripts/source_plugins.sh @@ -0,0 +1,41 @@ +#!/usr/bin/env bash + +CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +HELPERS_DIR="$CURRENT_DIR/helpers" + +source "$HELPERS_DIR/plugin_functions.sh" + +plugin_dir_exists() { + [ -d "$1" ] +} + +# Runs all *.tmux files from the plugin directory. +# Files are ran as executables. +# No errors if the plugin dir does not exist. +silently_source_all_tmux_files() { + local plugin_path="$1" + local plugin_tmux_files="$plugin_path*.tmux" + if plugin_dir_exists "$plugin_path"; then + for tmux_file in $plugin_tmux_files; do + # if the glob didn't find any files this will be the + # unexpanded glob which obviously doesn't exist + [ -f "$tmux_file" ] || continue + # runs *.tmux file as an executable + $tmux_file >/dev/null 2>&1 + done + fi +} + +source_plugins() { + local plugin plugin_path + local plugins="$(tpm_plugins_list_helper)" + for plugin in $plugins; do + plugin_path="$(plugin_path_helper "$plugin")" + silently_source_all_tmux_files "$plugin_path" + done +} + +main() { + source_plugins +} +main diff --git a/tmux/plugins/tpm/scripts/update_plugin.sh b/tmux/plugins/tpm/scripts/update_plugin.sh new file mode 100755 index 0000000..7d856ee --- /dev/null +++ b/tmux/plugins/tpm/scripts/update_plugin.sh @@ -0,0 +1,71 @@ +#!/usr/bin/env bash + +# this script handles core logic of updating plugins + +CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +HELPERS_DIR="$CURRENT_DIR/helpers" + +source "$HELPERS_DIR/plugin_functions.sh" +source "$HELPERS_DIR/utility.sh" + +if [ "$1" == "--tmux-echo" ]; then # tmux-specific echo functions + source "$HELPERS_DIR/tmux_echo_functions.sh" +else # shell output functions + source "$HELPERS_DIR/shell_echo_functions.sh" +fi + +# from now on ignore first script argument +shift + +pull_changes() { + local plugin="$1" + local plugin_path="$(plugin_path_helper "$plugin")" + cd "$plugin_path" && + GIT_TERMINAL_PROMPT=0 git pull && + GIT_TERMINAL_PROMPT=0 git submodule update --init --recursive +} + +update() { + local plugin="$1" + $(pull_changes "$plugin" > /dev/null 2>&1) && + echo_ok " \"$plugin\" update success" || + echo_err " \"$plugin\" update fail" +} + +update_all() { + echo_ok "Updating all plugins!" + echo_ok "" + local plugins="$(tpm_plugins_list_helper)" + for plugin in $plugins; do + local plugin_name="$(plugin_name_helper "$plugin")" + # updating only installed plugins + if plugin_already_installed "$plugin_name"; then + update "$plugin_name" & + fi + done + wait +} + +update_plugins() { + local plugins="$*" + for plugin in $plugins; do + local plugin_name="$(plugin_name_helper "$plugin")" + if plugin_already_installed "$plugin_name"; then + update "$plugin_name" & + else + echo_err "$plugin_name not installed!" & + fi + done + wait +} + +main() { + ensure_tpm_path_exists + if [ "$1" == "all" ]; then + update_all + else + update_plugins "$*" + fi + exit_value_helper +} +main "$*" diff --git a/tmux/plugins/tpm/scripts/update_plugin_prompt_handler.sh b/tmux/plugins/tpm/scripts/update_plugin_prompt_handler.sh new file mode 100755 index 0000000..5e1f7d9 --- /dev/null +++ b/tmux/plugins/tpm/scripts/update_plugin_prompt_handler.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +HELPERS_DIR="$CURRENT_DIR/helpers" + +if [ $# -eq 0 ]; then + exit 0 +fi + +source "$HELPERS_DIR/tmux_echo_functions.sh" +source "$HELPERS_DIR/tmux_utils.sh" + +main() { + "$CURRENT_DIR/update_plugin.sh" --tmux-echo "$*" + reload_tmux_environment + end_message +} +main "$*" diff --git a/tmux/plugins/tpm/scripts/variables.sh b/tmux/plugins/tpm/scripts/variables.sh new file mode 100644 index 0000000..5601a86 --- /dev/null +++ b/tmux/plugins/tpm/scripts/variables.sh @@ -0,0 +1,13 @@ +install_key_option="@tpm-install" +default_install_key="I" + +update_key_option="@tpm-update" +default_update_key="U" + +clean_key_option="@tpm-clean" +default_clean_key="M-u" + +SUPPORTED_TMUX_VERSION="1.9" + +DEFAULT_TPM_ENV_VAR_NAME="TMUX_PLUGIN_MANAGER_PATH" +DEFAULT_TPM_PATH="$HOME/.tmux/plugins/" diff --git a/tmux/plugins/tpm/tests/expect_failed_plugin_download b/tmux/plugins/tpm/tests/expect_failed_plugin_download new file mode 100755 index 0000000..b970477 --- /dev/null +++ b/tmux/plugins/tpm/tests/expect_failed_plugin_download @@ -0,0 +1,36 @@ +#!/usr/bin/env expect + +# disables script output +log_user 0 + +spawn tmux + +# Waiting for tmux to attach. If this is not done, next command, `send` will +# not work properly. +sleep 1 + +# this is tmux prefix + I +send "I" + +# cloning might take a while +set timeout 20 + +expect_after { + timeout { exit 1 } +} + +expect { + "Installing \"non-existing-plugin\"" +} + +expect { + "\"non-existing-plugin\" download fail" +} + +expect { + "Done, press ENTER to continue" { + exit 0 + } +} + +exit 1 diff --git a/tmux/plugins/tpm/tests/expect_successful_clean_plugins b/tmux/plugins/tpm/tests/expect_successful_clean_plugins new file mode 100755 index 0000000..987c49d --- /dev/null +++ b/tmux/plugins/tpm/tests/expect_successful_clean_plugins @@ -0,0 +1,35 @@ +#!/usr/bin/env expect + +# disables script output +log_user 0 + +spawn tmux + +# Waiting for tmux to attach. If this is not done, next command, `send` will +# not work properly. +sleep 1 + +# this is tmux prefix + alt + u +send "u" + +set timeout 5 + +expect_after { + timeout { exit 1 } +} + +expect { + "Removing \"tmux-example-plugin\"" +} + +expect { + "\"tmux-example-plugin\" clean success" +} + +expect { + "Done, press ENTER to continue." { + exit 0 + } +} + +exit 1 diff --git a/tmux/plugins/tpm/tests/expect_successful_multiple_plugins_download b/tmux/plugins/tpm/tests/expect_successful_multiple_plugins_download new file mode 100755 index 0000000..cc87a26 --- /dev/null +++ b/tmux/plugins/tpm/tests/expect_successful_multiple_plugins_download @@ -0,0 +1,44 @@ +#!/usr/bin/env expect + +# disables script output +log_user 0 + +spawn tmux + +# Waiting for tmux to attach. If this is not done, next command, `send` will +# not work properly. +sleep 1 + +# this is tmux prefix + I +send "I" + +# cloning might take a while +set timeout 15 + +expect_after { + timeout { exit 1 } +} + +expect { + "Installing \"tmux-example-plugin\"" +} + +expect { + "\"tmux-example-plugin\" download success" +} + +expect { + "Installing \"tmux-copycat\"" +} + +expect { + "\"tmux-copycat\" download success" +} + +expect { + "Done, press ENTER to continue." { + exit 0 + } +} + +exit 1 diff --git a/tmux/plugins/tpm/tests/expect_successful_plugin_download b/tmux/plugins/tpm/tests/expect_successful_plugin_download new file mode 100755 index 0000000..388f05d --- /dev/null +++ b/tmux/plugins/tpm/tests/expect_successful_plugin_download @@ -0,0 +1,50 @@ +#!/usr/bin/env expect + +# disables script output +log_user 0 + +spawn tmux + +# Waiting for tmux to attach. If this is not done, next command, `send` will +# not work properly. +sleep 1 + +# this is tmux prefix + I +send "I" + +# cloning might take a while +set timeout 15 + +expect_after { + timeout { exit 1 } +} + +expect { + "Installing \"tmux-example-plugin\"" +} + +expect { + "\"tmux-example-plugin\" download success" +} + +expect { + "Done, press ENTER to continue" { + send " " + } +} + +sleep 1 +# this is tmux prefix + I +send "I" + +expect { + "Already installed \"tmux-example-plugin\"" +} + +expect { + "Done, press ENTER to continue" { + exit 0 + } +} + +exit 1 diff --git a/tmux/plugins/tpm/tests/expect_successful_update_of_a_single_plugin b/tmux/plugins/tpm/tests/expect_successful_update_of_a_single_plugin new file mode 100755 index 0000000..bcd64fe --- /dev/null +++ b/tmux/plugins/tpm/tests/expect_successful_update_of_a_single_plugin @@ -0,0 +1,55 @@ +#!/usr/bin/env expect + +# disables script output +log_user 0 + +spawn tmux + +# Waiting for tmux to attach. If this is not done, next command, `send` will +# not work properly. +sleep 1 + +# this is tmux prefix + U +send "U" + +set timeout 15 + +expect_after { + timeout { exit 1 } +} + +expect { + "Installed plugins" +} + +expect { + "tmux-example-plugin" +} + +expect { + "\"all\" - updates all plugins" +} + +expect { + "ENTER - cancels" +} + +# wait for tmux to display prompt before sending characters +sleep 1 +send "tmux-example-plugin\r" + +expect { + "Updating \"tmux-example-plugin\"" +} + +expect { + "\"tmux-example-plugin\" update success" +} + +expect { + "Done, press ENTER to continue." { + exit 0 + } +} + +exit 1 diff --git a/tmux/plugins/tpm/tests/expect_successful_update_of_all_plugins b/tmux/plugins/tpm/tests/expect_successful_update_of_all_plugins new file mode 100755 index 0000000..4f3a4a3 --- /dev/null +++ b/tmux/plugins/tpm/tests/expect_successful_update_of_all_plugins @@ -0,0 +1,59 @@ +#!/usr/bin/env expect + +# disables script output +log_user 0 + +spawn tmux + +# Waiting for tmux to attach. If this is not done, next command, `send` will +# not work properly. +sleep 1 + +# this is tmux prefix + U +send "U" + +set timeout 5 + +expect_after { + timeout { exit 1 } +} + +expect { + "Installed plugins" +} + +expect { + "tmux-example-plugin" +} + +expect { + "\"all\" - updates all plugins" +} + +expect { + "ENTER - cancels" +} + +# wait for tmux to display prompt before sending characters +sleep 1 +send "all\r" + +expect { + "Updating all plugins!" +} + +expect { + "Updating \"tmux-example-plugin\"" +} + +expect { + "\"tmux-example-plugin\" update success" +} + +expect { + "Done, press ENTER to continue." { + exit 0 + } +} + +exit 1 diff --git a/tmux/plugins/tpm/tests/helpers/tpm.sh b/tmux/plugins/tpm/tests/helpers/tpm.sh new file mode 100644 index 0000000..1594afb --- /dev/null +++ b/tmux/plugins/tpm/tests/helpers/tpm.sh @@ -0,0 +1,13 @@ +check_dir_exists_helper() { + [ -d "$1" ] +} + +# runs the scripts and asserts it has the correct output and exit code +script_run_helper() { + local script="$1" + local expected_output="$2" + local expected_exit_code="${3:-0}" + $script 2>&1 | + grep "$expected_output" >/dev/null 2>&1 && # grep -q flag quits the script early + [ "${PIPESTATUS[0]}" -eq "$expected_exit_code" ] +} diff --git a/tmux/plugins/tpm/tests/test_plugin_clean.sh b/tmux/plugins/tpm/tests/test_plugin_clean.sh new file mode 100755 index 0000000..d36c468 --- /dev/null +++ b/tmux/plugins/tpm/tests/test_plugin_clean.sh @@ -0,0 +1,67 @@ +#!/usr/bin/env bash + +CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +TPM_DIR="$PWD" +PLUGINS_DIR="$HOME/.tmux/plugins" + +source "$CURRENT_DIR/helpers/helpers.sh" +source "$CURRENT_DIR/helpers/tpm.sh" + +manually_install_the_plugin() { + rm -rf "$PLUGINS_DIR" + mkdir -p "$PLUGINS_DIR" + cd "$PLUGINS_DIR" + git clone --quiet https://github.com/tmux-plugins/tmux-example-plugin +} + +# TMUX KEY-BINDING TESTS + +test_plugin_uninstallation_via_tmux_key_binding() { + set_tmux_conf_helper <<- HERE + set -g mode-keys vi + run-shell "$TPM_DIR/tpm" + HERE + + manually_install_the_plugin + + "$CURRENT_DIR/expect_successful_clean_plugins" || + fail_helper "[key-binding] clean fails" + + teardown_helper +} + +# SCRIPT TESTS + +test_plugin_uninstallation_via_script() { + set_tmux_conf_helper <<- HERE + set -g mode-keys vi + run-shell "$TPM_DIR/tpm" + HERE + + manually_install_the_plugin + + script_run_helper "$TPM_DIR/bin/clean_plugins" '"tmux-example-plugin" clean success' || + fail_helper "[script] plugin cleaning fails" + + teardown_helper +} + +test_unsuccessful_plugin_uninstallation_via_script() { + set_tmux_conf_helper <<- HERE + set -g mode-keys vi + run-shell "$TPM_DIR/tpm" + HERE + + manually_install_the_plugin + chmod 000 "$PLUGINS_DIR/tmux-example-plugin" # disable directory deletion + + local expected_exit_code=1 + script_run_helper "$TPM_DIR/bin/clean_plugins" '"tmux-example-plugin" clean fail' "$expected_exit_code" || + fail_helper "[script] unsuccessful plugin cleaning doesn't fail" + + chmod 755 "$PLUGINS_DIR/tmux-example-plugin" # enable directory deletion + + teardown_helper +} + +run_tests diff --git a/tmux/plugins/tpm/tests/test_plugin_installation.sh b/tmux/plugins/tpm/tests/test_plugin_installation.sh new file mode 100755 index 0000000..94fb674 --- /dev/null +++ b/tmux/plugins/tpm/tests/test_plugin_installation.sh @@ -0,0 +1,284 @@ +#!/usr/bin/env bash + +CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +PLUGINS_DIR="$HOME/.tmux/plugins" +TPM_DIR="$PWD" + +CUSTOM_PLUGINS_DIR="$HOME/foo/plugins" +ADDITIONAL_CONFIG_FILE_1="$HOME/.tmux/additional_config_file_1" +ADDITIONAL_CONFIG_FILE_2="$HOME/.tmux/additional_config_file_2" + +source "$CURRENT_DIR/helpers/helpers.sh" +source "$CURRENT_DIR/helpers/tpm.sh" + +# TMUX KEY-BINDING TESTS + +test_plugin_installation_via_tmux_key_binding() { + set_tmux_conf_helper <<- HERE + set -g mode-keys vi + set -g @plugin "tmux-plugins/tmux-example-plugin" + run-shell "$TPM_DIR/tpm" + HERE + + "$CURRENT_DIR/expect_successful_plugin_download" || + fail_helper "[key-binding] plugin installation fails" + + check_dir_exists_helper "$PLUGINS_DIR/tmux-example-plugin/" || + fail_helper "[key-binding] plugin download fails" + + teardown_helper +} + +test_plugin_installation_via_tmux_key_binding_set_option() { + set_tmux_conf_helper <<- HERE + set -g mode-keys vi + set-option -g @plugin "tmux-plugins/tmux-example-plugin" + run-shell "$TPM_DIR/tpm" + HERE + + "$CURRENT_DIR/expect_successful_plugin_download" || + fail_helper "[key-binding][set-option] plugin installation fails" + + check_dir_exists_helper "$PLUGINS_DIR/tmux-example-plugin/" || + fail_helper "[key-binding][set-option] plugin download fails" + + teardown_helper +} + +test_plugin_installation_custom_dir_via_tmux_key_binding() { + set_tmux_conf_helper <<- HERE + set -g mode-keys vi + set-environment -g TMUX_PLUGIN_MANAGER_PATH '$CUSTOM_PLUGINS_DIR' + + set -g @plugin "tmux-plugins/tmux-example-plugin" + run-shell "$TPM_DIR/tpm" + HERE + + "$CURRENT_DIR/expect_successful_plugin_download" || + fail_helper "[key-binding][custom dir] plugin installation fails" + + check_dir_exists_helper "$CUSTOM_PLUGINS_DIR/tmux-example-plugin/" || + fail_helper "[key-binding][custom dir] plugin download fails" + + teardown_helper + rm -rf "$CUSTOM_PLUGINS_DIR" +} + +test_non_existing_plugin_installation_via_tmux_key_binding() { + set_tmux_conf_helper <<- HERE + set -g mode-keys vi + set -g @plugin "tmux-plugins/non-existing-plugin" + run-shell "$TPM_DIR/tpm" + HERE + + "$CURRENT_DIR/expect_failed_plugin_download" || + fail_helper "[key-binding] non existing plugin installation doesn't fail" + + teardown_helper +} + +test_multiple_plugins_installation_via_tmux_key_binding() { + set_tmux_conf_helper <<- HERE + set -g mode-keys vi + set -g @plugin "tmux-plugins/tmux-example-plugin" + \ \ set -g @plugin 'tmux-plugins/tmux-copycat' + run-shell "$TPM_DIR/tpm" + HERE + + "$CURRENT_DIR/expect_successful_multiple_plugins_download" || + fail_helper "[key-binding] multiple plugins installation fails" + + check_dir_exists_helper "$PLUGINS_DIR/tmux-example-plugin/" || + fail_helper "[key-binding] plugin download fails (tmux-example-plugin)" + + check_dir_exists_helper "$PLUGINS_DIR/tmux-copycat/" || + fail_helper "[key-binding] plugin download fails (tmux-copycat)" + + teardown_helper +} + +test_plugins_installation_from_sourced_file_via_tmux_key_binding() { + set_tmux_conf_helper <<- HERE + set -g mode-keys vi + source '$ADDITIONAL_CONFIG_FILE_1' + set -g @plugin 'tmux-plugins/tmux-example-plugin' + run-shell "$TPM_DIR/tpm" + HERE + + mkdir ~/.tmux + echo "set -g @plugin 'tmux-plugins/tmux-copycat'" > "$ADDITIONAL_CONFIG_FILE_1" + + "$CURRENT_DIR/expect_successful_multiple_plugins_download" || + fail_helper "[key-binding][sourced file] plugins installation fails" + + check_dir_exists_helper "$PLUGINS_DIR/tmux-example-plugin/" || + fail_helper "[key-binding][sourced file] plugin download fails (tmux-example-plugin)" + + check_dir_exists_helper "$PLUGINS_DIR/tmux-copycat/" || + fail_helper "[key-binding][sourced file] plugin download fails (tmux-copycat)" + + teardown_helper +} + +test_plugins_installation_from_multiple_sourced_files_via_tmux_key_binding() { + set_tmux_conf_helper <<- HERE + set -g mode-keys vi + \ \ source '$ADDITIONAL_CONFIG_FILE_1' + source-file '$ADDITIONAL_CONFIG_FILE_2' + run-shell "$TPM_DIR/tpm" + HERE + + mkdir ~/.tmux + echo "set -g @plugin 'tmux-plugins/tmux-example-plugin'" > "$ADDITIONAL_CONFIG_FILE_1" + echo " set -g @plugin 'tmux-plugins/tmux-copycat'" > "$ADDITIONAL_CONFIG_FILE_2" + + "$CURRENT_DIR/expect_successful_multiple_plugins_download" || + fail_helper "[key-binding][multiple sourced files] plugins installation fails" + + check_dir_exists_helper "$PLUGINS_DIR/tmux-example-plugin/" || + fail_helper "[key-binding][multiple sourced files] plugin download fails (tmux-example-plugin)" + + check_dir_exists_helper "$PLUGINS_DIR/tmux-copycat/" || + fail_helper "[key-binding][multiple sourced files] plugin download fails (tmux-copycat)" + + teardown_helper +} + +# SCRIPT TESTS + +test_plugin_installation_via_script() { + set_tmux_conf_helper <<- HERE + set -g mode-keys vi + set -g @plugin "tmux-plugins/tmux-example-plugin" + run-shell "$TPM_DIR/tpm" + HERE + + script_run_helper "$TPM_DIR/bin/install_plugins" '"tmux-example-plugin" download success' || + fail_helper "[script] plugin installation fails" + + check_dir_exists_helper "$PLUGINS_DIR/tmux-example-plugin/" || + fail_helper "[script] plugin download fails" + + script_run_helper "$TPM_DIR/bin/install_plugins" 'Already installed "tmux-example-plugin"' || + fail_helper "[script] plugin already installed message fail" + + teardown_helper +} + +test_plugin_installation_custom_dir_via_script() { + set_tmux_conf_helper <<- HERE + set -g mode-keys vi + set-environment -g TMUX_PLUGIN_MANAGER_PATH '$CUSTOM_PLUGINS_DIR' + + set -g @plugin "tmux-plugins/tmux-example-plugin" + run-shell "$TPM_DIR/tpm" + HERE + + script_run_helper "$TPM_DIR/bin/install_plugins" '"tmux-example-plugin" download success' || + fail_helper "[script][custom dir] plugin installation fails" + + check_dir_exists_helper "$CUSTOM_PLUGINS_DIR/tmux-example-plugin/" || + fail_helper "[script][custom dir] plugin download fails" + + script_run_helper "$TPM_DIR/bin/install_plugins" 'Already installed "tmux-example-plugin"' || + fail_helper "[script][custom dir] plugin already installed message fail" + + teardown_helper + rm -rf "$CUSTOM_PLUGINS_DIR" +} + +test_non_existing_plugin_installation_via_script() { + set_tmux_conf_helper <<- HERE + set -g mode-keys vi + set -g @plugin "tmux-plugins/non-existing-plugin" + run-shell "$TPM_DIR/tpm" + HERE + + local expected_exit_code=1 + script_run_helper "$TPM_DIR/bin/install_plugins" '"non-existing-plugin" download fail' "$expected_exit_code" || + fail_helper "[script] non existing plugin installation doesn't fail" + + teardown_helper +} + +test_multiple_plugins_installation_via_script() { + set_tmux_conf_helper <<- HERE + set -g mode-keys vi + set -g @plugin "tmux-plugins/tmux-example-plugin" + \ \ set -g @plugin 'tmux-plugins/tmux-copycat' + run-shell "$TPM_DIR/tpm" + HERE + + script_run_helper "$TPM_DIR/bin/install_plugins" '"tmux-example-plugin" download success' || + fail_helper "[script] multiple plugins installation fails" + + check_dir_exists_helper "$PLUGINS_DIR/tmux-example-plugin/" || + fail_helper "[script] plugin download fails (tmux-example-plugin)" + + check_dir_exists_helper "$PLUGINS_DIR/tmux-copycat/" || + fail_helper "[script] plugin download fails (tmux-copycat)" + + script_run_helper "$TPM_DIR/bin/install_plugins" 'Already installed "tmux-copycat"' || + fail_helper "[script] multiple plugins already installed message fail" + + teardown_helper +} + +test_plugins_installation_from_sourced_file_via_script() { + set_tmux_conf_helper <<- HERE + set -g mode-keys vi + source '$ADDITIONAL_CONFIG_FILE_1' + set -g @plugin 'tmux-plugins/tmux-example-plugin' + run-shell "$TPM_DIR/tpm" + HERE + + mkdir ~/.tmux + echo "set -g @plugin 'tmux-plugins/tmux-copycat'" > "$ADDITIONAL_CONFIG_FILE_1" + + script_run_helper "$TPM_DIR/bin/install_plugins" '"tmux-copycat" download success' || + fail_helper "[script][sourced file] plugins installation fails" + + check_dir_exists_helper "$PLUGINS_DIR/tmux-example-plugin/" || + fail_helper "[script][sourced file] plugin download fails (tmux-example-plugin)" + + check_dir_exists_helper "$PLUGINS_DIR/tmux-copycat/" || + fail_helper "[script][sourced file] plugin download fails (tmux-copycat)" + + script_run_helper "$TPM_DIR/bin/install_plugins" 'Already installed "tmux-copycat"' || + fail_helper "[script][sourced file] plugins already installed message fail" + + teardown_helper +} + +test_plugins_installation_from_multiple_sourced_files_via_script() { + set_tmux_conf_helper <<- HERE + set -g mode-keys vi + \ \ source '$ADDITIONAL_CONFIG_FILE_1' + source-file '$ADDITIONAL_CONFIG_FILE_2' + set -g @plugin 'tmux-plugins/tmux-example-plugin' + run-shell "$TPM_DIR/tpm" + HERE + + mkdir ~/.tmux + echo " set -g @plugin 'tmux-plugins/tmux-copycat'" > "$ADDITIONAL_CONFIG_FILE_1" + echo "set -g @plugin 'tmux-plugins/tmux-sensible'" > "$ADDITIONAL_CONFIG_FILE_2" + + script_run_helper "$TPM_DIR/bin/install_plugins" '"tmux-sensible" download success' || + fail_helper "[script][multiple sourced files] plugins installation fails" + + check_dir_exists_helper "$PLUGINS_DIR/tmux-example-plugin/" || + fail_helper "[script][multiple sourced files] plugin download fails (tmux-example-plugin)" + + check_dir_exists_helper "$PLUGINS_DIR/tmux-copycat/" || + fail_helper "[script][multiple sourced files] plugin download fails (tmux-copycat)" + + check_dir_exists_helper "$PLUGINS_DIR/tmux-sensible/" || + fail_helper "[script][multiple sourced files] plugin download fails (tmux-sensible)" + + script_run_helper "$TPM_DIR/bin/install_plugins" 'Already installed "tmux-sensible"' || + fail_helper "[script][multiple sourced files] plugins already installed message fail" + + teardown_helper +} + +run_tests diff --git a/tmux/plugins/tpm/tests/test_plugin_installation_legacy.sh b/tmux/plugins/tpm/tests/test_plugin_installation_legacy.sh new file mode 100755 index 0000000..b1d0cf6 --- /dev/null +++ b/tmux/plugins/tpm/tests/test_plugin_installation_legacy.sh @@ -0,0 +1,100 @@ +#!/usr/bin/env bash + +CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +PLUGINS_DIR="$HOME/.tmux/plugins" +TPM_DIR="$PWD" + +source "$CURRENT_DIR/helpers/helpers.sh" +source "$CURRENT_DIR/helpers/tpm.sh" + +# TMUX KEY-BINDING TESTS + +test_plugin_installation_via_tmux_key_binding() { + set_tmux_conf_helper <<- HERE + set -g mode-keys vi + set -g @tpm_plugins "tmux-plugins/tmux-example-plugin" + run-shell "$TPM_DIR/tpm" + HERE + + # opens tmux and test it with `expect` + $CURRENT_DIR/expect_successful_plugin_download || + fail_helper "[key-binding] plugin installation fails" + + # check plugin dir exists after download + check_dir_exists_helper "$PLUGINS_DIR/tmux-example-plugin/" || + fail_helper "[key-binding] plugin download fails" + + teardown_helper +} + +test_legacy_and_new_syntax_for_plugin_installation_work_via_tmux_key_binding() { + set_tmux_conf_helper <<- HERE + set -g mode-keys vi + set -g @tpm_plugins " \ + tmux-plugins/tmux-example-plugin \ + " + set -g @plugin 'tmux-plugins/tmux-copycat' + run-shell "$TPM_DIR/tpm" + HERE + + # opens tmux and test it with `expect` + "$CURRENT_DIR"/expect_successful_multiple_plugins_download || + fail_helper "[key-binding] multiple plugins installation fails" + + # check plugin dir exists after download + check_dir_exists_helper "$PLUGINS_DIR/tmux-example-plugin/" || + fail_helper "[key-binding] plugin download fails (tmux-example-plugin)" + + check_dir_exists_helper "$PLUGINS_DIR/tmux-copycat/" || + fail_helper "[key-binding] plugin download fails (tmux-copycat)" + + teardown_helper +} + +# SCRIPT TESTS + +test_plugin_installation_via_script() { + set_tmux_conf_helper <<- HERE + set -g mode-keys vi + set -g @tpm_plugins "tmux-plugins/tmux-example-plugin" + run-shell "$TPM_DIR/tpm" + HERE + + script_run_helper "$TPM_DIR/bin/install_plugins" '"tmux-example-plugin" download success' || + fail_helper "[script] plugin installation fails" + + check_dir_exists_helper "$PLUGINS_DIR/tmux-example-plugin/" || + fail_helper "[script] plugin download fails" + + script_run_helper "$TPM_DIR/bin/install_plugins" 'Already installed "tmux-example-plugin"' || + fail_helper "[script] plugin already installed message fail" + + teardown_helper +} + +test_legacy_and_new_syntax_for_plugin_installation_work_via_script() { + set_tmux_conf_helper <<- HERE + set -g mode-keys vi + set -g @tpm_plugins " \ + tmux-plugins/tmux-example-plugin \ + " + set -g @plugin 'tmux-plugins/tmux-copycat' + run-shell "$TPM_DIR/tpm" + HERE + + script_run_helper "$TPM_DIR/bin/install_plugins" '"tmux-example-plugin" download success' || + fail_helper "[script] multiple plugin installation fails" + + check_dir_exists_helper "$PLUGINS_DIR/tmux-example-plugin/" || + fail_helper "[script] plugin download fails (tmux-example-plugin)" + + check_dir_exists_helper "$PLUGINS_DIR/tmux-copycat/" || + fail_helper "[script] plugin download fails (tmux-copycat)" + + script_run_helper "$TPM_DIR/bin/install_plugins" 'Already installed "tmux-copycat"' || + fail_helper "[script] multiple plugins already installed message fail" + + teardown_helper +} + +run_tests diff --git a/tmux/plugins/tpm/tests/test_plugin_sourcing.sh b/tmux/plugins/tpm/tests/test_plugin_sourcing.sh new file mode 100755 index 0000000..c06f1fe --- /dev/null +++ b/tmux/plugins/tpm/tests/test_plugin_sourcing.sh @@ -0,0 +1,78 @@ +#!/usr/bin/env bash + +CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +TPM_DIR="$PWD" +PLUGINS_DIR="$HOME/.tmux/plugins" + +CUSTOM_PLUGINS_DIR="$HOME/foo/plugins" + +source "$CURRENT_DIR/helpers/helpers.sh" +source "$CURRENT_DIR/helpers/tpm.sh" + +check_binding_defined() { + local binding="$1" + tmux list-keys | grep -q "$binding" +} + +create_test_plugin_helper() { + local plugin_path="$PLUGINS_DIR/tmux_test_plugin/" + rm -rf "$plugin_path" + mkdir -p "$plugin_path" + + while read line; do + echo "$line" >> "$plugin_path/test_plugin.tmux" + done + chmod +x "$plugin_path/test_plugin.tmux" +} + +check_tpm_path() { + local correct_tpm_path="$1" + local tpm_path="$(tmux start-server\; show-environment -g TMUX_PLUGIN_MANAGER_PATH | cut -f2 -d=)" + [ "$correct_tpm_path" == "$tpm_path" ] +} + +test_plugin_sourcing() { + set_tmux_conf_helper <<- HERE + set -g mode-keys vi + set -g @plugin "doesnt_matter/tmux_test_plugin" + run-shell "$TPM_DIR/tpm" + HERE + + # manually creates a local tmux plugin + create_test_plugin_helper <<- HERE + tmux bind-key R run-shell foo_command + HERE + + tmux new-session -d # tmux starts detached + check_binding_defined "R run-shell foo_command" || + fail_helper "Plugin sourcing fails" + + teardown_helper +} + +test_default_tpm_path() { + set_tmux_conf_helper <<- HERE + set -g mode-keys vi + run-shell "$TPM_DIR/tpm" + HERE + + check_tpm_path "${PLUGINS_DIR}/" || + fail_helper "Default TPM path not correct" + + teardown_helper +} + +test_custom_tpm_path() { + set_tmux_conf_helper <<- HERE + set -g mode-keys vi + set-environment -g TMUX_PLUGIN_MANAGER_PATH '$CUSTOM_PLUGINS_DIR' + run-shell "$TPM_DIR/tpm" + HERE + + check_tpm_path "$CUSTOM_PLUGINS_DIR" || + fail_helper "Custom TPM path not correct" + + teardown_helper +} + +run_tests diff --git a/tmux/plugins/tpm/tests/test_plugin_update.sh b/tmux/plugins/tpm/tests/test_plugin_update.sh new file mode 100755 index 0000000..4924d16 --- /dev/null +++ b/tmux/plugins/tpm/tests/test_plugin_update.sh @@ -0,0 +1,60 @@ +#!/usr/bin/env bash + +CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +TPM_DIR="$PWD" +PLUGINS_DIR="$HOME/.tmux/plugins" + +source "$CURRENT_DIR/helpers/helpers.sh" +source "$CURRENT_DIR/helpers/tpm.sh" + +manually_install_the_plugin() { + mkdir -p "$PLUGINS_DIR" + cd "$PLUGINS_DIR" + git clone --quiet https://github.com/tmux-plugins/tmux-example-plugin +} + +# TMUX KEY-BINDING TESTS + +test_plugin_update_via_tmux_key_binding() { + set_tmux_conf_helper <<- HERE + set -g mode-keys vi + set -g @plugin "tmux-plugins/tmux-example-plugin" + run-shell "$TPM_DIR/tpm" + HERE + + manually_install_the_plugin + + "$CURRENT_DIR/expect_successful_update_of_all_plugins" || + fail_helper "[key-binding] 'update all plugins' fails" + + "$CURRENT_DIR/expect_successful_update_of_a_single_plugin" || + fail_helper "[key-binding] 'update single plugin' fails" + + teardown_helper +} + +# SCRIPT TESTS + +test_plugin_update_via_script() { + set_tmux_conf_helper <<- HERE + set -g mode-keys vi + set -g @plugin "tmux-plugins/tmux-example-plugin" + run-shell "$TPM_DIR/tpm" + HERE + + manually_install_the_plugin + + local expected_exit_code=1 + script_run_helper "$TPM_DIR/bin/update_plugins" 'usage' "$expected_exit_code" || + fail_helper "[script] running update plugins without args should fail" + + script_run_helper "$TPM_DIR/bin/update_plugins tmux-example-plugin" '"tmux-example-plugin" update success' || + fail_helper "[script] plugin update fails" + + script_run_helper "$TPM_DIR/bin/update_plugins all" '"tmux-example-plugin" update success' || + fail_helper "[script] update all plugins fails" + + teardown_helper +} + +run_tests diff --git a/tmux/plugins/tpm/tpm b/tmux/plugins/tpm/tpm new file mode 100755 index 0000000..570d58b --- /dev/null +++ b/tmux/plugins/tpm/tpm @@ -0,0 +1,72 @@ +#!/usr/bin/env bash + +CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +BINDINGS_DIR="$CURRENT_DIR/bindings" +SCRIPTS_DIR="$CURRENT_DIR/scripts" + +source "$SCRIPTS_DIR/variables.sh" + +get_tmux_option() { + local option="$1" + local default_value="$2" + local option_value="$(tmux show-option -gqv "$option")" + if [ -z "$option_value" ]; then + echo "$default_value" + else + echo "$option_value" + fi +} + +tpm_path_set() { + tmux show-environment -g "$DEFAULT_TPM_ENV_VAR_NAME" >/dev/null 2>&1 +} + +set_default_tpm_path() { + tmux set-environment -g "$DEFAULT_TPM_ENV_VAR_NAME" "$DEFAULT_TPM_PATH" +} + +# Ensures TMUX_PLUGIN_MANAGER_PATH global env variable is set. +# +# Put this in `.tmux.conf` to override the default: +# `set-environment -g TMUX_PLUGIN_MANAGER_PATH "/some/other/path/"` +set_tpm_path() { + if ! tpm_path_set; then + set_default_tpm_path + fi +} + +# 1. Fetches plugin names from `@plugin` variables +# 2. Creates full plugin path +# 3. Sources all *.tmux files from each of the plugin directories +# - no errors raised if directory does not exist +# Files are sourced as tmux config files, not as shell scripts! +source_plugins() { + "$SCRIPTS_DIR/source_plugins.sh" >/dev/null 2>&1 +} + +# prefix + I - downloads TPM plugins and reloads TMUX environment +# prefix + U - updates a plugin (or all of them) and reloads TMUX environment +# prefix + alt + u - remove unused TPM plugins and reloads TMUX environment +set_tpm_key_bindings() { + local install_key="$(get_tmux_option "$install_key_option" "$default_install_key")" + tmux bind-key "$install_key" run-shell "$BINDINGS_DIR/install_plugins" + + local update_key="$(get_tmux_option "$update_key_option" "$default_update_key")" + tmux bind-key "$update_key" run-shell "$BINDINGS_DIR/update_plugins" + + local clean_key="$(get_tmux_option "$clean_key_option" "$default_clean_key")" + tmux bind-key "$clean_key" run-shell "$BINDINGS_DIR/clean_plugins" +} + +supported_tmux_version_ok() { + "$SCRIPTS_DIR/check_tmux_version.sh" "$SUPPORTED_TMUX_VERSION" +} + +main() { + if supported_tmux_version_ok; then + set_tpm_path + set_tpm_key_bindings + source_plugins + fi +} +main diff --git a/tmux/sessions/default.session b/tmux/sessions/default.session new file mode 100644 index 0000000..53dafa2 --- /dev/null +++ b/tmux/sessions/default.session @@ -0,0 +1,4 @@ +new -s User -n Default +neww -n Root sudo -i +selectw -t 1 +selectp -t 1 diff --git a/tmux/sessions/dev.session b/tmux/sessions/dev.session new file mode 100644 index 0000000..fa18a40 --- /dev/null +++ b/tmux/sessions/dev.session @@ -0,0 +1,7 @@ +selectp -t 1 # select the first (0) pane +splitw -h -p 50 # split it into two halves + +selectp -t 2 # select the new, second (1) pane +splitw -v -p 50 # split it into two halves +selectp -t 1 # go back to the first pane + diff --git a/tmux/sessions/log.session b/tmux/sessions/log.session new file mode 100644 index 0000000..2947401 --- /dev/null +++ b/tmux/sessions/log.session @@ -0,0 +1,11 @@ +selectp -t 1 # select the first (1) pane +splitw -v -p 20 sudo journalctl -f # split it into two halves + +selectp -t 1 # select the first (1) pane +splitw -h -p 40 sudo -i # split it into two halves +splitw -v -p 80 + +selectp -t 1 # go back to the first pane + + + diff --git a/tmux/tmux.conf b/tmux/tmux.conf new file mode 100644 index 0000000..59d0049 --- /dev/null +++ b/tmux/tmux.conf @@ -0,0 +1,183 @@ +# Some tweaks to the status line +set -g status-right "%H:%M" +#set -g window-status-current-attr "underscore" + +# If running inside tmux ($TMUX is set), then change the status line to red +%if #{TMUX} +set -g status-bg red +%endif + +# Enable RGB colour if running in xterm(1) +set-option -sa terminal-overrides ",xterm*:Tc" + +# Change the default $TERM to tmux-256color +set -g default-terminal "tmux-256color" + +# No bells at all +set -g bell-action none + +# Keep windows around after they exit +#set -g remain-on-exit on + +######################################################################### +## General Options + +# set first window to index 1 (not 0) to map more to the keyboard layout +set -g base-index 1 +setw -g pane-base-index 1 + +# Automatically set window title +#set-window-option -g automatic-rename on +# this eats probably much cpu, so turn it off +set-window-option -g automatic-rename off +set-window-option -g window-status-current-style bg=yellow +set-option -g set-titles on + +# Default termtype. If the rcfile sets $TERM, that overrides this value. +set -g default-terminal screen-256color + +set -g history-limit 10000 + +# pass through xterm keys +set-option -gw xterm-keys on + +# Watch for activity in background windows +setw -g monitor-activity on +set -g visual-activity on + +######################################################################### +## General Keymap + +# Keep your finger on ctrl, or don't, same result +bind-key C-d detach-client +bind-key C-p paste-buffer + +# Redraw the client (if interrupted by wall, etc) +bind R refresh-client + +# Reload tmux config +unbind r +bind r \ + source-file ~/.tmux.conf \;\ + source-file -q "${HOME}/.tmux.local.conf" \;\ + display 'Reloaded personal tmux config.' + +unbind R +bind R \ + source-file /etc/tmux.conf \;\ + display 'Reloaded general tmux config.' +#bind R source-file /etc/tmux.conf +#bind r source-file ~/.tmux.conf + +# Use vi keybindings in copy and choice modes +#setw -g mode-keys vi +set-window-option -g mode-keys vi +set -g status-keys vi + +########################################################################## +## Window management / navigation + +# Horizontal splits with s or C-s +unbind s +unbind C-s +bind-key s split-window +bind-key C-s split-window + +# Vertical split with v or C-v +unbind v +unbind C-v +bind-key v split-window -h +bind-key C-v split-window -h + +# Alt/Meta M L to switch windows vi-style +bind-key -n M-L next-window +bind-key -n M-H previous-window + +# Resize pane vi-style with Control + Cursorkeys +bind-key -n C-Left resize-pane -L +bind-key -n C-Right resize-pane -R +bind-key -n C-Up resize-pane -U +bind-key -n C-Down resize-pane -D + +# Use Crtl-vim keys without prefix key to switch panes +bind-key -n M-h select-pane -L +bind-key -n M-j select-pane -D +bind-key -n M-k select-pane -U +bind-key -n M-l select-pane -R + +# easily toggle synchronization (mnemonic: e is for echo) +# sends input to all panes in a given window. +bind e setw synchronize-panes on +bind E setw synchronize-panes off + +# No delay for escape key press +set -sg escape-time 0 + +########################################################################### +# THEME +#set -g status-bg black +#set -g status-fg white +#set -g window-status-current-bg white +#set -g window-status-current-fg black +#set -g window-status-current-attr bold +#set -g status-interval 60 +#set -g status-left-length 30 +#set -g status-left '#[fg=green](#S) #(whoami)' +#set -g status-right '#[fg=yellow]#(cut -d " " -f 1-3 /proc/loadavg)#[default] #[fg=white]%H:%M#[default]' + +######################################################################### +## Mouse +# Start copy mode when scrolling up +#bind -n WheelUpPane copy-mode +set -g mouse on +unbind -n MouseDrag1Pane +unbind -Tcopy-mode MouseDrag1Pane + +#set -g mouse-resize-pane on +#set -g mouse-select-pane on +#set -g mouse-select-window on + +bind m set -g mouse on \; display "Mouse ON" +bind M set -g mouse off \; display "Mouse OFF" + +bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'select-pane -t=; copy-mode -e; send-keys -M'" +bind -n WheelDownPane select-pane -t= \; send-keys -M + +# Enable our custom option to exit copy mode when scrolling past bottom +#set-window-option -g exit-copy-past-bottom on + + +## Source local and userfiles ## +#source-file -q "${HOME}/.tmux.conf" +source-file -q "${HOME}/.tmux.local.conf" +#source-file -q "${HOME}/.tmux/initial.conf" + +#source-file "${HOME}/.tmux/themepack/powerline/block/green.tmuxtheme" +set -g @plugin 'jimeh/tmux-themepack' +# Other examples: + + +bind S source-file ~/.tmux/sessions/default.session +bind D source-file ~/.tmux/sessions/dev.session +bind L source-file ~/.tmux/sessions/log.session + +# List of plugins +set -g @plugin 'tmux-plugins/tpm' +set -g @plugin 'tmux-plugins/tmux-sensible' +# set -g @plugin 'github_username/plugin_name' +# set -g @plugin 'git@github.com/user/plugin' +# set -g @plugin 'git@bitbucket.com/user/plugin' +#set -g @plugin 'jimeh/tmux-themepack' +set -g @plugin 'tmux-plugins/tmux-themepack' + +#set -g @themepack 'powerline/block/red' +#source-file "${HOME}/.tmux/plugins/themepack/powerline/block/green.tmuxtheme" +source-file "${HOME}/.tmux/plugins/tmux-themepack/powerline/block/green.tmuxtheme" + +# source local tmux.config +source-file -q "${HOME}/.local/share/tmux/tmux.conf" + +set -g update-environment "SSH_ASKPASS WINDOWID SSH_CONNECTION XAUTHORITY SSH_TTY" + +# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf) +run -b '~/.tmux/plugins/tpm/tpm' diff --git a/vim/autoload/bundle b/vim/autoload/bundle new file mode 120000 index 0000000..ab7374b --- /dev/null +++ b/vim/autoload/bundle @@ -0,0 +1 @@ +../bundle \ No newline at end of file diff --git a/vim/autoload/plug.vim b/vim/autoload/plug.vim new file mode 100644 index 0000000..9ebcf53 --- /dev/null +++ b/vim/autoload/plug.vim @@ -0,0 +1,2504 @@ +" vim-plug: Vim plugin manager +" ============================ +" +" Download plug.vim and put it in ~/.vim/autoload +" +" curl -fLo ~/.vim/autoload/plug.vim --create-dirs \ +" https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim +" +" Edit your .vimrc +" +" call plug#begin('~/.vim/plugged') +" +" " Make sure you use single quotes +" +" " Shorthand notation; fetches https://github.com/junegunn/vim-easy-align +" Plug 'junegunn/vim-easy-align' +" +" " Any valid git URL is allowed +" Plug 'https://github.com/junegunn/vim-github-dashboard.git' +" +" " Multiple Plug commands can be written in a single line using | separators +" Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets' +" +" " On-demand loading +" Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } +" Plug 'tpope/vim-fireplace', { 'for': 'clojure' } +" +" " Using a non-master branch +" Plug 'rdnetto/YCM-Generator', { 'branch': 'stable' } +" +" " Using a tagged release; wildcard allowed (requires git 1.9.2 or above) +" Plug 'fatih/vim-go', { 'tag': '*' } +" +" " Plugin options +" Plug 'nsf/gocode', { 'tag': 'v.20150303', 'rtp': 'vim' } +" +" " Plugin outside ~/.vim/plugged with post-update hook +" Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } +" +" " Unmanaged plugin (manually installed and updated) +" Plug '~/my-prototype-plugin' +" +" " Initialize plugin system +" call plug#end() +" +" Then reload .vimrc and :PlugInstall to install plugins. +" +" Plug options: +" +"| Option | Description | +"| ----------------------- | ------------------------------------------------ | +"| `branch`/`tag`/`commit` | Branch/tag/commit of the repository to use | +"| `rtp` | Subdirectory that contains Vim plugin | +"| `dir` | Custom directory for the plugin | +"| `as` | Use different name for the plugin | +"| `do` | Post-update hook (string or funcref) | +"| `on` | On-demand loading: Commands or ``-mappings | +"| `for` | On-demand loading: File types | +"| `frozen` | Do not update unless explicitly specified | +" +" More information: https://github.com/junegunn/vim-plug +" +" +" Copyright (c) 2017 Junegunn Choi +" +" MIT License +" +" Permission is hereby granted, free of charge, to any person obtaining +" a copy of this software and associated documentation files (the +" "Software"), to deal in the Software without restriction, including +" without limitation the rights to use, copy, modify, merge, publish, +" distribute, sublicense, and/or sell copies of the Software, and to +" permit persons to whom the Software is furnished to do so, subject to +" the following conditions: +" +" The above copyright notice and this permission notice shall be +" included in all copies or substantial portions of the Software. +" +" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +" NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +" LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +" OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +" WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +if exists('g:loaded_plug') + finish +endif +let g:loaded_plug = 1 + +let s:cpo_save = &cpo +set cpo&vim + +let s:plug_src = 'https://github.com/junegunn/vim-plug.git' +let s:plug_tab = get(s:, 'plug_tab', -1) +let s:plug_buf = get(s:, 'plug_buf', -1) +let s:mac_gui = has('gui_macvim') && has('gui_running') +let s:is_win = has('win32') || has('win64') +let s:nvim = has('nvim-0.2') || (has('nvim') && exists('*jobwait') && !s:is_win) +let s:vim8 = has('patch-8.0.0039') && exists('*job_start') +let s:me = resolve(expand(':p')) +let s:base_spec = { 'branch': 'master', 'frozen': 0 } +let s:TYPE = { +\ 'string': type(''), +\ 'list': type([]), +\ 'dict': type({}), +\ 'funcref': type(function('call')) +\ } +let s:loaded = get(s:, 'loaded', {}) +let s:triggers = get(s:, 'triggers', {}) + +function! plug#begin(...) + if a:0 > 0 + let s:plug_home_org = a:1 + let home = s:path(fnamemodify(expand(a:1), ':p')) + elseif exists('g:plug_home') + let home = s:path(g:plug_home) + elseif !empty(&rtp) + let home = s:path(split(&rtp, ',')[0]) . '/plugged' + else + return s:err('Unable to determine plug home. Try calling plug#begin() with a path argument.') + endif + if fnamemodify(home, ':t') ==# 'plugin' && fnamemodify(home, ':h') ==# s:first_rtp + return s:err('Invalid plug home. '.home.' is a standard Vim runtime path and is not allowed.') + endif + + let g:plug_home = home + let g:plugs = {} + let g:plugs_order = [] + let s:triggers = {} + + call s:define_commands() + return 1 +endfunction + +function! s:define_commands() + command! -nargs=+ -bar Plug call plug#() + if !executable('git') + return s:err('`git` executable not found. Most commands will not be available. To suppress this message, prepend `silent!` to `call plug#begin(...)`.') + endif + command! -nargs=* -bar -bang -complete=customlist,s:names PlugInstall call s:install(0, []) + command! -nargs=* -bar -bang -complete=customlist,s:names PlugUpdate call s:update(0, []) + command! -nargs=0 -bar -bang PlugClean call s:clean(0) + command! -nargs=0 -bar PlugUpgrade if s:upgrade() | execute 'source' s:esc(s:me) | endif + command! -nargs=0 -bar PlugStatus call s:status() + command! -nargs=0 -bar PlugDiff call s:diff() + command! -nargs=? -bar -bang -complete=file PlugSnapshot call s:snapshot(0, ) +endfunction + +function! s:to_a(v) + return type(a:v) == s:TYPE.list ? a:v : [a:v] +endfunction + +function! s:to_s(v) + return type(a:v) == s:TYPE.string ? a:v : join(a:v, "\n") . "\n" +endfunction + +function! s:glob(from, pattern) + return s:lines(globpath(a:from, a:pattern)) +endfunction + +function! s:source(from, ...) + let found = 0 + for pattern in a:000 + for vim in s:glob(a:from, pattern) + execute 'source' s:esc(vim) + let found = 1 + endfor + endfor + return found +endfunction + +function! s:assoc(dict, key, val) + let a:dict[a:key] = add(get(a:dict, a:key, []), a:val) +endfunction + +function! s:ask(message, ...) + call inputsave() + echohl WarningMsg + let answer = input(a:message.(a:0 ? ' (y/N/a) ' : ' (y/N) ')) + echohl None + call inputrestore() + echo "\r" + return (a:0 && answer =~? '^a') ? 2 : (answer =~? '^y') ? 1 : 0 +endfunction + +function! s:ask_no_interrupt(...) + try + return call('s:ask', a:000) + catch + return 0 + endtry +endfunction + +function! plug#end() + if !exists('g:plugs') + return s:err('Call plug#begin() first') + endif + + if exists('#PlugLOD') + augroup PlugLOD + autocmd! + augroup END + augroup! PlugLOD + endif + let lod = { 'ft': {}, 'map': {}, 'cmd': {} } + + if exists('g:did_load_filetypes') + filetype off + endif + for name in g:plugs_order + if !has_key(g:plugs, name) + continue + endif + let plug = g:plugs[name] + if get(s:loaded, name, 0) || !has_key(plug, 'on') && !has_key(plug, 'for') + let s:loaded[name] = 1 + continue + endif + + if has_key(plug, 'on') + let s:triggers[name] = { 'map': [], 'cmd': [] } + for cmd in s:to_a(plug.on) + if cmd =~? '^.\+' + if empty(mapcheck(cmd)) && empty(mapcheck(cmd, 'i')) + call s:assoc(lod.map, cmd, name) + endif + call add(s:triggers[name].map, cmd) + elseif cmd =~# '^[A-Z]' + let cmd = substitute(cmd, '!*$', '', '') + if exists(':'.cmd) != 2 + call s:assoc(lod.cmd, cmd, name) + endif + call add(s:triggers[name].cmd, cmd) + else + call s:err('Invalid `on` option: '.cmd. + \ '. Should start with an uppercase letter or ``.') + endif + endfor + endif + + if has_key(plug, 'for') + let types = s:to_a(plug.for) + if !empty(types) + augroup filetypedetect + call s:source(s:rtp(plug), 'ftdetect/**/*.vim', 'after/ftdetect/**/*.vim') + augroup END + endif + for type in types + call s:assoc(lod.ft, type, name) + endfor + endif + endfor + + for [cmd, names] in items(lod.cmd) + execute printf( + \ 'command! -nargs=* -range -bang -complete=file %s call s:lod_cmd(%s, "", , , , %s)', + \ cmd, string(cmd), string(names)) + endfor + + for [map, names] in items(lod.map) + for [mode, map_prefix, key_prefix] in + \ [['i', '', ''], ['n', '', ''], ['v', '', 'gv'], ['o', '', '']] + execute printf( + \ '%snoremap %s %s:call lod_map(%s, %s, %s, "%s")', + \ mode, map, map_prefix, string(map), string(names), mode != 'i', key_prefix) + endfor + endfor + + for [ft, names] in items(lod.ft) + augroup PlugLOD + execute printf('autocmd FileType %s call lod_ft(%s, %s)', + \ ft, string(ft), string(names)) + augroup END + endfor + + call s:reorg_rtp() + filetype plugin indent on + if has('vim_starting') + if has('syntax') && !exists('g:syntax_on') + syntax enable + end + else + call s:reload_plugins() + endif +endfunction + +function! s:loaded_names() + return filter(copy(g:plugs_order), 'get(s:loaded, v:val, 0)') +endfunction + +function! s:load_plugin(spec) + call s:source(s:rtp(a:spec), 'plugin/**/*.vim', 'after/plugin/**/*.vim') +endfunction + +function! s:reload_plugins() + for name in s:loaded_names() + call s:load_plugin(g:plugs[name]) + endfor +endfunction + +function! s:trim(str) + return substitute(a:str, '[\/]\+$', '', '') +endfunction + +function! s:version_requirement(val, min) + for idx in range(0, len(a:min) - 1) + let v = get(a:val, idx, 0) + if v < a:min[idx] | return 0 + elseif v > a:min[idx] | return 1 + endif + endfor + return 1 +endfunction + +function! s:git_version_requirement(...) + if !exists('s:git_version') + let s:git_version = map(split(split(s:system('git --version'))[2], '\.'), 'str2nr(v:val)') + endif + return s:version_requirement(s:git_version, a:000) +endfunction + +function! s:progress_opt(base) + return a:base && !s:is_win && + \ s:git_version_requirement(1, 7, 1) ? '--progress' : '' +endfunction + +if s:is_win + function! s:rtp(spec) + return s:path(a:spec.dir . get(a:spec, 'rtp', '')) + endfunction + + function! s:path(path) + return s:trim(substitute(a:path, '/', '\', 'g')) + endfunction + + function! s:dirpath(path) + return s:path(a:path) . '\' + endfunction + + function! s:is_local_plug(repo) + return a:repo =~? '^[a-z]:\|^[%~]' + endfunction +else + function! s:rtp(spec) + return s:dirpath(a:spec.dir . get(a:spec, 'rtp', '')) + endfunction + + function! s:path(path) + return s:trim(a:path) + endfunction + + function! s:dirpath(path) + return substitute(a:path, '[/\\]*$', '/', '') + endfunction + + function! s:is_local_plug(repo) + return a:repo[0] =~ '[/$~]' + endfunction +endif + +function! s:err(msg) + echohl ErrorMsg + echom '[vim-plug] '.a:msg + echohl None +endfunction + +function! s:warn(cmd, msg) + echohl WarningMsg + execute a:cmd 'a:msg' + echohl None +endfunction + +function! s:esc(path) + return escape(a:path, ' ') +endfunction + +function! s:escrtp(path) + return escape(a:path, ' ,') +endfunction + +function! s:remove_rtp() + for name in s:loaded_names() + let rtp = s:rtp(g:plugs[name]) + execute 'set rtp-='.s:escrtp(rtp) + let after = globpath(rtp, 'after') + if isdirectory(after) + execute 'set rtp-='.s:escrtp(after) + endif + endfor +endfunction + +function! s:reorg_rtp() + if !empty(s:first_rtp) + execute 'set rtp-='.s:first_rtp + execute 'set rtp-='.s:last_rtp + endif + + " &rtp is modified from outside + if exists('s:prtp') && s:prtp !=# &rtp + call s:remove_rtp() + unlet! s:middle + endif + + let s:middle = get(s:, 'middle', &rtp) + let rtps = map(s:loaded_names(), 's:rtp(g:plugs[v:val])') + let afters = filter(map(copy(rtps), 'globpath(v:val, "after")'), '!empty(v:val)') + let rtp = join(map(rtps, 'escape(v:val, ",")'), ',') + \ . ','.s:middle.',' + \ . join(map(afters, 'escape(v:val, ",")'), ',') + let &rtp = substitute(substitute(rtp, ',,*', ',', 'g'), '^,\|,$', '', 'g') + let s:prtp = &rtp + + if !empty(s:first_rtp) + execute 'set rtp^='.s:first_rtp + execute 'set rtp+='.s:last_rtp + endif +endfunction + +function! s:doautocmd(...) + if exists('#'.join(a:000, '#')) + execute 'doautocmd' ((v:version > 703 || has('patch442')) ? '' : '') join(a:000) + endif +endfunction + +function! s:dobufread(names) + for name in a:names + let path = s:rtp(g:plugs[name]).'/**' + for dir in ['ftdetect', 'ftplugin'] + if len(finddir(dir, path)) + if exists('#BufRead') + doautocmd BufRead + endif + return + endif + endfor + endfor +endfunction + +function! plug#load(...) + if a:0 == 0 + return s:err('Argument missing: plugin name(s) required') + endif + if !exists('g:plugs') + return s:err('plug#begin was not called') + endif + let names = a:0 == 1 && type(a:1) == s:TYPE.list ? a:1 : a:000 + let unknowns = filter(copy(names), '!has_key(g:plugs, v:val)') + if !empty(unknowns) + let s = len(unknowns) > 1 ? 's' : '' + return s:err(printf('Unknown plugin%s: %s', s, join(unknowns, ', '))) + end + let unloaded = filter(copy(names), '!get(s:loaded, v:val, 0)') + if !empty(unloaded) + for name in unloaded + call s:lod([name], ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin']) + endfor + call s:dobufread(unloaded) + return 1 + end + return 0 +endfunction + +function! s:remove_triggers(name) + if !has_key(s:triggers, a:name) + return + endif + for cmd in s:triggers[a:name].cmd + execute 'silent! delc' cmd + endfor + for map in s:triggers[a:name].map + execute 'silent! unmap' map + execute 'silent! iunmap' map + endfor + call remove(s:triggers, a:name) +endfunction + +function! s:lod(names, types, ...) + for name in a:names + call s:remove_triggers(name) + let s:loaded[name] = 1 + endfor + call s:reorg_rtp() + + for name in a:names + let rtp = s:rtp(g:plugs[name]) + for dir in a:types + call s:source(rtp, dir.'/**/*.vim') + endfor + if a:0 + if !s:source(rtp, a:1) && !empty(s:glob(rtp, a:2)) + execute 'runtime' a:1 + endif + call s:source(rtp, a:2) + endif + call s:doautocmd('User', name) + endfor +endfunction + +function! s:lod_ft(pat, names) + let syn = 'syntax/'.a:pat.'.vim' + call s:lod(a:names, ['plugin', 'after/plugin'], syn, 'after/'.syn) + execute 'autocmd! PlugLOD FileType' a:pat + call s:doautocmd('filetypeplugin', 'FileType') + call s:doautocmd('filetypeindent', 'FileType') +endfunction + +function! s:lod_cmd(cmd, bang, l1, l2, args, names) + call s:lod(a:names, ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin']) + call s:dobufread(a:names) + execute printf('%s%s%s %s', (a:l1 == a:l2 ? '' : (a:l1.','.a:l2)), a:cmd, a:bang, a:args) +endfunction + +function! s:lod_map(map, names, with_prefix, prefix) + call s:lod(a:names, ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin']) + call s:dobufread(a:names) + let extra = '' + while 1 + let c = getchar(0) + if c == 0 + break + endif + let extra .= nr2char(c) + endwhile + + if a:with_prefix + let prefix = v:count ? v:count : '' + let prefix .= '"'.v:register.a:prefix + if mode(1) == 'no' + if v:operator == 'c' + let prefix = "\" . prefix + endif + let prefix .= v:operator + endif + call feedkeys(prefix, 'n') + endif + call feedkeys(substitute(a:map, '^', "\", '') . extra) +endfunction + +function! plug#(repo, ...) + if a:0 > 1 + return s:err('Invalid number of arguments (1..2)') + endif + + try + let repo = s:trim(a:repo) + let opts = a:0 == 1 ? s:parse_options(a:1) : s:base_spec + let name = get(opts, 'as', fnamemodify(repo, ':t:s?\.git$??')) + let spec = extend(s:infer_properties(name, repo), opts) + if !has_key(g:plugs, name) + call add(g:plugs_order, name) + endif + let g:plugs[name] = spec + let s:loaded[name] = get(s:loaded, name, 0) + catch + return s:err(v:exception) + endtry +endfunction + +function! s:parse_options(arg) + let opts = copy(s:base_spec) + let type = type(a:arg) + if type == s:TYPE.string + let opts.tag = a:arg + elseif type == s:TYPE.dict + call extend(opts, a:arg) + if has_key(opts, 'dir') + let opts.dir = s:dirpath(expand(opts.dir)) + endif + else + throw 'Invalid argument type (expected: string or dictionary)' + endif + return opts +endfunction + +function! s:infer_properties(name, repo) + let repo = a:repo + if s:is_local_plug(repo) + return { 'dir': s:dirpath(expand(repo)) } + else + if repo =~ ':' + let uri = repo + else + if repo !~ '/' + throw printf('Invalid argument: %s (implicit `vim-scripts'' expansion is deprecated)', repo) + endif + let fmt = get(g:, 'plug_url_format', 'https://git::@github.com/%s.git') + let uri = printf(fmt, repo) + endif + return { 'dir': s:dirpath(g:plug_home.'/'.a:name), 'uri': uri } + endif +endfunction + +function! s:install(force, names) + call s:update_impl(0, a:force, a:names) +endfunction + +function! s:update(force, names) + call s:update_impl(1, a:force, a:names) +endfunction + +function! plug#helptags() + if !exists('g:plugs') + return s:err('plug#begin was not called') + endif + for spec in values(g:plugs) + let docd = join([s:rtp(spec), 'doc'], '/') + if isdirectory(docd) + silent! execute 'helptags' s:esc(docd) + endif + endfor + return 1 +endfunction + +function! s:syntax() + syntax clear + syntax region plug1 start=/\%1l/ end=/\%2l/ contains=plugNumber + syntax region plug2 start=/\%2l/ end=/\%3l/ contains=plugBracket,plugX + syn match plugNumber /[0-9]\+[0-9.]*/ contained + syn match plugBracket /[[\]]/ contained + syn match plugX /x/ contained + syn match plugDash /^-/ + syn match plugPlus /^+/ + syn match plugStar /^*/ + syn match plugMessage /\(^- \)\@<=.*/ + syn match plugName /\(^- \)\@<=[^ ]*:/ + syn match plugSha /\%(: \)\@<=[0-9a-f]\{4,}$/ + syn match plugTag /(tag: [^)]\+)/ + syn match plugInstall /\(^+ \)\@<=[^:]*/ + syn match plugUpdate /\(^* \)\@<=[^:]*/ + syn match plugCommit /^ \X*[0-9a-f]\{7,9} .*/ contains=plugRelDate,plugEdge,plugTag + syn match plugEdge /^ \X\+$/ + syn match plugEdge /^ \X*/ contained nextgroup=plugSha + syn match plugSha /[0-9a-f]\{7,9}/ contained + syn match plugRelDate /([^)]*)$/ contained + syn match plugNotLoaded /(not loaded)$/ + syn match plugError /^x.*/ + syn region plugDeleted start=/^\~ .*/ end=/^\ze\S/ + syn match plugH2 /^.*:\n-\+$/ + syn keyword Function PlugInstall PlugStatus PlugUpdate PlugClean + hi def link plug1 Title + hi def link plug2 Repeat + hi def link plugH2 Type + hi def link plugX Exception + hi def link plugBracket Structure + hi def link plugNumber Number + + hi def link plugDash Special + hi def link plugPlus Constant + hi def link plugStar Boolean + + hi def link plugMessage Function + hi def link plugName Label + hi def link plugInstall Function + hi def link plugUpdate Type + + hi def link plugError Error + hi def link plugDeleted Ignore + hi def link plugRelDate Comment + hi def link plugEdge PreProc + hi def link plugSha Identifier + hi def link plugTag Constant + + hi def link plugNotLoaded Comment +endfunction + +function! s:lpad(str, len) + return a:str . repeat(' ', a:len - len(a:str)) +endfunction + +function! s:lines(msg) + return split(a:msg, "[\r\n]") +endfunction + +function! s:lastline(msg) + return get(s:lines(a:msg), -1, '') +endfunction + +function! s:new_window() + execute get(g:, 'plug_window', 'vertical topleft new') +endfunction + +function! s:plug_window_exists() + let buflist = tabpagebuflist(s:plug_tab) + return !empty(buflist) && index(buflist, s:plug_buf) >= 0 +endfunction + +function! s:switch_in() + if !s:plug_window_exists() + return 0 + endif + + if winbufnr(0) != s:plug_buf + let s:pos = [tabpagenr(), winnr(), winsaveview()] + execute 'normal!' s:plug_tab.'gt' + let winnr = bufwinnr(s:plug_buf) + execute winnr.'wincmd w' + call add(s:pos, winsaveview()) + else + let s:pos = [winsaveview()] + endif + + setlocal modifiable + return 1 +endfunction + +function! s:switch_out(...) + call winrestview(s:pos[-1]) + setlocal nomodifiable + if a:0 > 0 + execute a:1 + endif + + if len(s:pos) > 1 + execute 'normal!' s:pos[0].'gt' + execute s:pos[1] 'wincmd w' + call winrestview(s:pos[2]) + endif +endfunction + +function! s:finish_bindings() + nnoremap R :call retry() + nnoremap D :PlugDiff + nnoremap S :PlugStatus + nnoremap U :call status_update() + xnoremap U :call status_update() + nnoremap ]] :silent! call section('') + nnoremap [[ :silent! call section('b') +endfunction + +function! s:prepare(...) + if empty(getcwd()) + throw 'Invalid current working directory. Cannot proceed.' + endif + + for evar in ['$GIT_DIR', '$GIT_WORK_TREE'] + if exists(evar) + throw evar.' detected. Cannot proceed.' + endif + endfor + + call s:job_abort() + if s:switch_in() + if b:plug_preview == 1 + pc + endif + enew + else + call s:new_window() + endif + + nnoremap q :if b:plug_preview==1pcendifbd + if a:0 == 0 + call s:finish_bindings() + endif + let b:plug_preview = -1 + let s:plug_tab = tabpagenr() + let s:plug_buf = winbufnr(0) + call s:assign_name() + + for k in ['', 'L', 'o', 'X', 'd', 'dd'] + execute 'silent! unmap ' k + endfor + setlocal buftype=nofile bufhidden=wipe nobuflisted nolist noswapfile nowrap cursorline modifiable nospell + setf vim-plug + if exists('g:syntax_on') + call s:syntax() + endif +endfunction + +function! s:assign_name() + " Assign buffer name + let prefix = '[Plugins]' + let name = prefix + let idx = 2 + while bufexists(name) + let name = printf('%s (%s)', prefix, idx) + let idx = idx + 1 + endwhile + silent! execute 'f' fnameescape(name) +endfunction + +function! s:chsh(swap) + let prev = [&shell, &shellcmdflag, &shellredir] + if s:is_win + set shell=cmd.exe shellcmdflag=/c shellredir=>%s\ 2>&1 + elseif a:swap + set shell=sh shellredir=>%s\ 2>&1 + endif + return prev +endfunction + +function! s:bang(cmd, ...) + try + let [sh, shellcmdflag, shrd] = s:chsh(a:0) + " FIXME: Escaping is incomplete. We could use shellescape with eval, + " but it won't work on Windows. + let cmd = a:0 ? s:with_cd(a:cmd, a:1) : a:cmd + if s:is_win + let batchfile = tempname().'.bat' + call writefile(['@echo off', cmd], batchfile) + let cmd = batchfile + endif + let g:_plug_bang = (s:is_win && has('gui_running') ? 'silent ' : '').'!'.escape(cmd, '#!%') + execute "normal! :execute g:_plug_bang\\" + finally + unlet g:_plug_bang + let [&shell, &shellcmdflag, &shellredir] = [sh, shellcmdflag, shrd] + if s:is_win + call delete(batchfile) + endif + endtry + return v:shell_error ? 'Exit status: ' . v:shell_error : '' +endfunction + +function! s:regress_bar() + let bar = substitute(getline(2)[1:-2], '.*\zs=', 'x', '') + call s:progress_bar(2, bar, len(bar)) +endfunction + +function! s:is_updated(dir) + return !empty(s:system_chomp('git log --pretty=format:"%h" "HEAD...HEAD@{1}"', a:dir)) +endfunction + +function! s:do(pull, force, todo) + for [name, spec] in items(a:todo) + if !isdirectory(spec.dir) + continue + endif + let installed = has_key(s:update.new, name) + let updated = installed ? 0 : + \ (a:pull && index(s:update.errors, name) < 0 && s:is_updated(spec.dir)) + if a:force || installed || updated + execute 'cd' s:esc(spec.dir) + call append(3, '- Post-update hook for '. name .' ... ') + let error = '' + let type = type(spec.do) + if type == s:TYPE.string + if spec.do[0] == ':' + if !get(s:loaded, name, 0) + let s:loaded[name] = 1 + call s:reorg_rtp() + endif + call s:load_plugin(spec) + try + execute spec.do[1:] + catch + let error = v:exception + endtry + if !s:plug_window_exists() + cd - + throw 'Warning: vim-plug was terminated by the post-update hook of '.name + endif + else + let error = s:bang(spec.do) + endif + elseif type == s:TYPE.funcref + try + let status = installed ? 'installed' : (updated ? 'updated' : 'unchanged') + call spec.do({ 'name': name, 'status': status, 'force': a:force }) + catch + let error = v:exception + endtry + else + let error = 'Invalid hook type' + endif + call s:switch_in() + call setline(4, empty(error) ? (getline(4) . 'OK') + \ : ('x' . getline(4)[1:] . error)) + if !empty(error) + call add(s:update.errors, name) + call s:regress_bar() + endif + cd - + endif + endfor +endfunction + +function! s:hash_match(a, b) + return stridx(a:a, a:b) == 0 || stridx(a:b, a:a) == 0 +endfunction + +function! s:checkout(spec) + let sha = a:spec.commit + let output = s:system('git rev-parse HEAD', a:spec.dir) + if !v:shell_error && !s:hash_match(sha, s:lines(output)[0]) + let output = s:system( + \ 'git fetch --depth 999999 && git checkout '.s:esc(sha).' --', a:spec.dir) + endif + return output +endfunction + +function! s:finish(pull) + let new_frozen = len(filter(keys(s:update.new), 'g:plugs[v:val].frozen')) + if new_frozen + let s = new_frozen > 1 ? 's' : '' + call append(3, printf('- Installed %d frozen plugin%s', new_frozen, s)) + endif + call append(3, '- Finishing ... ') | 4 + redraw + call plug#helptags() + call plug#end() + call setline(4, getline(4) . 'Done!') + redraw + let msgs = [] + if !empty(s:update.errors) + call add(msgs, "Press 'R' to retry.") + endif + if a:pull && len(s:update.new) < len(filter(getline(5, '$'), + \ "v:val =~ '^- ' && v:val !~# 'Already up.to.date'")) + call add(msgs, "Press 'D' to see the updated changes.") + endif + echo join(msgs, ' ') + call s:finish_bindings() +endfunction + +function! s:retry() + if empty(s:update.errors) + return + endif + echo + call s:update_impl(s:update.pull, s:update.force, + \ extend(copy(s:update.errors), [s:update.threads])) +endfunction + +function! s:is_managed(name) + return has_key(g:plugs[a:name], 'uri') +endfunction + +function! s:names(...) + return sort(filter(keys(g:plugs), 'stridx(v:val, a:1) == 0 && s:is_managed(v:val)')) +endfunction + +function! s:check_ruby() + silent! ruby require 'thread'; VIM::command("let g:plug_ruby = '#{RUBY_VERSION}'") + if !exists('g:plug_ruby') + redraw! + return s:warn('echom', 'Warning: Ruby interface is broken') + endif + let ruby_version = split(g:plug_ruby, '\.') + unlet g:plug_ruby + return s:version_requirement(ruby_version, [1, 8, 7]) +endfunction + +function! s:update_impl(pull, force, args) abort + let sync = index(a:args, '--sync') >= 0 || has('vim_starting') + let args = filter(copy(a:args), 'v:val != "--sync"') + let threads = (len(args) > 0 && args[-1] =~ '^[1-9][0-9]*$') ? + \ remove(args, -1) : get(g:, 'plug_threads', 16) + + let managed = filter(copy(g:plugs), 's:is_managed(v:key)') + let todo = empty(args) ? filter(managed, '!v:val.frozen || !isdirectory(v:val.dir)') : + \ filter(managed, 'index(args, v:key) >= 0') + + if empty(todo) + return s:warn('echo', 'No plugin to '. (a:pull ? 'update' : 'install')) + endif + + if !s:is_win && s:git_version_requirement(2, 3) + let s:git_terminal_prompt = exists('$GIT_TERMINAL_PROMPT') ? $GIT_TERMINAL_PROMPT : '' + let $GIT_TERMINAL_PROMPT = 0 + for plug in values(todo) + let plug.uri = substitute(plug.uri, + \ '^https://git::@github\.com', 'https://github.com', '') + endfor + endif + + if !isdirectory(g:plug_home) + try + call mkdir(g:plug_home, 'p') + catch + return s:err(printf('Invalid plug directory: %s. '. + \ 'Try to call plug#begin with a valid directory', g:plug_home)) + endtry + endif + + if has('nvim') && !exists('*jobwait') && threads > 1 + call s:warn('echom', '[vim-plug] Update Neovim for parallel installer') + endif + + let use_job = s:nvim || s:vim8 + let python = (has('python') || has('python3')) && !use_job + let ruby = has('ruby') && !use_job && (v:version >= 703 || v:version == 702 && has('patch374')) && !(s:is_win && has('gui_running')) && threads > 1 && s:check_ruby() + + let s:update = { + \ 'start': reltime(), + \ 'all': todo, + \ 'todo': copy(todo), + \ 'errors': [], + \ 'pull': a:pull, + \ 'force': a:force, + \ 'new': {}, + \ 'threads': (python || ruby || use_job) ? min([len(todo), threads]) : 1, + \ 'bar': '', + \ 'fin': 0 + \ } + + call s:prepare(1) + call append(0, ['', '']) + normal! 2G + silent! redraw + + let s:clone_opt = get(g:, 'plug_shallow', 1) ? + \ '--depth 1' . (s:git_version_requirement(1, 7, 10) ? ' --no-single-branch' : '') : '' + + if has('win32unix') + let s:clone_opt .= ' -c core.eol=lf -c core.autocrlf=input' + endif + + " Python version requirement (>= 2.7) + if python && !has('python3') && !ruby && !use_job && s:update.threads > 1 + redir => pyv + silent python import platform; print platform.python_version() + redir END + let python = s:version_requirement( + \ map(split(split(pyv)[0], '\.'), 'str2nr(v:val)'), [2, 6]) + endif + + if (python || ruby) && s:update.threads > 1 + try + let imd = &imd + if s:mac_gui + set noimd + endif + if ruby + call s:update_ruby() + else + call s:update_python() + endif + catch + let lines = getline(4, '$') + let printed = {} + silent! 4,$d _ + for line in lines + let name = s:extract_name(line, '.', '') + if empty(name) || !has_key(printed, name) + call append('$', line) + if !empty(name) + let printed[name] = 1 + if line[0] == 'x' && index(s:update.errors, name) < 0 + call add(s:update.errors, name) + end + endif + endif + endfor + finally + let &imd = imd + call s:update_finish() + endtry + else + call s:update_vim() + while use_job && sync + sleep 100m + if s:update.fin + break + endif + endwhile + endif +endfunction + +function! s:log4(name, msg) + call setline(4, printf('- %s (%s)', a:msg, a:name)) + redraw +endfunction + +function! s:update_finish() + if exists('s:git_terminal_prompt') + let $GIT_TERMINAL_PROMPT = s:git_terminal_prompt + endif + if s:switch_in() + call append(3, '- Updating ...') | 4 + for [name, spec] in items(filter(copy(s:update.all), 'index(s:update.errors, v:key) < 0 && (s:update.force || s:update.pull || has_key(s:update.new, v:key))')) + let [pos, _] = s:logpos(name) + if !pos + continue + endif + if has_key(spec, 'commit') + call s:log4(name, 'Checking out '.spec.commit) + let out = s:checkout(spec) + elseif has_key(spec, 'tag') + let tag = spec.tag + if tag =~ '\*' + let tags = s:lines(s:system('git tag --list '.s:shellesc(tag).' --sort -version:refname 2>&1', spec.dir)) + if !v:shell_error && !empty(tags) + let tag = tags[0] + call s:log4(name, printf('Latest tag for %s -> %s', spec.tag, tag)) + call append(3, '') + endif + endif + call s:log4(name, 'Checking out '.tag) + let out = s:system('git checkout -q '.s:esc(tag).' -- 2>&1', spec.dir) + else + let branch = s:esc(get(spec, 'branch', 'master')) + call s:log4(name, 'Merging origin/'.branch) + let out = s:system('git checkout -q '.branch.' -- 2>&1' + \. (has_key(s:update.new, name) ? '' : ('&& git merge --ff-only origin/'.branch.' 2>&1')), spec.dir) + endif + if !v:shell_error && filereadable(spec.dir.'/.gitmodules') && + \ (s:update.force || has_key(s:update.new, name) || s:is_updated(spec.dir)) + call s:log4(name, 'Updating submodules. This may take a while.') + let out .= s:bang('git submodule update --init --recursive 2>&1', spec.dir) + endif + let msg = s:format_message(v:shell_error ? 'x': '-', name, out) + if v:shell_error + call add(s:update.errors, name) + call s:regress_bar() + silent execute pos 'd _' + call append(4, msg) | 4 + elseif !empty(out) + call setline(pos, msg[0]) + endif + redraw + endfor + silent 4 d _ + try + call s:do(s:update.pull, s:update.force, filter(copy(s:update.all), 'index(s:update.errors, v:key) < 0 && has_key(v:val, "do")')) + catch + call s:warn('echom', v:exception) + call s:warn('echo', '') + return + endtry + call s:finish(s:update.pull) + call setline(1, 'Updated. Elapsed time: ' . split(reltimestr(reltime(s:update.start)))[0] . ' sec.') + call s:switch_out('normal! gg') + endif +endfunction + +function! s:job_abort() + if (!s:nvim && !s:vim8) || !exists('s:jobs') + return + endif + + for [name, j] in items(s:jobs) + if s:nvim + silent! call jobstop(j.jobid) + elseif s:vim8 + silent! call job_stop(j.jobid) + endif + if j.new + call s:system('rm -rf ' . s:shellesc(g:plugs[name].dir)) + endif + endfor + let s:jobs = {} +endfunction + +function! s:last_non_empty_line(lines) + let len = len(a:lines) + for idx in range(len) + let line = a:lines[len-idx-1] + if !empty(line) + return line + endif + endfor + return '' +endfunction + +function! s:job_out_cb(self, data) abort + let self = a:self + let data = remove(self.lines, -1) . a:data + let lines = map(split(data, "\n", 1), 'split(v:val, "\r", 1)[-1]') + call extend(self.lines, lines) + " To reduce the number of buffer updates + let self.tick = get(self, 'tick', -1) + 1 + if !self.running || self.tick % len(s:jobs) == 0 + let bullet = self.running ? (self.new ? '+' : '*') : (self.error ? 'x' : '-') + let result = self.error ? join(self.lines, "\n") : s:last_non_empty_line(self.lines) + call s:log(bullet, self.name, result) + endif +endfunction + +function! s:job_exit_cb(self, data) abort + let a:self.running = 0 + let a:self.error = a:data != 0 + call s:reap(a:self.name) + call s:tick() +endfunction + +function! s:job_cb(fn, job, ch, data) + if !s:plug_window_exists() " plug window closed + return s:job_abort() + endif + call call(a:fn, [a:job, a:data]) +endfunction + +function! s:nvim_cb(job_id, data, event) dict abort + return a:event == 'stdout' ? + \ s:job_cb('s:job_out_cb', self, 0, join(a:data, "\n")) : + \ s:job_cb('s:job_exit_cb', self, 0, a:data) +endfunction + +function! s:spawn(name, cmd, opts) + let job = { 'name': a:name, 'running': 1, 'error': 0, 'lines': [''], + \ 'batchfile': (s:is_win && (s:nvim || s:vim8)) ? tempname().'.bat' : '', + \ 'new': get(a:opts, 'new', 0) } + let s:jobs[a:name] = job + let cmd = has_key(a:opts, 'dir') ? s:with_cd(a:cmd, a:opts.dir) : a:cmd + if !empty(job.batchfile) + call writefile(['@echo off', cmd], job.batchfile) + let cmd = job.batchfile + endif + let argv = add(s:is_win ? ['cmd', '/c'] : ['sh', '-c'], cmd) + + if s:nvim + call extend(job, { + \ 'on_stdout': function('s:nvim_cb'), + \ 'on_exit': function('s:nvim_cb'), + \ }) + let jid = jobstart(argv, job) + if jid > 0 + let job.jobid = jid + else + let job.running = 0 + let job.error = 1 + let job.lines = [jid < 0 ? argv[0].' is not executable' : + \ 'Invalid arguments (or job table is full)'] + endif + elseif s:vim8 + let jid = job_start(s:is_win ? join(argv, ' ') : argv, { + \ 'out_cb': function('s:job_cb', ['s:job_out_cb', job]), + \ 'exit_cb': function('s:job_cb', ['s:job_exit_cb', job]), + \ 'out_mode': 'raw' + \}) + if job_status(jid) == 'run' + let job.jobid = jid + else + let job.running = 0 + let job.error = 1 + let job.lines = ['Failed to start job'] + endif + else + let job.lines = s:lines(call('s:system', [cmd])) + let job.error = v:shell_error != 0 + let job.running = 0 + endif +endfunction + +function! s:reap(name) + let job = s:jobs[a:name] + if job.error + call add(s:update.errors, a:name) + elseif get(job, 'new', 0) + let s:update.new[a:name] = 1 + endif + let s:update.bar .= job.error ? 'x' : '=' + + let bullet = job.error ? 'x' : '-' + let result = job.error ? join(job.lines, "\n") : s:last_non_empty_line(job.lines) + call s:log(bullet, a:name, empty(result) ? 'OK' : result) + call s:bar() + + if has_key(job, 'batchfile') && !empty(job.batchfile) + call delete(job.batchfile) + endif + call remove(s:jobs, a:name) +endfunction + +function! s:bar() + if s:switch_in() + let total = len(s:update.all) + call setline(1, (s:update.pull ? 'Updating' : 'Installing'). + \ ' plugins ('.len(s:update.bar).'/'.total.')') + call s:progress_bar(2, s:update.bar, total) + call s:switch_out() + endif +endfunction + +function! s:logpos(name) + for i in range(4, line('$')) + if getline(i) =~# '^[-+x*] '.a:name.':' + for j in range(i + 1, line('$')) + if getline(j) !~ '^ ' + return [i, j - 1] + endif + endfor + return [i, i] + endif + endfor + return [0, 0] +endfunction + +function! s:log(bullet, name, lines) + if s:switch_in() + let [b, e] = s:logpos(a:name) + if b > 0 + silent execute printf('%d,%d d _', b, e) + if b > winheight('.') + let b = 4 + endif + else + let b = 4 + endif + " FIXME For some reason, nomodifiable is set after :d in vim8 + setlocal modifiable + call append(b - 1, s:format_message(a:bullet, a:name, a:lines)) + call s:switch_out() + endif +endfunction + +function! s:update_vim() + let s:jobs = {} + + call s:bar() + call s:tick() +endfunction + +function! s:tick() + let pull = s:update.pull + let prog = s:progress_opt(s:nvim || s:vim8) +while 1 " Without TCO, Vim stack is bound to explode + if empty(s:update.todo) + if empty(s:jobs) && !s:update.fin + call s:update_finish() + let s:update.fin = 1 + endif + return + endif + + let name = keys(s:update.todo)[0] + let spec = remove(s:update.todo, name) + let new = !isdirectory(spec.dir) + + call s:log(new ? '+' : '*', name, pull ? 'Updating ...' : 'Installing ...') + redraw + + let has_tag = has_key(spec, 'tag') + if !new + let [error, _] = s:git_validate(spec, 0) + if empty(error) + if pull + let fetch_opt = (has_tag && !empty(globpath(spec.dir, '.git/shallow'))) ? '--depth 99999999' : '' + call s:spawn(name, printf('git fetch %s %s 2>&1', fetch_opt, prog), { 'dir': spec.dir }) + else + let s:jobs[name] = { 'running': 0, 'lines': ['Already installed'], 'error': 0 } + endif + else + let s:jobs[name] = { 'running': 0, 'lines': s:lines(error), 'error': 1 } + endif + else + call s:spawn(name, + \ printf('git clone %s %s %s %s 2>&1', + \ has_tag ? '' : s:clone_opt, + \ prog, + \ s:shellesc(spec.uri), + \ s:shellesc(s:trim(spec.dir))), { 'new': 1 }) + endif + + if !s:jobs[name].running + call s:reap(name) + endif + if len(s:jobs) >= s:update.threads + break + endif +endwhile +endfunction + +function! s:update_python() +let py_exe = has('python') ? 'python' : 'python3' +execute py_exe "<< EOF" +import datetime +import functools +import os +try: + import queue +except ImportError: + import Queue as queue +import random +import re +import shutil +import signal +import subprocess +import tempfile +import threading as thr +import time +import traceback +import vim + +G_NVIM = vim.eval("has('nvim')") == '1' +G_PULL = vim.eval('s:update.pull') == '1' +G_RETRIES = int(vim.eval('get(g:, "plug_retries", 2)')) + 1 +G_TIMEOUT = int(vim.eval('get(g:, "plug_timeout", 60)')) +G_CLONE_OPT = vim.eval('s:clone_opt') +G_PROGRESS = vim.eval('s:progress_opt(1)') +G_LOG_PROB = 1.0 / int(vim.eval('s:update.threads')) +G_STOP = thr.Event() +G_IS_WIN = vim.eval('s:is_win') == '1' + +class PlugError(Exception): + def __init__(self, msg): + self.msg = msg +class CmdTimedOut(PlugError): + pass +class CmdFailed(PlugError): + pass +class InvalidURI(PlugError): + pass +class Action(object): + INSTALL, UPDATE, ERROR, DONE = ['+', '*', 'x', '-'] + +class Buffer(object): + def __init__(self, lock, num_plugs, is_pull): + self.bar = '' + self.event = 'Updating' if is_pull else 'Installing' + self.lock = lock + self.maxy = int(vim.eval('winheight(".")')) + self.num_plugs = num_plugs + + def __where(self, name): + """ Find first line with name in current buffer. Return line num. """ + found, lnum = False, 0 + matcher = re.compile('^[-+x*] {0}:'.format(name)) + for line in vim.current.buffer: + if matcher.search(line) is not None: + found = True + break + lnum += 1 + + if not found: + lnum = -1 + return lnum + + def header(self): + curbuf = vim.current.buffer + curbuf[0] = self.event + ' plugins ({0}/{1})'.format(len(self.bar), self.num_plugs) + + num_spaces = self.num_plugs - len(self.bar) + curbuf[1] = '[{0}{1}]'.format(self.bar, num_spaces * ' ') + + with self.lock: + vim.command('normal! 2G') + vim.command('redraw') + + def write(self, action, name, lines): + first, rest = lines[0], lines[1:] + msg = ['{0} {1}{2}{3}'.format(action, name, ': ' if first else '', first)] + msg.extend([' ' + line for line in rest]) + + try: + if action == Action.ERROR: + self.bar += 'x' + vim.command("call add(s:update.errors, '{0}')".format(name)) + elif action == Action.DONE: + self.bar += '=' + + curbuf = vim.current.buffer + lnum = self.__where(name) + if lnum != -1: # Found matching line num + del curbuf[lnum] + if lnum > self.maxy and action in set([Action.INSTALL, Action.UPDATE]): + lnum = 3 + else: + lnum = 3 + curbuf.append(msg, lnum) + + self.header() + except vim.error: + pass + +class Command(object): + CD = 'cd /d' if G_IS_WIN else 'cd' + + def __init__(self, cmd, cmd_dir=None, timeout=60, cb=None, clean=None): + self.cmd = cmd + if cmd_dir: + self.cmd = '{0} {1} && {2}'.format(Command.CD, cmd_dir, self.cmd) + self.timeout = timeout + self.callback = cb if cb else (lambda msg: None) + self.clean = clean if clean else (lambda: None) + self.proc = None + + @property + def alive(self): + """ Returns true only if command still running. """ + return self.proc and self.proc.poll() is None + + def execute(self, ntries=3): + """ Execute the command with ntries if CmdTimedOut. + Returns the output of the command if no Exception. + """ + attempt, finished, limit = 0, False, self.timeout + + while not finished: + try: + attempt += 1 + result = self.try_command() + finished = True + return result + except CmdTimedOut: + if attempt != ntries: + self.notify_retry() + self.timeout += limit + else: + raise + + def notify_retry(self): + """ Retry required for command, notify user. """ + for count in range(3, 0, -1): + if G_STOP.is_set(): + raise KeyboardInterrupt + msg = 'Timeout. Will retry in {0} second{1} ...'.format( + count, 's' if count != 1 else '') + self.callback([msg]) + time.sleep(1) + self.callback(['Retrying ...']) + + def try_command(self): + """ Execute a cmd & poll for callback. Returns list of output. + Raises CmdFailed -> return code for Popen isn't 0 + Raises CmdTimedOut -> command exceeded timeout without new output + """ + first_line = True + + try: + tfile = tempfile.NamedTemporaryFile(mode='w+b') + preexec_fn = not G_IS_WIN and os.setsid or None + self.proc = subprocess.Popen(self.cmd, stdout=tfile, + stderr=subprocess.STDOUT, + stdin=subprocess.PIPE, shell=True, + preexec_fn=preexec_fn) + thrd = thr.Thread(target=(lambda proc: proc.wait()), args=(self.proc,)) + thrd.start() + + thread_not_started = True + while thread_not_started: + try: + thrd.join(0.1) + thread_not_started = False + except RuntimeError: + pass + + while self.alive: + if G_STOP.is_set(): + raise KeyboardInterrupt + + if first_line or random.random() < G_LOG_PROB: + first_line = False + line = '' if G_IS_WIN else nonblock_read(tfile.name) + if line: + self.callback([line]) + + time_diff = time.time() - os.path.getmtime(tfile.name) + if time_diff > self.timeout: + raise CmdTimedOut(['Timeout!']) + + thrd.join(0.5) + + tfile.seek(0) + result = [line.decode('utf-8', 'replace').rstrip() for line in tfile] + + if self.proc.returncode != 0: + raise CmdFailed([''] + result) + + return result + except: + self.terminate() + raise + + def terminate(self): + """ Terminate process and cleanup. """ + if self.alive: + if G_IS_WIN: + os.kill(self.proc.pid, signal.SIGINT) + else: + os.killpg(self.proc.pid, signal.SIGTERM) + self.clean() + +class Plugin(object): + def __init__(self, name, args, buf_q, lock): + self.name = name + self.args = args + self.buf_q = buf_q + self.lock = lock + self.tag = args.get('tag', 0) + + def manage(self): + try: + if os.path.exists(self.args['dir']): + self.update() + else: + self.install() + with self.lock: + thread_vim_command("let s:update.new['{0}'] = 1".format(self.name)) + except PlugError as exc: + self.write(Action.ERROR, self.name, exc.msg) + except KeyboardInterrupt: + G_STOP.set() + self.write(Action.ERROR, self.name, ['Interrupted!']) + except: + # Any exception except those above print stack trace + msg = 'Trace:\n{0}'.format(traceback.format_exc().rstrip()) + self.write(Action.ERROR, self.name, msg.split('\n')) + raise + + def install(self): + target = self.args['dir'] + if target[-1] == '\\': + target = target[0:-1] + + def clean(target): + def _clean(): + try: + shutil.rmtree(target) + except OSError: + pass + return _clean + + self.write(Action.INSTALL, self.name, ['Installing ...']) + callback = functools.partial(self.write, Action.INSTALL, self.name) + cmd = 'git clone {0} {1} {2} {3} 2>&1'.format( + '' if self.tag else G_CLONE_OPT, G_PROGRESS, self.args['uri'], + esc(target)) + com = Command(cmd, None, G_TIMEOUT, callback, clean(target)) + result = com.execute(G_RETRIES) + self.write(Action.DONE, self.name, result[-1:]) + + def repo_uri(self): + cmd = 'git rev-parse --abbrev-ref HEAD 2>&1 && git config -f .git/config remote.origin.url' + command = Command(cmd, self.args['dir'], G_TIMEOUT,) + result = command.execute(G_RETRIES) + return result[-1] + + def update(self): + actual_uri = self.repo_uri() + expect_uri = self.args['uri'] + regex = re.compile(r'^(?:\w+://)?(?:[^@/]*@)?([^:/]*(?::[0-9]*)?)[:/](.*?)(?:\.git)?/?$') + ma = regex.match(actual_uri) + mb = regex.match(expect_uri) + if ma is None or mb is None or ma.groups() != mb.groups(): + msg = ['', + 'Invalid URI: {0}'.format(actual_uri), + 'Expected {0}'.format(expect_uri), + 'PlugClean required.'] + raise InvalidURI(msg) + + if G_PULL: + self.write(Action.UPDATE, self.name, ['Updating ...']) + callback = functools.partial(self.write, Action.UPDATE, self.name) + fetch_opt = '--depth 99999999' if self.tag and os.path.isfile(os.path.join(self.args['dir'], '.git/shallow')) else '' + cmd = 'git fetch {0} {1} 2>&1'.format(fetch_opt, G_PROGRESS) + com = Command(cmd, self.args['dir'], G_TIMEOUT, callback) + result = com.execute(G_RETRIES) + self.write(Action.DONE, self.name, result[-1:]) + else: + self.write(Action.DONE, self.name, ['Already installed']) + + def write(self, action, name, msg): + self.buf_q.put((action, name, msg)) + +class PlugThread(thr.Thread): + def __init__(self, tname, args): + super(PlugThread, self).__init__() + self.tname = tname + self.args = args + + def run(self): + thr.current_thread().name = self.tname + buf_q, work_q, lock = self.args + + try: + while not G_STOP.is_set(): + name, args = work_q.get_nowait() + plug = Plugin(name, args, buf_q, lock) + plug.manage() + work_q.task_done() + except queue.Empty: + pass + +class RefreshThread(thr.Thread): + def __init__(self, lock): + super(RefreshThread, self).__init__() + self.lock = lock + self.running = True + + def run(self): + while self.running: + with self.lock: + thread_vim_command('noautocmd normal! a') + time.sleep(0.33) + + def stop(self): + self.running = False + +if G_NVIM: + def thread_vim_command(cmd): + vim.session.threadsafe_call(lambda: vim.command(cmd)) +else: + def thread_vim_command(cmd): + vim.command(cmd) + +def esc(name): + return '"' + name.replace('"', '\"') + '"' + +def nonblock_read(fname): + """ Read a file with nonblock flag. Return the last line. """ + fread = os.open(fname, os.O_RDONLY | os.O_NONBLOCK) + buf = os.read(fread, 100000).decode('utf-8', 'replace') + os.close(fread) + + line = buf.rstrip('\r\n') + left = max(line.rfind('\r'), line.rfind('\n')) + if left != -1: + left += 1 + line = line[left:] + + return line + +def main(): + thr.current_thread().name = 'main' + nthreads = int(vim.eval('s:update.threads')) + plugs = vim.eval('s:update.todo') + mac_gui = vim.eval('s:mac_gui') == '1' + + lock = thr.Lock() + buf = Buffer(lock, len(plugs), G_PULL) + buf_q, work_q = queue.Queue(), queue.Queue() + for work in plugs.items(): + work_q.put(work) + + start_cnt = thr.active_count() + for num in range(nthreads): + tname = 'PlugT-{0:02}'.format(num) + thread = PlugThread(tname, (buf_q, work_q, lock)) + thread.start() + if mac_gui: + rthread = RefreshThread(lock) + rthread.start() + + while not buf_q.empty() or thr.active_count() != start_cnt: + try: + action, name, msg = buf_q.get(True, 0.25) + buf.write(action, name, ['OK'] if not msg else msg) + buf_q.task_done() + except queue.Empty: + pass + except KeyboardInterrupt: + G_STOP.set() + + if mac_gui: + rthread.stop() + rthread.join() + +main() +EOF +endfunction + +function! s:update_ruby() + ruby << EOF + module PlugStream + SEP = ["\r", "\n", nil] + def get_line + buffer = '' + loop do + char = readchar rescue return + if SEP.include? char.chr + buffer << $/ + break + else + buffer << char + end + end + buffer + end + end unless defined?(PlugStream) + + def esc arg + %["#{arg.gsub('"', '\"')}"] + end + + def killall pid + pids = [pid] + if /mswin|mingw|bccwin/ =~ RUBY_PLATFORM + pids.each { |pid| Process.kill 'INT', pid.to_i rescue nil } + else + unless `which pgrep 2> /dev/null`.empty? + children = pids + until children.empty? + children = children.map { |pid| + `pgrep -P #{pid}`.lines.map { |l| l.chomp } + }.flatten + pids += children + end + end + pids.each { |pid| Process.kill 'TERM', pid.to_i rescue nil } + end + end + + def compare_git_uri a, b + regex = %r{^(?:\w+://)?(?:[^@/]*@)?([^:/]*(?::[0-9]*)?)[:/](.*?)(?:\.git)?/?$} + regex.match(a).to_a.drop(1) == regex.match(b).to_a.drop(1) + end + + require 'thread' + require 'fileutils' + require 'timeout' + running = true + iswin = VIM::evaluate('s:is_win').to_i == 1 + pull = VIM::evaluate('s:update.pull').to_i == 1 + base = VIM::evaluate('g:plug_home') + all = VIM::evaluate('s:update.todo') + limit = VIM::evaluate('get(g:, "plug_timeout", 60)') + tries = VIM::evaluate('get(g:, "plug_retries", 2)') + 1 + nthr = VIM::evaluate('s:update.threads').to_i + maxy = VIM::evaluate('winheight(".")').to_i + vim7 = VIM::evaluate('v:version').to_i <= 703 && RUBY_PLATFORM =~ /darwin/ + cd = iswin ? 'cd /d' : 'cd' + tot = VIM::evaluate('len(s:update.todo)') || 0 + bar = '' + skip = 'Already installed' + mtx = Mutex.new + take1 = proc { mtx.synchronize { running && all.shift } } + logh = proc { + cnt = bar.length + $curbuf[1] = "#{pull ? 'Updating' : 'Installing'} plugins (#{cnt}/#{tot})" + $curbuf[2] = '[' + bar.ljust(tot) + ']' + VIM::command('normal! 2G') + VIM::command('redraw') + } + where = proc { |name| (1..($curbuf.length)).find { |l| $curbuf[l] =~ /^[-+x*] #{name}:/ } } + log = proc { |name, result, type| + mtx.synchronize do + ing = ![true, false].include?(type) + bar += type ? '=' : 'x' unless ing + b = case type + when :install then '+' when :update then '*' + when true, nil then '-' else + VIM::command("call add(s:update.errors, '#{name}')") + 'x' + end + result = + if type || type.nil? + ["#{b} #{name}: #{result.lines.to_a.last || 'OK'}"] + elsif result =~ /^Interrupted|^Timeout/ + ["#{b} #{name}: #{result}"] + else + ["#{b} #{name}"] + result.lines.map { |l| " " << l } + end + if lnum = where.call(name) + $curbuf.delete lnum + lnum = 4 if ing && lnum > maxy + end + result.each_with_index do |line, offset| + $curbuf.append((lnum || 4) - 1 + offset, line.gsub(/\e\[./, '').chomp) + end + logh.call + end + } + bt = proc { |cmd, name, type, cleanup| + tried = timeout = 0 + begin + tried += 1 + timeout += limit + fd = nil + data = '' + if iswin + Timeout::timeout(timeout) do + tmp = VIM::evaluate('tempname()') + system("(#{cmd}) > #{tmp}") + data = File.read(tmp).chomp + File.unlink tmp rescue nil + end + else + fd = IO.popen(cmd).extend(PlugStream) + first_line = true + log_prob = 1.0 / nthr + while line = Timeout::timeout(timeout) { fd.get_line } + data << line + log.call name, line.chomp, type if name && (first_line || rand < log_prob) + first_line = false + end + fd.close + end + [$? == 0, data.chomp] + rescue Timeout::Error, Interrupt => e + if fd && !fd.closed? + killall fd.pid + fd.close + end + cleanup.call if cleanup + if e.is_a?(Timeout::Error) && tried < tries + 3.downto(1) do |countdown| + s = countdown > 1 ? 's' : '' + log.call name, "Timeout. Will retry in #{countdown} second#{s} ...", type + sleep 1 + end + log.call name, 'Retrying ...', type + retry + end + [false, e.is_a?(Interrupt) ? "Interrupted!" : "Timeout!"] + end + } + main = Thread.current + threads = [] + watcher = Thread.new { + if vim7 + while VIM::evaluate('getchar(1)') + sleep 0.1 + end + else + require 'io/console' # >= Ruby 1.9 + nil until IO.console.getch == 3.chr + end + mtx.synchronize do + running = false + threads.each { |t| t.raise Interrupt } unless vim7 + end + threads.each { |t| t.join rescue nil } + main.kill + } + refresh = Thread.new { + while true + mtx.synchronize do + break unless running + VIM::command('noautocmd normal! a') + end + sleep 0.2 + end + } if VIM::evaluate('s:mac_gui') == 1 + + clone_opt = VIM::evaluate('s:clone_opt') + progress = VIM::evaluate('s:progress_opt(1)') + nthr.times do + mtx.synchronize do + threads << Thread.new { + while pair = take1.call + name = pair.first + dir, uri, tag = pair.last.values_at *%w[dir uri tag] + exists = File.directory? dir + ok, result = + if exists + chdir = "#{cd} #{iswin ? dir : esc(dir)}" + ret, data = bt.call "#{chdir} && git rev-parse --abbrev-ref HEAD 2>&1 && git config -f .git/config remote.origin.url", nil, nil, nil + current_uri = data.lines.to_a.last + if !ret + if data =~ /^Interrupted|^Timeout/ + [false, data] + else + [false, [data.chomp, "PlugClean required."].join($/)] + end + elsif !compare_git_uri(current_uri, uri) + [false, ["Invalid URI: #{current_uri}", + "Expected: #{uri}", + "PlugClean required."].join($/)] + else + if pull + log.call name, 'Updating ...', :update + fetch_opt = (tag && File.exist?(File.join(dir, '.git/shallow'))) ? '--depth 99999999' : '' + bt.call "#{chdir} && git fetch #{fetch_opt} #{progress} 2>&1", name, :update, nil + else + [true, skip] + end + end + else + d = esc dir.sub(%r{[\\/]+$}, '') + log.call name, 'Installing ...', :install + bt.call "git clone #{clone_opt unless tag} #{progress} #{uri} #{d} 2>&1", name, :install, proc { + FileUtils.rm_rf dir + } + end + mtx.synchronize { VIM::command("let s:update.new['#{name}'] = 1") } if !exists && ok + log.call name, result, ok + end + } if running + end + end + threads.each { |t| t.join rescue nil } + logh.call + refresh.kill if refresh + watcher.kill +EOF +endfunction + +function! s:shellesc_cmd(arg) + let escaped = substitute(a:arg, '[&|<>()@^]', '^&', 'g') + let escaped = substitute(escaped, '%', '%%', 'g') + let escaped = substitute(escaped, '"', '\\^&', 'g') + let escaped = substitute(escaped, '\(\\\+\)\(\\^\)', '\1\1\2', 'g') + return '^"'.substitute(escaped, '\(\\\+\)$', '\1\1', '').'^"' +endfunction + +function! s:shellesc(arg) + if &shell =~# 'cmd.exe$' + return s:shellesc_cmd(a:arg) + endif + return shellescape(a:arg) +endfunction + +function! s:glob_dir(path) + return map(filter(s:glob(a:path, '**'), 'isdirectory(v:val)'), 's:dirpath(v:val)') +endfunction + +function! s:progress_bar(line, bar, total) + call setline(a:line, '[' . s:lpad(a:bar, a:total) . ']') +endfunction + +function! s:compare_git_uri(a, b) + " See `git help clone' + " https:// [user@] github.com[:port] / junegunn/vim-plug [.git] + " [git@] github.com[:port] : junegunn/vim-plug [.git] + " file:// / junegunn/vim-plug [/] + " / junegunn/vim-plug [/] + let pat = '^\%(\w\+://\)\='.'\%([^@/]*@\)\='.'\([^:/]*\%(:[0-9]*\)\=\)'.'[:/]'.'\(.\{-}\)'.'\%(\.git\)\=/\?$' + let ma = matchlist(a:a, pat) + let mb = matchlist(a:b, pat) + return ma[1:2] ==# mb[1:2] +endfunction + +function! s:format_message(bullet, name, message) + if a:bullet != 'x' + return [printf('%s %s: %s', a:bullet, a:name, s:lastline(a:message))] + else + let lines = map(s:lines(a:message), '" ".v:val') + return extend([printf('x %s:', a:name)], lines) + endif +endfunction + +function! s:with_cd(cmd, dir) + return printf('cd%s %s && %s', s:is_win ? ' /d' : '', s:shellesc(a:dir), a:cmd) +endfunction + +function! s:system(cmd, ...) + try + let [sh, shellcmdflag, shrd] = s:chsh(1) + let cmd = a:0 > 0 ? s:with_cd(a:cmd, a:1) : a:cmd + if s:is_win + let batchfile = tempname().'.bat' + call writefile(['@echo off', cmd], batchfile) + let cmd = batchfile + endif + return system(s:is_win ? '('.cmd.')' : cmd) + finally + let [&shell, &shellcmdflag, &shellredir] = [sh, shellcmdflag, shrd] + if s:is_win + call delete(batchfile) + endif + endtry +endfunction + +function! s:system_chomp(...) + let ret = call('s:system', a:000) + return v:shell_error ? '' : substitute(ret, '\n$', '', '') +endfunction + +function! s:git_validate(spec, check_branch) + let err = '' + if isdirectory(a:spec.dir) + let result = s:lines(s:system('git rev-parse --abbrev-ref HEAD 2>&1 && git config -f .git/config remote.origin.url', a:spec.dir)) + let remote = result[-1] + if v:shell_error + let err = join([remote, 'PlugClean required.'], "\n") + elseif !s:compare_git_uri(remote, a:spec.uri) + let err = join(['Invalid URI: '.remote, + \ 'Expected: '.a:spec.uri, + \ 'PlugClean required.'], "\n") + elseif a:check_branch && has_key(a:spec, 'commit') + let result = s:lines(s:system('git rev-parse HEAD 2>&1', a:spec.dir)) + let sha = result[-1] + if v:shell_error + let err = join(add(result, 'PlugClean required.'), "\n") + elseif !s:hash_match(sha, a:spec.commit) + let err = join([printf('Invalid HEAD (expected: %s, actual: %s)', + \ a:spec.commit[:6], sha[:6]), + \ 'PlugUpdate required.'], "\n") + endif + elseif a:check_branch + let branch = result[0] + " Check tag + if has_key(a:spec, 'tag') + let tag = s:system_chomp('git describe --exact-match --tags HEAD 2>&1', a:spec.dir) + if a:spec.tag !=# tag && a:spec.tag !~ '\*' + let err = printf('Invalid tag: %s (expected: %s). Try PlugUpdate.', + \ (empty(tag) ? 'N/A' : tag), a:spec.tag) + endif + " Check branch + elseif a:spec.branch !=# branch + let err = printf('Invalid branch: %s (expected: %s). Try PlugUpdate.', + \ branch, a:spec.branch) + endif + if empty(err) + let [ahead, behind] = split(s:lastline(s:system(printf( + \ 'git rev-list --count --left-right HEAD...origin/%s', + \ a:spec.branch), a:spec.dir)), '\t') + if !v:shell_error && ahead + if behind + " Only mention PlugClean if diverged, otherwise it's likely to be + " pushable (and probably not that messed up). + let err = printf( + \ "Diverged from origin/%s (%d commit(s) ahead and %d commit(s) behind!\n" + \ .'Backup local changes and run PlugClean and PlugUpdate to reinstall it.', a:spec.branch, ahead, behind) + else + let err = printf("Ahead of origin/%s by %d commit(s).\n" + \ .'Cannot update until local changes are pushed.', + \ a:spec.branch, ahead) + endif + endif + endif + endif + else + let err = 'Not found' + endif + return [err, err =~# 'PlugClean'] +endfunction + +function! s:rm_rf(dir) + if isdirectory(a:dir) + call s:system((s:is_win ? 'rmdir /S /Q ' : 'rm -rf ') . s:shellesc(a:dir)) + endif +endfunction + +function! s:clean(force) + call s:prepare() + call append(0, 'Searching for invalid plugins in '.g:plug_home) + call append(1, '') + + " List of valid directories + let dirs = [] + let errs = {} + let [cnt, total] = [0, len(g:plugs)] + for [name, spec] in items(g:plugs) + if !s:is_managed(name) + call add(dirs, spec.dir) + else + let [err, clean] = s:git_validate(spec, 1) + if clean + let errs[spec.dir] = s:lines(err)[0] + else + call add(dirs, spec.dir) + endif + endif + let cnt += 1 + call s:progress_bar(2, repeat('=', cnt), total) + normal! 2G + redraw + endfor + + let allowed = {} + for dir in dirs + let allowed[s:dirpath(fnamemodify(dir, ':h:h'))] = 1 + let allowed[dir] = 1 + for child in s:glob_dir(dir) + let allowed[child] = 1 + endfor + endfor + + let todo = [] + let found = sort(s:glob_dir(g:plug_home)) + while !empty(found) + let f = remove(found, 0) + if !has_key(allowed, f) && isdirectory(f) + call add(todo, f) + call append(line('$'), '- ' . f) + if has_key(errs, f) + call append(line('$'), ' ' . errs[f]) + endif + let found = filter(found, 'stridx(v:val, f) != 0') + end + endwhile + + 4 + redraw + if empty(todo) + call append(line('$'), 'Already clean.') + else + let s:clean_count = 0 + call append(3, ['Directories to delete:', '']) + redraw! + if a:force || s:ask_no_interrupt('Delete all directories?') + call s:delete([6, line('$')], 1) + else + call setline(4, 'Cancelled.') + nnoremap d :set opfunc=delete_opg@ + nmap dd d_ + xnoremap d :call delete_op(visualmode(), 1) + echo 'Delete the lines (d{motion}) to delete the corresponding directories' + endif + endif + 4 + setlocal nomodifiable +endfunction + +function! s:delete_op(type, ...) + call s:delete(a:0 ? [line("'<"), line("'>")] : [line("'["), line("']")], 0) +endfunction + +function! s:delete(range, force) + let [l1, l2] = a:range + let force = a:force + while l1 <= l2 + let line = getline(l1) + if line =~ '^- ' && isdirectory(line[2:]) + execute l1 + redraw! + let answer = force ? 1 : s:ask('Delete '.line[2:].'?', 1) + let force = force || answer > 1 + if answer + call s:rm_rf(line[2:]) + setlocal modifiable + call setline(l1, '~'.line[1:]) + let s:clean_count += 1 + call setline(4, printf('Removed %d directories.', s:clean_count)) + setlocal nomodifiable + endif + endif + let l1 += 1 + endwhile +endfunction + +function! s:upgrade() + echo 'Downloading the latest version of vim-plug' + redraw + let tmp = tempname() + let new = tmp . '/plug.vim' + + try + let out = s:system(printf('git clone --depth 1 %s %s', s:plug_src, tmp)) + if v:shell_error + return s:err('Error upgrading vim-plug: '. out) + endif + + if readfile(s:me) ==# readfile(new) + echo 'vim-plug is already up-to-date' + return 0 + else + call rename(s:me, s:me . '.old') + call rename(new, s:me) + unlet g:loaded_plug + echo 'vim-plug has been upgraded' + return 1 + endif + finally + silent! call s:rm_rf(tmp) + endtry +endfunction + +function! s:upgrade_specs() + for spec in values(g:plugs) + let spec.frozen = get(spec, 'frozen', 0) + endfor +endfunction + +function! s:status() + call s:prepare() + call append(0, 'Checking plugins') + call append(1, '') + + let ecnt = 0 + let unloaded = 0 + let [cnt, total] = [0, len(g:plugs)] + for [name, spec] in items(g:plugs) + let is_dir = isdirectory(spec.dir) + if has_key(spec, 'uri') + if is_dir + let [err, _] = s:git_validate(spec, 1) + let [valid, msg] = [empty(err), empty(err) ? 'OK' : err] + else + let [valid, msg] = [0, 'Not found. Try PlugInstall.'] + endif + else + if is_dir + let [valid, msg] = [1, 'OK'] + else + let [valid, msg] = [0, 'Not found.'] + endif + endif + let cnt += 1 + let ecnt += !valid + " `s:loaded` entry can be missing if PlugUpgraded + if is_dir && get(s:loaded, name, -1) == 0 + let unloaded = 1 + let msg .= ' (not loaded)' + endif + call s:progress_bar(2, repeat('=', cnt), total) + call append(3, s:format_message(valid ? '-' : 'x', name, msg)) + normal! 2G + redraw + endfor + call setline(1, 'Finished. '.ecnt.' error(s).') + normal! gg + setlocal nomodifiable + if unloaded + echo "Press 'L' on each line to load plugin, or 'U' to update" + nnoremap L :call status_load(line('.')) + xnoremap L :call status_load(line('.')) + end +endfunction + +function! s:extract_name(str, prefix, suffix) + return matchstr(a:str, '^'.a:prefix.' \zs[^:]\+\ze:.*'.a:suffix.'$') +endfunction + +function! s:status_load(lnum) + let line = getline(a:lnum) + let name = s:extract_name(line, '-', '(not loaded)') + if !empty(name) + call plug#load(name) + setlocal modifiable + call setline(a:lnum, substitute(line, ' (not loaded)$', '', '')) + setlocal nomodifiable + endif +endfunction + +function! s:status_update() range + let lines = getline(a:firstline, a:lastline) + let names = filter(map(lines, 's:extract_name(v:val, "[x-]", "")'), '!empty(v:val)') + if !empty(names) + echo + execute 'PlugUpdate' join(names) + endif +endfunction + +function! s:is_preview_window_open() + silent! wincmd P + if &previewwindow + wincmd p + return 1 + endif +endfunction + +function! s:find_name(lnum) + for lnum in reverse(range(1, a:lnum)) + let line = getline(lnum) + if empty(line) + return '' + endif + let name = s:extract_name(line, '-', '') + if !empty(name) + return name + endif + endfor + return '' +endfunction + +function! s:preview_commit() + if b:plug_preview < 0 + let b:plug_preview = !s:is_preview_window_open() + endif + + let sha = matchstr(getline('.'), '^ \X*\zs[0-9a-f]\{7,9}') + if empty(sha) + return + endif + + let name = s:find_name(line('.')) + if empty(name) || !has_key(g:plugs, name) || !isdirectory(g:plugs[name].dir) + return + endif + + if exists('g:plug_pwindow') && !s:is_preview_window_open() + execute g:plug_pwindow + execute 'e' sha + else + execute 'pedit' sha + wincmd P + endif + setlocal previewwindow filetype=git buftype=nofile nobuflisted modifiable + try + let [sh, shellcmdflag, shrd] = s:chsh(1) + let cmd = 'cd '.s:shellesc(g:plugs[name].dir).' && git show --no-color --pretty=medium '.sha + if s:is_win + let batchfile = tempname().'.bat' + call writefile(['@echo off', cmd], batchfile) + let cmd = batchfile + endif + execute 'silent %!' cmd + finally + let [&shell, &shellcmdflag, &shellredir] = [sh, shellcmdflag, shrd] + if s:is_win + call delete(batchfile) + endif + endtry + setlocal nomodifiable + nnoremap q :q + wincmd p +endfunction + +function! s:section(flags) + call search('\(^[x-] \)\@<=[^:]\+:', a:flags) +endfunction + +function! s:format_git_log(line) + let indent = ' ' + let tokens = split(a:line, nr2char(1)) + if len(tokens) != 5 + return indent.substitute(a:line, '\s*$', '', '') + endif + let [graph, sha, refs, subject, date] = tokens + let tag = matchstr(refs, 'tag: [^,)]\+') + let tag = empty(tag) ? ' ' : ' ('.tag.') ' + return printf('%s%s%s%s%s (%s)', indent, graph, sha, tag, subject, date) +endfunction + +function! s:append_ul(lnum, text) + call append(a:lnum, ['', a:text, repeat('-', len(a:text))]) +endfunction + +function! s:diff() + call s:prepare() + call append(0, ['Collecting changes ...', '']) + let cnts = [0, 0] + let bar = '' + let total = filter(copy(g:plugs), 's:is_managed(v:key) && isdirectory(v:val.dir)') + call s:progress_bar(2, bar, len(total)) + for origin in [1, 0] + let plugs = reverse(sort(items(filter(copy(total), (origin ? '' : '!').'(has_key(v:val, "commit") || has_key(v:val, "tag"))')))) + if empty(plugs) + continue + endif + call s:append_ul(2, origin ? 'Pending updates:' : 'Last update:') + for [k, v] in plugs + let range = origin ? '..origin/'.v.branch : 'HEAD@{1}..' + let diff = s:system_chomp('git log --graph --color=never '.join(map(['--pretty=format:%x01%h%x01%d%x01%s%x01%cr', range], 's:shellesc(v:val)')), v.dir) + if !empty(diff) + let ref = has_key(v, 'tag') ? (' (tag: '.v.tag.')') : has_key(v, 'commit') ? (' '.v.commit) : '' + call append(5, extend(['', '- '.k.':'.ref], map(s:lines(diff), 's:format_git_log(v:val)'))) + let cnts[origin] += 1 + endif + let bar .= '=' + call s:progress_bar(2, bar, len(total)) + normal! 2G + redraw + endfor + if !cnts[origin] + call append(5, ['', 'N/A']) + endif + endfor + call setline(1, printf('%d plugin(s) updated.', cnts[0]) + \ . (cnts[1] ? printf(' %d plugin(s) have pending updates.', cnts[1]) : '')) + + if cnts[0] || cnts[1] + nnoremap :silent! call preview_commit() + nnoremap o :silent! call preview_commit() + endif + if cnts[0] + nnoremap X :call revert() + echo "Press 'X' on each block to revert the update" + endif + normal! gg + setlocal nomodifiable +endfunction + +function! s:revert() + if search('^Pending updates', 'bnW') + return + endif + + let name = s:find_name(line('.')) + if empty(name) || !has_key(g:plugs, name) || + \ input(printf('Revert the update of %s? (y/N) ', name)) !~? '^y' + return + endif + + call s:system('git reset --hard HEAD@{1} && git checkout '.s:esc(g:plugs[name].branch).' --', g:plugs[name].dir) + setlocal modifiable + normal! "_dap + setlocal nomodifiable + echo 'Reverted' +endfunction + +function! s:snapshot(force, ...) abort + call s:prepare() + setf vim + call append(0, ['" Generated by vim-plug', + \ '" '.strftime("%c"), + \ '" :source this file in vim to restore the snapshot', + \ '" or execute: vim -S snapshot.vim', + \ '', '', 'PlugUpdate!']) + 1 + let anchor = line('$') - 3 + let names = sort(keys(filter(copy(g:plugs), + \'has_key(v:val, "uri") && !has_key(v:val, "commit") && isdirectory(v:val.dir)'))) + for name in reverse(names) + let sha = s:system_chomp('git rev-parse --short HEAD', g:plugs[name].dir) + if !empty(sha) + call append(anchor, printf("silent! let g:plugs['%s'].commit = '%s'", name, sha)) + redraw + endif + endfor + + if a:0 > 0 + let fn = expand(a:1) + if filereadable(fn) && !(a:force || s:ask(a:1.' already exists. Overwrite?')) + return + endif + call writefile(getline(1, '$'), fn) + echo 'Saved as '.a:1 + silent execute 'e' s:esc(fn) + setf vim + endif +endfunction + +function! s:split_rtp() + return split(&rtp, '\\\@) + +com! -nargs=* -bang -complete=custom,vundle#scripts#complete PluginInstall +\ call vundle#installer#new('!' == '', ) + +com! -nargs=? -bang -complete=custom,vundle#scripts#complete PluginSearch +\ call vundle#scripts#all('!' == '', ) + +com! -nargs=0 -bang PluginList +\ call vundle#installer#list('!' == '') + +com! -nargs=? -bang PluginClean +\ call vundle#installer#clean('!' == '') + +com! -nargs=0 PluginDocs +\ call vundle#installer#helptags(g:vundle#bundles) + +" Aliases +com! -nargs=* -complete=custom,vundle#scripts#complete PluginUpdate PluginInstall! + +" Vundle Aliases +com! -nargs=? -bang -complete=custom,vundle#scripts#complete VundleInstall PluginInstall +com! -nargs=? -bang -complete=custom,vundle#scripts#complete VundleSearch PluginSearch +com! -nargs=? -bang VundleClean PluginClean +com! -nargs=0 VundleDocs PluginDocs +com! VundleUpdate PluginInstall! +com! -nargs=* -complete=custom,vundle#scripts#complete VundleUpdate PluginInstall! + +" Deprecated Commands +com! -nargs=+ Bundle call vundle#config#bundle() +com! -nargs=? -bang -complete=custom,vundle#scripts#complete BundleInstall PluginInstall +com! -nargs=? -bang -complete=custom,vundle#scripts#complete BundleSearch PluginSearch +com! -nargs=0 -bang BundleList PluginList +com! -nargs=? -bang BundleClean PluginClean +com! -nargs=0 BundleDocs PluginDocs +com! BundleUpdate PluginInstall! + +" Set up the signs used in the installer window. (See :help signs) +if (has('signs')) + sign define Vu_error text=! texthl=Error + sign define Vu_active text=> texthl=Comment + sign define Vu_todate text=. texthl=Comment + sign define Vu_new text=+ texthl=Comment + sign define Vu_updated text=* texthl=Comment + sign define Vu_deleted text=- texthl=Comment + sign define Vu_helptags text=* texthl=Comment + sign define Vu_pinned text== texthl=Comment +endif + +" Set up Vundle. This function has to be called from the users vimrc file. +" This will force Vim to source this file as a side effect which wil define +" the :Plugin command. After calling this function the user can use the +" :Plugin command in the vimrc. It is not possible to do this automatically +" because when loading the vimrc file no plugins where loaded yet. +func! vundle#rc(...) abort + if a:0 > 0 + let g:vundle#bundle_dir = expand(a:1, 1) + endif + call vundle#config#init() +endf + +" Alternative to vundle#rc, offers speed up by modifying rtp only when end() +" called later. +func! vundle#begin(...) abort + let g:vundle#lazy_load = 1 + call call('vundle#rc', a:000) +endf + +" Finishes putting plugins on the rtp. +func! vundle#end(...) abort + unlet g:vundle#lazy_load + call vundle#config#activate_bundles() +endf + +" Initialize some global variables used by Vundle. +let vundle#bundle_dir = expand('$HOME/.vim/bundle', 1) +let vundle#bundles = [] +let vundle#lazy_load = 0 +let vundle#log = [] +let vundle#updated_bundles = [] + +" vim: set expandtab sts=2 ts=2 sw=2 tw=78 norl: diff --git a/vim/bundle/Vundle.vim/autoload/vundle/config.vim b/vim/bundle/Vundle.vim/autoload/vundle/config.vim new file mode 100644 index 0000000..0e02b11 --- /dev/null +++ b/vim/bundle/Vundle.vim/autoload/vundle/config.vim @@ -0,0 +1,281 @@ +" --------------------------------------------------------------------------- +" Add a plugin to the runtimepath. +" +" arg -- a string specifying the plugin +" ... -- a dictionary of options for the plugin +" return -- the return value from vundle#config#init_bundle() +" --------------------------------------------------------------------------- +func! vundle#config#bundle(arg, ...) + let bundle = vundle#config#init_bundle(a:arg, a:000) + if !s:check_bundle_name(bundle) + return + endif + if exists('g:vundle#lazy_load') && g:vundle#lazy_load + call add(g:vundle#bundles, bundle) + else + call s:rtp_rm_a() + call add(g:vundle#bundles, bundle) + call s:rtp_add_a() + call s:rtp_add_defaults() + endif + return bundle +endf + + +" --------------------------------------------------------------------------- +" When lazy bundle load is used (begin/end functions), add all configured +" bundles to runtimepath and reorder appropriately. +" --------------------------------------------------------------------------- +func! vundle#config#activate_bundles() + call s:rtp_add_a() + call s:rtp_add_defaults() +endf + + +" --------------------------------------------------------------------------- +" Initialize Vundle. +" +" Start a new bundles list and make sure the runtimepath does not contain +" directories from a previous call. In theory, this should only be called +" once. +" --------------------------------------------------------------------------- +func! vundle#config#init() + if !exists('g:vundle#bundles') | let g:vundle#bundles = [] | endif + call s:rtp_rm_a() + let g:vundle#bundles = [] + let s:bundle_names = {} +endf + + +" --------------------------------------------------------------------------- +" Add a list of bundles to the runtimepath and source them. +" +" bundles -- a list of bundle objects +" --------------------------------------------------------------------------- +func! vundle#config#require(bundles) abort + for b in a:bundles + call s:rtp_add(b.rtpath) + call s:rtp_add(g:vundle#bundle_dir) + " TODO: it has to be relative rtpath, not bundle.name + exec 'runtime! '.b.name.'/plugin/*.vim' + exec 'runtime! '.b.name.'/after/*.vim' + call s:rtp_rm(g:vundle#bundle_dir) + endfor + call s:rtp_add_defaults() +endf + + +" --------------------------------------------------------------------------- +" Create a bundle object from a bundle specification. +" +" name -- the bundle specification as a string +" opts -- the options dictionary from then bundle definition +" return -- an initialized bundle object +" --------------------------------------------------------------------------- +func! vundle#config#init_bundle(name, opts) + if a:name != substitute(a:name, '^\s*\(.\{-}\)\s*$', '\1', '') + echo "Spurious leading and/or trailing whitespace found in plugin spec '" . a:name . "'" + endif + let opts = extend(s:parse_options(a:opts), s:parse_name(substitute(a:name,"['".'"]\+','','g')), 'keep') + let b = extend(opts, copy(s:bundle)) + let b.rtpath = s:rtpath(opts) + return b +endf + + +" --------------------------------------------------------------------------- +" Check if the current bundle name has already been used in this running +" instance and show an error to that effect. +" +" bundle -- a bundle object whose name is to be checked +" return -- 0 if the bundle's name has been seen before, 1 otherwise +" --------------------------------------------------------------------------- +funct! s:check_bundle_name(bundle) + if has_key(s:bundle_names, a:bundle.name) + echoerr 'Vundle error: Name collision for Plugin ' . a:bundle.name_spec . + \ '. Plugin ' . s:bundle_names[a:bundle.name] . + \ ' previously used the name "' . a:bundle.name . '"' . + \ '. Skipping Plugin ' . a:bundle.name_spec . '.' + return 0 + elseif a:bundle.name !~ '\v^[A-Za-z0-9_-]%(\.?[A-Za-z0-9_-])*$' + echoerr 'Invalid plugin name: ' . a:bundle.name + return 0 + endif + let s:bundle_names[a:bundle.name] = a:bundle.name_spec + return 1 +endf + + +" --------------------------------------------------------------------------- +" Parse the options which can be supplied with the bundle specification. +" Corresponding documentation: vundle-plugins-configure +" +" opts -- a dictionary with the user supplied options for the bundle +" return -- a dictionary with the user supplied options for the bundle, this +" will be merged with a s:bundle object into one dictionary. +" --------------------------------------------------------------------------- +func! s:parse_options(opts) + " TODO: improve this + if len(a:opts) != 1 | return {} | endif + + if type(a:opts[0]) == type({}) + return a:opts[0] + else + return {'rev': a:opts[0]} + endif +endf + + +" --------------------------------------------------------------------------- +" Parse the plugin specification. Corresponding documentation: +" vundle-plugins-uris +" +" arg -- the string supplied to identify the plugin +" return -- a dictionary with the folder name (key 'name') and the uri (key +" 'uri') for cloning the plugin and the original argument (key +" 'name_spec') +" --------------------------------------------------------------------------- +func! s:parse_name(arg) + let arg = a:arg + let git_proto = exists('g:vundle_default_git_proto') ? g:vundle_default_git_proto : 'https' + + if arg =~? '^\s*\(gh\|github\):\S\+' + \ || arg =~? '^[a-z0-9][a-z0-9-]*/[^/]\+$' + let uri = git_proto.'://github.com/'.split(arg, ':')[-1] + if uri !~? '\.git$' + let uri .= '.git' + endif + let name = substitute(split(uri,'\/')[-1], '\.git\s*$','','i') + elseif arg =~? '^\s*\(git@\|git://\)\S\+' + \ || arg =~? '\(file\|https\?\)://' + \ || arg =~? '\.git\s*$' + let uri = arg + let name = split( substitute(uri,'/\?\.git\s*$','','i') ,'\/')[-1] + else + let name = arg + let uri = git_proto.'://github.com/vim-scripts/'.name.'.git' + endif + return {'name': name, 'uri': uri, 'name_spec': arg } +endf + + +" --------------------------------------------------------------------------- +" Modify the runtimepath, after all bundles have been added, so that the +" directories that were in the default runtimepath appear first in the list +" (with their 'after' directories last). +" --------------------------------------------------------------------------- +func! s:rtp_add_defaults() + let current = &rtp + set rtp&vim + let default = &rtp + let &rtp = current + let default_rtp_items = split(default, ',') + if !empty(default_rtp_items) + let first_item = fnameescape(default_rtp_items[0]) + exec 'set rtp-=' . first_item + exec 'set rtp^=' . first_item + endif +endf + + +" --------------------------------------------------------------------------- +" Remove all paths for the plugins which are managed by Vundle from the +" runtimepath. +" --------------------------------------------------------------------------- +func! s:rtp_rm_a() + let paths = map(copy(g:vundle#bundles), 'v:val.rtpath') + let prepends = join(paths, ',') + let appends = join(paths, '/after,').'/after' + exec 'set rtp-='.fnameescape(prepends) + exec 'set rtp-='.fnameescape(appends) +endf + + +" --------------------------------------------------------------------------- +" Add all paths for the plugins which are managed by Vundle to the +" runtimepath. +" --------------------------------------------------------------------------- +func! s:rtp_add_a() + let paths = map(copy(g:vundle#bundles), 'v:val.rtpath') + let prepends = join(paths, ',') + let appends = join(paths, '/after,').'/after' + exec 'set rtp^='.fnameescape(prepends) + exec 'set rtp+='.fnameescape(appends) +endf + + +" --------------------------------------------------------------------------- +" Remove a directory and the corresponding 'after' directory from runtimepath. +" +" dir -- the directory name to be removed as a string. The corresponding +" 'after' directory will also be removed. +" --------------------------------------------------------------------------- +func! s:rtp_rm(dir) abort + exec 'set rtp-='.fnameescape(expand(a:dir, 1)) + exec 'set rtp-='.fnameescape(expand(a:dir.'/after', 1)) +endf + + +" --------------------------------------------------------------------------- +" Add a directory and the corresponding 'after' directory to runtimepath. +" +" dir -- the directory name to be added as a string. The corresponding +" 'after' directory will also be added. +" --------------------------------------------------------------------------- +func! s:rtp_add(dir) abort + exec 'set rtp^='.fnameescape(expand(a:dir, 1)) + exec 'set rtp+='.fnameescape(expand(a:dir.'/after', 1)) +endf + + +" --------------------------------------------------------------------------- +" Expand and simplify a path. +" +" path -- the path to expand as a string +" return -- the expanded and simplified path +" --------------------------------------------------------------------------- +func! s:expand_path(path) abort + return simplify(expand(a:path, 1)) +endf + + +" --------------------------------------------------------------------------- +" Find the actual path inside a bundle directory to be added to the +" runtimepath. It might be provided by the user with the 'rtp' option. +" Corresponding documentation: vundle-plugins-configure +" +" opts -- a bundle dict +" return -- expanded path to the corresponding plugin directory +" --------------------------------------------------------------------------- +func! s:rtpath(opts) + return has_key(a:opts, 'rtp') ? s:expand_path(a:opts.path().'/'.a:opts.rtp) : a:opts.path() +endf + + +" --------------------------------------------------------------------------- +" a bundle 'object' +" --------------------------------------------------------------------------- +let s:bundle = {} + + +" --------------------------------------------------------------------------- +" Return the absolute path to the directory inside the bundle directory +" (prefix) where thr bundle will be cloned. +" +" return -- the target location to clone this bundle to +" --------------------------------------------------------------------------- +func! s:bundle.path() + return s:expand_path(g:vundle#bundle_dir.'/') . self.name +endf + + +" --------------------------------------------------------------------------- +" Determine if the bundle has the pinned attribute set in the config +" +" return -- 1 if the bundle is pinned, 0 otherwise +" --------------------------------------------------------------------------- +func! s:bundle.is_pinned() + return get(self, 'pinned') +endf + +" vim: set expandtab sts=2 ts=2 sw=2 tw=78 norl: diff --git a/vim/bundle/Vundle.vim/autoload/vundle/installer.vim b/vim/bundle/Vundle.vim/autoload/vundle/installer.vim new file mode 100644 index 0000000..472271a --- /dev/null +++ b/vim/bundle/Vundle.vim/autoload/vundle/installer.vim @@ -0,0 +1,547 @@ +" --------------------------------------------------------------------------- +" Try to clone all new bundles given (or all bundles in g:vundle#bundles by +" default) to g:vundle#bundle_dir. If a:bang is 1 it will also update all +" plugins (git pull). +" +" bang -- 1 or 0 +" ... -- any number of bundle specifications (separate arguments) +" --------------------------------------------------------------------------- +func! vundle#installer#new(bang, ...) abort + " No specific plugins are specified. Operate on all plugins. + if a:0 == 0 + let bundles = g:vundle#bundles + " Specific plugins are specified for update. Update them. + elseif (a:bang) + let bundles = filter(copy(g:vundle#bundles), 'index(a:000, v:val.name) > -1') + " Specific plugins are specified for installation. Install them. + else + let bundles = map(copy(a:000), 'vundle#config#bundle(v:val, {})') + endif + + if empty(bundles) + echoerr 'No bundles were selected for operation' + return + endif + + let names = vundle#scripts#bundle_names(map(copy(bundles), 'v:val.name_spec')) + call vundle#scripts#view('Installer',['" Installing plugins to '.expand(g:vundle#bundle_dir, 1)], names + ['Helptags']) + + " This calls 'add' as a normal mode command. This is a buffer local mapping + " defined in vundle#scripts#view(). The mapping will call a buffer local + " command InstallPlugin which in turn will call vundle#installer#run() with + " vundle#installer#install(). + call s:process(a:bang, (a:bang ? 'add!' : 'add')) + + call vundle#config#require(bundles) +endf + + +" --------------------------------------------------------------------------- +" Iterate over all lines in a Vundle window and execute the given command for +" every line. Used by the installation and cleaning functions. +" +" bang -- not used (FIXME) +" cmd -- the (normal mode) command to execute for every line as a string +" --------------------------------------------------------------------------- +func! s:process(bang, cmd) + let msg = '' + + redraw + sleep 1m + + let lines = (getline('.','$')[0:-2]) + + for line in lines + redraw + + exec ':norm '.a:cmd + + if 'error' == s:last_status + let msg = 'With errors; press l to view log' + endif + + if 'updated' == s:last_status && empty(msg) + let msg = 'Plugins updated; press u to view changelog' + endif + + " goto next one + exec ':+1' + + setl nomodified + endfor + + redraw + echo 'Done! '.msg +endf + + +" --------------------------------------------------------------------------- +" Call another function in the different Vundle windows. +" +" func_name -- the function to call +" name -- the bundle name to call func_name for (string) +" ... -- the argument to be used when calling func_name (only the first +" optional argument will be used) +" return -- the status returned by the call to func_name +" --------------------------------------------------------------------------- +func! vundle#installer#run(func_name, name, ...) abort + let n = a:name + + echo 'Processing '.n + call s:sign('active') + + sleep 1m + + let status = call(a:func_name, a:1) + + call s:sign(status) + + redraw + + if 'new' == status + echo n.' installed' + elseif 'updated' == status + echo n.' updated' + elseif 'todate' == status + echo n.' already installed' + elseif 'deleted' == status + echo n.' deleted' + elseif 'helptags' == status + echo n.' regenerated' + elseif 'pinned' == status + echo n.' pinned' + elseif 'error' == status + echohl Error + echo 'Error processing '.n + echohl None + sleep 1 + else + throw 'whoops, unknown status:'.status + endif + + let s:last_status = status + + return status +endf + + +" --------------------------------------------------------------------------- +" Put a sign on the current line, indicating the status of the installation +" step. +" +" status -- string describing the status +" --------------------------------------------------------------------------- +func! s:sign(status) + if (!has('signs')) + return + endif + + exe ":sign place ".line('.')." line=".line('.')." name=Vu_". a:status ." buffer=" . bufnr("%") +endf + + +" --------------------------------------------------------------------------- +" Install a plugin, then add it to the runtimepath and source it. +" +" bang -- 1 or 0, passed directly to vundle#installer#install() +" name -- the name of a bundle (string) +" return -- the return value from vundle#installer#install() +" --------------------------------------------------------------------------- +func! vundle#installer#install_and_require(bang, name) abort + let result = vundle#installer#install(a:bang, a:name) + let b = vundle#config#bundle(a:name, {}) + call vundle#installer#helptags([b]) + call vundle#config#require([b]) + return result +endf + + +" --------------------------------------------------------------------------- +" Install or update a bundle given by its name. +" +" bang -- 1 or 0, passed directly to s:sync() +" name -- the name of a bundle (string) +" return -- the return value from s:sync() +" --------------------------------------------------------------------------- +func! vundle#installer#install(bang, name) abort + if !isdirectory(g:vundle#bundle_dir) | call mkdir(g:vundle#bundle_dir, 'p') | endif + + let n = substitute(a:name,"['".'"]\+','','g') + let matched = filter(copy(g:vundle#bundles), 'v:val.name_spec == n') + + if len(matched) > 0 + let b = matched[0] + else + let b = vundle#config#init_bundle(a:name, {}) + endif + + return s:sync(a:bang, b) +endf + + +" --------------------------------------------------------------------------- +" Call :helptags for all bundles in g:vundle#bundles. +" +" return -- 'error' if an error occurred, else return 'helptags' +" --------------------------------------------------------------------------- +func! vundle#installer#docs() abort + let error_count = vundle#installer#helptags(g:vundle#bundles) + if error_count > 0 + return 'error' + endif + return 'helptags' +endf + + +" --------------------------------------------------------------------------- +" Call :helptags for a list of bundles. +" +" bundles -- a list of bundle dictionaries for which :helptags should be +" called. +" return -- the number of directories where :helptags failed +" --------------------------------------------------------------------------- +func! vundle#installer#helptags(bundles) abort + let bundle_dirs = map(copy(a:bundles),'v:val.rtpath') + let help_dirs = filter(bundle_dirs, 's:has_doc(v:val)') + + call s:log('') + call s:log('Helptags:') + + let statuses = map(copy(help_dirs), 's:helptags(v:val)') + let errors = filter(statuses, 'v:val == 0') + + call s:log('Helptags: '.len(help_dirs).' plugins processed') + + return len(errors) +endf + + +" --------------------------------------------------------------------------- +" List all installed plugins. +" Corresponding documentation: vundle-plugins-list +" +" bang -- not used +" --------------------------------------------------------------------------- +func! vundle#installer#list(bang) abort + let bundles = vundle#scripts#bundle_names(map(copy(g:vundle#bundles), 'v:val.name_spec')) + call vundle#scripts#view('list', ['" My Plugins'], bundles) + redraw + echo len(g:vundle#bundles).' plugins configured' +endf + + +" --------------------------------------------------------------------------- +" List and remove all directories in the bundle directory which are not +" activated (added to the bundle list). +" +" bang -- 0 if the user should be asked to confirm every deletion, 1 if they +" should be removed unconditionally +" --------------------------------------------------------------------------- +func! vundle#installer#clean(bang) abort + let bundle_dirs = map(copy(g:vundle#bundles), 'v:val.path()') + let all_dirs = (v:version > 702 || (v:version == 702 && has("patch51"))) + \ ? split(globpath(g:vundle#bundle_dir, '*', 1), "\n") + \ : split(globpath(g:vundle#bundle_dir, '*'), "\n") + let x_dirs = filter(all_dirs, '0 > index(bundle_dirs, v:val)') + + if empty(x_dirs) + let headers = ['" All clean!'] + let names = [] + else + let headers = ['" Removing Plugins:'] + let names = vundle#scripts#bundle_names(map(copy(x_dirs), 'fnamemodify(v:val, ":t")')) + end + + call vundle#scripts#view('clean', headers, names) + redraw + + if (a:bang || empty(names)) + call s:process(a:bang, 'D') + else + call inputsave() + let response = input('Continue? [Y/n]: ') + call inputrestore() + if (response =~? 'y' || response == '') + call s:process(a:bang, 'D') + endif + endif +endf + + +" --------------------------------------------------------------------------- +" Delete to directory for a plugin. +" +" bang -- not used +" dir_name -- the bundle directory to be deleted (as a string) +" return -- 'error' if an error occurred, 'deleted' if the plugin folder was +" successfully deleted +" --------------------------------------------------------------------------- +func! vundle#installer#delete(bang, dir_name) abort + + let cmd = ((has('win32') || has('win64')) && empty(matchstr(&shell, 'sh'))) ? + \ 'rmdir /S /Q' : + \ 'rm -rf' + + let bundle = vundle#config#init_bundle(a:dir_name, {}) + let cmd .= ' '.vundle#installer#shellesc(bundle.path()) + + let out = s:system(cmd) + + call s:log('') + call s:log('Plugin '.a:dir_name) + call s:log(cmd, '$ ') + call s:log(out, '> ') + + if 0 != v:shell_error + return 'error' + else + return 'deleted' + endif +endf + + +" --------------------------------------------------------------------------- +" Check if a bundled plugin has any documentation. +" +" rtp -- a path (string) where the plugin is installed +" return -- 1 if some documentation was found, 0 otherwise +" --------------------------------------------------------------------------- +func! s:has_doc(rtp) abort + return isdirectory(a:rtp.'/doc') + \ && (!filereadable(a:rtp.'/doc/tags') || filewritable(a:rtp.'/doc/tags')) + \ && (v:version > 702 || (v:version == 702 && has("patch51"))) + \ ? !(empty(glob(a:rtp.'/doc/*.txt', 1)) && empty(glob(a:rtp.'/doc/*.??x', 1))) + \ : !(empty(glob(a:rtp.'/doc/*.txt')) && empty(glob(a:rtp.'/doc/*.??x'))) +endf + + +" --------------------------------------------------------------------------- +" Update the helptags for a plugin. +" +" rtp -- the path to the plugin's root directory (string) +" return -- 1 if :helptags succeeded, 0 otherwise +" --------------------------------------------------------------------------- +func! s:helptags(rtp) abort + " it is important to keep trailing slash here + let doc_path = resolve(a:rtp . '/doc/') + call s:log(':helptags '.doc_path) + try + execute 'helptags ' . doc_path + catch + call s:log("> Error running :helptags ".doc_path) + return 0 + endtry + return 1 +endf + + +" --------------------------------------------------------------------------- +" Get the URL for the remote called 'origin' on the repository that +" corresponds to a given bundle. +" +" bundle -- a bundle object to check the repository for +" return -- the URL for the origin remote (string) +" --------------------------------------------------------------------------- +func! s:get_current_origin_url(bundle) abort + let cmd = 'cd '.vundle#installer#shellesc(a:bundle.path()).' && git config --get remote.origin.url' + let cmd = vundle#installer#shellesc_cd(cmd) + let out = s:strip(s:system(cmd)) + return out +endf + + +" --------------------------------------------------------------------------- +" Get a short sha of the HEAD of the repository for a given bundle +" +" bundle -- a bundle object +" return -- A 15 character log sha for the current HEAD +" --------------------------------------------------------------------------- +func! s:get_current_sha(bundle) + let cmd = 'cd '.vundle#installer#shellesc(a:bundle.path()).' && git rev-parse HEAD' + let cmd = vundle#installer#shellesc_cd(cmd) + let out = s:system(cmd)[0:15] + return out +endf + + +" --------------------------------------------------------------------------- +" Create the appropriate sync command to run according to the current state of +" the local repository (clone, pull, reset, etc). +" +" In the case of a pull (update), also return the current sha, so that we can +" later check that there has been an upgrade. +" +" bang -- 0 if only new plugins should be installed, 1 if existing plugins +" should be updated +" bundle -- a bundle object to create the sync command for +" return -- A list containing the command to run and the sha for the current +" HEAD +" --------------------------------------------------------------------------- +func! s:make_sync_command(bang, bundle) abort + let git_dir = expand(a:bundle.path().'/.git/', 1) + if isdirectory(git_dir) || filereadable(expand(a:bundle.path().'/.git', 1)) + + let current_origin_url = s:get_current_origin_url(a:bundle) + if current_origin_url != a:bundle.uri + call s:log('Plugin URI change detected for Plugin ' . a:bundle.name) + call s:log('> Plugin ' . a:bundle.name . ' old URI: ' . current_origin_url) + call s:log('> Plugin ' . a:bundle.name . ' new URI: ' . a:bundle.uri) + " Directory names match but the origin remotes are not the same + let cmd_parts = [ + \ 'cd '.vundle#installer#shellesc(a:bundle.path()) , + \ 'git remote set-url origin ' . vundle#installer#shellesc(a:bundle.uri), + \ 'git fetch', + \ 'git reset --hard origin/HEAD', + \ 'git submodule update --init --recursive', + \ ] + let cmd = join(cmd_parts, ' && ') + let cmd = vundle#installer#shellesc_cd(cmd) + let initial_sha = '' + return [cmd, initial_sha] + endif + + if !(a:bang) + " The repo exists, and no !, so leave as it is. + return ['', ''] + endif + + let cmd_parts = [ + \ 'cd '.vundle#installer#shellesc(a:bundle.path()), + \ 'git pull', + \ 'git submodule update --init --recursive', + \ ] + let cmd = join(cmd_parts, ' && ') + let cmd = vundle#installer#shellesc_cd(cmd) + + let initial_sha = s:get_current_sha(a:bundle) + else + let cmd = 'git clone --recursive '.vundle#installer#shellesc(a:bundle.uri).' '.vundle#installer#shellesc(a:bundle.path()) + let initial_sha = '' + endif + return [cmd, initial_sha] +endf + + +" --------------------------------------------------------------------------- +" Install or update a given bundle object with git. +" +" bang -- 0 if only new plugins should be installed, 1 if existing plugins +" should be updated +" bundle -- a bundle object (dictionary) +" return -- a string indicating the status of the bundle installation: +" - todate : Nothing was updated or the repository was up to date +" - new : The plugin was newly installed +" - updated : Some changes where pulled via git +" - error : An error occurred in the shell command +" - pinned : The bundle is marked as pinned +" --------------------------------------------------------------------------- +func! s:sync(bang, bundle) abort + " Do not sync if this bundle is pinned + if a:bundle.is_pinned() + return 'pinned' + endif + + let [ cmd, initial_sha ] = s:make_sync_command(a:bang, a:bundle) + if empty(cmd) + return 'todate' + endif + + let out = s:system(cmd) + call s:log('') + call s:log('Plugin '.a:bundle.name_spec) + call s:log(cmd, '$ ') + call s:log(out, '> ') + + if 0 != v:shell_error + return 'error' + end + + if empty(initial_sha) + return 'new' + endif + + let updated_sha = s:get_current_sha(a:bundle) + + if initial_sha == updated_sha + return 'todate' + endif + + call add(g:vundle#updated_bundles, [initial_sha, updated_sha, a:bundle]) + return 'updated' +endf + + +" --------------------------------------------------------------------------- +" Escape special characters in a string to be able to use it as a shell +" command with system(). +" +" cmd -- the string holding the shell command +" return -- a string with the relevant characters escaped +" --------------------------------------------------------------------------- +func! vundle#installer#shellesc(cmd) abort + if ((has('win32') || has('win64')) && empty(matchstr(&shell, 'sh'))) + return '"' . substitute(a:cmd, '"', '\\"', 'g') . '"' + endif + return shellescape(a:cmd) +endf + + +" --------------------------------------------------------------------------- +" Fix a cd shell command to be used on Windows. +" +" cmd -- the command to be fixed (string) +" return -- the fixed command (string) +" --------------------------------------------------------------------------- +func! vundle#installer#shellesc_cd(cmd) abort + if ((has('win32') || has('win64')) && empty(matchstr(&shell, 'sh'))) + let cmd = substitute(a:cmd, '^cd ','cd /d ','') " add /d switch to change drives + return cmd + else + return a:cmd + endif +endf + + +" --------------------------------------------------------------------------- +" Make a system call. This can be used to change the way system calls +" are made during developing, without searching the whole code base for +" actual system() calls. +" +" cmd -- the command passed to system() (string) +" return -- the return value from system() +" --------------------------------------------------------------------------- +func! s:system(cmd) abort + return system(a:cmd) +endf + + +" --------------------------------------------------------------------------- +" Add a log message to Vundle's internal logging variable. +" +" str -- the log message (string) +" prefix -- optional prefix for multi-line entries (string) +" return -- a:str +" --------------------------------------------------------------------------- +func! s:log(str, ...) abort + let prefix = a:0 > 0 ? a:1 : '' + let fmt = '%Y-%m-%d %H:%M:%S' + let lines = split(a:str, '\n', 1) + let time = strftime(fmt) + for line in lines + call add(g:vundle#log, '['. time .'] '. prefix . line) + endfor + return a:str +endf + + +" --------------------------------------------------------------------------- +" Remove leading and trailing whitespace from a string +" +" str -- The string to rid of trailing and leading spaces +" return -- A string stripped of side spaces +" --------------------------------------------------------------------------- +func! s:strip(str) + return substitute(a:str, '\%^\_s*\(.\{-}\)\_s*\%$', '\1', '') +endf + +" vim: set expandtab sts=2 ts=2 sw=2 tw=78 norl: diff --git a/vim/bundle/Vundle.vim/autoload/vundle/scripts.vim b/vim/bundle/Vundle.vim/autoload/vundle/scripts.vim new file mode 100644 index 0000000..f789762 --- /dev/null +++ b/vim/bundle/Vundle.vim/autoload/vundle/scripts.vim @@ -0,0 +1,280 @@ +" --------------------------------------------------------------------------- +" Search the database from vim-script.org for a matching plugin. If no +" argument is given, list all plugins. This function is used by the :Plugins +" and :PluginSearch commands. +" +" bang -- if 1 refresh the script name cache, if 0 don't +" ... -- a plugin name to search for +" --------------------------------------------------------------------------- +func! vundle#scripts#all(bang, ...) + let b:match = '' + let info = ['"Keymap: i - Install plugin; c - Cleanup; s - Search; R - Reload list'] + let matches = s:load_scripts(a:bang) + if !empty(a:1) + let matches = filter(matches, 'v:val =~? "'.escape(a:1,'"').'"') + let info += ['"Search results for: '.a:1] + " TODO: highlight matches + let b:match = a:1 + endif + call vundle#scripts#view('search',info, vundle#scripts#bundle_names(reverse(matches))) + redraw + echo len(matches).' plugins found' +endf + + +" --------------------------------------------------------------------------- +" Repeat the search for bundles. +" --------------------------------------------------------------------------- +func! vundle#scripts#reload() abort + silent exec ':PluginSearch! '.(exists('b:match') ? b:match : '') + redraw +endf + + +" --------------------------------------------------------------------------- +" Complete names for bundles in the command line. +" +" a, c, d -- see :h command-completion-custom +" return -- all valid plugin names from vim-scripts.org as completion +" candidates, or all installed plugin names when running an 'Update +" variant'. see also :h command-completion-custom +" --------------------------------------------------------------------------- +func! vundle#scripts#complete(a,c,d) + if match(a:c, '\v^%(Plugin|Vundle)%(Install!|Update)') == 0 + " Only installed plugins if updating + return join(map(copy(g:vundle#bundles), 'v:val.name'), "\n") + else + " Or all known plugins otherwise + return join(s:load_scripts(0),"\n") + endif +endf + + +" --------------------------------------------------------------------------- +" View the logfile after an update or installation. +" --------------------------------------------------------------------------- +func! s:view_log() + if !exists('s:log_file') + let s:log_file = tempname() + endif + + if bufloaded(s:log_file) + execute 'silent bdelete' s:log_file + endif + call writefile(g:vundle#log, s:log_file) + execute 'silent pedit ' . s:log_file + set bufhidden=wipe + setl buftype=nofile + setl noswapfile + setl ro noma + + wincmd P | wincmd H +endf + + +" --------------------------------------------------------------------------- +" Parse the output from git log after an update to create a change log for the +" user. +" --------------------------------------------------------------------------- +func! s:create_changelog() abort + let changelog = ['Updated Plugins:'] + for bundle_data in g:vundle#updated_bundles + let initial_sha = bundle_data[0] + let updated_sha = bundle_data[1] + let bundle = bundle_data[2] + + let cmd = 'cd '.vundle#installer#shellesc(bundle.path()). + \ ' && git log --pretty=format:"%s %an, %ar" --graph '. + \ initial_sha.'..'.updated_sha + + let cmd = vundle#installer#shellesc_cd(cmd) + + let updates = system(cmd) + + call add(changelog, '') + call add(changelog, 'Updated Plugin: '.bundle.name) + + if bundle.uri =~ "https://github.com" + call add(changelog, 'Compare at: '.bundle.uri[0:-5].'/compare/'.initial_sha.'...'.updated_sha) + endif + + for update in split(updates, '\n') + let update = substitute(update, '\s\+$', '', '') + call add(changelog, ' '.update) + endfor + endfor + return changelog +endf + + +" --------------------------------------------------------------------------- +" View the change log after an update or installation. +" --------------------------------------------------------------------------- +func! s:view_changelog() + if !exists('s:changelog_file') + let s:changelog_file = tempname() + endif + + if bufloaded(s:changelog_file) + execute 'silent bdelete' s:changelog_file + endif + call writefile(s:create_changelog(), s:changelog_file) + execute 'silent pedit' s:changelog_file + set bufhidden=wipe + setl buftype=nofile + setl noswapfile + setl ro noma + setfiletype vundlelog + + wincmd P | wincmd H +endf + + +" --------------------------------------------------------------------------- +" Create a list of 'Plugin ...' lines from a list of bundle names. +" +" names -- a list of names (strings) of plugins +" return -- a list of 'Plugin ...' lines suitable to be written to a buffer +" --------------------------------------------------------------------------- +func! vundle#scripts#bundle_names(names) + return map(copy(a:names), ' printf("Plugin ' ."'%s'".'", v:val) ') +endf + + +" --------------------------------------------------------------------------- +" Open a buffer to display information to the user. Several special commands +" are defined in the new buffer. +" +" title -- a title for the new buffer +" headers -- a list of header lines to be displayed at the top of the buffer +" results -- the main information to be displayed in the buffer (list of +" strings) +" --------------------------------------------------------------------------- +func! vundle#scripts#view(title, headers, results) + if exists('s:view') && bufloaded(s:view) + exec s:view.'bd!' + endif + + exec 'silent pedit [Vundle] '.a:title + + wincmd P | wincmd H + + let s:view = bufnr('%') + " + " make buffer modifiable + " to append without errors + set modifiable + + call append(0, a:headers + a:results) + + setl buftype=nofile + setl noswapfile + set bufhidden=wipe + + setl cursorline + setl nonu ro noma + if (exists('&relativenumber')) | setl norelativenumber | endif + + setl ft=vundle + setl syntax=vim + syn keyword vimCommand Plugin + syn keyword vimCommand Bundle + syn keyword vimCommand Helptags + + com! -buffer -bang -nargs=1 DeletePlugin + \ call vundle#installer#run('vundle#installer#delete', split(,',')[0], ['!' == '', ]) + + com! -buffer -bang -nargs=? InstallAndRequirePlugin + \ call vundle#installer#run('vundle#installer#install_and_require', split(,',')[0], ['!' == '', ]) + + com! -buffer -bang -nargs=? InstallPlugin + \ call vundle#installer#run('vundle#installer#install', split(,',')[0], ['!' == '', ]) + + com! -buffer -bang -nargs=0 InstallHelptags + \ call vundle#installer#run('vundle#installer#docs', 'helptags', []) + + com! -buffer -nargs=0 VundleLog call s:view_log() + + com! -buffer -nargs=0 VundleChangelog call s:view_changelog() + + nnoremap q :silent bd! + nnoremap D :exec 'Delete'.getline('.') + + nnoremap add :exec 'Install'.getline('.') + nnoremap add! :exec 'Install'.substitute(getline('.'), '^Plugin ', 'Plugin! ', '') + + nnoremap i :exec 'InstallAndRequire'.getline('.') + nnoremap I :exec 'InstallAndRequire'.substitute(getline('.'), '^Plugin ', 'Plugin! ', '') + + nnoremap l :VundleLog + nnoremap u :VundleChangelog + nnoremap h :h vundle + nnoremap ? :h vundle + + nnoremap c :PluginClean + nnoremap C :PluginClean! + + nnoremap s :PluginSearch + nnoremap R :call vundle#scripts#reload() + + " goto first line after headers + exec ':'.(len(a:headers) + 1) +endf + + +" --------------------------------------------------------------------------- +" Load the plugin database from vim-scripts.org . +" +" to -- the filename (string) to save the database to +" return -- 0 on success, 1 if an error occurred +" --------------------------------------------------------------------------- +func! s:fetch_scripts(to) + let scripts_dir = fnamemodify(expand(a:to, 1), ":h") + if !isdirectory(scripts_dir) + call mkdir(scripts_dir, "p") + endif + + let l:vim_scripts_json = 'http://vim-scripts.org/api/scripts.json' + if executable("curl") + let cmd = 'curl --fail -s -o '.vundle#installer#shellesc(a:to).' '.l:vim_scripts_json + elseif executable("wget") + let temp = vundle#installer#shellesc(tempname()) + let cmd = 'wget -q -O '.temp.' '.l:vim_scripts_json. ' && mv -f '.temp.' '.vundle#installer#shellesc(a:to) + if (has('win32') || has('win64')) + let cmd = substitute(cmd, 'mv -f ', 'move /Y ', '') " change force flag + let cmd = vundle#installer#shellesc(cmd) + end + else + echoerr 'Error curl or wget is not available!' + return 1 + endif + + call system(cmd) + + if (0 != v:shell_error) + echoerr 'Error fetching scripts!' + return v:shell_error + endif + return 0 +endf + + +" --------------------------------------------------------------------------- +" Load the plugin database and return a list of all plugins. +" +" bang -- if 1 download the redatabase, else only download if it is not +" readable on disk (i.e. does not exist) +" return -- a list of strings, these are the names (valid bundle +" specifications) of all plugins from vim-scripts.org +" --------------------------------------------------------------------------- +func! s:load_scripts(bang) + let f = expand(g:vundle#bundle_dir.'/.vundle/script-names.vim-scripts.org.json', 1) + if a:bang || !filereadable(f) + if 0 != s:fetch_scripts(f) + return [] + end + endif + return eval(readfile(f, 'b')[0]) +endf + +" vim: set expandtab sts=2 ts=2 sw=2 tw=78 norl: diff --git a/vim/bundle/Vundle.vim/changelog.md b/vim/bundle/Vundle.vim/changelog.md new file mode 100644 index 0000000..b620840 --- /dev/null +++ b/vim/bundle/Vundle.vim/changelog.md @@ -0,0 +1,22 @@ +Change Log +========== +F = Feature, B = Bug Fix, D = Doc Change + +### Version 0.10.2 + +- B: #430 Put user script directories before system directories in rtp +- B: #455 Rename functions that start with `g:` + lowercase letter (Vim patch 7.4.264) + +### Version 0.10.1 +- B: #451 Escape spaces when handling rtp directories + +### Version 0.10 +- F: #415 Support plugin pinning (for non-git repos & preventing updates) +- F: #440 Detect plugin name collisions +- F: #418 Deferred rtp manipulation (speeds up start) +- B: #418 Leave default rtp directories (i.e. ~/.vim) where they should be +- B: #429 Fix newline character in log +- B: #440 Detect changed remotes & update repos +- D: #435 Image update in README.md +- D: #419 Add function documentation +- D: #436 Rename vundle to Vundle.vim, add modelines, quickstart update diff --git a/vim/bundle/Vundle.vim/doc/vundle.txt b/vim/bundle/Vundle.vim/doc/vundle.txt new file mode 100644 index 0000000..81a5f66 --- /dev/null +++ b/vim/bundle/Vundle.vim/doc/vundle.txt @@ -0,0 +1,411 @@ +*vundle.txt* Vundle, a plug-in manager for Vim. *vundle* + + VUNDLE MANUAL + +1. About Vundle |vundle-about| +2. Quick Start |vundle-quickstart| +3. Plugins |vundle-plugins| + 3.1. Configuring Plugins |vundle-plugins-configure| + 3.2. Supported URIs |vundle-plugins-uris| + 3.3. Installing Plugins |vundle-plugins-install| + 3.4. Updating Plugins |vundle-plugins-update| + 3.5. Searching Plugins |vundle-plugins-search| + 3.6. Listing Plugins |vundle-plugins-list| + 3.7. Cleaning Up |vundle-plugins-cleanup| +4. Interactive Mode |vundle-interactive| +5. Key Mappings |vundle-keymappings| +6. Options |vundle-options| +7. Plugin Interface Change |vundle-interface-change| + +============================================================================= +1. ABOUT VUNDLE ~ + *vundle-about* + +Vundle is short for Vim bundle and is a Vim plugin manager. + +Vundle allows you to... + + - keep track of and configure your scripts right in the `.vimrc` + - install configured scripts (a.k.a. bundle) + - update configured scripts + - search by name all available Vim scripts + - clean unused scripts up + - run the above actions in a single keypress with interactive mode + +Vundle automatically... + + - manages the runtime path of your installed scripts + - regenerates help tags after installing and updating + +Vundle's search uses http://vim-scripts.org to provide a list of all +available Vim scripts. + +Vundle is undergoing an interface change, see |vundle-interface-change| for +more information. + +============================================================================= +2. QUICK START ~ + *vundle-quickstart* + +1. Introduction: + + Installation requires `Git` and triggers git clone for each configured + repository to `~/.vim/bundle/` by default. Curl is required for search. + + *vundle-windows* + If you are using Windows, see instructions on the Wiki + https://github.com/VundleVim/Vundle.vim/wiki/Vundle-for-Windows. + + *vundle-faq* + If you run into any issues, please consult the FAQ at + https://github.com/VundleVim/Vundle.vim/wiki + +2. Setup Vundle: +> + git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim +< +3. Configure bundles: + + Put this at the top of your `.vimrc` to use Vundle. Remove bundles you + don't need, they are for illustration purposes. +> + set nocompatible " be iMproved, required + filetype off " required + + " set the runtime path to include Vundle and initialize + set rtp+=~/.vim/bundle/Vundle.vim + call vundle#begin() + " alternatively, pass a path where Vundle should install plugins + "call vundle#begin('~/some/path/here') + + " let Vundle manage Vundle, required + Plugin 'VundleVim/Vundle.vim' + + " The following are examples of different formats supported. + " Keep Plugin commands between vundle#begin/end. + " plugin on GitHub repo + Plugin 'tpope/vim-fugitive' + " plugin from http://vim-scripts.org/vim/scripts.html + Plugin 'L9' + " Git plugin not hosted on GitHub + Plugin 'git://git.wincent.com/command-t.git' + " git repos on your local machine (i.e. when working on your own plugin) + Plugin 'file:///home/gmarik/path/to/plugin' + " The sparkup vim script is in a subdirectory of this repo called vim. + " Pass the path to set the runtimepath properly. + Plugin 'rstacruz/sparkup', {'rtp': 'vim/'} + " Avoid a name conflict with L9 + Plugin 'user/L9', {'name': 'newL9'} + + " All of your Plugins must be added before the following line + call vundle#end() " required + filetype plugin indent on " required + " To ignore plugin indent changes, instead use: + "filetype plugin on + " + " Brief help + " :PluginList - list configured plugins + " :PluginInstall(!) - install (update) plugins + " :PluginSearch(!) foo - search (or refresh cache first) for foo + " :PluginClean(!) - confirm (or auto-approve) removal of unused plugins + " + " see :h vundle for more details or wiki for FAQ + " Put your non-Plugin stuff after this line + +4. Install configured bundles: + + Launch vim and run +> + :PluginInstall +< + To install from command line: +> + vim +PluginInstall +qall + +============================================================================= +3. PLUGINS ~ + *vundle-plugins* + +3.1 CONFIGURING PLUGINS ~ + *vundle-plugins-configure* *:Plugin* + +Vundle tracks what plugins you want configured by the `Plugin` commands in your +`.vimrc`. Each `Plugin` command tells Vundle to activate the script on startup +adding it to your |runtimepath|. Commenting out or removing the line will +disable the `Plugin`. + +Each `Plugin` command takes a URI pointing to the script. No comments should +follow on the same line as the command. Example: +> + Plugin 'git_URI' + +The `Plugin` command can optionally take a second argument after the URI. It +has to be a dictionary, separated from the URI by a comma. Each key-value pair +in the dictionary is a configuration option. + +The following per-script configuration options are available. + +The 'rtp' option +---------------- + +Specifies a directory inside the repository (relative path from the root of +the repository) where the vim plugin resides. It determines the path that will +be added to the |runtimepath|. + +For example: +> + Plugin 'git_URI', {'rtp': 'some/subdir/'} + +This can be used with git repositories that put the vim plugin inside a +subdirectory. + +The 'name' option +----------------- + +The name of the directory that will hold the local clone of the configured +script. + +For example: +> + Plugin 'git_URI', {'name': 'newPluginName'} + +This can be used to prevent name collisions between plugins that Vundle would +otherwise try to clone into the same directory. It also provides an additional +level of customisation. + +The 'pinned' option +------------------- + +A flag that, when set to a value of 1, tells Vundle not to perform any git +operations on the plugin, while still adding the existing plugin under the +`bundles` directories to the |runtimepath|. + +For example: +> + Plugin 'mylocalplugin', {'pinned': 1} + +This allows the users to include, with Vundle, plugins tracked with version +control systems other than git, but the user is responsible for cloning and +keeping up to date. It also allows the users to stay in the current version of +a plugin that might have previously been updated by Vundle. + +Please note that the URI will be treated the same as for any other plugins, so +only the last part of it will be added to the |runtimepath|. The user is +advised to use this flag only with single word URIs to avoid confusion. + +3.2 SUPPORTED URIS ~ + *vundle-plugins-uris* + +`Vundle` integrates very well with both GitHub and vim-scripts.org +(http://vim-scripts.org/vim/scripts.html) allowing short URIs. It also allows +the use of any URI `git` recognizes. In all of the following cases (except +local) the 'https' protocol is used, see Vundle's options to override this. + +More information on `git`'s protocols can be found at: +http://git-scm.com/book/ch4-1.html + +GitHub +------ +GitHub is used when a user/repo is passed to `Plugin`. +> + Plugin 'VundleVim/Vundle.vim' => https://github.com/VundleVim/Vundle.vim + +Vim Scripts +----------- +Any single word without a slash '/' is assumed to be from Vim Scripts. +> + Plugin 'ctrlp.vim' => https://github.com/vim-scripts/ctrlp.vim + +Other Git URIs +-------------- +No modification is performed on valid URIs that point outside the above +URLs. +> + Plugin 'git://git.wincent.com/command-t.git' + +Local Plugins +------------- +The git protocol supports local installation using the 'file://' protocol. +This is handy when developing plugins locally. Follow the protocol with an +absolute path to the script directory. +> + Plugin 'file:///path/from/root/to/plugin' + +3.3 INSTALLING PLUGINS ~ + *vundle-plugins-install* *:PluginInstall* +> + :PluginInstall + +Will install all plugins configured in your `.vimrc`. Newly installed +plugins will be automatically enabled. Some plugins may require extra steps +such as compilation or external programs, refer to their documentation. + +PluginInstall allows installation of plugins by name: +> + :PluginInstall unite.vim + +Installs and activates unite.vim. + +PluginInstall also allows installation of several plugins separated by space. +> + :PluginInstall tpope/vim-surround tpope/vim-fugitive + +Installs both tpope/vim-surround and tpope/vim-fugitive from GitHub. + +You can use Tab to auto-complete known script names. +Note that the installation just described isn't permanent. To +finish, you must put `Plugin 'unite.vim'` at the appropriate place in your +`.vimrc` to tell Vundle to load the plugin at startup. + +After installing plugins press 'l' (lowercase 'L') to see the log of commands +if any errors occurred. + +3.4 UPDATING PLUGINS ~ + *vundle-plugins-update* *:PluginUpdate* *:PluginInstall!* +> + :PluginInstall! " NOTE: bang(!) +or > + :PluginUpdate + +Installs or updates the configured plugins. Press 'u' after updates complete +to see the change log of all updated bundles. Press 'l' (lowercase 'L') to +see the log of commands if any errors occurred. + +To update specific plugins, write their names separated by space: +> + :PluginInstall! vim-surround vim-fugitive +or > + :PluginUpdate vim-surround vim-fugitive + +3.5 SEARCHING PLUGINS ~ + *vundle-plugins-search* *:PluginSearch* +> + :PluginSearch + +Search requires that `curl` be available on the system. The command searches +Vim Scripts (http://vim-scripts.org/vim/scripts.html) for matching +plugins. Results display in a new split window. For example: +> + PluginSearch foo + +displays: +> + "Search results for: foo + Plugin 'MarkdownFootnotes' + Plugin 'VimFootnotes' + Plugin 'foo.vim' +< + *:PluginSearch!* +Alternatively, you can refresh the script list before searching by adding a +bang to the command. +> + :PluginSearch! foo + +If the command is run without argument: +> + :PluginSearch! + +it will display all known plugins in the new split. + +3.6 LISTING BUNDLES ~ + *vundle-plugins-list* *:PluginList* +> + :PluginList + +Displays a list of installed bundles. + +3.7 CLEANING UP ~ + *vundle-plugins-cleanup* *:PluginClean* +> + :PluginClean + +Requests confirmation for the removal of all plugins no longered configured +in your `.vimrc` but present in your bundle installation directory +(default: `.vim/bundle/`). + + *:PluginClean!* +> + :PluginClean! + +Automatically confirm removal of unused bundles. + +============================================================================= +4. INTERACTIVE MODE ~ + *vundle-interactive* + +Vundle provides a simple interactive mode to help you explore new plugins +easily. Interactive mode is available after any command that lists `Plugins` +such as PluginSearch, PluginList or Plugins. For instance: +> + :PluginSearch! unite + +Searches for plugins matching 'unite' and yields a split window with: +> + "Keymap: i - Install bundle; c - Cleanup; s - Search; R - Reload list + "Search results for: unite + Plugin 'unite-scriptenames' + Plugin 'unite.vim' + Plugin 'unite-yarm' + Plugin 'unite-gem' + Plugin 'unite-locate' + Plugin 'unite-font' + Plugin 'unite-colorscheme' + +To install a bundle, move your cursor to the Plugin of interest and then +select a command. To install 'unite.vim' put your cursor on the line and +then push `i`. For a more complete list see |vundle-keymappings|. After +unite.vim is installed the `:Unite file` command should be available. + +Note: Interactive installation doesn't update your `.vimrc`. + +============================================================================= +5. KEY MAPPINGS ~ + *vundle-keymappings* + +KEY | DESCRIPTION +----|-------------------------- > + i | run :PluginInstall with name taken from line cursor is positioned on + I | same as i, but runs :PluginInstall! to update bundle + D | delete selected bundle (be careful not to remove local modifications) + c | run :PluginClean + s | run :PluginSearch + R | fetch fresh script list from server + +============================================================================= +6. OPTIONS ~ + *vundle-options* +> + let g:vundle_default_git_proto = 'git' +< + This option makes Vundle use `git` instead of `https` when building + absolute URIs. For example: +> + Plugin 'sjl/gundo.vim' -> git@github.com:sjl/gundo.git + +============================================================================= +7. VUNDLE INTERFACE CHANGE ~ + *vundle-interface-change* *:Bundle* *:BundleInstall!* + *:BundleUpdate* *:BundleSearch* *:BundleList* *:BundleClean!* + *:VundleInstall!* *:VundleUpdate* *:VundleSearch* + *:VundleList* *:VundleClean!* + + In order to bring in new changes, Vundle is adopting a new interface. + Going forward we will support primarily the Plugin namespace, additionally + for convenience we will also alias some commands to the Vundle namespace. + The following table summarizes the interface changes. + + Deprecated Names | New Names + ----------------------------- + Bundle | Plugin + BundleInstall(!) | PluginInstall(!), VundleInstall(!) + BundleUpdate | PluginUpdate, VundleUpdate + BundleSearch(!) | PluginSearch(!), VundleSearch(!) + BundleClean | PluginClean(!), VundleClean(!) + BundleList | PluginList + + Note: The Bundle commands will be deprecated. You may continue using them, + but they may not get all future updates. For instance, we have enabled + comments on Plugin lines but not Bundle, since it requires a change in + command declaration. + +" vim: set expandtab sts=2 ts=2 sw=2 tw=78 ft=help norl: diff --git a/vim/bundle/Vundle.vim/ftplugin/vundlelog.vim b/vim/bundle/Vundle.vim/ftplugin/vundlelog.vim new file mode 100644 index 0000000..0f338eb --- /dev/null +++ b/vim/bundle/Vundle.vim/ftplugin/vundlelog.vim @@ -0,0 +1,15 @@ +" --------------------------------------------------------------------------- +" Standard ftplugin boilerplate; see ':help ftplugin'. +" --------------------------------------------------------------------------- +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + + +" --------------------------------------------------------------------------- +" Settings for the Vundle update log buffer. +" --------------------------------------------------------------------------- +setlocal textwidth=0 +setlocal nowrap +setlocal noswapfile diff --git a/vim/bundle/Vundle.vim/syntax/vundlelog.vim b/vim/bundle/Vundle.vim/syntax/vundlelog.vim new file mode 100644 index 0000000..64e81e3 --- /dev/null +++ b/vim/bundle/Vundle.vim/syntax/vundlelog.vim @@ -0,0 +1,36 @@ +" --------------------------------------------------------------------------- +" Syntax highlighting for the line which identifies the plugin. +" --------------------------------------------------------------------------- +syntax match VundlePluginName '\v(^Updated Plugin: )@<=.*$' +highlight link VundlePluginName Keyword + +" --------------------------------------------------------------------------- +" Syntax highlighting for the 'compare at' line of each plugin. +" --------------------------------------------------------------------------- +syntax region VundleCompareLine start='\v^Compare at: https:' end='\v\n' + \ contains=VundleCompareUrl +syntax match VundleCompareUrl '\vhttps:\S+' +highlight link VundleCompareLine Comment +highlight link VundleCompareUrl Underlined + +" --------------------------------------------------------------------------- +" Syntax highlighting for individual commits. +" --------------------------------------------------------------------------- +" The main commit line. +" Note that this regex is intimately related to the one for VundleCommitTree, +" and the two should be changed in sync. +syntax match VundleCommitLine '\v(^ [|*]( *[\\|/\*])* )@<=[^*|].*$' + \ contains=VundleCommitMerge,VundleCommitUser,VundleCommitTime +highlight link VundleCommitLine String +" Sub-regions inside the commit message. +syntax match VundleCommitMerge '\v Merge pull request #\d+.*' +syntax match VundleCommitUser '\v( )@<=\S+( \S+)*(, \d+ \w+ ago$)@=' +syntax match VundleCommitTime '\v(, )@<=\d+ \w+ ago$' +highlight link VundleCommitMerge Ignore +highlight link VundleCommitUser Identifier +highlight link VundleCommitTime Comment +" The git history DAG markers are outside of the main commit line region. +" Note that this regex is intimately related to the one for VundleCommitLine, +" and the two should be changed in sync. +syntax match VundleCommitTree '\v(^ )@<=[|*]( *[\\|/\*])*' +highlight link VundleCommitTree Label diff --git a/vim/bundle/Vundle.vim/test/files/test.erl b/vim/bundle/Vundle.vim/test/files/test.erl new file mode 100644 index 0000000..1672953 --- /dev/null +++ b/vim/bundle/Vundle.vim/test/files/test.erl @@ -0,0 +1,20 @@ +-module(mmc_logmon_sup). +-behaviour(supervisor). +-export([init/1]). + +init(_) -> + {ok, { + {one_for_one, 5, 1}, + [ + {listener, + {aaa, start_link, []}, + permanent, 100, worker, + [aaa] + }, + {server, + {bbb, start_link, []}, + permanent, 100, worker, + [bbb] + } + ] + }}. diff --git a/vim/bundle/Vundle.vim/test/minirc.vim b/vim/bundle/Vundle.vim/test/minirc.vim new file mode 100644 index 0000000..f4ece70 --- /dev/null +++ b/vim/bundle/Vundle.vim/test/minirc.vim @@ -0,0 +1,9 @@ +set nocompatible +syntax on +filetype off +set rtp+=~/.vim/bundle/Vundle.vim/ +call vundle#begin() +Plugin 'VundleVim/Vundle.vim' +call vundle#end() +filetype plugin indent on + diff --git a/vim/bundle/Vundle.vim/test/vimrc b/vim/bundle/Vundle.vim/test/vimrc new file mode 100644 index 0000000..d8455a7 --- /dev/null +++ b/vim/bundle/Vundle.vim/test/vimrc @@ -0,0 +1,81 @@ +" vim -u test/vimrc +set nocompatible + +set nowrap + +let bundle_dir = '/tmp/vundle-test/bundles/' +" let src = 'http://github.com/gmarik/vundle.git' + +" Vundle Options +" let g:vundle_default_git_proto = 'git' + +silent execute '!mkdir -p '.bundle_dir +silent execute '!ln -f -s ~/.vim/bundle/Vundle.vim '.bundle_dir + +filetype off +syntax on + +runtime macros/matchit.vim + +" This test should be executed in "test" directory +exec 'set rtp^='.bundle_dir.'Vundle.vim/' + +call vundle#rc(bundle_dir) + + +Plugin 'molokai' " vim-scripts name + +" github username with dashes +Bundle 'vim-scripts/ragtag.vim' + +" original repo +Bundle 'altercation/vim-colors-solarized' +" with extension +Bundle 'nelstrom/vim-mac-classic-theme.git' +" +" invalid uri +"Bundle 'nonexistinguser/yupppierepo.git' + +" full uri +Bundle 'https://github.com/vim-scripts/vim-game-of-life' +" full uri +Bundle 'git@github.com:gmarik/ingretu.git' +" short uri +Bundle 'gh:gmarik/snipmate.vim.git' +Bundle 'github:mattn/gist-vim.git' + +" local uri stuff +Bundle '~/Dropbox/.gitrepos/utilz.vim.git' +" Bundle 'file://Dropbox/.gitrepos/utilz.vim.git' + +" with options +Bundle 'rstacruz/sparkup.git', {'rtp': 'vim/'} +Bundle 'matchit.zip', {'name': 'matchit'} + +" Camel case +Bundle 'vim-scripts/RubySinatra' + +" syntax issue #203 +Bundle 'jimenezrick/vimerl' + +" Static bundle: Same name as a valid vim-scripts bundle +Bundle 'latte', {'pinned' : 1} +if !isdirectory(expand(bundle_dir) . '/latte') + call mkdir(expand(bundle_dir) . '/latte', 'p') +endif + + +filetype plugin indent on " Automatically detect file types. + +set wildignore+=doc " should not break helptags +set wildignore+=.git " should not break clone +set wildignore+=.git/* " should not break clone +set wildignore+=*/.git/* +" TODO: helptags fails with this +" set wildignore+=doc/* " should not break clone +" set wildignore+=*/doc/* + +au VimEnter * BundleInstall + +" e test/files/erlang.erl +" vim: set expandtab sts=2 ts=2 sw=2 tw=78: diff --git a/vim/doc/imaps.txt.gz b/vim/doc/imaps.txt.gz new file mode 120000 index 0000000..cf5808b --- /dev/null +++ b/vim/doc/imaps.txt.gz @@ -0,0 +1 @@ +/usr/share/vim/addons/doc/imaps.txt.gz \ No newline at end of file diff --git a/vim/doc/latex-suite-quickstart.txt.gz b/vim/doc/latex-suite-quickstart.txt.gz new file mode 120000 index 0000000..5ef4db2 --- /dev/null +++ b/vim/doc/latex-suite-quickstart.txt.gz @@ -0,0 +1 @@ +/usr/share/vim/addons/doc/latex-suite-quickstart.txt.gz \ No newline at end of file diff --git a/vim/doc/latex-suite.txt.gz b/vim/doc/latex-suite.txt.gz new file mode 120000 index 0000000..35c3d5a --- /dev/null +++ b/vim/doc/latex-suite.txt.gz @@ -0,0 +1 @@ +/usr/share/vim/addons/doc/latex-suite.txt.gz \ No newline at end of file diff --git a/vim/doc/latexhelp.txt.gz b/vim/doc/latexhelp.txt.gz new file mode 120000 index 0000000..f8197a0 --- /dev/null +++ b/vim/doc/latexhelp.txt.gz @@ -0,0 +1 @@ +/usr/share/vim/addons/doc/latexhelp.txt.gz \ No newline at end of file diff --git a/vim/doc/tags b/vim/doc/tags new file mode 100644 index 0000000..c821193 --- /dev/null +++ b/vim/doc/tags @@ -0,0 +1,915 @@ +Alph latexhelp.txt.gz /*Alph* +Alt-B latex-suite.txt.gz /*Alt-B* +Alt-C latex-suite.txt.gz /*Alt-C* +Alt-I latex-suite.txt.gz /*Alt-I* +Alt-L latex-suite.txt.gz /*Alt-L* +BibTeX latexhelp.txt.gz /*BibTeX* +IMAP_PutTextWithMovement latex-suite.txt.gz /*IMAP_PutTextWithMovement* +Imap_DeleteEmptyPlaceHolders latex-suite.txt.gz /*Imap_DeleteEmptyPlaceHolders* +Imap_FreezeImap latex-suite.txt.gz /*Imap_FreezeImap* +Imap_PlaceHolderEnd latex-suite.txt.gz /*Imap_PlaceHolderEnd* +Imap_PlaceHolderStart latex-suite.txt.gz /*Imap_PlaceHolderStart* +Imap_StickyPlaceHolders latex-suite.txt.gz /*Imap_StickyPlaceHolders* +Imap_UsePlaceHolders latex-suite.txt.gz /*Imap_UsePlaceHolders* +LaTeX latexhelp.txt.gz /*LaTeX* +Plug_IMAP_DeleteAndJumBack latex-suite.txt.gz /*Plug_IMAP_DeleteAndJumBack* +Plug_IMAP_DeleteAndJumpForward latex-suite.txt.gz /*Plug_IMAP_DeleteAndJumpForward* +Plug_IMAP_JumpBack latex-suite.txt.gz /*Plug_IMAP_JumpBack* +Plug_IMAP_JumpForward latex-suite.txt.gz /*Plug_IMAP_JumpForward* +Plug_Tex_InsertItemOnThisLine latex-suite.txt.gz /*Plug_Tex_InsertItemOnThisLine* +Plug_Tex_LeftRight latex-suite.txt.gz /*Plug_Tex_LeftRight* +Plug_Tex_MathBF latex-suite.txt.gz /*Plug_Tex_MathBF* +Plug_Tex_MathCal latex-suite.txt.gz /*Plug_Tex_MathCal* +Roman latexhelp.txt.gz /*Roman* +TClearCiteHist latex-suite.txt.gz /*TClearCiteHist* +TLook latex-suite.txt.gz /*TLook* +TLookAll latex-suite.txt.gz /*TLookAll* +TLookBib latex-suite.txt.gz /*TLookBib* +TMacro latex-suite.txt.gz /*TMacro* +TMacroDelete latex-suite.txt.gz /*TMacroDelete* +TMacroEdit latex-suite.txt.gz /*TMacroEdit* +TMacroNew latex-suite.txt.gz /*TMacroNew* +TPackage latex-suite.txt.gz /*TPackage* +TPackageUpdate latex-suite.txt.gz /*TPackageUpdate* +TPackageUpdateAll latex-suite.txt.gz /*TPackageUpdateAll* +TPartComp latex-suite.txt.gz /*TPartComp* +TPartView latex-suite.txt.gz /*TPartView* +TSection latex-suite.txt.gz /*TSection* +TSectionAdvanced latex-suite.txt.gz /*TSectionAdvanced* +TTemplate latex-suite.txt.gz /*TTemplate* +Tex_AutoFolding latex-suite.txt.gz /*Tex_AutoFolding* +Tex_BIBINPUTS latex-suite.txt.gz /*Tex_BIBINPUTS* +Tex_CatchVisMapErrors latex-suite.txt.gz /*Tex_CatchVisMapErrors* +Tex_Com_name latex-suite.txt.gz /*Tex_Com_name* +Tex_CompileRule_format latex-suite.txt.gz /*Tex_CompileRule_format* +Tex_Debug latex-suite.txt.gz /*Tex_Debug* +Tex_DefaultTargetFormat latex-suite.txt.gz /*Tex_DefaultTargetFormat* +Tex_Diacritics latex-suite.txt.gz /*Tex_Diacritics* +Tex_Env_name latex-suite.txt.gz /*Tex_Env_name* +Tex_EnvironmentMaps latex-suite.txt.gz /*Tex_EnvironmentMaps* +Tex_EnvironmentMenus latex-suite.txt.gz /*Tex_EnvironmentMenus* +Tex_ExplorerHeight latex-suite.txt.gz /*Tex_ExplorerHeight* +Tex_FoldedCommands latex-suite.txt.gz /*Tex_FoldedCommands* +Tex_FoldedEnvironments latex-suite.txt.gz /*Tex_FoldedEnvironments* +Tex_FoldedMisc latex-suite.txt.gz /*Tex_FoldedMisc* +Tex_FoldedSections latex-suite.txt.gz /*Tex_FoldedSections* +Tex_Folding latex-suite.txt.gz /*Tex_Folding* +Tex_FontMaps latex-suite.txt.gz /*Tex_FontMaps* +Tex_FontMenus latex-suite.txt.gz /*Tex_FontMenus* +Tex_GotoError latex-suite.txt.gz /*Tex_GotoError* +Tex_HotKeyMappings latex-suite.txt.gz /*Tex_HotKeyMappings* +Tex_IgnoreLevel latex-suite.txt.gz /*Tex_IgnoreLevel* +Tex_IgnoredWarnings latex-suite.txt.gz /*Tex_IgnoredWarnings* +Tex_ImageDir latex-suite.txt.gz /*Tex_ImageDir* +Tex_ItemStyle_environment latex-suite.txt.gz /*Tex_ItemStyle_environment* +Tex_Leader latex-suite.txt.gz /*Tex_Leader* +Tex_Leader2 latex-suite.txt.gz /*Tex_Leader2* +Tex_MainFileExpression latex-suite.txt.gz /*Tex_MainFileExpression* +Tex_MainMenuLocation latex-suite.txt.gz /*Tex_MainMenuLocation* +Tex_MathMenus latex-suite.txt.gz /*Tex_MathMenus* +Tex_Menus latex-suite.txt.gz /*Tex_Menus* +Tex_MultipleCompileFormats latex-suite.txt.gz /*Tex_MultipleCompileFormats* +Tex_NestElementMenus latex-suite.txt.gz /*Tex_NestElementMenus* +Tex_NestPackagesMenu latex-suite.txt.gz /*Tex_NestPackagesMenu* +Tex_PackagesMenu latex-suite.txt.gz /*Tex_PackagesMenu* +Tex_ProjectSourceFiles latex-suite.txt.gz /*Tex_ProjectSourceFiles* +Tex_PromptedCommands latex-suite.txt.gz /*Tex_PromptedCommands* +Tex_PromptedEnvironments latex-suite.txt.gz /*Tex_PromptedEnvironments* +Tex_RememberCiteSearch latex-suite.txt.gz /*Tex_RememberCiteSearch* +Tex_SectionMaps latex-suite.txt.gz /*Tex_SectionMaps* +Tex_SectionMenus latex-suite.txt.gz /*Tex_SectionMenus* +Tex_SmartKeyBS latex-suite.txt.gz /*Tex_SmartKeyBS* +Tex_SmartKeyQuote latex-suite.txt.gz /*Tex_SmartKeyQuote* +Tex_TEXINPUTS latex-suite.txt.gz /*Tex_TEXINPUTS* +Tex_UseMakefile latex-suite.txt.gz /*Tex_UseMakefile* +Tex_UseMenuWizard latex-suite.txt.gz /*Tex_UseMenuWizard* +Tex_UsePython latex-suite.txt.gz /*Tex_UsePython* +Tex_UseSimpleLabelSearch latex-suite.txt.gz /*Tex_UseSimpleLabelSearch* +Tex_UseUtfMenus latex-suite.txt.gz /*Tex_UseUtfMenus* +Tex_ViewRuleComplete_format latex-suite.txt.gz /*Tex_ViewRuleComplete_format* +Tex_ViewRule_format latex-suite.txt.gz /*Tex_ViewRule_format* +Tex_ViewerCwindowHeight latex-suite.txt.gz /*Tex_ViewerCwindowHeight* +Tex_ViewerPreviewHeight latex-suite.txt.gz /*Tex_ViewerPreviewHeight* +Tshortcuts latex-suite.txt.gz /*Tshortcuts* +\Alph latexhelp.txt.gz /*\\Alph* +\Huge latexhelp.txt.gz /*\\Huge* +\LARGE latexhelp.txt.gz /*\\LARGE* +\Large latexhelp.txt.gz /*\\Large* +\Roman latexhelp.txt.gz /*\\Roman* +\\ latexhelp.txt.gz /*\\\\* +\\\\ latexhelp.txt.gz /*\\\\\\\\* +\addcontentsline latexhelp.txt.gz /*\\addcontentsline* +\address latexhelp.txt.gz /*\\address* +\addtocontents latexhelp.txt.gz /*\\addtocontents* +\addtocounter latexhelp.txt.gz /*\\addtocounter* +\addtolength latexhelp.txt.gz /*\\addtolength* +\addvspace latexhelp.txt.gz /*\\addvspace* +\alph latexhelp.txt.gz /*\\alph* +\and latexhelp.txt.gz /*\\and* +\appendix latexhelp.txt.gz /*\\appendix* +\arabic latexhelp.txt.gz /*\\arabic* +\author latexhelp.txt.gz /*\\author* +\begin latexhelp.txt.gz /*\\begin* +\bfseries latexhelp.txt.gz /*\\bfseries* +\bibitem latexhelp.txt.gz /*\\bibitem* +\bibliography latexhelp.txt.gz /*\\bibliography* +\bibliographystyle latexhelp.txt.gz /*\\bibliographystyle* +\bigskip latexhelp.txt.gz /*\\bigskip* +\cc latexhelp.txt.gz /*\\cc* +\cdots latexhelp.txt.gz /*\\cdots* +\centering latexhelp.txt.gz /*\\centering* +\chapter latexhelp.txt.gz /*\\chapter* +\circle latexhelp.txt.gz /*\\circle* +\cite latexhelp.txt.gz /*\\cite* +\cleardoublepage latexhelp.txt.gz /*\\cleardoublepage* +\clearpage latexhelp.txt.gz /*\\clearpage* +\cline latexhelp.txt.gz /*\\cline* +\closing latexhelp.txt.gz /*\\closing* +\dashbox latexhelp.txt.gz /*\\dashbox* +\date latexhelp.txt.gz /*\\date* +\ddots latexhelp.txt.gz /*\\ddots* +\depth latexhelp.txt.gz /*\\depth* +\documentclass latexhelp.txt.gz /*\\documentclass* +\dotfill latexhelp.txt.gz /*\\dotfill* +\emph latexhelp.txt.gz /*\\emph* +\end latexhelp.txt.gz /*\\end* +\enlargethispage latexhelp.txt.gz /*\\enlargethispage* +\fbox latexhelp.txt.gz /*\\fbox* +\flushbottom latexhelp.txt.gz /*\\flushbottom* +\fnsymbol latexhelp.txt.gz /*\\fnsymbol* +\fontencoding latexhelp.txt.gz /*\\fontencoding* +\fontfamily latexhelp.txt.gz /*\\fontfamily* +\fontseries latexhelp.txt.gz /*\\fontseries* +\fontshape latexhelp.txt.gz /*\\fontshape* +\fontsize latexhelp.txt.gz /*\\fontsize* +\footnote latexhelp.txt.gz /*\\footnote* +\footnotemark latexhelp.txt.gz /*\\footnotemark* +\footnotesize latexhelp.txt.gz /*\\footnotesize* +\footnotetext latexhelp.txt.gz /*\\footnotetext* +\frac latexhelp.txt.gz /*\\frac* +\frame latexhelp.txt.gz /*\\frame* +\framebox latexhelp.txt.gz /*\\framebox* +\fussy latexhelp.txt.gz /*\\fussy* +\height latexhelp.txt.gz /*\\height* +\hfill latexhelp.txt.gz /*\\hfill* +\hline latexhelp.txt.gz /*\\hline* +\hrulefill latexhelp.txt.gz /*\\hrulefill* +\hspace latexhelp.txt.gz /*\\hspace* +\huge latexhelp.txt.gz /*\\huge* +\hyphenation latexhelp.txt.gz /*\\hyphenation* +\include latexhelp.txt.gz /*\\include* +\includeonly latexhelp.txt.gz /*\\includeonly* +\indent latexhelp.txt.gz /*\\indent* +\input latexhelp.txt.gz /*\\input* +\item latexhelp.txt.gz /*\\item* +\itshape latexhelp.txt.gz /*\\itshape* +\kill latexhelp.txt.gz /*\\kill* +\label latexhelp.txt.gz /*\\label* +\large latexhelp.txt.gz /*\\large* +\ldots latexhelp.txt.gz /*\\ldots* +\lefteqn latexhelp.txt.gz /*\\lefteqn* +\letter latexhelp.txt.gz /*\\letter* +\line latexhelp.txt.gz /*\\line* +\linebreak latexhelp.txt.gz /*\\linebreak* +\linethickness latexhelp.txt.gz /*\\linethickness* +\listoffigures latexhelp.txt.gz /*\\listoffigures* +\listoftables latexhelp.txt.gz /*\\listoftables* +\location latexhelp.txt.gz /*\\location* +\lrbox latexhelp.txt.gz /*\\lrbox* +\makebox latexhelp.txt.gz /*\\makebox* +\makelabels latexhelp.txt.gz /*\\makelabels* +\maketitle latexhelp.txt.gz /*\\maketitle* +\marginpar latexhelp.txt.gz /*\\marginpar* +\markboth latexhelp.txt.gz /*\\markboth* +\markright latexhelp.txt.gz /*\\markright* +\mathbf latexhelp.txt.gz /*\\mathbf* +\mathcal latexhelp.txt.gz /*\\mathcal* +\mathit latexhelp.txt.gz /*\\mathit* +\mathnormal latexhelp.txt.gz /*\\mathnormal* +\mathrm latexhelp.txt.gz /*\\mathrm* +\mathsf latexhelp.txt.gz /*\\mathsf* +\mathtt latexhelp.txt.gz /*\\mathtt* +\mathversion latexhelp.txt.gz /*\\mathversion* +\mbox latexhelp.txt.gz /*\\mbox* +\mdseries latexhelp.txt.gz /*\\mdseries* +\medskip latexhelp.txt.gz /*\\medskip* +\multicolumn latexhelp.txt.gz /*\\multicolumn* +\multiput latexhelp.txt.gz /*\\multiput* +\name latexhelp.txt.gz /*\\name* +\newcommand latexhelp.txt.gz /*\\newcommand* +\newcounter latexhelp.txt.gz /*\\newcounter* +\newenvironment latexhelp.txt.gz /*\\newenvironment* +\newfont latexhelp.txt.gz /*\\newfont* +\newlength latexhelp.txt.gz /*\\newlength* +\newline latexhelp.txt.gz /*\\newline* +\newpage latexhelp.txt.gz /*\\newpage* +\newsavebox latexhelp.txt.gz /*\\newsavebox* +\newtheorem latexhelp.txt.gz /*\\newtheorem* +\nocite latexhelp.txt.gz /*\\nocite* +\nofiles latexhelp.txt.gz /*\\nofiles* +\noindent latexhelp.txt.gz /*\\noindent* +\nolinebreak latexhelp.txt.gz /*\\nolinebreak* +\nonumber latexhelp.txt.gz /*\\nonumber* +\nopagebreak latexhelp.txt.gz /*\\nopagebreak* +\normalfont latexhelp.txt.gz /*\\normalfont* +\normalsize latexhelp.txt.gz /*\\normalsize* +\onecolumn latexhelp.txt.gz /*\\onecolumn* +\opening latexhelp.txt.gz /*\\opening* +\oval latexhelp.txt.gz /*\\oval* +\overbrace latexhelp.txt.gz /*\\overbrace* +\overline latexhelp.txt.gz /*\\overline* +\pagebreak latexhelp.txt.gz /*\\pagebreak* +\pagenumbering latexhelp.txt.gz /*\\pagenumbering* +\pageref latexhelp.txt.gz /*\\pageref* +\pagestyle latexhelp.txt.gz /*\\pagestyle* +\par latexhelp.txt.gz /*\\par* +\paragraph latexhelp.txt.gz /*\\paragraph* +\parbox latexhelp.txt.gz /*\\parbox* +\part latexhelp.txt.gz /*\\part* +\picture-framebox latexhelp.txt.gz /*\\picture-framebox* +\ps latexhelp.txt.gz /*\\ps* +\pushtabs latexhelp.txt.gz /*\\pushtabs* +\put latexhelp.txt.gz /*\\put* +\raggedbottom latexhelp.txt.gz /*\\raggedbottom* +\raggedleft latexhelp.txt.gz /*\\raggedleft* +\raggedright latexhelp.txt.gz /*\\raggedright* +\raisebox latexhelp.txt.gz /*\\raisebox* +\ref latexhelp.txt.gz /*\\ref* +\refstepcounter latexhelp.txt.gz /*\\refstepcounter* +\renewcommand latexhelp.txt.gz /*\\renewcommand* +\renewenvironment latexhelp.txt.gz /*\\renewenvironment* +\reversemarginpar latexhelp.txt.gz /*\\reversemarginpar* +\rmfamily latexhelp.txt.gz /*\\rmfamily* +\roman latexhelp.txt.gz /*\\roman* +\rule latexhelp.txt.gz /*\\rule* +\savebox latexhelp.txt.gz /*\\savebox* +\sbox latexhelp.txt.gz /*\\sbox* +\scriptsize latexhelp.txt.gz /*\\scriptsize* +\scshape latexhelp.txt.gz /*\\scshape* +\section latexhelp.txt.gz /*\\section* +\selectfont latexhelp.txt.gz /*\\selectfont* +\setcounter latexhelp.txt.gz /*\\setcounter* +\setlength latexhelp.txt.gz /*\\setlength* +\settodepth latexhelp.txt.gz /*\\settodepth* +\settoheight latexhelp.txt.gz /*\\settoheight* +\settowidth latexhelp.txt.gz /*\\settowidth* +\sffamily latexhelp.txt.gz /*\\sffamily* +\shortstack latexhelp.txt.gz /*\\shortstack* +\signature latexhelp.txt.gz /*\\signature* +\sloppy latexhelp.txt.gz /*\\sloppy* +\slshape latexhelp.txt.gz /*\\slshape* +\small latexhelp.txt.gz /*\\small* +\smallskip latexhelp.txt.gz /*\\smallskip* +\space latexhelp.txt.gz /*\\space* +\sqrt latexhelp.txt.gz /*\\sqrt* +\startbreaks latexhelp.txt.gz /*\\startbreaks* +\stepcounter latexhelp.txt.gz /*\\stepcounter* +\stopbreaks latexhelp.txt.gz /*\\stopbreaks* +\subparagraph latexhelp.txt.gz /*\\subparagraph* +\subsection latexhelp.txt.gz /*\\subsection* +\subsubsection latexhelp.txt.gz /*\\subsubsection* +\symbol latexhelp.txt.gz /*\\symbol* +\table latexhelp.txt.gz /*\\table* +\tableofcontents latexhelp.txt.gz /*\\tableofcontents* +\telephone latexhelp.txt.gz /*\\telephone* +\textbf latexhelp.txt.gz /*\\textbf* +\textit latexhelp.txt.gz /*\\textit* +\textmd latexhelp.txt.gz /*\\textmd* +\textnormal latexhelp.txt.gz /*\\textnormal* +\textrm latexhelp.txt.gz /*\\textrm* +\textsc latexhelp.txt.gz /*\\textsc* +\textsf latexhelp.txt.gz /*\\textsf* +\textsl latexhelp.txt.gz /*\\textsl* +\texttt latexhelp.txt.gz /*\\texttt* +\textup latexhelp.txt.gz /*\\textup* +\thanks latexhelp.txt.gz /*\\thanks* +\thebibliography latexhelp.txt.gz /*\\thebibliography* +\thispagestyle latexhelp.txt.gz /*\\thispagestyle* +\tiny latexhelp.txt.gz /*\\tiny* +\title latexhelp.txt.gz /*\\title* +\totalheight latexhelp.txt.gz /*\\totalheight* +\ttfamily latexhelp.txt.gz /*\\ttfamily* +\twocolumn latexhelp.txt.gz /*\\twocolumn* +\typein latexhelp.txt.gz /*\\typein* +\typeout latexhelp.txt.gz /*\\typeout* +\underbrace latexhelp.txt.gz /*\\underbrace* +\underline latexhelp.txt.gz /*\\underline* +\upshape latexhelp.txt.gz /*\\upshape* +\usebox latexhelp.txt.gz /*\\usebox* +\usecounter latexhelp.txt.gz /*\\usecounter* +\usefont latexhelp.txt.gz /*\\usefont* +\usepackage latexhelp.txt.gz /*\\usepackage* +\value latexhelp.txt.gz /*\\value* +\vdots latexhelp.txt.gz /*\\vdots* +\vector latexhelp.txt.gz /*\\vector* +\verb latexhelp.txt.gz /*\\verb* +\vfill latexhelp.txt.gz /*\\vfill* +\vline latexhelp.txt.gz /*\\vline* +\vspace latexhelp.txt.gz /*\\vspace* +\width latexhelp.txt.gz /*\\width* +adding-bib-options latex-suite.txt.gz /*adding-bib-options* +alph latexhelp.txt.gz /*alph* +altkey-mappings latex-suite.txt.gz /*altkey-mappings* +arabic latexhelp.txt.gz /*arabic* +array latexhelp.txt.gz /*array* +article-class latexhelp.txt.gz /*article-class* +auc-tex-mappings latex-suite.txt.gz /*auc-tex-mappings* +automatic-package-detection latex-suite.txt.gz /*automatic-package-detection* +bibtex latexhelp.txt.gz /*bibtex* +bibtex-bindings latex-suite.txt.gz /*bibtex-bindings* +book-class latexhelp.txt.gz /*book-class* +center latexhelp.txt.gz /*center* +changing-commands latex-suite.txt.gz /*changing-commands* +changing-environments latex-suite.txt.gz /*changing-environments* +cite-search-caching latex-suite.txt.gz /*cite-search-caching* +compiler-dependency latex-suite.txt.gz /*compiler-dependency* +compiler-output-customization latex-suite.txt.gz /*compiler-output-customization* +compiler-rules latex-suite.txt.gz /*compiler-rules* +compiling-multiple latex-suite.txt.gz /*compiling-multiple* +completion-window-preferences latex-suite.txt.gz /*completion-window-preferences* +custom-macros-menu latex-suite.txt.gz /*custom-macros-menu* +custom-packages latex-suite.txt.gz /*custom-packages* +customize-alt-key-maps latex-suite.txt.gz /*customize-alt-key-maps* +customize-imap-maps latex-suite.txt.gz /*customize-imap-maps* +customizing-compiling latex-suite.txt.gz /*customizing-compiling* +customizing-folding latex-suite.txt.gz /*customizing-folding* +customizing-latex-completion latex-suite.txt.gz /*customizing-latex-completion* +customizing-latex-suite latex-suite.txt.gz /*customizing-latex-suite* +customizing-macros latex-suite.txt.gz /*customizing-macros* +customizing-menus latex-suite.txt.gz /*customizing-menus* +customizing-packages latex-suite.txt.gz /*customizing-packages* +customizing-place-holders latex-suite.txt.gz /*customizing-place-holders* +customizing-smart-keys latex-suite.txt.gz /*customizing-smart-keys* +customizing-viewing latex-suite.txt.gz /*customizing-viewing* +customizing-what-to-fold latex-suite.txt.gz /*customizing-what-to-fold* +default-folding latex-suite.txt.gz /*default-folding* +description latexhelp.txt.gz /*description* +diacritic-mappings latex-suite.txt.gz /*diacritic-mappings* +displaymath latexhelp.txt.gz /*displaymath* +draft latexhelp.txt.gz /*draft* +editing-folding latex-suite.txt.gz /*editing-folding* +empty latexhelp.txt.gz /*empty* +enabling-searching latex-suite.txt.gz /*enabling-searching* +enclosing-commands latex-suite.txt.gz /*enclosing-commands* +enclosing-env-f5 latex-suite.txt.gz /*enclosing-env-f5* +enclosing-env-threeletter latex-suite.txt.gz /*enclosing-env-threeletter* +enclosing-environments latex-suite.txt.gz /*enclosing-environments* +enumerate latexhelp.txt.gz /*enumerate* +environment-mappings latex-suite.txt.gz /*environment-mappings* +eqnarray latexhelp.txt.gz /*eqnarray* +equation latexhelp.txt.gz /*equation* +figure latexhelp.txt.gz /*figure* +final latexhelp.txt.gz /*final* +fleqn latexhelp.txt.gz /*fleqn* +flushleft latexhelp.txt.gz /*flushleft* +flushright latexhelp.txt.gz /*flushright* +fold-setting-adding latex-suite.txt.gz /*fold-setting-adding* +fold-setting-advanced latex-suite.txt.gz /*fold-setting-advanced* +font-lowlevelcommands latexhelp.txt.gz /*font-lowlevelcommands* +font-maps latex-suite.txt.gz /*font-maps* +font-size latexhelp.txt.gz /*font-size* +font-styles latexhelp.txt.gz /*font-styles* +forward-searching latex-suite.txt.gz /*forward-searching* +greek-letter-mappings latex-suite.txt.gz /*greek-letter-mappings* +headings latexhelp.txt.gz /*headings* +hyph- latexhelp.txt.gz /*hyph-* +im_1 imaps.txt.gz /*im_1* +imaps-usage imaps.txt.gz /*imaps-usage* +imaps.txt imaps.txt.gz /*imaps.txt* +imaps.txt-toc imaps.txt.gz /*imaps.txt-toc* +inserting-commands latex-suite.txt.gz /*inserting-commands* +inserting-env-f5 latex-suite.txt.gz /*inserting-env-f5* +inserting-env-shift-f1 latex-suite.txt.gz /*inserting-env-shift-f1* +inserting-env-threeletter latex-suite.txt.gz /*inserting-env-threeletter* +inserting-environments latex-suite.txt.gz /*inserting-environments* +inserting-packages latex-suite.txt.gz /*inserting-packages* +inverse-searching latex-suite.txt.gz /*inverse-searching* +itemize latexhelp.txt.gz /*itemize* +landscape latexhelp.txt.gz /*landscape* +latex latexhelp.txt.gz /*latex* +latex-boxes latexhelp.txt.gz /*latex-boxes* +latex-breaking latexhelp.txt.gz /*latex-breaking* +latex-classes latexhelp.txt.gz /*latex-classes* +latex-command-maps latex-suite.txt.gz /*latex-command-maps* +latex-commands latexhelp.txt.gz /*latex-commands* +latex-compiling latex-suite.txt.gz /*latex-compiling* +latex-completion latex-suite.txt.gz /*latex-completion* +latex-completion-cite latex-suite.txt.gz /*latex-completion-cite* +latex-counters latexhelp.txt.gz /*latex-counters* +latex-definitions latexhelp.txt.gz /*latex-definitions* +latex-environments latexhelp.txt.gz /*latex-environments* +latex-folding latex-suite.txt.gz /*latex-folding* +latex-footnotes latexhelp.txt.gz /*latex-footnotes* +latex-hor-space latexhelp.txt.gz /*latex-hor-space* +latex-inputting latexhelp.txt.gz /*latex-inputting* +latex-layout latexhelp.txt.gz /*latex-layout* +latex-lengths latexhelp.txt.gz /*latex-lengths* +latex-letters latexhelp.txt.gz /*latex-letters* +latex-macros latex-suite.txt.gz /*latex-macros* +latex-margin-notes latexhelp.txt.gz /*latex-margin-notes* +latex-master-file latex-suite.txt.gz /*latex-master-file* +latex-master-file-specification latex-suite.txt.gz /*latex-master-file-specification* +latex-math latexhelp.txt.gz /*latex-math* +latex-modes latexhelp.txt.gz /*latex-modes* +latex-package-scanning latex-suite.txt.gz /*latex-package-scanning* +latex-packages latex-suite.txt.gz /*latex-packages* +latex-page-styles latexhelp.txt.gz /*latex-page-styles* +latex-paragraphs latexhelp.txt.gz /*latex-paragraphs* +latex-parameters latexhelp.txt.gz /*latex-parameters* +latex-project latex-suite.txt.gz /*latex-project* +latex-project-example latex-suite.txt.gz /*latex-project-example* +latex-project-settings latex-suite.txt.gz /*latex-project-settings* +latex-references latexhelp.txt.gz /*latex-references* +latex-sectioning latexhelp.txt.gz /*latex-sectioning* +latex-spaces-boxes latexhelp.txt.gz /*latex-spaces-boxes* +latex-special latexhelp.txt.gz /*latex-special* +latex-start-end latexhelp.txt.gz /*latex-start-end* +latex-suite-commands latex-suite.txt.gz /*latex-suite-commands* +latex-suite-commands-maps latex-suite.txt.gz /*latex-suite-commands-maps* +latex-suite-credits latex-suite.txt.gz /*latex-suite-credits* +latex-suite-maintainer latex-suite.txt.gz /*latex-suite-maintainer* +latex-suite-maps latex-suite.txt.gz /*latex-suite-maps* +latex-suite-quickstart.txt latex-suite-quickstart.txt.gz /*latex-suite-quickstart.txt* +latex-suite-quickstart.txt-toc latex-suite-quickstart.txt.gz /*latex-suite-quickstart.txt-toc* +latex-suite-templates latex-suite.txt.gz /*latex-suite-templates* +latex-suite.txt latex-suite.txt.gz /*latex-suite.txt* +latex-suite.txt-toc latex-suite.txt.gz /*latex-suite.txt-toc* +latex-terminal latexhelp.txt.gz /*latex-terminal* +latex-toc latexhelp.txt.gz /*latex-toc* +latex-typefaces latexhelp.txt.gz /*latex-typefaces* +latex-ver-space latexhelp.txt.gz /*latex-ver-space* +latex-viewing latex-suite.txt.gz /*latex-viewing* +latex-viewing-rules latex-suite.txt.gz /*latex-viewing-rules* +latexhelp.txt latexhelp.txt.gz /*latexhelp.txt* +leqno latexhelp.txt.gz /*leqno* +letter-class latexhelp.txt.gz /*letter-class* +list latexhelp.txt.gz /*list* +lq_1 latex-suite-quickstart.txt.gz /*lq_1* +lq_10 latex-suite-quickstart.txt.gz /*lq_10* +lq_2 latex-suite-quickstart.txt.gz /*lq_2* +lq_3 latex-suite-quickstart.txt.gz /*lq_3* +lq_4 latex-suite-quickstart.txt.gz /*lq_4* +lq_5 latex-suite-quickstart.txt.gz /*lq_5* +lq_6 latex-suite-quickstart.txt.gz /*lq_6* +lq_7 latex-suite-quickstart.txt.gz /*lq_7* +lq_8 latex-suite-quickstart.txt.gz /*lq_8* +lq_8_1 latex-suite-quickstart.txt.gz /*lq_8_1* +lq_9 latex-suite-quickstart.txt.gz /*lq_9* +lq_9_1 latex-suite-quickstart.txt.gz /*lq_9_1* +lq_9_2 latex-suite-quickstart.txt.gz /*lq_9_2* +lq_a_bc latex-suite-quickstart.txt.gz /*lq_a_bc* +lq_a_bd latex-suite-quickstart.txt.gz /*lq_a_bd* +lq_a_be latex-suite-quickstart.txt.gz /*lq_a_be* +lq_a_bf latex-suite-quickstart.txt.gz /*lq_a_bf* +lq_a_bg latex-suite-quickstart.txt.gz /*lq_a_bg* +lq_a_bh latex-suite-quickstart.txt.gz /*lq_a_bh* +lq_a_bi latex-suite-quickstart.txt.gz /*lq_a_bi* +lq_a_bj latex-suite-quickstart.txt.gz /*lq_a_bj* +lq_a_bk latex-suite-quickstart.txt.gz /*lq_a_bk* +lq_a_bl latex-suite-quickstart.txt.gz /*lq_a_bl* +lq_a_bm latex-suite-quickstart.txt.gz /*lq_a_bm* +lq_a_bn latex-suite-quickstart.txt.gz /*lq_a_bn* +lq_a_bo latex-suite-quickstart.txt.gz /*lq_a_bo* +lq_u_1 latex-suite-quickstart.txt.gz /*lq_u_1* +lq_u_2 latex-suite-quickstart.txt.gz /*lq_u_2* +lq_u_3 latex-suite-quickstart.txt.gz /*lq_u_3* +lq_u_4 latex-suite-quickstart.txt.gz /*lq_u_4* +lq_u_5 latex-suite-quickstart.txt.gz /*lq_u_5* +lq_u_6 latex-suite-quickstart.txt.gz /*lq_u_6* +lq_u_7 latex-suite-quickstart.txt.gz /*lq_u_7* +lq_u_8 latex-suite-quickstart.txt.gz /*lq_u_8* +lq_u_9 latex-suite-quickstart.txt.gz /*lq_u_9* +lr-mode latexhelp.txt.gz /*lr-mode* +ls-completion-custom latex-suite.txt.gz /*ls-completion-custom* +ls-completion-ref latex-suite.txt.gz /*ls-completion-ref* +ls-completion-usage latex-suite.txt.gz /*ls-completion-usage* +ls-filename-completion latex-suite.txt.gz /*ls-filename-completion* +ls-general-purpose-settings latex-suite.txt.gz /*ls-general-purpose-settings* +ls-imap-f7 latex-suite.txt.gz /*ls-imap-f7* +ls-imap-s-f7 latex-suite.txt.gz /*ls-imap-s-f7* +ls-imaps-syntax latex-suite.txt.gz /*ls-imaps-syntax* +ls-new-macros latex-suite.txt.gz /*ls-new-macros* +ls-set-grepprg latex-suite.txt.gz /*ls-set-grepprg* +ls-vmap-f7 latex-suite.txt.gz /*ls-vmap-f7* +ls_1 latex-suite.txt.gz /*ls_1* +ls_10 latex-suite.txt.gz /*ls_10* +ls_10_1 latex-suite.txt.gz /*ls_10_1* +ls_10_1_1 latex-suite.txt.gz /*ls_10_1_1* +ls_10_1_2 latex-suite.txt.gz /*ls_10_1_2* +ls_10_2 latex-suite.txt.gz /*ls_10_2* +ls_10_2_1 latex-suite.txt.gz /*ls_10_2_1* +ls_10_2_10 latex-suite.txt.gz /*ls_10_2_10* +ls_10_2_11 latex-suite.txt.gz /*ls_10_2_11* +ls_10_2_12 latex-suite.txt.gz /*ls_10_2_12* +ls_10_2_13 latex-suite.txt.gz /*ls_10_2_13* +ls_10_2_14 latex-suite.txt.gz /*ls_10_2_14* +ls_10_2_15 latex-suite.txt.gz /*ls_10_2_15* +ls_10_2_16 latex-suite.txt.gz /*ls_10_2_16* +ls_10_2_2 latex-suite.txt.gz /*ls_10_2_2* +ls_10_2_3 latex-suite.txt.gz /*ls_10_2_3* +ls_10_2_4 latex-suite.txt.gz /*ls_10_2_4* +ls_10_2_5 latex-suite.txt.gz /*ls_10_2_5* +ls_10_2_6 latex-suite.txt.gz /*ls_10_2_6* +ls_10_2_7 latex-suite.txt.gz /*ls_10_2_7* +ls_10_2_8 latex-suite.txt.gz /*ls_10_2_8* +ls_10_2_9 latex-suite.txt.gz /*ls_10_2_9* +ls_11 latex-suite.txt.gz /*ls_11* +ls_11_1 latex-suite.txt.gz /*ls_11_1* +ls_11_10 latex-suite.txt.gz /*ls_11_10* +ls_11_10_1 latex-suite.txt.gz /*ls_11_10_1* +ls_11_1_1 latex-suite.txt.gz /*ls_11_1_1* +ls_11_1_2 latex-suite.txt.gz /*ls_11_1_2* +ls_11_2 latex-suite.txt.gz /*ls_11_2* +ls_11_2_1 latex-suite.txt.gz /*ls_11_2_1* +ls_11_2_2 latex-suite.txt.gz /*ls_11_2_2* +ls_11_2_3 latex-suite.txt.gz /*ls_11_2_3* +ls_11_2_4 latex-suite.txt.gz /*ls_11_2_4* +ls_11_3 latex-suite.txt.gz /*ls_11_3* +ls_11_3_1 latex-suite.txt.gz /*ls_11_3_1* +ls_11_3_10 latex-suite.txt.gz /*ls_11_3_10* +ls_11_3_11 latex-suite.txt.gz /*ls_11_3_11* +ls_11_3_12 latex-suite.txt.gz /*ls_11_3_12* +ls_11_3_13 latex-suite.txt.gz /*ls_11_3_13* +ls_11_3_2 latex-suite.txt.gz /*ls_11_3_2* +ls_11_3_3 latex-suite.txt.gz /*ls_11_3_3* +ls_11_3_4 latex-suite.txt.gz /*ls_11_3_4* +ls_11_3_5 latex-suite.txt.gz /*ls_11_3_5* +ls_11_3_6 latex-suite.txt.gz /*ls_11_3_6* +ls_11_3_7 latex-suite.txt.gz /*ls_11_3_7* +ls_11_3_8 latex-suite.txt.gz /*ls_11_3_8* +ls_11_3_9 latex-suite.txt.gz /*ls_11_3_9* +ls_11_4 latex-suite.txt.gz /*ls_11_4* +ls_11_4_1 latex-suite.txt.gz /*ls_11_4_1* +ls_11_4_2 latex-suite.txt.gz /*ls_11_4_2* +ls_11_5 latex-suite.txt.gz /*ls_11_5* +ls_11_5_1 latex-suite.txt.gz /*ls_11_5_1* +ls_11_5_2 latex-suite.txt.gz /*ls_11_5_2* +ls_11_5_3 latex-suite.txt.gz /*ls_11_5_3* +ls_11_5_4 latex-suite.txt.gz /*ls_11_5_4* +ls_11_5_5 latex-suite.txt.gz /*ls_11_5_5* +ls_11_6 latex-suite.txt.gz /*ls_11_6* +ls_11_6_1 latex-suite.txt.gz /*ls_11_6_1* +ls_11_6_2 latex-suite.txt.gz /*ls_11_6_2* +ls_11_6_3 latex-suite.txt.gz /*ls_11_6_3* +ls_11_6_4 latex-suite.txt.gz /*ls_11_6_4* +ls_11_6_5 latex-suite.txt.gz /*ls_11_6_5* +ls_11_6_6 latex-suite.txt.gz /*ls_11_6_6* +ls_11_6_7 latex-suite.txt.gz /*ls_11_6_7* +ls_11_6_8 latex-suite.txt.gz /*ls_11_6_8* +ls_11_7 latex-suite.txt.gz /*ls_11_7* +ls_11_7_1 latex-suite.txt.gz /*ls_11_7_1* +ls_11_7_2 latex-suite.txt.gz /*ls_11_7_2* +ls_11_8 latex-suite.txt.gz /*ls_11_8* +ls_11_8_1 latex-suite.txt.gz /*ls_11_8_1* +ls_11_8_2 latex-suite.txt.gz /*ls_11_8_2* +ls_11_8_3 latex-suite.txt.gz /*ls_11_8_3* +ls_11_8_4 latex-suite.txt.gz /*ls_11_8_4* +ls_11_8_5 latex-suite.txt.gz /*ls_11_8_5* +ls_11_8_6 latex-suite.txt.gz /*ls_11_8_6* +ls_11_8_7 latex-suite.txt.gz /*ls_11_8_7* +ls_11_9 latex-suite.txt.gz /*ls_11_9* +ls_11_9_1 latex-suite.txt.gz /*ls_11_9_1* +ls_11_9_2 latex-suite.txt.gz /*ls_11_9_2* +ls_12 latex-suite.txt.gz /*ls_12* +ls_2 latex-suite.txt.gz /*ls_2* +ls_3 latex-suite.txt.gz /*ls_3* +ls_3_1 latex-suite.txt.gz /*ls_3_1* +ls_3_10 latex-suite.txt.gz /*ls_3_10* +ls_3_10_1 latex-suite.txt.gz /*ls_3_10_1* +ls_3_10_2 latex-suite.txt.gz /*ls_3_10_2* +ls_3_10_3 latex-suite.txt.gz /*ls_3_10_3* +ls_3_10_4 latex-suite.txt.gz /*ls_3_10_4* +ls_3_11 latex-suite.txt.gz /*ls_3_11* +ls_3_12 latex-suite.txt.gz /*ls_3_12* +ls_3_12_1 latex-suite.txt.gz /*ls_3_12_1* +ls_3_12_2 latex-suite.txt.gz /*ls_3_12_2* +ls_3_1_1 latex-suite.txt.gz /*ls_3_1_1* +ls_3_1_1_1 latex-suite.txt.gz /*ls_3_1_1_1* +ls_3_1_1_2 latex-suite.txt.gz /*ls_3_1_1_2* +ls_3_1_1_3 latex-suite.txt.gz /*ls_3_1_1_3* +ls_3_1_2 latex-suite.txt.gz /*ls_3_1_2* +ls_3_1_2_1 latex-suite.txt.gz /*ls_3_1_2_1* +ls_3_1_2_2 latex-suite.txt.gz /*ls_3_1_2_2* +ls_3_1_3 latex-suite.txt.gz /*ls_3_1_3* +ls_3_2 latex-suite.txt.gz /*ls_3_2* +ls_3_2_1 latex-suite.txt.gz /*ls_3_2_1* +ls_3_2_2 latex-suite.txt.gz /*ls_3_2_2* +ls_3_2_3 latex-suite.txt.gz /*ls_3_2_3* +ls_3_3 latex-suite.txt.gz /*ls_3_3* +ls_3_4 latex-suite.txt.gz /*ls_3_4* +ls_3_5 latex-suite.txt.gz /*ls_3_5* +ls_3_6 latex-suite.txt.gz /*ls_3_6* +ls_3_7 latex-suite.txt.gz /*ls_3_7* +ls_3_8 latex-suite.txt.gz /*ls_3_8* +ls_3_8_1 latex-suite.txt.gz /*ls_3_8_1* +ls_3_9 latex-suite.txt.gz /*ls_3_9* +ls_4 latex-suite.txt.gz /*ls_4* +ls_4_1 latex-suite.txt.gz /*ls_4_1* +ls_4_2 latex-suite.txt.gz /*ls_4_2* +ls_4_3 latex-suite.txt.gz /*ls_4_3* +ls_4_3_1 latex-suite.txt.gz /*ls_4_3_1* +ls_4_4 latex-suite.txt.gz /*ls_4_4* +ls_4_4_1 latex-suite.txt.gz /*ls_4_4_1* +ls_4_4_2 latex-suite.txt.gz /*ls_4_4_2* +ls_5 latex-suite.txt.gz /*ls_5* +ls_5_1 latex-suite.txt.gz /*ls_5_1* +ls_5_2 latex-suite.txt.gz /*ls_5_2* +ls_5_3 latex-suite.txt.gz /*ls_5_3* +ls_5_3_1 latex-suite.txt.gz /*ls_5_3_1* +ls_5_4 latex-suite.txt.gz /*ls_5_4* +ls_5_5 latex-suite.txt.gz /*ls_5_5* +ls_6 latex-suite.txt.gz /*ls_6* +ls_6_1 latex-suite.txt.gz /*ls_6_1* +ls_6_2 latex-suite.txt.gz /*ls_6_2* +ls_6_3 latex-suite.txt.gz /*ls_6_3* +ls_6_4 latex-suite.txt.gz /*ls_6_4* +ls_6_5 latex-suite.txt.gz /*ls_6_5* +ls_7 latex-suite.txt.gz /*ls_7* +ls_7_1 latex-suite.txt.gz /*ls_7_1* +ls_7_2 latex-suite.txt.gz /*ls_7_2* +ls_7_3 latex-suite.txt.gz /*ls_7_3* +ls_8 latex-suite.txt.gz /*ls_8* +ls_8_1 latex-suite.txt.gz /*ls_8_1* +ls_8_2 latex-suite.txt.gz /*ls_8_2* +ls_8_2_1 latex-suite.txt.gz /*ls_8_2_1* +ls_8_2_2 latex-suite.txt.gz /*ls_8_2_2* +ls_8_2_3 latex-suite.txt.gz /*ls_8_2_3* +ls_8_2_4 latex-suite.txt.gz /*ls_8_2_4* +ls_8_2_5 latex-suite.txt.gz /*ls_8_2_5* +ls_8_3 latex-suite.txt.gz /*ls_8_3* +ls_9 latex-suite.txt.gz /*ls_9* +ls_9_1 latex-suite.txt.gz /*ls_9_1* +ls_9_2 latex-suite.txt.gz /*ls_9_2* +ls_a_bA latex-suite.txt.gz /*ls_a_bA* +ls_a_bB latex-suite.txt.gz /*ls_a_bB* +ls_a_bC latex-suite.txt.gz /*ls_a_bC* +ls_a_bD latex-suite.txt.gz /*ls_a_bD* +ls_a_bE latex-suite.txt.gz /*ls_a_bE* +ls_a_bF latex-suite.txt.gz /*ls_a_bF* +ls_a_bG latex-suite.txt.gz /*ls_a_bG* +ls_a_bH latex-suite.txt.gz /*ls_a_bH* +ls_a_bI latex-suite.txt.gz /*ls_a_bI* +ls_a_bJ latex-suite.txt.gz /*ls_a_bJ* +ls_a_bK latex-suite.txt.gz /*ls_a_bK* +ls_a_bL latex-suite.txt.gz /*ls_a_bL* +ls_a_bM latex-suite.txt.gz /*ls_a_bM* +ls_a_bN latex-suite.txt.gz /*ls_a_bN* +ls_a_bO latex-suite.txt.gz /*ls_a_bO* +ls_a_bP latex-suite.txt.gz /*ls_a_bP* +ls_a_bQ latex-suite.txt.gz /*ls_a_bQ* +ls_a_bR latex-suite.txt.gz /*ls_a_bR* +ls_a_bS latex-suite.txt.gz /*ls_a_bS* +ls_a_bT latex-suite.txt.gz /*ls_a_bT* +ls_a_bU latex-suite.txt.gz /*ls_a_bU* +ls_a_bV latex-suite.txt.gz /*ls_a_bV* +ls_a_bW latex-suite.txt.gz /*ls_a_bW* +ls_a_bX latex-suite.txt.gz /*ls_a_bX* +ls_a_bY latex-suite.txt.gz /*ls_a_bY* +ls_a_bZ latex-suite.txt.gz /*ls_a_bZ* +ls_a_bc latex-suite.txt.gz /*ls_a_bc* +ls_a_bd latex-suite.txt.gz /*ls_a_bd* +ls_a_be latex-suite.txt.gz /*ls_a_be* +ls_a_bf latex-suite.txt.gz /*ls_a_bf* +ls_a_bg latex-suite.txt.gz /*ls_a_bg* +ls_a_bh latex-suite.txt.gz /*ls_a_bh* +ls_a_bi latex-suite.txt.gz /*ls_a_bi* +ls_a_bj latex-suite.txt.gz /*ls_a_bj* +ls_a_bk latex-suite.txt.gz /*ls_a_bk* +ls_a_bl latex-suite.txt.gz /*ls_a_bl* +ls_a_bm latex-suite.txt.gz /*ls_a_bm* +ls_a_bn latex-suite.txt.gz /*ls_a_bn* +ls_a_bo latex-suite.txt.gz /*ls_a_bo* +ls_a_bp latex-suite.txt.gz /*ls_a_bp* +ls_a_bq latex-suite.txt.gz /*ls_a_bq* +ls_a_br latex-suite.txt.gz /*ls_a_br* +ls_a_bs latex-suite.txt.gz /*ls_a_bs* +ls_a_bt latex-suite.txt.gz /*ls_a_bt* +ls_a_bu latex-suite.txt.gz /*ls_a_bu* +ls_a_bv latex-suite.txt.gz /*ls_a_bv* +ls_a_bw latex-suite.txt.gz /*ls_a_bw* +ls_a_bx latex-suite.txt.gz /*ls_a_bx* +ls_a_by latex-suite.txt.gz /*ls_a_by* +ls_a_bz latex-suite.txt.gz /*ls_a_bz* +ls_a_cA latex-suite.txt.gz /*ls_a_cA* +ls_a_cB latex-suite.txt.gz /*ls_a_cB* +ls_a_cC latex-suite.txt.gz /*ls_a_cC* +ls_a_cD latex-suite.txt.gz /*ls_a_cD* +ls_a_cE latex-suite.txt.gz /*ls_a_cE* +ls_a_cF latex-suite.txt.gz /*ls_a_cF* +ls_a_cG latex-suite.txt.gz /*ls_a_cG* +ls_a_cH latex-suite.txt.gz /*ls_a_cH* +ls_a_cI latex-suite.txt.gz /*ls_a_cI* +ls_a_cJ latex-suite.txt.gz /*ls_a_cJ* +ls_a_cK latex-suite.txt.gz /*ls_a_cK* +ls_a_cL latex-suite.txt.gz /*ls_a_cL* +ls_a_cM latex-suite.txt.gz /*ls_a_cM* +ls_a_cN latex-suite.txt.gz /*ls_a_cN* +ls_a_cO latex-suite.txt.gz /*ls_a_cO* +ls_a_cP latex-suite.txt.gz /*ls_a_cP* +ls_a_cQ latex-suite.txt.gz /*ls_a_cQ* +ls_a_cR latex-suite.txt.gz /*ls_a_cR* +ls_a_cS latex-suite.txt.gz /*ls_a_cS* +ls_a_cT latex-suite.txt.gz /*ls_a_cT* +ls_a_cU latex-suite.txt.gz /*ls_a_cU* +ls_a_cV latex-suite.txt.gz /*ls_a_cV* +ls_a_cW latex-suite.txt.gz /*ls_a_cW* +ls_a_cX latex-suite.txt.gz /*ls_a_cX* +ls_a_cY latex-suite.txt.gz /*ls_a_cY* +ls_a_cZ latex-suite.txt.gz /*ls_a_cZ* +ls_a_ca latex-suite.txt.gz /*ls_a_ca* +ls_a_cb latex-suite.txt.gz /*ls_a_cb* +ls_a_cc latex-suite.txt.gz /*ls_a_cc* +ls_a_cd latex-suite.txt.gz /*ls_a_cd* +ls_a_ce latex-suite.txt.gz /*ls_a_ce* +ls_a_cf latex-suite.txt.gz /*ls_a_cf* +ls_a_cg latex-suite.txt.gz /*ls_a_cg* +ls_a_ch latex-suite.txt.gz /*ls_a_ch* +ls_a_ci latex-suite.txt.gz /*ls_a_ci* +ls_a_cj latex-suite.txt.gz /*ls_a_cj* +ls_a_ck latex-suite.txt.gz /*ls_a_ck* +ls_a_cl latex-suite.txt.gz /*ls_a_cl* +ls_a_cm latex-suite.txt.gz /*ls_a_cm* +ls_a_cn latex-suite.txt.gz /*ls_a_cn* +ls_a_co latex-suite.txt.gz /*ls_a_co* +ls_a_cp latex-suite.txt.gz /*ls_a_cp* +ls_a_cq latex-suite.txt.gz /*ls_a_cq* +ls_a_cr latex-suite.txt.gz /*ls_a_cr* +ls_a_cs latex-suite.txt.gz /*ls_a_cs* +ls_a_ct latex-suite.txt.gz /*ls_a_ct* +ls_a_cu latex-suite.txt.gz /*ls_a_cu* +ls_a_cv latex-suite.txt.gz /*ls_a_cv* +ls_a_cw latex-suite.txt.gz /*ls_a_cw* +ls_a_cx latex-suite.txt.gz /*ls_a_cx* +ls_a_cy latex-suite.txt.gz /*ls_a_cy* +ls_a_cz latex-suite.txt.gz /*ls_a_cz* +ls_a_dA latex-suite.txt.gz /*ls_a_dA* +ls_a_dB latex-suite.txt.gz /*ls_a_dB* +ls_a_dC latex-suite.txt.gz /*ls_a_dC* +ls_a_dD latex-suite.txt.gz /*ls_a_dD* +ls_a_dE latex-suite.txt.gz /*ls_a_dE* +ls_a_dF latex-suite.txt.gz /*ls_a_dF* +ls_a_dG latex-suite.txt.gz /*ls_a_dG* +ls_a_dH latex-suite.txt.gz /*ls_a_dH* +ls_a_dI latex-suite.txt.gz /*ls_a_dI* +ls_a_dJ latex-suite.txt.gz /*ls_a_dJ* +ls_a_dK latex-suite.txt.gz /*ls_a_dK* +ls_a_dL latex-suite.txt.gz /*ls_a_dL* +ls_a_dM latex-suite.txt.gz /*ls_a_dM* +ls_a_dN latex-suite.txt.gz /*ls_a_dN* +ls_a_dO latex-suite.txt.gz /*ls_a_dO* +ls_a_dP latex-suite.txt.gz /*ls_a_dP* +ls_a_dQ latex-suite.txt.gz /*ls_a_dQ* +ls_a_dR latex-suite.txt.gz /*ls_a_dR* +ls_a_dS latex-suite.txt.gz /*ls_a_dS* +ls_a_dT latex-suite.txt.gz /*ls_a_dT* +ls_a_dU latex-suite.txt.gz /*ls_a_dU* +ls_a_dV latex-suite.txt.gz /*ls_a_dV* +ls_a_dW latex-suite.txt.gz /*ls_a_dW* +ls_a_dX latex-suite.txt.gz /*ls_a_dX* +ls_a_dY latex-suite.txt.gz /*ls_a_dY* +ls_a_dZ latex-suite.txt.gz /*ls_a_dZ* +ls_a_da latex-suite.txt.gz /*ls_a_da* +ls_a_db latex-suite.txt.gz /*ls_a_db* +ls_a_dc latex-suite.txt.gz /*ls_a_dc* +ls_a_dd latex-suite.txt.gz /*ls_a_dd* +ls_a_de latex-suite.txt.gz /*ls_a_de* +ls_a_df latex-suite.txt.gz /*ls_a_df* +ls_a_dg latex-suite.txt.gz /*ls_a_dg* +ls_a_dh latex-suite.txt.gz /*ls_a_dh* +ls_a_di latex-suite.txt.gz /*ls_a_di* +ls_a_dj latex-suite.txt.gz /*ls_a_dj* +ls_a_dk latex-suite.txt.gz /*ls_a_dk* +ls_a_dl latex-suite.txt.gz /*ls_a_dl* +ls_a_dm latex-suite.txt.gz /*ls_a_dm* +ls_a_dn latex-suite.txt.gz /*ls_a_dn* +ls_a_do latex-suite.txt.gz /*ls_a_do* +ls_a_dp latex-suite.txt.gz /*ls_a_dp* +ls_a_dq latex-suite.txt.gz /*ls_a_dq* +ls_a_dr latex-suite.txt.gz /*ls_a_dr* +ls_a_ds latex-suite.txt.gz /*ls_a_ds* +ls_a_dt latex-suite.txt.gz /*ls_a_dt* +ls_a_du latex-suite.txt.gz /*ls_a_du* +ls_a_dv latex-suite.txt.gz /*ls_a_dv* +ls_a_dw latex-suite.txt.gz /*ls_a_dw* +ls_a_dx latex-suite.txt.gz /*ls_a_dx* +ls_a_dy latex-suite.txt.gz /*ls_a_dy* +ls_a_dz latex-suite.txt.gz /*ls_a_dz* +ls_a_eA latex-suite.txt.gz /*ls_a_eA* +ls_a_eB latex-suite.txt.gz /*ls_a_eB* +ls_a_eC latex-suite.txt.gz /*ls_a_eC* +ls_a_eD latex-suite.txt.gz /*ls_a_eD* +ls_a_eE latex-suite.txt.gz /*ls_a_eE* +ls_a_eF latex-suite.txt.gz /*ls_a_eF* +ls_a_eG latex-suite.txt.gz /*ls_a_eG* +ls_a_ea latex-suite.txt.gz /*ls_a_ea* +ls_a_eb latex-suite.txt.gz /*ls_a_eb* +ls_a_ec latex-suite.txt.gz /*ls_a_ec* +ls_a_ed latex-suite.txt.gz /*ls_a_ed* +ls_a_ee latex-suite.txt.gz /*ls_a_ee* +ls_a_ef latex-suite.txt.gz /*ls_a_ef* +ls_a_eg latex-suite.txt.gz /*ls_a_eg* +ls_a_eh latex-suite.txt.gz /*ls_a_eh* +ls_a_ei latex-suite.txt.gz /*ls_a_ei* +ls_a_ej latex-suite.txt.gz /*ls_a_ej* +ls_a_ek latex-suite.txt.gz /*ls_a_ek* +ls_a_el latex-suite.txt.gz /*ls_a_el* +ls_a_em latex-suite.txt.gz /*ls_a_em* +ls_a_en latex-suite.txt.gz /*ls_a_en* +ls_a_eo latex-suite.txt.gz /*ls_a_eo* +ls_a_ep latex-suite.txt.gz /*ls_a_ep* +ls_a_eq latex-suite.txt.gz /*ls_a_eq* +ls_a_er latex-suite.txt.gz /*ls_a_er* +ls_a_es latex-suite.txt.gz /*ls_a_es* +ls_a_et latex-suite.txt.gz /*ls_a_et* +ls_a_eu latex-suite.txt.gz /*ls_a_eu* +ls_a_ev latex-suite.txt.gz /*ls_a_ev* +ls_a_ew latex-suite.txt.gz /*ls_a_ew* +ls_a_ex latex-suite.txt.gz /*ls_a_ex* +ls_a_ey latex-suite.txt.gz /*ls_a_ey* +ls_a_ez latex-suite.txt.gz /*ls_a_ez* +ls_u_1 latex-suite.txt.gz /*ls_u_1* +ls_u_10 latex-suite.txt.gz /*ls_u_10* +ls_u_11 latex-suite.txt.gz /*ls_u_11* +ls_u_12 latex-suite.txt.gz /*ls_u_12* +ls_u_13 latex-suite.txt.gz /*ls_u_13* +ls_u_14 latex-suite.txt.gz /*ls_u_14* +ls_u_2 latex-suite.txt.gz /*ls_u_2* +ls_u_3 latex-suite.txt.gz /*ls_u_3* +ls_u_4 latex-suite.txt.gz /*ls_u_4* +ls_u_5 latex-suite.txt.gz /*ls_u_5* +ls_u_6 latex-suite.txt.gz /*ls_u_6* +ls_u_7 latex-suite.txt.gz /*ls_u_7* +ls_u_8 latex-suite.txt.gz /*ls_u_8* +ls_u_9 latex-suite.txt.gz /*ls_u_9* +lsq-compiling latex-suite-quickstart.txt.gz /*lsq-compiling* +lsq-conclusions latex-suite-quickstart.txt.gz /*lsq-conclusions* +lsq-debugging latex-suite-quickstart.txt.gz /*lsq-debugging* +lsq-folding latex-suite-quickstart.txt.gz /*lsq-folding* +lsq-insert-environment latex-suite-quickstart.txt.gz /*lsq-insert-environment* +lsq-inserting-reference latex-suite-quickstart.txt.gz /*lsq-inserting-reference* +lsq-inserting-template latex-suite-quickstart.txt.gz /*lsq-inserting-template* +lsq-keyboard-shortcuts latex-suite-quickstart.txt.gz /*lsq-keyboard-shortcuts* +lsq-lsq-inserting-package latex-suite-quickstart.txt.gz /*lsq-lsq-inserting-package* +lsq-quick-forward-searching latex-suite-quickstart.txt.gz /*lsq-quick-forward-searching* +lsq-quick-inverse-searching latex-suite-quickstart.txt.gz /*lsq-quick-inverse-searching* +lsq-using-tutorial latex-suite-quickstart.txt.gz /*lsq-using-tutorial* +lsq-viewing-dvi latex-suite-quickstart.txt.gz /*lsq-viewing-dvi* +macro-enabling latex-suite.txt.gz /*macro-enabling* +math, latexhelp.txt.gz /*math,* +math-misc latexhelp.txt.gz /*math-misc* +math-mode latexhelp.txt.gz /*math-mode* +math-spacing latexhelp.txt.gz /*math-spacing* +math-symbols latexhelp.txt.gz /*math-symbols* +math: latexhelp.txt.gz /*math:* +math; latexhelp.txt.gz /*math;* +matn! latexhelp.txt.gz /*matn!* +minipage latexhelp.txt.gz /*minipage* +notitlepage latexhelp.txt.gz /*notitlepage* +onecolumn latexhelp.txt.gz /*onecolumn* +oneside latexhelp.txt.gz /*oneside* +openany latexhelp.txt.gz /*openany* +openbib latexhelp.txt.gz /*openbib* +openright latexhelp.txt.gz /*openright* +overriding-macros latex-suite.txt.gz /*overriding-macros* +package-actions latex-suite.txt.gz /*package-actions* +paragraph-mode latexhelp.txt.gz /*paragraph-mode* +part-compiling latex-suite.txt.gz /*part-compiling* +pausing-imaps latex-suite.txt.gz /*pausing-imaps* +picture latexhelp.txt.gz /*picture* +picture-makebox latexhelp.txt.gz /*picture-makebox* +place-holder latex-suite.txt.gz /*place-holder* +place-holders latex-suite.txt.gz /*place-holders* +plain latexhelp.txt.gz /*plain* +pre-lengths latexhelp.txt.gz /*pre-lengths* +quotation latexhelp.txt.gz /*quotation* +quote-l latexhelp.txt.gz /*quote-l* +recommended-settings latex-suite.txt.gz /*recommended-settings* +remapping-latex-suite-keys latex-suite.txt.gz /*remapping-latex-suite-keys* +report-class latexhelp.txt.gz /*report-class* +roman latexhelp.txt.gz /*roman* +rqno latexhelp.txt.gz /*rqno* +section-mappings latex-suite.txt.gz /*section-mappings* +slides-class latexhelp.txt.gz /*slides-class* +smart-backspace latex-suite.txt.gz /*smart-backspace* +smart-keys latex-suite.txt.gz /*smart-keys* +sub-sup latexhelp.txt.gz /*sub-sup* +subscripts latexhelp.txt.gz /*subscripts* +superscripts latexhelp.txt.gz /*superscripts* +supporting-packages latex-suite.txt.gz /*supporting-packages* +tab' latexhelp.txt.gz /*tab'* +tab+ latexhelp.txt.gz /*tab+* +tab- latexhelp.txt.gz /*tab-* +tab< latexhelp.txt.gz /*tab<* +tab= latexhelp.txt.gz /*tab=* +tab> latexhelp.txt.gz /*tab>* +tab` latexhelp.txt.gz /*tab`* +taba latexhelp.txt.gz /*taba* +tabbing latexhelp.txt.gz /*tabbing* +tabular latexhelp.txt.gz /*tabular* +theorem latexhelp.txt.gz /*theorem* +titlepage latexhelp.txt.gz /*titlepage* +twocolumn latexhelp.txt.gz /*twocolumn* +twoside latexhelp.txt.gz /*twoside* +verbatim latexhelp.txt.gz /*verbatim* +verse latexhelp.txt.gz /*verse* +why-IMAP latex-suite.txt.gz /*why-IMAP* diff --git a/vim/ftplugin/tex.vim b/vim/ftplugin/tex.vim new file mode 100644 index 0000000..a2605f0 --- /dev/null +++ b/vim/ftplugin/tex.vim @@ -0,0 +1,2 @@ +let g:Tex_CompileRule_dvi = 'latex -src-specials -interaction=nonstopmode $*' +g:TCTarget dvi diff --git a/vim/spell/de.utf-8.add b/vim/spell/de.utf-8.add new file mode 100644 index 0000000..cfb931e --- /dev/null +++ b/vim/spell/de.utf-8.add @@ -0,0 +1 @@ +off diff --git a/vim/spell/de.utf-8.add.spl b/vim/spell/de.utf-8.add.spl new file mode 100644 index 0000000..ed59522 Binary files /dev/null and b/vim/spell/de.utf-8.add.spl differ diff --git a/vim/spell/de.utf-8.spl b/vim/spell/de.utf-8.spl new file mode 100644 index 0000000..ce93d33 Binary files /dev/null and b/vim/spell/de.utf-8.spl differ diff --git a/vim/syntax/exim.vim b/vim/syntax/exim.vim new file mode 100644 index 0000000..0705de6 --- /dev/null +++ b/vim/syntax/exim.vim @@ -0,0 +1,431 @@ +" Vim syntax file +" Language: Exim4 configuration file exim.conf +" Maintainer: David Ne\v{c}as (Yeti) +" Last Change: 2004-02-06 +" URL: http://trific.ath.cx/Ftp/vim/syntax/exim.vim +" Required Vim Version: 6.0 + +" Note: The numbers and names are references to Exim specification chapters +" and sections mentioning a particular construct or keyword. + +" Setup {{{ +" React to possibly already-defined syntax. +" For version 5.x: Clear all syntax items unconditionally +" For version 6.x: Quit when a syntax file was already loaded +if version >= 600 + if exists("b:current_syntax") + finish + endif +else + syntax clear +endif + +syn case match +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}} +" Base constructs {{{ +" 6.2. Configuration file format +syn match eximComment "^\s*#.*$" contains=eximFixme +syn keyword eximFixme FIXME TODO XXX NOT contained +" 6.7 Boolean options +syn keyword eximConstant true false yes no +" 6.6. Common option syntax +syn keyword eximHide hide +" 6.8. Integer values +" 6.9. Octal integer values +syn match eximNumber "\<\d\+[KM]\=\>" +syn match eximNumber "\<0[xX]\x\+\>" +" 6.10. Fixed point number values +syn match eximNumber "\<\d\+\(\.\d\{,3}\)\=\>" +" 6.11. Time interval values +syn match eximTime "\<\(\d\+[wdhms]\)\+\>" +syn match eximSpecialChar "\\[\\nrtN]\|\\\o\{1,3}\|\\x\x\{1,2}" +syn match eximListChanger "=\s*\zs<." +syn match eximLineContinuation "\\$" +" 6.16. Format of driver configurations +" (also ACL) +syn match eximDriver "^\s*\i\+:" +" 10.5. Named lists +syn match eximListReference "+\i\+\>" +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}} +" 11. String expansions {{{ +syn match eximVariableReference "\$\i\+" +syn match eximVariableReference "\$header_[-a-zA-Z0-9_]\+\>" +syn region eximBracedGroup matchgroup=eximSpecialChar start="\$\={" end="}" transparent contains=TOP +" 11.4 Expansion items +" 11.5 Expansion operators +syn match eximStringOperation "{\@<=\K[-a-zA-Z0-9_]*\>" transparent contained containedin=eximBracedGroup contains=eximStringOperationName,eximExpansionVariable +syn keyword eximStringOperationName address base62 domain escape eval expand from_utf8 h hash hex2b64 lc l length local_part mask md5 nhash rxquote rfc2047 sha1 stat s strlen substr uc contained +syn keyword eximStringOperationName extract hash hmac length lookup nhash perl readfile readsocket run sg substr tr contained +syn match eximStringOperationName "\" contained nextgroup=eximOperationConditionName skipwhite +syn match eximStringOperationName "\" +syn keyword eximStringOperationName quote quote_cdb quote_dbm[nz] quote_dsearch quote_lsearch quote_nis[plus] quote_wildlsearch quote_dnsdb quote_ldap[dn] quote_ldapm quote_local_part quote_mysql quote_nisplus quote_oracle quote_passwd quote_pgsql quote_testdb quote_whoson contained +syn match eximStringOperationName "\<\(n\=hash\|substr\)\(_-\=\d\+\)\{1,2}\>" contained +syn match eximStringOperationName "\" contained +" 11.6 Expansion conditions +syn keyword eximOperationConditionName crypteq def eq eqi exists first_delivery ldpauth match pam pwcheck queue_running radius contained containedin=eximBracedGroup +" 11.7 Combining expansion conditions +syn keyword eximOperationConditionName or and contained containedin=eximBracedGroup +" 11.8 Expansion variables +" XXX: unused +syn match eximExpansionVariable "acl_[cm]\d\|s\=n\d\|\d" contained +syn keyword eximExpansionVariable acl_verify_message address_data address_file address_pipe authenticated_id authenticated_sender authentication_failed contained +syn keyword eximExpansionVariable body_linecount bounce_recipient caller_gid caller_uid compile_date compile_number contained +syn keyword eximExpansionVariable dnslist_domain dnslist_text dnslist_value domain domain_data domain_data home contained +syn keyword eximExpansionVariable host host_address host_data host_lookup_failed inode interface_address interface_port ldap_dn load_average contained +syn keyword eximExpansionVariable local_part local_part_data local_part_prefix local_part_suffix local_scan_data localhost_number contained +syn keyword eximExpansionVariable message_age message_body message_body_end message_body_size message_headers message_id message_size contained +syn keyword eximExpansionVariable original_domain original_local_part originator_gid originator_uid parent_domain parent_local_part pid pipe_addresses primary_hostname qualify_domain qualify_recipient contained +syn keyword eximExpansionVariable rcpt_count rcpt_defer_count rcpt_fail_count received_for received_protocol recipients recipients_count reply_address return_path return_size_limit runrc self_hostname contained +syn keyword eximExpansionVariable sender_address sender_address_domain sender_address_local_part sender_fullhost sender_helo_name sender_host_address sender_host_authenticated sender_host_name sender_host_port sender_ident sender_rcvhost contained +syn keyword eximExpansionVariable smtp_command_argument spool_directory thisaddress tls_certificate_verified tls_cipher tls_peerdn contained +syn keyword eximExpansionVariable tod_bsdinbox tod_epoch tod_full tod_log tod_logfile tod_zone tod_zulu value version_number warn_message_delay warn_message_recipients contained +" Exim 4.30 +syn keyword eximExpansionVariable mailstore_basename local_user_uid local_user_gid received_count contained +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}} +" 6. The Exim run time configuration file {{{ +" 6.2. Configuration file format +syn match eximSection "^\s*begin\>" nextgroup=eximSectionName skipwhite +syn keyword eximSectionName acl authenticators routers transports retry rewrite local_scan contained +syn region eximRewriteSection start="\s*begin\s\+rewrite" end="^\ze\s*begin\>" end="\%$" contains=TOP,eximOption +syn region eximRetrySection start="\s*begin\s\+retry" end="^\ze\s*begin\>" end="\%$" contains=TOP,eximOption +" 6.3. File inclusions in the configuration file +syn match eximInclude "^\s*.include\(_if_exists\)\?\>" +" 6.4. Macros in the configuration file +syn region eximMacroDefinition matchgroup=eximMacroName start="^[A-Z]\i*\s*=" end="$" skip="\\\s*$" transparent contains=TOP +" 6.5. Conditional skips in the configuration file +syn match eximIfThen "^\s*.\(ifdef\|ifndef\|endifdef\|elifndef\|else\|endif\)\>" +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}} +" 9. File and databasae lookups {{{ +syn keyword eximLookupType cdb dbm[nz] dsearch lsearch nis wildlsearch +syn keyword eximLookupType dnsdb ldap[dn] ldapm mysql nisplus oracle passwd pgsql testdb whoson +" The contains= is to fool keyword-before-match matching order +syn match eximLookupType "\" contains=eximLookupType +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}} +" 10. Domain, Host, Address, and Local Part lists {{{ +syn match eximListDefinition "^\s*\(domain\|host\|address\|localpart\)list\>" nextgroup=eximListName skipwhite +syn match eximListName "\i\+" contained +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}} +" 13. Main configuration {{{ +" 13.1 Miscellaneous +syn keyword eximOption bi_command keep_malformed localhost_number message_body_visible timezone +syn keyword eximOption message_logs no_message_logs not_message_logs +syn keyword eximOption print_topbitchars no_print_topbitchars not_print_topbitchars +syn keyword eximOption split_spool_directory no_split_spool_directory not_split_spool_directory +" 13.2 Exim parameters +syn keyword eximOption exim_group exim_path exim_user primary_hostname spool_directory +" 13.3. Privilege controls +syn keyword eximOption admin_groups local_from_prefix local_from_suffix never_users trusted_groups trusted_users +syn keyword eximOption deliver_drop_privilege no_deliver_drop_privilege not_deliver_drop_privilege +syn keyword eximOption local_from_check no_local_from_check not_local_from_check +syn keyword eximOption local_sender_retain no_local_sender_retain not_local_sender_retain +syn keyword eximOption prod_requires_admin no_prod_requires_admin not_prod_requires_admin +syn keyword eximOption queue_list_requires_admin no_queue_list_requires_admin not_queue_list_requires_admin +" 13.4. Logging +syn keyword eximOption log_file_path log_selector log_timezone syslog_facility syslog_processname +syn keyword eximOption preserve_message_logs no_preserve_message_logs not_preserve_message_logs +syn keyword eximOption syslog_timestamp no_syslog_timestamp not_syslog_timestamp +" 13.5. Frozen messages +syn keyword eximOption auto_thaw freeze_tell timeout_frozen_after +syn keyword eximOption move_frozen_messages no_move_frozen_messages not_move_frozen_messages +" 13.6. Data lookups +syn keyword eximOption ldap_default_servers ldap_version lookup_open_max mysql_servers oracle_servers pgsql_servers +" 13.7. Message ids +syn keyword eximOption message_id_header_domain message_id_header_text +" 13.8. Embedded Perl Startup +syn keyword eximOption perl_startup +syn keyword eximOption perl_at_start no_perl_at_start not_perl_at_start +" 13.9. Daemon +syn keyword eximOption daemon_smtp_port local_interfaces pid_file_path +" 13.10. Resource control +syn keyword eximOption check_log_inodes check_log_space check_spool_inodes check_spool_space deliver_queue_load_max smtp_load_reserve queue_only_load +" 13.11. Policy controls +syn keyword eximOption acl_not_smtp acl_smtp_auth acl_smtp_connect acl_smtp_data acl_smtp_etrn acl_smtp_expn acl_smtp_helo acl_smtp_mail acl_smtp_rcpt acl_smtp_starttls acl_smtp_vrfy header_maxsize header_line_maxsize helo_verify_hosts host_lookup host_reject_connection hosts_treat_as_local local_scan_timeout message_size_limit percent_hack_domains host_lookup_order +" 13.12. Callout cache +syn keyword eximOption callout_domain_negative_expire callout_domain_positive_expire callout_negative_expire callout_positive_expire callout_random_local_part +" 13.13. TLS +syn keyword eximOption tls_advertise_hosts tls_certificate tls_dhparam tls_privatekey tls_try_verify_hosts tle_verify_certificates tls_verify_hosts +" 13.14. Local user handling +syn keyword eximOption finduser_retries gecos_name gecos_pattern max_username_length unknown_login unknown_username uucp_from_pattern uucp_from_sender +" 13.15. Incoming messages +syn keyword eximOption header_maxsize header_line_maxsize percent_hack_domains receive_timeout received_header_text received_headers_max recipient_unqualified_hosts recipients_max +syn keyword eximOption recipients_max_reject no_recipients_max_reject not_recipients_max_reject +" 13.16. Incoming SMTP +syn keyword eximOption rfc1413_hosts rfc1413_query_timeout sender_unqualified_hosts smtp_accept_max smtp_accept_max_nommail smtp_accept_max_nonmail_hosts smtp_accept_max_per_connection smtp_accept_max_per_host smtp_accept_queue smtp_accept_queue_per_connection smtp_accept_reserve smtp_banner smtp_connect_backlog smtp_etrn_command smtp_load_reserve smtp_max_unknown_commands smtp_ratelimit_hosts smtp_ratelimit_mail smtp_ratelimit_rcpt smtp_receive_timeout smtp_reserve_hosts smtp_return_error_details +syn keyword eximOption smtp_accept_keepalive no_smtp_accept_keepalive not_smtp_accept_keepalive +syn keyword eximOption smtp_check_spool_space no_smtp_check_spool_space not_smtp_check_spool_space +syn keyword eximOption smtp_enforce_sync no_smtp_enforce_sync not_smtp_enforce_sync +syn keyword eximOption smtp_etrn_serialize no_smtp_etrn_serialize not_smtp_etrn_serialize +" 13.17. SMTP extensions +syn keyword eximOption auth_advertise_hosts ignore_fromline_hosts pipelining_advertise_hosts tls_advertise_hosts +syn keyword eximOption accept_8bitmime no_accept_8bitmime not_accept_8bitmime +syn keyword eximOption ignore_fromline_local no_ignore_fromline_local not_ignore_fromline_local +" 13.18. Processing messages +syn keyword eximOption allow_utf8_domains qualify_domain qualify_recipient return_path_remove strip_excess_angle_brackets strip_trailing_dot untrusted_set_sender +syn keyword eximOption allow_domain_literals no_allow_domain_literals not_allow_domain_literals +syn keyword eximOption allow_mx_to_ip no_allow_mx_to_ip not_allow_mx_to_ip +syn keyword eximOption delivery_date_remove no_delivery_date_remove not_delivery_date_remove +syn keyword eximOption drop_cr no_drop_cr not_drop_cr +syn keyword eximOption envelope_to_remove no_envelope_to_remove not_envelope_to_remove +syn keyword eximOption extract_addresses_remove_arguments no_extract_addresses_remove_arguments not_extract_addresses_remove_arguments +syn keyword eximOption return_path_remove no_return_path_remove not_return_path_remove +syn keyword eximOption strip_excess_angle_brackets no_strip_excess_angle_brackets not_strip_excess_angle_brackets +syn keyword eximOption strip_trailing_dot no_strip_trailing_dot not_strip_trailing_dot +" 13.19. System filter +syn keyword eximOption system_filter system_filter_directory_transport system_filter_file_transport system_filter_group system_filter_pipe_transport system_filter_reply_transport system_filter_user +" 13.20. Routing and delivery +syn keyword eximOption dns_again_means_nonexist dns_check_names_pattern dns_ipv4_lookup dns_retrans dns_retry hold_domains local_interfaces queue_domains queue_only_file queue_only_load queue_run_max queue_smtp_domains remote_max_parallel remote_sort_domains retry_data_expire retry_interval_max +syn keyword eximOption queue_only no_queue_only not_queue_only +syn keyword eximOption queue_run_in_order no_queue_run_in_order not_queue_run_in_order +" 13.21. Bounce and warning messages +syn keyword eximOption bounce_message_file bounce_message_text bounce_sender_authentication errors_copy errors_reply_to delay_warning delay_warning_condition ignore_bounce_errors_after return_size_limit warn_message_file +syn keyword eximOption bounce_return_message no_bounce_return_message not_bounce_return_message +syn keyword eximOption bounce_return_body no_bounce_return_body not_bounce_return_body +" XXX New 4.30 keywords, belong nowhere +syn keyword eximOption tcp_nodelay no_tcp_nodelay not_tcp_nodelay +syn keyword eximOption smtp_max_synprot_errors +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}} +" 14. Generic options for routers {{{ +syn keyword eximOption address_data cannot_route_message condition debug_print domains driver errors_to fallback_hosts group headers_add headers_remove ignore_target_hosts local_part_prefix local_part_suffix local_parts pass_router redirect_router require_files self senders translate_ip_address transport transport_current_directory transport_home_directory user +syn keyword eximOption caseful_local_part no_caseful_local_part not_caseful_local_part +syn keyword eximOption check_local_user no_check_local_user not_check_local_user +syn keyword eximOption expn no_expn not_expn +syn keyword eximOption fail_verify no_fail_verify not_fail_verify +syn keyword eximOption fail_verify_recipient no_fail_verify_recipient not_fail_verify_recipient +syn keyword eximOption fail_verify_sender no_fail_verify_sender not_fail_verify_sender +syn keyword eximOption initgroups no_initgroups not_initgroups +syn keyword eximOption local_part_prefix_optional no_local_part_prefix_optional not_local_part_prefix_optional +syn keyword eximOption local_part_suffix_optional no_local_part_suffix_optional not_local_part_suffix_optional +syn keyword eximOption log_as_local no_log_as_local not_log_as_local +syn keyword eximOption more no_more not_more +syn keyword eximOption pass_on_timeout no_pass_on_timeout not_pass_on_timeout +syn keyword eximOption retry_use_local_part no_retry_use_local_part not_retry_use_local_part +syn keyword eximOption unseen no_unseen not_unseen +syn keyword eximOption verify no_verify not_verify +syn keyword eximOption verify_only no_verify_only not_verify_only +syn keyword eximOption verify_recipient no_verify_recipient not_verify_recipient +syn keyword eximOption verify_sender no_verify_sender not_verify_sender +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}} +" 15. The accept router {{{ +syn keyword eximDriverName accept +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}} +" 16. The dnslookup router {{{ +syn keyword eximDriverName dnslookup +syn keyword eximOption mx_domains widen_domains +syn keyword eximOption check_secondary_mx no_check_secondary_mx not_check_secondary_mx +syn keyword eximOption qualify_single no_qualify_single not_qualify_single +syn keyword eximOption rewrite_headers no_rewrite_headers not_rewrite_headers +syn keyword eximOption same_domain_copy_routing no_same_domain_copy_routing not_same_domain_copy_routing +syn keyword eximOption search_parents no_search_parents not_search_parents +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}} +" 17. The ipliteral router {{{ +syn keyword eximDriverName ipliteral +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}} +" 18. The iplookup router {{{ +syn keyword eximDriverName iplookup +syn keyword eximOption hosts port protocol query reroute response_pattern timeout +syn keyword eximOption optional no_optional not_optional +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}} +" 19. The manualroute router {{{ +syn keyword eximDriverName manualroute +syn keyword eximOption host_find_failed route_data route_list +syn keyword eximOption hosts_randomize no_hosts_randomize not_hosts_randomize +syn keyword eximOption same_domain_copy_routing no_same_domain_copy_routing not_same_domain_copy_routing +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}} +" 20. The queryprogram router {{{ +syn keyword eximDriverName queryprogram +syn keyword eximOption command command_group command_user current_directory timeout +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}} +" 21. The redirect router {{{ +syn keyword eximDriverName redirect +syn keyword eximOption data directory_transport file file_transport include_directory modemask owners owngroups pipe_transport reply_transport syntax_errors_text syntax_errors_to +syn keyword eximOption allow_defer no_allow_defer not_allow_defer +syn keyword eximOption allow_fail no_allow_fail not_allow_fail +syn keyword eximOption allow_filter no_allow_filter not_allow_filter +syn keyword eximOption allow_freeze no_allow_freeze not_allow_freeze +syn keyword eximOption check_ancestor no_check_ancestor not_check_ancestor +syn keyword eximOption check_group no_check_group not_check_group +syn keyword eximOption check_owner no_check_owner not_check_owner +syn keyword eximOption forbid_blackhole no_forbid_blackhole not_forbid_blackhole +syn keyword eximOption forbid_file no_forbid_file not_forbid_file +syn keyword eximOption forbid_filter_existstest no_forbid_filter_existstest not_forbid_filter_existstest +syn keyword eximOption forbid_filter_logwrite no_forbid_filter_logwrite not_forbid_filter_logwrite +syn keyword eximOption forbid_filter_lookup no_forbid_filter_lookup not_forbid_filter_lookup +syn keyword eximOption forbid_filter_perl no_forbid_filter_perl not_forbid_filter_perl +syn keyword eximOption forbid_filter_readfile no_forbid_filter_readfile not_forbid_filter_readfile +syn keyword eximOption forbid_filter_reply no_forbid_filter_reply not_forbid_filter_reply +syn keyword eximOption forbid_filter_run no_forbid_filter_run not_forbid_filter_run +syn keyword eximOption forbid_include no_forbid_include not_forbid_include +syn keyword eximOption forbid_pipe no_forbid_pipe not_forbid_pipe +syn keyword eximOption hide_child_in_errmsg no_hide_child_in_errmsg not_hide_child_in_errmsg +syn keyword eximOption ignore_eacces no_ignore_eacces not_ignore_eacces +syn keyword eximOption ignore_enotdir no_ignore_enotdir not_ignore_enotdir +syn keyword eximOption one_time no_one_time not_one_time +syn keyword eximOption qualify_preserve_domain no_qualify_preserve_domain not_qualify_preserve_domain +syn keyword eximOption repeat_use no_repeat_use not_repeat_use +syn keyword eximOption rewrite no_rewrite not_rewrite +syn keyword eximOption skip_syntax_errors no_skip_syntax_errors not_skip_syntax_errors +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}} +" 23. Generic options for transports {{{ +syn keyword eximOption current_directory debug_print driver group headers_add headers_remove headers_rewrite home_directory message_size_limit return_path shadow_condition shadow_transport transport_filter user +syn keyword eximOption body_only no_body_only not_body_only +syn keyword eximOption delivery_date_add no_delivery_date_add not_delivery_date_add +syn keyword eximOption envelope_to_add no_envelope_to_add not_envelope_to_add +syn keyword eximOption headers_only no_headers_only not_headers_only +syn keyword eximOption initgroups no_initgroups not_initgroups +syn keyword eximOption retry_use_local_part no_retry_use_local_part not_retry_use_local_part +syn keyword eximOption return_path_add no_return_path_add not_return_path_add +syn keyword eximOption transport_filter_timeout +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}} +" 25. The appendfile transport {{{ +syn keyword eximDriverName appendfile +syn keyword eximOption batch_id batch_max check_string create_file directory directory_file directory_mode escape_string file file_format lock_fcntl_timeout lock_interval lock_retries lockfile_mode lockfile_timeout maildir_retries maildir_tag mailstore_prefix mailstore_suffix message_prefix message_suffix mode quota quota_filecount quota_size_regex quota_warn_message quota_warn_threshold +syn keyword eximOption allow_fifo no_allow_fifo not_allow_fifo +syn keyword eximOption allow_symlink no_allow_symlink not_allow_symlink +syn keyword eximOption check_group no_check_group not_check_group +syn keyword eximOption check_owner no_check_owner not_check_owner +syn keyword eximOption create_directory no_create_directory not_create_directory +syn keyword eximOption file_must_exist no_file_must_exist not_file_must_exist +syn keyword eximOption maildir_format no_maildir_format not_maildir_format +syn keyword eximOption mailstore_format no_mailstore_format not_mailstore_format +syn keyword eximOption mbx_format no_mbx_format not_mbx_format +syn keyword eximOption mode_fail_narrower no_mode_fail_narrower not_mode_fail_narrower +syn keyword eximOption notify_comsat no_notify_comsat not_notify_comsat +syn keyword eximOption quota_is_inclusive no_quota_is_inclusive not_quota_is_inclusive +syn keyword eximOption use_bsmtp no_use_bsmtp not_use_bsmtp +syn keyword eximOption use_crlf no_use_crlf not_use_crlf +syn keyword eximOption use_fcntl_lock no_use_fcntl_lock not_use_fcntl_lock +syn keyword eximOption use_lockfile no_use_lockfile not_use_lockfile +syn keyword eximOption use_mbx_lock no_use_mbx_lock not_use_mbx_lock +syn keyword eximOption maildir_use_size_file no_maildir_use_size_file not_maildir_use_size_file +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}} +" 26. The autoreply transport {{{ +syn keyword eximDriverName autoreply +syn keyword eximOption bcc cc file from headers log mode once once_file_size once_repeat reply_to subject text to +syn keyword eximOption file_expand no_file_expand not_file_expand +syn keyword eximOption file_optional no_file_optional not_file_optional +syn keyword eximOption return_message no_return_message not_return_message +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}} +" 27. The lmtp transport {{{ +syn keyword eximDriverName lmtp +syn keyword eximOption batch_id batch_max command timeout +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}} +" 28. The pipe transport {{{ +syn keyword eximDriverName pipe +syn keyword eximOption allow_commands batch_id batch_max check_string command environment escape_string max_output message_prefix message_suffix path temp_errors timeout umask +syn keyword eximOption freeze_exec_fail no_freeze_exec_fail not_freeze_exec_fail +syn keyword eximOption ignore_status no_ignore_status not_ignore_status +syn keyword eximOption log_defer_output no_log_defer_output not_log_defer_output +syn keyword eximOption log_fail_output no_log_fail_output not_log_fail_output +syn keyword eximOption log_output no_log_output not_log_output +syn keyword eximOption pipe_as_creator no_pipe_as_creator not_pipe_as_creator +syn keyword eximOption restrict_to_path no_restrict_to_path not_restrict_to_path +syn keyword eximOption return_fail_output no_return_fail_output not_return_fail_output +syn keyword eximOption return_output no_return_output not_return_output +syn keyword eximOption use_bsmtp no_use_bsmtp not_use_bsmtp +syn keyword eximOption use_crlf no_use_crlf not_use_crlf +syn keyword eximOption use_shell no_use_shell not_use_shell +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}} +" 29. The smtp transport {{{ +syn keyword eximDriverName smtp +syn keyword eximOption command_timeout connect_timeout connection_max_messages data_timeout fallback_hosts final_timeout helo_data hosts hosts_avoid_tls hosts_max_try hosts_nopass_tls hosts_require_auth hosts_require_tls hosts_try_auth interface max_rcpt port protocol serialize_hosts size_addition tls_certificate tls_privatekey tls_require_ciphers tls_verify_certificates +syn keyword eximOption allow_localhost no_allow_localhost not_allow_localhost +syn keyword eximOption delay_after_cutoff no_delay_after_cutoff not_delay_after_cutoff +syn keyword eximOption dns_qualify_single no_dns_qualify_single not_dns_qualify_single +syn keyword eximOption dns_search_parents no_dns_search_parents not_dns_search_parents +syn keyword eximOption gethostbyname no_gethostbyname not_gethostbyname +syn keyword eximOption hosts_override no_hosts_override not_hosts_override +syn keyword eximOption hosts_randomize no_hosts_randomize not_hosts_randomize +syn keyword eximOption keepalive no_keepalive not_keepalive +syn keyword eximOption multi_domain no_multi_domain not_multi_domain +syn keyword eximOption retry_include_ip_address no_retry_include_ip_address not_retry_include_ip_address +syn keyword eximOption tls_tempfail_tryclear no_tls_tempfail_tryclear not_tls_tempfail_tryclear +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}} +" 30. Address rewritting {{{ +syn match eximRewriteFlags "[EFTbcfhrstSQqrw]\+\s*$" contained containedin=eximRewriteSection +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}} +" 31. Retry configuration {{{ +" 31.2. Retry rules for specific errors +syn keyword eximRetryCondition auth_failed refused_MX refused_A refused timeout_connect timeout_DNS timeout contained containedin=eximRetrySection +syn keyword eximRetryCondition timeout timeout_A timeout_connect_A timeout_MX timeout_connect_MX contained containedin=eximRetrySection +syn match eximRetryCondition "\" contained containedin=eximRetrySection +syn match eximRetryCondition "\s\zs\*\ze\s" contained containedin=eximRetrySection +" 31.3. Retry rule parameters +syn match eximRetryLetter "\<[FG]\ze\s*," contained containedin=eximRetrySection +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}} +" 32. SMTP authentication {{{ +" 32.1. Generic options for authenticators +syn keyword eximOption driver public_name server_advertise_condition server_debug_print server_set_id server_mail_auth_condition +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}} +" 33. The plaintext authenticator {{{ +syn keyword eximDriverName plaintext +syn keyword eximOption server_prompts server_condition +syn keyword eximOption client_send +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}} +" 34. The cram_md5 authenticator {{{ +syn keyword eximDriverName cram_md5 +syn keyword eximOption server_secret +syn keyword eximOption client_name client_secret +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}} +" 35. The spa authenticator {{{ +syn keyword eximDriverName spa +syn keyword eximOption server_password +syn keyword eximOption client_domain client_password client_username +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}} +" 37. Access control lists {{{ +" 37.8. Format of an ACL +syn match eximACLKeyword "^\s*\(accept\|defer\|deny\|discard\|drop\|require\|warn\)\>" +" 37.11. ACL modifiers +syn keyword eximACLModifier control delay endpass log_message message set +" 37.12. ACL conditions +syn keyword eximACLCondition acl authenticated condition dnslists domains encrypted hosts local_parts recipients sender_domains senders verify +syn keyword eximACLCondition header_sender header_syntax helo recipient reverse_host_lookup sender adderss +syn keyword eximACLParameter callout defer_ok no_cache postmaster random no_details +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}} +" Define the default highlighting {{{ +" For version 5.7 and earlier: Only when not done already +" For version 5.8 and later: Only when an item doesn't have highlighting yet +if version >= 508 || !exists("did_exim_syntax_inits") + if version < 508 + let did_exim_syntax_inits = 1 + command -nargs=+ HiLink hi link + else + command -nargs=+ HiLink hi def link + endif + + HiLink eximComment Comment + HiLink eximFixme Todo + HiLink eximSection Keyword + HiLink eximSectionName Keyword + HiLink eximRewriteFlags Keyword + HiLink eximRetryLetter Keyword + HiLink eximACLKeyword Keyword + HiLink eximNumber Number + HiLink eximDriverName Constant + HiLink eximConstant Constant + HiLink eximTime Constant + HiLink eximOption Type + HiLink eximStringOperationName Type + HiLink eximOperationConditionName Type + HiLink eximRetryCondition Type + HiLink eximACLModifier Type + HiLink eximACLCondition Type + HiLink eximACLParameter Type + HiLink eximSpecialChar Special + HiLink eximLineContinuation Special + HiLink eximListChanger Special + HiLink eximHide Special + HiLink eximMacroName Preproc + HiLink eximInclude Preproc + HiLink eximIfThen Preproc + HiLink eximListDefinition Preproc + HiLink eximListReference Function + HiLink eximListName Function + HiLink eximLookupType Function + HiLink eximVariableReference Function + HiLink eximExpansionVariable Function + HiLink eximDriver Title + + delcommand HiLink +endif +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}} +let b:current_syntax = "exim" diff --git a/vim/syntax/yaml.vim b/vim/syntax/yaml.vim new file mode 100755 index 0000000..b922047 --- /dev/null +++ b/vim/syntax/yaml.vim @@ -0,0 +1,62 @@ +" To make this file do stuff, add something like the following (without the +" leading ") to your ~/.vimrc: +" au BufNewFile,BufRead *.yaml,*.yml so ~/src/PyYaml/YAML.vim + +" Vim syntax/macro file +" Language: YAML +" Author: Igor Vergeichik +" Sponsor: Tom Sawyer +" Stayven: Ryan King +" Copyright (c) 2002 Tom Saywer + +" Add an item to a gangly list: +"map , o-o +" Convert to Canonical form: +"map \c :%!python -c 'from yaml.redump import redump; import sys; print redump(sys.stdin.read()).rstrip()' + +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif +syntax clear + +syn match yamlDelimiter "[:,-]" +syn match yamlBlock "[\[\]\{\}\|\>]" +syn match yamlOperator "[?^+-]\|=>" + +syn region yamlComment start="\#" end="$" +syn match yamlIndicator "#YAML:\S\+" + +syn region yamlString start="'" end="'" skip="\\'" +syn region yamlString start='"' end='"' skip='\\"' contains=yamlEscape +syn match yamlEscape +\\[abfnrtv'"\\]+ contained +syn match yamlEscape "\\\o\o\=\o\=" contained +syn match yamlEscape "\\x\x\+" contained + +syn match yamlType "!\S\+" + +syn keyword yamlConstant NULL Null null NONE None none NIL Nil nil +syn keyword yamlConstant TRUE True true YES Yes yes ON On on +syn keyword yamlConstant FALSE False false NO No no OFF Off off + +syn match yamlKey "\w\+\ze\s*:" +syn match yamlAnchor "&\S\+" +syn match yamlAlias "*\S\+" + +" Setupt the hilighting links + +hi link yamlConstant Keyword +hi link yamlIndicator PreCondit +hi link yamlAnchor Function +hi link yamlAlias Function +hi link yamlKey Identifier +hi link yamlType Type + +hi link yamlComment Comment +hi link yamlBlock Operator +hi link yamlOperator Operator +hi link yamlDelimiter Delimiter +hi link yamlString String +hi link yamlEscape Special + diff --git a/vim/yaml.vim b/vim/yaml.vim new file mode 100755 index 0000000..b922047 --- /dev/null +++ b/vim/yaml.vim @@ -0,0 +1,62 @@ +" To make this file do stuff, add something like the following (without the +" leading ") to your ~/.vimrc: +" au BufNewFile,BufRead *.yaml,*.yml so ~/src/PyYaml/YAML.vim + +" Vim syntax/macro file +" Language: YAML +" Author: Igor Vergeichik +" Sponsor: Tom Sawyer +" Stayven: Ryan King +" Copyright (c) 2002 Tom Saywer + +" Add an item to a gangly list: +"map , o-o +" Convert to Canonical form: +"map \c :%!python -c 'from yaml.redump import redump; import sys; print redump(sys.stdin.read()).rstrip()' + +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif +syntax clear + +syn match yamlDelimiter "[:,-]" +syn match yamlBlock "[\[\]\{\}\|\>]" +syn match yamlOperator "[?^+-]\|=>" + +syn region yamlComment start="\#" end="$" +syn match yamlIndicator "#YAML:\S\+" + +syn region yamlString start="'" end="'" skip="\\'" +syn region yamlString start='"' end='"' skip='\\"' contains=yamlEscape +syn match yamlEscape +\\[abfnrtv'"\\]+ contained +syn match yamlEscape "\\\o\o\=\o\=" contained +syn match yamlEscape "\\x\x\+" contained + +syn match yamlType "!\S\+" + +syn keyword yamlConstant NULL Null null NONE None none NIL Nil nil +syn keyword yamlConstant TRUE True true YES Yes yes ON On on +syn keyword yamlConstant FALSE False false NO No no OFF Off off + +syn match yamlKey "\w\+\ze\s*:" +syn match yamlAnchor "&\S\+" +syn match yamlAlias "*\S\+" + +" Setupt the hilighting links + +hi link yamlConstant Keyword +hi link yamlIndicator PreCondit +hi link yamlAnchor Function +hi link yamlAlias Function +hi link yamlKey Identifier +hi link yamlType Type + +hi link yamlComment Comment +hi link yamlBlock Operator +hi link yamlOperator Operator +hi link yamlDelimiter Delimiter +hi link yamlString String +hi link yamlEscape Special + diff --git a/vimrc b/vimrc new file mode 100644 index 0000000..9ce0448 --- /dev/null +++ b/vimrc @@ -0,0 +1,506 @@ +" URL: http://vim.wikia.com/wiki/Example_vimrc +" Authors: http://vim.wikia.com/wiki/Vim_on_Freenode +" Description: A minimal, but feature rich, example .vimrc. If you are a +" newbie, basing your first .vimrc on this file is a good choice. +" If you're a more advanced user, building your own .vimrc based +" on this file is still a good idea. + +"------------------------------------------------------------ +set nocompatible " required +filetype off " required + +let g:NERDTreeDirArrows = 1 + +if !empty(glob("~/.vim/bundle/Vundle.vim")) + " set the runtime path to include Vundle and initialize + set rtp+=~/.vim/bundle/Vundle.vim + call vundle#begin() + + " alternatively, pass a path where Vundle should install plugins + "call vundle#begin('~/some/path/here') + + " let Vundle manage Vundle, required + + Plugin $MYSHELLCONFIG_VIM_PLUGINS'/gmarik/Vundle.vim' + Plugin $MYSHELLCONFIG_VIM_PLUGINS'Zenburn' +" Plugin $MYSHELLCONFIG_VIM_PLUGINS'Solarized' + Plugin $MYSHELLCONFIG_VIM_PLUGINS'altercation/vim-colors-solarized.git' + Plugin $MYSHELLCONFIG_VIM_PLUGINS'vim-scripts/indentpython.vim' + Plugin $MYSHELLCONFIG_VIM_PLUGINS'tmhedberg/SimpylFold' + Plugin $MYSHELLCONFIG_VIM_PLUGINS'vim-syntastic/syntastic' + Plugin $MYSHELLCONFIG_VIM_PLUGINS'ctrlpvim/ctrlp.vim' + Plugin $MYSHELLCONFIG_VIM_PLUGINS'scrooloose/nerdtree' + Plugin $MYSHELLCONFIG_VIM_PLUGINS'Xuyuanp/nerdtree-git-plugin' + Plugin $MYSHELLCONFIG_VIM_PLUGINS'jistr/vim-nerdtree-tabs' + Plugin $MYSHELLCONFIG_VIM_PLUGINS'tpope/vim-fugitive' + Plugin $MYSHELLCONFIG_VIM_PLUGINS'Lokaltog/powerline', {'rtp': 'powerline/bindings/vim/'} + Plugin $MYSHELLCONFIG_VIM_PLUGINS'rakr/vim-togglebg' + Plugin $MYSHELLCONFIG_VIM_PLUGINS'ConradIrwin/vim-bracketed-paste' +" Plugin $MYSHELLCONFIG_VIM_PLUGINS'ryanpcmcquen/fix-vim-pasting' +" Plugin $MYSHELLCONFIG_VIM_PLUGINS'Valloric/YouCompleteMe' + + + + "Plugin 'gmarik/Vundle.vim' + "Plugin 'Zenburn' + "Plugin 'Solarized' + "Plugin 'altercation/vim-colors-solarized.git' + "Plugin 'vim-scripts/indentpython.vim' + "Plugin 'tmhedberg/SimpylFold' + "Plugin 'vim-syntastic/syntastic' + "Plugin 'ctrlpvim/ctrlp.vim' + "Plugin 'scrooloose/nerdtree' + "Plugin 'Xuyuanp/nerdtree-git-plugin' + "Plugin 'jistr/vim-nerdtree-tabs' + "Plugin 'tpope/vim-fugitive' + "Plugin 'Lokaltog/powerline', {'rtp': 'powerline/bindings/vim/'} + "Plugin 'rakr/vim-togglebg' + "Plugin 'ConradIrwin/vim-bracketed-paste' + "Plugin 'ryanpcmcquen/fix-vim-pasting' + "Plugin 'Valloric/YouCompleteMe' + +" Plugin 'https://git.schuerz.at/public/Vim/Vundle.vim.git' +" Plugin 'https://git.schuerz.at/public/Vim/Zenburn.git' +" Plugin 'https://git.schuerz.at/public/Vim/vim-colors-solarized.git' +" Plugin 'https://git.schuerz.at/public/Vim/indentpython.vim.git' +" Plugin 'https://git.schuerz.at/public/Vim/SimpylFold.git' +" Plugin 'https://git.schuerz.at/public/Vim/syntastic.git' +" Plugin 'https://git.schuerz.at/public/Vim/ctrlp.vim.git' +" Plugin 'https://git.schuerz.at/public/Vim/scrooloose/nerdtree' +" Plugin 'https://git.schuerz.at/public/Vim/Xuyuanp/nerdtree-git-plugin' +" Plugin 'https://git.schuerz.at/public/Vim/vim-nerdtree-tabs.git' +" Plugin 'https://git.schuerz.at/public/Vim/vim-fugitive.git' +" Plugin 'https://git.schuerz.at/public/Vim/powerline.git', {'rtp': 'powerline/bindings/vim/'} +" Plugin 'https://git.schuerz.at/public/Vim/vim-togglebg.git' +" Plugin 'https://git.schuerz.at/public/Vim/vim-bracketed-paste.git' +" "Plugin 'https://git.schuerz.at/public/Vim/ryanpcmcquen/fix-vim-pasting' +" "Plugin 'https://git.schuerz.at/public/Vim/Valloric/YouCompleteMe' + + " add all your plugins here (note older versions of Vundle + " used Bundle instead of Plugin) + + " ... + + " All of your Plugins must be added before the following line + call vundle#end() " required +endif +filetype plugin indent on " required +"------------------------------------------------------------ +set encoding=utf-8 + +" Features {{{1 +" +" These options and commands enable some very useful features in Vim, that +" no user should have to live without. + +" Set 'nocompatible' to ward off unexpected things that your distro might +" have made, as well as sanely reset options when re-sourcing .vimrc +set nocompatible + +" Attempt to determine the type of a file based on its name and possibly its +" contents. Use this to allow intelligent auto-indenting for each filetype, +" and for plugins that are filetype specific. +"filetype indent plugin on +filetype on +filetype plugin on +filetype indent on + +" Enable syntax highlighting +syntax on + +" Set Highlight-Color of marked text reverse: +"hi Visual term=reverse cterm=reverse guibg=Grey +hi Visual term=underline ctermbg=Grey cterm=underline guibg=Grey gui=underline + +"------------------------------------------------------------ +" Must have options {{{1 +" +" These are highly recommended options. + +" Vim with default settings does not allow easy switching between multiple files +" in the same editor window. Users can use multiple split windows or multiple +" tab pages to edit multiple files, but it is still best to enable an option to +" allow easier switching between files. +" +" One such option is the 'hidden' option, which allows you to re-use the same +" window and switch from an unsaved buffer without saving it first. Also allows +" you to keep an undo history for multiple files when re-using the same window +" in this way. Note that using persistent undo also lets you undo in multiple +" files even in the same window, but is less efficient and is actually designed +" for keeping undo history after closing Vim entirely. Vim will complain if you +" try to quit without saving, and swap files will keep you safe if your computer +" crashes. +set hidden + +" Note that not everyone likes working this way (with the hidden option). +" Alternatives include using tabs or split windows instead of re-using the same +" window as mentioned above, and/or either of the following options: +" set confirm +" set autowriteall + +" Better command-line completion +set wildmenu + +" Show partial commands in the last line of the screen +set showcmd + +" Highlight searches (use to temporarily turn off highlighting; see the +" mapping of below) +set hlsearch + +" Modelines have historically been a source of security vulnerabilities. As +" such, it may be a good idea to disable them and use the securemodelines +" script, . +" set nomodeline + + +"------------------------------------------------------------ +" Usability options {{{1 +" +" These are options that users frequently set in their .vimrc. Some of them +" change Vim's behaviour in ways which deviate from the true Vi way, but +" which are considered to add usability. Which, if any, of these options to +" use is very much a personal preference, but they are harmless. + +" Use case insensitive search, except when using capital letters +set ignorecase +set smartcase + +" Set title in terminal-window +set title + +" Allow backspacing over autoindent, line breaks and start of insert action +set backspace=indent,eol,start + +" When opening a new line and no filetype-specific indenting is enabled, keep +" the same indent as the line you're currently on. Useful for READMEs, etc. +set autoindent + +" Stop certain movements from always going to the first character of a line. +" While this behaviour deviates from that of Vi, it does what most users +" coming from other editors would expect. +set nostartofline + +" Display the cursor position on the last line of the screen or in the status +" line of a window +set ruler + +" Always display the status line, even if only one window is displayed +set laststatus=2 + +" Instead of failing a command because of unsaved changes, instead raise a +" dialogue asking if you wish to save changed files. +set confirm + +" Use visual bell instead of beeping when doing something wrong +set visualbell + +" And reset the terminal code for the visual bell. If visualbell is set, and +" this line is also included, vim will neither flash nor beep. If visualbell +" is unset, this does nothing. +set t_vb= + +" check if mouse is enabled +" Disabled, because mark and paste outside vim is not working correctly +"if has('mouse') +" " Enable use of the mouse for all modes +" set mouse=a +"endif + +" Set the command window height to 2 lines, to avoid many cases of having to +" "press to continue" +set cmdheight=2 + +" Display line numbers on the left +"set number + +" Quickly time out on keycodes, but never time out on mappings +set notimeout ttimeout ttimeoutlen=200 + +" Use to toggle between 'paste' and 'nopaste' +set pastetoggle= + + +"------------------------------------------------------------ +" Indentation options {{{1 +" +" Indentation settings according to personal preference. + +" Indentation settings for using 4 spaces instead of tabs. +" Do not change 'tabstop' from its default value of 8 with this setup. +set shiftwidth=4 +set softtabstop=4 +set expandtab + +" Indentation settings for using hard tabs for indent. Display tabs as +" four characters wide. +"set shiftwidth=4 +"set tabstop=4 + +" Enable folding +set foldmethod=indent +set foldlevel=99 + +"------------------------------------------------------------ +" Mappings {{{1 +" +" Useful mappings + +" Map Y to act like D and C, i.e. to yank until EOL, rather than act as yy, +" which is the default +map Y y$ + +" Map (redraw screen) to also turn off search highlighting until the +" next search +nnoremap :nohl + +" Enable folding with the spacebar +nnoremap za + +"split navigations +nnoremap +nnoremap +nnoremap +nnoremap + +" Map :next to +nmap :next +nmap :prev +nmap :tabnew +"------------------------------------------------------------ +let g:SimplyFold_docstring_preview=1 + +let g:ycm_autoclose_preview_window_after_completion=1 +map g :YcmCompleter GoToDefinitionElseDeclaration + +"python with virtualenv support +"py << EOF +"import os +"import sys +"if 'VIRTUAL_ENV' in os.environ: +" project_base_dir = os.environ['VIRTUAL_ENV'] +" activate_this = os.path.join(project_base_dir, 'bin/activate_this.py') +" execfile(activate_this, dict(__file__=activate_this)) +"EOF +"================================================================================= +set background=light + +if has('gui_running') + set grepprg=grep\ -nH\ $* + filetype indent on + let g:tex_flavor='latex' +endif + +au BufEnter *.tex set autowrite +let g:Tex_DefaultTargetFormat = 'pdf' +let g:Tex_MultipleCompileFormats = 'pdf' +let g:Tex_CompileRule_pdf = 'pdflatex -interaction=nonstopmode $*' +" Um alle Ausgabe-Pdfs von LaTeX in einem Verzeichnis zu sammeln oben de- und unten aktivieren. +"let g:Tex_CompileRule_pdf = 'mkdir -p out && pdflatex -output-directory=out -interaction=nonstopmode $* && mv out/$*.pdf .' +let g:Tex_GotoError = 0 +let g:Tex_ViewRule_pdf = 'evince' +let g:Tex_ViewRule_dvi = 'xdvi -editor "gvim --servername xdvi --remote +\%l \%f" $* &' +let g:Tex_ViewRuleComplete_dvi = 'xdvi -editor "gvim --servername xdvi --remote +\%l \%f" $* &' + + +"set nospell +set spelllang=de + +" mutt-Einstellungen +:hi mailHeader ctermfg=Grey +:hi mailSubject ctermfg=Green +:hi mailEmail ctermfg=Blue +:hi mailSignature ctermfg=Grey +:hi mailQuoted1 ctermfg=Darkyellow +:hi mailQuoted2 ctermfg=Green + +" CSV syntax +au BufNewFile,BufRead *.csv + \ set fileformat=unix + +" Javascript and Java syntax +au BufNewFile,BufRead *.js,*.java + \ set tabstop=2 | + \ set softtabstop=2 | + \ set shiftwidth=2 | + \ set textwidth=79 | + \ set expandtab | + \ set autoindent | + \ set fileformat=unix + +" Python syntax +au BufNewFile,BufRead *.py,*pyw,*.c,*.h + \ set tabstop=4 | + \ set softtabstop=4 | + \ set shiftwidth=4 | + \ set textwidth=79 | + \ set expandtab | + \ set autoindent | + \ set fileformat=unix + +au BufNewFile,BufRead *.yml,*yaml + \ set tabstop=2 | + \ set softtabstop=2 | + \ set shiftwidth=2 | + \ set textwidth=79 | + \ set expandtab | + \ set autoindent | + \ set fileformat=unix + +"Use the below highlight group when displaying bad whitespace is desired. +highlight BadWhitespace ctermbg=red guibg=red + +" Display tabs at the beginning of a line in Python mode as bad. +au BufRead,BufNewFile *.py,*.pyw match BadWhitespace /^\t\+/ +" Make trailing whitespaces be flagged as bad. +au BufRead,BufNewFile *.py,*.pyw,*.c,*.h match BadWhitespace /\s\+$/ + +" yaml syntax +" https://www.vim.org/scripts/script.php?script_id=739 +" wget https://www.vim.org/scripts/download_script.php?src_id=2249 -O ~/.vim/yaml.vim +"au BufNewFile,BufRead *.yaml,*.yml so $MYSHELLCONFIG_BASE/.vim/yaml.vim + +autocmd BufRead,BufNewFile /etc/exim* set filetype=exim +autocmd BufRead,BufNewFile *.yaml,*.yml set filetype=yaml + +"------ +" in makefiles, dont't expand tabs to spaces, since actual tab characters are +" needed, and have indentation at 8 chars to be sure that all indents are tabs +" (despite the mappings later): +autocmd FileType make set noexpandtab shiftwidth=8 softtabstop=0 + +" two space indentation for some files +autocmd FileType vim,lua,nginx set shiftwidth=2 softtabstop=2 + +augroup filetype + autocmd BufNewFile,BufRead *.txt set filetype=human +augroup END + +autocmd FileType human set formatoptions-=t textwidth=0 "disable wrapping in txt + + +autocmd BufRead,BufNewFile *.conf setf dosini + +" to make comments better visible on dark backgrounds +:color desert + +if has('gui_running') + set background=dark + colorscheme solarized +else + if !empty(glob("~/vim//bundle/Zenburn/colors/zenburn.vim")) + colorscheme zenburn + endif +endif + +if !empty(glob("~/.vim/bundle/vim-togglebg")) + call togglebg#map("") +endif + + + +" Commands + +" Sample command W + +command W :execute ':silent w !sudo tee % > /dev/null' | :edit! + +let python_highlight_all=1 +syntax on + +let NERDTreeIgnore=['\.pyc$', '\~$'] "ignore files in NERDTree + + + + +" Code from: +" http://stackoverflow.com/questions/5585129/pasting-code-into-terminal-window-into-vim-on-mac-os-x +" then https://coderwall.com/p/if9mda +" and then https://github.com/aaronjensen/vimfiles/blob/59a7019b1f2d08c70c28a41ef4e2612470ea0549/plugin/terminaltweaks.vim +" to fix the escape time problem with insert mode. +" +" Docs on bracketed paste mode: +" http://www.xfree86.org/current/ctlseqs.html +" Docs on mapping fast escape codes in vim +" http://vim.wikia.com/wiki/Mapping_fast_keycodes_in_terminal_Vim + +"if exists("g:loaded_bracketed_paste") +" finish +"endif +"let g:loaded_bracketed_paste = 1 + +"function! WrapForTmux(s) +" if !exists('$TMUX') || !exists('$SCREEN') +" return a:s +" endif +" +" let tmux_start = "\Ptmux;" +" let tmux_end = "\\\" +" +" return tmux_start . substitute(a:s, "\", "\\", 'g') . tmux_end +"endfunction +" +"let &t_SI .= WrapForTmux("\[?2004h") +"let &t_EI .= WrapForTmux("\[?2004l") +" +"inoremap [200~ XTermPasteBegin() +" +"function! XTermPasteBegin() +" set pastetoggle=[201~ +" set paste +" "return "a:ret" +" return "" +"endfunction + +" write .netrwhist to cache-dir instead of ~/.vim to prevent configcheckout +" problems +let g:netrw_home=$XDG_CACHE_HOME.'/vim' +"let g:nerdtree_tabs_open_on_console_startup=1 +let g:nerdtree_tabs_open_on_console_startup=0 + +let g:NERDTreeIndicatorMapCustom = { + \ "Modified" : "✹", + \ "Staged" : "✚", + \ "Untracked" : "✭", + \ "Renamed" : "➜", + \ "Unmerged" : "═", + \ "Deleted" : "✖", + \ "Dirty" : "✗", + \ "Clean" : "✔︎", + \ 'Ignored' : '☒', + \ "Unknown" : "?" + \ } + +" (a heavy feature may cost much more time) +"let g:NERDTreeShowIgnoredStatus = 1 + +"If the {lhs} key sequence of a map command starts with the string "", +"then Vim replaces it with the key set in the 'mapleader' variable. +"The default setting for the 'mapleader' variable is backslash ('\'). +"Note that 'mapleader' is a Vim variable and not a Vim option. +"The value of this variable can be changed using the 'let' command. For example, +"to set it to '_' (underscore), you can use the following command in your vimrc file: +let mapleader = "_" + +map n NERDTreeTabsToggle + +" from https://vim.fandom.com/wiki/Modeline_magic +" Append modeline after last line in buffer. +" Use substitute() instead of printf() to handle '%%s' modeline in LaTeX +" files. +function! AppendModeline() + let l:modeline = printf(" vim: set ts=%d sw=%d tw=%d %set :", + \ &tabstop, &shiftwidth, &textwidth, &expandtab ? '' : 'no') + let l:modeline = substitute(&commentstring, "%s", l:modeline, "") + call append(line("$"), l:modeline) +endfunction +nnoremap ml :call AppendModeline() + +" Tabhandling +set switchbuf=usetab +noremap :sbnext +noremap :sbprevious +noremap :tabprevious +noremap :tabnext +noremap :execute 'silent! tabmove' . (tabpagenr()-2) +noremap :execute 'silent! tabmove' . (tabpagenr()+1)