├── tag-vim ├── vim │ ├── Brewfile │ ├── config │ │ ├── keybindings.vim │ │ ├── appearance.vim │ │ └── l80snight.vim │ ├── plugins │ │ └── plugins.vim │ └── autoload │ │ └── plug.vim └── vimrc ├── tag-git ├── gitignore ├── config │ └── git │ │ └── completion.zsh └── gitconfig ├── tag-zsh ├── config │ └── zsh │ │ ├── aliases.zsh │ │ ├── path.zsh │ │ ├── colors.zsh │ │ ├── history.zsh │ │ ├── config.zsh │ │ ├── completion.zsh │ │ └── prompt.zsh ├── Brewfile └── zshrc ├── Brewfile ├── setup ├── Brewfile ├── link-dotfiles ├── setup └── install-homebrew ├── tag-xcode ├── config │ └── xcode │ │ └── aliases.zsh └── xvimrc ├── slack-themes └── ladiesnight ├── intellij-themes └── LadiesNight.jar ├── .gitignore ├── rcrc ├── tag-android ├── config │ └── android │ │ ├── path.zsh │ │ ├── projects.zsh │ │ ├── aliases.zsh │ │ ├── amandroid.sh │ │ └── functions.zsh └── ideavimrc ├── link-dotfiles ├── README.md ├── xcode-themes └── Ladies Night.xccolortheme └── iterm_themes ├── ladiesnight.itermcolors └── com.googlecode.iterm2.plist /tag-vim/vim/Brewfile: -------------------------------------------------------------------------------- 1 | brew 'vim' 2 | -------------------------------------------------------------------------------- /tag-git/gitignore: -------------------------------------------------------------------------------- 1 | # OS X 2 | .DS_Store 3 | -------------------------------------------------------------------------------- /tag-zsh/config/zsh/aliases.zsh: -------------------------------------------------------------------------------- 1 | alias l='ls -al' 2 | -------------------------------------------------------------------------------- /Brewfile: -------------------------------------------------------------------------------- 1 | brew 'vim' 2 | brew 'the_silver_searcher' 3 | -------------------------------------------------------------------------------- /setup/Brewfile: -------------------------------------------------------------------------------- 1 | tap 'thoughtbot/formulae' 2 | 3 | brew 'rcm' 4 | -------------------------------------------------------------------------------- /tag-xcode/config/xcode/aliases.zsh: -------------------------------------------------------------------------------- 1 | alias ox="open -a 'Xcode' ." 2 | -------------------------------------------------------------------------------- /tag-zsh/Brewfile: -------------------------------------------------------------------------------- 1 | brew 'zsh' 2 | brew 'zsh-syntax-highlighting' 3 | brew 'fzf' 4 | -------------------------------------------------------------------------------- /slack-themes/ladiesnight: -------------------------------------------------------------------------------- 1 | #21282D,#21282D,#85B5C7,#FFFFFF,#21282D,#FFFFFF,#85B5C7,#E784A2 2 | -------------------------------------------------------------------------------- /tag-vim/vim/config/keybindings.vim: -------------------------------------------------------------------------------- 1 | " Better navigation 2 | nnoremap H ^ 3 | nnoremap L $ 4 | -------------------------------------------------------------------------------- /intellij-themes/LadiesNight.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mandybess/dotfiles/HEAD/intellij-themes/LadiesNight.jar -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # ignore my secrets file as it is full of my secrets 🔮 2 | tag-zsh/config/zsh/secrets.zsh 3 | Brewfile.lock.json 4 | -------------------------------------------------------------------------------- /rcrc: -------------------------------------------------------------------------------- 1 | EXCLUDES="README.md Brewfile setup" 2 | DOTFILES_DIRS=$HOME/Development/dotfiles 3 | TAGS="zsh android git vim xcode" 4 | -------------------------------------------------------------------------------- /tag-zsh/config/zsh/path.zsh: -------------------------------------------------------------------------------- 1 | path=( "/usr/bin" "/bin" "/usr/sbin" "/sbin" ) 2 | path=( "$HOME/.local/bin" "/usr/local/bin" $path ) 3 | -------------------------------------------------------------------------------- /tag-android/config/android/path.zsh: -------------------------------------------------------------------------------- 1 | export ANDROID_HOME="$HOME/Library/Android/sdk" 2 | path=($ANDROID_HOME/emulator $ANDROID_HOME/tools $ANDROID_HOME/platform-tools $path) 3 | -------------------------------------------------------------------------------- /setup/link-dotfiles: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | set -e 4 | 5 | echo "" 6 | echo "===========================================" 7 | echo "Linking dotfiles" 8 | echo "" 9 | 10 | RCRC=rcrc rcup -v -d . 11 | -------------------------------------------------------------------------------- /link-dotfiles: -------------------------------------------------------------------------------- 1 | !/usr/bin/env sh 2 | 3 | set -e 4 | 5 | echo "" 6 | echo "===========================================" 7 | echo "Linking dotfiles" 8 | echo "" 9 | 10 | RCRC=rcrc rcup -v -d . 11 | © 2022 GitHub, Inc. 12 | -------------------------------------------------------------------------------- /setup/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | set -e 4 | 5 | setup/install-homebrew 6 | setup/link-dotfiles 7 | 8 | # Find all tag-specific setup files and source them 9 | for setup in tag-*/setup; do 10 | . "$setup" 11 | done 12 | -------------------------------------------------------------------------------- /tag-android/config/android/projects.zsh: -------------------------------------------------------------------------------- 1 | # all things related to specific projects 2 | # this will make it easy to 🔎 and ✂️ them later 3 | 4 | # upload apk to any littleBits slack channel 5 | alias ulb="upload -t $LITTLE_BITS_SLACK_BOT_TOKEN" 6 | 7 | -------------------------------------------------------------------------------- /tag-zsh/config/zsh/colors.zsh: -------------------------------------------------------------------------------- 1 | # http://zsh.sourceforge.net/Doc/Release/Completion-System.html 2 | zmodload -i zsh/complist 3 | 4 | # Show ls on dark backgrounds well 5 | export LSCOLORS=exfxcxdxbxegedabagacad 6 | export LS_COLORS='di=34:ln=35:so=32:pi=33:ex=31:bd=34;46:cd=34;43:su=30;41:sg=30;46:tw=30;42:ow=30;43' 7 | -------------------------------------------------------------------------------- /tag-zsh/config/zsh/history.zsh: -------------------------------------------------------------------------------- 1 | HISTFILE=~/.zsh_history 2 | HISTSIZE=10000000 3 | SAVEHIST=$HISTSIZE 4 | 5 | setopt SHARE_HISTORY # share history between sessions ??? 6 | setopt EXTENDED_HISTORY # add timestamps to history 7 | setopt INC_APPEND_HISTORY # adds history incrementally 8 | setopt HIST_IGNORE_ALL_DUPS # don't record dupes in history 9 | setopt HIST_REDUCE_BLANKS 10 | -------------------------------------------------------------------------------- /tag-git/config/git/completion.zsh: -------------------------------------------------------------------------------- 1 | autoload -U compinit && compinit 2 | 3 | zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}' 4 | zstyle ':completion:*' insert-tab pending 5 | 6 | # by itself: run `git status` 7 | # with arguments: acts like `git` 8 | function g { 9 | if [[ $# > 0 ]]; then 10 | git $@ 11 | else 12 | git st 13 | fi 14 | } 15 | # 16 | # complete `g` like `git`, etc 17 | compdef g=git 18 | 19 | # tab completion for `delete_branch` command 20 | _git_delete_branch() { 21 | __gitcomp "$(__git_heads)" 22 | } 23 | -------------------------------------------------------------------------------- /tag-zsh/config/zsh/config.zsh: -------------------------------------------------------------------------------- 1 | # colors 2 | export CLICOLOR=true 3 | 4 | # zsh options 5 | setopt NO_BG_NICE # don't nice background tasks 6 | setopt NO_HUP 7 | setopt NO_LIST_BEEP 8 | setopt LOCAL_OPTIONS # allow functions to have local options 9 | setopt LOCAL_TRAPS # allow functions to have local traps 10 | setopt PROMPT_SUBST 11 | setopt CORRECT 12 | setopt COMPLETE_IN_WORD 13 | setopt IGNORE_EOF 14 | setopt EXTENDED_GLOB 15 | 16 | # set the editor du jour. 17 | export VISUAL='/usr/local/bin/vim' 18 | export EDITOR="$VISUAL" 19 | 20 | -------------------------------------------------------------------------------- /tag-zsh/zshrc: -------------------------------------------------------------------------------- 1 | # your projects folder so that we can `c [tab]` to 2 | export PROJECTS="$HOME/Development" 3 | 4 | # shortcut to this dotfiles path is $DOTFILES 5 | export DOTFILES="$PROJECTS/dotfiles" 6 | 7 | # source the base zshrc configurations first 8 | for config_file (~/.config/zsh/*.zsh) source $config_file 9 | 10 | # source the remaining zsh config files 11 | # the `^zsh` bit means all directories _except_ the `zsh` directory 12 | for config_file (~/.config/^zsh/*.zsh) source $config_file 13 | 14 | #source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh 15 | -------------------------------------------------------------------------------- /tag-zsh/config/zsh/completion.zsh: -------------------------------------------------------------------------------- 1 | fpath=(~/.config/zsh/completion-scripts ~/.config/zsh/functions $fpath) 2 | autoload -U compinit && compinit 3 | autoload -U bashcompinit && bashcompinit 4 | 5 | # matches case insensitive for lowercase 6 | zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}' 7 | 8 | # pasting with tabs doesn't perform completion 9 | zstyle ':completion:*' insert-tab pending 10 | 11 | # Colorful lists of possible autocompletions for `ls` 12 | # zstyle doesn't understand the BSD-style $LSCOLORS at all, so use Linux-style 13 | # $LS_COLORS 14 | zstyle ':completion:*:ls:*:*' list-colors "$LS_COLORS" 15 | 16 | # fastlane completion 17 | #. ~/.fastlane/completions/completion.sh 18 | -------------------------------------------------------------------------------- /setup/install-homebrew: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | echo "" 6 | echo "===========================================" 7 | echo "Setting up Homebrew" 8 | echo "" 9 | # 10 | 11 | which -s brew 12 | if [[ $? != 0 ]] ; then 13 | echo "Homebrew not found. Installing Homebrew..." 14 | ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 15 | else 16 | echo "Homebrew already installed. Updating..." 17 | brew update 18 | brew upgrade 19 | fi 20 | 21 | 22 | echo "Installing brew bundle" 23 | brew tap Homebrew/bundle 24 | 25 | echo "Installing homebrew dependencies" 26 | 27 | for brewfile in */Brewfile; do 28 | brew bundle --file="$brewfile" 29 | done 30 | -------------------------------------------------------------------------------- /tag-vim/vim/plugins/plugins.vim: -------------------------------------------------------------------------------- 1 | " Easily comment/uncomment lines in many languages 2 | Plug 'tomtom/tcomment_vim' 3 | 4 | " indents or triggers autocomplete, smartly 5 | Plug 'ervandew/supertab' 6 | 7 | " Fuzzy-finder 8 | Plug 'ctrlpvim/ctrlp.vim' 9 | 10 | " Make working with shell scripts nicer ("vim-unix") 11 | Plug 'tpope/vim-eunuch' 12 | 13 | " Intelligently reopen files where you left off 14 | Plug 'dietsche/vim-lastplace' 15 | 16 | " Make `.` work to repeat plugin actions too 17 | Plug 'tpope/vim-repeat' 18 | 19 | " Instead of always copying to the system clipboard, use `cp` (plus motions) to 20 | " copy to the system clipboard. `cP` copies the current line. `cv` pastes. 21 | Plug 'christoomey/vim-system-copy' 22 | -------------------------------------------------------------------------------- /tag-android/config/android/aliases.zsh: -------------------------------------------------------------------------------- 1 | alias gr="./gradlew" 2 | 3 | # build debug and open finder to show apk file 4 | alias debug="./gradlew assembleDebug && open **/build/outputs/apk" 5 | 6 | # build release and open finder to show apk file 7 | alias release="./gradlew assembleRelease && open **/build/outputs/apk" 8 | 9 | # build amazon release 10 | alias amazon="./gradlew clean amazon assembleRelease" 11 | 12 | # run unit test 13 | alias magic="./gradlew -Punit clean testDebug" 14 | 15 | # kill emulator 16 | alias kill="adb -s emulator-5554 emu kill" 17 | 18 | # open android studio 19 | alias oa="open -a 'Android Studio' ." 20 | 21 | # upload apk to any thoughtbot slack channel 22 | alias upload="./gradlew assembleDebug && ~/.config/android/amandroid.sh" 23 | -------------------------------------------------------------------------------- /tag-vim/vim/config/appearance.vim: -------------------------------------------------------------------------------- 1 | set colorcolumn=+1 " Highlight (textwidth +1) character column 2 | set relativenumber " Use relative line numbers 3 | set number " Also show the current line number 4 | set cursorline " Highlight the current line 5 | set textwidth=80 " Force the cursor onto a new line after 80 characters 6 | 7 | " Display extra whitespace 8 | set list listchars=tab:»·,trail:·,nbsp:· 9 | 10 | " Set the cursor to a vertical line in insert mode 11 | " and a solid block in command mode 12 | autocmd InsertEnter * : silent exec "!printf '\033]50;CursorShape=1\x7'" | exec ":redraw!" 13 | autocmd InsertLeave * : silent exec "!printf '\033]50;CursorShape=0\x7'" | exec ":redraw!" 14 | 15 | " upon hitting escape to change modes, 16 | " send successive move-left and move-right 17 | " commands to immediately redraw the cursor 18 | inoremap hl 19 | 20 | -------------------------------------------------------------------------------- /tag-vim/vimrc: -------------------------------------------------------------------------------- 1 | " Stolen wholesale from gabebw, who stole it wholesale from christoomey, 2 | " whose dotfiles you really should check out: 3 | " https://github.com/christoomey/dotfiles 4 | function! s:SourceConfigFilesIn(directory) 5 | let directory_splat = '~/.vim/' . a:directory . '/*.vim' 6 | for config_file in split(glob(directory_splat), '\n') 7 | if filereadable(config_file) 8 | execute 'source' config_file 9 | endif 10 | endfor 11 | endfunction 12 | 13 | call plug#begin() 14 | call s:SourceConfigFilesIn('plugins') 15 | call plug#end() 16 | 17 | call s:SourceConfigFilesIn('config') 18 | 19 | set tabstop=2 " Global tab width. 20 | set shiftwidth=2 " And again, related. 21 | set expandtab " Use spaces instead of tabs 22 | set wrap " Turn on line wrapping. 23 | set nojoinspaces " Don't add two spaces after punctuation 24 | " when joining lines 25 | 26 | set secure " Don't let external configs do scary shit 27 | set exrc " Load local vimrc if found 28 | -------------------------------------------------------------------------------- /tag-android/ideavimrc: -------------------------------------------------------------------------------- 1 | " Case-insensitive searching. 2 | set ignorecase 3 | " But case-sensitive if expression contains a capital letter. 4 | set smartcase 5 | 6 | " Setup the number line 7 | set number 8 | set relativenumber 9 | 10 | " Use the system pasteboard 11 | set clipboard=unnamed 12 | 13 | 14 | " rename refactor 15 | " nnoremap ,r :xccmd refactorRename 16 | 17 | " Better navigation 18 | nnoremap H ^ 19 | nnoremap L $ 20 | 21 | " Run Current Configuration 22 | nnoremap r :action Run 23 | 24 | " Select Run / Build Configuration 25 | nnoremap c :action ChooseRunConfiguration 26 | 27 | "Replace Constructor With Builder 28 | nnoremap b :action ReplaceConstructorWithBuilder 29 | 30 | " Window navigation 31 | nnoremap h 32 | nnoremap l 33 | 34 | " Make computers make sense 35 | nnoremap Y y$ 36 | 37 | " I'd like the following command to save too 38 | " it doesn't seem like xvim supports this: \| update 39 | vnoremap s :sort ui 40 | 41 | " vim-unimpared knock off 42 | nnoremap ]e "udd"up 43 | nnoremap [e "uddk"uP 44 | 45 | " Jump to counterpart 46 | " nnoremap :xccmd jumpToPreviousCounterpart 47 | " nnoremap :xccmd jumpToNextCounterpart 48 | -------------------------------------------------------------------------------- /tag-git/gitconfig: -------------------------------------------------------------------------------- 1 | [user] 2 | name = Amanda Adams 3 | email = amandabessadams@gmail.com 4 | 5 | [github] 6 | user = mandybess 7 | 8 | [core] 9 | excludesfile = ~/.gitignore 10 | editor = vim 11 | autocrlf = false 12 | 13 | [color] 14 | ui = true 15 | 16 | [format] 17 | pretty = %C(yellow)%h%Cblue%d%Creset %s - %C(white)%an %Cgreen(%cr)%Creset 18 | 19 | [status] 20 | submodule = 1 21 | 22 | [fetch] 23 | prune = true 24 | 25 | [pull] 26 | rebase = true 27 | 28 | [push] 29 | default = current 30 | 31 | [rebase] 32 | autosquash = true 33 | 34 | [merge] 35 | ff = only 36 | tool = kdiff3 37 | 38 | [mergetool] 39 | keepBackup = false 40 | prompt = false 41 | 42 | [apply] 43 | whitespace = warn 44 | 45 | [help] 46 | autocorrect = 1 47 | 48 | [credential] 49 | helper = osxkeychain 50 | 51 | [alias] 52 | create-branch = !sh -c 'git push origin HEAD:refs/heads/$1 && git fetch origin && git branch --track $1 origin/$1 && cd . && git checkout $1' - 53 | delete-branch = !sh -c 'git push origin :refs/heads/$1 && git remote prune origin && git branch -D $1' - 54 | undo = !sh -c 'git reset HEAD~' 55 | 56 | [filter "media"] 57 | required = true 58 | clean = git media clean %f 59 | smudge = git media smudge %f 60 | 61 | [filter "lfs"] 62 | clean = git-lfs clean -- %f 63 | smudge = git-lfs smudge -- %f 64 | process = git-lfs filter-process 65 | required = true 66 | -------------------------------------------------------------------------------- /tag-android/config/android/amandroid.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # upload android APK to slack channel 4 | # arguments: 5 | # -c: slack channel you want the APK shared in, can be channel id or name, 6 | # if name, make sure to include the "#" (i.e. #general) 7 | # -n: name of the APK being uploaded 8 | # -p: path to location of APK 9 | 10 | # constants 11 | DOMAIN="https://slack.com/api/files.upload" 12 | 13 | # defaults 14 | DEFAULT_CHANNEL="#slackbot-testing" 15 | # this assumes you are in the project directory and the main app module is 'app' 16 | DEFAULT_RELATIVE_PATH="$PWD/app/build/outputs/apk/app-debug.apk" 17 | # this is for thoughtbot slack 18 | DEFAULT_TOKEN=$AMANDROID_SLACK_BOT_TOKEN 19 | 20 | # variables 21 | CHANNEL=$DEFAULT_CHANNEL 22 | FILE_NAME="" 23 | FILE_PATH=$DEFAULT_RELATIVE_PATH 24 | TOKEN=$DEFAULT_TOKEN 25 | 26 | while getopts "c:n:p:t:" opt ; do 27 | case "$opt" in 28 | c) CHANNEL=$OPTARG;; 29 | n) FILE_NAME=$OPTARG;; 30 | p) FILE_PATH=$OPTARG;; 31 | t) TOKEN=$OPTARG;; 32 | esac 33 | done 34 | 35 | # check if we've got a file path 36 | if [ -z "$FILE_PATH" ]; then 37 | echo "🙅 Oops. Looks like you forgot to add a file path via '- p'. Go back 38 | and try again." 39 | exit 1 40 | fi 41 | 42 | # check if file name has .apk extension, if not, add one 43 | # we do this because Slack is silly and if we don't add the .apk extension it 44 | # will upload the apk as a zip file 45 | FILE_NAME="${FILE_NAME%.apk}.apk" 46 | 47 | # execute curl 48 | curl -F file=@"$FILE_PATH" -F channels="$CHANNEL" -F filename="$FILE_NAME" -F token="$TOKEN" "$DOMAIN" 49 | -------------------------------------------------------------------------------- /tag-xcode/xvimrc: -------------------------------------------------------------------------------- 1 | " No status bar 2 | set laststatus=0 3 | 4 | " Search 5 | set incsearch 6 | set ignorecase 7 | set smartcase 8 | set wrap 9 | set wrapscan 10 | set gdefault 11 | 12 | " Setup the number line 13 | set number 14 | set relativenumber 15 | 16 | " Use the system pasteboard 17 | set clipboard=unnamed 18 | 19 | " Better navigation 20 | nmap H ^ 21 | nmap L $ 22 | 23 | " Window navigation 24 | nmap h 25 | nmap l 26 | 27 | " Make computers make sense 28 | nmap D d$ 29 | nmap Y y$ 30 | 31 | " I'd like the following command to save too 32 | " it doesn't seem like xvim supports this: \| update 33 | vmap s :sort ui 34 | 35 | " vim-unimpared knock off 36 | nmap ]e "udd"up 37 | nmap [e "uddk"uP 38 | 39 | " Move visual blocks 40 | vnoremap J :m '>+1gv=gv 41 | vnoremap K :m '<-2gv=gv 42 | 43 | " Navigate 44 | nmap ch :xcmenucmd Find Call Hierarchy 45 | nmap jp :xcmenucmd Jump to Definition 46 | nmap ja :xccmd jumpToDefinitionWithAlternate 47 | nmap i :xcmenucmd Jump to Generated Interface 48 | 49 | " Editor 50 | nmap gcc :xcmenucmd Comment Selection 51 | vmap gc :xcmenucmd Comment Selection 52 | nmap f :xcmenucmd Fix All in Scope 53 | nmap gb :xcmenucmd Show Blame for Line 54 | 55 | " Product 56 | nmap C :xccmd compileCurrentFile 57 | nmap k :xcmenucmd Clean 58 | nmap K :xcmenucmd Clean Build Folder... 59 | 60 | " Debug 61 | nmap vi :xcmenucmd Capture View Hierarchy 62 | 63 | " Documentation 64 | nmap d :xcmenucmd Quick Help for Selected Item 65 | 66 | " Make Things Like they are in Android Studio 67 | map r :run 68 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # dotfiles :floppy_disk: 2 | welcome to my dotfiles :wave:! These are my dotfiles for Zsh, git, android and beyond :dizzy: 3 | 4 | Questions? Comments? Concerns? Complements? Open an issue or tweet at me [@mandybess](https://twitter.com/mandybess) 5 | 6 | ## prerequisites :clipboard: 7 | 8 | * OS X 9 | * Zsh (to change your default shell to Zsh: `chsh -s $(which zsh) $USER`) 10 | * [Homebrew](http://brew.sh/) 11 | 12 | ## installation :wrench: 13 | $ git clone git@github.com:mandybess/dotfiles.git $PROJECTS/dotfiles 14 | $ cd $DOTFILES 15 | $ ./setup/setup 16 | 17 | It will install [rcm] and use that to safely symlink the dotfiles, prompting you 18 | if a file already exists (like if you already have `~/.zshrc`). 19 | 20 | [rcm]: http://thoughtbot.github.io/rcm/rcm.7.html 21 | 22 | ## organization :card_index: 23 | 24 | This repo uses [rcm] for management. It's pretty dope, you should probably check it 25 | out :sunglasses: 26 | 27 | `rcm` will symlink all files into place, keeping the folder structure relative 28 | to the tag root. However, our `rcrc` is explicitly ignoring a few things: 29 | 30 | - `Brewfile`s are the homebrew dependencies for a specific tag, and therefore don't 31 | need to be symlinked. 32 | - Anything named `setup` (or in a directory with that name) is assumed to be 33 | part of the general setup process, and will therefore also not be symlinked. 34 | 35 | The full list of what is being ignored is being controlled by the `EXCLUDES` key in my [`rcrc`][rcrc]. 36 | 37 | [rcrc]: https://github.com/gfontenot/dotfiles/blob/master/rcrc 38 | [rcm]: https://github.com/thoughtbot/rcm 39 | 40 | ## styles :dizzy: 41 | For every IDE or application I use in my regular development there is a corresponding `themes` folder (i.e. [`intelliji-themes`][intelliji-themes]) 42 | 43 | [intelliji-themes]: https://github.com/mandybess/dotfiles/intelliji-themes 44 | 45 | For my desktop :computer: wallpapers, I like to use [larknraven](https://www.etsy.com/shop/larknraven) designs as featured on [Design Love Fest](http://www.designlovefest.com/?s=lark+raven) :art: 46 | 47 | ## attribution :couple: 48 | 49 | Many scripts and configurations (including this sentence) have been inspired by or outright stolen from 50 | my colleagues at thoughtbot. Of special note, I've stolen many things from 51 | [Gabe Berke-Williams], [Gordon Fontenot], and [Mark Adams], among others that I'm sure I'm forgetting. 52 | 53 | [Gabe Berke-Williams]: https://github.com/gabebw/dotfiles 54 | [Gordon Fontenot]: https://github.com/gfontenot/dotfiles 55 | [Mark Adams]: https://github.com/hyperspacemark/dotfiles 56 | -------------------------------------------------------------------------------- /tag-android/config/android/functions.zsh: -------------------------------------------------------------------------------- 1 | #silly parse Logcat output 2 | alog () { 3 | parser=ack 4 | if [[ -e `which ack` ]]; then 5 | parser=grep 6 | fi 7 | if (( $# == 0 )); then 8 | adb logcat -v time 9 | elif [[ $1 == "runtime" ]]; then 10 | pattern='E/AndroidRuntime' 11 | adb logcat -v time | $parser --ignore-case $pattern 12 | else 13 | adb logcat -v time | $parser --ignore-case $@ 14 | fi 15 | } 16 | 17 | # take an android screenshot - for pre nougat devices 18 | # adapted off alias from http://blog.shvetsov.com/2013/02/grab-android-screenshot-to-computer-via.html 19 | ascreen(){ 20 | _file="android_screenshot-`date +"%m_%d_%y-%H_%M_%S"`" 21 | _dir="$HOME/Desktop" 22 | target=$_dir/$_file.png 23 | adb shell screencap -p | perl -pe 's/\x0D\x0A/\x0A/g' > $target 24 | 25 | opened_already="no" 26 | uploaded_already="no" 27 | for arg in "$@"; do 28 | [[ $uploaded_already == "no" && ($arg == "upload" || $arg == "up") ]] && \ 29 | uploaded_already="yes" && \ 30 | cloudapp $target 31 | [[ $opened_already == "no" && $arg == "open" ]] && \ 32 | opened_already="yes" && \ 33 | open $target 34 | done 35 | } 36 | 37 | # take a screen shot for post nougat devices 38 | # from: https://stkent.github.io/2016/08/28/capturing-Nougat-screenshots-using-adb-shell.html 39 | screenshot(){ 40 | _file="android_screenshot-`date +"%m_%d_%y-%H_%M_%S"`" 41 | _dir="$HOME/Desktop" 42 | target=$_dir/$_file.png 43 | 44 | adb shell screencap -p > $target 45 | } 46 | 47 | 48 | # record a video of whatever the connected devices is 49 | record(){ 50 | # start recording 51 | adb shell screenrecord /sdcard/demo.mp4 52 | 53 | # Download the video 54 | # adb pull /sdcard/demo.mp4 55 | 56 | # Delete the video from the device 57 | # adb shell rm /sdcard/demo.mp4 58 | } 59 | 60 | 61 | # grab the video recorded from the above (screenrecord) function and put it on the Desktop 62 | grab(){ 63 | # Download the video 64 | adb pull /sdcard/demo.mp4 ~/Desktop 65 | 66 | # Delete the video from the device 67 | adb shell rm /sdcard/demo.mp4 68 | } 69 | 70 | ## convert the video created by the `screenrecord` function to a GIF and place it on the Desktop 71 | gif(){ 72 | # Download the video to the Desktop 73 | adb pull /sdcard/demo.mp4 ~/Desktop 74 | 75 | # Delete the video from the device 76 | adb shell rm /sdcard/demo.mp4 77 | 78 | # Convert to a GIF named screenshot.gif on the Desktop 79 | gifify ~/Desktop/demo.mp4 -o ~/Desktop/screenshot.gif 80 | 81 | # Delete the mp4 from the Desktop 82 | rm ~/Desktop/demo.mp4 83 | } 84 | 85 | avd(){ 86 | emulator -list-avds | cat -n 87 | printf "Select AVD: " 88 | read index 89 | avd=$(emulator -list-avds | sed "${index}q;d") 90 | echo "Selected $avd" 91 | emulator -avd $avd -netdelay none -netspeed full 92 | } 93 | 94 | -------------------------------------------------------------------------------- /tag-zsh/config/zsh/prompt.zsh: -------------------------------------------------------------------------------- 1 | ## Colors 2 | 3 | # Generate colors for all 256 colors 4 | typeset -AHg fg bg 5 | 6 | for color in {000..255}; do 7 | fg[$color]="%{[38;5;${color}m%}" 8 | bg[$color]="%{[48;5;${color}m%}" 9 | done 10 | 11 | ZSH_SPECTRUM_TEXT="What a neat color this is" 12 | # Show all 256 colors with color number 13 | spectrum_ls() { 14 | for code in {000..255}; do 15 | print -P -- "$code: %{$fg[$code]%}$ZSH_SPECTRUM_TEXT%{$reset_color%}" 16 | done 17 | } 18 | 19 | # Show all 256 colors, but set the background color, not the foreground 20 | spectrum_bls() { 21 | for code in {000..255}; do 22 | print -P -- "$code: %{$bg[$code]%}$ZSH_SPECTRUM_TEXT%{$reset_color%}" 23 | done 24 | } 25 | 26 | prompt_color() { 27 | [[ -n "$1" ]] && print "%{$fg[$2]%}$1%{$reset_color%}" 28 | } 29 | 30 | prompt_green() { print "$(prompt_color "$1" 158)" } 31 | prompt_magenta(){ print "$(prompt_color "$1" 225)" } 32 | prompt_purple() { print "$(prompt_color "$1" 183)" } 33 | prompt_red() { print "$(prompt_color "$1" 218)" } 34 | prompt_cyan() { print "$(prompt_color "$1" 158)" } 35 | prompt_blue() { print "$(prompt_color "$1" 159)" } 36 | prompt_yellow() { print "$(prompt_color "$1" 222)" } 37 | prompt_spaced() { [[ -n "$1" ]] && print " $@" } 38 | 39 | ## Helper functions: path 40 | 41 | # %2~ means "show the last two components of the path, and show the home 42 | # directory as ~". 43 | # 44 | # Examples: 45 | # 46 | # ~/foo/bar is shown as "foo/bar" 47 | # ~/foo is shown as ~/foo (not /Users/amanda/foo) 48 | prompt_shortened_path() { print "$(prompt_purple "%2~")" } 49 | 50 | 51 | ## GIT (branch, vcs) # 52 | # vcs_info docs: http://zsh.sourceforge.net/Doc/Release/User-Contributions.html#Version-Control-Information 53 | 54 | autoload -Uz vcs_info 55 | 56 | zstyle ':vcs_info:*' enable git 57 | zstyle ':vcs_info:git*' formats $(prompt_blue "%b") 58 | zstyle ':vcs_info:git*' actionformats $(prompt_red "%b|%a") 59 | 60 | prompt_git_status_symbol(){ 61 | local letter 62 | local gucci="%2{👍🏼%} " 63 | local no_gucci="%2{🙅🏻%} " 64 | 65 | case $(prompt_git_status) in 66 | changed) letter=$(prompt_red $no_gucci);; 67 | staged) letter=$(prompt_yellow "S");; 68 | untracked) letter=$(prompt_red "?");; 69 | unchanged) letter=$(prompt_green $gucci);; 70 | esac 71 | 72 | prompt_spaced "$letter" 73 | } 74 | 75 | # Is this branch ahead/behind its remote tracking branch? 76 | prompt_git_relative_branch_status_symbol(){ 77 | local arrow; 78 | 79 | # http://www.fileformat.info/info/unicode/char/21e3/index.htm 80 | local downwards_arrow="\u21e3" 81 | # http://www.fileformat.info/info/unicode/char/21e1/index.htm 82 | local upwards_arrow="\u21e1" 83 | case $(prompt_git_relative_branch_status) in 84 | behind) arrow=$(prompt_cyan $downwards_arrow);; 85 | ahead) arrow=$(prompt_cyan $upwards_arrow);; 86 | esac 87 | 88 | print -n "$arrow" 89 | } 90 | 91 | prompt_git_status() { 92 | local git_status="$(cat "/tmp/git-status-$$")" 93 | if print "$git_status" | command grep -qF "Changes not staged" ; then 94 | print "changed" 95 | elif print "$git_status" | command grep -qF "Changes to be committed"; then 96 | print "staged" 97 | elif print "$git_status" | command grep -qF "Untracked files"; then 98 | print "untracked" 99 | else 100 | print "unchanged" 101 | fi 102 | } 103 | 104 | prompt_git_relative_branch_status(){ 105 | local git_status="$(cat "/tmp/git-status-$$")" 106 | if print "$git_status" | command grep -qF "Your branch is behind"; then 107 | print "behind" 108 | elif print "$git_status" | command grep -qF "Your branch is ahead"; then 109 | print "ahead" 110 | fi 111 | } 112 | 113 | prompt_git_branch() { 114 | # vcs_info_msg_0_ is set by the `zstyle vcs_info` directives 115 | local colored_branch_name="$vcs_info_msg_0_" 116 | prompt_spaced "$colored_branch_name" 117 | } 118 | 119 | # This shows everything about the current git branch: 120 | # * branch name 121 | # * check mark/x mark/letter etc depending on whether branch is dirty, clean, 122 | # has staged changes, etc 123 | # * Up arrow if local branch is ahead of remote branch, or down arrow if local 124 | # branch is behind remote branch 125 | prompt_full_git_status(){ 126 | if [[ -n "$vcs_info_msg_0_" ]]; then 127 | prompt_spaced $(prompt_git_branch) $(prompt_git_status_symbol) $(prompt_git_relative_branch_status_symbol) 128 | fi 129 | } 130 | 131 | # wrap in brackets 132 | bracket_wrap(){ 133 | echo "$(prompt_red "[")$1$(prompt_red "]") " 134 | } 135 | 136 | # `precmd` is a magic function that's run right before the prompt is evaluated 137 | # on each line. 138 | # Here, it's used to capture the git status to show in the prompt. 139 | function precmd { 140 | vcs_info 141 | git status 2> /dev/null >! "/tmp/git-status-$$" 142 | } 143 | 144 | 145 | ## Actually set the PROMPT 146 | 147 | # prompt_subst allows `$(function)` inside the PROMPT 148 | # Escape the `$()` like `\$()` so it's not immediately evaluated when this file 149 | # is sourced but is evaluated every time we need the prompt. 150 | setopt prompt_subst 151 | 152 | PROMPT='$(bracket_wrap "$(prompt_shortened_path)$(prompt_spaced $(prompt_full_git_status))")' 153 | -------------------------------------------------------------------------------- /xcode-themes/Ladies Night.xccolortheme: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | DVTConsoleDebuggerInputTextColor 6 | 0.972549 0.972549 0.94902 1 7 | DVTConsoleDebuggerInputTextFont 8 | Monaco - 12.0 9 | DVTConsoleDebuggerOutputTextColor 10 | 0.972549 0.972549 0.94902 1 11 | DVTConsoleDebuggerOutputTextFont 12 | Monaco - 12.0 13 | DVTConsoleDebuggerPromptTextColor 14 | 0.313725 0.980392 0.482353 1 15 | DVTConsoleDebuggerPromptTextFont 16 | Monaco - 12.0 17 | DVTConsoleExectuableInputTextColor 18 | 0.972549 0.972549 0.94902 1 19 | DVTConsoleExectuableInputTextFont 20 | Monaco - 12.0 21 | DVTConsoleExectuableOutputTextColor 22 | 0.972549 0.972549 0.94902 1 23 | DVTConsoleExectuableOutputTextFont 24 | Monaco - 12.0 25 | DVTConsoleTextBackgroundColor 26 | 0.156863 0.164706 0.211765 1 27 | DVTConsoleTextInsertionPointColor 28 | 1 1 1 1 29 | DVTConsoleTextSelectionColor 30 | 0.266667 0.278431 0.352941 1 31 | DVTDebuggerInstructionPointerColor 32 | 0.545098 0.913725 0.992157 1 33 | DVTMarkupTextBackgroundColor 34 | 0.188245 0.192381 0.226996 1 35 | DVTMarkupTextBorderColor 36 | 0.253186 0.25699 0.288836 1 37 | DVTMarkupTextCodeFont 38 | Monaco - 11.0 39 | DVTMarkupTextEmphasisColor 40 | 0.877929 0.872979 0.878041 1 41 | DVTMarkupTextEmphasisFont 42 | .AppleSystemUIFontItalic - 11.0 43 | DVTMarkupTextInlineCodeColor 44 | 0.877929 0.872979 0.878041 0.7 45 | DVTMarkupTextLinkColor 46 | 0.384314 0.447059 0.643137 1 47 | DVTMarkupTextLinkFont 48 | .AppleSystemUIFont - 11.0 49 | DVTMarkupTextNormalColor 50 | 0.877929 0.872979 0.878041 1 51 | DVTMarkupTextNormalFont 52 | .AppleSystemUIFont - 11.0 53 | DVTMarkupTextOtherHeadingColor 54 | 0.877929 0.872979 0.878041 0.5 55 | DVTMarkupTextOtherHeadingFont 56 | .AppleSystemUIFont - 15.4 57 | DVTMarkupTextPrimaryHeadingColor 58 | 0.877929 0.872979 0.878041 1 59 | DVTMarkupTextPrimaryHeadingFont 60 | .AppleSystemUIFont - 26.4 61 | DVTMarkupTextSecondaryHeadingColor 62 | 0.877929 0.872979 0.878041 1 63 | DVTMarkupTextSecondaryHeadingFont 64 | .AppleSystemUIFont - 19.8 65 | DVTMarkupTextStrongColor 66 | 0.877929 0.872979 0.878041 1 67 | DVTMarkupTextStrongFont 68 | .AppleSystemUIFontEmphasized - 11.0 69 | DVTSourceTextBackground 70 | 0.0976036 0.117204 0.133008 1 71 | DVTSourceTextBlockDimBackgroundColor 72 | 0.5 0.5 0.5 1 73 | DVTSourceTextCurrentLineHighlightColor 74 | 0.15491 0.161222 0.208069 1 75 | DVTSourceTextInsertionPointColor 76 | 1 1 1 1 77 | DVTSourceTextInvisiblesColor 78 | 0.496379 0.5 0.5 1 79 | DVTSourceTextSelectionColor 80 | 0.266667 0.278431 0.352941 1 81 | DVTSourceTextSyntaxColors 82 | 83 | xcode.syntax.attribute 84 | 0.545098 0.913725 0.992157 1 85 | xcode.syntax.character 86 | 0.174085 0.675574 0.510621 1 87 | xcode.syntax.comment 88 | 0.41441 0.475201 0.505969 1 89 | xcode.syntax.comment.doc 90 | 0.41441 0.475201 0.505969 1 91 | xcode.syntax.comment.doc.keyword 92 | 0.41441 0.475201 0.505969 1 93 | xcode.syntax.identifier.class 94 | 0.445926 0.650899 0.737005 1 95 | xcode.syntax.identifier.class.system 96 | 0.888581 0.868157 0.651237 1 97 | xcode.syntax.identifier.constant 98 | 0.445926 0.650899 0.737005 1 99 | xcode.syntax.identifier.constant.system 100 | 0.888581 0.868157 0.651237 1 101 | xcode.syntax.identifier.function 102 | 0.445926 0.650899 0.737005 1 103 | xcode.syntax.identifier.function.system 104 | 0.888581 0.868157 0.651237 1 105 | xcode.syntax.identifier.macro 106 | 0.558001 0.413902 0.694072 1 107 | xcode.syntax.identifier.macro.system 108 | 0.558001 0.413902 0.694072 1 109 | xcode.syntax.identifier.type 110 | 0.445926 0.650899 0.737005 1 111 | xcode.syntax.identifier.type.system 112 | 0.888581 0.868157 0.651237 1 113 | xcode.syntax.identifier.variable 114 | 0.445926 0.650899 0.737005 1 115 | xcode.syntax.identifier.variable.system 116 | 0.888581 0.868157 0.651237 1 117 | xcode.syntax.keyword 118 | 0.882532 0.419876 0.567276 1 119 | xcode.syntax.number 120 | 0.174085 0.675574 0.510621 1 121 | xcode.syntax.plain 122 | 0.995018 1 0.979366 1 123 | xcode.syntax.preprocessor 124 | 0.558001 0.413902 0.694072 1 125 | xcode.syntax.string 126 | 0.174085 0.675574 0.510621 1 127 | xcode.syntax.url 128 | 0.558001 0.413902 0.694072 1 129 | 130 | DVTSourceTextSyntaxFonts 131 | 132 | xcode.syntax.attribute 133 | SFMono-Regular - 15.0 134 | xcode.syntax.character 135 | SFMono-Regular - 15.0 136 | xcode.syntax.comment 137 | SFMono-Regular - 15.0 138 | xcode.syntax.comment.doc 139 | SFMono-Regular - 15.0 140 | xcode.syntax.comment.doc.keyword 141 | SFMono-Regular - 15.0 142 | xcode.syntax.identifier.class 143 | SFMono-Regular - 15.0 144 | xcode.syntax.identifier.class.system 145 | SFMono-Regular - 15.0 146 | xcode.syntax.identifier.constant 147 | SFMono-Regular - 15.0 148 | xcode.syntax.identifier.constant.system 149 | SFMono-Regular - 15.0 150 | xcode.syntax.identifier.function 151 | SFMono-Regular - 15.0 152 | xcode.syntax.identifier.function.system 153 | SFMono-Regular - 15.0 154 | xcode.syntax.identifier.macro 155 | SFMono-Regular - 15.0 156 | xcode.syntax.identifier.macro.system 157 | SFMono-Regular - 15.0 158 | xcode.syntax.identifier.type 159 | SFMono-Regular - 15.0 160 | xcode.syntax.identifier.type.system 161 | SFMono-Regular - 15.0 162 | xcode.syntax.identifier.variable 163 | SFMono-Regular - 15.0 164 | xcode.syntax.identifier.variable.system 165 | SFMono-Regular - 15.0 166 | xcode.syntax.keyword 167 | SFMono-Regular - 15.0 168 | xcode.syntax.number 169 | SFMono-Regular - 15.0 170 | xcode.syntax.plain 171 | SFMono-Regular - 15.0 172 | xcode.syntax.preprocessor 173 | SFMono-Regular - 15.0 174 | xcode.syntax.string 175 | SFMono-Regular - 15.0 176 | xcode.syntax.url 177 | SFMono-Regular - 15.0 178 | 179 | 180 | 181 | -------------------------------------------------------------------------------- /iterm_themes/ladiesnight.itermcolors: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Ansi 0 Color 6 | 7 | Alpha Component 8 | 1 9 | Blue Component 10 | 0.13225468993186951 11 | Color Space 12 | Calibrated 13 | Green Component 14 | 0.11743681877851486 15 | Red Component 16 | 0.098235249519348145 17 | 18 | Ansi 1 Color 19 | 20 | Alpha Component 21 | 1 22 | Blue Component 23 | 0.68654429912567139 24 | Color Space 25 | Calibrated 26 | Green Component 27 | 0.42116943001747131 28 | Red Component 29 | 0.55604356527328491 30 | 31 | Ansi 10 Color 32 | 33 | Alpha Component 34 | 1 35 | Blue Component 36 | 0.48235294222831726 37 | Color Space 38 | Calibrated 39 | Green Component 40 | 0.98039215803146362 41 | Red Component 42 | 0.31372550129890442 43 | 44 | Ansi 11 Color 45 | 46 | Alpha Component 47 | 1 48 | Blue Component 49 | 0.54901963472366333 50 | Color Space 51 | Calibrated 52 | Green Component 53 | 0.98039215803146362 54 | Red Component 55 | 0.94509804248809814 56 | 57 | Ansi 12 Color 58 | 59 | Alpha Component 60 | 1 61 | Blue Component 62 | 0.97647058963775635 63 | Color Space 64 | Calibrated 65 | Green Component 66 | 0.57647061347961426 67 | Red Component 68 | 0.74117648601531982 69 | 70 | Ansi 13 Color 71 | 72 | Alpha Component 73 | 1 74 | Blue Component 75 | 0.7764706015586853 76 | Color Space 77 | Calibrated 78 | Green Component 79 | 0.47450980544090271 80 | Red Component 81 | 1 82 | 83 | Ansi 14 Color 84 | 85 | Alpha Component 86 | 1 87 | Blue Component 88 | 0.99215686321258545 89 | Color Space 90 | Calibrated 91 | Green Component 92 | 0.91372549533843994 93 | Red Component 94 | 0.54509806632995605 95 | 96 | Ansi 15 Color 97 | 98 | Alpha Component 99 | 1 100 | Blue Component 101 | 1 102 | Color Space 103 | Calibrated 104 | Green Component 105 | 1 106 | Red Component 107 | 1 108 | 109 | Ansi 2 Color 110 | 111 | Alpha Component 112 | 1 113 | Blue Component 114 | 0.51263946294784546 115 | Color Space 116 | Calibrated 117 | Green Component 118 | 0.67132043838500977 119 | Red Component 120 | 0.19664245843887329 121 | 122 | Ansi 3 Color 123 | 124 | Alpha Component 125 | 1 126 | Blue Component 127 | 0.66091841459274292 128 | Color Space 129 | Calibrated 130 | Green Component 131 | 0.86446142196655273 132 | Red Component 133 | 0.88733154535293579 134 | 135 | Ansi 4 Color 136 | 137 | Alpha Component 138 | 1 139 | Blue Component 140 | 0.7320408821105957 141 | Color Space 142 | Calibrated 143 | Green Component 144 | 0.65185022354125977 145 | Red Component 146 | 0.4526006281375885 147 | 148 | Ansi 5 Color 149 | 150 | Alpha Component 151 | 1 152 | Blue Component 153 | 0.56849712133407593 154 | Color Space 155 | Calibrated 156 | Green Component 157 | 0.42560216784477234 158 | Red Component 159 | 0.87387526035308838 160 | 161 | Ansi 6 Color 162 | 163 | Alpha Component 164 | 1 165 | Blue Component 166 | 0.6909257173538208 167 | Color Space 168 | Calibrated 169 | Green Component 170 | 0.53994590044021606 171 | Red Component 172 | 0.35756626725196838 173 | 174 | Ansi 7 Color 175 | 176 | Alpha Component 177 | 1 178 | Blue Component 179 | 0.98027229309082031 180 | Color Space 181 | Calibrated 182 | Green Component 183 | 1 184 | Red Component 185 | 0.99521839618682861 186 | 187 | Ansi 8 Color 188 | 189 | Alpha Component 190 | 1 191 | Blue Component 192 | 0.33333333333333331 193 | Color Space 194 | Calibrated 195 | Green Component 196 | 0.33333333333333331 197 | Red Component 198 | 0.33333333333333331 199 | 200 | Ansi 9 Color 201 | 202 | Alpha Component 203 | 1 204 | Blue Component 205 | 0.3333333432674408 206 | Color Space 207 | Calibrated 208 | Green Component 209 | 0.3333333432674408 210 | Red Component 211 | 1 212 | 213 | Background Color 214 | 215 | Alpha Component 216 | 1 217 | Blue Component 218 | 0.15977837145328522 219 | Color Space 220 | Calibrated 221 | Green Component 222 | 0.12215272337198257 223 | Red Component 224 | 0.11765811592340469 225 | 226 | Badge Color 227 | 228 | Alpha Component 229 | 0.5 230 | Blue Component 231 | 0.0 232 | Color Space 233 | Calibrated 234 | Green Component 235 | 0.0 236 | Red Component 237 | 1 238 | 239 | Bold Color 240 | 241 | Alpha Component 242 | 1 243 | Blue Component 244 | 1 245 | Color Space 246 | Calibrated 247 | Green Component 248 | 1 249 | Red Component 250 | 1 251 | 252 | Cursor Color 253 | 254 | Alpha Component 255 | 1 256 | Blue Component 257 | 0.73333334922790527 258 | Color Space 259 | Calibrated 260 | Green Component 261 | 0.73333334922790527 262 | Red Component 263 | 0.73333334922790527 264 | 265 | Cursor Guide Color 266 | 267 | Alpha Component 268 | 0.25 269 | Blue Component 270 | 1 271 | Color Space 272 | Calibrated 273 | Green Component 274 | 0.9100000262260437 275 | Red Component 276 | 0.64999997615814209 277 | 278 | Cursor Text Color 279 | 280 | Alpha Component 281 | 1 282 | Blue Component 283 | 1 284 | Color Space 285 | Calibrated 286 | Green Component 287 | 1 288 | Red Component 289 | 1 290 | 291 | Foreground Color 292 | 293 | Alpha Component 294 | 1 295 | Blue Component 296 | 0.94901961088180542 297 | Color Space 298 | Calibrated 299 | Green Component 300 | 0.97254902124404907 301 | Red Component 302 | 0.97254902124404907 303 | 304 | Link Color 305 | 306 | Alpha Component 307 | 1 308 | Blue Component 309 | 0.67799997329711914 310 | Color Space 311 | Calibrated 312 | Green Component 313 | 0.27000001072883606 314 | Red Component 315 | 0.023000000044703484 316 | 317 | Selected Text Color 318 | 319 | Alpha Component 320 | 1 321 | Blue Component 322 | 1 323 | Color Space 324 | Calibrated 325 | Green Component 326 | 1 327 | Red Component 328 | 1 329 | 330 | Selection Color 331 | 332 | Alpha Component 333 | 1 334 | Blue Component 335 | 0.35294118523597717 336 | Color Space 337 | Calibrated 338 | Green Component 339 | 0.27843138575553894 340 | Red Component 341 | 0.26666668057441711 342 | 343 | 344 | 345 | -------------------------------------------------------------------------------- /tag-vim/vim/config/l80snight.vim: -------------------------------------------------------------------------------- 1 | " Default GUI Colours 2 | let s:foreground = "cccccc" 3 | let s:background = "21282D" 4 | let s:selection = "515151" 5 | let s:line = "393939" 6 | let s:comment = "999999" 7 | let s:red = "E784A2" 8 | let s:orange = "E8E2B7" 9 | let s:yellow = "ffcc66" 10 | let s:green = "3AB795" 11 | let s:aqua = "85B5C7" 12 | let s:blue = "6699cc" 13 | let s:purple = "6699cc" 14 | let s:window = "4d5057" 15 | 16 | hi clear 17 | syntax reset 18 | 19 | let g:colors_name = "ladiesnight" 20 | 21 | if has("gui_running") || &t_Co == 88 || &t_Co == 256 22 | " Returns an approximate grey index for the given grey level 23 | fun grey_number(x) 24 | if &t_Co == 88 25 | if a:x < 23 26 | return 0 27 | elseif a:x < 69 28 | return 1 29 | elseif a:x < 103 30 | return 2 31 | elseif a:x < 127 32 | return 3 33 | elseif a:x < 150 34 | return 4 35 | elseif a:x < 173 36 | return 5 37 | elseif a:x < 196 38 | return 6 39 | elseif a:x < 219 40 | return 7 41 | elseif a:x < 243 42 | return 8 43 | else 44 | return 9 45 | endif 46 | else 47 | if a:x < 14 48 | return 0 49 | else 50 | let l:n = (a:x - 8) / 10 51 | let l:m = (a:x - 8) % 10 52 | if l:m < 5 53 | return l:n 54 | else 55 | return l:n + 1 56 | endif 57 | endif 58 | endif 59 | endfun 60 | 61 | " Returns the actual grey level represented by the grey index 62 | fun grey_level(n) 63 | if &t_Co == 88 64 | if a:n == 0 65 | return 0 66 | elseif a:n == 1 67 | return 46 68 | elseif a:n == 2 69 | return 92 70 | elseif a:n == 3 71 | return 115 72 | elseif a:n == 4 73 | return 139 74 | elseif a:n == 5 75 | return 162 76 | elseif a:n == 6 77 | return 185 78 | elseif a:n == 7 79 | return 208 80 | elseif a:n == 8 81 | return 231 82 | else 83 | return 255 84 | endif 85 | else 86 | if a:n == 0 87 | return 0 88 | else 89 | return 8 + (a:n * 10) 90 | endif 91 | endif 92 | endfun 93 | 94 | " Returns the palette index for the given grey index 95 | fun grey_colour(n) 96 | if &t_Co == 88 97 | if a:n == 0 98 | return 16 99 | elseif a:n == 9 100 | return 79 101 | else 102 | return 79 + a:n 103 | endif 104 | else 105 | if a:n == 0 106 | return 16 107 | elseif a:n == 25 108 | return 231 109 | else 110 | return 231 + a:n 111 | endif 112 | endif 113 | endfun 114 | 115 | " Returns an approximate colour index for the given colour level 116 | fun rgb_number(x) 117 | if &t_Co == 88 118 | if a:x < 69 119 | return 0 120 | elseif a:x < 172 121 | return 1 122 | elseif a:x < 230 123 | return 2 124 | else 125 | return 3 126 | endif 127 | else 128 | if a:x < 75 129 | return 0 130 | else 131 | let l:n = (a:x - 55) / 40 132 | let l:m = (a:x - 55) % 40 133 | if l:m < 20 134 | return l:n 135 | else 136 | return l:n + 1 137 | endif 138 | endif 139 | endif 140 | endfun 141 | 142 | " Returns the actual colour level for the given colour index 143 | fun rgb_level(n) 144 | if &t_Co == 88 145 | if a:n == 0 146 | return 0 147 | elseif a:n == 1 148 | return 139 149 | elseif a:n == 2 150 | return 205 151 | else 152 | return 255 153 | endif 154 | else 155 | if a:n == 0 156 | return 0 157 | else 158 | return 55 + (a:n * 40) 159 | endif 160 | endif 161 | endfun 162 | 163 | " Returns the palette index for the given R/G/B colour indices 164 | fun rgb_colour(x, y, z) 165 | if &t_Co == 88 166 | return 16 + (a:x * 16) + (a:y * 4) + a:z 167 | else 168 | return 16 + (a:x * 36) + (a:y * 6) + a:z 169 | endif 170 | endfun 171 | 172 | " Returns the palette index to approximate the given R/G/B colour levels 173 | fun colour(r, g, b) 174 | " Get the closest grey 175 | let l:gx = grey_number(a:r) 176 | let l:gy = grey_number(a:g) 177 | let l:gz = grey_number(a:b) 178 | 179 | " Get the closest colour 180 | let l:x = rgb_number(a:r) 181 | let l:y = rgb_number(a:g) 182 | let l:z = rgb_number(a:b) 183 | 184 | if l:gx == l:gy && l:gy == l:gz 185 | " There are two possibilities 186 | let l:dgr = grey_level(l:gx) - a:r 187 | let l:dgg = grey_level(l:gy) - a:g 188 | let l:dgb = grey_level(l:gz) - a:b 189 | let l:dgrey = (l:dgr * l:dgr) + (l:dgg * l:dgg) + (l:dgb * l:dgb) 190 | let l:dr = rgb_level(l:gx) - a:r 191 | let l:dg = rgb_level(l:gy) - a:g 192 | let l:db = rgb_level(l:gz) - a:b 193 | let l:drgb = (l:dr * l:dr) + (l:dg * l:dg) + (l:db * l:db) 194 | if l:dgrey < l:drgb 195 | " Use the grey 196 | return grey_colour(l:gx) 197 | else 198 | " Use the colour 199 | return rgb_colour(l:x, l:y, l:z) 200 | endif 201 | else 202 | " Only one possibility 203 | return rgb_colour(l:x, l:y, l:z) 204 | endif 205 | endfun 206 | 207 | " Returns the palette index to approximate the 'rrggbb' hex string 208 | fun rgb(rgb) 209 | let l:r = ("0x" . strpart(a:rgb, 0, 2)) + 0 210 | let l:g = ("0x" . strpart(a:rgb, 2, 2)) + 0 211 | let l:b = ("0x" . strpart(a:rgb, 4, 2)) + 0 212 | 213 | return colour(l:r, l:g, l:b) 214 | endfun 215 | 216 | " Sets the highlighting for the given group 217 | fun X(group, fg, bg, attr) 218 | if a:fg != "" 219 | exec "hi " . a:group . " guifg=#" . a:fg . " ctermfg=" . rgb(a:fg) 220 | endif 221 | if a:bg != "" 222 | exec "hi " . a:group . " guibg=#" . a:bg . " ctermbg=" . rgb(a:bg) 223 | endif 224 | if a:attr != "" 225 | exec "hi " . a:group . " gui=" . a:attr . " cterm=" . a:attr 226 | endif 227 | endfun 228 | 229 | " Vim Highlighting 230 | call X("Normal", s:foreground, s:background, "") 231 | call X("LineNr", s:selection, "", "") 232 | call X("NonText", s:selection, "", "") 233 | call X("SpecialKey", s:selection, "", "") 234 | call X("Search", s:background, s:yellow, "") 235 | call X("TabLine", s:window, s:foreground, "reverse") 236 | call X("TabLineFill", s:window, s:foreground, "reverse") 237 | call X("StatusLine", s:window, s:yellow, "reverse") 238 | call X("StatusLineNC", s:window, s:foreground, "reverse") 239 | call X("VertSplit", s:window, s:window, "none") 240 | call X("Visual", "", s:selection, "") 241 | call X("Directory", s:blue, "", "") 242 | call X("ModeMsg", s:green, "", "") 243 | call X("MoreMsg", s:green, "", "") 244 | call X("Question", s:green, "", "") 245 | call X("WarningMsg", s:red, "", "") 246 | call X("MatchParen", "", s:selection, "") 247 | call X("Folded", s:comment, s:background, "") 248 | call X("FoldColumn", "", s:background, "") 249 | if version >= 700 250 | call X("CursorLine", "", s:line, "none") 251 | call X("CursorColumn", "", s:line, "none") 252 | call X("PMenu", s:foreground, s:selection, "none") 253 | call X("PMenuSel", s:foreground, s:selection, "reverse") 254 | call X("SignColumn", "", s:background, "none") 255 | end 256 | if version >= 703 257 | call X("ColorColumn", "", s:line, "none") 258 | end 259 | 260 | " Standard Highlighting 261 | call X("Comment", s:comment, "", "") 262 | call X("Todo", s:comment, s:background, "") 263 | call X("Title", s:comment, "", "") 264 | call X("Identifier", s:red, "", "none") 265 | call X("Statement", s:foreground, "", "") 266 | call X("Conditional", s:foreground, "", "") 267 | call X("Repeat", s:foreground, "", "") 268 | call X("Structure", s:purple, "", "") 269 | call X("Function", s:blue, "", "") 270 | call X("Constant", s:orange, "", "") 271 | call X("Keyword", s:orange, "", "") 272 | call X("String", s:green, "", "") 273 | call X("Special", s:foreground, "", "") 274 | call X("PreProc", s:purple, "", "") 275 | call X("Operator", s:aqua, "", "none") 276 | call X("Type", s:blue, "", "none") 277 | call X("Define", s:purple, "", "none") 278 | call X("Include", s:blue, "", "") 279 | "call X("Ignore", "666666", "", "") 280 | 281 | " Vim Highlighting 282 | call X("vimCommand", s:red, "", "none") 283 | 284 | " C Highlighting 285 | call X("cType", s:yellow, "", "") 286 | call X("cStorageClass", s:purple, "", "") 287 | call X("cConditional", s:purple, "", "") 288 | call X("cRepeat", s:purple, "", "") 289 | 290 | " PHP Highlighting 291 | call X("phpVarSelector", s:red, "", "") 292 | call X("phpKeyword", s:purple, "", "") 293 | call X("phpRepeat", s:purple, "", "") 294 | call X("phpConditional", s:purple, "", "") 295 | call X("phpStatement", s:purple, "", "") 296 | call X("phpMemberSelector", s:foreground, "", "") 297 | 298 | " Ruby Highlighting 299 | call X("rubySymbol", s:green, "", "") 300 | call X("rubyConstant", s:yellow, "", "") 301 | call X("rubyAccess", s:yellow, "", "") 302 | call X("rubyAttribute", s:blue, "", "") 303 | call X("rubyInclude", s:blue, "", "") 304 | call X("rubyLocalVariableOrMethod", s:orange, "", "") 305 | call X("rubyCurlyBlock", s:orange, "", "") 306 | call X("rubyStringDelimiter", s:green, "", "") 307 | call X("rubyInterpolationDelimiter", s:orange, "", "") 308 | call X("rubyConditional", s:purple, "", "") 309 | call X("rubyRepeat", s:purple, "", "") 310 | call X("rubyControl", s:purple, "", "") 311 | call X("rubyException", s:purple, "", "") 312 | 313 | " Crystal Highlighting 314 | call X("crystalSymbol", s:green, "", "") 315 | call X("crystalConstant", s:yellow, "", "") 316 | call X("crystalAccess", s:yellow, "", "") 317 | call X("crystalAttribute", s:blue, "", "") 318 | call X("crystalInclude", s:blue, "", "") 319 | call X("crystalLocalVariableOrMethod", s:orange, "", "") 320 | call X("crystalCurlyBlock", s:orange, "", "") 321 | call X("crystalStringDelimiter", s:green, "", "") 322 | call X("crystalInterpolationDelimiter", s:orange, "", "") 323 | call X("crystalConditional", s:purple, "", "") 324 | call X("crystalRepeat", s:purple, "", "") 325 | call X("crystalControl", s:purple, "", "") 326 | call X("crystalException", s:purple, "", "") 327 | 328 | " Python Highlighting 329 | call X("pythonInclude", s:purple, "", "") 330 | call X("pythonStatement", s:purple, "", "") 331 | call X("pythonConditional", s:purple, "", "") 332 | call X("pythonRepeat", s:purple, "", "") 333 | call X("pythonException", s:purple, "", "") 334 | call X("pythonFunction", s:blue, "", "") 335 | call X("pythonPreCondit", s:purple, "", "") 336 | call X("pythonRepeat", s:aqua, "", "") 337 | call X("pythonExClass", s:orange, "", "") 338 | 339 | " JavaScript Highlighting 340 | call X("javaScriptBraces", s:foreground, "", "") 341 | call X("javaScriptFunction", s:purple, "", "") 342 | call X("javaScriptConditional", s:purple, "", "") 343 | call X("javaScriptRepeat", s:purple, "", "") 344 | call X("javaScriptNumber", s:orange, "", "") 345 | call X("javaScriptMember", s:orange, "", "") 346 | call X("javascriptNull", s:orange, "", "") 347 | call X("javascriptGlobal", s:blue, "", "") 348 | call X("javascriptStatement", s:red, "", "") 349 | 350 | " CoffeeScript Highlighting 351 | call X("coffeeRepeat", s:purple, "", "") 352 | call X("coffeeConditional", s:purple, "", "") 353 | call X("coffeeKeyword", s:purple, "", "") 354 | call X("coffeeObject", s:yellow, "", "") 355 | 356 | " HTML Highlighting 357 | call X("htmlTag", s:red, "", "") 358 | call X("htmlTagName", s:red, "", "") 359 | call X("htmlArg", s:red, "", "") 360 | call X("htmlScriptTag", s:red, "", "") 361 | 362 | " Diff Highlighting 363 | call X("diffAdd", "", "4c4e39", "") 364 | call X("diffDelete", s:background, s:red, "") 365 | call X("diffChange", "", "2B5B77", "") 366 | call X("diffText", s:line, s:blue, "") 367 | 368 | " ShowMarks Highlighting 369 | call X("ShowMarksHLl", s:orange, s:background, "none") 370 | call X("ShowMarksHLo", s:purple, s:background, "none") 371 | call X("ShowMarksHLu", s:yellow, s:background, "none") 372 | call X("ShowMarksHLm", s:aqua, s:background, "none") 373 | 374 | " Lua Highlighting 375 | call X("luaStatement", s:purple, "", "") 376 | call X("luaRepeat", s:purple, "", "") 377 | call X("luaCondStart", s:purple, "", "") 378 | call X("luaCondElseif", s:purple, "", "") 379 | call X("luaCond", s:purple, "", "") 380 | call X("luaCondEnd", s:purple, "", "") 381 | 382 | " Cucumber Highlighting 383 | call X("cucumberGiven", s:blue, "", "") 384 | call X("cucumberGivenAnd", s:blue, "", "") 385 | 386 | " Go Highlighting 387 | call X("goDirective", s:purple, "", "") 388 | call X("goDeclaration", s:purple, "", "") 389 | call X("goStatement", s:purple, "", "") 390 | call X("goConditional", s:purple, "", "") 391 | call X("goConstants", s:orange, "", "") 392 | call X("goTodo", s:yellow, "", "") 393 | call X("goDeclType", s:blue, "", "") 394 | call X("goBuiltins", s:purple, "", "") 395 | call X("goRepeat", s:purple, "", "") 396 | call X("goLabel", s:purple, "", "") 397 | 398 | " Clojure Highlighting 399 | call X("clojureConstant", s:orange, "", "") 400 | call X("clojureBoolean", s:orange, "", "") 401 | call X("clojureCharacter", s:orange, "", "") 402 | call X("clojureKeyword", s:green, "", "") 403 | call X("clojureNumber", s:orange, "", "") 404 | call X("clojureString", s:green, "", "") 405 | call X("clojureRegexp", s:green, "", "") 406 | call X("clojureParen", s:aqua, "", "") 407 | call X("clojureVariable", s:yellow, "", "") 408 | call X("clojureCond", s:blue, "", "") 409 | call X("clojureDefine", s:purple, "", "") 410 | call X("clojureException", s:red, "", "") 411 | call X("clojureFunc", s:blue, "", "") 412 | call X("clojureMacro", s:blue, "", "") 413 | call X("clojureRepeat", s:blue, "", "") 414 | call X("clojureSpecial", s:purple, "", "") 415 | call X("clojureQuote", s:blue, "", "") 416 | call X("clojureUnquote", s:blue, "", "") 417 | call X("clojureMeta", s:blue, "", "") 418 | call X("clojureDeref", s:blue, "", "") 419 | call X("clojureAnonArg", s:blue, "", "") 420 | call X("clojureRepeat", s:blue, "", "") 421 | call X("clojureDispatch", s:blue, "", "") 422 | 423 | " Scala Highlighting 424 | call X("scalaKeyword", s:purple, "", "") 425 | call X("scalaKeywordModifier", s:purple, "", "") 426 | call X("scalaOperator", s:blue, "", "") 427 | call X("scalaPackage", s:red, "", "") 428 | call X("scalaFqn", s:foreground, "", "") 429 | call X("scalaFqnSet", s:foreground, "", "") 430 | call X("scalaImport", s:purple, "", "") 431 | call X("scalaBoolean", s:orange, "", "") 432 | call X("scalaDef", s:purple, "", "") 433 | call X("scalaVal", s:purple, "", "") 434 | call X("scalaVar", s:aqua, "", "") 435 | call X("scalaClass", s:purple, "", "") 436 | call X("scalaObject", s:purple, "", "") 437 | call X("scalaTrait", s:purple, "", "") 438 | call X("scalaDefName", s:blue, "", "") 439 | call X("scalaValName", s:foreground, "", "") 440 | call X("scalaVarName", s:foreground, "", "") 441 | call X("scalaClassName", s:foreground, "", "") 442 | call X("scalaType", s:yellow, "", "") 443 | call X("scalaTypeSpecializer", s:yellow, "", "") 444 | call X("scalaAnnotation", s:orange, "", "") 445 | call X("scalaNumber", s:orange, "", "") 446 | call X("scalaDefSpecializer", s:yellow, "", "") 447 | call X("scalaClassSpecializer", s:yellow, "", "") 448 | call X("scalaBackTick", s:green, "", "") 449 | call X("scalaRoot", s:foreground, "", "") 450 | call X("scalaMethodCall", s:blue, "", "") 451 | call X("scalaCaseType", s:yellow, "", "") 452 | call X("scalaLineComment", s:comment, "", "") 453 | call X("scalaComment", s:comment, "", "") 454 | call X("scalaDocComment", s:comment, "", "") 455 | call X("scalaDocTags", s:comment, "", "") 456 | call X("scalaEmptyString", s:green, "", "") 457 | call X("scalaMultiLineString", s:green, "", "") 458 | call X("scalaUnicode", s:orange, "", "") 459 | call X("scalaString", s:green, "", "") 460 | call X("scalaStringEscape", s:green, "", "") 461 | call X("scalaSymbol", s:orange, "", "") 462 | call X("scalaChar", s:orange, "", "") 463 | call X("scalaXml", s:green, "", "") 464 | call X("scalaConstructorSpecializer", s:yellow, "", "") 465 | call X("scalaBackTick", s:blue, "", "") 466 | 467 | " Git 468 | call X("diffAdded", s:green, "", "") 469 | call X("diffRemoved", s:red, "", "") 470 | call X("gitcommitSummary", "", "", "bold") 471 | 472 | " Delete Functions 473 | delf X 474 | delf rgb 475 | delf colour 476 | delf rgb_colour 477 | delf rgb_level 478 | delf rgb_number 479 | delf grey_colour 480 | delf grey_level 481 | delf grey_number 482 | endif 483 | 484 | set background=dark -------------------------------------------------------------------------------- /iterm_themes/com.googlecode.iterm2.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | AdjustWindowForFontSizeChange 6 | 7 | AllowClipboardAccess 8 | 9 | AnimateDimming 10 | 11 | AppleAntiAliasingThreshold 12 | 1 13 | AppleScrollAnimationEnabled 14 | 0 15 | AppleSmoothFixedFontsSizeThreshold 16 | 1 17 | AppleWindowTabbingMode 18 | manual 19 | AutoHideTmuxClientSession 20 | 21 | CheckTestRelease 22 | 23 | ClosingHotkeySwitchesSpaces 24 | 25 | CommandSelection 26 | 27 | Control 28 | 1 29 | ConvertDosNewlines 30 | 31 | CopyLastNewline 32 | 33 | CopySelection 34 | 35 | Custom Color Presets 36 | 37 | Dracula 38 | 39 | Ansi 0 Color 40 | 41 | Blue Component 42 | 0.0 43 | Green Component 44 | 0.0 45 | Red Component 46 | 0.0 47 | 48 | Ansi 1 Color 49 | 50 | Blue Component 51 | 0.3333333432674408 52 | Green Component 53 | 0.3333333432674408 54 | Red Component 55 | 1 56 | 57 | Ansi 10 Color 58 | 59 | Blue Component 60 | 0.4823529411764706 61 | Green Component 62 | 0.98039215686274506 63 | Red Component 64 | 0.31372549019607843 65 | 66 | Ansi 11 Color 67 | 68 | Blue Component 69 | 0.5490196078431373 70 | Green Component 71 | 0.98039215686274506 72 | Red Component 73 | 0.94509803921568625 74 | 75 | Ansi 12 Color 76 | 77 | Blue Component 78 | 0.97647058823529409 79 | Green Component 80 | 0.57647058823529407 81 | Red Component 82 | 0.74117647058823533 83 | 84 | Ansi 13 Color 85 | 86 | Blue Component 87 | 0.77647058823529413 88 | Green Component 89 | 0.47450980392156861 90 | Red Component 91 | 1 92 | 93 | Ansi 14 Color 94 | 95 | Blue Component 96 | 0.99215686274509807 97 | Green Component 98 | 0.9137254901960784 99 | Red Component 100 | 0.54509803921568623 101 | 102 | Ansi 15 Color 103 | 104 | Blue Component 105 | 1 106 | Green Component 107 | 1 108 | Red Component 109 | 1 110 | 111 | Ansi 2 Color 112 | 113 | Blue Component 114 | 0.4823529411764706 115 | Green Component 116 | 0.98039215686274506 117 | Red Component 118 | 0.31372549019607843 119 | 120 | Ansi 3 Color 121 | 122 | Blue Component 123 | 0.5490196078431373 124 | Green Component 125 | 0.98039215686274506 126 | Red Component 127 | 0.94509803921568625 128 | 129 | Ansi 4 Color 130 | 131 | Blue Component 132 | 0.97647058823529409 133 | Green Component 134 | 0.57647058823529407 135 | Red Component 136 | 0.74117647058823533 137 | 138 | Ansi 5 Color 139 | 140 | Blue Component 141 | 0.77647058823529413 142 | Green Component 143 | 0.47450980392156861 144 | Red Component 145 | 1 146 | 147 | Ansi 6 Color 148 | 149 | Blue Component 150 | 0.99215686274509807 151 | Green Component 152 | 0.9137254901960784 153 | Red Component 154 | 0.54509803921568623 155 | 156 | Ansi 7 Color 157 | 158 | Blue Component 159 | 0.73333334922790527 160 | Green Component 161 | 0.73333334922790527 162 | Red Component 163 | 0.73333334922790527 164 | 165 | Ansi 8 Color 166 | 167 | Blue Component 168 | 0.33333333333333331 169 | Green Component 170 | 0.33333333333333331 171 | Red Component 172 | 0.33333333333333331 173 | 174 | Ansi 9 Color 175 | 176 | Blue Component 177 | 0.33333333333333331 178 | Green Component 179 | 0.33333333333333331 180 | Red Component 181 | 1 182 | 183 | Background Color 184 | 185 | Blue Component 186 | 0.15977837145328522 187 | Green Component 188 | 0.12215272337198257 189 | Red Component 190 | 0.11765811592340469 191 | 192 | Bold Color 193 | 194 | Blue Component 195 | 1 196 | Green Component 197 | 1 198 | Red Component 199 | 1 200 | 201 | Cursor Color 202 | 203 | Blue Component 204 | 0.73333334922790527 205 | Green Component 206 | 0.73333334922790527 207 | Red Component 208 | 0.73333334922790527 209 | 210 | Cursor Text Color 211 | 212 | Blue Component 213 | 1 214 | Green Component 215 | 1 216 | Red Component 217 | 1 218 | 219 | Foreground Color 220 | 221 | Blue Component 222 | 0.94901961088180542 223 | Green Component 224 | 0.97254902124404907 225 | Red Component 226 | 0.97254902124404907 227 | 228 | Selected Text Color 229 | 230 | Blue Component 231 | 1 232 | Green Component 233 | 1 234 | Red Component 235 | 1 236 | 237 | Selection Color 238 | 239 | Blue Component 240 | 0.35294118523597717 241 | Green Component 242 | 0.27843138575553894 243 | Red Component 244 | 0.26666668057441711 245 | 246 | 247 | 248 | Default Bookmark Guid 249 | E0839E72-BB7E-4C1A-A72F-E8EFA6738FAD 250 | DimBackgroundWindows 251 | 252 | DimInactiveSplitPanes 253 | 254 | DimOnlyText 255 | 256 | DisableFullscreenTransparency 257 | 258 | EnableRendezvous 259 | 260 | EscapeShellCharsWithBackslash 261 | 262 | FocusFollowsMouse 263 | 264 | FsTabDelay 265 | 1 266 | HiddenAFRStrokeThickness 267 | 0.0 268 | HiddenAdvancedFontRendering 269 | 270 | HideActivityIndicator 271 | 272 | HideMenuBarInFullscreen 273 | 274 | HideScrollbar 275 | 276 | HideTab 277 | 278 | HighlightTabLabels 279 | 280 | HotKeyBookmark 281 | E0839E72-BB7E-4C1A-A72F-E8EFA6738FAD 282 | HotKeyTogglesWindow 283 | 284 | Hotkey 285 | 286 | HotkeyChar 287 | 0 288 | HotkeyCode 289 | 0 290 | HotkeyMigratedFromSingleToMulti 291 | 292 | HotkeyModifiers 293 | 0 294 | IRMemory 295 | 4 296 | JobName 297 | 298 | LeftCommand 299 | 7 300 | LeftOption 301 | 2 302 | LoadPrefsFromCustomFolder 303 | 304 | MaxVertically 305 | 306 | NSNavLastRootDirectory 307 | ~/Desktop/iterm 308 | NSNavPanelExpandedSizeForOpenMode 309 | {712, 459} 310 | NSNavPanelExpandedSizeForSaveMode 311 | {712, 521} 312 | NSNavPanelExpandedStateForSaveMode 313 | 314 | NSQuotedKeystrokeBinding 315 | 316 | NSRepeatCountBinding 317 | 318 | NSScrollAnimationEnabled 319 | 320 | NSScrollViewShouldScrollUnderTitlebar 321 | 322 | NSTableView Columns v2 KeyBingingTable 323 | 324 | YnBsaXN0MDDUAQIDBAUGNjdYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS 325 | AAGGoK4HCA8aGxwdHh8gJjAxMlUkbnVsbNIJCgsOWk5TLm9iamVjdHNWJGNsYXNzogwN 326 | gAKACoAN0xAJChEVGVdOUy5rZXlzoxITFIADgASABaMWFxiABoAHgAiACVpJZGVudGlm 327 | aWVyVVdpZHRoVkhpZGRlblEwI0BowAAAAAAACNIhIiMkWiRjbGFzc25hbWVYJGNsYXNz 328 | ZXNcTlNEaWN0aW9uYXJ5oiMlWE5TT2JqZWN00xAJCicrGaMSExSAA4AEgAWjLC0YgAuA 329 | DIAIgAlRMSNAdKAAAAAAANIhIjM0Xk5TTXV0YWJsZUFycmF5ozM1JVdOU0FycmF5XxAP 330 | TlNLZXllZEFyY2hpdmVy0Tg5VUFycmF5gAEACAARABoAIwAtADIANwBGAEwAUQBcAGMA 331 | ZgBoAGoAbABzAHsAfwCBAIMAhQCJAIsAjQCPAJEAnACiAKkAqwC0ALUAugDFAM4A2wDe 332 | AOcA7gDyAPQA9gD4APwA/gEAAQIBBAEGAQ8BFAEjAScBLwFBAUQBSgAAAAAAAAIBAAAA 333 | AAAAADoAAAAAAAAAAAAAAAAAAAFM 334 | 335 | NSTableView Sort Ordering v2 KeyBingingTable 336 | 337 | YnBsaXN0MDDUAQIDBAUGFBVYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS 338 | AAGGoKMHCA1VJG51bGzSCQoLDFpOUy5vYmplY3RzViRjbGFzc6CAAtIODxARWiRjbGFz 339 | c25hbWVYJGNsYXNzZXNeTlNNdXRhYmxlQXJyYXmjEBITV05TQXJyYXlYTlNPYmplY3Rf 340 | EA9OU0tleWVkQXJjaGl2ZXLRFhdVQXJyYXmAAQgRGiMtMjc7QUZRWFlbYGt0g4ePmKqt 341 | swAAAAAAAAEBAAAAAAAAABgAAAAAAAAAAAAAAAAAAAC1 342 | 343 | NSTableView Supports v2 KeyBingingTable 344 | 345 | NSToolbar Configuration com.apple.NSColorPanel 346 | 347 | TB Is Shown 348 | 1 349 | 350 | NSWindow Frame NSFontPanel 351 | 569 62 772 408 0 0 1440 877 352 | NSWindow Frame Preferences 353 | 850 944 606 456 0 0 2560 1417 354 | NSWindow Frame SUStatusFrame 355 | 1080 968 400 129 0 0 2560 1417 356 | NSWindow Frame SUUpdateAlert 357 | 970 769 620 392 0 0 2560 1417 358 | NSWindow Frame SharedPreferences 359 | 1445 465 796 473 0 0 2560 1417 360 | NSWindow Frame iTerm Window 0 361 | 0 0 1360 1417 0 0 2560 1417 362 | NSWindow Frame iTerm Window 1 363 | 183 68 570 451 0 0 1440 877 364 | New Bookmarks 365 | 366 | 367 | ASCII Anti Aliased 368 | 369 | Allow Title Reporting 370 | 371 | Ambiguous Double Width 372 | 373 | Ansi 0 Color 374 | 375 | Alpha Component 376 | 1 377 | Blue Component 378 | 0.13225468993186951 379 | Color Space 380 | Calibrated 381 | Green Component 382 | 0.11743681877851486 383 | Red Component 384 | 0.098235249519348145 385 | 386 | Ansi 1 Color 387 | 388 | Alpha Component 389 | 1 390 | Blue Component 391 | 0.68654429912567139 392 | Color Space 393 | Calibrated 394 | Green Component 395 | 0.42116943001747131 396 | Red Component 397 | 0.55604356527328491 398 | 399 | Ansi 10 Color 400 | 401 | Blue Component 402 | 0.4823529411764706 403 | Green Component 404 | 0.98039215686274506 405 | Red Component 406 | 0.31372549019607843 407 | 408 | Ansi 11 Color 409 | 410 | Blue Component 411 | 0.5490196078431373 412 | Green Component 413 | 0.98039215686274506 414 | Red Component 415 | 0.94509803921568625 416 | 417 | Ansi 12 Color 418 | 419 | Blue Component 420 | 0.97647058823529409 421 | Green Component 422 | 0.57647058823529407 423 | Red Component 424 | 0.74117647058823533 425 | 426 | Ansi 13 Color 427 | 428 | Blue Component 429 | 0.77647058823529413 430 | Green Component 431 | 0.47450980392156861 432 | Red Component 433 | 1 434 | 435 | Ansi 14 Color 436 | 437 | Blue Component 438 | 0.99215686274509807 439 | Green Component 440 | 0.9137254901960784 441 | Red Component 442 | 0.54509803921568623 443 | 444 | Ansi 15 Color 445 | 446 | Blue Component 447 | 1 448 | Green Component 449 | 1 450 | Red Component 451 | 1 452 | 453 | Ansi 2 Color 454 | 455 | Alpha Component 456 | 1 457 | Blue Component 458 | 0.51263946294784546 459 | Color Space 460 | Calibrated 461 | Green Component 462 | 0.67132043838500977 463 | Red Component 464 | 0.19664245843887329 465 | 466 | Ansi 3 Color 467 | 468 | Alpha Component 469 | 1 470 | Blue Component 471 | 0.66091841459274292 472 | Color Space 473 | Calibrated 474 | Green Component 475 | 0.86446142196655273 476 | Red Component 477 | 0.88733154535293579 478 | 479 | Ansi 4 Color 480 | 481 | Alpha Component 482 | 1 483 | Blue Component 484 | 0.7320408821105957 485 | Color Space 486 | Calibrated 487 | Green Component 488 | 0.65185022354125977 489 | Red Component 490 | 0.4526006281375885 491 | 492 | Ansi 5 Color 493 | 494 | Alpha Component 495 | 1 496 | Blue Component 497 | 0.56849712133407593 498 | Color Space 499 | Calibrated 500 | Green Component 501 | 0.42560216784477234 502 | Red Component 503 | 0.87387526035308838 504 | 505 | Ansi 6 Color 506 | 507 | Alpha Component 508 | 1 509 | Blue Component 510 | 0.6909257173538208 511 | Color Space 512 | Calibrated 513 | Green Component 514 | 0.53994590044021606 515 | Red Component 516 | 0.35756626725196838 517 | 518 | Ansi 7 Color 519 | 520 | Alpha Component 521 | 1 522 | Blue Component 523 | 0.98027229309082031 524 | Color Space 525 | Calibrated 526 | Green Component 527 | 1 528 | Red Component 529 | 0.99521839618682861 530 | 531 | Ansi 8 Color 532 | 533 | Blue Component 534 | 0.33333333333333331 535 | Green Component 536 | 0.33333333333333331 537 | Red Component 538 | 0.33333333333333331 539 | 540 | Ansi 9 Color 541 | 542 | Blue Component 543 | 0.33333333333333331 544 | Green Component 545 | 0.33333333333333331 546 | Red Component 547 | 1 548 | 549 | Automatically Log 550 | 551 | BM Growl 552 | 553 | Background Color 554 | 555 | Blue Component 556 | 0.15977837145328522 557 | Green Component 558 | 0.12215272337198257 559 | Red Component 560 | 0.11765811592340469 561 | 562 | Background Image Is Tiled 563 | 564 | Background Image Location 565 | 566 | Badge Color 567 | 568 | Alpha Component 569 | 0.5 570 | Blue Component 571 | 0.0 572 | Color Space 573 | Calibrated 574 | Green Component 575 | 0.0 576 | Red Component 577 | 1 578 | 579 | Blend 580 | 0.30000001192092896 581 | Blink Allowed 582 | 583 | Blinking Cursor 584 | 585 | Blur 586 | 587 | Blur Radius 588 | 2.2596755027770996 589 | Bold Color 590 | 591 | Blue Component 592 | 1 593 | Green Component 594 | 1 595 | Red Component 596 | 1 597 | 598 | Character Encoding 599 | 4 600 | Close Sessions On End 601 | 602 | Columns 603 | 150 604 | Command 605 | 606 | Cursor Color 607 | 608 | Blue Component 609 | 0.73333334922790527 610 | Green Component 611 | 0.73333334922790527 612 | Red Component 613 | 0.73333334922790527 614 | 615 | Cursor Guide Color 616 | 617 | Alpha Component 618 | 0.25 619 | Blue Component 620 | 1 621 | Color Space 622 | Calibrated 623 | Green Component 624 | 0.91000000000000003 625 | Red Component 626 | 0.65000000000000002 627 | 628 | Cursor Text Color 629 | 630 | Blue Component 631 | 1 632 | Green Component 633 | 1 634 | Red Component 635 | 1 636 | 637 | Cursor Type 638 | 2 639 | Custom Command 640 | No 641 | Custom Directory 642 | No 643 | Default Bookmark 644 | No 645 | Disable Printing 646 | 647 | Disable Smcup Rmcup 648 | 649 | Disable Window Resizing 650 | 651 | Flashing Bell 652 | 653 | Foreground Color 654 | 655 | Blue Component 656 | 0.94901961088180542 657 | Green Component 658 | 0.97254902124404907 659 | Red Component 660 | 0.97254902124404907 661 | 662 | Guid 663 | E0839E72-BB7E-4C1A-A72F-E8EFA6738FAD 664 | Hide After Opening 665 | 666 | Horizontal Spacing 667 | 1 668 | Idle Code 669 | 0 670 | Initial Text 671 | 672 | Jobs to Ignore 673 | 674 | rlogin 675 | ssh 676 | slogin 677 | telnet 678 | 679 | Keyboard Map 680 | 681 | 0x2d-0x40000 682 | 683 | Action 684 | 11 685 | Text 686 | 0x1f 687 | 688 | 0x32-0x40000 689 | 690 | Action 691 | 11 692 | Text 693 | 0x00 694 | 695 | 0x33-0x40000 696 | 697 | Action 698 | 11 699 | Text 700 | 0x1b 701 | 702 | 0x34-0x40000 703 | 704 | Action 705 | 11 706 | Text 707 | 0x1c 708 | 709 | 0x35-0x40000 710 | 711 | Action 712 | 11 713 | Text 714 | 0x1d 715 | 716 | 0x36-0x40000 717 | 718 | Action 719 | 11 720 | Text 721 | 0x1e 722 | 723 | 0x37-0x40000 724 | 725 | Action 726 | 11 727 | Text 728 | 0x1f 729 | 730 | 0x38-0x40000 731 | 732 | Action 733 | 11 734 | Text 735 | 0x7f 736 | 737 | 0xf700-0x220000 738 | 739 | Action 740 | 10 741 | Text 742 | [1;2A 743 | 744 | 0xf700-0x240000 745 | 746 | Action 747 | 10 748 | Text 749 | [1;5A 750 | 751 | 0xf700-0x260000 752 | 753 | Action 754 | 10 755 | Text 756 | [1;6A 757 | 758 | 0xf700-0x280000 759 | 760 | Action 761 | 11 762 | Text 763 | 0x1b 0x1b 0x5b 0x41 764 | 765 | 0xf701-0x220000 766 | 767 | Action 768 | 10 769 | Text 770 | [1;2B 771 | 772 | 0xf701-0x240000 773 | 774 | Action 775 | 10 776 | Text 777 | [1;5B 778 | 779 | 0xf701-0x260000 780 | 781 | Action 782 | 10 783 | Text 784 | [1;6B 785 | 786 | 0xf701-0x280000 787 | 788 | Action 789 | 11 790 | Text 791 | 0x1b 0x1b 0x5b 0x42 792 | 793 | 0xf702-0x220000 794 | 795 | Action 796 | 10 797 | Text 798 | [1;2D 799 | 800 | 0xf702-0x240000 801 | 802 | Action 803 | 10 804 | Text 805 | [1;5D 806 | 807 | 0xf702-0x260000 808 | 809 | Action 810 | 10 811 | Text 812 | [1;6D 813 | 814 | 0xf702-0x280000 815 | 816 | Action 817 | 11 818 | Text 819 | 0x1b 0x1b 0x5b 0x44 820 | 821 | 0xf703-0x220000 822 | 823 | Action 824 | 10 825 | Text 826 | [1;2C 827 | 828 | 0xf703-0x240000 829 | 830 | Action 831 | 10 832 | Text 833 | [1;5C 834 | 835 | 0xf703-0x260000 836 | 837 | Action 838 | 10 839 | Text 840 | [1;6C 841 | 842 | 0xf703-0x280000 843 | 844 | Action 845 | 11 846 | Text 847 | 0x1b 0x1b 0x5b 0x43 848 | 849 | 0xf704-0x20000 850 | 851 | Action 852 | 10 853 | Text 854 | [1;2P 855 | 856 | 0xf705-0x20000 857 | 858 | Action 859 | 10 860 | Text 861 | [1;2Q 862 | 863 | 0xf706-0x20000 864 | 865 | Action 866 | 10 867 | Text 868 | [1;2R 869 | 870 | 0xf707-0x20000 871 | 872 | Action 873 | 10 874 | Text 875 | [1;2S 876 | 877 | 0xf708-0x20000 878 | 879 | Action 880 | 10 881 | Text 882 | [15;2~ 883 | 884 | 0xf709-0x20000 885 | 886 | Action 887 | 10 888 | Text 889 | [17;2~ 890 | 891 | 0xf70a-0x20000 892 | 893 | Action 894 | 10 895 | Text 896 | [18;2~ 897 | 898 | 0xf70b-0x20000 899 | 900 | Action 901 | 10 902 | Text 903 | [19;2~ 904 | 905 | 0xf70c-0x20000 906 | 907 | Action 908 | 10 909 | Text 910 | [20;2~ 911 | 912 | 0xf70d-0x20000 913 | 914 | Action 915 | 10 916 | Text 917 | [21;2~ 918 | 919 | 0xf70e-0x20000 920 | 921 | Action 922 | 10 923 | Text 924 | [23;2~ 925 | 926 | 0xf70f-0x20000 927 | 928 | Action 929 | 10 930 | Text 931 | [24;2~ 932 | 933 | 0xf729-0x20000 934 | 935 | Action 936 | 10 937 | Text 938 | [1;2H 939 | 940 | 0xf729-0x40000 941 | 942 | Action 943 | 10 944 | Text 945 | [1;5H 946 | 947 | 0xf72b-0x20000 948 | 949 | Action 950 | 10 951 | Text 952 | [1;2F 953 | 954 | 0xf72b-0x40000 955 | 956 | Action 957 | 10 958 | Text 959 | [1;5F 960 | 961 | 962 | Link Color 963 | 964 | Alpha Component 965 | 1 966 | Blue Component 967 | 0.67800000000000005 968 | Color Space 969 | Calibrated 970 | Green Component 971 | 0.27000000000000002 972 | Red Component 973 | 0.023 974 | 975 | Log Directory 976 | 977 | Minimum Contrast 978 | 0.0 979 | Mouse Reporting 980 | 981 | Name 982 | Default 983 | Non Ascii Font 984 | Monaco 12 985 | Non-ASCII Anti Aliased 986 | 987 | Normal Font 988 | SFMono-Regular 14 989 | Option Key Sends 990 | 0 991 | Prompt Before Closing 2 992 | 0 993 | Right Option Key Sends 994 | 0 995 | Rows 996 | 25 997 | Screen 998 | -1 999 | Scrollback Lines 1000 | 1000 1001 | Scrollback With Status Bar 1002 | 1003 | Scrollback in Alternate Screen 1004 | 1005 | Selected Text Color 1006 | 1007 | Blue Component 1008 | 1 1009 | Green Component 1010 | 1 1011 | Red Component 1012 | 1 1013 | 1014 | Selection Color 1015 | 1016 | Blue Component 1017 | 0.35294118523597717 1018 | Green Component 1019 | 0.27843138575553894 1020 | Red Component 1021 | 0.26666668057441711 1022 | 1023 | Semantic History 1024 | 1025 | action 1026 | best editor 1027 | editor 1028 | com.sublimetext.3 1029 | text 1030 | 1031 | 1032 | Send Code When Idle 1033 | 1034 | Set Local Environment Vars 1035 | 1036 | Shortcut 1037 | 1038 | Silence Bell 1039 | 1040 | Smart Cursor Color 1041 | 1042 | Smart Selection Rules 1043 | 1044 | 1045 | notes 1046 | Word bounded by whitespace 1047 | precision 1048 | low 1049 | regex 1050 | \S+ 1051 | 1052 | 1053 | notes 1054 | C++ namespace::identifier 1055 | precision 1056 | normal 1057 | regex 1058 | ([a-zA-Z0-9_]+::)+[a-zA-Z0-9_]+ 1059 | 1060 | 1061 | notes 1062 | Paths 1063 | precision 1064 | normal 1065 | regex 1066 | \~?/?([[:letter:][:number:]._-]+/+)+[[:letter:][:number:]._-]+/? 1067 | 1068 | 1069 | notes 1070 | Quoted string 1071 | precision 1072 | normal 1073 | regex 1074 | @?"(?:[^"\\]|\\.)*" 1075 | 1076 | 1077 | notes 1078 | Java/Python include paths 1079 | precision 1080 | normal 1081 | regex 1082 | ([[:letter:][:number:]._]+\.)+[[:letter:][:number:]._]+ 1083 | 1084 | 1085 | notes 1086 | mailto URL 1087 | precision 1088 | normal 1089 | regex 1090 | \bmailto:([a-z0-9A-Z_]+@)?([a-zA-Z0-9\-]+\.)*[a-zA-Z0-9\-]+\b 1091 | 1092 | 1093 | notes 1094 | Obj-C selector 1095 | precision 1096 | high 1097 | regex 1098 | @selector\([^)]+\) 1099 | 1100 | 1101 | notes 1102 | email address 1103 | precision 1104 | high 1105 | regex 1106 | \b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}\b 1107 | 1108 | 1109 | notes 1110 | HTTP URL 1111 | precision 1112 | very_high 1113 | regex 1114 | https?://([a-z0-9A-Z]+(:[a-zA-Z0-9]+)?@)?[a-z0-9A-Z]+(\.[a-z0-9A-Z]+)*((:[0-9]+)?)(/[a-zA-Z0-9;/\.\-_+%~?&@=#\(\)]*)? 1115 | 1116 | 1117 | notes 1118 | SSH URL 1119 | precision 1120 | very_high 1121 | regex 1122 | \bssh:([a-z0-9A-Z_]+@)?([a-zA-Z0-9\-]+\.)*[a-zA-Z0-9\-]+\b 1123 | 1124 | 1125 | notes 1126 | Telnet URL 1127 | precision 1128 | very_high 1129 | regex 1130 | \btelnet:([a-z0-9A-Z_]+@)?([a-zA-Z0-9\-]+\.)*[a-zA-Z0-9\-]+\b 1131 | 1132 | 1133 | Space 1134 | 0 1135 | Sync Title 1136 | 1137 | Tags 1138 | 1139 | Terminal Type 1140 | xterm-256color 1141 | Thin Strokes 1142 | 4 1143 | Transparency 1144 | 0.1489044057723333 1145 | Triggers 1146 | 1147 | Unicode Normalization 1148 | 0 1149 | Unicode Version 1150 | 9 1151 | Unlimited Scrollback 1152 | 1153 | Use Bold Font 1154 | 1155 | Use Bright Bold 1156 | 1157 | Use Canonical Parser 1158 | 1159 | Use Italic Font 1160 | 1161 | Use Non-ASCII Font 1162 | 1163 | Vertical Spacing 1164 | 1 1165 | Visual Bell 1166 | 1167 | Window Type 1168 | 6 1169 | Working Directory 1170 | /Users/amanda 1171 | 1172 | 1173 | NoSyncConfirmBeta 1174 | 1175 | NoSyncHaveWarnedAboutPasteConfirmationChange 1176 | 1177 | NoSyncInstallationId 1178 | 31D8CD27-A7D1-4657-B83B-8AE6DBD6648B 1179 | NoSyncPermissionToShowTip 1180 | 1181 | NoSyncTimeOfFirstLaunchOfVersionWithTip 1182 | 486528987.5801 1183 | NoSyncTimeOfLastPromo 1184 | 478806744.73044097 1185 | NoSyncTimeOfLastPromoDownload 1186 | 486407153.39998901 1187 | OnlyWhenMoreTabs 1188 | 1189 | OpenArrangementAtStartup 1190 | 1191 | OpenBookmark 1192 | 1193 | OpenTmuxWindowsIn 1194 | 0 1195 | PassOnControlClick 1196 | 1197 | PasteFromClipboard 1198 | 1199 | PasteSpecialChunkDelay 1200 | 0.01 1201 | PasteSpecialChunkSize 1202 | 1024 1203 | PasteSpecialRegex 1204 | 1205 | PasteSpecialSubstitution 1206 | 1207 | PasteSpecialUseRegexSubstitution 1208 | 1209 | PasteTabToStringTabStopSize 1210 | 2 1211 | PointerActions 1212 | 1213 | Button,1,1,, 1214 | 1215 | Action 1216 | kContextMenuPointerAction 1217 | 1218 | Button,2,1,, 1219 | 1220 | Action 1221 | kPasteFromClipboardPointerAction 1222 | 1223 | Gesture,ThreeFingerSwipeDown,, 1224 | 1225 | Action 1226 | kPrevWindowPointerAction 1227 | 1228 | Gesture,ThreeFingerSwipeLeft,, 1229 | 1230 | Action 1231 | kPrevTabPointerAction 1232 | 1233 | Gesture,ThreeFingerSwipeRight,, 1234 | 1235 | Action 1236 | kNextTabPointerAction 1237 | 1238 | Gesture,ThreeFingerSwipeUp,, 1239 | 1240 | Action 1241 | kNextWindowPointerAction 1242 | 1243 | 1244 | PrefsCustomFolder 1245 | /Users/amanda/Desktop/iterm 1246 | PromptOnQuit 1247 | 1248 | QuitWhenAllWindowsClosed 1249 | 1250 | RightCommand 1251 | 8 1252 | RightOption 1253 | 3 1254 | SUAutomaticallyUpdate 1255 | 1256 | SUEnableAutomaticChecks 1257 | 1258 | SUFeedAlternateAppNameKey 1259 | iTerm 1260 | SUFeedURL 1261 | https://iterm2.com/appcasts/final.xml?shard=27 1262 | SUHasLaunchedBefore 1263 | 1264 | SULastCheckTime 1265 | 2018-04-23T17:18:06Z 1266 | SavePasteHistory 1267 | 1268 | ShowBookmarkName 1269 | 1270 | ShowPaneTitles 1271 | 1272 | SmartPlacement 1273 | 1274 | SplitPaneDimmingAmount 1275 | 0.40000000596046448 1276 | SwitchTabModifier 1277 | 4 1278 | SwitchWindowModifier 1279 | 6 1280 | TabStyle 1281 | 0 1282 | TabViewType 1283 | 0 1284 | ThreeFingerEmulates 1285 | 1286 | TmuxDashboardLimit 1287 | 10 1288 | TripleClickSelectsFullWrappedLines 1289 | 1290 | URLHandlersByGuid 1291 | 1292 | UseBorder 1293 | 1294 | UseCompactLabel 1295 | 1296 | UseLionStyleFullscreen 1297 | 1298 | WebKitDefaultFontSize 1299 | 11 1300 | WebKitStandardFont 1301 | .AppleSystemUIFont 1302 | WindowNumber 1303 | 1304 | WindowStyle 1305 | 0 1306 | WordCharacters 1307 | and 1308 | findIgnoreCase_iTerm 1309 | 1310 | findMode_iTerm 1311 | 0 1312 | findRegex_iTerm 1313 | 1314 | iTerm Version 1315 | 3.1.5 1316 | kCPKSelectionViewPreferredModeKey 1317 | 0 1318 | kCPKSelectionViewShowHSBTextFieldsKey 1319 | 1320 | 1321 | 1322 | -------------------------------------------------------------------------------- /tag-vim/vim/autoload/plug.vim: -------------------------------------------------------------------------------- 1 | " vim-plug: Vim plugin manager 2 | " ============================ 3 | " 4 | " Download plug.vim and put it in ~/.vim/autoload 5 | " 6 | " curl -fLo ~/.vim/autoload/plug.vim --create-dirs \ 7 | " https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim 8 | " 9 | " Edit your .vimrc 10 | " 11 | " call plug#begin('~/.vim/plugged') 12 | " 13 | " " Make sure you use single quotes 14 | " 15 | " " Shorthand notation; fetches https://github.com/junegunn/vim-easy-align 16 | " Plug 'junegunn/vim-easy-align' 17 | " 18 | " " Any valid git URL is allowed 19 | " Plug 'https://github.com/junegunn/vim-github-dashboard.git' 20 | " 21 | " " Multiple Plug commands can be written in a single line using | separators 22 | " Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets' 23 | " 24 | " " On-demand loading 25 | " Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } 26 | " Plug 'tpope/vim-fireplace', { 'for': 'clojure' } 27 | " 28 | " " Using a non-master branch 29 | " Plug 'rdnetto/YCM-Generator', { 'branch': 'stable' } 30 | " 31 | " " Using a tagged release; wildcard allowed (requires git 1.9.2 or above) 32 | " Plug 'fatih/vim-go', { 'tag': '*' } 33 | " 34 | " " Plugin options 35 | " Plug 'nsf/gocode', { 'tag': 'v.20150303', 'rtp': 'vim' } 36 | " 37 | " " Plugin outside ~/.vim/plugged with post-update hook 38 | " Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } 39 | " 40 | " " Unmanaged plugin (manually installed and updated) 41 | " Plug '~/my-prototype-plugin' 42 | " 43 | " " Initialize plugin system 44 | " call plug#end() 45 | " 46 | " Then reload .vimrc and :PlugInstall to install plugins. 47 | " 48 | " Plug options: 49 | " 50 | "| Option | Description | 51 | "| ----------------------- | ------------------------------------------------ | 52 | "| `branch`/`tag`/`commit` | Branch/tag/commit of the repository to use | 53 | "| `rtp` | Subdirectory that contains Vim plugin | 54 | "| `dir` | Custom directory for the plugin | 55 | "| `as` | Use different name for the plugin | 56 | "| `do` | Post-update hook (string or funcref) | 57 | "| `on` | On-demand loading: Commands or ``-mappings | 58 | "| `for` | On-demand loading: File types | 59 | "| `frozen` | Do not update unless explicitly specified | 60 | " 61 | " More information: https://github.com/junegunn/vim-plug 62 | " 63 | " 64 | " Copyright (c) 2017 Junegunn Choi 65 | " 66 | " MIT License 67 | " 68 | " Permission is hereby granted, free of charge, to any person obtaining 69 | " a copy of this software and associated documentation files (the 70 | " "Software"), to deal in the Software without restriction, including 71 | " without limitation the rights to use, copy, modify, merge, publish, 72 | " distribute, sublicense, and/or sell copies of the Software, and to 73 | " permit persons to whom the Software is furnished to do so, subject to 74 | " the following conditions: 75 | " 76 | " The above copyright notice and this permission notice shall be 77 | " included in all copies or substantial portions of the Software. 78 | " 79 | " THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 80 | " EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 81 | " MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 82 | " NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 83 | " LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 84 | " OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 85 | " WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 86 | 87 | if exists('g:loaded_plug') 88 | finish 89 | endif 90 | let g:loaded_plug = 1 91 | 92 | let s:cpo_save = &cpo 93 | set cpo&vim 94 | 95 | let s:plug_src = 'https://github.com/junegunn/vim-plug.git' 96 | let s:plug_tab = get(s:, 'plug_tab', -1) 97 | let s:plug_buf = get(s:, 'plug_buf', -1) 98 | let s:mac_gui = has('gui_macvim') && has('gui_running') 99 | let s:is_win = has('win32') || has('win64') 100 | let s:nvim = has('nvim') && exists('*jobwait') && !s:is_win 101 | let s:vim8 = has('patch-8.0.0039') && exists('*job_start') 102 | let s:me = resolve(expand(':p')) 103 | let s:base_spec = { 'branch': 'master', 'frozen': 0 } 104 | let s:TYPE = { 105 | \ 'string': type(''), 106 | \ 'list': type([]), 107 | \ 'dict': type({}), 108 | \ 'funcref': type(function('call')) 109 | \ } 110 | let s:loaded = get(s:, 'loaded', {}) 111 | let s:triggers = get(s:, 'triggers', {}) 112 | 113 | function! plug#begin(...) 114 | if a:0 > 0 115 | let s:plug_home_org = a:1 116 | let home = s:path(fnamemodify(expand(a:1), ':p')) 117 | elseif exists('g:plug_home') 118 | let home = s:path(g:plug_home) 119 | elseif !empty(&rtp) 120 | let home = s:path(split(&rtp, ',')[0]) . '/plugged' 121 | else 122 | return s:err('Unable to determine plug home. Try calling plug#begin() with a path argument.') 123 | endif 124 | 125 | let g:plug_home = home 126 | let g:plugs = {} 127 | let g:plugs_order = [] 128 | let s:triggers = {} 129 | 130 | call s:define_commands() 131 | return 1 132 | endfunction 133 | 134 | function! s:define_commands() 135 | command! -nargs=+ -bar Plug call plug#() 136 | if !executable('git') 137 | return s:err('`git` executable not found. Most commands will not be available. To suppress this message, prepend `silent!` to `call plug#begin(...)`.') 138 | endif 139 | command! -nargs=* -bar -bang -complete=customlist,s:names PlugInstall call s:install(0, []) 140 | command! -nargs=* -bar -bang -complete=customlist,s:names PlugUpdate call s:update(0, []) 141 | command! -nargs=0 -bar -bang PlugClean call s:clean(0) 142 | command! -nargs=0 -bar PlugUpgrade if s:upgrade() | execute 'source' s:esc(s:me) | endif 143 | command! -nargs=0 -bar PlugStatus call s:status() 144 | command! -nargs=0 -bar PlugDiff call s:diff() 145 | command! -nargs=? -bar -bang -complete=file PlugSnapshot call s:snapshot(0, ) 146 | endfunction 147 | 148 | function! s:to_a(v) 149 | return type(a:v) == s:TYPE.list ? a:v : [a:v] 150 | endfunction 151 | 152 | function! s:to_s(v) 153 | return type(a:v) == s:TYPE.string ? a:v : join(a:v, "\n") . "\n" 154 | endfunction 155 | 156 | function! s:glob(from, pattern) 157 | return s:lines(globpath(a:from, a:pattern)) 158 | endfunction 159 | 160 | function! s:source(from, ...) 161 | let found = 0 162 | for pattern in a:000 163 | for vim in s:glob(a:from, pattern) 164 | execute 'source' s:esc(vim) 165 | let found = 1 166 | endfor 167 | endfor 168 | return found 169 | endfunction 170 | 171 | function! s:assoc(dict, key, val) 172 | let a:dict[a:key] = add(get(a:dict, a:key, []), a:val) 173 | endfunction 174 | 175 | function! s:ask(message, ...) 176 | call inputsave() 177 | echohl WarningMsg 178 | let answer = input(a:message.(a:0 ? ' (y/N/a) ' : ' (y/N) ')) 179 | echohl None 180 | call inputrestore() 181 | echo "\r" 182 | return (a:0 && answer =~? '^a') ? 2 : (answer =~? '^y') ? 1 : 0 183 | endfunction 184 | 185 | function! s:ask_no_interrupt(...) 186 | try 187 | return call('s:ask', a:000) 188 | catch 189 | return 0 190 | endtry 191 | endfunction 192 | 193 | function! plug#end() 194 | if !exists('g:plugs') 195 | return s:err('Call plug#begin() first') 196 | endif 197 | 198 | if exists('#PlugLOD') 199 | augroup PlugLOD 200 | autocmd! 201 | augroup END 202 | augroup! PlugLOD 203 | endif 204 | let lod = { 'ft': {}, 'map': {}, 'cmd': {} } 205 | 206 | if exists('g:did_load_filetypes') 207 | filetype off 208 | endif 209 | for name in g:plugs_order 210 | if !has_key(g:plugs, name) 211 | continue 212 | endif 213 | let plug = g:plugs[name] 214 | if get(s:loaded, name, 0) || !has_key(plug, 'on') && !has_key(plug, 'for') 215 | let s:loaded[name] = 1 216 | continue 217 | endif 218 | 219 | if has_key(plug, 'on') 220 | let s:triggers[name] = { 'map': [], 'cmd': [] } 221 | for cmd in s:to_a(plug.on) 222 | if cmd =~? '^.\+' 223 | if empty(mapcheck(cmd)) && empty(mapcheck(cmd, 'i')) 224 | call s:assoc(lod.map, cmd, name) 225 | endif 226 | call add(s:triggers[name].map, cmd) 227 | elseif cmd =~# '^[A-Z]' 228 | let cmd = substitute(cmd, '!*$', '', '') 229 | if exists(':'.cmd) != 2 230 | call s:assoc(lod.cmd, cmd, name) 231 | endif 232 | call add(s:triggers[name].cmd, cmd) 233 | else 234 | call s:err('Invalid `on` option: '.cmd. 235 | \ '. Should start with an uppercase letter or ``.') 236 | endif 237 | endfor 238 | endif 239 | 240 | if has_key(plug, 'for') 241 | let types = s:to_a(plug.for) 242 | if !empty(types) 243 | augroup filetypedetect 244 | call s:source(s:rtp(plug), 'ftdetect/**/*.vim', 'after/ftdetect/**/*.vim') 245 | augroup END 246 | endif 247 | for type in types 248 | call s:assoc(lod.ft, type, name) 249 | endfor 250 | endif 251 | endfor 252 | 253 | for [cmd, names] in items(lod.cmd) 254 | execute printf( 255 | \ 'command! -nargs=* -range -bang -complete=file %s call s:lod_cmd(%s, "", , , , %s)', 256 | \ cmd, string(cmd), string(names)) 257 | endfor 258 | 259 | for [map, names] in items(lod.map) 260 | for [mode, map_prefix, key_prefix] in 261 | \ [['i', '', ''], ['n', '', ''], ['v', '', 'gv'], ['o', '', '']] 262 | execute printf( 263 | \ '%snoremap %s %s:call lod_map(%s, %s, %s, "%s")', 264 | \ mode, map, map_prefix, string(map), string(names), mode != 'i', key_prefix) 265 | endfor 266 | endfor 267 | 268 | for [ft, names] in items(lod.ft) 269 | augroup PlugLOD 270 | execute printf('autocmd FileType %s call lod_ft(%s, %s)', 271 | \ ft, string(ft), string(names)) 272 | augroup END 273 | endfor 274 | 275 | call s:reorg_rtp() 276 | filetype plugin indent on 277 | if has('vim_starting') 278 | if has('syntax') && !exists('g:syntax_on') 279 | syntax enable 280 | end 281 | else 282 | call s:reload_plugins() 283 | endif 284 | endfunction 285 | 286 | function! s:loaded_names() 287 | return filter(copy(g:plugs_order), 'get(s:loaded, v:val, 0)') 288 | endfunction 289 | 290 | function! s:load_plugin(spec) 291 | call s:source(s:rtp(a:spec), 'plugin/**/*.vim', 'after/plugin/**/*.vim') 292 | endfunction 293 | 294 | function! s:reload_plugins() 295 | for name in s:loaded_names() 296 | call s:load_plugin(g:plugs[name]) 297 | endfor 298 | endfunction 299 | 300 | function! s:trim(str) 301 | return substitute(a:str, '[\/]\+$', '', '') 302 | endfunction 303 | 304 | function! s:version_requirement(val, min) 305 | for idx in range(0, len(a:min) - 1) 306 | let v = get(a:val, idx, 0) 307 | if v < a:min[idx] | return 0 308 | elseif v > a:min[idx] | return 1 309 | endif 310 | endfor 311 | return 1 312 | endfunction 313 | 314 | function! s:git_version_requirement(...) 315 | if !exists('s:git_version') 316 | let s:git_version = map(split(split(s:system('git --version'))[2], '\.'), 'str2nr(v:val)') 317 | endif 318 | return s:version_requirement(s:git_version, a:000) 319 | endfunction 320 | 321 | function! s:progress_opt(base) 322 | return a:base && !s:is_win && 323 | \ s:git_version_requirement(1, 7, 1) ? '--progress' : '' 324 | endfunction 325 | 326 | if s:is_win 327 | function! s:rtp(spec) 328 | return s:path(a:spec.dir . get(a:spec, 'rtp', '')) 329 | endfunction 330 | 331 | function! s:path(path) 332 | return s:trim(substitute(a:path, '/', '\', 'g')) 333 | endfunction 334 | 335 | function! s:dirpath(path) 336 | return s:path(a:path) . '\' 337 | endfunction 338 | 339 | function! s:is_local_plug(repo) 340 | return a:repo =~? '^[a-z]:\|^[%~]' 341 | endfunction 342 | else 343 | function! s:rtp(spec) 344 | return s:dirpath(a:spec.dir . get(a:spec, 'rtp', '')) 345 | endfunction 346 | 347 | function! s:path(path) 348 | return s:trim(a:path) 349 | endfunction 350 | 351 | function! s:dirpath(path) 352 | return substitute(a:path, '[/\\]*$', '/', '') 353 | endfunction 354 | 355 | function! s:is_local_plug(repo) 356 | return a:repo[0] =~ '[/$~]' 357 | endfunction 358 | endif 359 | 360 | function! s:err(msg) 361 | echohl ErrorMsg 362 | echom '[vim-plug] '.a:msg 363 | echohl None 364 | endfunction 365 | 366 | function! s:warn(cmd, msg) 367 | echohl WarningMsg 368 | execute a:cmd 'a:msg' 369 | echohl None 370 | endfunction 371 | 372 | function! s:esc(path) 373 | return escape(a:path, ' ') 374 | endfunction 375 | 376 | function! s:escrtp(path) 377 | return escape(a:path, ' ,') 378 | endfunction 379 | 380 | function! s:remove_rtp() 381 | for name in s:loaded_names() 382 | let rtp = s:rtp(g:plugs[name]) 383 | execute 'set rtp-='.s:escrtp(rtp) 384 | let after = globpath(rtp, 'after') 385 | if isdirectory(after) 386 | execute 'set rtp-='.s:escrtp(after) 387 | endif 388 | endfor 389 | endfunction 390 | 391 | function! s:reorg_rtp() 392 | if !empty(s:first_rtp) 393 | execute 'set rtp-='.s:first_rtp 394 | execute 'set rtp-='.s:last_rtp 395 | endif 396 | 397 | " &rtp is modified from outside 398 | if exists('s:prtp') && s:prtp !=# &rtp 399 | call s:remove_rtp() 400 | unlet! s:middle 401 | endif 402 | 403 | let s:middle = get(s:, 'middle', &rtp) 404 | let rtps = map(s:loaded_names(), 's:rtp(g:plugs[v:val])') 405 | let afters = filter(map(copy(rtps), 'globpath(v:val, "after")'), '!empty(v:val)') 406 | let rtp = join(map(rtps, 'escape(v:val, ",")'), ',') 407 | \ . ','.s:middle.',' 408 | \ . join(map(afters, 'escape(v:val, ",")'), ',') 409 | let &rtp = substitute(substitute(rtp, ',,*', ',', 'g'), '^,\|,$', '', 'g') 410 | let s:prtp = &rtp 411 | 412 | if !empty(s:first_rtp) 413 | execute 'set rtp^='.s:first_rtp 414 | execute 'set rtp+='.s:last_rtp 415 | endif 416 | endfunction 417 | 418 | function! s:doautocmd(...) 419 | if exists('#'.join(a:000, '#')) 420 | execute 'doautocmd' ((v:version > 703 || has('patch442')) ? '' : '') join(a:000) 421 | endif 422 | endfunction 423 | 424 | function! s:dobufread(names) 425 | for name in a:names 426 | let path = s:rtp(g:plugs[name]).'/**' 427 | for dir in ['ftdetect', 'ftplugin'] 428 | if len(finddir(dir, path)) 429 | return s:doautocmd('BufRead') 430 | endif 431 | endfor 432 | endfor 433 | endfunction 434 | 435 | function! plug#load(...) 436 | if a:0 == 0 437 | return s:err('Argument missing: plugin name(s) required') 438 | endif 439 | if !exists('g:plugs') 440 | return s:err('plug#begin was not called') 441 | endif 442 | let unknowns = filter(copy(a:000), '!has_key(g:plugs, v:val)') 443 | if !empty(unknowns) 444 | let s = len(unknowns) > 1 ? 's' : '' 445 | return s:err(printf('Unknown plugin%s: %s', s, join(unknowns, ', '))) 446 | end 447 | for name in a:000 448 | call s:lod([name], ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin']) 449 | endfor 450 | call s:dobufread(a:000) 451 | return 1 452 | endfunction 453 | 454 | function! s:remove_triggers(name) 455 | if !has_key(s:triggers, a:name) 456 | return 457 | endif 458 | for cmd in s:triggers[a:name].cmd 459 | execute 'silent! delc' cmd 460 | endfor 461 | for map in s:triggers[a:name].map 462 | execute 'silent! unmap' map 463 | execute 'silent! iunmap' map 464 | endfor 465 | call remove(s:triggers, a:name) 466 | endfunction 467 | 468 | function! s:lod(names, types, ...) 469 | for name in a:names 470 | call s:remove_triggers(name) 471 | let s:loaded[name] = 1 472 | endfor 473 | call s:reorg_rtp() 474 | 475 | for name in a:names 476 | let rtp = s:rtp(g:plugs[name]) 477 | for dir in a:types 478 | call s:source(rtp, dir.'/**/*.vim') 479 | endfor 480 | if a:0 481 | if !s:source(rtp, a:1) && !empty(s:glob(rtp, a:2)) 482 | execute 'runtime' a:1 483 | endif 484 | call s:source(rtp, a:2) 485 | endif 486 | call s:doautocmd('User', name) 487 | endfor 488 | endfunction 489 | 490 | function! s:lod_ft(pat, names) 491 | let syn = 'syntax/'.a:pat.'.vim' 492 | call s:lod(a:names, ['plugin', 'after/plugin'], syn, 'after/'.syn) 493 | execute 'autocmd! PlugLOD FileType' a:pat 494 | call s:doautocmd('filetypeplugin', 'FileType') 495 | call s:doautocmd('filetypeindent', 'FileType') 496 | endfunction 497 | 498 | function! s:lod_cmd(cmd, bang, l1, l2, args, names) 499 | call s:lod(a:names, ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin']) 500 | call s:dobufread(a:names) 501 | execute printf('%s%s%s %s', (a:l1 == a:l2 ? '' : (a:l1.','.a:l2)), a:cmd, a:bang, a:args) 502 | endfunction 503 | 504 | function! s:lod_map(map, names, with_prefix, prefix) 505 | call s:lod(a:names, ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin']) 506 | call s:dobufread(a:names) 507 | let extra = '' 508 | while 1 509 | let c = getchar(0) 510 | if c == 0 511 | break 512 | endif 513 | let extra .= nr2char(c) 514 | endwhile 515 | 516 | if a:with_prefix 517 | let prefix = v:count ? v:count : '' 518 | let prefix .= '"'.v:register.a:prefix 519 | if mode(1) == 'no' 520 | if v:operator == 'c' 521 | let prefix = "\" . prefix 522 | endif 523 | let prefix .= v:operator 524 | endif 525 | call feedkeys(prefix, 'n') 526 | endif 527 | call feedkeys(substitute(a:map, '^', "\", '') . extra) 528 | endfunction 529 | 530 | function! plug#(repo, ...) 531 | if a:0 > 1 532 | return s:err('Invalid number of arguments (1..2)') 533 | endif 534 | 535 | try 536 | let repo = s:trim(a:repo) 537 | let opts = a:0 == 1 ? s:parse_options(a:1) : s:base_spec 538 | let name = get(opts, 'as', fnamemodify(repo, ':t:s?\.git$??')) 539 | let spec = extend(s:infer_properties(name, repo), opts) 540 | if !has_key(g:plugs, name) 541 | call add(g:plugs_order, name) 542 | endif 543 | let g:plugs[name] = spec 544 | let s:loaded[name] = get(s:loaded, name, 0) 545 | catch 546 | return s:err(v:exception) 547 | endtry 548 | endfunction 549 | 550 | function! s:parse_options(arg) 551 | let opts = copy(s:base_spec) 552 | let type = type(a:arg) 553 | if type == s:TYPE.string 554 | let opts.tag = a:arg 555 | elseif type == s:TYPE.dict 556 | call extend(opts, a:arg) 557 | if has_key(opts, 'dir') 558 | let opts.dir = s:dirpath(expand(opts.dir)) 559 | endif 560 | else 561 | throw 'Invalid argument type (expected: string or dictionary)' 562 | endif 563 | return opts 564 | endfunction 565 | 566 | function! s:infer_properties(name, repo) 567 | let repo = a:repo 568 | if s:is_local_plug(repo) 569 | return { 'dir': s:dirpath(expand(repo)) } 570 | else 571 | if repo =~ ':' 572 | let uri = repo 573 | else 574 | if repo !~ '/' 575 | let repo = 'vim-scripts/'. repo 576 | endif 577 | let fmt = get(g:, 'plug_url_format', 'https://git::@github.com/%s.git') 578 | let uri = printf(fmt, repo) 579 | endif 580 | return { 'dir': s:dirpath(g:plug_home.'/'.a:name), 'uri': uri } 581 | endif 582 | endfunction 583 | 584 | function! s:install(force, names) 585 | call s:update_impl(0, a:force, a:names) 586 | endfunction 587 | 588 | function! s:update(force, names) 589 | call s:update_impl(1, a:force, a:names) 590 | endfunction 591 | 592 | function! plug#helptags() 593 | if !exists('g:plugs') 594 | return s:err('plug#begin was not called') 595 | endif 596 | for spec in values(g:plugs) 597 | let docd = join([spec.dir, 'doc'], '/') 598 | if isdirectory(docd) 599 | silent! execute 'helptags' s:esc(docd) 600 | endif 601 | endfor 602 | return 1 603 | endfunction 604 | 605 | function! s:syntax() 606 | syntax clear 607 | syntax region plug1 start=/\%1l/ end=/\%2l/ contains=plugNumber 608 | syntax region plug2 start=/\%2l/ end=/\%3l/ contains=plugBracket,plugX 609 | syn match plugNumber /[0-9]\+[0-9.]*/ contained 610 | syn match plugBracket /[[\]]/ contained 611 | syn match plugX /x/ contained 612 | syn match plugDash /^-/ 613 | syn match plugPlus /^+/ 614 | syn match plugStar /^*/ 615 | syn match plugMessage /\(^- \)\@<=.*/ 616 | syn match plugName /\(^- \)\@<=[^ ]*:/ 617 | syn match plugSha /\%(: \)\@<=[0-9a-f]\{4,}$/ 618 | syn match plugTag /(tag: [^)]\+)/ 619 | syn match plugInstall /\(^+ \)\@<=[^:]*/ 620 | syn match plugUpdate /\(^* \)\@<=[^:]*/ 621 | syn match plugCommit /^ \X*[0-9a-f]\{7} .*/ contains=plugRelDate,plugEdge,plugTag 622 | syn match plugEdge /^ \X\+$/ 623 | syn match plugEdge /^ \X*/ contained nextgroup=plugSha 624 | syn match plugSha /[0-9a-f]\{7}/ contained 625 | syn match plugRelDate /([^)]*)$/ contained 626 | syn match plugNotLoaded /(not loaded)$/ 627 | syn match plugError /^x.*/ 628 | syn region plugDeleted start=/^\~ .*/ end=/^\ze\S/ 629 | syn match plugH2 /^.*:\n-\+$/ 630 | syn keyword Function PlugInstall PlugStatus PlugUpdate PlugClean 631 | hi def link plug1 Title 632 | hi def link plug2 Repeat 633 | hi def link plugH2 Type 634 | hi def link plugX Exception 635 | hi def link plugBracket Structure 636 | hi def link plugNumber Number 637 | 638 | hi def link plugDash Special 639 | hi def link plugPlus Constant 640 | hi def link plugStar Boolean 641 | 642 | hi def link plugMessage Function 643 | hi def link plugName Label 644 | hi def link plugInstall Function 645 | hi def link plugUpdate Type 646 | 647 | hi def link plugError Error 648 | hi def link plugDeleted Ignore 649 | hi def link plugRelDate Comment 650 | hi def link plugEdge PreProc 651 | hi def link plugSha Identifier 652 | hi def link plugTag Constant 653 | 654 | hi def link plugNotLoaded Comment 655 | endfunction 656 | 657 | function! s:lpad(str, len) 658 | return a:str . repeat(' ', a:len - len(a:str)) 659 | endfunction 660 | 661 | function! s:lines(msg) 662 | return split(a:msg, "[\r\n]") 663 | endfunction 664 | 665 | function! s:lastline(msg) 666 | return get(s:lines(a:msg), -1, '') 667 | endfunction 668 | 669 | function! s:new_window() 670 | execute get(g:, 'plug_window', 'vertical topleft new') 671 | endfunction 672 | 673 | function! s:plug_window_exists() 674 | let buflist = tabpagebuflist(s:plug_tab) 675 | return !empty(buflist) && index(buflist, s:plug_buf) >= 0 676 | endfunction 677 | 678 | function! s:switch_in() 679 | if !s:plug_window_exists() 680 | return 0 681 | endif 682 | 683 | if winbufnr(0) != s:plug_buf 684 | let s:pos = [tabpagenr(), winnr(), winsaveview()] 685 | execute 'normal!' s:plug_tab.'gt' 686 | let winnr = bufwinnr(s:plug_buf) 687 | execute winnr.'wincmd w' 688 | call add(s:pos, winsaveview()) 689 | else 690 | let s:pos = [winsaveview()] 691 | endif 692 | 693 | setlocal modifiable 694 | return 1 695 | endfunction 696 | 697 | function! s:switch_out(...) 698 | call winrestview(s:pos[-1]) 699 | setlocal nomodifiable 700 | if a:0 > 0 701 | execute a:1 702 | endif 703 | 704 | if len(s:pos) > 1 705 | execute 'normal!' s:pos[0].'gt' 706 | execute s:pos[1] 'wincmd w' 707 | call winrestview(s:pos[2]) 708 | endif 709 | endfunction 710 | 711 | function! s:finish_bindings() 712 | nnoremap R :call retry() 713 | nnoremap D :PlugDiff 714 | nnoremap S :PlugStatus 715 | nnoremap U :call status_update() 716 | xnoremap U :call status_update() 717 | nnoremap ]] :silent! call section('') 718 | nnoremap [[ :silent! call section('b') 719 | endfunction 720 | 721 | function! s:prepare(...) 722 | if empty(getcwd()) 723 | throw 'Invalid current working directory. Cannot proceed.' 724 | endif 725 | 726 | for evar in ['$GIT_DIR', '$GIT_WORK_TREE'] 727 | if exists(evar) 728 | throw evar.' detected. Cannot proceed.' 729 | endif 730 | endfor 731 | 732 | call s:job_abort() 733 | if s:switch_in() 734 | if b:plug_preview == 1 735 | pc 736 | endif 737 | enew 738 | else 739 | call s:new_window() 740 | endif 741 | 742 | nnoremap q :if b:plug_preview==1pcendifbd 743 | if a:0 == 0 744 | call s:finish_bindings() 745 | endif 746 | let b:plug_preview = -1 747 | let s:plug_tab = tabpagenr() 748 | let s:plug_buf = winbufnr(0) 749 | call s:assign_name() 750 | 751 | for k in ['', 'L', 'o', 'X', 'd', 'dd'] 752 | execute 'silent! unmap ' k 753 | endfor 754 | setlocal buftype=nofile bufhidden=wipe nobuflisted nolist noswapfile nowrap cursorline modifiable nospell 755 | setf vim-plug 756 | if exists('g:syntax_on') 757 | call s:syntax() 758 | endif 759 | endfunction 760 | 761 | function! s:assign_name() 762 | " Assign buffer name 763 | let prefix = '[Plugins]' 764 | let name = prefix 765 | let idx = 2 766 | while bufexists(name) 767 | let name = printf('%s (%s)', prefix, idx) 768 | let idx = idx + 1 769 | endwhile 770 | silent! execute 'f' fnameescape(name) 771 | endfunction 772 | 773 | function! s:chsh(swap) 774 | let prev = [&shell, &shellredir] 775 | if !s:is_win && a:swap 776 | set shell=sh shellredir=>%s\ 2>&1 777 | endif 778 | return prev 779 | endfunction 780 | 781 | function! s:bang(cmd, ...) 782 | try 783 | let [sh, shrd] = s:chsh(a:0) 784 | " FIXME: Escaping is incomplete. We could use shellescape with eval, 785 | " but it won't work on Windows. 786 | let cmd = a:0 ? s:with_cd(a:cmd, a:1) : a:cmd 787 | let g:_plug_bang = '!'.escape(cmd, '#!%') 788 | execute "normal! :execute g:_plug_bang\\" 789 | finally 790 | unlet g:_plug_bang 791 | let [&shell, &shellredir] = [sh, shrd] 792 | endtry 793 | return v:shell_error ? 'Exit status: ' . v:shell_error : '' 794 | endfunction 795 | 796 | function! s:regress_bar() 797 | let bar = substitute(getline(2)[1:-2], '.*\zs=', 'x', '') 798 | call s:progress_bar(2, bar, len(bar)) 799 | endfunction 800 | 801 | function! s:is_updated(dir) 802 | return !empty(s:system_chomp('git log --pretty=format:"%h" "HEAD...HEAD@{1}"', a:dir)) 803 | endfunction 804 | 805 | function! s:do(pull, force, todo) 806 | for [name, spec] in items(a:todo) 807 | if !isdirectory(spec.dir) 808 | continue 809 | endif 810 | let installed = has_key(s:update.new, name) 811 | let updated = installed ? 0 : 812 | \ (a:pull && index(s:update.errors, name) < 0 && s:is_updated(spec.dir)) 813 | if a:force || installed || updated 814 | execute 'cd' s:esc(spec.dir) 815 | call append(3, '- Post-update hook for '. name .' ... ') 816 | let error = '' 817 | let type = type(spec.do) 818 | if type == s:TYPE.string 819 | if spec.do[0] == ':' 820 | call s:load_plugin(spec) 821 | try 822 | execute spec.do[1:] 823 | catch 824 | let error = v:exception 825 | endtry 826 | if !s:plug_window_exists() 827 | cd - 828 | throw 'Warning: vim-plug was terminated by the post-update hook of '.name 829 | endif 830 | else 831 | let error = s:bang(spec.do) 832 | endif 833 | elseif type == s:TYPE.funcref 834 | try 835 | let status = installed ? 'installed' : (updated ? 'updated' : 'unchanged') 836 | call spec.do({ 'name': name, 'status': status, 'force': a:force }) 837 | catch 838 | let error = v:exception 839 | endtry 840 | else 841 | let error = 'Invalid hook type' 842 | endif 843 | call s:switch_in() 844 | call setline(4, empty(error) ? (getline(4) . 'OK') 845 | \ : ('x' . getline(4)[1:] . error)) 846 | if !empty(error) 847 | call add(s:update.errors, name) 848 | call s:regress_bar() 849 | endif 850 | cd - 851 | endif 852 | endfor 853 | endfunction 854 | 855 | function! s:hash_match(a, b) 856 | return stridx(a:a, a:b) == 0 || stridx(a:b, a:a) == 0 857 | endfunction 858 | 859 | function! s:checkout(spec) 860 | let sha = a:spec.commit 861 | let output = s:system('git rev-parse HEAD', a:spec.dir) 862 | if !v:shell_error && !s:hash_match(sha, s:lines(output)[0]) 863 | let output = s:system( 864 | \ 'git fetch --depth 999999 && git checkout '.s:esc(sha), a:spec.dir) 865 | endif 866 | return output 867 | endfunction 868 | 869 | function! s:finish(pull) 870 | let new_frozen = len(filter(keys(s:update.new), 'g:plugs[v:val].frozen')) 871 | if new_frozen 872 | let s = new_frozen > 1 ? 's' : '' 873 | call append(3, printf('- Installed %d frozen plugin%s', new_frozen, s)) 874 | endif 875 | call append(3, '- Finishing ... ') | 4 876 | redraw 877 | call plug#helptags() 878 | call plug#end() 879 | call setline(4, getline(4) . 'Done!') 880 | redraw 881 | let msgs = [] 882 | if !empty(s:update.errors) 883 | call add(msgs, "Press 'R' to retry.") 884 | endif 885 | if a:pull && len(s:update.new) < len(filter(getline(5, '$'), 886 | \ "v:val =~ '^- ' && stridx(v:val, 'Already up-to-date') < 0")) 887 | call add(msgs, "Press 'D' to see the updated changes.") 888 | endif 889 | echo join(msgs, ' ') 890 | call s:finish_bindings() 891 | endfunction 892 | 893 | function! s:retry() 894 | if empty(s:update.errors) 895 | return 896 | endif 897 | echo 898 | call s:update_impl(s:update.pull, s:update.force, 899 | \ extend(copy(s:update.errors), [s:update.threads])) 900 | endfunction 901 | 902 | function! s:is_managed(name) 903 | return has_key(g:plugs[a:name], 'uri') 904 | endfunction 905 | 906 | function! s:names(...) 907 | return sort(filter(keys(g:plugs), 'stridx(v:val, a:1) == 0 && s:is_managed(v:val)')) 908 | endfunction 909 | 910 | function! s:check_ruby() 911 | silent! ruby require 'thread'; VIM::command("let g:plug_ruby = '#{RUBY_VERSION}'") 912 | if !exists('g:plug_ruby') 913 | redraw! 914 | return s:warn('echom', 'Warning: Ruby interface is broken') 915 | endif 916 | let ruby_version = split(g:plug_ruby, '\.') 917 | unlet g:plug_ruby 918 | return s:version_requirement(ruby_version, [1, 8, 7]) 919 | endfunction 920 | 921 | function! s:update_impl(pull, force, args) abort 922 | let sync = index(a:args, '--sync') >= 0 || has('vim_starting') 923 | let args = filter(copy(a:args), 'v:val != "--sync"') 924 | let threads = (len(args) > 0 && args[-1] =~ '^[1-9][0-9]*$') ? 925 | \ remove(args, -1) : get(g:, 'plug_threads', 16) 926 | 927 | let managed = filter(copy(g:plugs), 's:is_managed(v:key)') 928 | let todo = empty(args) ? filter(managed, '!v:val.frozen || !isdirectory(v:val.dir)') : 929 | \ filter(managed, 'index(args, v:key) >= 0') 930 | 931 | if empty(todo) 932 | return s:warn('echo', 'No plugin to '. (a:pull ? 'update' : 'install')) 933 | endif 934 | 935 | if !s:is_win && s:git_version_requirement(2, 3) 936 | let s:git_terminal_prompt = exists('$GIT_TERMINAL_PROMPT') ? $GIT_TERMINAL_PROMPT : '' 937 | let $GIT_TERMINAL_PROMPT = 0 938 | for plug in values(todo) 939 | let plug.uri = substitute(plug.uri, 940 | \ '^https://git::@github\.com', 'https://github.com', '') 941 | endfor 942 | endif 943 | 944 | if !isdirectory(g:plug_home) 945 | try 946 | call mkdir(g:plug_home, 'p') 947 | catch 948 | return s:err(printf('Invalid plug directory: %s. '. 949 | \ 'Try to call plug#begin with a valid directory', g:plug_home)) 950 | endtry 951 | endif 952 | 953 | if has('nvim') && !exists('*jobwait') && threads > 1 954 | call s:warn('echom', '[vim-plug] Update Neovim for parallel installer') 955 | endif 956 | 957 | let use_job = s:nvim || s:vim8 958 | let python = (has('python') || has('python3')) && !use_job 959 | 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() 960 | 961 | let s:update = { 962 | \ 'start': reltime(), 963 | \ 'all': todo, 964 | \ 'todo': copy(todo), 965 | \ 'errors': [], 966 | \ 'pull': a:pull, 967 | \ 'force': a:force, 968 | \ 'new': {}, 969 | \ 'threads': (python || ruby || use_job) ? min([len(todo), threads]) : 1, 970 | \ 'bar': '', 971 | \ 'fin': 0 972 | \ } 973 | 974 | call s:prepare(1) 975 | call append(0, ['', '']) 976 | normal! 2G 977 | silent! redraw 978 | 979 | let s:clone_opt = get(g:, 'plug_shallow', 1) ? 980 | \ '--depth 1' . (s:git_version_requirement(1, 7, 10) ? ' --no-single-branch' : '') : '' 981 | 982 | " Python version requirement (>= 2.7) 983 | if python && !has('python3') && !ruby && !use_job && s:update.threads > 1 984 | redir => pyv 985 | silent python import platform; print platform.python_version() 986 | redir END 987 | let python = s:version_requirement( 988 | \ map(split(split(pyv)[0], '\.'), 'str2nr(v:val)'), [2, 6]) 989 | endif 990 | 991 | if (python || ruby) && s:update.threads > 1 992 | try 993 | let imd = &imd 994 | if s:mac_gui 995 | set noimd 996 | endif 997 | if ruby 998 | call s:update_ruby() 999 | else 1000 | call s:update_python() 1001 | endif 1002 | catch 1003 | let lines = getline(4, '$') 1004 | let printed = {} 1005 | silent! 4,$d _ 1006 | for line in lines 1007 | let name = s:extract_name(line, '.', '') 1008 | if empty(name) || !has_key(printed, name) 1009 | call append('$', line) 1010 | if !empty(name) 1011 | let printed[name] = 1 1012 | if line[0] == 'x' && index(s:update.errors, name) < 0 1013 | call add(s:update.errors, name) 1014 | end 1015 | endif 1016 | endif 1017 | endfor 1018 | finally 1019 | let &imd = imd 1020 | call s:update_finish() 1021 | endtry 1022 | else 1023 | call s:update_vim() 1024 | while use_job && sync 1025 | sleep 100m 1026 | if s:update.fin 1027 | break 1028 | endif 1029 | endwhile 1030 | endif 1031 | endfunction 1032 | 1033 | function! s:log4(name, msg) 1034 | call setline(4, printf('- %s (%s)', a:msg, a:name)) 1035 | redraw 1036 | endfunction 1037 | 1038 | function! s:update_finish() 1039 | if exists('s:git_terminal_prompt') 1040 | let $GIT_TERMINAL_PROMPT = s:git_terminal_prompt 1041 | endif 1042 | if s:switch_in() 1043 | call append(3, '- Updating ...') | 4 1044 | 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))')) 1045 | let [pos, _] = s:logpos(name) 1046 | if !pos 1047 | continue 1048 | endif 1049 | if has_key(spec, 'commit') 1050 | call s:log4(name, 'Checking out '.spec.commit) 1051 | let out = s:checkout(spec) 1052 | elseif has_key(spec, 'tag') 1053 | let tag = spec.tag 1054 | if tag =~ '\*' 1055 | let tags = s:lines(s:system('git tag --list '.string(tag).' --sort -version:refname 2>&1', spec.dir)) 1056 | if !v:shell_error && !empty(tags) 1057 | let tag = tags[0] 1058 | call s:log4(name, printf('Latest tag for %s -> %s', spec.tag, tag)) 1059 | call append(3, '') 1060 | endif 1061 | endif 1062 | call s:log4(name, 'Checking out '.tag) 1063 | let out = s:system('git checkout -q '.s:esc(tag).' 2>&1', spec.dir) 1064 | else 1065 | let branch = s:esc(get(spec, 'branch', 'master')) 1066 | call s:log4(name, 'Merging origin/'.branch) 1067 | let out = s:system('git checkout -q '.branch.' 2>&1' 1068 | \. (has_key(s:update.new, name) ? '' : ('&& git merge --ff-only origin/'.branch.' 2>&1')), spec.dir) 1069 | endif 1070 | if !v:shell_error && filereadable(spec.dir.'/.gitmodules') && 1071 | \ (s:update.force || has_key(s:update.new, name) || s:is_updated(spec.dir)) 1072 | call s:log4(name, 'Updating submodules. This may take a while.') 1073 | let out .= s:bang('git submodule update --init --recursive 2>&1', spec.dir) 1074 | endif 1075 | let msg = s:format_message(v:shell_error ? 'x': '-', name, out) 1076 | if v:shell_error 1077 | call add(s:update.errors, name) 1078 | call s:regress_bar() 1079 | silent execute pos 'd _' 1080 | call append(4, msg) | 4 1081 | elseif !empty(out) 1082 | call setline(pos, msg[0]) 1083 | endif 1084 | redraw 1085 | endfor 1086 | silent 4 d _ 1087 | try 1088 | 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")')) 1089 | catch 1090 | call s:warn('echom', v:exception) 1091 | call s:warn('echo', '') 1092 | return 1093 | endtry 1094 | call s:finish(s:update.pull) 1095 | call setline(1, 'Updated. Elapsed time: ' . split(reltimestr(reltime(s:update.start)))[0] . ' sec.') 1096 | call s:switch_out('normal! gg') 1097 | endif 1098 | endfunction 1099 | 1100 | function! s:job_abort() 1101 | if (!s:nvim && !s:vim8) || !exists('s:jobs') 1102 | return 1103 | endif 1104 | 1105 | for [name, j] in items(s:jobs) 1106 | if s:nvim 1107 | silent! call jobstop(j.jobid) 1108 | elseif s:vim8 1109 | silent! call job_stop(j.jobid) 1110 | endif 1111 | if j.new 1112 | call s:system('rm -rf ' . s:shellesc(g:plugs[name].dir)) 1113 | endif 1114 | endfor 1115 | let s:jobs = {} 1116 | endfunction 1117 | 1118 | function! s:last_non_empty_line(lines) 1119 | let len = len(a:lines) 1120 | for idx in range(len) 1121 | let line = a:lines[len-idx-1] 1122 | if !empty(line) 1123 | return line 1124 | endif 1125 | endfor 1126 | return '' 1127 | endfunction 1128 | 1129 | function! s:job_out_cb(self, data) abort 1130 | let self = a:self 1131 | let data = remove(self.lines, -1) . a:data 1132 | let lines = map(split(data, "\n", 1), 'split(v:val, "\r", 1)[-1]') 1133 | call extend(self.lines, lines) 1134 | " To reduce the number of buffer updates 1135 | let self.tick = get(self, 'tick', -1) + 1 1136 | if !self.running || self.tick % len(s:jobs) == 0 1137 | let bullet = self.running ? (self.new ? '+' : '*') : (self.error ? 'x' : '-') 1138 | let result = self.error ? join(self.lines, "\n") : s:last_non_empty_line(self.lines) 1139 | call s:log(bullet, self.name, result) 1140 | endif 1141 | endfunction 1142 | 1143 | function! s:job_exit_cb(self, data) abort 1144 | let a:self.running = 0 1145 | let a:self.error = a:data != 0 1146 | call s:reap(a:self.name) 1147 | call s:tick() 1148 | endfunction 1149 | 1150 | function! s:job_cb(fn, job, ch, data) 1151 | if !s:plug_window_exists() " plug window closed 1152 | return s:job_abort() 1153 | endif 1154 | call call(a:fn, [a:job, a:data]) 1155 | endfunction 1156 | 1157 | function! s:nvim_cb(job_id, data, event) dict abort 1158 | return a:event == 'stdout' ? 1159 | \ s:job_cb('s:job_out_cb', self, 0, join(a:data, "\n")) : 1160 | \ s:job_cb('s:job_exit_cb', self, 0, a:data) 1161 | endfunction 1162 | 1163 | function! s:spawn(name, cmd, opts) 1164 | let job = { 'name': a:name, 'running': 1, 'error': 0, 'lines': [''], 1165 | \ 'new': get(a:opts, 'new', 0) } 1166 | let s:jobs[a:name] = job 1167 | let argv = add(s:is_win ? ['cmd', '/c'] : ['sh', '-c'], 1168 | \ has_key(a:opts, 'dir') ? s:with_cd(a:cmd, a:opts.dir) : a:cmd) 1169 | 1170 | if s:nvim 1171 | call extend(job, { 1172 | \ 'on_stdout': function('s:nvim_cb'), 1173 | \ 'on_exit': function('s:nvim_cb'), 1174 | \ }) 1175 | let jid = jobstart(argv, job) 1176 | if jid > 0 1177 | let job.jobid = jid 1178 | else 1179 | let job.running = 0 1180 | let job.error = 1 1181 | let job.lines = [jid < 0 ? argv[0].' is not executable' : 1182 | \ 'Invalid arguments (or job table is full)'] 1183 | endif 1184 | elseif s:vim8 1185 | let jid = job_start(s:is_win ? join(argv, ' ') : argv, { 1186 | \ 'out_cb': function('s:job_cb', ['s:job_out_cb', job]), 1187 | \ 'exit_cb': function('s:job_cb', ['s:job_exit_cb', job]), 1188 | \ 'out_mode': 'raw' 1189 | \}) 1190 | if job_status(jid) == 'run' 1191 | let job.jobid = jid 1192 | else 1193 | let job.running = 0 1194 | let job.error = 1 1195 | let job.lines = ['Failed to start job'] 1196 | endif 1197 | else 1198 | let params = has_key(a:opts, 'dir') ? [a:cmd, a:opts.dir] : [a:cmd] 1199 | let job.lines = s:lines(call('s:system', params)) 1200 | let job.error = v:shell_error != 0 1201 | let job.running = 0 1202 | endif 1203 | endfunction 1204 | 1205 | function! s:reap(name) 1206 | let job = s:jobs[a:name] 1207 | if job.error 1208 | call add(s:update.errors, a:name) 1209 | elseif get(job, 'new', 0) 1210 | let s:update.new[a:name] = 1 1211 | endif 1212 | let s:update.bar .= job.error ? 'x' : '=' 1213 | 1214 | let bullet = job.error ? 'x' : '-' 1215 | let result = job.error ? join(job.lines, "\n") : s:last_non_empty_line(job.lines) 1216 | call s:log(bullet, a:name, empty(result) ? 'OK' : result) 1217 | call s:bar() 1218 | 1219 | call remove(s:jobs, a:name) 1220 | endfunction 1221 | 1222 | function! s:bar() 1223 | if s:switch_in() 1224 | let total = len(s:update.all) 1225 | call setline(1, (s:update.pull ? 'Updating' : 'Installing'). 1226 | \ ' plugins ('.len(s:update.bar).'/'.total.')') 1227 | call s:progress_bar(2, s:update.bar, total) 1228 | call s:switch_out() 1229 | endif 1230 | endfunction 1231 | 1232 | function! s:logpos(name) 1233 | for i in range(4, line('$')) 1234 | if getline(i) =~# '^[-+x*] '.a:name.':' 1235 | for j in range(i + 1, line('$')) 1236 | if getline(j) !~ '^ ' 1237 | return [i, j - 1] 1238 | endif 1239 | endfor 1240 | return [i, i] 1241 | endif 1242 | endfor 1243 | return [0, 0] 1244 | endfunction 1245 | 1246 | function! s:log(bullet, name, lines) 1247 | if s:switch_in() 1248 | let [b, e] = s:logpos(a:name) 1249 | if b > 0 1250 | silent execute printf('%d,%d d _', b, e) 1251 | if b > winheight('.') 1252 | let b = 4 1253 | endif 1254 | else 1255 | let b = 4 1256 | endif 1257 | " FIXME For some reason, nomodifiable is set after :d in vim8 1258 | setlocal modifiable 1259 | call append(b - 1, s:format_message(a:bullet, a:name, a:lines)) 1260 | call s:switch_out() 1261 | endif 1262 | endfunction 1263 | 1264 | function! s:update_vim() 1265 | let s:jobs = {} 1266 | 1267 | call s:bar() 1268 | call s:tick() 1269 | endfunction 1270 | 1271 | function! s:tick() 1272 | let pull = s:update.pull 1273 | let prog = s:progress_opt(s:nvim || s:vim8) 1274 | while 1 " Without TCO, Vim stack is bound to explode 1275 | if empty(s:update.todo) 1276 | if empty(s:jobs) && !s:update.fin 1277 | call s:update_finish() 1278 | let s:update.fin = 1 1279 | endif 1280 | return 1281 | endif 1282 | 1283 | let name = keys(s:update.todo)[0] 1284 | let spec = remove(s:update.todo, name) 1285 | let new = !isdirectory(spec.dir) 1286 | 1287 | call s:log(new ? '+' : '*', name, pull ? 'Updating ...' : 'Installing ...') 1288 | redraw 1289 | 1290 | let has_tag = has_key(spec, 'tag') 1291 | if !new 1292 | let [error, _] = s:git_validate(spec, 0) 1293 | if empty(error) 1294 | if pull 1295 | let fetch_opt = (has_tag && !empty(globpath(spec.dir, '.git/shallow'))) ? '--depth 99999999' : '' 1296 | call s:spawn(name, printf('git fetch %s %s 2>&1', fetch_opt, prog), { 'dir': spec.dir }) 1297 | else 1298 | let s:jobs[name] = { 'running': 0, 'lines': ['Already installed'], 'error': 0 } 1299 | endif 1300 | else 1301 | let s:jobs[name] = { 'running': 0, 'lines': s:lines(error), 'error': 1 } 1302 | endif 1303 | else 1304 | call s:spawn(name, 1305 | \ printf('git clone %s %s %s %s 2>&1', 1306 | \ has_tag ? '' : s:clone_opt, 1307 | \ prog, 1308 | \ s:shellesc(spec.uri), 1309 | \ s:shellesc(s:trim(spec.dir))), { 'new': 1 }) 1310 | endif 1311 | 1312 | if !s:jobs[name].running 1313 | call s:reap(name) 1314 | endif 1315 | if len(s:jobs) >= s:update.threads 1316 | break 1317 | endif 1318 | endwhile 1319 | endfunction 1320 | 1321 | function! s:update_python() 1322 | let py_exe = has('python') ? 'python' : 'python3' 1323 | execute py_exe "<< EOF" 1324 | import datetime 1325 | import functools 1326 | import os 1327 | try: 1328 | import queue 1329 | except ImportError: 1330 | import Queue as queue 1331 | import random 1332 | import re 1333 | import shutil 1334 | import signal 1335 | import subprocess 1336 | import tempfile 1337 | import threading as thr 1338 | import time 1339 | import traceback 1340 | import vim 1341 | 1342 | G_NVIM = vim.eval("has('nvim')") == '1' 1343 | G_PULL = vim.eval('s:update.pull') == '1' 1344 | G_RETRIES = int(vim.eval('get(g:, "plug_retries", 2)')) + 1 1345 | G_TIMEOUT = int(vim.eval('get(g:, "plug_timeout", 60)')) 1346 | G_CLONE_OPT = vim.eval('s:clone_opt') 1347 | G_PROGRESS = vim.eval('s:progress_opt(1)') 1348 | G_LOG_PROB = 1.0 / int(vim.eval('s:update.threads')) 1349 | G_STOP = thr.Event() 1350 | G_IS_WIN = vim.eval('s:is_win') == '1' 1351 | 1352 | class PlugError(Exception): 1353 | def __init__(self, msg): 1354 | self.msg = msg 1355 | class CmdTimedOut(PlugError): 1356 | pass 1357 | class CmdFailed(PlugError): 1358 | pass 1359 | class InvalidURI(PlugError): 1360 | pass 1361 | class Action(object): 1362 | INSTALL, UPDATE, ERROR, DONE = ['+', '*', 'x', '-'] 1363 | 1364 | class Buffer(object): 1365 | def __init__(self, lock, num_plugs, is_pull): 1366 | self.bar = '' 1367 | self.event = 'Updating' if is_pull else 'Installing' 1368 | self.lock = lock 1369 | self.maxy = int(vim.eval('winheight(".")')) 1370 | self.num_plugs = num_plugs 1371 | 1372 | def __where(self, name): 1373 | """ Find first line with name in current buffer. Return line num. """ 1374 | found, lnum = False, 0 1375 | matcher = re.compile('^[-+x*] {0}:'.format(name)) 1376 | for line in vim.current.buffer: 1377 | if matcher.search(line) is not None: 1378 | found = True 1379 | break 1380 | lnum += 1 1381 | 1382 | if not found: 1383 | lnum = -1 1384 | return lnum 1385 | 1386 | def header(self): 1387 | curbuf = vim.current.buffer 1388 | curbuf[0] = self.event + ' plugins ({0}/{1})'.format(len(self.bar), self.num_plugs) 1389 | 1390 | num_spaces = self.num_plugs - len(self.bar) 1391 | curbuf[1] = '[{0}{1}]'.format(self.bar, num_spaces * ' ') 1392 | 1393 | with self.lock: 1394 | vim.command('normal! 2G') 1395 | vim.command('redraw') 1396 | 1397 | def write(self, action, name, lines): 1398 | first, rest = lines[0], lines[1:] 1399 | msg = ['{0} {1}{2}{3}'.format(action, name, ': ' if first else '', first)] 1400 | msg.extend([' ' + line for line in rest]) 1401 | 1402 | try: 1403 | if action == Action.ERROR: 1404 | self.bar += 'x' 1405 | vim.command("call add(s:update.errors, '{0}')".format(name)) 1406 | elif action == Action.DONE: 1407 | self.bar += '=' 1408 | 1409 | curbuf = vim.current.buffer 1410 | lnum = self.__where(name) 1411 | if lnum != -1: # Found matching line num 1412 | del curbuf[lnum] 1413 | if lnum > self.maxy and action in set([Action.INSTALL, Action.UPDATE]): 1414 | lnum = 3 1415 | else: 1416 | lnum = 3 1417 | curbuf.append(msg, lnum) 1418 | 1419 | self.header() 1420 | except vim.error: 1421 | pass 1422 | 1423 | class Command(object): 1424 | CD = 'cd /d' if G_IS_WIN else 'cd' 1425 | 1426 | def __init__(self, cmd, cmd_dir=None, timeout=60, cb=None, clean=None): 1427 | self.cmd = cmd 1428 | if cmd_dir: 1429 | self.cmd = '{0} {1} && {2}'.format(Command.CD, cmd_dir, self.cmd) 1430 | self.timeout = timeout 1431 | self.callback = cb if cb else (lambda msg: None) 1432 | self.clean = clean if clean else (lambda: None) 1433 | self.proc = None 1434 | 1435 | @property 1436 | def alive(self): 1437 | """ Returns true only if command still running. """ 1438 | return self.proc and self.proc.poll() is None 1439 | 1440 | def execute(self, ntries=3): 1441 | """ Execute the command with ntries if CmdTimedOut. 1442 | Returns the output of the command if no Exception. 1443 | """ 1444 | attempt, finished, limit = 0, False, self.timeout 1445 | 1446 | while not finished: 1447 | try: 1448 | attempt += 1 1449 | result = self.try_command() 1450 | finished = True 1451 | return result 1452 | except CmdTimedOut: 1453 | if attempt != ntries: 1454 | self.notify_retry() 1455 | self.timeout += limit 1456 | else: 1457 | raise 1458 | 1459 | def notify_retry(self): 1460 | """ Retry required for command, notify user. """ 1461 | for count in range(3, 0, -1): 1462 | if G_STOP.is_set(): 1463 | raise KeyboardInterrupt 1464 | msg = 'Timeout. Will retry in {0} second{1} ...'.format( 1465 | count, 's' if count != 1 else '') 1466 | self.callback([msg]) 1467 | time.sleep(1) 1468 | self.callback(['Retrying ...']) 1469 | 1470 | def try_command(self): 1471 | """ Execute a cmd & poll for callback. Returns list of output. 1472 | Raises CmdFailed -> return code for Popen isn't 0 1473 | Raises CmdTimedOut -> command exceeded timeout without new output 1474 | """ 1475 | first_line = True 1476 | 1477 | try: 1478 | tfile = tempfile.NamedTemporaryFile(mode='w+b') 1479 | preexec_fn = not G_IS_WIN and os.setsid or None 1480 | self.proc = subprocess.Popen(self.cmd, stdout=tfile, 1481 | stderr=subprocess.STDOUT, 1482 | stdin=subprocess.PIPE, shell=True, 1483 | preexec_fn=preexec_fn) 1484 | thrd = thr.Thread(target=(lambda proc: proc.wait()), args=(self.proc,)) 1485 | thrd.start() 1486 | 1487 | thread_not_started = True 1488 | while thread_not_started: 1489 | try: 1490 | thrd.join(0.1) 1491 | thread_not_started = False 1492 | except RuntimeError: 1493 | pass 1494 | 1495 | while self.alive: 1496 | if G_STOP.is_set(): 1497 | raise KeyboardInterrupt 1498 | 1499 | if first_line or random.random() < G_LOG_PROB: 1500 | first_line = False 1501 | line = '' if G_IS_WIN else nonblock_read(tfile.name) 1502 | if line: 1503 | self.callback([line]) 1504 | 1505 | time_diff = time.time() - os.path.getmtime(tfile.name) 1506 | if time_diff > self.timeout: 1507 | raise CmdTimedOut(['Timeout!']) 1508 | 1509 | thrd.join(0.5) 1510 | 1511 | tfile.seek(0) 1512 | result = [line.decode('utf-8', 'replace').rstrip() for line in tfile] 1513 | 1514 | if self.proc.returncode != 0: 1515 | raise CmdFailed([''] + result) 1516 | 1517 | return result 1518 | except: 1519 | self.terminate() 1520 | raise 1521 | 1522 | def terminate(self): 1523 | """ Terminate process and cleanup. """ 1524 | if self.alive: 1525 | if G_IS_WIN: 1526 | os.kill(self.proc.pid, signal.SIGINT) 1527 | else: 1528 | os.killpg(self.proc.pid, signal.SIGTERM) 1529 | self.clean() 1530 | 1531 | class Plugin(object): 1532 | def __init__(self, name, args, buf_q, lock): 1533 | self.name = name 1534 | self.args = args 1535 | self.buf_q = buf_q 1536 | self.lock = lock 1537 | self.tag = args.get('tag', 0) 1538 | 1539 | def manage(self): 1540 | try: 1541 | if os.path.exists(self.args['dir']): 1542 | self.update() 1543 | else: 1544 | self.install() 1545 | with self.lock: 1546 | thread_vim_command("let s:update.new['{0}'] = 1".format(self.name)) 1547 | except PlugError as exc: 1548 | self.write(Action.ERROR, self.name, exc.msg) 1549 | except KeyboardInterrupt: 1550 | G_STOP.set() 1551 | self.write(Action.ERROR, self.name, ['Interrupted!']) 1552 | except: 1553 | # Any exception except those above print stack trace 1554 | msg = 'Trace:\n{0}'.format(traceback.format_exc().rstrip()) 1555 | self.write(Action.ERROR, self.name, msg.split('\n')) 1556 | raise 1557 | 1558 | def install(self): 1559 | target = self.args['dir'] 1560 | if target[-1] == '\\': 1561 | target = target[0:-1] 1562 | 1563 | def clean(target): 1564 | def _clean(): 1565 | try: 1566 | shutil.rmtree(target) 1567 | except OSError: 1568 | pass 1569 | return _clean 1570 | 1571 | self.write(Action.INSTALL, self.name, ['Installing ...']) 1572 | callback = functools.partial(self.write, Action.INSTALL, self.name) 1573 | cmd = 'git clone {0} {1} {2} {3} 2>&1'.format( 1574 | '' if self.tag else G_CLONE_OPT, G_PROGRESS, self.args['uri'], 1575 | esc(target)) 1576 | com = Command(cmd, None, G_TIMEOUT, callback, clean(target)) 1577 | result = com.execute(G_RETRIES) 1578 | self.write(Action.DONE, self.name, result[-1:]) 1579 | 1580 | def repo_uri(self): 1581 | cmd = 'git rev-parse --abbrev-ref HEAD 2>&1 && git config -f .git/config remote.origin.url' 1582 | command = Command(cmd, self.args['dir'], G_TIMEOUT,) 1583 | result = command.execute(G_RETRIES) 1584 | return result[-1] 1585 | 1586 | def update(self): 1587 | actual_uri = self.repo_uri() 1588 | expect_uri = self.args['uri'] 1589 | regex = re.compile(r'^(?:\w+://)?(?:[^@/]*@)?([^:/]*(?::[0-9]*)?)[:/](.*?)(?:\.git)?/?$') 1590 | ma = regex.match(actual_uri) 1591 | mb = regex.match(expect_uri) 1592 | if ma is None or mb is None or ma.groups() != mb.groups(): 1593 | msg = ['', 1594 | 'Invalid URI: {0}'.format(actual_uri), 1595 | 'Expected {0}'.format(expect_uri), 1596 | 'PlugClean required.'] 1597 | raise InvalidURI(msg) 1598 | 1599 | if G_PULL: 1600 | self.write(Action.UPDATE, self.name, ['Updating ...']) 1601 | callback = functools.partial(self.write, Action.UPDATE, self.name) 1602 | fetch_opt = '--depth 99999999' if self.tag and os.path.isfile(os.path.join(self.args['dir'], '.git/shallow')) else '' 1603 | cmd = 'git fetch {0} {1} 2>&1'.format(fetch_opt, G_PROGRESS) 1604 | com = Command(cmd, self.args['dir'], G_TIMEOUT, callback) 1605 | result = com.execute(G_RETRIES) 1606 | self.write(Action.DONE, self.name, result[-1:]) 1607 | else: 1608 | self.write(Action.DONE, self.name, ['Already installed']) 1609 | 1610 | def write(self, action, name, msg): 1611 | self.buf_q.put((action, name, msg)) 1612 | 1613 | class PlugThread(thr.Thread): 1614 | def __init__(self, tname, args): 1615 | super(PlugThread, self).__init__() 1616 | self.tname = tname 1617 | self.args = args 1618 | 1619 | def run(self): 1620 | thr.current_thread().name = self.tname 1621 | buf_q, work_q, lock = self.args 1622 | 1623 | try: 1624 | while not G_STOP.is_set(): 1625 | name, args = work_q.get_nowait() 1626 | plug = Plugin(name, args, buf_q, lock) 1627 | plug.manage() 1628 | work_q.task_done() 1629 | except queue.Empty: 1630 | pass 1631 | 1632 | class RefreshThread(thr.Thread): 1633 | def __init__(self, lock): 1634 | super(RefreshThread, self).__init__() 1635 | self.lock = lock 1636 | self.running = True 1637 | 1638 | def run(self): 1639 | while self.running: 1640 | with self.lock: 1641 | thread_vim_command('noautocmd normal! a') 1642 | time.sleep(0.33) 1643 | 1644 | def stop(self): 1645 | self.running = False 1646 | 1647 | if G_NVIM: 1648 | def thread_vim_command(cmd): 1649 | vim.session.threadsafe_call(lambda: vim.command(cmd)) 1650 | else: 1651 | def thread_vim_command(cmd): 1652 | vim.command(cmd) 1653 | 1654 | def esc(name): 1655 | return '"' + name.replace('"', '\"') + '"' 1656 | 1657 | def nonblock_read(fname): 1658 | """ Read a file with nonblock flag. Return the last line. """ 1659 | fread = os.open(fname, os.O_RDONLY | os.O_NONBLOCK) 1660 | buf = os.read(fread, 100000).decode('utf-8', 'replace') 1661 | os.close(fread) 1662 | 1663 | line = buf.rstrip('\r\n') 1664 | left = max(line.rfind('\r'), line.rfind('\n')) 1665 | if left != -1: 1666 | left += 1 1667 | line = line[left:] 1668 | 1669 | return line 1670 | 1671 | def main(): 1672 | thr.current_thread().name = 'main' 1673 | nthreads = int(vim.eval('s:update.threads')) 1674 | plugs = vim.eval('s:update.todo') 1675 | mac_gui = vim.eval('s:mac_gui') == '1' 1676 | 1677 | lock = thr.Lock() 1678 | buf = Buffer(lock, len(plugs), G_PULL) 1679 | buf_q, work_q = queue.Queue(), queue.Queue() 1680 | for work in plugs.items(): 1681 | work_q.put(work) 1682 | 1683 | start_cnt = thr.active_count() 1684 | for num in range(nthreads): 1685 | tname = 'PlugT-{0:02}'.format(num) 1686 | thread = PlugThread(tname, (buf_q, work_q, lock)) 1687 | thread.start() 1688 | if mac_gui: 1689 | rthread = RefreshThread(lock) 1690 | rthread.start() 1691 | 1692 | while not buf_q.empty() or thr.active_count() != start_cnt: 1693 | try: 1694 | action, name, msg = buf_q.get(True, 0.25) 1695 | buf.write(action, name, ['OK'] if not msg else msg) 1696 | buf_q.task_done() 1697 | except queue.Empty: 1698 | pass 1699 | except KeyboardInterrupt: 1700 | G_STOP.set() 1701 | 1702 | if mac_gui: 1703 | rthread.stop() 1704 | rthread.join() 1705 | 1706 | main() 1707 | EOF 1708 | endfunction 1709 | 1710 | function! s:update_ruby() 1711 | ruby << EOF 1712 | module PlugStream 1713 | SEP = ["\r", "\n", nil] 1714 | def get_line 1715 | buffer = '' 1716 | loop do 1717 | char = readchar rescue return 1718 | if SEP.include? char.chr 1719 | buffer << $/ 1720 | break 1721 | else 1722 | buffer << char 1723 | end 1724 | end 1725 | buffer 1726 | end 1727 | end unless defined?(PlugStream) 1728 | 1729 | def esc arg 1730 | %["#{arg.gsub('"', '\"')}"] 1731 | end 1732 | 1733 | def killall pid 1734 | pids = [pid] 1735 | if /mswin|mingw|bccwin/ =~ RUBY_PLATFORM 1736 | pids.each { |pid| Process.kill 'INT', pid.to_i rescue nil } 1737 | else 1738 | unless `which pgrep 2> /dev/null`.empty? 1739 | children = pids 1740 | until children.empty? 1741 | children = children.map { |pid| 1742 | `pgrep -P #{pid}`.lines.map { |l| l.chomp } 1743 | }.flatten 1744 | pids += children 1745 | end 1746 | end 1747 | pids.each { |pid| Process.kill 'TERM', pid.to_i rescue nil } 1748 | end 1749 | end 1750 | 1751 | def compare_git_uri a, b 1752 | regex = %r{^(?:\w+://)?(?:[^@/]*@)?([^:/]*(?::[0-9]*)?)[:/](.*?)(?:\.git)?/?$} 1753 | regex.match(a).to_a.drop(1) == regex.match(b).to_a.drop(1) 1754 | end 1755 | 1756 | require 'thread' 1757 | require 'fileutils' 1758 | require 'timeout' 1759 | running = true 1760 | iswin = VIM::evaluate('s:is_win').to_i == 1 1761 | pull = VIM::evaluate('s:update.pull').to_i == 1 1762 | base = VIM::evaluate('g:plug_home') 1763 | all = VIM::evaluate('s:update.todo') 1764 | limit = VIM::evaluate('get(g:, "plug_timeout", 60)') 1765 | tries = VIM::evaluate('get(g:, "plug_retries", 2)') + 1 1766 | nthr = VIM::evaluate('s:update.threads').to_i 1767 | maxy = VIM::evaluate('winheight(".")').to_i 1768 | cd = iswin ? 'cd /d' : 'cd' 1769 | tot = VIM::evaluate('len(s:update.todo)') || 0 1770 | bar = '' 1771 | skip = 'Already installed' 1772 | mtx = Mutex.new 1773 | take1 = proc { mtx.synchronize { running && all.shift } } 1774 | logh = proc { 1775 | cnt = bar.length 1776 | $curbuf[1] = "#{pull ? 'Updating' : 'Installing'} plugins (#{cnt}/#{tot})" 1777 | $curbuf[2] = '[' + bar.ljust(tot) + ']' 1778 | VIM::command('normal! 2G') 1779 | VIM::command('redraw') 1780 | } 1781 | where = proc { |name| (1..($curbuf.length)).find { |l| $curbuf[l] =~ /^[-+x*] #{name}:/ } } 1782 | log = proc { |name, result, type| 1783 | mtx.synchronize do 1784 | ing = ![true, false].include?(type) 1785 | bar += type ? '=' : 'x' unless ing 1786 | b = case type 1787 | when :install then '+' when :update then '*' 1788 | when true, nil then '-' else 1789 | VIM::command("call add(s:update.errors, '#{name}')") 1790 | 'x' 1791 | end 1792 | result = 1793 | if type || type.nil? 1794 | ["#{b} #{name}: #{result.lines.to_a.last || 'OK'}"] 1795 | elsif result =~ /^Interrupted|^Timeout/ 1796 | ["#{b} #{name}: #{result}"] 1797 | else 1798 | ["#{b} #{name}"] + result.lines.map { |l| " " << l } 1799 | end 1800 | if lnum = where.call(name) 1801 | $curbuf.delete lnum 1802 | lnum = 4 if ing && lnum > maxy 1803 | end 1804 | result.each_with_index do |line, offset| 1805 | $curbuf.append((lnum || 4) - 1 + offset, line.gsub(/\e\[./, '').chomp) 1806 | end 1807 | logh.call 1808 | end 1809 | } 1810 | bt = proc { |cmd, name, type, cleanup| 1811 | tried = timeout = 0 1812 | begin 1813 | tried += 1 1814 | timeout += limit 1815 | fd = nil 1816 | data = '' 1817 | if iswin 1818 | Timeout::timeout(timeout) do 1819 | tmp = VIM::evaluate('tempname()') 1820 | system("(#{cmd}) > #{tmp}") 1821 | data = File.read(tmp).chomp 1822 | File.unlink tmp rescue nil 1823 | end 1824 | else 1825 | fd = IO.popen(cmd).extend(PlugStream) 1826 | first_line = true 1827 | log_prob = 1.0 / nthr 1828 | while line = Timeout::timeout(timeout) { fd.get_line } 1829 | data << line 1830 | log.call name, line.chomp, type if name && (first_line || rand < log_prob) 1831 | first_line = false 1832 | end 1833 | fd.close 1834 | end 1835 | [$? == 0, data.chomp] 1836 | rescue Timeout::Error, Interrupt => e 1837 | if fd && !fd.closed? 1838 | killall fd.pid 1839 | fd.close 1840 | end 1841 | cleanup.call if cleanup 1842 | if e.is_a?(Timeout::Error) && tried < tries 1843 | 3.downto(1) do |countdown| 1844 | s = countdown > 1 ? 's' : '' 1845 | log.call name, "Timeout. Will retry in #{countdown} second#{s} ...", type 1846 | sleep 1 1847 | end 1848 | log.call name, 'Retrying ...', type 1849 | retry 1850 | end 1851 | [false, e.is_a?(Interrupt) ? "Interrupted!" : "Timeout!"] 1852 | end 1853 | } 1854 | main = Thread.current 1855 | threads = [] 1856 | watcher = Thread.new { 1857 | require 'io/console' # >= Ruby 1.9 1858 | nil until IO.console.getch == 3.chr 1859 | mtx.synchronize do 1860 | running = false 1861 | threads.each { |t| t.raise Interrupt } 1862 | end 1863 | threads.each { |t| t.join rescue nil } 1864 | main.kill 1865 | } 1866 | refresh = Thread.new { 1867 | while true 1868 | mtx.synchronize do 1869 | break unless running 1870 | VIM::command('noautocmd normal! a') 1871 | end 1872 | sleep 0.2 1873 | end 1874 | } if VIM::evaluate('s:mac_gui') == 1 1875 | 1876 | clone_opt = VIM::evaluate('s:clone_opt') 1877 | progress = VIM::evaluate('s:progress_opt(1)') 1878 | nthr.times do 1879 | mtx.synchronize do 1880 | threads << Thread.new { 1881 | while pair = take1.call 1882 | name = pair.first 1883 | dir, uri, tag = pair.last.values_at *%w[dir uri tag] 1884 | exists = File.directory? dir 1885 | ok, result = 1886 | if exists 1887 | chdir = "#{cd} #{iswin ? dir : esc(dir)}" 1888 | ret, data = bt.call "#{chdir} && git rev-parse --abbrev-ref HEAD 2>&1 && git config -f .git/config remote.origin.url", nil, nil, nil 1889 | current_uri = data.lines.to_a.last 1890 | if !ret 1891 | if data =~ /^Interrupted|^Timeout/ 1892 | [false, data] 1893 | else 1894 | [false, [data.chomp, "PlugClean required."].join($/)] 1895 | end 1896 | elsif !compare_git_uri(current_uri, uri) 1897 | [false, ["Invalid URI: #{current_uri}", 1898 | "Expected: #{uri}", 1899 | "PlugClean required."].join($/)] 1900 | else 1901 | if pull 1902 | log.call name, 'Updating ...', :update 1903 | fetch_opt = (tag && File.exist?(File.join(dir, '.git/shallow'))) ? '--depth 99999999' : '' 1904 | bt.call "#{chdir} && git fetch #{fetch_opt} #{progress} 2>&1", name, :update, nil 1905 | else 1906 | [true, skip] 1907 | end 1908 | end 1909 | else 1910 | d = esc dir.sub(%r{[\\/]+$}, '') 1911 | log.call name, 'Installing ...', :install 1912 | bt.call "git clone #{clone_opt unless tag} #{progress} #{uri} #{d} 2>&1", name, :install, proc { 1913 | FileUtils.rm_rf dir 1914 | } 1915 | end 1916 | mtx.synchronize { VIM::command("let s:update.new['#{name}'] = 1") } if !exists && ok 1917 | log.call name, result, ok 1918 | end 1919 | } if running 1920 | end 1921 | end 1922 | threads.each { |t| t.join rescue nil } 1923 | logh.call 1924 | refresh.kill if refresh 1925 | watcher.kill 1926 | EOF 1927 | endfunction 1928 | 1929 | function! s:shellesc(arg) 1930 | return '"'.escape(a:arg, '"').'"' 1931 | endfunction 1932 | 1933 | function! s:glob_dir(path) 1934 | return map(filter(s:glob(a:path, '**'), 'isdirectory(v:val)'), 's:dirpath(v:val)') 1935 | endfunction 1936 | 1937 | function! s:progress_bar(line, bar, total) 1938 | call setline(a:line, '[' . s:lpad(a:bar, a:total) . ']') 1939 | endfunction 1940 | 1941 | function! s:compare_git_uri(a, b) 1942 | " See `git help clone' 1943 | " https:// [user@] github.com[:port] / junegunn/vim-plug [.git] 1944 | " [git@] github.com[:port] : junegunn/vim-plug [.git] 1945 | " file:// / junegunn/vim-plug [/] 1946 | " / junegunn/vim-plug [/] 1947 | let pat = '^\%(\w\+://\)\='.'\%([^@/]*@\)\='.'\([^:/]*\%(:[0-9]*\)\=\)'.'[:/]'.'\(.\{-}\)'.'\%(\.git\)\=/\?$' 1948 | let ma = matchlist(a:a, pat) 1949 | let mb = matchlist(a:b, pat) 1950 | return ma[1:2] ==# mb[1:2] 1951 | endfunction 1952 | 1953 | function! s:format_message(bullet, name, message) 1954 | if a:bullet != 'x' 1955 | return [printf('%s %s: %s', a:bullet, a:name, s:lastline(a:message))] 1956 | else 1957 | let lines = map(s:lines(a:message), '" ".v:val') 1958 | return extend([printf('x %s:', a:name)], lines) 1959 | endif 1960 | endfunction 1961 | 1962 | function! s:with_cd(cmd, dir) 1963 | return printf('cd%s %s && %s', s:is_win ? ' /d' : '', s:shellesc(a:dir), a:cmd) 1964 | endfunction 1965 | 1966 | function! s:system(cmd, ...) 1967 | try 1968 | let [sh, shrd] = s:chsh(1) 1969 | let cmd = a:0 > 0 ? s:with_cd(a:cmd, a:1) : a:cmd 1970 | return system(s:is_win ? '('.cmd.')' : cmd) 1971 | finally 1972 | let [&shell, &shellredir] = [sh, shrd] 1973 | endtry 1974 | endfunction 1975 | 1976 | function! s:system_chomp(...) 1977 | let ret = call('s:system', a:000) 1978 | return v:shell_error ? '' : substitute(ret, '\n$', '', '') 1979 | endfunction 1980 | 1981 | function! s:git_validate(spec, check_branch) 1982 | let err = '' 1983 | if isdirectory(a:spec.dir) 1984 | 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)) 1985 | let remote = result[-1] 1986 | if v:shell_error 1987 | let err = join([remote, 'PlugClean required.'], "\n") 1988 | elseif !s:compare_git_uri(remote, a:spec.uri) 1989 | let err = join(['Invalid URI: '.remote, 1990 | \ 'Expected: '.a:spec.uri, 1991 | \ 'PlugClean required.'], "\n") 1992 | elseif a:check_branch && has_key(a:spec, 'commit') 1993 | let result = s:lines(s:system('git rev-parse HEAD 2>&1', a:spec.dir)) 1994 | let sha = result[-1] 1995 | if v:shell_error 1996 | let err = join(add(result, 'PlugClean required.'), "\n") 1997 | elseif !s:hash_match(sha, a:spec.commit) 1998 | let err = join([printf('Invalid HEAD (expected: %s, actual: %s)', 1999 | \ a:spec.commit[:6], sha[:6]), 2000 | \ 'PlugUpdate required.'], "\n") 2001 | endif 2002 | elseif a:check_branch 2003 | let branch = result[0] 2004 | " Check tag 2005 | if has_key(a:spec, 'tag') 2006 | let tag = s:system_chomp('git describe --exact-match --tags HEAD 2>&1', a:spec.dir) 2007 | if a:spec.tag !=# tag 2008 | let err = printf('Invalid tag: %s (expected: %s). Try PlugUpdate.', 2009 | \ (empty(tag) ? 'N/A' : tag), a:spec.tag) 2010 | endif 2011 | " Check branch 2012 | elseif a:spec.branch !=# branch 2013 | let err = printf('Invalid branch: %s (expected: %s). Try PlugUpdate.', 2014 | \ branch, a:spec.branch) 2015 | endif 2016 | if empty(err) 2017 | let [ahead, behind] = split(s:lastline(s:system(printf( 2018 | \ 'git rev-list --count --left-right HEAD...origin/%s', 2019 | \ a:spec.branch), a:spec.dir)), '\t') 2020 | if !v:shell_error && ahead 2021 | if behind 2022 | " Only mention PlugClean if diverged, otherwise it's likely to be 2023 | " pushable (and probably not that messed up). 2024 | let err = printf( 2025 | \ "Diverged from origin/%s (%d commit(s) ahead and %d commit(s) behind!\n" 2026 | \ .'Backup local changes and run PlugClean and PlugUpdate to reinstall it.', a:spec.branch, ahead, behind) 2027 | else 2028 | let err = printf("Ahead of origin/%s by %d commit(s).\n" 2029 | \ .'Cannot update until local changes are pushed.', 2030 | \ a:spec.branch, ahead) 2031 | endif 2032 | endif 2033 | endif 2034 | endif 2035 | else 2036 | let err = 'Not found' 2037 | endif 2038 | return [err, err =~# 'PlugClean'] 2039 | endfunction 2040 | 2041 | function! s:rm_rf(dir) 2042 | if isdirectory(a:dir) 2043 | call s:system((s:is_win ? 'rmdir /S /Q ' : 'rm -rf ') . s:shellesc(a:dir)) 2044 | endif 2045 | endfunction 2046 | 2047 | function! s:clean(force) 2048 | call s:prepare() 2049 | call append(0, 'Searching for invalid plugins in '.g:plug_home) 2050 | call append(1, '') 2051 | 2052 | " List of valid directories 2053 | let dirs = [] 2054 | let errs = {} 2055 | let [cnt, total] = [0, len(g:plugs)] 2056 | for [name, spec] in items(g:plugs) 2057 | if !s:is_managed(name) 2058 | call add(dirs, spec.dir) 2059 | else 2060 | let [err, clean] = s:git_validate(spec, 1) 2061 | if clean 2062 | let errs[spec.dir] = s:lines(err)[0] 2063 | else 2064 | call add(dirs, spec.dir) 2065 | endif 2066 | endif 2067 | let cnt += 1 2068 | call s:progress_bar(2, repeat('=', cnt), total) 2069 | normal! 2G 2070 | redraw 2071 | endfor 2072 | 2073 | let allowed = {} 2074 | for dir in dirs 2075 | let allowed[s:dirpath(fnamemodify(dir, ':h:h'))] = 1 2076 | let allowed[dir] = 1 2077 | for child in s:glob_dir(dir) 2078 | let allowed[child] = 1 2079 | endfor 2080 | endfor 2081 | 2082 | let todo = [] 2083 | let found = sort(s:glob_dir(g:plug_home)) 2084 | while !empty(found) 2085 | let f = remove(found, 0) 2086 | if !has_key(allowed, f) && isdirectory(f) 2087 | call add(todo, f) 2088 | call append(line('$'), '- ' . f) 2089 | if has_key(errs, f) 2090 | call append(line('$'), ' ' . errs[f]) 2091 | endif 2092 | let found = filter(found, 'stridx(v:val, f) != 0') 2093 | end 2094 | endwhile 2095 | 2096 | 4 2097 | redraw 2098 | if empty(todo) 2099 | call append(line('$'), 'Already clean.') 2100 | else 2101 | let s:clean_count = 0 2102 | call append(3, ['Directories to delete:', '']) 2103 | redraw! 2104 | if a:force || s:ask_no_interrupt('Delete all directories?') 2105 | call s:delete([6, line('$')], 1) 2106 | else 2107 | call setline(4, 'Cancelled.') 2108 | nnoremap d :set opfunc=delete_opg@ 2109 | nmap dd d_ 2110 | xnoremap d :call delete_op(visualmode(), 1) 2111 | echo 'Delete the lines (d{motion}) to delete the corresponding directories' 2112 | endif 2113 | endif 2114 | 4 2115 | setlocal nomodifiable 2116 | endfunction 2117 | 2118 | function! s:delete_op(type, ...) 2119 | call s:delete(a:0 ? [line("'<"), line("'>")] : [line("'["), line("']")], 0) 2120 | endfunction 2121 | 2122 | function! s:delete(range, force) 2123 | let [l1, l2] = a:range 2124 | let force = a:force 2125 | while l1 <= l2 2126 | let line = getline(l1) 2127 | if line =~ '^- ' && isdirectory(line[2:]) 2128 | execute l1 2129 | redraw! 2130 | let answer = force ? 1 : s:ask('Delete '.line[2:].'?', 1) 2131 | let force = force || answer > 1 2132 | if answer 2133 | call s:rm_rf(line[2:]) 2134 | setlocal modifiable 2135 | call setline(l1, '~'.line[1:]) 2136 | let s:clean_count += 1 2137 | call setline(4, printf('Removed %d directories.', s:clean_count)) 2138 | setlocal nomodifiable 2139 | endif 2140 | endif 2141 | let l1 += 1 2142 | endwhile 2143 | endfunction 2144 | 2145 | function! s:upgrade() 2146 | echo 'Downloading the latest version of vim-plug' 2147 | redraw 2148 | let tmp = tempname() 2149 | let new = tmp . '/plug.vim' 2150 | 2151 | try 2152 | let out = s:system(printf('git clone --depth 1 %s %s', s:plug_src, tmp)) 2153 | if v:shell_error 2154 | return s:err('Error upgrading vim-plug: '. out) 2155 | endif 2156 | 2157 | if readfile(s:me) ==# readfile(new) 2158 | echo 'vim-plug is already up-to-date' 2159 | return 0 2160 | else 2161 | call rename(s:me, s:me . '.old') 2162 | call rename(new, s:me) 2163 | unlet g:loaded_plug 2164 | echo 'vim-plug has been upgraded' 2165 | return 1 2166 | endif 2167 | finally 2168 | silent! call s:rm_rf(tmp) 2169 | endtry 2170 | endfunction 2171 | 2172 | function! s:upgrade_specs() 2173 | for spec in values(g:plugs) 2174 | let spec.frozen = get(spec, 'frozen', 0) 2175 | endfor 2176 | endfunction 2177 | 2178 | function! s:status() 2179 | call s:prepare() 2180 | call append(0, 'Checking plugins') 2181 | call append(1, '') 2182 | 2183 | let ecnt = 0 2184 | let unloaded = 0 2185 | let [cnt, total] = [0, len(g:plugs)] 2186 | for [name, spec] in items(g:plugs) 2187 | if has_key(spec, 'uri') 2188 | if isdirectory(spec.dir) 2189 | let [err, _] = s:git_validate(spec, 1) 2190 | let [valid, msg] = [empty(err), empty(err) ? 'OK' : err] 2191 | else 2192 | let [valid, msg] = [0, 'Not found. Try PlugInstall.'] 2193 | endif 2194 | else 2195 | if isdirectory(spec.dir) 2196 | let [valid, msg] = [1, 'OK'] 2197 | else 2198 | let [valid, msg] = [0, 'Not found.'] 2199 | endif 2200 | endif 2201 | let cnt += 1 2202 | let ecnt += !valid 2203 | " `s:loaded` entry can be missing if PlugUpgraded 2204 | if valid && get(s:loaded, name, -1) == 0 2205 | let unloaded = 1 2206 | let msg .= ' (not loaded)' 2207 | endif 2208 | call s:progress_bar(2, repeat('=', cnt), total) 2209 | call append(3, s:format_message(valid ? '-' : 'x', name, msg)) 2210 | normal! 2G 2211 | redraw 2212 | endfor 2213 | call setline(1, 'Finished. '.ecnt.' error(s).') 2214 | normal! gg 2215 | setlocal nomodifiable 2216 | if unloaded 2217 | echo "Press 'L' on each line to load plugin, or 'U' to update" 2218 | nnoremap L :call status_load(line('.')) 2219 | xnoremap L :call status_load(line('.')) 2220 | end 2221 | endfunction 2222 | 2223 | function! s:extract_name(str, prefix, suffix) 2224 | return matchstr(a:str, '^'.a:prefix.' \zs[^:]\+\ze:.*'.a:suffix.'$') 2225 | endfunction 2226 | 2227 | function! s:status_load(lnum) 2228 | let line = getline(a:lnum) 2229 | let name = s:extract_name(line, '-', '(not loaded)') 2230 | if !empty(name) 2231 | call plug#load(name) 2232 | setlocal modifiable 2233 | call setline(a:lnum, substitute(line, ' (not loaded)$', '', '')) 2234 | setlocal nomodifiable 2235 | endif 2236 | endfunction 2237 | 2238 | function! s:status_update() range 2239 | let lines = getline(a:firstline, a:lastline) 2240 | let names = filter(map(lines, 's:extract_name(v:val, "[x-]", "")'), '!empty(v:val)') 2241 | if !empty(names) 2242 | echo 2243 | execute 'PlugUpdate' join(names) 2244 | endif 2245 | endfunction 2246 | 2247 | function! s:is_preview_window_open() 2248 | silent! wincmd P 2249 | if &previewwindow 2250 | wincmd p 2251 | return 1 2252 | endif 2253 | endfunction 2254 | 2255 | function! s:find_name(lnum) 2256 | for lnum in reverse(range(1, a:lnum)) 2257 | let line = getline(lnum) 2258 | if empty(line) 2259 | return '' 2260 | endif 2261 | let name = s:extract_name(line, '-', '') 2262 | if !empty(name) 2263 | return name 2264 | endif 2265 | endfor 2266 | return '' 2267 | endfunction 2268 | 2269 | function! s:preview_commit() 2270 | if b:plug_preview < 0 2271 | let b:plug_preview = !s:is_preview_window_open() 2272 | endif 2273 | 2274 | let sha = matchstr(getline('.'), '^ \X*\zs[0-9a-f]\{7}') 2275 | if empty(sha) 2276 | return 2277 | endif 2278 | 2279 | let name = s:find_name(line('.')) 2280 | if empty(name) || !has_key(g:plugs, name) || !isdirectory(g:plugs[name].dir) 2281 | return 2282 | endif 2283 | 2284 | if exists('g:plug_pwindow') && !s:is_preview_window_open() 2285 | execute g:plug_pwindow 2286 | execute 'e' sha 2287 | else 2288 | execute 'pedit' sha 2289 | wincmd P 2290 | endif 2291 | setlocal previewwindow filetype=git buftype=nofile nobuflisted modifiable 2292 | try 2293 | let [sh, shrd] = s:chsh(1) 2294 | execute 'silent %!cd' s:shellesc(g:plugs[name].dir) '&& git show --no-color --pretty=medium' sha 2295 | finally 2296 | let [&shell, &shellredir] = [sh, shrd] 2297 | endtry 2298 | setlocal nomodifiable 2299 | nnoremap q :q 2300 | wincmd p 2301 | endfunction 2302 | 2303 | function! s:section(flags) 2304 | call search('\(^[x-] \)\@<=[^:]\+:', a:flags) 2305 | endfunction 2306 | 2307 | function! s:format_git_log(line) 2308 | let indent = ' ' 2309 | let tokens = split(a:line, nr2char(1)) 2310 | if len(tokens) != 5 2311 | return indent.substitute(a:line, '\s*$', '', '') 2312 | endif 2313 | let [graph, sha, refs, subject, date] = tokens 2314 | let tag = matchstr(refs, 'tag: [^,)]\+') 2315 | let tag = empty(tag) ? ' ' : ' ('.tag.') ' 2316 | return printf('%s%s%s%s%s (%s)', indent, graph, sha, tag, subject, date) 2317 | endfunction 2318 | 2319 | function! s:append_ul(lnum, text) 2320 | call append(a:lnum, ['', a:text, repeat('-', len(a:text))]) 2321 | endfunction 2322 | 2323 | function! s:diff() 2324 | call s:prepare() 2325 | call append(0, ['Collecting changes ...', '']) 2326 | let cnts = [0, 0] 2327 | let bar = '' 2328 | let total = filter(copy(g:plugs), 's:is_managed(v:key) && isdirectory(v:val.dir)') 2329 | call s:progress_bar(2, bar, len(total)) 2330 | for origin in [1, 0] 2331 | let plugs = reverse(sort(items(filter(copy(total), (origin ? '' : '!').'(has_key(v:val, "commit") || has_key(v:val, "tag"))')))) 2332 | if empty(plugs) 2333 | continue 2334 | endif 2335 | call s:append_ul(2, origin ? 'Pending updates:' : 'Last update:') 2336 | for [k, v] in plugs 2337 | let range = origin ? '..origin/'.v.branch : 'HEAD@{1}..' 2338 | let diff = s:system_chomp('git log --graph --color=never --pretty=format:"%x01%h%x01%d%x01%s%x01%cr" '.s:shellesc(range), v.dir) 2339 | if !empty(diff) 2340 | let ref = has_key(v, 'tag') ? (' (tag: '.v.tag.')') : has_key(v, 'commit') ? (' '.v.commit) : '' 2341 | call append(5, extend(['', '- '.k.':'.ref], map(s:lines(diff), 's:format_git_log(v:val)'))) 2342 | let cnts[origin] += 1 2343 | endif 2344 | let bar .= '=' 2345 | call s:progress_bar(2, bar, len(total)) 2346 | normal! 2G 2347 | redraw 2348 | endfor 2349 | if !cnts[origin] 2350 | call append(5, ['', 'N/A']) 2351 | endif 2352 | endfor 2353 | call setline(1, printf('%d plugin(s) updated.', cnts[0]) 2354 | \ . (cnts[1] ? printf(' %d plugin(s) have pending updates.', cnts[1]) : '')) 2355 | 2356 | if cnts[0] || cnts[1] 2357 | nnoremap :silent! call preview_commit() 2358 | nnoremap o :silent! call preview_commit() 2359 | endif 2360 | if cnts[0] 2361 | nnoremap X :call revert() 2362 | echo "Press 'X' on each block to revert the update" 2363 | endif 2364 | normal! gg 2365 | setlocal nomodifiable 2366 | endfunction 2367 | 2368 | function! s:revert() 2369 | if search('^Pending updates', 'bnW') 2370 | return 2371 | endif 2372 | 2373 | let name = s:find_name(line('.')) 2374 | if empty(name) || !has_key(g:plugs, name) || 2375 | \ input(printf('Revert the update of %s? (y/N) ', name)) !~? '^y' 2376 | return 2377 | endif 2378 | 2379 | call s:system('git reset --hard HEAD@{1} && git checkout '.s:esc(g:plugs[name].branch), g:plugs[name].dir) 2380 | setlocal modifiable 2381 | normal! "_dap 2382 | setlocal nomodifiable 2383 | echo 'Reverted' 2384 | endfunction 2385 | 2386 | function! s:snapshot(force, ...) abort 2387 | call s:prepare() 2388 | setf vim 2389 | call append(0, ['" Generated by vim-plug', 2390 | \ '" '.strftime("%c"), 2391 | \ '" :source this file in vim to restore the snapshot', 2392 | \ '" or execute: vim -S snapshot.vim', 2393 | \ '', '', 'PlugUpdate!']) 2394 | 1 2395 | let anchor = line('$') - 3 2396 | let names = sort(keys(filter(copy(g:plugs), 2397 | \'has_key(v:val, "uri") && !has_key(v:val, "commit") && isdirectory(v:val.dir)'))) 2398 | for name in reverse(names) 2399 | let sha = s:system_chomp('git rev-parse --short HEAD', g:plugs[name].dir) 2400 | if !empty(sha) 2401 | call append(anchor, printf("silent! let g:plugs['%s'].commit = '%s'", name, sha)) 2402 | redraw 2403 | endif 2404 | endfor 2405 | 2406 | if a:0 > 0 2407 | let fn = expand(a:1) 2408 | if filereadable(fn) && !(a:force || s:ask(a:1.' already exists. Overwrite?')) 2409 | return 2410 | endif 2411 | call writefile(getline(1, '$'), fn) 2412 | echo 'Saved as '.a:1 2413 | silent execute 'e' s:esc(fn) 2414 | setf vim 2415 | endif 2416 | endfunction 2417 | 2418 | function! s:split_rtp() 2419 | return split(&rtp, '\\\@