From 6909ff08edf10b51caf481f3c70f255b397f0f25 Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Wed, 9 Mar 2022 22:10:10 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=97=91=20Deletes=20pretty=20much=20everyt?= =?UTF-8?q?hing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .dotbot | 1 - bash/bashrc | 47 - tmux/plugins/tmux-continuum | 1 - tmux/plugins/tmux-mem-cpu-load | 1 - tmux/plugins/tmux-online-status | 1 - tmux/plugins/tmux-open | 1 - tmux/plugins/tmux-prefix-highlight | 1 - tmux/plugins/tmux-resurrect | 1 - tmux/plugins/tmux-sensible | 1 - tmux/plugins/tmux-themepack | 1 - tmux/plugins/tmux-yank | 1 - tmux/plugins/tpm | 1 - tmux/tmux.conf | 36 - vim/after/ftplugin/elm.vim | 14 - vim/after/ftplugin/handlebars.vim | 1 - vim/after/ftplugin/html.vim | 1 - vim/after/ftplugin/requirements.vim | 6 - vim/after/ftplugin/sh.vim | 2 - vim/after/ftplugin/sshconfig.vim | 4 - vim/after/ftplugin/typescript.vim | 1 - vim/autoload/plug.vim | 2788 ----------------------- vim/colors/solarized.vim | 1117 ---------- vim/colors/synthwave.vim | 291 --- vim/editor.vim | 537 ----- vim/filetype.vim | 51 - vim/ftdetect/Dockerfile.vim | 8 - vim/ftdetect/cloudformation.vim | 4 - vim/ftdetect/docker-compose.vim | 4 - vim/ftdetect/sshconfig.vim | 4 - vim/ftplugin/Dockerfile.vim | 33 - vim/ftplugin/docker-compose.vim | 5 - vim/ftplugin/gitcommit.vim | 7 - vim/ftplugin/go.vim | 19 - vim/ftplugin/javascript.vim | 67 - vim/ftplugin/markdown.vim | 18 - vim/ftplugin/python.vim | 67 - vim/ftplugin/scss.vim | 13 - vim/ftplugin/typescript-react.vim | 1 - vim/ftplugin/typescript.vim | 21 - vim/ftplugin/vue.vim | 11 - vim/ftplugin/yaml.vim | 38 - vim/indent/Dockerfile.vim | 23 - vim/plugged/Dockerfile.vim | 1 - vim/plugged/SimpylFold | 1 - vim/plugged/ale | 1 - vim/plugged/committia.vim | 1 - vim/plugged/deoplete.nvim | 1 - vim/plugged/dracula | 1 - vim/plugged/fzf.vim | 1 - vim/plugged/incsearch.vim | 1 - vim/plugged/indentpython.vim | 1 - vim/plugged/nerdcommenter | 1 - vim/plugged/nerdtree | 1 - vim/plugged/nginx.vim | 1 - vim/plugged/requirements.txt.vim | 1 - vim/plugged/syntastic | 1 - vim/plugged/tagbar | 1 - vim/plugged/vim-airline | 1 - vim/plugged/vim-css-color | 1 - vim/plugged/vim-devicons | 1 - vim/plugged/vim-fugitive | 1 - vim/plugged/vim-git | 1 - vim/plugged/vim-gitgutter | 1 - vim/plugged/vim-go | 1 - vim/plugged/vim-gutentags | 1 - vim/plugged/vim-javascript | 1 - vim/plugged/vim-json | 1 - vim/plugged/vim-jsx-pretty | 1 - vim/plugged/vim-markdown | 1 - vim/plugged/vim-matchup | 1 - vim/plugged/vim-mustache-handlebars | 1 - vim/plugged/vim-smoothie | 1 - vim/plugged/vim-surround | 1 - vim/plugged/vim-test | 1 - vim/plugged/vim-visual-increment | 1 - vim/plugged/vim-visual-multi | 1 - vim/plugged/vimtex | 1 - vim/plugged/yats.vim | 1 - vim/plugged/zinit-vim-syntax | 1 - vim/plugins.vim | 280 --- vim/snippets/Dockerfile.snippets | 67 - vim/snippets/docker-compose.snippets | 166 -- vim/spell/en.utf-8.add | 7 - vim/syntax/Dockerfile.vim | 59 - vim/syntax/docker-compose.vim | 80 - vim/vimrc | 11 - zsh/aliases/ansible-aliases.zsh | 28 - zsh/aliases/common-aliases.zsh | 94 - zsh/aliases/git-aliases.zsh | 307 --- zsh/aliases/lol-aliases.zsh | 44 - zsh/aliases/npm-aliases.zsh | 61 - zsh/aliases/tmux-aliases.zsh | 97 - zsh/antigen | 1 - zsh/antigen.zsh | 2057 ----------------- zsh/p10k.zsh | 1584 ------------- zsh/plugins/colored-man-pages.zsh | 48 - zsh/plugins/colorize.zsh | 114 - zsh/plugins/docker-auto-complete.zsh | 3049 -------------------------- zsh/plugins/interactive-cd.zsh | 148 -- zsh/plugins/ufw.zsh | 115 - zsh/themes/alicia.zsh-theme | 42 - zsh/themes/angostar.zsh-theme | 370 ---- zsh/zshrc | 49 - 103 files changed, 14165 deletions(-) delete mode 160000 .dotbot delete mode 100644 bash/bashrc delete mode 160000 tmux/plugins/tmux-continuum delete mode 160000 tmux/plugins/tmux-mem-cpu-load delete mode 160000 tmux/plugins/tmux-online-status delete mode 160000 tmux/plugins/tmux-open delete mode 160000 tmux/plugins/tmux-prefix-highlight delete mode 160000 tmux/plugins/tmux-resurrect delete mode 160000 tmux/plugins/tmux-sensible delete mode 160000 tmux/plugins/tmux-themepack delete mode 160000 tmux/plugins/tmux-yank delete mode 120000 tmux/plugins/tpm delete mode 100644 tmux/tmux.conf delete mode 100644 vim/after/ftplugin/elm.vim delete mode 100644 vim/after/ftplugin/handlebars.vim delete mode 100644 vim/after/ftplugin/html.vim delete mode 100644 vim/after/ftplugin/requirements.vim delete mode 100644 vim/after/ftplugin/sh.vim delete mode 100644 vim/after/ftplugin/sshconfig.vim delete mode 100644 vim/after/ftplugin/typescript.vim delete mode 100644 vim/autoload/plug.vim delete mode 100644 vim/colors/solarized.vim delete mode 100644 vim/colors/synthwave.vim delete mode 100644 vim/editor.vim delete mode 100644 vim/filetype.vim delete mode 100644 vim/ftdetect/Dockerfile.vim delete mode 100644 vim/ftdetect/cloudformation.vim delete mode 100644 vim/ftdetect/docker-compose.vim delete mode 100644 vim/ftdetect/sshconfig.vim delete mode 100644 vim/ftplugin/Dockerfile.vim delete mode 100644 vim/ftplugin/docker-compose.vim delete mode 100644 vim/ftplugin/gitcommit.vim delete mode 100644 vim/ftplugin/go.vim delete mode 100644 vim/ftplugin/javascript.vim delete mode 100644 vim/ftplugin/markdown.vim delete mode 100644 vim/ftplugin/python.vim delete mode 100644 vim/ftplugin/scss.vim delete mode 100644 vim/ftplugin/typescript-react.vim delete mode 100644 vim/ftplugin/typescript.vim delete mode 100644 vim/ftplugin/vue.vim delete mode 100644 vim/ftplugin/yaml.vim delete mode 100644 vim/indent/Dockerfile.vim delete mode 160000 vim/plugged/Dockerfile.vim delete mode 160000 vim/plugged/SimpylFold delete mode 160000 vim/plugged/ale delete mode 160000 vim/plugged/committia.vim delete mode 160000 vim/plugged/deoplete.nvim delete mode 160000 vim/plugged/dracula delete mode 160000 vim/plugged/fzf.vim delete mode 160000 vim/plugged/incsearch.vim delete mode 160000 vim/plugged/indentpython.vim delete mode 160000 vim/plugged/nerdcommenter delete mode 160000 vim/plugged/nerdtree delete mode 160000 vim/plugged/nginx.vim delete mode 160000 vim/plugged/requirements.txt.vim delete mode 160000 vim/plugged/syntastic delete mode 160000 vim/plugged/tagbar delete mode 160000 vim/plugged/vim-airline delete mode 160000 vim/plugged/vim-css-color delete mode 160000 vim/plugged/vim-devicons delete mode 160000 vim/plugged/vim-fugitive delete mode 160000 vim/plugged/vim-git delete mode 160000 vim/plugged/vim-gitgutter delete mode 160000 vim/plugged/vim-go delete mode 160000 vim/plugged/vim-gutentags delete mode 160000 vim/plugged/vim-javascript delete mode 160000 vim/plugged/vim-json delete mode 160000 vim/plugged/vim-jsx-pretty delete mode 160000 vim/plugged/vim-markdown delete mode 160000 vim/plugged/vim-matchup delete mode 160000 vim/plugged/vim-mustache-handlebars delete mode 160000 vim/plugged/vim-smoothie delete mode 160000 vim/plugged/vim-surround delete mode 160000 vim/plugged/vim-test delete mode 160000 vim/plugged/vim-visual-increment delete mode 160000 vim/plugged/vim-visual-multi delete mode 160000 vim/plugged/vimtex delete mode 160000 vim/plugged/yats.vim delete mode 160000 vim/plugged/zinit-vim-syntax delete mode 100644 vim/plugins.vim delete mode 100644 vim/snippets/Dockerfile.snippets delete mode 100644 vim/snippets/docker-compose.snippets delete mode 100644 vim/spell/en.utf-8.add delete mode 100644 vim/syntax/Dockerfile.vim delete mode 100644 vim/syntax/docker-compose.vim delete mode 100644 vim/vimrc delete mode 100644 zsh/aliases/ansible-aliases.zsh delete mode 100644 zsh/aliases/common-aliases.zsh delete mode 100644 zsh/aliases/git-aliases.zsh delete mode 100644 zsh/aliases/lol-aliases.zsh delete mode 100644 zsh/aliases/npm-aliases.zsh delete mode 100644 zsh/aliases/tmux-aliases.zsh delete mode 160000 zsh/antigen delete mode 100644 zsh/antigen.zsh delete mode 100644 zsh/p10k.zsh delete mode 100644 zsh/plugins/colored-man-pages.zsh delete mode 100644 zsh/plugins/colorize.zsh delete mode 100644 zsh/plugins/docker-auto-complete.zsh delete mode 100644 zsh/plugins/interactive-cd.zsh delete mode 100644 zsh/plugins/ufw.zsh delete mode 100644 zsh/themes/alicia.zsh-theme delete mode 100644 zsh/themes/angostar.zsh-theme delete mode 100644 zsh/zshrc diff --git a/.dotbot b/.dotbot deleted file mode 160000 index 4ec846c..0000000 --- a/.dotbot +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 4ec846cdad4c5f6996523e7015f0b36a6b40e9f6 diff --git a/bash/bashrc b/bash/bashrc deleted file mode 100644 index 562765a..0000000 --- a/bash/bashrc +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/bash -## Define all the colors -COL_USER_HOST='\e[35m' # The color of 'user@host.ext' -COL_CURSOR='\e[35m' # The color of the trailing cursor arrow -COL_CURRENT_PATH='\e[37m' # The color of the current directory full path -COL_GIT_STATUS_CLEAN='\e[93m' # Color of fresh git branch name, with NO changes -COL_GIT_STATUS_CHANGES='\e[92m' # Color of git branch, affter its diverged from remote -## Text Styles -RESET='\e[0m' # What color will comand outputs be in -BOLD='\e[1m' # BOLD -## Config -SHOW_GIT=false -## If this is a valid git repo, echo the current branch name -parse_git_branch() { - git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' -} -## Echos what color the git branch should be (depending on changes) -check_for_git_changes() { - if [[ "$(parse_git_branch)" ]]; then - if [[ $(git status --porcelain) ]]; then - echo ${COL_GIT_STATUS_CLEAN} - else - echo ${COL_GIT_STATUS_CHANGES} - fi - fi -} -## Build-up what will be the final PS1 string -set_bash_prompt(){ - PS1="${RESET}" - PS1+="${BOLD}${COL_USER_HOST}\u @ \h ${RESET}${COL_CURRENT_PATH}\w " - - if [ "$SHOW_GIT" = true ] ; then - PS1+="$(check_for_git_changes)" - PS1+="$(parse_git_branch)" - fi - - PS1+="\n${COL_CURSOR}└─▶ " - PS1+="${RESET}" -} -## Done, now just set the PS1 prompt :) -PROMPT_COMMAND=set_bash_prompt - -## -if hash zsh 2>/dev/null; then - zsh -fi -source "$HOME/.cargo/env" diff --git a/tmux/plugins/tmux-continuum b/tmux/plugins/tmux-continuum deleted file mode 160000 index 113826b..0000000 --- a/tmux/plugins/tmux-continuum +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 113826b161c1b1e54d2b5b3f26bd2fc8fc46ed92 diff --git a/tmux/plugins/tmux-mem-cpu-load b/tmux/plugins/tmux-mem-cpu-load deleted file mode 160000 index d5007d4..0000000 --- a/tmux/plugins/tmux-mem-cpu-load +++ /dev/null @@ -1 +0,0 @@ -Subproject commit d5007d4694b02f4abd1f9b4dbaf61aaa8345acea diff --git a/tmux/plugins/tmux-online-status b/tmux/plugins/tmux-online-status deleted file mode 160000 index 82f4fbc..0000000 --- a/tmux/plugins/tmux-online-status +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 82f4fbcaee7ece775f37cf7ed201f9d4beab76b8 diff --git a/tmux/plugins/tmux-open b/tmux/plugins/tmux-open deleted file mode 160000 index 5b09bd9..0000000 --- a/tmux/plugins/tmux-open +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 5b09bd955292ae33ef6d3519df09b5bc1b0ff49e diff --git a/tmux/plugins/tmux-prefix-highlight b/tmux/plugins/tmux-prefix-highlight deleted file mode 160000 index 12c4818..0000000 --- a/tmux/plugins/tmux-prefix-highlight +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 12c4818f50aa43f7a637d031f93f122337d92b6f diff --git a/tmux/plugins/tmux-resurrect b/tmux/plugins/tmux-resurrect deleted file mode 160000 index 4a36ded..0000000 --- a/tmux/plugins/tmux-resurrect +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 4a36ded50f89fd03e81ed1013ea9c73381c58160 diff --git a/tmux/plugins/tmux-sensible b/tmux/plugins/tmux-sensible deleted file mode 160000 index e91b178..0000000 --- a/tmux/plugins/tmux-sensible +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e91b178ff832b7bcbbf4d99d9f467f63fd1b76b5 diff --git a/tmux/plugins/tmux-themepack b/tmux/plugins/tmux-themepack deleted file mode 160000 index 7c59902..0000000 --- a/tmux/plugins/tmux-themepack +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 7c59902f64dcd7ea356e891274b21144d1ea5948 diff --git a/tmux/plugins/tmux-yank b/tmux/plugins/tmux-yank deleted file mode 160000 index 1b1a436..0000000 --- a/tmux/plugins/tmux-yank +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 1b1a436e19f095ae8f825243dbe29800a8acd25c diff --git a/tmux/plugins/tpm b/tmux/plugins/tpm deleted file mode 120000 index 484104a..0000000 --- a/tmux/plugins/tpm +++ /dev/null @@ -1 +0,0 @@ -/home/alicia/dotfiles/tmux/tpm \ No newline at end of file diff --git a/tmux/tmux.conf b/tmux/tmux.conf deleted file mode 100644 index 78e6771..0000000 --- a/tmux/tmux.conf +++ /dev/null @@ -1,36 +0,0 @@ -# Import Tmux plugins using TMP -set -g @plugin 'tmux-plugins/tpm' -set -g @plugin 'tmux-plugins/tmux-sensible' -set -g @plugin 'tmux-plugins/tmux-resurrect' -set -g @plugin 'tmux-plugins/tmux-continuum' -set -g @plugin 'tmux-plugins/tmux-yank' -set -g @plugin 'tmux-plugins/tmux-prefix-highlight' -set -g @plugin 'tmux-plugins/tmux-online-status' -set -g @plugin 'tmux-plugins/tmux-open' -set -g @plugin 'tmux-plugins/tmux-open' -set -g @plugin 'jimeh/tmux-themepack' -set -g @plugin 'thewtex/tmux-mem-cpu-load' - -# Set Shell -set -g default-shell /bin/zsh - -# Set Theme -set -g @themepack 'powerline/default/cyan' - -# Automatically restore session -set -g @continuum-restore 'on' - -# Configure Tmux-prefix-highlight -set -g status-right '#{prefix_highlight} | %a %Y-%m-%d %H:%M' - -# Show current internet status -set -g status-right "Online: #{online_status} | %a %h-%d %H:%M " - -# Show system resource usage -set -g status-right "#[fg=green]#($TMUX_PLUGIN_MANAGER_PATH/tmux-mem-cpu-load/tmux-mem-cpu-load --colors --powerline-right --interval 2)#[default]" - -# Use DDG as the default search engine (for Tmux-open) -set -g @open-S 'https://www.duckduckgo.com/' - -# Initialize Tmux plugin manager -run '~/.tmux/plugins/tpm/tpm' diff --git a/vim/after/ftplugin/elm.vim b/vim/after/ftplugin/elm.vim deleted file mode 100644 index d9a98e6..0000000 --- a/vim/after/ftplugin/elm.vim +++ /dev/null @@ -1,14 +0,0 @@ -setlocal foldmethod=syntax -setlocal nospell - -let b:ale_linters = ['elm_ls'] -let b:ale_fixers = ['trim_whitespace', 'remove_trailing_lines', 'elm-format'] -let b:ale_linters_ignore = { 'elm': ['make'] } - -" autocompleting ought to be provided via elm-language-server -" also when coding elm there's an error from deoplete telling -" that elm-oracle is not available -" but then again elm-oracle does not work with 0.19 -" issue <| https://github.com/pbogut/deoplete-elm/issues/3 -let b:deoplete_disable_auto_complete = 1 -let b:ale_completion_enabled = 1 diff --git a/vim/after/ftplugin/handlebars.vim b/vim/after/ftplugin/handlebars.vim deleted file mode 100644 index bf4245d..0000000 --- a/vim/after/ftplugin/handlebars.vim +++ /dev/null @@ -1 +0,0 @@ -let b:ale_fixers = ['trim_whitespace', 'remove_trailing_lines'] diff --git a/vim/after/ftplugin/html.vim b/vim/after/ftplugin/html.vim deleted file mode 100644 index 24952dd..0000000 --- a/vim/after/ftplugin/html.vim +++ /dev/null @@ -1 +0,0 @@ -let b:ale_fixers = ['trim_whitespace', 'remove_trailing_lines', 'prettier'] diff --git a/vim/after/ftplugin/requirements.vim b/vim/after/ftplugin/requirements.vim deleted file mode 100644 index 10fab01..0000000 --- a/vim/after/ftplugin/requirements.vim +++ /dev/null @@ -1,6 +0,0 @@ -fu! s:InstallRequirements() - silent !clear - execute '!' . 'pip install -r ' . bufname('%') -endfu - -:command! -bar InstallRequirements :call s:InstallRequirements() diff --git a/vim/after/ftplugin/sh.vim b/vim/after/ftplugin/sh.vim deleted file mode 100644 index a14c236..0000000 --- a/vim/after/ftplugin/sh.vim +++ /dev/null @@ -1,2 +0,0 @@ -let b:ale_fixers = ['trim_whitespace', 'shfmt'] -let b:ale_linters = ['shellcheck', 'language_server'] diff --git a/vim/after/ftplugin/sshconfig.vim b/vim/after/ftplugin/sshconfig.vim deleted file mode 100644 index 9ce283f..0000000 --- a/vim/after/ftplugin/sshconfig.vim +++ /dev/null @@ -1,4 +0,0 @@ -setlocal nospell -setlocal encoding=utf-8 -setlocal tabstop=2 -setlocal shiftwidth=2 diff --git a/vim/after/ftplugin/typescript.vim b/vim/after/ftplugin/typescript.vim deleted file mode 100644 index 24952dd..0000000 --- a/vim/after/ftplugin/typescript.vim +++ /dev/null @@ -1 +0,0 @@ -let b:ale_fixers = ['trim_whitespace', 'remove_trailing_lines', 'prettier'] diff --git a/vim/autoload/plug.vim b/vim/autoload/plug.vim deleted file mode 100644 index f22e097..0000000 --- a/vim/autoload/plug.vim +++ /dev/null @@ -1,2788 +0,0 @@ -" vim-plug: Vim plugin manager -" ============================ -" -" Download plug.vim and put it in ~/.vim/autoload -" -" curl -fLo ~/.vim/autoload/plug.vim --create-dirs \ -" https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim -" -" Edit your .vimrc -" -" call plug#begin('~/.vim/plugged') -" -" " Make sure you use single quotes -" -" " Shorthand notation; fetches https://github.com/junegunn/vim-easy-align -" Plug 'junegunn/vim-easy-align' -" -" " Any valid git URL is allowed -" Plug 'https://github.com/junegunn/vim-github-dashboard.git' -" -" " Multiple Plug commands can be written in a single line using | separators -" Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets' -" -" " On-demand loading -" Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } -" Plug 'tpope/vim-fireplace', { 'for': 'clojure' } -" -" " Using a non-default branch -" Plug 'rdnetto/YCM-Generator', { 'branch': 'stable' } -" -" " Using a tagged release; wildcard allowed (requires git 1.9.2 or above) -" Plug 'fatih/vim-go', { 'tag': '*' } -" -" " Plugin options -" Plug 'nsf/gocode', { 'tag': 'v.20150303', 'rtp': 'vim' } -" -" " Plugin outside ~/.vim/plugged with post-update hook -" Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } -" -" " Unmanaged plugin (manually installed and updated) -" Plug '~/my-prototype-plugin' -" -" " Initialize plugin system -" call plug#end() -" -" Then reload .vimrc and :PlugInstall to install plugins. -" -" Plug options: -" -"| Option | Description | -"| ----------------------- | ------------------------------------------------ | -"| `branch`/`tag`/`commit` | Branch/tag/commit of the repository to use | -"| `rtp` | Subdirectory that contains Vim plugin | -"| `dir` | Custom directory for the plugin | -"| `as` | Use different name for the plugin | -"| `do` | Post-update hook (string or funcref) | -"| `on` | On-demand loading: Commands or ``-mappings | -"| `for` | On-demand loading: File types | -"| `frozen` | Do not update unless explicitly specified | -" -" More information: https://github.com/junegunn/vim-plug -" -" -" Copyright (c) 2017 Junegunn Choi -" -" MIT License -" -" Permission is hereby granted, free of charge, to any person obtaining -" a copy of this software and associated documentation files (the -" "Software"), to deal in the Software without restriction, including -" without limitation the rights to use, copy, modify, merge, publish, -" distribute, sublicense, and/or sell copies of the Software, and to -" permit persons to whom the Software is furnished to do so, subject to -" the following conditions: -" -" The above copyright notice and this permission notice shall be -" included in all copies or substantial portions of the Software. -" -" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -" NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -" LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -" OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -" WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -if exists('g:loaded_plug') - finish -endif -let g:loaded_plug = 1 - -let s:cpo_save = &cpo -set cpo&vim - -let s:plug_src = 'https://github.com/junegunn/vim-plug.git' -let s:plug_tab = get(s:, 'plug_tab', -1) -let s:plug_buf = get(s:, 'plug_buf', -1) -let s:mac_gui = has('gui_macvim') && has('gui_running') -let s:is_win = has('win32') -let s:nvim = has('nvim-0.2') || (has('nvim') && exists('*jobwait') && !s:is_win) -let s:vim8 = has('patch-8.0.0039') && exists('*job_start') -if s:is_win && &shellslash - set noshellslash - let s:me = resolve(expand(':p')) - set shellslash -else - let s:me = resolve(expand(':p')) -endif -let s:base_spec = { 'branch': '', 'frozen': 0 } -let s:TYPE = { -\ 'string': type(''), -\ 'list': type([]), -\ 'dict': type({}), -\ 'funcref': type(function('call')) -\ } -let s:loaded = get(s:, 'loaded', {}) -let s:triggers = get(s:, 'triggers', {}) - -function! s:isabsolute(dir) abort - return a:dir =~# '^/' || (has('win32') && a:dir =~? '^\%(\\\|[A-Z]:\)') -endfunction - -function! s:git_dir(dir) abort - let gitdir = s:trim(a:dir) . '/.git' - if isdirectory(gitdir) - return gitdir - endif - if !filereadable(gitdir) - return '' - endif - let gitdir = matchstr(get(readfile(gitdir), 0, ''), '^gitdir: \zs.*') - if len(gitdir) && !s:isabsolute(gitdir) - let gitdir = a:dir . '/' . gitdir - endif - return isdirectory(gitdir) ? gitdir : '' -endfunction - -function! s:git_origin_url(dir) abort - let gitdir = s:git_dir(a:dir) - let config = gitdir . '/config' - if empty(gitdir) || !filereadable(config) - return '' - endif - return matchstr(join(readfile(config)), '\[remote "origin"\].\{-}url\s*=\s*\zs\S*\ze') -endfunction - -function! s:git_revision(dir) abort - let gitdir = s:git_dir(a:dir) - let head = gitdir . '/HEAD' - if empty(gitdir) || !filereadable(head) - return '' - endif - - let line = get(readfile(head), 0, '') - let ref = matchstr(line, '^ref: \zs.*') - if empty(ref) - return line - endif - - if filereadable(gitdir . '/' . ref) - return get(readfile(gitdir . '/' . ref), 0, '') - endif - - if filereadable(gitdir . '/packed-refs') - for line in readfile(gitdir . '/packed-refs') - if line =~# ' ' . ref - return matchstr(line, '^[0-9a-f]*') - endif - endfor - endif - - return '' -endfunction - -function! s:git_local_branch(dir) abort - let gitdir = s:git_dir(a:dir) - let head = gitdir . '/HEAD' - if empty(gitdir) || !filereadable(head) - return '' - endif - let branch = matchstr(get(readfile(head), 0, ''), '^ref: refs/heads/\zs.*') - return len(branch) ? branch : 'HEAD' -endfunction - -function! s:git_origin_branch(spec) - if len(a:spec.branch) - return a:spec.branch - endif - - " The file may not be present if this is a local repository - let gitdir = s:git_dir(a:spec.dir) - let origin_head = gitdir.'/refs/remotes/origin/HEAD' - if len(gitdir) && filereadable(origin_head) - return matchstr(get(readfile(origin_head), 0, ''), - \ '^ref: refs/remotes/origin/\zs.*') - endif - - " The command may not return the name of a branch in detached HEAD state - let result = s:lines(s:system('git symbolic-ref --short HEAD', a:spec.dir)) - return v:shell_error ? '' : result[-1] -endfunction - -if s:is_win - function! s:plug_call(fn, ...) - let shellslash = &shellslash - try - set noshellslash - return call(a:fn, a:000) - finally - let &shellslash = shellslash - endtry - endfunction -else - function! s:plug_call(fn, ...) - return call(a:fn, a:000) - endfunction -endif - -function! s:plug_getcwd() - return s:plug_call('getcwd') -endfunction - -function! s:plug_fnamemodify(fname, mods) - return s:plug_call('fnamemodify', a:fname, a:mods) -endfunction - -function! s:plug_expand(fmt) - return s:plug_call('expand', a:fmt, 1) -endfunction - -function! s:plug_tempname() - return s:plug_call('tempname') -endfunction - -function! plug#begin(...) - if a:0 > 0 - let s:plug_home_org = a:1 - let home = s:path(s:plug_fnamemodify(s:plug_expand(a:1), ':p')) - elseif exists('g:plug_home') - let home = s:path(g:plug_home) - elseif !empty(&rtp) - let home = s:path(split(&rtp, ',')[0]) . '/plugged' - else - return s:err('Unable to determine plug home. Try calling plug#begin() with a path argument.') - endif - if s:plug_fnamemodify(home, ':t') ==# 'plugin' && s:plug_fnamemodify(home, ':h') ==# s:first_rtp - return s:err('Invalid plug home. '.home.' is a standard Vim runtime path and is not allowed.') - endif - - let g:plug_home = home - let g:plugs = {} - let g:plugs_order = [] - let s:triggers = {} - - call s:define_commands() - return 1 -endfunction - -function! s:define_commands() - command! -nargs=+ -bar Plug call plug#() - if !executable('git') - return s:err('`git` executable not found. Most commands will not be available. To suppress this message, prepend `silent!` to `call plug#begin(...)`.') - endif - if has('win32') - \ && &shellslash - \ && (&shell =~# 'cmd\(\.exe\)\?$' || &shell =~# 'powershell\(\.exe\)\?$') - return s:err('vim-plug does not support shell, ' . &shell . ', when shellslash is set.') - endif - if !has('nvim') - \ && (has('win32') || has('win32unix')) - \ && !has('multi_byte') - return s:err('Vim needs +multi_byte feature on Windows to run shell commands. Enable +iconv for best results.') - endif - command! -nargs=* -bar -bang -complete=customlist,s:names PlugInstall call s:install(0, []) - command! -nargs=* -bar -bang -complete=customlist,s:names PlugUpdate call s:update(0, []) - command! -nargs=0 -bar -bang PlugClean call s:clean(0) - command! -nargs=0 -bar PlugUpgrade if s:upgrade() | execute 'source' s:esc(s:me) | endif - command! -nargs=0 -bar PlugStatus call s:status() - command! -nargs=0 -bar PlugDiff call s:diff() - command! -nargs=? -bar -bang -complete=file PlugSnapshot call s:snapshot(0, ) -endfunction - -function! s:to_a(v) - return type(a:v) == s:TYPE.list ? a:v : [a:v] -endfunction - -function! s:to_s(v) - return type(a:v) == s:TYPE.string ? a:v : join(a:v, "\n") . "\n" -endfunction - -function! s:glob(from, pattern) - return s:lines(globpath(a:from, a:pattern)) -endfunction - -function! s:source(from, ...) - let found = 0 - for pattern in a:000 - for vim in s:glob(a:from, pattern) - execute 'source' s:esc(vim) - let found = 1 - endfor - endfor - return found -endfunction - -function! s:assoc(dict, key, val) - let a:dict[a:key] = add(get(a:dict, a:key, []), a:val) -endfunction - -function! s:ask(message, ...) - call inputsave() - echohl WarningMsg - let answer = input(a:message.(a:0 ? ' (y/N/a) ' : ' (y/N) ')) - echohl None - call inputrestore() - echo "\r" - return (a:0 && answer =~? '^a') ? 2 : (answer =~? '^y') ? 1 : 0 -endfunction - -function! s:ask_no_interrupt(...) - try - return call('s:ask', a:000) - catch - return 0 - endtry -endfunction - -function! s:lazy(plug, opt) - return has_key(a:plug, a:opt) && - \ (empty(s:to_a(a:plug[a:opt])) || - \ !isdirectory(a:plug.dir) || - \ len(s:glob(s:rtp(a:plug), 'plugin')) || - \ len(s:glob(s:rtp(a:plug), 'after/plugin'))) -endfunction - -function! plug#end() - if !exists('g:plugs') - return s:err('plug#end() called without calling plug#begin() first') - endif - - if exists('#PlugLOD') - augroup PlugLOD - autocmd! - augroup END - augroup! PlugLOD - endif - let lod = { 'ft': {}, 'map': {}, 'cmd': {} } - - if exists('g:did_load_filetypes') - filetype off - endif - for name in g:plugs_order - if !has_key(g:plugs, name) - continue - endif - let plug = g:plugs[name] - if get(s:loaded, name, 0) || !s:lazy(plug, 'on') && !s:lazy(plug, 'for') - let s:loaded[name] = 1 - continue - endif - - if has_key(plug, 'on') - let s:triggers[name] = { 'map': [], 'cmd': [] } - for cmd in s:to_a(plug.on) - if cmd =~? '^.\+' - if empty(mapcheck(cmd)) && empty(mapcheck(cmd, 'i')) - call s:assoc(lod.map, cmd, name) - endif - call add(s:triggers[name].map, cmd) - elseif cmd =~# '^[A-Z]' - let cmd = substitute(cmd, '!*$', '', '') - if exists(':'.cmd) != 2 - call s:assoc(lod.cmd, cmd, name) - endif - call add(s:triggers[name].cmd, cmd) - else - call s:err('Invalid `on` option: '.cmd. - \ '. Should start with an uppercase letter or ``.') - endif - endfor - endif - - if has_key(plug, 'for') - let types = s:to_a(plug.for) - if !empty(types) - augroup filetypedetect - call s:source(s:rtp(plug), 'ftdetect/**/*.vim', 'after/ftdetect/**/*.vim') - augroup END - endif - for type in types - call s:assoc(lod.ft, type, name) - endfor - endif - endfor - - for [cmd, names] in items(lod.cmd) - execute printf( - \ 'command! -nargs=* -range -bang -complete=file %s call s:lod_cmd(%s, "", , , , %s)', - \ cmd, string(cmd), string(names)) - endfor - - for [map, names] in items(lod.map) - for [mode, map_prefix, key_prefix] in - \ [['i', '', ''], ['n', '', ''], ['v', '', 'gv'], ['o', '', '']] - execute printf( - \ '%snoremap %s %s:call lod_map(%s, %s, %s, "%s")', - \ mode, map, map_prefix, string(map), string(names), mode != 'i', key_prefix) - endfor - endfor - - for [ft, names] in items(lod.ft) - augroup PlugLOD - execute printf('autocmd FileType %s call lod_ft(%s, %s)', - \ ft, string(ft), string(names)) - augroup END - endfor - - call s:reorg_rtp() - filetype plugin indent on - if has('vim_starting') - if has('syntax') && !exists('g:syntax_on') - syntax enable - end - else - call s:reload_plugins() - endif -endfunction - -function! s:loaded_names() - return filter(copy(g:plugs_order), 'get(s:loaded, v:val, 0)') -endfunction - -function! s:load_plugin(spec) - call s:source(s:rtp(a:spec), 'plugin/**/*.vim', 'after/plugin/**/*.vim') -endfunction - -function! s:reload_plugins() - for name in s:loaded_names() - call s:load_plugin(g:plugs[name]) - endfor -endfunction - -function! s:trim(str) - return substitute(a:str, '[\/]\+$', '', '') -endfunction - -function! s:version_requirement(val, min) - for idx in range(0, len(a:min) - 1) - let v = get(a:val, idx, 0) - if v < a:min[idx] | return 0 - elseif v > a:min[idx] | return 1 - endif - endfor - return 1 -endfunction - -function! s:git_version_requirement(...) - if !exists('s:git_version') - let s:git_version = map(split(split(s:system(['git', '--version']))[2], '\.'), 'str2nr(v:val)') - endif - return s:version_requirement(s:git_version, a:000) -endfunction - -function! s:progress_opt(base) - return a:base && !s:is_win && - \ s:git_version_requirement(1, 7, 1) ? '--progress' : '' -endfunction - -function! s:rtp(spec) - return s:path(a:spec.dir . get(a:spec, 'rtp', '')) -endfunction - -if s:is_win - function! s:path(path) - return s:trim(substitute(a:path, '/', '\', 'g')) - endfunction - - function! s:dirpath(path) - return s:path(a:path) . '\' - endfunction - - function! s:is_local_plug(repo) - return a:repo =~? '^[a-z]:\|^[%~]' - endfunction - - " Copied from fzf - function! s:wrap_cmds(cmds) - let cmds = [ - \ '@echo off', - \ 'setlocal enabledelayedexpansion'] - \ + (type(a:cmds) == type([]) ? a:cmds : [a:cmds]) - \ + ['endlocal'] - if has('iconv') - if !exists('s:codepage') - let s:codepage = libcallnr('kernel32.dll', 'GetACP', 0) - endif - return map(cmds, printf('iconv(v:val."\r", "%s", "cp%d")', &encoding, s:codepage)) - endif - return map(cmds, 'v:val."\r"') - endfunction - - function! s:batchfile(cmd) - let batchfile = s:plug_tempname().'.bat' - call writefile(s:wrap_cmds(a:cmd), batchfile) - let cmd = plug#shellescape(batchfile, {'shell': &shell, 'script': 0}) - if &shell =~# 'powershell\(\.exe\)\?$' - let cmd = '& ' . cmd - endif - return [batchfile, cmd] - endfunction -else - function! s:path(path) - return s:trim(a:path) - endfunction - - function! s:dirpath(path) - return substitute(a:path, '[/\\]*$', '/', '') - endfunction - - function! s:is_local_plug(repo) - return a:repo[0] =~ '[/$~]' - endfunction -endif - -function! s:err(msg) - echohl ErrorMsg - echom '[vim-plug] '.a:msg - echohl None -endfunction - -function! s:warn(cmd, msg) - echohl WarningMsg - execute a:cmd 'a:msg' - echohl None -endfunction - -function! s:esc(path) - return escape(a:path, ' ') -endfunction - -function! s:escrtp(path) - return escape(a:path, ' ,') -endfunction - -function! s:remove_rtp() - for name in s:loaded_names() - let rtp = s:rtp(g:plugs[name]) - execute 'set rtp-='.s:escrtp(rtp) - let after = globpath(rtp, 'after') - if isdirectory(after) - execute 'set rtp-='.s:escrtp(after) - endif - endfor -endfunction - -function! s:reorg_rtp() - if !empty(s:first_rtp) - execute 'set rtp-='.s:first_rtp - execute 'set rtp-='.s:last_rtp - endif - - " &rtp is modified from outside - if exists('s:prtp') && s:prtp !=# &rtp - call s:remove_rtp() - unlet! s:middle - endif - - let s:middle = get(s:, 'middle', &rtp) - let rtps = map(s:loaded_names(), 's:rtp(g:plugs[v:val])') - let afters = filter(map(copy(rtps), 'globpath(v:val, "after")'), '!empty(v:val)') - let rtp = join(map(rtps, 'escape(v:val, ",")'), ',') - \ . ','.s:middle.',' - \ . join(map(afters, 'escape(v:val, ",")'), ',') - let &rtp = substitute(substitute(rtp, ',,*', ',', 'g'), '^,\|,$', '', 'g') - let s:prtp = &rtp - - if !empty(s:first_rtp) - execute 'set rtp^='.s:first_rtp - execute 'set rtp+='.s:last_rtp - endif -endfunction - -function! s:doautocmd(...) - if exists('#'.join(a:000, '#')) - execute 'doautocmd' ((v:version > 703 || has('patch442')) ? '' : '') join(a:000) - endif -endfunction - -function! s:dobufread(names) - for name in a:names - let path = s:rtp(g:plugs[name]) - for dir in ['ftdetect', 'ftplugin', 'after/ftdetect', 'after/ftplugin'] - if len(finddir(dir, path)) - if exists('#BufRead') - doautocmd BufRead - endif - return - endif - endfor - endfor -endfunction - -function! plug#load(...) - if a:0 == 0 - return s:err('Argument missing: plugin name(s) required') - endif - if !exists('g:plugs') - return s:err('plug#begin was not called') - endif - let names = a:0 == 1 && type(a:1) == s:TYPE.list ? a:1 : a:000 - let unknowns = filter(copy(names), '!has_key(g:plugs, v:val)') - if !empty(unknowns) - let s = len(unknowns) > 1 ? 's' : '' - return s:err(printf('Unknown plugin%s: %s', s, join(unknowns, ', '))) - end - let unloaded = filter(copy(names), '!get(s:loaded, v:val, 0)') - if !empty(unloaded) - for name in unloaded - call s:lod([name], ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin']) - endfor - call s:dobufread(unloaded) - return 1 - end - return 0 -endfunction - -function! s:remove_triggers(name) - if !has_key(s:triggers, a:name) - return - endif - for cmd in s:triggers[a:name].cmd - execute 'silent! delc' cmd - endfor - for map in s:triggers[a:name].map - execute 'silent! unmap' map - execute 'silent! iunmap' map - endfor - call remove(s:triggers, a:name) -endfunction - -function! s:lod(names, types, ...) - for name in a:names - call s:remove_triggers(name) - let s:loaded[name] = 1 - endfor - call s:reorg_rtp() - - for name in a:names - let rtp = s:rtp(g:plugs[name]) - for dir in a:types - call s:source(rtp, dir.'/**/*.vim') - endfor - if a:0 - if !s:source(rtp, a:1) && !empty(s:glob(rtp, a:2)) - execute 'runtime' a:1 - endif - call s:source(rtp, a:2) - endif - call s:doautocmd('User', name) - endfor -endfunction - -function! s:lod_ft(pat, names) - let syn = 'syntax/'.a:pat.'.vim' - call s:lod(a:names, ['plugin', 'after/plugin'], syn, 'after/'.syn) - execute 'autocmd! PlugLOD FileType' a:pat - call s:doautocmd('filetypeplugin', 'FileType') - call s:doautocmd('filetypeindent', 'FileType') -endfunction - -function! s:lod_cmd(cmd, bang, l1, l2, args, names) - call s:lod(a:names, ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin']) - call s:dobufread(a:names) - execute printf('%s%s%s %s', (a:l1 == a:l2 ? '' : (a:l1.','.a:l2)), a:cmd, a:bang, a:args) -endfunction - -function! s:lod_map(map, names, with_prefix, prefix) - call s:lod(a:names, ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin']) - call s:dobufread(a:names) - let extra = '' - while 1 - let c = getchar(0) - if c == 0 - break - endif - let extra .= nr2char(c) - endwhile - - if a:with_prefix - let prefix = v:count ? v:count : '' - let prefix .= '"'.v:register.a:prefix - if mode(1) == 'no' - if v:operator == 'c' - let prefix = "\" . prefix - endif - let prefix .= v:operator - endif - call feedkeys(prefix, 'n') - endif - call feedkeys(substitute(a:map, '^', "\", '') . extra) -endfunction - -function! plug#(repo, ...) - if a:0 > 1 - return s:err('Invalid number of arguments (1..2)') - endif - - try - let repo = s:trim(a:repo) - let opts = a:0 == 1 ? s:parse_options(a:1) : s:base_spec - let name = get(opts, 'as', s:plug_fnamemodify(repo, ':t:s?\.git$??')) - let spec = extend(s:infer_properties(name, repo), opts) - if !has_key(g:plugs, name) - call add(g:plugs_order, name) - endif - let g:plugs[name] = spec - let s:loaded[name] = get(s:loaded, name, 0) - catch - return s:err(repo . ' ' . v:exception) - endtry -endfunction - -function! s:parse_options(arg) - let opts = copy(s:base_spec) - let type = type(a:arg) - let opt_errfmt = 'Invalid argument for "%s" option of :Plug (expected: %s)' - if type == s:TYPE.string - if empty(a:arg) - throw printf(opt_errfmt, 'tag', 'string') - endif - let opts.tag = a:arg - elseif type == s:TYPE.dict - for opt in ['branch', 'tag', 'commit', 'rtp', 'dir', 'as'] - if has_key(a:arg, opt) - \ && (type(a:arg[opt]) != s:TYPE.string || empty(a:arg[opt])) - throw printf(opt_errfmt, opt, 'string') - endif - endfor - for opt in ['on', 'for'] - if has_key(a:arg, opt) - \ && type(a:arg[opt]) != s:TYPE.list - \ && (type(a:arg[opt]) != s:TYPE.string || empty(a:arg[opt])) - throw printf(opt_errfmt, opt, 'string or list') - endif - endfor - if has_key(a:arg, 'do') - \ && type(a:arg.do) != s:TYPE.funcref - \ && (type(a:arg.do) != s:TYPE.string || empty(a:arg.do)) - throw printf(opt_errfmt, 'do', 'string or funcref') - endif - call extend(opts, a:arg) - if has_key(opts, 'dir') - let opts.dir = s:dirpath(s:plug_expand(opts.dir)) - endif - else - throw 'Invalid argument type (expected: string or dictionary)' - endif - return opts -endfunction - -function! s:infer_properties(name, repo) - let repo = a:repo - if s:is_local_plug(repo) - return { 'dir': s:dirpath(s:plug_expand(repo)) } - else - if repo =~ ':' - let uri = repo - else - if repo !~ '/' - throw printf('Invalid argument: %s (implicit `vim-scripts'' expansion is deprecated)', repo) - endif - let fmt = get(g:, 'plug_url_format', 'https://git::@github.com/%s.git') - let uri = printf(fmt, repo) - endif - return { 'dir': s:dirpath(g:plug_home.'/'.a:name), 'uri': uri } - endif -endfunction - -function! s:install(force, names) - call s:update_impl(0, a:force, a:names) -endfunction - -function! s:update(force, names) - call s:update_impl(1, a:force, a:names) -endfunction - -function! plug#helptags() - if !exists('g:plugs') - return s:err('plug#begin was not called') - endif - for spec in values(g:plugs) - let docd = join([s:rtp(spec), 'doc'], '/') - if isdirectory(docd) - silent! execute 'helptags' s:esc(docd) - endif - endfor - return 1 -endfunction - -function! s:syntax() - syntax clear - syntax region plug1 start=/\%1l/ end=/\%2l/ contains=plugNumber - syntax region plug2 start=/\%2l/ end=/\%3l/ contains=plugBracket,plugX - syn match plugNumber /[0-9]\+[0-9.]*/ contained - syn match plugBracket /[[\]]/ contained - syn match plugX /x/ contained - syn match plugDash /^-\{1}\ / - syn match plugPlus /^+/ - syn match plugStar /^*/ - syn match plugMessage /\(^- \)\@<=.*/ - syn match plugName /\(^- \)\@<=[^ ]*:/ - syn match plugSha /\%(: \)\@<=[0-9a-f]\{4,}$/ - syn match plugTag /(tag: [^)]\+)/ - syn match plugInstall /\(^+ \)\@<=[^:]*/ - syn match plugUpdate /\(^* \)\@<=[^:]*/ - syn match plugCommit /^ \X*[0-9a-f]\{7,9} .*/ contains=plugRelDate,plugEdge,plugTag - syn match plugEdge /^ \X\+$/ - syn match plugEdge /^ \X*/ contained nextgroup=plugSha - syn match plugSha /[0-9a-f]\{7,9}/ contained - syn match plugRelDate /([^)]*)$/ contained - syn match plugNotLoaded /(not loaded)$/ - syn match plugError /^x.*/ - syn region plugDeleted start=/^\~ .*/ end=/^\ze\S/ - syn match plugH2 /^.*:\n-\+$/ - syn match plugH2 /^-\{2,}/ - syn keyword Function PlugInstall PlugStatus PlugUpdate PlugClean - hi def link plug1 Title - hi def link plug2 Repeat - hi def link plugH2 Type - hi def link plugX Exception - hi def link plugBracket Structure - hi def link plugNumber Number - - hi def link plugDash Special - hi def link plugPlus Constant - hi def link plugStar Boolean - - hi def link plugMessage Function - hi def link plugName Label - hi def link plugInstall Function - hi def link plugUpdate Type - - hi def link plugError Error - hi def link plugDeleted Ignore - hi def link plugRelDate Comment - hi def link plugEdge PreProc - hi def link plugSha Identifier - hi def link plugTag Constant - - hi def link plugNotLoaded Comment -endfunction - -function! s:lpad(str, len) - return a:str . repeat(' ', a:len - len(a:str)) -endfunction - -function! s:lines(msg) - return split(a:msg, "[\r\n]") -endfunction - -function! s:lastline(msg) - return get(s:lines(a:msg), -1, '') -endfunction - -function! s:new_window() - execute get(g:, 'plug_window', 'vertical topleft new') -endfunction - -function! s:plug_window_exists() - let buflist = tabpagebuflist(s:plug_tab) - return !empty(buflist) && index(buflist, s:plug_buf) >= 0 -endfunction - -function! s:switch_in() - if !s:plug_window_exists() - return 0 - endif - - if winbufnr(0) != s:plug_buf - let s:pos = [tabpagenr(), winnr(), winsaveview()] - execute 'normal!' s:plug_tab.'gt' - let winnr = bufwinnr(s:plug_buf) - execute winnr.'wincmd w' - call add(s:pos, winsaveview()) - else - let s:pos = [winsaveview()] - endif - - setlocal modifiable - return 1 -endfunction - -function! s:switch_out(...) - call winrestview(s:pos[-1]) - setlocal nomodifiable - if a:0 > 0 - execute a:1 - endif - - if len(s:pos) > 1 - execute 'normal!' s:pos[0].'gt' - execute s:pos[1] 'wincmd w' - call winrestview(s:pos[2]) - endif -endfunction - -function! s:finish_bindings() - nnoremap R :call retry() - nnoremap D :PlugDiff - nnoremap S :PlugStatus - nnoremap U :call status_update() - xnoremap U :call status_update() - nnoremap ]] :silent! call section('') - nnoremap [[ :silent! call section('b') -endfunction - -function! s:prepare(...) - if empty(s:plug_getcwd()) - throw 'Invalid current working directory. Cannot proceed.' - endif - - for evar in ['$GIT_DIR', '$GIT_WORK_TREE'] - if exists(evar) - throw evar.' detected. Cannot proceed.' - endif - endfor - - call s:job_abort() - if s:switch_in() - if b:plug_preview == 1 - pc - endif - enew - else - call s:new_window() - endif - - nnoremap q :if b:plug_preview==1pcendifbd - if a:0 == 0 - call s:finish_bindings() - endif - let b:plug_preview = -1 - let s:plug_tab = tabpagenr() - let s:plug_buf = winbufnr(0) - call s:assign_name() - - for k in ['', 'L', 'o', 'X', 'd', 'dd'] - execute 'silent! unmap ' k - endfor - setlocal buftype=nofile bufhidden=wipe nobuflisted nolist noswapfile nowrap cursorline modifiable nospell - if exists('+colorcolumn') - setlocal colorcolumn= - endif - setf vim-plug - if exists('g:syntax_on') - call s:syntax() - endif -endfunction - -function! s:assign_name() - " Assign buffer name - let prefix = '[Plugins]' - let name = prefix - let idx = 2 - while bufexists(name) - let name = printf('%s (%s)', prefix, idx) - let idx = idx + 1 - endwhile - silent! execute 'f' fnameescape(name) -endfunction - -function! s:chsh(swap) - let prev = [&shell, &shellcmdflag, &shellredir] - if !s:is_win - set shell=sh - endif - if a:swap - if &shell =~# 'powershell\(\.exe\)\?$' || &shell =~# 'pwsh$' - let &shellredir = '2>&1 | Out-File -Encoding UTF8 %s' - elseif &shell =~# 'sh' || &shell =~# 'cmd\(\.exe\)\?$' - set shellredir=>%s\ 2>&1 - endif - endif - return prev -endfunction - -function! s:bang(cmd, ...) - let batchfile = '' - try - let [sh, shellcmdflag, shrd] = s:chsh(a:0) - " FIXME: Escaping is incomplete. We could use shellescape with eval, - " but it won't work on Windows. - let cmd = a:0 ? s:with_cd(a:cmd, a:1) : a:cmd - if s:is_win - let [batchfile, cmd] = s:batchfile(cmd) - endif - let g:_plug_bang = (s:is_win && has('gui_running') ? 'silent ' : '').'!'.escape(cmd, '#!%') - execute "normal! :execute g:_plug_bang\\" - finally - unlet g:_plug_bang - let [&shell, &shellcmdflag, &shellredir] = [sh, shellcmdflag, shrd] - if s:is_win && filereadable(batchfile) - call delete(batchfile) - endif - endtry - return v:shell_error ? 'Exit status: ' . v:shell_error : '' -endfunction - -function! s:regress_bar() - let bar = substitute(getline(2)[1:-2], '.*\zs=', 'x', '') - call s:progress_bar(2, bar, len(bar)) -endfunction - -function! s:is_updated(dir) - return !empty(s:system_chomp(['git', 'log', '--pretty=format:%h', 'HEAD...HEAD@{1}'], a:dir)) -endfunction - -function! s:do(pull, force, todo) - for [name, spec] in items(a:todo) - if !isdirectory(spec.dir) - continue - endif - let installed = has_key(s:update.new, name) - let updated = installed ? 0 : - \ (a:pull && index(s:update.errors, name) < 0 && s:is_updated(spec.dir)) - if a:force || installed || updated - execute 'cd' s:esc(spec.dir) - call append(3, '- Post-update hook for '. name .' ... ') - let error = '' - let type = type(spec.do) - if type == s:TYPE.string - if spec.do[0] == ':' - if !get(s:loaded, name, 0) - let s:loaded[name] = 1 - call s:reorg_rtp() - endif - call s:load_plugin(spec) - try - execute spec.do[1:] - catch - let error = v:exception - endtry - if !s:plug_window_exists() - cd - - throw 'Warning: vim-plug was terminated by the post-update hook of '.name - endif - else - let error = s:bang(spec.do) - endif - elseif type == s:TYPE.funcref - try - call s:load_plugin(spec) - let status = installed ? 'installed' : (updated ? 'updated' : 'unchanged') - call spec.do({ 'name': name, 'status': status, 'force': a:force }) - catch - let error = v:exception - endtry - else - let error = 'Invalid hook type' - endif - call s:switch_in() - call setline(4, empty(error) ? (getline(4) . 'OK') - \ : ('x' . getline(4)[1:] . error)) - if !empty(error) - call add(s:update.errors, name) - call s:regress_bar() - endif - cd - - endif - endfor -endfunction - -function! s:hash_match(a, b) - return stridx(a:a, a:b) == 0 || stridx(a:b, a:a) == 0 -endfunction - -function! s:checkout(spec) - let sha = a:spec.commit - let output = s:git_revision(a:spec.dir) - if !empty(output) && !s:hash_match(sha, s:lines(output)[0]) - let credential_helper = s:git_version_requirement(2) ? '-c credential.helper= ' : '' - let output = s:system( - \ 'git '.credential_helper.'fetch --depth 999999 && git checkout '.plug#shellescape(sha).' --', a:spec.dir) - endif - return output -endfunction - -function! s:finish(pull) - let new_frozen = len(filter(keys(s:update.new), 'g:plugs[v:val].frozen')) - if new_frozen - let s = new_frozen > 1 ? 's' : '' - call append(3, printf('- Installed %d frozen plugin%s', new_frozen, s)) - endif - call append(3, '- Finishing ... ') | 4 - redraw - call plug#helptags() - call plug#end() - call setline(4, getline(4) . 'Done!') - redraw - let msgs = [] - if !empty(s:update.errors) - call add(msgs, "Press 'R' to retry.") - endif - if a:pull && len(s:update.new) < len(filter(getline(5, '$'), - \ "v:val =~ '^- ' && v:val !~# 'Already up.to.date'")) - call add(msgs, "Press 'D' to see the updated changes.") - endif - echo join(msgs, ' ') - call s:finish_bindings() -endfunction - -function! s:retry() - if empty(s:update.errors) - return - endif - echo - call s:update_impl(s:update.pull, s:update.force, - \ extend(copy(s:update.errors), [s:update.threads])) -endfunction - -function! s:is_managed(name) - return has_key(g:plugs[a:name], 'uri') -endfunction - -function! s:names(...) - return sort(filter(keys(g:plugs), 'stridx(v:val, a:1) == 0 && s:is_managed(v:val)')) -endfunction - -function! s:check_ruby() - silent! ruby require 'thread'; VIM::command("let g:plug_ruby = '#{RUBY_VERSION}'") - if !exists('g:plug_ruby') - redraw! - return s:warn('echom', 'Warning: Ruby interface is broken') - endif - let ruby_version = split(g:plug_ruby, '\.') - unlet g:plug_ruby - return s:version_requirement(ruby_version, [1, 8, 7]) -endfunction - -function! s:update_impl(pull, force, args) abort - let sync = index(a:args, '--sync') >= 0 || has('vim_starting') - let args = filter(copy(a:args), 'v:val != "--sync"') - let threads = (len(args) > 0 && args[-1] =~ '^[1-9][0-9]*$') ? - \ remove(args, -1) : get(g:, 'plug_threads', 16) - - let managed = filter(copy(g:plugs), 's:is_managed(v:key)') - let todo = empty(args) ? filter(managed, '!v:val.frozen || !isdirectory(v:val.dir)') : - \ filter(managed, 'index(args, v:key) >= 0') - - if empty(todo) - return s:warn('echo', 'No plugin to '. (a:pull ? 'update' : 'install')) - endif - - if !s:is_win && s:git_version_requirement(2, 3) - let s:git_terminal_prompt = exists('$GIT_TERMINAL_PROMPT') ? $GIT_TERMINAL_PROMPT : '' - let $GIT_TERMINAL_PROMPT = 0 - for plug in values(todo) - let plug.uri = substitute(plug.uri, - \ '^https://git::@github\.com', 'https://github.com', '') - endfor - endif - - if !isdirectory(g:plug_home) - try - call mkdir(g:plug_home, 'p') - catch - return s:err(printf('Invalid plug directory: %s. '. - \ 'Try to call plug#begin with a valid directory', g:plug_home)) - endtry - endif - - if has('nvim') && !exists('*jobwait') && threads > 1 - call s:warn('echom', '[vim-plug] Update Neovim for parallel installer') - endif - - let use_job = s:nvim || s:vim8 - let python = (has('python') || has('python3')) && !use_job - let ruby = has('ruby') && !use_job && (v:version >= 703 || v:version == 702 && has('patch374')) && !(s:is_win && has('gui_running')) && threads > 1 && s:check_ruby() - - let s:update = { - \ 'start': reltime(), - \ 'all': todo, - \ 'todo': copy(todo), - \ 'errors': [], - \ 'pull': a:pull, - \ 'force': a:force, - \ 'new': {}, - \ 'threads': (python || ruby || use_job) ? min([len(todo), threads]) : 1, - \ 'bar': '', - \ 'fin': 0 - \ } - - call s:prepare(1) - call append(0, ['', '']) - normal! 2G - silent! redraw - - let s:clone_opt = [] - if get(g:, 'plug_shallow', 1) - call extend(s:clone_opt, ['--depth', '1']) - if s:git_version_requirement(1, 7, 10) - call add(s:clone_opt, '--no-single-branch') - endif - endif - - if has('win32unix') || has('wsl') - call extend(s:clone_opt, ['-c', 'core.eol=lf', '-c', 'core.autocrlf=input']) - endif - - let s:submodule_opt = s:git_version_requirement(2, 8) ? ' --jobs='.threads : '' - - " Python version requirement (>= 2.7) - if python && !has('python3') && !ruby && !use_job && s:update.threads > 1 - redir => pyv - silent python import platform; print platform.python_version() - redir END - let python = s:version_requirement( - \ map(split(split(pyv)[0], '\.'), 'str2nr(v:val)'), [2, 6]) - endif - - if (python || ruby) && s:update.threads > 1 - try - let imd = &imd - if s:mac_gui - set noimd - endif - if ruby - call s:update_ruby() - else - call s:update_python() - endif - catch - let lines = getline(4, '$') - let printed = {} - silent! 4,$d _ - for line in lines - let name = s:extract_name(line, '.', '') - if empty(name) || !has_key(printed, name) - call append('$', line) - if !empty(name) - let printed[name] = 1 - if line[0] == 'x' && index(s:update.errors, name) < 0 - call add(s:update.errors, name) - end - endif - endif - endfor - finally - let &imd = imd - call s:update_finish() - endtry - else - call s:update_vim() - while use_job && sync - sleep 100m - if s:update.fin - break - endif - endwhile - endif -endfunction - -function! s:log4(name, msg) - call setline(4, printf('- %s (%s)', a:msg, a:name)) - redraw -endfunction - -function! s:update_finish() - if exists('s:git_terminal_prompt') - let $GIT_TERMINAL_PROMPT = s:git_terminal_prompt - endif - if s:switch_in() - call append(3, '- Updating ...') | 4 - for [name, spec] in items(filter(copy(s:update.all), 'index(s:update.errors, v:key) < 0 && (s:update.force || s:update.pull || has_key(s:update.new, v:key))')) - let [pos, _] = s:logpos(name) - if !pos - continue - endif - if has_key(spec, 'commit') - call s:log4(name, 'Checking out '.spec.commit) - let out = s:checkout(spec) - elseif has_key(spec, 'tag') - let tag = spec.tag - if tag =~ '\*' - let tags = s:lines(s:system('git tag --list '.plug#shellescape(tag).' --sort -version:refname 2>&1', spec.dir)) - if !v:shell_error && !empty(tags) - let tag = tags[0] - call s:log4(name, printf('Latest tag for %s -> %s', spec.tag, tag)) - call append(3, '') - endif - endif - call s:log4(name, 'Checking out '.tag) - let out = s:system('git checkout -q '.plug#shellescape(tag).' -- 2>&1', spec.dir) - else - let branch = s:git_origin_branch(spec) - call s:log4(name, 'Merging origin/'.s:esc(branch)) - let out = s:system('git checkout -q '.plug#shellescape(branch).' -- 2>&1' - \. (has_key(s:update.new, name) ? '' : ('&& git merge --ff-only '.plug#shellescape('origin/'.branch).' 2>&1')), spec.dir) - endif - if !v:shell_error && filereadable(spec.dir.'/.gitmodules') && - \ (s:update.force || has_key(s:update.new, name) || s:is_updated(spec.dir)) - call s:log4(name, 'Updating submodules. This may take a while.') - let out .= s:bang('git submodule update --init --recursive'.s:submodule_opt.' 2>&1', spec.dir) - endif - let msg = s:format_message(v:shell_error ? 'x': '-', name, out) - if v:shell_error - call add(s:update.errors, name) - call s:regress_bar() - silent execute pos 'd _' - call append(4, msg) | 4 - elseif !empty(out) - call setline(pos, msg[0]) - endif - redraw - endfor - silent 4 d _ - try - call s:do(s:update.pull, s:update.force, filter(copy(s:update.all), 'index(s:update.errors, v:key) < 0 && has_key(v:val, "do")')) - catch - call s:warn('echom', v:exception) - call s:warn('echo', '') - return - endtry - call s:finish(s:update.pull) - call setline(1, 'Updated. Elapsed time: ' . split(reltimestr(reltime(s:update.start)))[0] . ' sec.') - call s:switch_out('normal! gg') - endif -endfunction - -function! s:job_abort() - if (!s:nvim && !s:vim8) || !exists('s:jobs') - return - endif - - for [name, j] in items(s:jobs) - if s:nvim - silent! call jobstop(j.jobid) - elseif s:vim8 - silent! call job_stop(j.jobid) - endif - if j.new - call s:rm_rf(g:plugs[name].dir) - endif - endfor - let s:jobs = {} -endfunction - -function! s:last_non_empty_line(lines) - let len = len(a:lines) - for idx in range(len) - let line = a:lines[len-idx-1] - if !empty(line) - return line - endif - endfor - return '' -endfunction - -function! s:job_out_cb(self, data) abort - let self = a:self - let data = remove(self.lines, -1) . a:data - let lines = map(split(data, "\n", 1), 'split(v:val, "\r", 1)[-1]') - call extend(self.lines, lines) - " To reduce the number of buffer updates - let self.tick = get(self, 'tick', -1) + 1 - if !self.running || self.tick % len(s:jobs) == 0 - let bullet = self.running ? (self.new ? '+' : '*') : (self.error ? 'x' : '-') - let result = self.error ? join(self.lines, "\n") : s:last_non_empty_line(self.lines) - call s:log(bullet, self.name, result) - endif -endfunction - -function! s:job_exit_cb(self, data) abort - let a:self.running = 0 - let a:self.error = a:data != 0 - call s:reap(a:self.name) - call s:tick() -endfunction - -function! s:job_cb(fn, job, ch, data) - if !s:plug_window_exists() " plug window closed - return s:job_abort() - endif - call call(a:fn, [a:job, a:data]) -endfunction - -function! s:nvim_cb(job_id, data, event) dict abort - return (a:event == 'stdout' || a:event == 'stderr') ? - \ s:job_cb('s:job_out_cb', self, 0, join(a:data, "\n")) : - \ s:job_cb('s:job_exit_cb', self, 0, a:data) -endfunction - -function! s:spawn(name, cmd, opts) - let job = { 'name': a:name, 'running': 1, 'error': 0, 'lines': [''], - \ 'new': get(a:opts, 'new', 0) } - let s:jobs[a:name] = job - - if s:nvim - if has_key(a:opts, 'dir') - let job.cwd = a:opts.dir - endif - let argv = a:cmd - call extend(job, { - \ 'on_stdout': function('s:nvim_cb'), - \ 'on_stderr': function('s:nvim_cb'), - \ 'on_exit': function('s:nvim_cb'), - \ }) - let jid = s:plug_call('jobstart', argv, job) - if jid > 0 - let job.jobid = jid - else - let job.running = 0 - let job.error = 1 - let job.lines = [jid < 0 ? argv[0].' is not executable' : - \ 'Invalid arguments (or job table is full)'] - endif - elseif s:vim8 - let cmd = join(map(copy(a:cmd), 'plug#shellescape(v:val, {"script": 0})')) - if has_key(a:opts, 'dir') - let cmd = s:with_cd(cmd, a:opts.dir, 0) - endif - let argv = s:is_win ? ['cmd', '/s', '/c', '"'.cmd.'"'] : ['sh', '-c', cmd] - let jid = job_start(s:is_win ? join(argv, ' ') : argv, { - \ 'out_cb': function('s:job_cb', ['s:job_out_cb', job]), - \ 'err_cb': function('s:job_cb', ['s:job_out_cb', job]), - \ 'exit_cb': function('s:job_cb', ['s:job_exit_cb', job]), - \ 'err_mode': 'raw', - \ 'out_mode': 'raw' - \}) - if job_status(jid) == 'run' - let job.jobid = jid - else - let job.running = 0 - let job.error = 1 - let job.lines = ['Failed to start job'] - endif - else - let job.lines = s:lines(call('s:system', has_key(a:opts, 'dir') ? [a:cmd, a:opts.dir] : [a:cmd])) - let job.error = v:shell_error != 0 - let job.running = 0 - endif -endfunction - -function! s:reap(name) - let job = s:jobs[a:name] - if job.error - call add(s:update.errors, a:name) - elseif get(job, 'new', 0) - let s:update.new[a:name] = 1 - endif - let s:update.bar .= job.error ? 'x' : '=' - - let bullet = job.error ? 'x' : '-' - let result = job.error ? join(job.lines, "\n") : s:last_non_empty_line(job.lines) - call s:log(bullet, a:name, empty(result) ? 'OK' : result) - call s:bar() - - call remove(s:jobs, a:name) -endfunction - -function! s:bar() - if s:switch_in() - let total = len(s:update.all) - call setline(1, (s:update.pull ? 'Updating' : 'Installing'). - \ ' plugins ('.len(s:update.bar).'/'.total.')') - call s:progress_bar(2, s:update.bar, total) - call s:switch_out() - endif -endfunction - -function! s:logpos(name) - let max = line('$') - for i in range(4, max > 4 ? max : 4) - if getline(i) =~# '^[-+x*] '.a:name.':' - for j in range(i + 1, max > 5 ? max : 5) - if getline(j) !~ '^ ' - return [i, j - 1] - endif - endfor - return [i, i] - endif - endfor - return [0, 0] -endfunction - -function! s:log(bullet, name, lines) - if s:switch_in() - let [b, e] = s:logpos(a:name) - if b > 0 - silent execute printf('%d,%d d _', b, e) - if b > winheight('.') - let b = 4 - endif - else - let b = 4 - endif - " FIXME For some reason, nomodifiable is set after :d in vim8 - setlocal modifiable - call append(b - 1, s:format_message(a:bullet, a:name, a:lines)) - call s:switch_out() - endif -endfunction - -function! s:update_vim() - let s:jobs = {} - - call s:bar() - call s:tick() -endfunction - -function! s:tick() - let pull = s:update.pull - let prog = s:progress_opt(s:nvim || s:vim8) -while 1 " Without TCO, Vim stack is bound to explode - if empty(s:update.todo) - if empty(s:jobs) && !s:update.fin - call s:update_finish() - let s:update.fin = 1 - endif - return - endif - - let name = keys(s:update.todo)[0] - let spec = remove(s:update.todo, name) - let new = empty(globpath(spec.dir, '.git', 1)) - - call s:log(new ? '+' : '*', name, pull ? 'Updating ...' : 'Installing ...') - redraw - - let has_tag = has_key(spec, 'tag') - if !new - let [error, _] = s:git_validate(spec, 0) - if empty(error) - if pull - let cmd = s:git_version_requirement(2) ? ['git', '-c', 'credential.helper=', 'fetch'] : ['git', 'fetch'] - if has_tag && !empty(globpath(spec.dir, '.git/shallow')) - call extend(cmd, ['--depth', '99999999']) - endif - if !empty(prog) - call add(cmd, prog) - endif - call s:spawn(name, cmd, { 'dir': spec.dir }) - else - let s:jobs[name] = { 'running': 0, 'lines': ['Already installed'], 'error': 0 } - endif - else - let s:jobs[name] = { 'running': 0, 'lines': s:lines(error), 'error': 1 } - endif - else - let cmd = ['git', 'clone'] - if !has_tag - call extend(cmd, s:clone_opt) - endif - if !empty(prog) - call add(cmd, prog) - endif - call s:spawn(name, extend(cmd, [spec.uri, s:trim(spec.dir)]), { 'new': 1 }) - endif - - if !s:jobs[name].running - call s:reap(name) - endif - if len(s:jobs) >= s:update.threads - break - endif -endwhile -endfunction - -function! s:update_python() -let py_exe = has('python') ? 'python' : 'python3' -execute py_exe "<< EOF" -import datetime -import functools -import os -try: - import queue -except ImportError: - import Queue as queue -import random -import re -import shutil -import signal -import subprocess -import tempfile -import threading as thr -import time -import traceback -import vim - -G_NVIM = vim.eval("has('nvim')") == '1' -G_PULL = vim.eval('s:update.pull') == '1' -G_RETRIES = int(vim.eval('get(g:, "plug_retries", 2)')) + 1 -G_TIMEOUT = int(vim.eval('get(g:, "plug_timeout", 60)')) -G_CLONE_OPT = ' '.join(vim.eval('s:clone_opt')) -G_PROGRESS = vim.eval('s:progress_opt(1)') -G_LOG_PROB = 1.0 / int(vim.eval('s:update.threads')) -G_STOP = thr.Event() -G_IS_WIN = vim.eval('s:is_win') == '1' - -class PlugError(Exception): - def __init__(self, msg): - self.msg = msg -class CmdTimedOut(PlugError): - pass -class CmdFailed(PlugError): - pass -class InvalidURI(PlugError): - pass -class Action(object): - INSTALL, UPDATE, ERROR, DONE = ['+', '*', 'x', '-'] - -class Buffer(object): - def __init__(self, lock, num_plugs, is_pull): - self.bar = '' - self.event = 'Updating' if is_pull else 'Installing' - self.lock = lock - self.maxy = int(vim.eval('winheight(".")')) - self.num_plugs = num_plugs - - def __where(self, name): - """ Find first line with name in current buffer. Return line num. """ - found, lnum = False, 0 - matcher = re.compile('^[-+x*] {0}:'.format(name)) - for line in vim.current.buffer: - if matcher.search(line) is not None: - found = True - break - lnum += 1 - - if not found: - lnum = -1 - return lnum - - def header(self): - curbuf = vim.current.buffer - curbuf[0] = self.event + ' plugins ({0}/{1})'.format(len(self.bar), self.num_plugs) - - num_spaces = self.num_plugs - len(self.bar) - curbuf[1] = '[{0}{1}]'.format(self.bar, num_spaces * ' ') - - with self.lock: - vim.command('normal! 2G') - vim.command('redraw') - - def write(self, action, name, lines): - first, rest = lines[0], lines[1:] - msg = ['{0} {1}{2}{3}'.format(action, name, ': ' if first else '', first)] - msg.extend([' ' + line for line in rest]) - - try: - if action == Action.ERROR: - self.bar += 'x' - vim.command("call add(s:update.errors, '{0}')".format(name)) - elif action == Action.DONE: - self.bar += '=' - - curbuf = vim.current.buffer - lnum = self.__where(name) - if lnum != -1: # Found matching line num - del curbuf[lnum] - if lnum > self.maxy and action in set([Action.INSTALL, Action.UPDATE]): - lnum = 3 - else: - lnum = 3 - curbuf.append(msg, lnum) - - self.header() - except vim.error: - pass - -class Command(object): - CD = 'cd /d' if G_IS_WIN else 'cd' - - def __init__(self, cmd, cmd_dir=None, timeout=60, cb=None, clean=None): - self.cmd = cmd - if cmd_dir: - self.cmd = '{0} {1} && {2}'.format(Command.CD, cmd_dir, self.cmd) - self.timeout = timeout - self.callback = cb if cb else (lambda msg: None) - self.clean = clean if clean else (lambda: None) - self.proc = None - - @property - def alive(self): - """ Returns true only if command still running. """ - return self.proc and self.proc.poll() is None - - def execute(self, ntries=3): - """ Execute the command with ntries if CmdTimedOut. - Returns the output of the command if no Exception. - """ - attempt, finished, limit = 0, False, self.timeout - - while not finished: - try: - attempt += 1 - result = self.try_command() - finished = True - return result - except CmdTimedOut: - if attempt != ntries: - self.notify_retry() - self.timeout += limit - else: - raise - - def notify_retry(self): - """ Retry required for command, notify user. """ - for count in range(3, 0, -1): - if G_STOP.is_set(): - raise KeyboardInterrupt - msg = 'Timeout. Will retry in {0} second{1} ...'.format( - count, 's' if count != 1 else '') - self.callback([msg]) - time.sleep(1) - self.callback(['Retrying ...']) - - def try_command(self): - """ Execute a cmd & poll for callback. Returns list of output. - Raises CmdFailed -> return code for Popen isn't 0 - Raises CmdTimedOut -> command exceeded timeout without new output - """ - first_line = True - - try: - tfile = tempfile.NamedTemporaryFile(mode='w+b') - preexec_fn = not G_IS_WIN and os.setsid or None - self.proc = subprocess.Popen(self.cmd, stdout=tfile, - stderr=subprocess.STDOUT, - stdin=subprocess.PIPE, shell=True, - preexec_fn=preexec_fn) - thrd = thr.Thread(target=(lambda proc: proc.wait()), args=(self.proc,)) - thrd.start() - - thread_not_started = True - while thread_not_started: - try: - thrd.join(0.1) - thread_not_started = False - except RuntimeError: - pass - - while self.alive: - if G_STOP.is_set(): - raise KeyboardInterrupt - - if first_line or random.random() < G_LOG_PROB: - first_line = False - line = '' if G_IS_WIN else nonblock_read(tfile.name) - if line: - self.callback([line]) - - time_diff = time.time() - os.path.getmtime(tfile.name) - if time_diff > self.timeout: - raise CmdTimedOut(['Timeout!']) - - thrd.join(0.5) - - tfile.seek(0) - result = [line.decode('utf-8', 'replace').rstrip() for line in tfile] - - if self.proc.returncode != 0: - raise CmdFailed([''] + result) - - return result - except: - self.terminate() - raise - - def terminate(self): - """ Terminate process and cleanup. """ - if self.alive: - if G_IS_WIN: - os.kill(self.proc.pid, signal.SIGINT) - else: - os.killpg(self.proc.pid, signal.SIGTERM) - self.clean() - -class Plugin(object): - def __init__(self, name, args, buf_q, lock): - self.name = name - self.args = args - self.buf_q = buf_q - self.lock = lock - self.tag = args.get('tag', 0) - - def manage(self): - try: - if os.path.exists(self.args['dir']): - self.update() - else: - self.install() - with self.lock: - thread_vim_command("let s:update.new['{0}'] = 1".format(self.name)) - except PlugError as exc: - self.write(Action.ERROR, self.name, exc.msg) - except KeyboardInterrupt: - G_STOP.set() - self.write(Action.ERROR, self.name, ['Interrupted!']) - except: - # Any exception except those above print stack trace - msg = 'Trace:\n{0}'.format(traceback.format_exc().rstrip()) - self.write(Action.ERROR, self.name, msg.split('\n')) - raise - - def install(self): - target = self.args['dir'] - if target[-1] == '\\': - target = target[0:-1] - - def clean(target): - def _clean(): - try: - shutil.rmtree(target) - except OSError: - pass - return _clean - - self.write(Action.INSTALL, self.name, ['Installing ...']) - callback = functools.partial(self.write, Action.INSTALL, self.name) - cmd = 'git clone {0} {1} {2} {3} 2>&1'.format( - '' if self.tag else G_CLONE_OPT, G_PROGRESS, self.args['uri'], - esc(target)) - com = Command(cmd, None, G_TIMEOUT, callback, clean(target)) - result = com.execute(G_RETRIES) - self.write(Action.DONE, self.name, result[-1:]) - - def repo_uri(self): - cmd = 'git rev-parse --abbrev-ref HEAD 2>&1 && git config -f .git/config remote.origin.url' - command = Command(cmd, self.args['dir'], G_TIMEOUT,) - result = command.execute(G_RETRIES) - return result[-1] - - def update(self): - actual_uri = self.repo_uri() - expect_uri = self.args['uri'] - regex = re.compile(r'^(?:\w+://)?(?:[^@/]*@)?([^:/]*(?::[0-9]*)?)[:/](.*?)(?:\.git)?/?$') - ma = regex.match(actual_uri) - mb = regex.match(expect_uri) - if ma is None or mb is None or ma.groups() != mb.groups(): - msg = ['', - 'Invalid URI: {0}'.format(actual_uri), - 'Expected {0}'.format(expect_uri), - 'PlugClean required.'] - raise InvalidURI(msg) - - if G_PULL: - self.write(Action.UPDATE, self.name, ['Updating ...']) - callback = functools.partial(self.write, Action.UPDATE, self.name) - fetch_opt = '--depth 99999999' if self.tag and os.path.isfile(os.path.join(self.args['dir'], '.git/shallow')) else '' - cmd = 'git fetch {0} {1} 2>&1'.format(fetch_opt, G_PROGRESS) - com = Command(cmd, self.args['dir'], G_TIMEOUT, callback) - result = com.execute(G_RETRIES) - self.write(Action.DONE, self.name, result[-1:]) - else: - self.write(Action.DONE, self.name, ['Already installed']) - - def write(self, action, name, msg): - self.buf_q.put((action, name, msg)) - -class PlugThread(thr.Thread): - def __init__(self, tname, args): - super(PlugThread, self).__init__() - self.tname = tname - self.args = args - - def run(self): - thr.current_thread().name = self.tname - buf_q, work_q, lock = self.args - - try: - while not G_STOP.is_set(): - name, args = work_q.get_nowait() - plug = Plugin(name, args, buf_q, lock) - plug.manage() - work_q.task_done() - except queue.Empty: - pass - -class RefreshThread(thr.Thread): - def __init__(self, lock): - super(RefreshThread, self).__init__() - self.lock = lock - self.running = True - - def run(self): - while self.running: - with self.lock: - thread_vim_command('noautocmd normal! a') - time.sleep(0.33) - - def stop(self): - self.running = False - -if G_NVIM: - def thread_vim_command(cmd): - vim.session.threadsafe_call(lambda: vim.command(cmd)) -else: - def thread_vim_command(cmd): - vim.command(cmd) - -def esc(name): - return '"' + name.replace('"', '\"') + '"' - -def nonblock_read(fname): - """ Read a file with nonblock flag. Return the last line. """ - fread = os.open(fname, os.O_RDONLY | os.O_NONBLOCK) - buf = os.read(fread, 100000).decode('utf-8', 'replace') - os.close(fread) - - line = buf.rstrip('\r\n') - left = max(line.rfind('\r'), line.rfind('\n')) - if left != -1: - left += 1 - line = line[left:] - - return line - -def main(): - thr.current_thread().name = 'main' - nthreads = int(vim.eval('s:update.threads')) - plugs = vim.eval('s:update.todo') - mac_gui = vim.eval('s:mac_gui') == '1' - - lock = thr.Lock() - buf = Buffer(lock, len(plugs), G_PULL) - buf_q, work_q = queue.Queue(), queue.Queue() - for work in plugs.items(): - work_q.put(work) - - start_cnt = thr.active_count() - for num in range(nthreads): - tname = 'PlugT-{0:02}'.format(num) - thread = PlugThread(tname, (buf_q, work_q, lock)) - thread.start() - if mac_gui: - rthread = RefreshThread(lock) - rthread.start() - - while not buf_q.empty() or thr.active_count() != start_cnt: - try: - action, name, msg = buf_q.get(True, 0.25) - buf.write(action, name, ['OK'] if not msg else msg) - buf_q.task_done() - except queue.Empty: - pass - except KeyboardInterrupt: - G_STOP.set() - - if mac_gui: - rthread.stop() - rthread.join() - -main() -EOF -endfunction - -function! s:update_ruby() - ruby << EOF - module PlugStream - SEP = ["\r", "\n", nil] - def get_line - buffer = '' - loop do - char = readchar rescue return - if SEP.include? char.chr - buffer << $/ - break - else - buffer << char - end - end - buffer - end - end unless defined?(PlugStream) - - def esc arg - %["#{arg.gsub('"', '\"')}"] - end - - def killall pid - pids = [pid] - if /mswin|mingw|bccwin/ =~ RUBY_PLATFORM - pids.each { |pid| Process.kill 'INT', pid.to_i rescue nil } - else - unless `which pgrep 2> /dev/null`.empty? - children = pids - until children.empty? - children = children.map { |pid| - `pgrep -P #{pid}`.lines.map { |l| l.chomp } - }.flatten - pids += children - end - end - pids.each { |pid| Process.kill 'TERM', pid.to_i rescue nil } - end - end - - def compare_git_uri a, b - regex = %r{^(?:\w+://)?(?:[^@/]*@)?([^:/]*(?::[0-9]*)?)[:/](.*?)(?:\.git)?/?$} - regex.match(a).to_a.drop(1) == regex.match(b).to_a.drop(1) - end - - require 'thread' - require 'fileutils' - require 'timeout' - running = true - iswin = VIM::evaluate('s:is_win').to_i == 1 - pull = VIM::evaluate('s:update.pull').to_i == 1 - base = VIM::evaluate('g:plug_home') - all = VIM::evaluate('s:update.todo') - limit = VIM::evaluate('get(g:, "plug_timeout", 60)') - tries = VIM::evaluate('get(g:, "plug_retries", 2)') + 1 - nthr = VIM::evaluate('s:update.threads').to_i - maxy = VIM::evaluate('winheight(".")').to_i - vim7 = VIM::evaluate('v:version').to_i <= 703 && RUBY_PLATFORM =~ /darwin/ - cd = iswin ? 'cd /d' : 'cd' - tot = VIM::evaluate('len(s:update.todo)') || 0 - bar = '' - skip = 'Already installed' - mtx = Mutex.new - take1 = proc { mtx.synchronize { running && all.shift } } - logh = proc { - cnt = bar.length - $curbuf[1] = "#{pull ? 'Updating' : 'Installing'} plugins (#{cnt}/#{tot})" - $curbuf[2] = '[' + bar.ljust(tot) + ']' - VIM::command('normal! 2G') - VIM::command('redraw') - } - where = proc { |name| (1..($curbuf.length)).find { |l| $curbuf[l] =~ /^[-+x*] #{name}:/ } } - log = proc { |name, result, type| - mtx.synchronize do - ing = ![true, false].include?(type) - bar += type ? '=' : 'x' unless ing - b = case type - when :install then '+' when :update then '*' - when true, nil then '-' else - VIM::command("call add(s:update.errors, '#{name}')") - 'x' - end - result = - if type || type.nil? - ["#{b} #{name}: #{result.lines.to_a.last || 'OK'}"] - elsif result =~ /^Interrupted|^Timeout/ - ["#{b} #{name}: #{result}"] - else - ["#{b} #{name}"] + result.lines.map { |l| " " << l } - end - if lnum = where.call(name) - $curbuf.delete lnum - lnum = 4 if ing && lnum > maxy - end - result.each_with_index do |line, offset| - $curbuf.append((lnum || 4) - 1 + offset, line.gsub(/\e\[./, '').chomp) - end - logh.call - end - } - bt = proc { |cmd, name, type, cleanup| - tried = timeout = 0 - begin - tried += 1 - timeout += limit - fd = nil - data = '' - if iswin - Timeout::timeout(timeout) do - tmp = VIM::evaluate('tempname()') - system("(#{cmd}) > #{tmp}") - data = File.read(tmp).chomp - File.unlink tmp rescue nil - end - else - fd = IO.popen(cmd).extend(PlugStream) - first_line = true - log_prob = 1.0 / nthr - while line = Timeout::timeout(timeout) { fd.get_line } - data << line - log.call name, line.chomp, type if name && (first_line || rand < log_prob) - first_line = false - end - fd.close - end - [$? == 0, data.chomp] - rescue Timeout::Error, Interrupt => e - if fd && !fd.closed? - killall fd.pid - fd.close - end - cleanup.call if cleanup - if e.is_a?(Timeout::Error) && tried < tries - 3.downto(1) do |countdown| - s = countdown > 1 ? 's' : '' - log.call name, "Timeout. Will retry in #{countdown} second#{s} ...", type - sleep 1 - end - log.call name, 'Retrying ...', type - retry - end - [false, e.is_a?(Interrupt) ? "Interrupted!" : "Timeout!"] - end - } - main = Thread.current - threads = [] - watcher = Thread.new { - if vim7 - while VIM::evaluate('getchar(1)') - sleep 0.1 - end - else - require 'io/console' # >= Ruby 1.9 - nil until IO.console.getch == 3.chr - end - mtx.synchronize do - running = false - threads.each { |t| t.raise Interrupt } unless vim7 - end - threads.each { |t| t.join rescue nil } - main.kill - } - refresh = Thread.new { - while true - mtx.synchronize do - break unless running - VIM::command('noautocmd normal! a') - end - sleep 0.2 - end - } if VIM::evaluate('s:mac_gui') == 1 - - clone_opt = VIM::evaluate('s:clone_opt').join(' ') - progress = VIM::evaluate('s:progress_opt(1)') - nthr.times do - mtx.synchronize do - threads << Thread.new { - while pair = take1.call - name = pair.first - dir, uri, tag = pair.last.values_at *%w[dir uri tag] - exists = File.directory? dir - ok, result = - if exists - chdir = "#{cd} #{iswin ? dir : esc(dir)}" - ret, data = bt.call "#{chdir} && git rev-parse --abbrev-ref HEAD 2>&1 && git config -f .git/config remote.origin.url", nil, nil, nil - current_uri = data.lines.to_a.last - if !ret - if data =~ /^Interrupted|^Timeout/ - [false, data] - else - [false, [data.chomp, "PlugClean required."].join($/)] - end - elsif !compare_git_uri(current_uri, uri) - [false, ["Invalid URI: #{current_uri}", - "Expected: #{uri}", - "PlugClean required."].join($/)] - else - if pull - log.call name, 'Updating ...', :update - fetch_opt = (tag && File.exist?(File.join(dir, '.git/shallow'))) ? '--depth 99999999' : '' - bt.call "#{chdir} && git fetch #{fetch_opt} #{progress} 2>&1", name, :update, nil - else - [true, skip] - end - end - else - d = esc dir.sub(%r{[\\/]+$}, '') - log.call name, 'Installing ...', :install - bt.call "git clone #{clone_opt unless tag} #{progress} #{uri} #{d} 2>&1", name, :install, proc { - FileUtils.rm_rf dir - } - end - mtx.synchronize { VIM::command("let s:update.new['#{name}'] = 1") } if !exists && ok - log.call name, result, ok - end - } if running - end - end - threads.each { |t| t.join rescue nil } - logh.call - refresh.kill if refresh - watcher.kill -EOF -endfunction - -function! s:shellesc_cmd(arg, script) - let escaped = substitute('"'.a:arg.'"', '[&|<>()@^!"]', '^&', 'g') - return substitute(escaped, '%', (a:script ? '%' : '^') . '&', 'g') -endfunction - -function! s:shellesc_ps1(arg) - return "'".substitute(escape(a:arg, '\"'), "'", "''", 'g')."'" -endfunction - -function! s:shellesc_sh(arg) - return "'".substitute(a:arg, "'", "'\\\\''", 'g')."'" -endfunction - -" Escape the shell argument based on the shell. -" Vim and Neovim's shellescape() are insufficient. -" 1. shellslash determines whether to use single/double quotes. -" Double-quote escaping is fragile for cmd.exe. -" 2. It does not work for powershell. -" 3. It does not work for *sh shells if the command is executed -" via cmd.exe (ie. cmd.exe /c sh -c command command_args) -" 4. It does not support batchfile syntax. -" -" Accepts an optional dictionary with the following keys: -" - shell: same as Vim/Neovim 'shell' option. -" If unset, fallback to 'cmd.exe' on Windows or 'sh'. -" - script: If truthy and shell is cmd.exe, escape for batchfile syntax. -function! plug#shellescape(arg, ...) - if a:arg =~# '^[A-Za-z0-9_/:.-]\+$' - return a:arg - endif - let opts = a:0 > 0 && type(a:1) == s:TYPE.dict ? a:1 : {} - let shell = get(opts, 'shell', s:is_win ? 'cmd.exe' : 'sh') - let script = get(opts, 'script', 1) - if shell =~# 'cmd\(\.exe\)\?$' - return s:shellesc_cmd(a:arg, script) - elseif shell =~# 'powershell\(\.exe\)\?$' || shell =~# 'pwsh$' - return s:shellesc_ps1(a:arg) - endif - return s:shellesc_sh(a:arg) -endfunction - -function! s:glob_dir(path) - return map(filter(s:glob(a:path, '**'), 'isdirectory(v:val)'), 's:dirpath(v:val)') -endfunction - -function! s:progress_bar(line, bar, total) - call setline(a:line, '[' . s:lpad(a:bar, a:total) . ']') -endfunction - -function! s:compare_git_uri(a, b) - " See `git help clone' - " https:// [user@] github.com[:port] / junegunn/vim-plug [.git] - " [git@] github.com[:port] : junegunn/vim-plug [.git] - " file:// / junegunn/vim-plug [/] - " / junegunn/vim-plug [/] - let pat = '^\%(\w\+://\)\='.'\%([^@/]*@\)\='.'\([^:/]*\%(:[0-9]*\)\=\)'.'[:/]'.'\(.\{-}\)'.'\%(\.git\)\=/\?$' - let ma = matchlist(a:a, pat) - let mb = matchlist(a:b, pat) - return ma[1:2] ==# mb[1:2] -endfunction - -function! s:format_message(bullet, name, message) - if a:bullet != 'x' - return [printf('%s %s: %s', a:bullet, a:name, s:lastline(a:message))] - else - let lines = map(s:lines(a:message), '" ".v:val') - return extend([printf('x %s:', a:name)], lines) - endif -endfunction - -function! s:with_cd(cmd, dir, ...) - let script = a:0 > 0 ? a:1 : 1 - return printf('cd%s %s && %s', s:is_win ? ' /d' : '', plug#shellescape(a:dir, {'script': script}), a:cmd) -endfunction - -function! s:system(cmd, ...) - let batchfile = '' - try - let [sh, shellcmdflag, shrd] = s:chsh(1) - if type(a:cmd) == s:TYPE.list - " Neovim's system() supports list argument to bypass the shell - " but it cannot set the working directory for the command. - " Assume that the command does not rely on the shell. - if has('nvim') && a:0 == 0 - return system(a:cmd) - endif - let cmd = join(map(copy(a:cmd), 'plug#shellescape(v:val, {"shell": &shell, "script": 0})')) - if &shell =~# 'powershell\(\.exe\)\?$' - let cmd = '& ' . cmd - endif - else - let cmd = a:cmd - endif - if a:0 > 0 - let cmd = s:with_cd(cmd, a:1, type(a:cmd) != s:TYPE.list) - endif - if s:is_win && type(a:cmd) != s:TYPE.list - let [batchfile, cmd] = s:batchfile(cmd) - endif - return system(cmd) - finally - let [&shell, &shellcmdflag, &shellredir] = [sh, shellcmdflag, shrd] - if s:is_win && filereadable(batchfile) - call delete(batchfile) - endif - endtry -endfunction - -function! s:system_chomp(...) - let ret = call('s:system', a:000) - return v:shell_error ? '' : substitute(ret, '\n$', '', '') -endfunction - -function! s:git_validate(spec, check_branch) - let err = '' - if isdirectory(a:spec.dir) - let result = [s:git_local_branch(a:spec.dir), s:git_origin_url(a:spec.dir)] - let remote = result[-1] - if empty(remote) - let err = join([remote, 'PlugClean required.'], "\n") - elseif !s:compare_git_uri(remote, a:spec.uri) - let err = join(['Invalid URI: '.remote, - \ 'Expected: '.a:spec.uri, - \ 'PlugClean required.'], "\n") - elseif a:check_branch && has_key(a:spec, 'commit') - let sha = s:git_revision(a:spec.dir) - if empty(sha) - let err = join(add(result, 'PlugClean required.'), "\n") - elseif !s:hash_match(sha, a:spec.commit) - let err = join([printf('Invalid HEAD (expected: %s, actual: %s)', - \ a:spec.commit[:6], sha[:6]), - \ 'PlugUpdate required.'], "\n") - endif - elseif a:check_branch - let current_branch = result[0] - " Check tag - let origin_branch = s:git_origin_branch(a:spec) - if has_key(a:spec, 'tag') - let tag = s:system_chomp('git describe --exact-match --tags HEAD 2>&1', a:spec.dir) - if a:spec.tag !=# tag && a:spec.tag !~ '\*' - let err = printf('Invalid tag: %s (expected: %s). Try PlugUpdate.', - \ (empty(tag) ? 'N/A' : tag), a:spec.tag) - endif - " Check branch - elseif origin_branch !=# current_branch - let err = printf('Invalid branch: %s (expected: %s). Try PlugUpdate.', - \ current_branch, origin_branch) - endif - if empty(err) - let [ahead, behind] = split(s:lastline(s:system([ - \ 'git', 'rev-list', '--count', '--left-right', - \ printf('HEAD...origin/%s', origin_branch) - \ ], a:spec.dir)), '\t') - if !v:shell_error && ahead - if behind - " Only mention PlugClean if diverged, otherwise it's likely to be - " pushable (and probably not that messed up). - let err = printf( - \ "Diverged from origin/%s (%d commit(s) ahead and %d commit(s) behind!\n" - \ .'Backup local changes and run PlugClean and PlugUpdate to reinstall it.', origin_branch, ahead, behind) - else - let err = printf("Ahead of origin/%s by %d commit(s).\n" - \ .'Cannot update until local changes are pushed.', - \ origin_branch, ahead) - endif - endif - endif - endif - else - let err = 'Not found' - endif - return [err, err =~# 'PlugClean'] -endfunction - -function! s:rm_rf(dir) - if isdirectory(a:dir) - return s:system(s:is_win - \ ? 'rmdir /S /Q '.plug#shellescape(a:dir) - \ : ['rm', '-rf', a:dir]) - endif -endfunction - -function! s:clean(force) - call s:prepare() - call append(0, 'Searching for invalid plugins in '.g:plug_home) - call append(1, '') - - " List of valid directories - let dirs = [] - let errs = {} - let [cnt, total] = [0, len(g:plugs)] - for [name, spec] in items(g:plugs) - if !s:is_managed(name) - call add(dirs, spec.dir) - else - let [err, clean] = s:git_validate(spec, 1) - if clean - let errs[spec.dir] = s:lines(err)[0] - else - call add(dirs, spec.dir) - endif - endif - let cnt += 1 - call s:progress_bar(2, repeat('=', cnt), total) - normal! 2G - redraw - endfor - - let allowed = {} - for dir in dirs - let allowed[s:dirpath(s:plug_fnamemodify(dir, ':h:h'))] = 1 - let allowed[dir] = 1 - for child in s:glob_dir(dir) - let allowed[child] = 1 - endfor - endfor - - let todo = [] - let found = sort(s:glob_dir(g:plug_home)) - while !empty(found) - let f = remove(found, 0) - if !has_key(allowed, f) && isdirectory(f) - call add(todo, f) - call append(line('$'), '- ' . f) - if has_key(errs, f) - call append(line('$'), ' ' . errs[f]) - endif - let found = filter(found, 'stridx(v:val, f) != 0') - end - endwhile - - 4 - redraw - if empty(todo) - call append(line('$'), 'Already clean.') - else - let s:clean_count = 0 - call append(3, ['Directories to delete:', '']) - redraw! - if a:force || s:ask_no_interrupt('Delete all directories?') - call s:delete([6, line('$')], 1) - else - call setline(4, 'Cancelled.') - nnoremap d :set opfunc=delete_opg@ - nmap dd d_ - xnoremap d :call delete_op(visualmode(), 1) - echo 'Delete the lines (d{motion}) to delete the corresponding directories' - endif - endif - 4 - setlocal nomodifiable -endfunction - -function! s:delete_op(type, ...) - call s:delete(a:0 ? [line("'<"), line("'>")] : [line("'["), line("']")], 0) -endfunction - -function! s:delete(range, force) - let [l1, l2] = a:range - let force = a:force - let err_count = 0 - while l1 <= l2 - let line = getline(l1) - if line =~ '^- ' && isdirectory(line[2:]) - execute l1 - redraw! - let answer = force ? 1 : s:ask('Delete '.line[2:].'?', 1) - let force = force || answer > 1 - if answer - let err = s:rm_rf(line[2:]) - setlocal modifiable - if empty(err) - call setline(l1, '~'.line[1:]) - let s:clean_count += 1 - else - delete _ - call append(l1 - 1, s:format_message('x', line[1:], err)) - let l2 += len(s:lines(err)) - let err_count += 1 - endif - let msg = printf('Removed %d directories.', s:clean_count) - if err_count > 0 - let msg .= printf(' Failed to remove %d directories.', err_count) - endif - call setline(4, msg) - setlocal nomodifiable - endif - endif - let l1 += 1 - endwhile -endfunction - -function! s:upgrade() - echo 'Downloading the latest version of vim-plug' - redraw - let tmp = s:plug_tempname() - let new = tmp . '/plug.vim' - - try - let out = s:system(['git', 'clone', '--depth', '1', s:plug_src, tmp]) - if v:shell_error - return s:err('Error upgrading vim-plug: '. out) - endif - - if readfile(s:me) ==# readfile(new) - echo 'vim-plug is already up-to-date' - return 0 - else - call rename(s:me, s:me . '.old') - call rename(new, s:me) - unlet g:loaded_plug - echo 'vim-plug has been upgraded' - return 1 - endif - finally - silent! call s:rm_rf(tmp) - endtry -endfunction - -function! s:upgrade_specs() - for spec in values(g:plugs) - let spec.frozen = get(spec, 'frozen', 0) - endfor -endfunction - -function! s:status() - call s:prepare() - call append(0, 'Checking plugins') - call append(1, '') - - let ecnt = 0 - let unloaded = 0 - let [cnt, total] = [0, len(g:plugs)] - for [name, spec] in items(g:plugs) - let is_dir = isdirectory(spec.dir) - if has_key(spec, 'uri') - if is_dir - let [err, _] = s:git_validate(spec, 1) - let [valid, msg] = [empty(err), empty(err) ? 'OK' : err] - else - let [valid, msg] = [0, 'Not found. Try PlugInstall.'] - endif - else - if is_dir - let [valid, msg] = [1, 'OK'] - else - let [valid, msg] = [0, 'Not found.'] - endif - endif - let cnt += 1 - let ecnt += !valid - " `s:loaded` entry can be missing if PlugUpgraded - if is_dir && get(s:loaded, name, -1) == 0 - let unloaded = 1 - let msg .= ' (not loaded)' - endif - call s:progress_bar(2, repeat('=', cnt), total) - call append(3, s:format_message(valid ? '-' : 'x', name, msg)) - normal! 2G - redraw - endfor - call setline(1, 'Finished. '.ecnt.' error(s).') - normal! gg - setlocal nomodifiable - if unloaded - echo "Press 'L' on each line to load plugin, or 'U' to update" - nnoremap L :call status_load(line('.')) - xnoremap L :call status_load(line('.')) - end -endfunction - -function! s:extract_name(str, prefix, suffix) - return matchstr(a:str, '^'.a:prefix.' \zs[^:]\+\ze:.*'.a:suffix.'$') -endfunction - -function! s:status_load(lnum) - let line = getline(a:lnum) - let name = s:extract_name(line, '-', '(not loaded)') - if !empty(name) - call plug#load(name) - setlocal modifiable - call setline(a:lnum, substitute(line, ' (not loaded)$', '', '')) - setlocal nomodifiable - endif -endfunction - -function! s:status_update() range - let lines = getline(a:firstline, a:lastline) - let names = filter(map(lines, 's:extract_name(v:val, "[x-]", "")'), '!empty(v:val)') - if !empty(names) - echo - execute 'PlugUpdate' join(names) - endif -endfunction - -function! s:is_preview_window_open() - silent! wincmd P - if &previewwindow - wincmd p - return 1 - endif -endfunction - -function! s:find_name(lnum) - for lnum in reverse(range(1, a:lnum)) - let line = getline(lnum) - if empty(line) - return '' - endif - let name = s:extract_name(line, '-', '') - if !empty(name) - return name - endif - endfor - return '' -endfunction - -function! s:preview_commit() - if b:plug_preview < 0 - let b:plug_preview = !s:is_preview_window_open() - endif - - let sha = matchstr(getline('.'), '^ \X*\zs[0-9a-f]\{7,9}') - if empty(sha) - return - endif - - let name = s:find_name(line('.')) - if empty(name) || !has_key(g:plugs, name) || !isdirectory(g:plugs[name].dir) - return - endif - - if exists('g:plug_pwindow') && !s:is_preview_window_open() - execute g:plug_pwindow - execute 'e' sha - else - execute 'pedit' sha - wincmd P - endif - setlocal previewwindow filetype=git buftype=nofile nobuflisted modifiable - let batchfile = '' - try - let [sh, shellcmdflag, shrd] = s:chsh(1) - let cmd = 'cd '.plug#shellescape(g:plugs[name].dir).' && git show --no-color --pretty=medium '.sha - if s:is_win - let [batchfile, cmd] = s:batchfile(cmd) - endif - execute 'silent %!' cmd - finally - let [&shell, &shellcmdflag, &shellredir] = [sh, shellcmdflag, shrd] - if s:is_win && filereadable(batchfile) - call delete(batchfile) - endif - endtry - setlocal nomodifiable - nnoremap q :q - wincmd p -endfunction - -function! s:section(flags) - call search('\(^[x-] \)\@<=[^:]\+:', a:flags) -endfunction - -function! s:format_git_log(line) - let indent = ' ' - let tokens = split(a:line, nr2char(1)) - if len(tokens) != 5 - return indent.substitute(a:line, '\s*$', '', '') - endif - let [graph, sha, refs, subject, date] = tokens - let tag = matchstr(refs, 'tag: [^,)]\+') - let tag = empty(tag) ? ' ' : ' ('.tag.') ' - return printf('%s%s%s%s%s (%s)', indent, graph, sha, tag, subject, date) -endfunction - -function! s:append_ul(lnum, text) - call append(a:lnum, ['', a:text, repeat('-', len(a:text))]) -endfunction - -function! s:diff() - call s:prepare() - call append(0, ['Collecting changes ...', '']) - let cnts = [0, 0] - let bar = '' - let total = filter(copy(g:plugs), 's:is_managed(v:key) && isdirectory(v:val.dir)') - call s:progress_bar(2, bar, len(total)) - for origin in [1, 0] - let plugs = reverse(sort(items(filter(copy(total), (origin ? '' : '!').'(has_key(v:val, "commit") || has_key(v:val, "tag"))')))) - if empty(plugs) - continue - endif - call s:append_ul(2, origin ? 'Pending updates:' : 'Last update:') - for [k, v] in plugs - let branch = s:git_origin_branch(v) - if len(branch) - let range = origin ? '..origin/'.branch : 'HEAD@{1}..' - let cmd = ['git', 'log', '--graph', '--color=never'] - if s:git_version_requirement(2, 10, 0) - call add(cmd, '--no-show-signature') - endif - call extend(cmd, ['--pretty=format:%x01%h%x01%d%x01%s%x01%cr', range]) - if has_key(v, 'rtp') - call extend(cmd, ['--', v.rtp]) - endif - let diff = s:system_chomp(cmd, v.dir) - if !empty(diff) - let ref = has_key(v, 'tag') ? (' (tag: '.v.tag.')') : has_key(v, 'commit') ? (' '.v.commit) : '' - call append(5, extend(['', '- '.k.':'.ref], map(s:lines(diff), 's:format_git_log(v:val)'))) - let cnts[origin] += 1 - endif - endif - let bar .= '=' - call s:progress_bar(2, bar, len(total)) - normal! 2G - redraw - endfor - if !cnts[origin] - call append(5, ['', 'N/A']) - endif - endfor - call setline(1, printf('%d plugin(s) updated.', cnts[0]) - \ . (cnts[1] ? printf(' %d plugin(s) have pending updates.', cnts[1]) : '')) - - if cnts[0] || cnts[1] - nnoremap (plug-preview) :silent! call preview_commit() - if empty(maparg("\", 'n')) - nmap (plug-preview) - endif - if empty(maparg('o', 'n')) - nmap o (plug-preview) - endif - endif - if cnts[0] - nnoremap X :call revert() - echo "Press 'X' on each block to revert the update" - endif - normal! gg - setlocal nomodifiable -endfunction - -function! s:revert() - if search('^Pending updates', 'bnW') - return - endif - - let name = s:find_name(line('.')) - if empty(name) || !has_key(g:plugs, name) || - \ input(printf('Revert the update of %s? (y/N) ', name)) !~? '^y' - return - endif - - call s:system('git reset --hard HEAD@{1} && git checkout '.plug#shellescape(g:plugs[name].branch).' --', g:plugs[name].dir) - setlocal modifiable - normal! "_dap - setlocal nomodifiable - echo 'Reverted' -endfunction - -function! s:snapshot(force, ...) abort - call s:prepare() - setf vim - call append(0, ['" Generated by vim-plug', - \ '" '.strftime("%c"), - \ '" :source this file in vim to restore the snapshot', - \ '" or execute: vim -S snapshot.vim', - \ '', '', 'PlugUpdate!']) - 1 - let anchor = line('$') - 3 - let names = sort(keys(filter(copy(g:plugs), - \'has_key(v:val, "uri") && !has_key(v:val, "commit") && isdirectory(v:val.dir)'))) - for name in reverse(names) - let sha = s:git_revision(g:plugs[name].dir) - if !empty(sha) - call append(anchor, printf("silent! let g:plugs['%s'].commit = '%s'", name, sha)) - redraw - endif - endfor - - if a:0 > 0 - let fn = s:plug_expand(a:1) - if filereadable(fn) && !(a:force || s:ask(a:1.' already exists. Overwrite?')) - return - endif - call writefile(getline(1, '$'), fn) - echo 'Saved as '.a:1 - silent execute 'e' s:esc(fn) - setf vim - endif -endfunction - -function! s:split_rtp() - return split(&rtp, '\\\@ -" URL: http://ethanschoonover.com/solarized -" (see this url for latest release & screenshots) -" License: OSI approved MIT license (see end of this file) -" Created: In the middle of the night -" Modified: 2011 May 05 -" -" Usage "{{{ -" -" --------------------------------------------------------------------- -" ABOUT: -" --------------------------------------------------------------------- -" Solarized is a carefully designed selective contrast colorscheme with dual -" light and dark modes that runs in both GUI, 256 and 16 color modes. -" -" See the homepage above for screenshots and details. -" -" --------------------------------------------------------------------- -" OPTIONS: -" --------------------------------------------------------------------- -" See the "solarized.txt" help file included with this colorscheme (in the -" "doc" subdirectory) for information on options, usage, the Toggle Background -" function and more. If you have already installed Solarized, this is available -" from the Solarized menu and command line as ":help solarized" -" -" --------------------------------------------------------------------- -" INSTALLATION: -" --------------------------------------------------------------------- -" Two options for installation: manual or pathogen -" -" MANUAL INSTALLATION OPTION: -" --------------------------------------------------------------------- -" -" 1. Download the solarized distribution (available on the homepage above) -" and unarchive the file. -" 2. Move `solarized.vim` to your `.vim/colors` directory. -" 3. Move each of the files in each subdirectories to the corresponding .vim -" subdirectory (e.g. autoload/togglebg.vim goes into your .vim/autoload -" directory as .vim/autoload/togglebg.vim). -" -" RECOMMENDED PATHOGEN INSTALLATION OPTION: -" --------------------------------------------------------------------- -" -" 1. Download and install Tim Pope's Pathogen from: -" https://github.com/tpope/vim-pathogen -" -" 2. Next, move or clone the `vim-colors-solarized` directory so that it is -" a subdirectory of the `.vim/bundle` directory. -" -" a. **clone with git:** -" -" $ cd ~/.vim/bundle -" $ git clone git://github.com/altercation/vim-colors-solarized.git -" -" b. **or move manually into the pathogen bundle directory:** -" In the parent directory of vim-colors-solarized: -" -" $ mv vim-colors-solarized ~/.vim/bundle/ -" -" MODIFY VIMRC: -" -" After either Option 1 or Option 2 above, put the following two lines in your -" .vimrc: -" -" syntax enable -" set background=dark -" colorscheme solarized -" -" or, for the light background mode of Solarized: -" -" syntax enable -" set background=light -" colorscheme solarized -" -" I like to have a different background in GUI and terminal modes, so I can use -" the following if-then. However, I find vim's background autodetection to be -" pretty good and, at least with MacVim, I can leave this background value -" assignment out entirely and get the same results. -" -" if has('gui_running') -" set background=light -" else -" set background=dark -" endif -" -" See the Solarized homepage at http://ethanschoonover.com/solarized for -" screenshots which will help you select either the light or dark background. -" -" --------------------------------------------------------------------- -" COLOR VALUES -" --------------------------------------------------------------------- -" Download palettes and files from: http://ethanschoonover.com/solarized -" -" L\*a\*b values are canonical (White D65, Reference D50), other values are -" matched in sRGB space. -" -" SOLARIZED HEX 16/8 TERMCOL XTERM/HEX L*A*B sRGB HSB -" --------- ------- ---- ------- ----------- ---------- ----------- ----------- -" base03 #002b36 8/4 brblack 234 #1c1c1c 15 -12 -12 0 43 54 193 100 21 -" base02 #073642 0/4 black 235 #262626 20 -12 -12 7 54 66 192 90 26 -" base01 #586e75 10/7 brgreen 240 #4e4e4e 45 -07 -07 88 110 117 194 25 46 -" base00 #657b83 11/7 bryellow 241 #585858 50 -07 -07 101 123 131 195 23 51 -" base0 #839496 12/6 brblue 244 #808080 60 -06 -03 131 148 150 186 13 59 -" base1 #93a1a1 14/4 brcyan 245 #8a8a8a 65 -05 -02 147 161 161 180 9 63 -" base2 #eee8d5 7/7 white 254 #d7d7af 92 -00 10 238 232 213 44 11 93 -" base3 #fdf6e3 15/7 brwhite 230 #ffffd7 97 00 10 253 246 227 44 10 99 -" yellow #b58900 3/3 yellow 136 #af8700 60 10 65 181 137 0 45 100 71 -" orange #cb4b16 9/3 brred 166 #d75f00 50 50 55 203 75 22 18 89 80 -" red #dc322f 1/1 red 160 #d70000 50 65 45 220 50 47 1 79 86 -" magenta #d33682 5/5 magenta 125 #af005f 50 65 -05 211 54 130 331 74 83 -" violet #6c71c4 13/5 brmagenta 61 #5f5faf 50 15 -45 108 113 196 237 45 77 -" blue #268bd2 4/4 blue 33 #0087ff 55 -10 -45 38 139 210 205 82 82 -" cyan #2aa198 6/6 cyan 37 #00afaf 60 -35 -05 42 161 152 175 74 63 -" green #859900 2/2 green 64 #5f8700 60 -20 65 133 153 0 68 100 60 -" -" --------------------------------------------------------------------- -" COLORSCHEME HACKING -" --------------------------------------------------------------------- -" -" Useful commands for testing colorschemes: -" :source $VIMRUNTIME/syntax/hitest.vim -" :help highlight-groups -" :help cterm-colors -" :help group-name -" -" Useful links for developing colorschemes: -" http://www.vim.org/scripts/script.php?script_id=2937 -" http://vimcasts.org/episodes/creating-colorschemes-for-vim/ -" http://www.frexx.de/xterm-256-notes/" -" -" }}} -" Environment Specific Overrides "{{{ -" Allow or disallow certain features based on current terminal emulator or -" environment. - -" Terminals that support italics -let s:terms_italic=[ - \"rxvt", - \"gnome-terminal" - \] -" For reference only, terminals are known to be incomptible. -" Terminals that are in neither list need to be tested. -let s:terms_noitalic=[ - \"iTerm.app", - \"Apple_Terminal" - \] -if has("gui_running") - let s:terminal_italic=1 " TODO: could refactor to not require this at all -else - let s:terminal_italic=0 " terminals will be guilty until proven compatible - for term in s:terms_italic - if $TERM_PROGRAM =~ term - let s:terminal_italic=1 - endif - endfor -endif - -" }}} -" Default option values"{{{ -" --------------------------------------------------------------------- -" s:options_list is used to autogenerate a list of all non-default options -" using "call SolarizedOptions()" or with the "Generate .vimrc commands" -" Solarized menu option. See the "Menus" section below for the function itself. -let s:options_list=[ - \'" this block of commands has been autogenerated by solarized.vim and', - \'" includes the current, non-default Solarized option values.', - \'" To use, place these commands in your .vimrc file (replacing any', - \'" existing colorscheme commands). See also ":help solarized"', - \'', - \'" ------------------------------------------------------------------', - \'" Solarized Colorscheme Config', - \'" ------------------------------------------------------------------', - \] -let s:colorscheme_list=[ - \'syntax enable', - \'set background='.&background, - \'colorscheme solarized', - \] -let s:defaults_list=[ - \'" ------------------------------------------------------------------', - \'', - \'" The following items are available options, but do not need to be', - \'" included in your .vimrc as they are currently set to their defaults.', - \'' - \] -let s:lazycat_list=[ - \'" lazy method of appending this onto your .vimrc ":w! >> ~/.vimrc"', - \'" ------------------------------------------------------------------', - \] - -function! s:SetOption(name,default) - if type(a:default) == type(0) - let l:wrap='' - let l:ewrap='' - else - let l:wrap='"' - let l:ewrap='\"' - endif - if !exists("g:solarized_".a:name) || g:solarized_{a:name}==a:default - exe 'let g:solarized_'.a:name.'='.l:wrap.a:default.l:wrap.'"' - exe 'call add(s:defaults_list, "\" let g:solarized_'.a:name.'='.l:ewrap.g:solarized_{a:name}.l:ewrap.'")' - else - exe 'call add(s:options_list, "let g:solarized_'.a:name.'='.l:ewrap.g:solarized_{a:name}.l:ewrap.' \"default value is '.a:default.'")' - endif -endfunction - -if ($TERM_PROGRAM ==? "apple_terminal" && &t_Co < 256) - let s:solarized_termtrans_default = 1 -else - let s:solarized_termtrans_default = 0 -endif -call s:SetOption("termtrans",s:solarized_termtrans_default) -call s:SetOption("degrade",0) -call s:SetOption("bold",1) -call s:SetOption("underline",1) -call s:SetOption("italic",1) " note that we need to override this later if the terminal doesn't support -call s:SetOption("termcolors",16) -call s:SetOption("contrast","normal") -call s:SetOption("visibility","normal") -call s:SetOption("diffmode","normal") -call s:SetOption("hitrail",0) -call s:SetOption("menu",1) - -"}}} -" Colorscheme initialization "{{{ -" --------------------------------------------------------------------- -hi clear -if exists("syntax_on") - syntax reset -endif -let colors_name = "solarized" - -"}}} -" GUI & CSApprox hexadecimal palettes"{{{ -" --------------------------------------------------------------------- -" -" Set both gui and terminal color values in separate conditional statements -" Due to possibility that CSApprox is running (though I suppose we could just -" leave the hex values out entirely in that case and include only cterm colors) -" We also check to see if user has set solarized (force use of the -" neutral gray monotone palette component) -if (has("gui_running") && g:solarized_degrade == 0) - let s:vmode = "gui" - let s:base03 = "#002b36" - let s:base02 = "#073642" - let s:base01 = "#586e75" - let s:base00 = "#657b83" - let s:base0 = "#839496" - let s:base1 = "#93a1a1" - let s:base2 = "#eee8d5" - let s:base3 = "#fdf6e3" - let s:yellow = "#b58900" - let s:orange = "#cb4b16" - let s:red = "#dc322f" - let s:magenta = "#d33682" - let s:violet = "#6c71c4" - let s:blue = "#268bd2" - let s:cyan = "#2aa198" - "let s:green = "#859900" "original - let s:green = "#719e07" "experimental -elseif (has("gui_running") && g:solarized_degrade == 1) - " These colors are identical to the 256 color mode. They may be viewed - " while in gui mode via "let g:solarized_degrade=1", though this is not - " recommened and is for testing only. - let s:vmode = "gui" - let s:base03 = "#1c1c1c" - let s:base02 = "#262626" - let s:base01 = "#4e4e4e" - let s:base00 = "#585858" - let s:base0 = "#808080" - let s:base1 = "#8a8a8a" - let s:base2 = "#d7d7af" - let s:base3 = "#ffffd7" - let s:yellow = "#af8700" - let s:orange = "#d75f00" - let s:red = "#af0000" - let s:magenta = "#af005f" - let s:violet = "#5f5faf" - let s:blue = "#0087ff" - let s:cyan = "#00afaf" - let s:green = "#5f8700" -elseif g:solarized_termcolors != 256 && &t_Co >= 16 - let s:vmode = "cterm" - let s:base03 = "8" - let s:base02 = "0" - let s:base01 = "10" - let s:base00 = "11" - let s:base0 = "12" - let s:base1 = "14" - let s:base2 = "7" - let s:base3 = "15" - let s:yellow = "3" - let s:orange = "9" - let s:red = "1" - let s:magenta = "5" - let s:violet = "13" - let s:blue = "4" - let s:cyan = "6" - let s:green = "2" -elseif g:solarized_termcolors == 256 - let s:vmode = "cterm" - let s:base03 = "234" - let s:base02 = "235" - let s:base01 = "239" - let s:base00 = "240" - let s:base0 = "244" - let s:base1 = "245" - let s:base2 = "187" - let s:base3 = "230" - let s:yellow = "136" - let s:orange = "166" - let s:red = "124" - let s:magenta = "125" - let s:violet = "61" - let s:blue = "33" - let s:cyan = "37" - let s:green = "64" -else - let s:vmode = "cterm" - let s:bright = "* term=bold cterm=bold" -" let s:base03 = "0".s:bright -" let s:base02 = "0" -" let s:base01 = "2".s:bright -" let s:base00 = "3".s:bright -" let s:base0 = "4".s:bright -" let s:base1 = "6".s:bright -" let s:base2 = "7" -" let s:base3 = "7".s:bright -" let s:yellow = "3" -" let s:orange = "1".s:bright -" let s:red = "1" -" let s:magenta = "5" -" let s:violet = "5".s:bright -" let s:blue = "4" -" let s:cyan = "6" -" let s:green = "2" - let s:base03 = "DarkGray" " 0* - let s:base02 = "Black" " 0 - let s:base01 = "LightGreen" " 2* - let s:base00 = "LightYellow" " 3* - let s:base0 = "LightBlue" " 4* - let s:base1 = "LightCyan" " 6* - let s:base2 = "LightGray" " 7 - let s:base3 = "White" " 7* - let s:yellow = "DarkYellow" " 3 - let s:orange = "LightRed" " 1* - let s:red = "DarkRed" " 1 - let s:magenta = "DarkMagenta" " 5 - let s:violet = "LightMagenta" " 5* - let s:blue = "DarkBlue" " 4 - let s:cyan = "DarkCyan" " 6 - let s:green = "DarkGreen" " 2 - -endif -"}}} -" Formatting options and null values for passthrough effect "{{{ -" --------------------------------------------------------------------- - let s:none = "NONE" - let s:none = "NONE" - let s:t_none = "NONE" - let s:n = "NONE" - let s:c = ",undercurl" - let s:r = ",reverse" - let s:s = ",standout" - let s:ou = "" - let s:ob = "" -"}}} -" Background value based on termtrans setting "{{{ -" --------------------------------------------------------------------- -if (has("gui_running") || g:solarized_termtrans == 0) - let s:back = s:base03 -else - let s:back = "NONE" -endif -"}}} -" Alternate light scheme "{{{ -" --------------------------------------------------------------------- -if &background == "light" - let s:temp03 = s:base03 - let s:temp02 = s:base02 - let s:temp01 = s:base01 - let s:temp00 = s:base00 - let s:base03 = s:base3 - let s:base02 = s:base2 - let s:base01 = s:base1 - let s:base00 = s:base0 - let s:base0 = s:temp00 - let s:base1 = s:temp01 - let s:base2 = s:temp02 - let s:base3 = s:temp03 - if (s:back != "NONE") - let s:back = s:base03 - endif -endif -"}}} -" Optional contrast schemes "{{{ -" --------------------------------------------------------------------- -if g:solarized_contrast == "high" - let s:base01 = s:base00 - let s:base00 = s:base0 - let s:base0 = s:base1 - let s:base1 = s:base2 - let s:base2 = s:base3 - let s:back = s:back -endif -if g:solarized_contrast == "low" - let s:back = s:base02 - let s:ou = ",underline" -endif -"}}} -" Overrides dependent on user specified values and environment "{{{ -" --------------------------------------------------------------------- -if (g:solarized_bold == 0 || &t_Co == 8 ) - let s:b = "" - let s:bb = ",bold" -else - let s:b = ",bold" - let s:bb = "" -endif - -if g:solarized_underline == 0 - let s:u = "" -else - let s:u = ",underline" -endif - -if g:solarized_italic == 0 || s:terminal_italic == 0 - let s:i = "" -else - let s:i = ",italic" -endif -"}}} -" Highlighting primitives"{{{ -" --------------------------------------------------------------------- - -exe "let s:bg_none = ' ".s:vmode."bg=".s:none ."'" -exe "let s:bg_back = ' ".s:vmode."bg=".s:back ."'" -exe "let s:bg_base03 = ' ".s:vmode."bg=".s:base03 ."'" -exe "let s:bg_base02 = ' ".s:vmode."bg=".s:base02 ."'" -exe "let s:bg_base01 = ' ".s:vmode."bg=".s:base01 ."'" -exe "let s:bg_base00 = ' ".s:vmode."bg=".s:base00 ."'" -exe "let s:bg_base0 = ' ".s:vmode."bg=".s:base0 ."'" -exe "let s:bg_base1 = ' ".s:vmode."bg=".s:base1 ."'" -exe "let s:bg_base2 = ' ".s:vmode."bg=".s:base2 ."'" -exe "let s:bg_base3 = ' ".s:vmode."bg=".s:base3 ."'" -exe "let s:bg_green = ' ".s:vmode."bg=".s:green ."'" -exe "let s:bg_yellow = ' ".s:vmode."bg=".s:yellow ."'" -exe "let s:bg_orange = ' ".s:vmode."bg=".s:orange ."'" -exe "let s:bg_red = ' ".s:vmode."bg=".s:red ."'" -exe "let s:bg_magenta = ' ".s:vmode."bg=".s:magenta."'" -exe "let s:bg_violet = ' ".s:vmode."bg=".s:violet ."'" -exe "let s:bg_blue = ' ".s:vmode."bg=".s:blue ."'" -exe "let s:bg_cyan = ' ".s:vmode."bg=".s:cyan ."'" - -exe "let s:fg_none = ' ".s:vmode."fg=".s:none ."'" -exe "let s:fg_back = ' ".s:vmode."fg=".s:back ."'" -exe "let s:fg_base03 = ' ".s:vmode."fg=".s:base03 ."'" -exe "let s:fg_base02 = ' ".s:vmode."fg=".s:base02 ."'" -exe "let s:fg_base01 = ' ".s:vmode."fg=".s:base01 ."'" -exe "let s:fg_base00 = ' ".s:vmode."fg=".s:base00 ."'" -exe "let s:fg_base0 = ' ".s:vmode."fg=".s:base0 ."'" -exe "let s:fg_base1 = ' ".s:vmode."fg=".s:base1 ."'" -exe "let s:fg_base2 = ' ".s:vmode."fg=".s:base2 ."'" -exe "let s:fg_base3 = ' ".s:vmode."fg=".s:base3 ."'" -exe "let s:fg_green = ' ".s:vmode."fg=".s:green ."'" -exe "let s:fg_yellow = ' ".s:vmode."fg=".s:yellow ."'" -exe "let s:fg_orange = ' ".s:vmode."fg=".s:orange ."'" -exe "let s:fg_red = ' ".s:vmode."fg=".s:red ."'" -exe "let s:fg_magenta = ' ".s:vmode."fg=".s:magenta."'" -exe "let s:fg_violet = ' ".s:vmode."fg=".s:violet ."'" -exe "let s:fg_blue = ' ".s:vmode."fg=".s:blue ."'" -exe "let s:fg_cyan = ' ".s:vmode."fg=".s:cyan ."'" - -exe "let s:fmt_none = ' ".s:vmode."=NONE". " term=NONE". "'" -exe "let s:fmt_bold = ' ".s:vmode."=NONE".s:b. " term=NONE".s:b."'" -exe "let s:fmt_bldi = ' ".s:vmode."=NONE".s:b. " term=NONE".s:b."'" -exe "let s:fmt_undr = ' ".s:vmode."=NONE".s:u. " term=NONE".s:u."'" -exe "let s:fmt_undb = ' ".s:vmode."=NONE".s:u.s:b. " term=NONE".s:u.s:b."'" -exe "let s:fmt_undi = ' ".s:vmode."=NONE".s:u. " term=NONE".s:u."'" -exe "let s:fmt_uopt = ' ".s:vmode."=NONE".s:ou. " term=NONE".s:ou."'" -exe "let s:fmt_curl = ' ".s:vmode."=NONE".s:c. " term=NONE".s:c."'" -exe "let s:fmt_ital = ' ".s:vmode."=NONE".s:i. " term=NONE".s:i."'" -exe "let s:fmt_stnd = ' ".s:vmode."=NONE".s:s. " term=NONE".s:s."'" -exe "let s:fmt_revr = ' ".s:vmode."=NONE".s:r. " term=NONE".s:r."'" -exe "let s:fmt_revb = ' ".s:vmode."=NONE".s:r.s:b. " term=NONE".s:r.s:b."'" -" revbb (reverse bold for bright colors) is only set to actual bold in low -" color terminals (t_co=8, such as OS X Terminal.app) and should only be used -" with colors 8-15. -exe "let s:fmt_revbb = ' ".s:vmode."=NONE".s:r.s:bb. " term=NONE".s:r.s:bb."'" -exe "let s:fmt_revbbu = ' ".s:vmode."=NONE".s:r.s:bb.s:u." term=NONE".s:r.s:bb.s:u."'" - -if has("gui_running") - exe "let s:sp_none = ' guisp=".s:none ."'" - exe "let s:sp_back = ' guisp=".s:back ."'" - exe "let s:sp_base03 = ' guisp=".s:base03 ."'" - exe "let s:sp_base02 = ' guisp=".s:base02 ."'" - exe "let s:sp_base01 = ' guisp=".s:base01 ."'" - exe "let s:sp_base00 = ' guisp=".s:base00 ."'" - exe "let s:sp_base0 = ' guisp=".s:base0 ."'" - exe "let s:sp_base1 = ' guisp=".s:base1 ."'" - exe "let s:sp_base2 = ' guisp=".s:base2 ."'" - exe "let s:sp_base3 = ' guisp=".s:base3 ."'" - exe "let s:sp_green = ' guisp=".s:green ."'" - exe "let s:sp_yellow = ' guisp=".s:yellow ."'" - exe "let s:sp_orange = ' guisp=".s:orange ."'" - exe "let s:sp_red = ' guisp=".s:red ."'" - exe "let s:sp_magenta = ' guisp=".s:magenta."'" - exe "let s:sp_violet = ' guisp=".s:violet ."'" - exe "let s:sp_blue = ' guisp=".s:blue ."'" - exe "let s:sp_cyan = ' guisp=".s:cyan ."'" -else - let s:sp_none = "" - let s:sp_back = "" - let s:sp_base03 = "" - let s:sp_base02 = "" - let s:sp_base01 = "" - let s:sp_base00 = "" - let s:sp_base0 = "" - let s:sp_base1 = "" - let s:sp_base2 = "" - let s:sp_base3 = "" - let s:sp_green = "" - let s:sp_yellow = "" - let s:sp_orange = "" - let s:sp_red = "" - let s:sp_magenta = "" - let s:sp_violet = "" - let s:sp_blue = "" - let s:sp_cyan = "" -endif - -"}}} -" Basic highlighting"{{{ -" --------------------------------------------------------------------- -" note that link syntax to avoid duplicate configuration doesn't work with the -" exe compiled formats - -exe "hi! Normal" .s:fmt_none .s:fg_base0 .s:bg_back - -exe "hi! Comment" .s:fmt_ital .s:fg_base01 .s:bg_none -" *Comment any comment - -exe "hi! Constant" .s:fmt_none .s:fg_cyan .s:bg_none -" *Constant any constant -" String a string constant: "this is a string" -" Character a character constant: 'c', '\n' -" Number a number constant: 234, 0xff -" Boolean a boolean constant: TRUE, false -" Float a floating point constant: 2.3e10 - -exe "hi! Identifier" .s:fmt_none .s:fg_blue .s:bg_none -" *Identifier any variable name -" Function function name (also: methods for classes) -" -exe "hi! Statement" .s:fmt_none .s:fg_green .s:bg_none -" *Statement any statement -" Conditional if, then, else, endif, switch, etc. -" Repeat for, do, while, etc. -" Label case, default, etc. -" Operator "sizeof", "+", "*", etc. -" Keyword any other keyword -" Exception try, catch, throw - -exe "hi! PreProc" .s:fmt_none .s:fg_orange .s:bg_none -" *PreProc generic Preprocessor -" Include preprocessor #include -" Define preprocessor #define -" Macro same as Define -" PreCondit preprocessor #if, #else, #endif, etc. - -exe "hi! Type" .s:fmt_none .s:fg_yellow .s:bg_none -" *Type int, long, char, etc. -" StorageClass static, register, volatile, etc. -" Structure struct, union, enum, etc. -" Typedef A typedef - -exe "hi! Special" .s:fmt_none .s:fg_red .s:bg_none -" *Special any special symbol -" SpecialChar special character in a constant -" Tag you can use CTRL-] on this -" Delimiter character that needs attention -" SpecialComment special things inside a comment -" Debug debugging statements - -exe "hi! Underlined" .s:fmt_none .s:fg_violet .s:bg_none -" *Underlined text that stands out, HTML links - -exe "hi! Ignore" .s:fmt_none .s:fg_none .s:bg_none -" *Ignore left blank, hidden |hl-Ignore| - -exe "hi! Error" .s:fmt_bold .s:fg_red .s:bg_none -" *Error any erroneous construct - -exe "hi! Todo" .s:fmt_bold .s:fg_magenta.s:bg_none -" *Todo anything that needs extra attention; mostly the -" keywords TODO FIXME and XXX -" -"}}} -" Extended highlighting "{{{ -" --------------------------------------------------------------------- -if (g:solarized_visibility=="high") - exe "hi! SpecialKey" .s:fmt_revr .s:fg_red .s:bg_none - exe "hi! NonText" .s:fmt_bold .s:fg_red .s:bg_none -elseif (g:solarized_visibility=="low") - exe "hi! SpecialKey" .s:fmt_bold .s:fg_base02 .s:bg_none - exe "hi! NonText" .s:fmt_bold .s:fg_base02 .s:bg_none -else - exe "hi! SpecialKey" .s:fmt_bold .s:fg_base00 .s:bg_base02 - exe "hi! NonText" .s:fmt_bold .s:fg_base00 .s:bg_none -endif -exe "hi! StatusLine" .s:fmt_none .s:fg_base1 .s:bg_base02 .s:fmt_revbb -exe "hi! StatusLineNC" .s:fmt_none .s:fg_base00 .s:bg_base02 .s:fmt_revbb -exe "hi! Visual" .s:fmt_none .s:fg_base01 .s:bg_base03 .s:fmt_revbb -exe "hi! Directory" .s:fmt_none .s:fg_blue .s:bg_none -exe "hi! ErrorMsg" .s:fmt_revr .s:fg_red .s:bg_none -exe "hi! IncSearch" .s:fmt_stnd .s:fg_orange .s:bg_none -exe "hi! Search" .s:fmt_revr .s:fg_yellow .s:bg_none -exe "hi! MoreMsg" .s:fmt_none .s:fg_blue .s:bg_none -exe "hi! ModeMsg" .s:fmt_none .s:fg_blue .s:bg_none -exe "hi! LineNr" .s:fmt_none .s:fg_base01 .s:bg_base02 -exe "hi! Question" .s:fmt_bold .s:fg_cyan .s:bg_none -if ( has("gui_running") || &t_Co > 8 ) - exe "hi! VertSplit" .s:fmt_none .s:fg_base00 .s:bg_base00 -else - exe "hi! VertSplit" .s:fmt_revbb .s:fg_base00 .s:bg_base02 -endif -exe "hi! Title" .s:fmt_bold .s:fg_orange .s:bg_none -exe "hi! VisualNOS" .s:fmt_stnd .s:fg_none .s:bg_base02 .s:fmt_revbb -exe "hi! WarningMsg" .s:fmt_bold .s:fg_red .s:bg_none -exe "hi! WildMenu" .s:fmt_none .s:fg_base2 .s:bg_base02 .s:fmt_revbb -exe "hi! Folded" .s:fmt_undb .s:fg_base0 .s:bg_base02 .s:sp_base03 -exe "hi! FoldColumn" .s:fmt_none .s:fg_base0 .s:bg_base02 -if (g:solarized_diffmode=="high") -exe "hi! DiffAdd" .s:fmt_revr .s:fg_green .s:bg_none -exe "hi! DiffChange" .s:fmt_revr .s:fg_yellow .s:bg_none -exe "hi! DiffDelete" .s:fmt_revr .s:fg_red .s:bg_none -exe "hi! DiffText" .s:fmt_revr .s:fg_blue .s:bg_none -elseif (g:solarized_diffmode=="low") -exe "hi! DiffAdd" .s:fmt_undr .s:fg_green .s:bg_none .s:sp_green -exe "hi! DiffChange" .s:fmt_undr .s:fg_yellow .s:bg_none .s:sp_yellow -exe "hi! DiffDelete" .s:fmt_bold .s:fg_red .s:bg_none -exe "hi! DiffText" .s:fmt_undr .s:fg_blue .s:bg_none .s:sp_blue -else " normal - if has("gui_running") -exe "hi! DiffAdd" .s:fmt_bold .s:fg_green .s:bg_base02 .s:sp_green -exe "hi! DiffChange" .s:fmt_bold .s:fg_yellow .s:bg_base02 .s:sp_yellow -exe "hi! DiffDelete" .s:fmt_bold .s:fg_red .s:bg_base02 -exe "hi! DiffText" .s:fmt_bold .s:fg_blue .s:bg_base02 .s:sp_blue - else -exe "hi! DiffAdd" .s:fmt_none .s:fg_green .s:bg_base02 .s:sp_green -exe "hi! DiffChange" .s:fmt_none .s:fg_yellow .s:bg_base02 .s:sp_yellow -exe "hi! DiffDelete" .s:fmt_none .s:fg_red .s:bg_base02 -exe "hi! DiffText" .s:fmt_none .s:fg_blue .s:bg_base02 .s:sp_blue - endif -endif -exe "hi! SignColumn" .s:fmt_none .s:fg_base0 -exe "hi! Conceal" .s:fmt_none .s:fg_blue .s:bg_none -exe "hi! SpellBad" .s:fmt_curl .s:fg_none .s:bg_none .s:sp_red -exe "hi! SpellCap" .s:fmt_curl .s:fg_none .s:bg_none .s:sp_violet -exe "hi! SpellRare" .s:fmt_curl .s:fg_none .s:bg_none .s:sp_cyan -exe "hi! SpellLocal" .s:fmt_curl .s:fg_none .s:bg_none .s:sp_yellow -exe "hi! Pmenu" .s:fmt_none .s:fg_base0 .s:bg_base02 .s:fmt_revbb -exe "hi! PmenuSel" .s:fmt_none .s:fg_base01 .s:bg_base2 .s:fmt_revbb -exe "hi! PmenuSbar" .s:fmt_none .s:fg_base2 .s:bg_base0 .s:fmt_revbb -exe "hi! PmenuThumb" .s:fmt_none .s:fg_base0 .s:bg_base03 .s:fmt_revbb -exe "hi! TabLine" .s:fmt_undr .s:fg_base0 .s:bg_base02 .s:sp_base0 -exe "hi! TabLineFill" .s:fmt_undr .s:fg_base0 .s:bg_base02 .s:sp_base0 -exe "hi! TabLineSel" .s:fmt_undr .s:fg_base01 .s:bg_base2 .s:sp_base0 .s:fmt_revbbu -exe "hi! CursorColumn" .s:fmt_none .s:fg_none .s:bg_base02 -exe "hi! CursorLine" .s:fmt_uopt .s:fg_none .s:bg_base02 .s:sp_base1 -exe "hi! ColorColumn" .s:fmt_none .s:fg_none .s:bg_base02 -exe "hi! Cursor" .s:fmt_none .s:fg_base03 .s:bg_base0 -hi! link lCursor Cursor -exe "hi! MatchParen" .s:fmt_bold .s:fg_red .s:bg_base01 - -"}}} -" vim syntax highlighting "{{{ -" --------------------------------------------------------------------- -"exe "hi! vimLineComment" . s:fg_base01 .s:bg_none .s:fmt_ital -"hi! link vimComment Comment -"hi! link vimLineComment Comment -hi! link vimVar Identifier -hi! link vimFunc Function -hi! link vimUserFunc Function -hi! link helpSpecial Special -hi! link vimSet Normal -hi! link vimSetEqual Normal -exe "hi! vimCommentString" .s:fmt_none .s:fg_violet .s:bg_none -exe "hi! vimCommand" .s:fmt_none .s:fg_yellow .s:bg_none -exe "hi! vimCmdSep" .s:fmt_bold .s:fg_blue .s:bg_none -exe "hi! helpExample" .s:fmt_none .s:fg_base1 .s:bg_none -exe "hi! helpOption" .s:fmt_none .s:fg_cyan .s:bg_none -exe "hi! helpNote" .s:fmt_none .s:fg_magenta.s:bg_none -exe "hi! helpVim" .s:fmt_none .s:fg_magenta.s:bg_none -exe "hi! helpHyperTextJump" .s:fmt_undr .s:fg_blue .s:bg_none -exe "hi! helpHyperTextEntry".s:fmt_none .s:fg_green .s:bg_none -exe "hi! vimIsCommand" .s:fmt_none .s:fg_base00 .s:bg_none -exe "hi! vimSynMtchOpt" .s:fmt_none .s:fg_yellow .s:bg_none -exe "hi! vimSynType" .s:fmt_none .s:fg_cyan .s:bg_none -exe "hi! vimHiLink" .s:fmt_none .s:fg_blue .s:bg_none -exe "hi! vimHiGroup" .s:fmt_none .s:fg_blue .s:bg_none -exe "hi! vimGroup" .s:fmt_undb .s:fg_blue .s:bg_none -"}}} -" diff highlighting "{{{ -" --------------------------------------------------------------------- -hi! link diffAdded Statement -hi! link diffLine Identifier -"}}} -" git & gitcommit highlighting "{{{ -"git -"exe "hi! gitDateHeader" -"exe "hi! gitIdentityHeader" -"exe "hi! gitIdentityKeyword" -"exe "hi! gitNotesHeader" -"exe "hi! gitReflogHeader" -"exe "hi! gitKeyword" -"exe "hi! gitIdentity" -"exe "hi! gitEmailDelimiter" -"exe "hi! gitEmail" -"exe "hi! gitDate" -"exe "hi! gitMode" -"exe "hi! gitHashAbbrev" -"exe "hi! gitHash" -"exe "hi! gitReflogMiddle" -"exe "hi! gitReference" -"exe "hi! gitStage" -"exe "hi! gitType" -"exe "hi! gitDiffAdded" -"exe "hi! gitDiffRemoved" -"gitcommit -"exe "hi! gitcommitSummary" -exe "hi! gitcommitComment" .s:fmt_ital .s:fg_base01 .s:bg_none -hi! link gitcommitUntracked gitcommitComment -hi! link gitcommitDiscarded gitcommitComment -hi! link gitcommitSelected gitcommitComment -exe "hi! gitcommitUnmerged" .s:fmt_bold .s:fg_green .s:bg_none -exe "hi! gitcommitOnBranch" .s:fmt_bold .s:fg_base01 .s:bg_none -exe "hi! gitcommitBranch" .s:fmt_bold .s:fg_magenta .s:bg_none -hi! link gitcommitNoBranch gitcommitBranch -exe "hi! gitcommitDiscardedType".s:fmt_none .s:fg_red .s:bg_none -exe "hi! gitcommitSelectedType" .s:fmt_none .s:fg_green .s:bg_none -"exe "hi! gitcommitUnmergedType" -"exe "hi! gitcommitType" -"exe "hi! gitcommitNoChanges" -"exe "hi! gitcommitHeader" -exe "hi! gitcommitHeader" .s:fmt_none .s:fg_base01 .s:bg_none -exe "hi! gitcommitUntrackedFile".s:fmt_bold .s:fg_cyan .s:bg_none -exe "hi! gitcommitDiscardedFile".s:fmt_bold .s:fg_red .s:bg_none -exe "hi! gitcommitSelectedFile" .s:fmt_bold .s:fg_green .s:bg_none -exe "hi! gitcommitUnmergedFile" .s:fmt_bold .s:fg_yellow .s:bg_none -exe "hi! gitcommitFile" .s:fmt_bold .s:fg_base0 .s:bg_none -hi! link gitcommitDiscardedArrow gitcommitDiscardedFile -hi! link gitcommitSelectedArrow gitcommitSelectedFile -hi! link gitcommitUnmergedArrow gitcommitUnmergedFile -"exe "hi! gitcommitArrow" -"exe "hi! gitcommitOverflow" -"exe "hi! gitcommitBlank" -" }}} -" html highlighting "{{{ -" --------------------------------------------------------------------- -exe "hi! htmlTag" .s:fmt_none .s:fg_base01 .s:bg_none -exe "hi! htmlEndTag" .s:fmt_none .s:fg_base01 .s:bg_none -exe "hi! htmlTagN" .s:fmt_bold .s:fg_base1 .s:bg_none -exe "hi! htmlTagName" .s:fmt_bold .s:fg_blue .s:bg_none -exe "hi! htmlSpecialTagName".s:fmt_ital .s:fg_blue .s:bg_none -exe "hi! htmlArg" .s:fmt_none .s:fg_base00 .s:bg_none -exe "hi! javaScript" .s:fmt_none .s:fg_yellow .s:bg_none -"}}} -" perl highlighting "{{{ -" --------------------------------------------------------------------- -exe "hi! perlHereDoc" . s:fg_base1 .s:bg_back .s:fmt_none -exe "hi! perlVarPlain" . s:fg_yellow .s:bg_back .s:fmt_none -exe "hi! perlStatementFileDesc". s:fg_cyan.s:bg_back.s:fmt_none - -"}}} -" tex highlighting "{{{ -" --------------------------------------------------------------------- -exe "hi! texStatement" . s:fg_cyan .s:bg_back .s:fmt_none -exe "hi! texMathZoneX" . s:fg_yellow .s:bg_back .s:fmt_none -exe "hi! texMathMatcher" . s:fg_yellow .s:bg_back .s:fmt_none -exe "hi! texMathMatcher" . s:fg_yellow .s:bg_back .s:fmt_none -exe "hi! texRefLabel" . s:fg_yellow .s:bg_back .s:fmt_none -"}}} -" ruby highlighting "{{{ -" --------------------------------------------------------------------- -exe "hi! rubyDefine" . s:fg_base1 .s:bg_back .s:fmt_bold -"rubyInclude -"rubySharpBang -"rubyAccess -"rubyPredefinedVariable -"rubyBoolean -"rubyClassVariable -"rubyBeginEnd -"rubyRepeatModifier -"hi! link rubyArrayDelimiter Special " [ , , ] -"rubyCurlyBlock { , , } - -"hi! link rubyClass Keyword -"hi! link rubyModule Keyword -"hi! link rubyKeyword Keyword -"hi! link rubyOperator Operator -"hi! link rubyIdentifier Identifier -"hi! link rubyInstanceVariable Identifier -"hi! link rubyGlobalVariable Identifier -"hi! link rubyClassVariable Identifier -"hi! link rubyConstant Type -"}}} -" haskell syntax highlighting"{{{ -" --------------------------------------------------------------------- -" For use with syntax/haskell.vim : Haskell Syntax File -" http://www.vim.org/scripts/script.php?script_id=3034 -" See also Steffen Siering's github repository: -" http://github.com/urso/dotrc/blob/master/vim/syntax/haskell.vim -" --------------------------------------------------------------------- -" -" Treat True and False specially, see the plugin referenced above -let hs_highlight_boolean=1 -" highlight delims, see the plugin referenced above -let hs_highlight_delimiters=1 - -exe "hi! cPreCondit". s:fg_orange.s:bg_none .s:fmt_none - -exe "hi! VarId" . s:fg_blue .s:bg_none .s:fmt_none -exe "hi! ConId" . s:fg_yellow .s:bg_none .s:fmt_none -exe "hi! hsImport" . s:fg_magenta.s:bg_none .s:fmt_none -exe "hi! hsString" . s:fg_base00 .s:bg_none .s:fmt_none - -exe "hi! hsStructure" . s:fg_cyan .s:bg_none .s:fmt_none -exe "hi! hs_hlFunctionName" . s:fg_blue .s:bg_none -exe "hi! hsStatement" . s:fg_cyan .s:bg_none .s:fmt_none -exe "hi! hsImportLabel" . s:fg_cyan .s:bg_none .s:fmt_none -exe "hi! hs_OpFunctionName" . s:fg_yellow .s:bg_none .s:fmt_none -exe "hi! hs_DeclareFunction" . s:fg_orange .s:bg_none .s:fmt_none -exe "hi! hsVarSym" . s:fg_cyan .s:bg_none .s:fmt_none -exe "hi! hsType" . s:fg_yellow .s:bg_none .s:fmt_none -exe "hi! hsTypedef" . s:fg_cyan .s:bg_none .s:fmt_none -exe "hi! hsModuleName" . s:fg_green .s:bg_none .s:fmt_undr -exe "hi! hsModuleStartLabel" . s:fg_magenta.s:bg_none .s:fmt_none -hi! link hsImportParams Delimiter -hi! link hsDelimTypeExport Delimiter -hi! link hsModuleStartLabel hsStructure -hi! link hsModuleWhereLabel hsModuleStartLabel - -" following is for the haskell-conceal plugin -" the first two items don't have an impact, but better safe -exe "hi! hsNiceOperator" . s:fg_cyan .s:bg_none .s:fmt_none -exe "hi! hsniceoperator" . s:fg_cyan .s:bg_none .s:fmt_none - -"}}} -" pandoc markdown syntax highlighting "{{{ -" --------------------------------------------------------------------- - -"PandocHiLink pandocNormalBlock -exe "hi! pandocTitleBlock" .s:fg_blue .s:bg_none .s:fmt_none -exe "hi! pandocTitleBlockTitle" .s:fg_blue .s:bg_none .s:fmt_bold -exe "hi! pandocTitleComment" .s:fg_blue .s:bg_none .s:fmt_bold -exe "hi! pandocComment" .s:fg_base01 .s:bg_none .s:fmt_ital -exe "hi! pandocVerbatimBlock" .s:fg_yellow .s:bg_none .s:fmt_none -hi! link pandocVerbatimBlockDeep pandocVerbatimBlock -hi! link pandocCodeBlock pandocVerbatimBlock -hi! link pandocCodeBlockDelim pandocVerbatimBlock -exe "hi! pandocBlockQuote" .s:fg_blue .s:bg_none .s:fmt_none -exe "hi! pandocBlockQuoteLeader1" .s:fg_blue .s:bg_none .s:fmt_none -exe "hi! pandocBlockQuoteLeader2" .s:fg_cyan .s:bg_none .s:fmt_none -exe "hi! pandocBlockQuoteLeader3" .s:fg_yellow .s:bg_none .s:fmt_none -exe "hi! pandocBlockQuoteLeader4" .s:fg_red .s:bg_none .s:fmt_none -exe "hi! pandocBlockQuoteLeader5" .s:fg_base0 .s:bg_none .s:fmt_none -exe "hi! pandocBlockQuoteLeader6" .s:fg_base01 .s:bg_none .s:fmt_none -exe "hi! pandocListMarker" .s:fg_magenta.s:bg_none .s:fmt_none -exe "hi! pandocListReference" .s:fg_magenta.s:bg_none .s:fmt_undr - -" Definitions -" --------------------------------------------------------------------- -let s:fg_pdef = s:fg_violet -exe "hi! pandocDefinitionBlock" .s:fg_pdef .s:bg_none .s:fmt_none -exe "hi! pandocDefinitionTerm" .s:fg_pdef .s:bg_none .s:fmt_stnd -exe "hi! pandocDefinitionIndctr" .s:fg_pdef .s:bg_none .s:fmt_bold -exe "hi! pandocEmphasisDefinition" .s:fg_pdef .s:bg_none .s:fmt_ital -exe "hi! pandocEmphasisNestedDefinition" .s:fg_pdef .s:bg_none .s:fmt_bldi -exe "hi! pandocStrongEmphasisDefinition" .s:fg_pdef .s:bg_none .s:fmt_bold -exe "hi! pandocStrongEmphasisNestedDefinition" .s:fg_pdef.s:bg_none.s:fmt_bldi -exe "hi! pandocStrongEmphasisEmphasisDefinition" .s:fg_pdef.s:bg_none.s:fmt_bldi -exe "hi! pandocStrikeoutDefinition" .s:fg_pdef .s:bg_none .s:fmt_revr -exe "hi! pandocVerbatimInlineDefinition" .s:fg_pdef .s:bg_none .s:fmt_none -exe "hi! pandocSuperscriptDefinition" .s:fg_pdef .s:bg_none .s:fmt_none -exe "hi! pandocSubscriptDefinition" .s:fg_pdef .s:bg_none .s:fmt_none - -" Tables -" --------------------------------------------------------------------- -let s:fg_ptable = s:fg_blue -exe "hi! pandocTable" .s:fg_ptable.s:bg_none .s:fmt_none -exe "hi! pandocTableStructure" .s:fg_ptable.s:bg_none .s:fmt_none -hi! link pandocTableStructureTop pandocTableStructre -hi! link pandocTableStructureEnd pandocTableStructre -exe "hi! pandocTableZebraLight" .s:fg_ptable.s:bg_base03.s:fmt_none -exe "hi! pandocTableZebraDark" .s:fg_ptable.s:bg_base02.s:fmt_none -exe "hi! pandocEmphasisTable" .s:fg_ptable.s:bg_none .s:fmt_ital -exe "hi! pandocEmphasisNestedTable" .s:fg_ptable.s:bg_none .s:fmt_bldi -exe "hi! pandocStrongEmphasisTable" .s:fg_ptable.s:bg_none .s:fmt_bold -exe "hi! pandocStrongEmphasisNestedTable" .s:fg_ptable.s:bg_none .s:fmt_bldi -exe "hi! pandocStrongEmphasisEmphasisTable" .s:fg_ptable.s:bg_none .s:fmt_bldi -exe "hi! pandocStrikeoutTable" .s:fg_ptable.s:bg_none .s:fmt_revr -exe "hi! pandocVerbatimInlineTable" .s:fg_ptable.s:bg_none .s:fmt_none -exe "hi! pandocSuperscriptTable" .s:fg_ptable.s:bg_none .s:fmt_none -exe "hi! pandocSubscriptTable" .s:fg_ptable.s:bg_none .s:fmt_none - -" Headings -" --------------------------------------------------------------------- -let s:fg_phead = s:fg_orange -exe "hi! pandocHeading" .s:fg_phead .s:bg_none.s:fmt_bold -exe "hi! pandocHeadingMarker" .s:fg_yellow.s:bg_none.s:fmt_bold -exe "hi! pandocEmphasisHeading" .s:fg_phead .s:bg_none.s:fmt_bldi -exe "hi! pandocEmphasisNestedHeading" .s:fg_phead .s:bg_none.s:fmt_bldi -exe "hi! pandocStrongEmphasisHeading" .s:fg_phead .s:bg_none.s:fmt_bold -exe "hi! pandocStrongEmphasisNestedHeading" .s:fg_phead .s:bg_none.s:fmt_bldi -exe "hi! pandocStrongEmphasisEmphasisHeading".s:fg_phead .s:bg_none.s:fmt_bldi -exe "hi! pandocStrikeoutHeading" .s:fg_phead .s:bg_none.s:fmt_revr -exe "hi! pandocVerbatimInlineHeading" .s:fg_phead .s:bg_none.s:fmt_bold -exe "hi! pandocSuperscriptHeading" .s:fg_phead .s:bg_none.s:fmt_bold -exe "hi! pandocSubscriptHeading" .s:fg_phead .s:bg_none.s:fmt_bold - -" Links -" --------------------------------------------------------------------- -exe "hi! pandocLinkDelim" .s:fg_base01 .s:bg_none .s:fmt_none -exe "hi! pandocLinkLabel" .s:fg_blue .s:bg_none .s:fmt_undr -exe "hi! pandocLinkText" .s:fg_blue .s:bg_none .s:fmt_undb -exe "hi! pandocLinkURL" .s:fg_base00 .s:bg_none .s:fmt_undr -exe "hi! pandocLinkTitle" .s:fg_base00 .s:bg_none .s:fmt_undi -exe "hi! pandocLinkTitleDelim" .s:fg_base01 .s:bg_none .s:fmt_undi .s:sp_base00 -exe "hi! pandocLinkDefinition" .s:fg_cyan .s:bg_none .s:fmt_undr .s:sp_base00 -exe "hi! pandocLinkDefinitionID" .s:fg_blue .s:bg_none .s:fmt_bold -exe "hi! pandocImageCaption" .s:fg_violet .s:bg_none .s:fmt_undb -exe "hi! pandocFootnoteLink" .s:fg_green .s:bg_none .s:fmt_undr -exe "hi! pandocFootnoteDefLink" .s:fg_green .s:bg_none .s:fmt_bold -exe "hi! pandocFootnoteInline" .s:fg_green .s:bg_none .s:fmt_undb -exe "hi! pandocFootnote" .s:fg_green .s:bg_none .s:fmt_none -exe "hi! pandocCitationDelim" .s:fg_magenta.s:bg_none .s:fmt_none -exe "hi! pandocCitation" .s:fg_magenta.s:bg_none .s:fmt_none -exe "hi! pandocCitationID" .s:fg_magenta.s:bg_none .s:fmt_undr -exe "hi! pandocCitationRef" .s:fg_magenta.s:bg_none .s:fmt_none - -" Main Styles -" --------------------------------------------------------------------- -exe "hi! pandocStyleDelim" .s:fg_base01 .s:bg_none .s:fmt_none -exe "hi! pandocEmphasis" .s:fg_base0 .s:bg_none .s:fmt_ital -exe "hi! pandocEmphasisNested" .s:fg_base0 .s:bg_none .s:fmt_bldi -exe "hi! pandocStrongEmphasis" .s:fg_base0 .s:bg_none .s:fmt_bold -exe "hi! pandocStrongEmphasisNested" .s:fg_base0 .s:bg_none .s:fmt_bldi -exe "hi! pandocStrongEmphasisEmphasis" .s:fg_base0 .s:bg_none .s:fmt_bldi -exe "hi! pandocStrikeout" .s:fg_base01 .s:bg_none .s:fmt_revr -exe "hi! pandocVerbatimInline" .s:fg_yellow .s:bg_none .s:fmt_none -exe "hi! pandocSuperscript" .s:fg_violet .s:bg_none .s:fmt_none -exe "hi! pandocSubscript" .s:fg_violet .s:bg_none .s:fmt_none - -exe "hi! pandocRule" .s:fg_blue .s:bg_none .s:fmt_bold -exe "hi! pandocRuleLine" .s:fg_blue .s:bg_none .s:fmt_bold -exe "hi! pandocEscapePair" .s:fg_red .s:bg_none .s:fmt_bold -exe "hi! pandocCitationRef" .s:fg_magenta.s:bg_none .s:fmt_none -exe "hi! pandocNonBreakingSpace" . s:fg_red .s:bg_none .s:fmt_revr -hi! link pandocEscapedCharacter pandocEscapePair -hi! link pandocLineBreak pandocEscapePair - -" Embedded Code -" --------------------------------------------------------------------- -exe "hi! pandocMetadataDelim" .s:fg_base01 .s:bg_none .s:fmt_none -exe "hi! pandocMetadata" .s:fg_blue .s:bg_none .s:fmt_none -exe "hi! pandocMetadataKey" .s:fg_blue .s:bg_none .s:fmt_none -exe "hi! pandocMetadata" .s:fg_blue .s:bg_none .s:fmt_bold -hi! link pandocMetadataTitle pandocMetadata - -"}}} -" Utility autocommand "{{{ -" --------------------------------------------------------------------- -" In cases where Solarized is initialized inside a terminal vim session and -" then transferred to a gui session via the command `:gui`, the gui vim process -" does not re-read the colorscheme (or .vimrc for that matter) so any `has_gui` -" related code that sets gui specific values isn't executed. -" -" Currently, Solarized sets only the cterm or gui values for the colorscheme -" depending on gui or terminal mode. It's possible that, if the following -" autocommand method is deemed excessively poor form, that approach will be -" used again and the autocommand below will be dropped. -" -" However it seems relatively benign in this case to include the autocommand -" here. It fires only in cases where vim is transferring from terminal to gui -" mode (detected with the script scope s:vmode variable). It also allows for -" other potential terminal customizations that might make gui mode suboptimal. -" -autocmd GUIEnter * if (s:vmode != "gui") | exe "colorscheme " . g:colors_name | endif -"}}} -" Highlight Trailing Space {{{ -" Experimental: Different highlight when on cursorline -function! s:SolarizedHiTrail() - if g:solarized_hitrail==0 - hi! clear solarizedTrailingSpace - else - syn match solarizedTrailingSpace "\s*$" - exe "hi! solarizedTrailingSpace " .s:fmt_undr .s:fg_red .s:bg_none .s:sp_red - endif -endfunction -augroup SolarizedHiTrail - autocmd! - if g:solarized_hitrail==1 - autocmd! Syntax * call s:SolarizedHiTrail() - autocmd! ColorScheme * if g:colors_name == "solarized" | call s:SolarizedHiTrail() | else | augroup! s:SolarizedHiTrail | endif - endif -augroup END -" }}} -" Menus "{{{ -" --------------------------------------------------------------------- -" Turn off Solarized menu by including the following assignment in your .vimrc: -" -" let g:solarized_menu=0 - -function! s:SolarizedOptions() - new "new buffer - setf vim "vim filetype - let failed = append(0, s:defaults_list) - let failed = append(0, s:colorscheme_list) - let failed = append(0, s:options_list) - let failed = append(0, s:lazycat_list) - 0 "jump back to the top -endfunction -if !exists(":SolarizedOptions") - command SolarizedOptions :call s:SolarizedOptions() -endif - -function! SolarizedMenu() - if exists("g:loaded_solarized_menu") - try - silent! aunmenu Solarized - endtry - endif - let g:loaded_solarized_menu = 1 - - if g:colors_name == "solarized" && g:solarized_menu != 0 - - amenu &Solarized.&Contrast.&Low\ Contrast :let g:solarized_contrast="low" \| colorscheme solarized - amenu &Solarized.&Contrast.&Normal\ Contrast :let g:solarized_contrast="normal" \| colorscheme solarized - amenu &Solarized.&Contrast.&High\ Contrast :let g:solarized_contrast="high" \| colorscheme solarized - an &Solarized.&Contrast.-sep- - amenu &Solarized.&Contrast.&Help:\ Contrast :help 'solarized_contrast' - - amenu &Solarized.&Visibility.&Low\ Visibility :let g:solarized_visibility="low" \| colorscheme solarized - amenu &Solarized.&Visibility.&Normal\ Visibility :let g:solarized_visibility="normal" \| colorscheme solarized - amenu &Solarized.&Visibility.&High\ Visibility :let g:solarized_visibility="high" \| colorscheme solarized - an &Solarized.&Visibility.-sep- - amenu &Solarized.&Visibility.&Help:\ Visibility :help 'solarized_visibility' - - amenu &Solarized.&Background.&Toggle\ Background :ToggleBG - amenu &Solarized.&Background.&Dark\ Background :set background=dark \| colorscheme solarized - amenu &Solarized.&Background.&Light\ Background :set background=light \| colorscheme solarized - an &Solarized.&Background.-sep- - amenu &Solarized.&Background.&Help:\ ToggleBG :help togglebg - - if g:solarized_bold==0 | let l:boldswitch="On" | else | let l:boldswitch="Off" | endif - exe "amenu &Solarized.&Styling.&Turn\\ Bold\\ ".l:boldswitch." :let g:solarized_bold=(abs(g:solarized_bold-1)) \\| colorscheme solarized" - if g:solarized_italic==0 | let l:italicswitch="On" | else | let l:italicswitch="Off" | endif - exe "amenu &Solarized.&Styling.&Turn\\ Italic\\ ".l:italicswitch." :let g:solarized_italic=(abs(g:solarized_italic-1)) \\| colorscheme solarized" - if g:solarized_underline==0 | let l:underlineswitch="On" | else | let l:underlineswitch="Off" | endif - exe "amenu &Solarized.&Styling.&Turn\\ Underline\\ ".l:underlineswitch." :let g:solarized_underline=(abs(g:solarized_underline-1)) \\| colorscheme solarized" - - amenu &Solarized.&Diff\ Mode.&Low\ Diff\ Mode :let g:solarized_diffmode="low" \| colorscheme solarized - amenu &Solarized.&Diff\ Mode.&Normal\ Diff\ Mode :let g:solarized_diffmode="normal" \| colorscheme solarized - amenu &Solarized.&Diff\ Mode.&High\ Diff\ Mode :let g:solarized_diffmode="high" \| colorscheme solarized - - if g:solarized_hitrail==0 | let l:hitrailswitch="On" | else | let l:hitrailswitch="Off" | endif - exe "amenu &Solarized.&Experimental.&Turn\\ Highlight\\ Trailing\\ Spaces\\ ".l:hitrailswitch." :let g:solarized_hitrail=(abs(g:solarized_hitrail-1)) \\| colorscheme solarized" - an &Solarized.&Experimental.-sep- - amenu &Solarized.&Experimental.&Help:\ HiTrail :help 'solarized_hitrail' - - an &Solarized.-sep1- - - amenu &Solarized.&Autogenerate\ options :SolarizedOptions - - an &Solarized.-sep2- - - amenu &Solarized.&Help.&Solarized\ Help :help solarized - amenu &Solarized.&Help.&Toggle\ Background\ Help :help togglebg - amenu &Solarized.&Help.&Removing\ This\ Menu :help solarized-menu - - an 9999.77 &Help.&Solarized\ Colorscheme :help solarized - an 9999.78 &Help.&Toggle\ Background :help togglebg - an 9999.79 &Help.-sep3- - - endif -endfunction - -autocmd ColorScheme * if g:colors_name != "solarized" | silent! aunmenu Solarized | else | call SolarizedMenu() | endif - -"}}} -" License "{{{ -" --------------------------------------------------------------------- -" -" Copyright (c) 2011 Ethan Schoonover -" -" Permission is hereby granted, free of charge, to any person obtaining a copy -" of this software and associated documentation files (the "Software"), to deal -" in the Software without restriction, including without limitation the rights -" to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -" copies of the Software, and to permit persons to whom the Software is -" furnished to do so, subject to the following conditions: -" -" The above copyright notice and this permission notice shall be included in -" all copies or substantial portions of the Software. -" -" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -" OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -" THE SOFTWARE. -" -" vim:foldmethod=marker:foldlevel=0 -"}}} \ No newline at end of file diff --git a/vim/colors/synthwave.vim b/vim/colors/synthwave.vim deleted file mode 100644 index 747c55e..0000000 --- a/vim/colors/synthwave.vim +++ /dev/null @@ -1,291 +0,0 @@ -" Name: Synthwave84 -" Author: Anikin Artyom -" Maintainer: Anikin Artyom -" Website: https://github.com/artanikin/vim-synthwave84 -" License: Vim License (see `:help license`) -" Last Updated: Wed Aug 7 12:28:29 2019 - -" Generated by Colortemplate v2.0.0 - -set background=dark - -hi clear -if exists('syntax_on') - syntax reset -endif - -let g:colors_name = 'synthwave84' - -let s:t_Co = exists('&t_Co') && !empty(&t_Co) && &t_Co > 1 ? &t_Co : 2 - -hi! link EndOfBuffer NonText -hi! link QuickFixLine Search -hi! link Boolean Constant -hi! link Character Constant -hi! link Conditional Statement -hi! link Define PreProc -hi! link Debug Special -hi! link Delimiter Special -hi! link Exception Statement -hi! link Float Number -hi! link Function Identifier -hi! link Keyword Statement -hi! link Label Statement -hi! link Macro PreProc -hi! link Number Constant -hi! link Operator Statement -hi! link PreCondit PreProc -hi! link Repeat Statement -hi! link SpecialChar Special -hi! link SpecialComment Special -hi! link StorageClass Type -hi! link Structure Type -hi! link Tag Special -hi! link Typedef Type -hi! link lCursor Cursor -hi! link jsFlowMaybe Normal -hi! link jsFlowObject Normal -hi! link jsFlowType PreProc -hi! link jsClassDefinition Normal -hi! link jsClassFuncName Title -hi! link jsImport Include -hi! link jsExport Include -hi! link jsFrom PreProc -hi! link jsFuncName Identifier -hi! link jsFutureKeys Statement -hi! link jsFuncCall Identifier -hi! link jsModuleKeywords Statement -hi! link jsModuleOperators Statement -hi! link jsNull Constant -hi! link jsObjectFuncName Identifier -hi! link jsObjectKey Title -hi! link jsSuper Statement -hi! link jsTemplateBraces Special -hi! link jsUndefined Constant -hi! link jsFunction PreProc -hi! link jsThis Constant -hi! link jsStorageClass PreProc -hi! link jsVariableDef Title -hi! link jsAsyncKeyword Title -hi! link jsFuncArgs Title -hi! link jsArrowFuncArgs Title -hi! link jsArrowFunction PreProc -hi! link jsObjectShorthandProp Title -hi! link jsGlobalObjects Constant -hi! link jsModuleKeyword Title -hi! link jsClassStringKey Title -hi! link jsObjectKeyComputed Title -hi! link jsObjectValue Title -hi! link jsBlockLabel Title -hi! link jsBlockLabelKey Title -hi! link rubyClass PreProc -hi! link rubyConstant Constant -hi! link rubyInstanceVariable Title -hi! link rubyInterpolationDelimiter Identifier -hi! link rubyModule Statement -hi! link rubyFunction Identifier -hi! link rubyInclude Include -hi! link markdownBold Special -hi! link markdownCode String -hi! link markdownCodeDelimiter String -hi! link markdownHeadingDelimiter Comment -hi! link markdownRule Comment - -if (has('termguicolors') && &termguicolors) || has('gui_running') - let g:terminal_ansi_colors = ['Black', 'DarkRed', 'DarkGreen', 'DarkYellow', - \ 'DarkBlue', 'DarkMagenta', 'DarkCyan', 'LightGrey', 'DarkGrey', 'Red', - \ 'Green', '#FEDE5D', 'Blue', '#D884C7', 'Cyan', 'White'] - hi Normal guifg=#ECEBED guibg=#262335 guisp=NONE gui=NONE cterm=NONE - hi ColorColumn guifg=NONE guibg=#2C2540 guisp=NONE gui=NONE cterm=NONE - hi Cursor guifg=Black guibg=fg guisp=NONE gui=NONE cterm=NONE - hi CursorColumn guifg=NONE guibg=#2C2540 guisp=NONE gui=NONE cterm=NONE - hi CursorLine guifg=NONE guibg=#2C2540 guisp=NONE gui=NONE cterm=NONE - hi CursorLineNr guifg=#D4D3D7 guibg=#2C2540 guisp=NONE gui=bold cterm=bold - hi DiffAdd guifg=NONE guibg=#90DEB6 guisp=NONE gui=NONE cterm=NONE - hi DiffChange guifg=NONE guibg=#D884C7 guisp=NONE gui=NONE cterm=NONE - hi DiffDelete guifg=Black guibg=#EB8F82 guisp=NONE gui=bold cterm=bold - hi DiffText guifg=NONE guibg=Red guisp=NONE gui=bold cterm=bold - hi FoldColumn guifg=#495495 guibg=#2C2540 guisp=NONE gui=NONE cterm=NONE - hi Folded guifg=#495495 guibg=#2C2540 guisp=NONE gui=NONE cterm=NONE - hi LineNr guifg=#888690 guibg=NONE guisp=NONE gui=NONE cterm=NONE - hi NonText guifg=#495495 guibg=NONE guisp=NONE gui=bold cterm=bold - hi Pmenu guifg=#ECEBED guibg=#2C2540 guisp=NONE gui=NONE cterm=NONE - hi PmenuSbar guifg=NONE guibg=#3E3B4B guisp=NONE gui=NONE cterm=NONE - hi PmenuSel guifg=#ECEBED guibg=#495495 guisp=NONE gui=NONE cterm=NONE - hi PmenuThumb guifg=NONE guibg=#ECEBED guisp=NONE gui=NONE cterm=NONE - hi Search guifg=Black guibg=#FEDE5D guisp=NONE gui=NONE cterm=NONE - hi SignColumn guifg=#888690 guibg=NONE guisp=NONE gui=NONE cterm=NONE - hi SignColumn guifg=#ECEBED guibg=NONE guisp=NONE gui=NONE cterm=NONE - hi SpecialKey guifg=#ECEBED guibg=#2C2540 guisp=NONE gui=NONE cterm=NONE - hi StatusLine guifg=#ECEBED guibg=#2C2540 guisp=NONE gui=bold,reverse cterm=bold,reverse - hi StatusLineNC guifg=#ECEBED guibg=#2C2540 guisp=NONE gui=reverse cterm=reverse - hi TabLine guifg=#495495 guibg=#2C2540 guisp=NONE gui=NONE cterm=NONE - hi TabLineFill guifg=NONE guibg=#2C2540 guisp=NONE gui=NONE cterm=NONE - hi TabLineSel guifg=#EB8F82 guibg=#2C2540 guisp=NONE gui=NONE cterm=NONE - hi Title guifg=#D884C7 guibg=NONE guisp=NONE gui=NONE cterm=NONE - hi Todo guifg=Black guibg=#FEDE5D guisp=NONE gui=NONE cterm=NONE - hi VertSplit guifg=#2C2540 guibg=#495495 guisp=NONE gui=reverse cterm=reverse - hi Visual guifg=NONE guibg=#3E3B4B guisp=NONE gui=NONE cterm=NONE - hi VisualNOS guifg=NONE guibg=NONE guisp=NONE gui=bold,underline ctermfg=NONE ctermbg=NONE cterm=bold,underline - hi WildMenu guifg=Black guibg=#FEDE5D guisp=NONE gui=NONE cterm=NONE - hi Comment guifg=#495495 guibg=NONE guisp=NONE gui=NONE cterm=NONE - hi Constant guifg=#E55A5E guibg=NONE guisp=NONE gui=NONE cterm=NONE - hi Error guifg=#ECEBED guibg=Red guisp=NONE gui=NONE cterm=NONE - hi Identifier guifg=#40ffff guibg=NONE guisp=NONE gui=NONE cterm=NONE - hi Ignore guifg=Black guibg=NONE guisp=NONE gui=NONE cterm=NONE - hi Include guifg=#90DEB6 guibg=NONE guisp=NONE gui=NONE cterm=NONE - hi PreProc guifg=#FEDE5D guibg=NONE guisp=NONE gui=NONE cterm=NONE - hi Special guifg=#EA9652 guibg=NONE guisp=NONE gui=NONE cterm=NONE - hi Statement guifg=#FEDE5D guibg=NONE guisp=NONE gui=NONE cterm=NONE - hi String guifg=#EA9652 guibg=NONE guisp=NONE gui=NONE cterm=NONE - hi Type guifg=#E55A5E guibg=NONE guisp=NONE gui=NONE cterm=NONE - hi Underlined guifg=#40ffff guibg=NONE guisp=NONE gui=underline cterm=underline - hi rubySymbol guifg=#EB8F82 guibg=NONE guisp=NONE gui=NONE cterm=NONE - hi rubyBoolean guifg=#EB8F82 guibg=NONE guisp=NONE gui=NONE cterm=NONE - unlet s:t_Co - finish -endif - -if s:t_Co >= 256 - hi Normal ctermfg=7 ctermbg=8 cterm=NONE - if !has('patch-8.0.0616') " Fix for Vim bug - set background=dark - endif - hi ColorColumn ctermfg=NONE ctermbg=7 cterm=NONE - hi Cursor ctermbg=fg cterm=NONE - hi CursorColumn ctermfg=NONE ctermbg=7 cterm=NONE - hi CursorLine ctermfg=NONE ctermbg=7 cterm=NONE - hi CursorLineNr ctermfg=7 ctermbg=7 cterm=NONE - hi DiffAdd ctermfg=NONE ctermbg=121 cterm=NONE - hi DiffChange ctermfg=NONE ctermbg=13 cterm=NONE - hi DiffDelete ctermbg=224 cterm=NONE - hi DiffText ctermfg=NONE ctermbg=9 cterm=bold - hi FoldColumn ctermfg=14 ctermbg=7 cterm=NONE - hi Folded ctermfg=14 ctermbg=7 cterm=NONE - hi LineNr ctermfg=7 ctermbg=NONE cterm=NONE - hi NonText ctermfg=14 ctermbg=NONE cterm=NONE - hi Pmenu ctermfg=7 ctermbg=7 cterm=NONE - hi PmenuSbar ctermfg=NONE ctermbg=8 cterm=NONE - hi PmenuSel ctermfg=7 ctermbg=14 cterm=NONE - hi PmenuThumb ctermfg=NONE ctermbg=7 cterm=NONE - hi Search ctermbg=11 cterm=NONE - hi SignColumn ctermfg=7 ctermbg=NONE cterm=NONE - hi SignColumn ctermfg=7 ctermbg=NONE cterm=NONE - hi SpecialKey ctermfg=7 ctermbg=7 cterm=NONE - hi StatusLine ctermfg=7 ctermbg=7 cterm=bold,reverse - hi StatusLineNC ctermfg=7 ctermbg=7 cterm=reverse - hi TabLine ctermfg=14 ctermbg=7 cterm=NONE - hi TabLineFill ctermfg=NONE ctermbg=7 cterm=NONE - hi TabLineSel ctermfg=224 ctermbg=7 cterm=NONE - hi Title ctermfg=13 ctermbg=NONE cterm=NONE - hi Todo ctermbg=11 cterm=NONE - hi VertSplit ctermfg=7 ctermbg=14 cterm=reverse - hi Visual ctermfg=NONE ctermbg=8 cterm=NONE - hi VisualNOS ctermfg=NONE ctermbg=NONE cterm=bold,underline - hi WildMenu ctermbg=11 cterm=NONE - hi Comment ctermfg=14 ctermbg=NONE cterm=NONE - hi Constant ctermfg=9 ctermbg=NONE cterm=NONE - hi Error ctermfg=7 ctermbg=9 cterm=NONE - hi Identifier ctermfg=14 ctermbg=NONE cterm=NONE - hi Ignore ctermbg=NONE cterm=NONE - hi Include ctermfg=121 ctermbg=NONE cterm=NONE - hi PreProc ctermfg=11 ctermbg=NONE cterm=NONE - hi Special ctermfg=224 ctermbg=NONE cterm=NONE - hi Statement ctermfg=11 ctermbg=NONE cterm=NONE - hi String ctermfg=224 ctermbg=NONE cterm=NONE - hi Type ctermfg=9 ctermbg=NONE cterm=NONE - hi Underlined ctermfg=14 ctermbg=NONE cterm=underline - hi rubySymbol ctermfg=224 ctermbg=NONE cterm=NONE - hi rubyBoolean ctermfg=224 ctermbg=NONE cterm=NONE - unlet s:t_Co - finish -endif - -if s:t_Co >= 8 - hi Normal ctermfg=LightGray ctermbg=DarkGray cterm=NONE - if !has('patch-8.0.0616') " Fix for Vim bug - set background=dark - endif - hi ColorColumn ctermfg=NONE ctermbg=LightGray cterm=NONE - hi Cursor ctermfg=Black ctermbg=fg cterm=NONE - hi CursorColumn ctermfg=NONE ctermbg=LightGray cterm=NONE - hi CursorLine ctermfg=NONE ctermbg=LightGray cterm=NONE - hi CursorLineNr ctermfg=LightGray ctermbg=LightGray cterm=NONE - hi DiffAdd ctermfg=NONE ctermbg=LightGreen cterm=NONE - hi DiffChange ctermfg=NONE ctermbg=Magenta cterm=NONE - hi DiffDelete ctermfg=Black ctermbg=LightRed cterm=NONE - hi DiffText ctermfg=NONE ctermbg=Red cterm=bold - hi FoldColumn ctermfg=Cyan ctermbg=LightGray cterm=NONE - hi Folded ctermfg=Cyan ctermbg=LightGray cterm=NONE - hi LineNr ctermfg=LightGray ctermbg=NONE cterm=NONE - hi NonText ctermfg=Cyan ctermbg=NONE cterm=NONE - hi Pmenu ctermfg=LightGray ctermbg=LightGray cterm=NONE - hi PmenuSbar ctermfg=NONE ctermbg=DarkGray cterm=NONE - hi PmenuSel ctermfg=LightGray ctermbg=Cyan cterm=NONE - hi PmenuThumb ctermfg=NONE ctermbg=LightGray cterm=NONE - hi Search ctermfg=Black ctermbg=Yellow cterm=NONE - hi SignColumn ctermfg=LightGray ctermbg=NONE cterm=NONE - hi SignColumn ctermfg=LightGray ctermbg=NONE cterm=NONE - hi SpecialKey ctermfg=LightGray ctermbg=LightGray cterm=NONE - hi StatusLine ctermfg=LightGray ctermbg=LightGray cterm=bold,reverse - hi StatusLineNC ctermfg=LightGray ctermbg=LightGray cterm=reverse - hi TabLine ctermfg=Cyan ctermbg=LightGray cterm=NONE - hi TabLineFill ctermfg=NONE ctermbg=LightGray cterm=NONE - hi TabLineSel ctermfg=LightRed ctermbg=LightGray cterm=NONE - hi Title ctermfg=Magenta ctermbg=NONE cterm=NONE - hi Todo ctermfg=Black ctermbg=Yellow cterm=NONE - hi VertSplit ctermfg=LightGray ctermbg=Cyan cterm=reverse - hi Visual ctermfg=NONE ctermbg=DarkGray cterm=NONE - hi VisualNOS ctermfg=NONE ctermbg=NONE cterm=bold,underline - hi WildMenu ctermfg=Black ctermbg=Yellow cterm=NONE - hi Comment ctermfg=Cyan ctermbg=NONE cterm=NONE - hi Constant ctermfg=Red ctermbg=NONE cterm=NONE - hi Error ctermfg=LightGray ctermbg=Red cterm=NONE - hi Identifier ctermfg=Cyan ctermbg=NONE cterm=NONE - hi Ignore ctermfg=Black ctermbg=NONE cterm=NONE - hi Include ctermfg=LightGreen ctermbg=NONE cterm=NONE - hi PreProc ctermfg=Yellow ctermbg=NONE cterm=NONE - hi Special ctermfg=LightRed ctermbg=NONE cterm=NONE - hi Statement ctermfg=Yellow ctermbg=NONE cterm=NONE - hi String ctermfg=LightRed ctermbg=NONE cterm=NONE - hi Type ctermfg=Red ctermbg=NONE cterm=NONE - hi Underlined ctermfg=Cyan ctermbg=NONE cterm=underline - hi rubySymbol ctermfg=LightRed ctermbg=NONE cterm=NONE - hi rubyBoolean ctermfg=LightRed ctermbg=NONE cterm=NONE - unlet s:t_Co - finish -endif - -" Color: black Black 0 Black -" Color: blue Blue 12 Blue -" Color: cyan Cyan 14 Cyan -" Color: cyanidentifier #40ffff 14 Cyan -" Color: darkblue DarkBlue 4 DarkBlue -" Color: darkcyan DarkCyan 6 DarkCyan -" Color: darkgreen DarkGreen 2 DarkGreen -" Color: darkmagenta DarkMagenta 5 DarkMagenta -" Color: darkred DarkRed 1 DarkRed -" Color: green Green 10 Green -" Color: lightgrey LightGrey 7 LightGrey -" Color: red Red 9 Red -" Color: white White 15 White -" Color: darkyellow DarkYellow 3 DarkYellow -" Color: darkgrey DarkGrey 8 DarkGrey -" Color: s_steelgray #262335 8 DarkGray -" Color: s_white #ECEBED 7 LightGray -" Color: s_tolopea #2C2540 7 LightGray -" Color: s_oslogray #888690 7 LightGray -" Color: s_lightgray #D4D3D7 7 LightGray -" Color: s_yellow #FEDE5D 11 Yellow -" Color: s_governorbay #495495 14 Cyan -" Color: s_grape #3E3B4B 8 DarkGray -" Color: s_red #E55A5E 9 Red -" Color: s_lightred #EB8F82 224 LightRed -" Color: s_magenta #D884C7 13 Magenta -" Color: s_orange #EA9652 224 LightRed -" Color: s_green #90DEB6 121 LightGreen -" Term Colors: black darkred darkgreen darkyellow darkblue darkmagenta darkcyan lightgrey -" Term Colors: darkgrey red green s_yellow blue s_magenta cyan white -" Background: dark -" vim: et ts=2 sw=2 - diff --git a/vim/editor.vim b/vim/editor.vim deleted file mode 100644 index cd79b2f..0000000 --- a/vim/editor.vim +++ /dev/null @@ -1,537 +0,0 @@ -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" Alicia Sykes's Vim Config for *nix systems -" -" Heavily inspired by: -" Amir Salihefendic (@amix3k): https://github.com/amix/vimrc -" -" Sections: -" -> General -" -> VIM user interface -" -> Colors and Fonts -" -> Files and backups -" -> Text, tab and indent related -" -> Visual mode related -" -> Moving around, tabs and buffers -" -> Status line -" -> Editing mappings -" -> Searching and cope displaying -" -> Spell checking -" -> Misc -" -> Helper functions -" -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" - - -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" => General -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" File encodings -set fileencoding=utf-8 -set fileencodings=utf-8 - -" Set title -set title - -" Set file formats for OS -set fileformats=unix - -" Default Shell -set shell=/bin/zsh - -" Sets how many lines of history VIM has to remember -set history=500 - -" Sets how many undo actions VIM will remember -set undolevels=100 - -" Enable filetype plugins -filetype plugin on -filetype indent on - -" Set to auto read when a file is changed from the outside -set autoread -au FocusGained,BufEnter * checktime - -" With a map leader it's possible to do extra key combinations -" like w saves the current file -let mapleader = "," - -" Fast saving -nmap w :w! - -" :W sudo saves the file -" (useful for handling the permission-denied error) -command! W execute 'w !sudo tee % > /dev/null' edit! - -" Normal OS clipboard interaction -set clipboard+=unnamedplus - -" Remember info about open buffers on close -set viminfo^= - -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" => VIM user interface -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" Set 7 lines to the cursor - when moving vertically using j/k -set so=7 - -" Avoid garbled characters in Chinese language windows OS -let $LANG='en' -set langmenu=en -source $VIMRUNTIME/delmenu.vim -source $VIMRUNTIME/menu.vim - -" Turn on the Wild menu -set wildmenu - -" Ignore compiled files -set wildignore=*.o,*~,*.pyc -if has("win16") || has("win32") - set wildignore+=.git\*,.hg\*,.svn\* -else - set wildignore+=*/.git/*,*/.hg/*,*/.svn/*,*/.DS_Store -endif - -"Always show current position -set ruler - -" Height of the command bar -set cmdheight=1 - -" A buffer becomes hidden when it is abandoned -set hid - -" Configure backspace so it acts as it should act -set backspace=eol,start,indent -set whichwrap+=<,>,h,l - -" Ignore case when searching -set ignorecase - -" When searching try to be smart about cases -set smartcase - -" Highlight search results -set hlsearch - -" Makes search act like search in modern browsers -set incsearch - -" Don't redraw while executing macros (good performance config) -set lazyredraw - -" For regular expressions turn magic on -set magic - -" Show matching brackets when text indicator is over them -set showmatch -" How many tenths of a second to blink when matching brackets -set mat=2 - -" No annoying sound on errors -set noerrorbells -set novisualbell -set t_vb= -set tm=500 - -" Properly disable sound on errors on MacVim -if has("gui_macvim") - autocmd GUIEnter * set vb t_vb= -endif - - -" Add a bit extra margin to the left -set foldcolumn=1 - - -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" => Colors and Fonts -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" Enable syntax highlighting -syntax enable - -" Enable 256 colors palette in Gnome Terminal -if $COLORTERM == 'gnome-terminal' - set t_Co=256 -endif - -set background=dark - -" Set extra options when running in GUI mode -if has("gui_running") - set guioptions-=T - set guioptions-=e - set t_Co=256 - set guitablabel=%M\ %t -endif - -" Set utf8 as standard encoding and en_US as the standard language -set encoding=utf8 - -" Use Unix as the standard file type -set ffs=unix,dos,mac - -" Set font to Hack -set guifont=Hack:h20 -set guifont=Monospace:h20 - -" Set color schemes, when availible -augroup colorscheme_customization - au! - if has('termguicolors') - set termguicolors - endif - - if has_key(g:plugs, 'dracula') - let g:_bold = 1 - let g:dracula_italic = 1 - let g:dracula_colorterm = 0 - - colorscheme dracula - - if has_key(g:plugs, 'vim-airline') - let g:airline_theme = 'dracula' - call airline#load_theme() | call airline#update_statusline() - endif - - endif -augroup END - -colorscheme synthwave - - -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" => Files, backups and undo -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" Turn backup off, since most stuff is in SVN, git etc. anyway... -set nobackup -set nowb -set noswapfile - -" Persistent undo, for making more 'u' operations -if has('persistent_undo') - set undodir=~/.vim/undodir - set undofile - set undolevels=1000 - set undoreload=10000 -endif - -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" => Text, tab and indent related -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" Do not wrap lines -set nowrap - -" Use spaces instead of tabs -set expandtab - -" Be smart when using tabs ;) -set smarttab - -" 1 tab == 4 spaces -set shiftwidth=4 -set tabstop=4 -set softtabstop=4 -set expandtab -set smarttab - -" Linebreak on 500 characters -set lbr -set tw=500 - -set ai "Auto indent -set si "Smart indent -set wrap "Wrap lines - -" Indentation settings -set autoindent -set copyindent - - -"""""""""""""""""""""""""""""" -" => Visual mode related -"""""""""""""""""""""""""""""" -" Visual mode pressing * or # searches for the current selection -" Super useful! From an idea by Michael Naumann -vnoremap * :call VisualSelection('', '')/=@/ -vnoremap # :call VisualSelection('', '')?=@/ - -" Show linenumbers -set number relativenumber -augroup numbertoggle - autocmd! - autocmd BufEnter,FocusGained,InsertLeave * set relativenumber - autocmd BufLeave,FocusLost,InsertEnter * set norelativenumber -augroup END -set ruler - -" Enable folding -set foldmethod=indent -set foldlevel=99 -nnoremap za -vnoremap za - -" Make whitespaces, tabs visible -set list -set listchars-=nbsp:+ -set listchars-=trail- -set listchars+=trail:•,nbsp:~,eol:↵ -highlight BadWhitespace ctermbg=red guibg=red - -" Splitting windows settings -set splitbelow -set splitright - -" Open Vim help verically -augroup help_vertical - au! - command! -nargs=* -complete=help Help vertical belowright help - autocmd FileType help wincmd L -augroup END - - -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" => Moving around, tabs, windows and buffers -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" Map to / (search) and Ctrl- to ? (backwards search) -map / -map ? - -" Disable highlight when is pressed -map :noh - -" Quicker way to move between windows -map j -map k -map h -map l - -" Quicker resizing with arrows -nnoremap :vertical resize +2 -nnoremap :vertical resize -2 -nnoremap :resize +2 -nnoremap :resize -2 - -" Close the current buffer -map bd :Bclose:tabclosegT - -" Close all the buffers -map ba :bufdo bd - -map l :bnext -map h :bprevious - -" Useful mappings for managing tabs -map tn :tabnew -map to :tabonly -map tc :tabclose -map tm :tabmove -map t :tabnext - -" Let 'tl' toggle between this and the last accessed tab -let g:lasttab = 1 -nmap tl :exe "tabn ".g:lasttab -au TabLeave * let g:lasttab = tabpagenr() - -" Opens a new tab with the current buffer's path -" Super useful when editing files in the same directory -map te :tabedit =expand("%:p:h")/ - -" Switch CWD to the directory of the open buffer -map cd :cd %:p:h:pwd - -" Specify the behavior when switching between buffers -try - set switchbuf=useopen,usetab,newtab - set stal=2 -catch -endtry - -" Make the keyboard faster -set ttyfast -set timeout timeoutlen=1000 ttimeoutlen=50 - -" Return to last edit position when opening files (You want this!) -au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif - -" Ignore encoded, irrelevant or temp files while searching -set wildignore+=*.BACKUP.*,*.BASE.*,*.LOCAL.*,*.REMOTE.* -set wildignore+=/tmp/** -set wildignore=*.o,*.obj,*~,*.exe,*.a,*.pdb,*.lib -set wildignore+=*.so,*.dll,*.swp,*.egg,*.jar,*.class,*.pyc,*.pyo,*.bin,*.dex -set wildignore+=*.log,*.pyc,*.sqlite,*.sqlite3,*.min.js,*.min.css,*.tags -set wildignore+=*.zip,*.7z,*.rar,*.gz,*.tar,*.gzip,*.bz2,*.tgz,*.xz -set wildignore+=*.png,*.jpg,*.gif,*.bmp,*.tga,*.pcx,*.ppm,*.img,*.iso -set wildignore+=*.pdf,*.dmg,*.app,*.ipa,*.apk,*.mobi,*.epub -set wildignore+=*.mp4,*.avi,*.flv,*.mov,*.mkv,*.swf,*.swc -set wildignore+=*.ppt,*.pptx,*.doc,*.docx,*.xlt,*.xls,*.xlsx,*.odt,*.wps -set wildignore+=*/.git/*,*/.svn/*,*.DS_Store -set wildignore+=*/node_modules/*,*/nginx_runtime/*,*/build/*,*/logs/*,*/dist/*,*/tmp/* -set wildignore+=*/.aws-sam/* -set wildmode=longest:full,full -set wildmenu - -" Nerd-Tree Options -let g:netrw_banner=1 -let g:netrw_browse_split=4 " open in prior window -let g:netrw_altv=1 " open splits to the right -let g:netrw_liststyle=3 " tree view -let g:netrw_list_hide=netrw_gitignore#Hide() -let g:netrw_list_hide.=',\(^\|\s\s\)\zs\.\S\+' - -" Navigate through buffers -nnoremap :bnext -nnoremap :bprevious -nnoremap q :bdgT -nnoremap Q :bufdo bd -nnoremap r :e -nnoremap R :e! - -" Tabs keybindings -map :tabr -map :tabl -map :tabp -map :tabn - - -"""""""""""""""""""""""""""""" -" => Status line -"""""""""""""""""""""""""""""" -" Always show the status line -set laststatus=2 - -" Format the status line -set statusline=\ %{HasPaste()}%F%m%r%h\ %w\ \ CWD:\ %r%{getcwd()}%h\ \ \ Line:\ %l\ \ Column:\ %c - - -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" => Editing mappings -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" Remap VIM 0 to first non-blank character -map 0 ^ - -" Move a line of text using ALT+[jk] or Command+[jk] on mac -nmap mz:m+`z -nmap mz:m-2`z -vmap :m'>+`mzgv`yo`z -vmap :m'<-2`>my` - nmap - vmap - vmap -endif - -" Delete trailing white space on save, useful for some filetypes ;) -fun! CleanExtraSpaces() - let save_cursor = getpos(".") - let old_query = getreg('/') - silent! %s/\s\+$//e - call setpos('.', save_cursor) - call setreg('/', old_query) -endfun - -if has("autocmd") - autocmd BufWritePre *.txt,*.js,*.py,*.wiki,*.sh,*.coffee :call CleanExtraSpaces() -endif - - -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" => Searching -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" - -" make searching smart -if executable('ag') - set grepprg=ag\ --nogroup\ --nocolor\ --vimgrep - set grepformat^=%f:%l:%c:%m -endif -set ignorecase -set smartcase - -" Center the screen when advancing to next match -nnoremap n nzzzv -nnoremap N Nzzzv - -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" => Spell checking -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" Pressing ,ss will toggle and untoggle spell checking -map ss :setlocal spell! - -" Shortcuts using -map sn ]s -map sp [s -map sa zg -map s? z= - - -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" => Misc -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" Remove the Windows ^M - when the encodings gets messed up -noremap m mmHmt:%s///ge'tzt'm - -" Quickly open a buffer for scribble -map q :e ~/buffer - -" Quickly open a markdown buffer for scribble -map x :e ~/buffer.md - -" Toggle paste mode on and off -map pp :setlocal paste! - - -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" => Helper functions -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" Returns true if paste mode is enabled -function! HasPaste() - if &paste - return 'PASTE MODE ' - endif - return '' -endfunction - -" Don't close window, when deleting a buffer -command! Bclose call BufcloseCloseIt() -function! BufcloseCloseIt() - let l:currentBufNum = bufnr("%") - let l:alternateBufNum = bufnr("#") - - if buflisted(l:alternateBufNum) - buffer # - else - bnext - endif - - if bufnr("%") == l:currentBufNum - new - endif - - if buflisted(l:currentBufNum) - execute("bdelete! ".l:currentBufNum) - endif -endfunction - -function! CmdLine(str) - call feedkeys(":" . a:str) -endfunction - -function! VisualSelection(direction, extra_filter) range - let l:saved_reg = @" - execute "normal! vgvy" - - let l:pattern = escape(@", "\\/.*'$^~[]") - - if a:direction == 'gv' - call CmdLine("Ack '" . l:pattern . "' " ) - elseif a:direction == 'replace' - call CmdLine("%s" . '/'. l:pattern . '/') - endif - - let @/ = l:pattern - let @" = l:saved_reg -endfunction - -" The End :) diff --git a/vim/filetype.vim b/vim/filetype.vim deleted file mode 100644 index 39e6b3a..0000000 --- a/vim/filetype.vim +++ /dev/null @@ -1,51 +0,0 @@ -scriptencoding utf-8 - -set fileformats=unix,dos,mac - -augroup git_ft_config - au! - au BufNewFile,BufRead gitconfig setlocal ft=gitconfig nolist nospell ts=4 sw=4 noet - au BufNewFile,BufRead .gitconfig* setlocal ft=gitconfig nolist nospell ts=4 sw=4 noet - au FileType gitcommit setlocal nospell -augroup END - -augroup js_ft_settings - au! - au BufRead,BufNewFile *.js,*.jsx set et ai ts=4 sts=4 sw=4 tw=79 - au BufRead,BufNewFile *.js,*.jsx match BadWhitespace /^\t\+/ - au BufRead,BufNewFile *.js,*.jsx match BadWhitespace /\s\+$/ - au BufNewFile *.js,*.jsx set fileformat=unix - au BufRead,BufNewFile *.js,*.jsx let b:comment_leader = '//' -augroup END - -augroup sh_ft_settings - au! - au BufNewFile,BufRead *.sh setlocal ai et ts=2 sw=2 sts=2 -augroup END - -augroup vim_ft_settings - au! - au BufNewFile,BufRead *.vim setlocal ai et ts=2 sw=2 sts=2 -augroup END - -augroup text_ft_settings - au! - au BufNewFile,BufRead *.txt setlocal et ts=4 sw=4 -augroup END - -augroup cpp_ft_settings - au! - au BufNewFile,BufRead *.cpp setlocal et ts=2 sw=2 - au BufNewFile,BufRead *.hpp setlocal et ts=2 sw=2 -augroup END - -augroup json_ft_settings - au! - au FileType json setlocal foldmethod=syntax - au BufNewFile,BufRead *.json setlocal et ts=2 sw=2 -augroup END - -augroup asciidoc_ft_settings - au! - au FileType asciidoc setlocal spell -augroup END diff --git a/vim/ftdetect/Dockerfile.vim b/vim/ftdetect/Dockerfile.vim deleted file mode 100644 index ee2976f..0000000 --- a/vim/ftdetect/Dockerfile.vim +++ /dev/null @@ -1,8 +0,0 @@ -" vint: -ProhibitAutocmdWithNoGroup - -" Dockerfile -autocmd BufRead,BufNewFile [Dd]ockerfile set ft=Dockerfile -autocmd BufRead,BufNewFile Dockerfile* set ft=Dockerfile -autocmd BufRead,BufNewFile [Dd]ockerfile.vim set ft=vim -autocmd BufRead,BufNewFile *.dock set ft=Dockerfile -autocmd BufRead,BufNewFile *.[Dd]ockerfile set ft=Dockerfile diff --git a/vim/ftdetect/cloudformation.vim b/vim/ftdetect/cloudformation.vim deleted file mode 100644 index ffa0183..0000000 --- a/vim/ftdetect/cloudformation.vim +++ /dev/null @@ -1,4 +0,0 @@ -augroup cfn - au BufRead,BufNewFile template.yml set filetype=yaml.cloudformation - au BufRead,BufNewFile *.template.yml set filetype=yaml.cloudformation -augroup END diff --git a/vim/ftdetect/docker-compose.vim b/vim/ftdetect/docker-compose.vim deleted file mode 100644 index 61a3876..0000000 --- a/vim/ftdetect/docker-compose.vim +++ /dev/null @@ -1,4 +0,0 @@ -" vint: -ProhibitAutocmdWithNoGroup - -" docker-compose.yml -autocmd BufRead,BufNewFile docker-compose*.{yaml,yml}* set ft=yaml.docker-compose diff --git a/vim/ftdetect/sshconfig.vim b/vim/ftdetect/sshconfig.vim deleted file mode 100644 index 7d0a418..0000000 --- a/vim/ftdetect/sshconfig.vim +++ /dev/null @@ -1,4 +0,0 @@ -augroup sshconfig_ft - au BufNewFile,BufRead *ssh/config setfiletype sshconfig - au BufNewFile,BufRead *ssh/config.d/*.config setfiletype sshconfig -augroup END diff --git a/vim/ftplugin/Dockerfile.vim b/vim/ftplugin/Dockerfile.vim deleted file mode 100644 index 79edc46..0000000 --- a/vim/ftplugin/Dockerfile.vim +++ /dev/null @@ -1,33 +0,0 @@ -" Define comment string -setlocal commentstring=#\ %s - -" Enable automatic comment insertion -setlocal formatoptions+=cro - -function! DockerfileReplaceInstruction(original, replacement) - let syn = synIDtrans(synID(line("."), col(".") - 1, 0)) - if syn != hlID("Comment") && syn != hlID("Constant") && strlen(getline(".")) == 0 - let word = a:replacement - else - let word = a:original - endif - let g:UnduBuffer = a:original - return word -endfunction - -inoreabbr from =DockerfileReplaceInstruction("from", "FROM") -inoreabbr maintainer =DockerfileReplaceInstruction("maintainer", "MAINTAINER") -inoreabbr run =DockerfileReplaceInstruction("run", "RUN") -inoreabbr cmd =DockerfileReplaceInstruction("cmd", "CMD") -inoreabbr label =DockerfileReplaceInstruction("label", "LABEL") -inoreabbr expose =DockerfileReplaceInstruction("expose", "EXPOSE") -inoreabbr env =DockerfileReplaceInstruction("env", "ENV") -inoreabbr add =DockerfileReplaceInstruction("add", "ADD") -inoreabbr copy =DockerfileReplaceInstruction("copy", "COPY") -inoreabbr entrypoint =DockerfileReplaceInstruction("entrypoint", "ENTRYPOINT") -inoreabbr volume =DockerfileReplaceInstruction("volume", "VOLUME") -inoreabbr user =DockerfileReplaceInstruction("user", "USER") -inoreabbr workdir =DockerfileReplaceInstruction("workdir", "WORKDIR") -inoreabbr arg =DockerfileReplaceInstruction("arg", "ARG") -inoreabbr onbuild =DockerfileReplaceInstruction("onbuild", "ONBUILD") -inoreabbr stopsignal =DockerfileReplaceInstruction("stopsignal", "STOPSIGNAL") diff --git a/vim/ftplugin/docker-compose.vim b/vim/ftplugin/docker-compose.vim deleted file mode 100644 index 4564fd0..0000000 --- a/vim/ftplugin/docker-compose.vim +++ /dev/null @@ -1,5 +0,0 @@ -" Define comment string -setlocal commentstring=#\ %s - -" Enable automatic comment insertion -setlocal formatoptions+=cro diff --git a/vim/ftplugin/gitcommit.vim b/vim/ftplugin/gitcommit.vim deleted file mode 100644 index 1d6c282..0000000 --- a/vim/ftplugin/gitcommit.vim +++ /dev/null @@ -1,7 +0,0 @@ -if exists('b:did_ftplugin') - finish -endif -let b:did_ftplugin = 1 - -set spell -set spelllang=en diff --git a/vim/ftplugin/go.vim b/vim/ftplugin/go.vim deleted file mode 100644 index 8a3aa03..0000000 --- a/vim/ftplugin/go.vim +++ /dev/null @@ -1,19 +0,0 @@ -if exists('b:did_ftplugin') - finish -endif -let b:did_ftplugin = 1 - -let b:ale_linters = ['go build', 'gometalinter', 'gopls'] -let b:ale_fixers = ['gofmt', 'goimports', 'trim_whitespace'] - -setlocal noexpandtab -setlocal shiftwidth=4 -setlocal softtabstop=4 -setlocal tabstop=4 - -setlocal nolisp -setlocal autoindent - -setlocal nospell - -set makeprg=go " point :make to go binary diff --git a/vim/ftplugin/javascript.vim b/vim/ftplugin/javascript.vim deleted file mode 100644 index 64dccd4..0000000 --- a/vim/ftplugin/javascript.vim +++ /dev/null @@ -1,67 +0,0 @@ -" make Vim recognize ES6 import statements -let &l:include = 'from\|require' - -" allow Vim to parse path aliases such as ~/components or @/components -" which are common in Vue projects -setlocal isfname+=@-@ -setlocal suffixesadd+=.vue -let &l:includeexpr = "path#resolve_alias(['~', '@'], ['src', 'app'], v:fname)" - -" make Vim use ES6 export statements as define statements -let &l:define = '\v(export\s+(default\s+)?)?(var|let|const|(async\s+)?function|class)|export\s+' - -setlocal textwidth=80 - -" define convenience sniplets -let s:snippets_map={ - \ "log": "console.log(", - \ "warn": "console.warn(", - \ "json": "JSON.stringify", - \ "jlog": "console.log(JSON.stringify(, null, 2))\2F,", - \ "fn": "() => {}", - \ "if": "if () {\\k\f)", - \ "ifelse": "if () {\\j else {\\3k\f)", - \ "try": "try {\\j catch (error) {\\{\", - \ "tryf": "try {\\j catch (error) {\\j finally {\\2{\", - \ "pobj": "PropTypes.object", - \ "pfn": "PropTypes.func", - \ "parr": "PropTypes.arrayOf(", - \ "pstr": "PropTypes.string", - \ "pbool": "PropTypes.bool", - \ "pshape": "PropTypes.shape({", - \ "pnum": "PropTypes.number", - \ "pany": "PropTypes.any", - \ "pnode": "PropTypes.node", - \ "pone": "PropTypes.oneOf([", - \ "ptypes": "static propTypes = {", - \ "defprops": "static defaultProps = {", - \ "ctypes": "static contextTypes = {", - \ "constructor": "constructor(props) { -super(props);", - \ "cwm": "componentWillMount() {", - \ "cdm": "componentDidMount() {", - \ "scu": "shouldComponentUpdate(nextProps, nextState) {", - \ "cwrp": "componentWillReceiveProps(nextProps) {", - \ "cwu": "componentWillUpdate() {", - \ "cdu": "componentDidUpdate() {", - \ "cwum": "componentWillUnmount() {", - \ } - -for [s:pattern, s:expansion] in items(s:snippets_map) - execute "ISnipletBuffer" s:pattern s:expansion -endfor - -CSnipletBuffer json JSON.stringify -CSnipletBuffer warn console.warn -CSnipletBuffer log console.log - -" define convenience map for destructuring -inoremap xx ;Bconst {} = F} -inoremap xi ';B'import {} from F} - -" define convenience map for passing down handler props -inoremap xp "zyiwz={} - \:keeppatterns s/handle/on - -" allow filename completion with import * from ../ -call cwd#ChangeOnInsert() diff --git a/vim/ftplugin/markdown.vim b/vim/ftplugin/markdown.vim deleted file mode 100644 index ba21bcd..0000000 --- a/vim/ftplugin/markdown.vim +++ /dev/null @@ -1,18 +0,0 @@ -if exists('b:did_ftplugin') - finish -endif -let b:did_ftplugin = 1 - -setlocal spell -setlocal expandtab -setlocal tabstop=4 -setlocal shiftwidth=4 -setlocal textwidth=99 - -" spellcheck -setlocal spell - -" generate TOC quicker -nmap toc :GenTocGFM - -let b:ale_fixers = ['trim_whitespace', 'remove_trailing_lines', 'prettier'] diff --git a/vim/ftplugin/python.vim b/vim/ftplugin/python.vim deleted file mode 100644 index 2cea4bb..0000000 --- a/vim/ftplugin/python.vim +++ /dev/null @@ -1,67 +0,0 @@ -if exists('b:did_ftplugin') - finish -endif -let b:did_ftplugin = 1 - -setlocal expandtab -setlocal autoindent -setlocal smartindent -setlocal textwidth=79 -setlocal tabstop=4 -setlocal softtabstop=4 -setlocal shiftwidth=4 -setlocal fileformat=unix - -set backspace=indent,eol,start - -match BadWhitespace /^\t\+/ -match BadWhitespace /\s\+$/ - -let b:comment_leader = '#' -let b:ale_fix_on_save = 0 - -let b:ale_linters = ['mypy', 'flake8'] -let b:ale_fixers = ['trim_whitespace', 'remove_trailing_lines'] - -if isdirectory($VIRTUAL_ENV) - let s:yapf_bin = expand($VIRTUAL_ENV.'/bin/yapf') - let s:black_bin = expand($VIRTUAL_ENV.'/bin/black') - if executable(s:black_bin) - call add(b:ale_fixers, 'black') - elseif executable(s:yapf_bin) - call add(b:ale_fixers, 'yapf') - endif -elseif executable('yapf') - call add(b:ale_fixers, 'yapf') -elseif executable('black') - call add(b:ale_fixers, 'black') -endif - -" if enabled, it makes flake8 loose its configuration file in project root -let b:ale_python_flake8_change_directory = 0 - -" always load pyls from neovim3 virtualenv :) -let b:ale_python_pyls_executable = expand(fnamemodify(g:python3_host_prog, ':h') . '/' . 'pyls') -if executable(b:ale_python_pyls_executable) - - call add(b:ale_linters, 'pyls') - - let b:ale_python_pyls_config = { - \ 'pyls': { - \ 'plugins': { - \ 'flake8': {'enabled': v:true}, - \ 'mypy': {'enabled': v:true}, - \ 'yapf': {'enabled': v:true}, - \ 'pyflakes': {'enabled': v:false}, - \ 'pycodestyle': {'enabled': v:false}, - \ 'jedi': {'enabled': v:true}, - \ 'rope': {'enabled': v:true}, - \ 'jedi_definition': { - \ 'follow_imports': v:true, - \ 'follow_builtin_imports': v:true, - \ }, - \ } - \ }} - -endif - diff --git a/vim/ftplugin/scss.vim b/vim/ftplugin/scss.vim deleted file mode 100644 index 286240c..0000000 --- a/vim/ftplugin/scss.vim +++ /dev/null @@ -1,13 +0,0 @@ -if exists('b:did_ftplugin') - finish -endif -let b:did_ftplugin = 1 - -setlocal autoindent -setlocal expandtab -setlocal tabstop=2 -setlocal shiftwidth=2 -setlocal softtabstop=2 - -" ale fixer settings -let b:ale_fixers = ['trim_whitespace', 'remove_trailing_lines', 'prettier'] diff --git a/vim/ftplugin/typescript-react.vim b/vim/ftplugin/typescript-react.vim deleted file mode 100644 index c23ec13..0000000 --- a/vim/ftplugin/typescript-react.vim +++ /dev/null @@ -1 +0,0 @@ -runtime! ftplugin/typescript.vim diff --git a/vim/ftplugin/typescript.vim b/vim/ftplugin/typescript.vim deleted file mode 100644 index da4b1e8..0000000 --- a/vim/ftplugin/typescript.vim +++ /dev/null @@ -1,21 +0,0 @@ -if exists("b:did_ftplugin") - finish -endif -let b:did_ftplugin = 1 - -let s:cpo_save = &cpo -set cpo-=C - -compiler typescript -setlocal commentstring=//\ %s - -" Set 'formatoptions' to break comment lines but not other lines, -" " and insert the comment leader when hitting or using "o". -setlocal formatoptions-=t formatoptions+=croql - -setlocal suffixesadd+=.ts,.tsx - -let b:undo_ftplugin = "setl fo< ofu< com< cms<" - -let &cpo = s:cpo_save -unlet s:cpo_save diff --git a/vim/ftplugin/vue.vim b/vim/ftplugin/vue.vim deleted file mode 100644 index abacd38..0000000 --- a/vim/ftplugin/vue.vim +++ /dev/null @@ -1,11 +0,0 @@ -if exists('b:did_ftplugin') - finish -endif -let b:did_ftplugin = 1 - -setlocal tabstop=2 -setlocal softtabstop=2 -setlocal shiftwidth=2 - -let b:ale_fix_on_save = 1 -let b:ale_fixers = ['prettier', 'trim_whitespace', 'remove_trailing_lines'] diff --git a/vim/ftplugin/yaml.vim b/vim/ftplugin/yaml.vim deleted file mode 100644 index 751f0de..0000000 --- a/vim/ftplugin/yaml.vim +++ /dev/null @@ -1,38 +0,0 @@ -if exists('b:did_ftplugin') - finish -endif -let b:did_ftplugin = 1 - -setlocal expandtab -setlocal tabstop=2 -setlocal softtabstop=2 -setlocal shiftwidth=2 -setlocal foldmethod=indent -setlocal nowrap - -setlocal indentexpr=GetYamlIndent() -setlocal indentkeys=o,O,*,!^F - -function! GetYamlIndent() - let prevlnum = v:lnum - 1 - if prevlnum == 0 - return 0 - endif - let line = substitute(getline(v:lnum),'\s\+$','','') - let prevline = substitute(getline(prevlnum),'\s\+$','','') - - let indent = indent(prevlnum) - let increase = indent + &shiftwidth - let decrease = indent - &shiftwidth - - if prevline =~# ':$' - return increase - elseif prevline =~# '^\s\+\-' && line =~# '^\s\+[^-]\+:' - return decrease - else - return indent - endif -endfunction - -let b:ale_linters = ['yamllint', 'cloudformation'] -let b:ale_fixers = ['trim_whitespace', 'remove_trailing_lines', 'prettier'] diff --git a/vim/indent/Dockerfile.vim b/vim/indent/Dockerfile.vim deleted file mode 100644 index e7b5058..0000000 --- a/vim/indent/Dockerfile.vim +++ /dev/null @@ -1,23 +0,0 @@ -if exists('b:did_indent') | finish | endif -let b:did_indent = 1 - - -function! DockerfileIndent(line) - let prev_line = getline(a:line - 1) - if a:line > 1 && prev_line =~ '\\\s*$' - let i = indent(a:line - 1) - if i == 0 - let i += &l:shiftwidth - if &l:expandtab && prev_line =~# '^RUN\s' - " Overindent past RUN - let i = 4 + &l:shiftwidth - endif - endif - return i - endif - - return -1 -endfunction - - -set indentexpr=DockerfileIndent(v:lnum) diff --git a/vim/plugged/Dockerfile.vim b/vim/plugged/Dockerfile.vim deleted file mode 160000 index 2386923..0000000 --- a/vim/plugged/Dockerfile.vim +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 2386923a8c30d0c4f06f27eef2a025752423ea86 diff --git a/vim/plugged/SimpylFold b/vim/plugged/SimpylFold deleted file mode 160000 index 0459df8..0000000 --- a/vim/plugged/SimpylFold +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 0459df8a0bbfc8ef1bfd88db889e881626f65914 diff --git a/vim/plugged/ale b/vim/plugged/ale deleted file mode 160000 index 1773a49..0000000 --- a/vim/plugged/ale +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 1773a496ad39fdd3d904679955b39357f3f38442 diff --git a/vim/plugged/committia.vim b/vim/plugged/committia.vim deleted file mode 160000 index 1d28828..0000000 --- a/vim/plugged/committia.vim +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 1d288281586d1e6b52646a4c412df3dd3a2fe231 diff --git a/vim/plugged/deoplete.nvim b/vim/plugged/deoplete.nvim deleted file mode 160000 index 27af4ab..0000000 --- a/vim/plugged/deoplete.nvim +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 27af4ab2de157f80c8a8391aebb60061318814ea diff --git a/vim/plugged/dracula b/vim/plugged/dracula deleted file mode 160000 index e715437..0000000 --- a/vim/plugged/dracula +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e7154372adc95d637ccd911c2f8601d9ff2eac1f diff --git a/vim/plugged/fzf.vim b/vim/plugged/fzf.vim deleted file mode 160000 index 02a192e..0000000 --- a/vim/plugged/fzf.vim +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 02a192ea0bed22a015e005b281e55e0da2a8e496 diff --git a/vim/plugged/incsearch.vim b/vim/plugged/incsearch.vim deleted file mode 160000 index 25e2547..0000000 --- a/vim/plugged/incsearch.vim +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 25e2547fb0566460f5999024f7a0de7b3775201f diff --git a/vim/plugged/indentpython.vim b/vim/plugged/indentpython.vim deleted file mode 160000 index 6aaddfd..0000000 --- a/vim/plugged/indentpython.vim +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 6aaddfde21fe9e7acbe448b92b3cbb67f2fe1fc1 diff --git a/vim/plugged/nerdcommenter b/vim/plugged/nerdcommenter deleted file mode 160000 index b83e9cd..0000000 --- a/vim/plugged/nerdcommenter +++ /dev/null @@ -1 +0,0 @@ -Subproject commit b83e9cdf835161b398e04e4c462103fd21801ee3 diff --git a/vim/plugged/nerdtree b/vim/plugged/nerdtree deleted file mode 160000 index 3a9d533..0000000 --- a/vim/plugged/nerdtree +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 3a9d533f3de86a43b69f6c47d3394c0d866fdb08 diff --git a/vim/plugged/nginx.vim b/vim/plugged/nginx.vim deleted file mode 160000 index f21506f..0000000 --- a/vim/plugged/nginx.vim +++ /dev/null @@ -1 +0,0 @@ -Subproject commit f21506f8cd9ae8a21bb82fcb67830e5e29d186c5 diff --git a/vim/plugged/requirements.txt.vim b/vim/plugged/requirements.txt.vim deleted file mode 160000 index a86fea9..0000000 --- a/vim/plugged/requirements.txt.vim +++ /dev/null @@ -1 +0,0 @@ -Subproject commit a86fea904d8d54413e590a05bb2174fda0cee98d diff --git a/vim/plugged/syntastic b/vim/plugged/syntastic deleted file mode 160000 index d97a664..0000000 --- a/vim/plugged/syntastic +++ /dev/null @@ -1 +0,0 @@ -Subproject commit d97a664b9adbd1a0a9cba6c1c3baf071a1059d1e diff --git a/vim/plugged/tagbar b/vim/plugged/tagbar deleted file mode 160000 index 7e8aeb6..0000000 --- a/vim/plugged/tagbar +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 7e8aeb69709b73cdbdaf50f4d26ab45d7920b7f0 diff --git a/vim/plugged/vim-airline b/vim/plugged/vim-airline deleted file mode 160000 index c01977d..0000000 --- a/vim/plugged/vim-airline +++ /dev/null @@ -1 +0,0 @@ -Subproject commit c01977d027de854c6a85ed5c57915a7e8848f4b9 diff --git a/vim/plugged/vim-css-color b/vim/plugged/vim-css-color deleted file mode 160000 index 8dd7f1b..0000000 --- a/vim/plugged/vim-css-color +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 8dd7f1bf25acee493a5114e627ea90a9850c5fa8 diff --git a/vim/plugged/vim-devicons b/vim/plugged/vim-devicons deleted file mode 160000 index 0329d89..0000000 --- a/vim/plugged/vim-devicons +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 0329d89c5114dc285939050fd5777dbcc450ddd7 diff --git a/vim/plugged/vim-fugitive b/vim/plugged/vim-fugitive deleted file mode 160000 index 8cf0cf5..0000000 --- a/vim/plugged/vim-fugitive +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 8cf0cf5bfb2b858faecf4e0f6c1b8d0948805e5e diff --git a/vim/plugged/vim-git b/vim/plugged/vim-git deleted file mode 160000 index 4be54a3..0000000 --- a/vim/plugged/vim-git +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 4be54a3e2e300a94f6f7dfa7a6ee9e81245c9886 diff --git a/vim/plugged/vim-gitgutter b/vim/plugged/vim-gitgutter deleted file mode 160000 index 2e3cd54..0000000 --- a/vim/plugged/vim-gitgutter +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 2e3cd54ed696500bb3722226f2103d4b279272c0 diff --git a/vim/plugged/vim-go b/vim/plugged/vim-go deleted file mode 160000 index cb4c622..0000000 --- a/vim/plugged/vim-go +++ /dev/null @@ -1 +0,0 @@ -Subproject commit cb4c622c97a39652151748c4dec70a46e93a9117 diff --git a/vim/plugged/vim-gutentags b/vim/plugged/vim-gutentags deleted file mode 160000 index 50705e8..0000000 --- a/vim/plugged/vim-gutentags +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 50705e8ebb7038b31314f416d1bddd9cb9154049 diff --git a/vim/plugged/vim-javascript b/vim/plugged/vim-javascript deleted file mode 160000 index 3c90d0c..0000000 --- a/vim/plugged/vim-javascript +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 3c90d0cc37bb8b78422f647e62587f498a5dd7bd diff --git a/vim/plugged/vim-json b/vim/plugged/vim-json deleted file mode 160000 index 3727f08..0000000 --- a/vim/plugged/vim-json +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 3727f089410e23ae113be6222e8a08dd2613ecf2 diff --git a/vim/plugged/vim-jsx-pretty b/vim/plugged/vim-jsx-pretty deleted file mode 160000 index 6989f16..0000000 --- a/vim/plugged/vim-jsx-pretty +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 6989f1663cc03d7da72b5ef1c03f87e6ddb70b41 diff --git a/vim/plugged/vim-markdown b/vim/plugged/vim-markdown deleted file mode 160000 index 772de97..0000000 --- a/vim/plugged/vim-markdown +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 772de97c97d37e5e22d7bd6884b17b858a687bc2 diff --git a/vim/plugged/vim-matchup b/vim/plugged/vim-matchup deleted file mode 160000 index 52b3ec1..0000000 --- a/vim/plugged/vim-matchup +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 52b3ec1ee8d0f78c69bae6cc32f3c2d1a023a8c8 diff --git a/vim/plugged/vim-mustache-handlebars b/vim/plugged/vim-mustache-handlebars deleted file mode 160000 index fcc1401..0000000 --- a/vim/plugged/vim-mustache-handlebars +++ /dev/null @@ -1 +0,0 @@ -Subproject commit fcc1401c2f783c14314ef22517a525a884c549ac diff --git a/vim/plugged/vim-smoothie b/vim/plugged/vim-smoothie deleted file mode 160000 index 10fd0aa..0000000 --- a/vim/plugged/vim-smoothie +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 10fd0aa57d176718bc2c570f121ab523c4429a25 diff --git a/vim/plugged/vim-surround b/vim/plugged/vim-surround deleted file mode 160000 index f51a26d..0000000 --- a/vim/plugged/vim-surround +++ /dev/null @@ -1 +0,0 @@ -Subproject commit f51a26d3710629d031806305b6c8727189cd1935 diff --git a/vim/plugged/vim-test b/vim/plugged/vim-test deleted file mode 160000 index 77d0b89..0000000 --- a/vim/plugged/vim-test +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 77d0b89fe5648d0881e8506d1949a9412201772b diff --git a/vim/plugged/vim-visual-increment b/vim/plugged/vim-visual-increment deleted file mode 160000 index 0e55bb4..0000000 --- a/vim/plugged/vim-visual-increment +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 0e55bb4054cdd5eefc0bb870f3e3c249673817cb diff --git a/vim/plugged/vim-visual-multi b/vim/plugged/vim-visual-multi deleted file mode 160000 index 3ea06b6..0000000 --- a/vim/plugged/vim-visual-multi +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 3ea06b623d2234d75a33fed787b9a07a64fff9b2 diff --git a/vim/plugged/vimtex b/vim/plugged/vimtex deleted file mode 160000 index 3e76c81..0000000 --- a/vim/plugged/vimtex +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 3e76c81f329cb13b563b9092fb0e5097151bb08b diff --git a/vim/plugged/yats.vim b/vim/plugged/yats.vim deleted file mode 160000 index 6104b30..0000000 --- a/vim/plugged/yats.vim +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 6104b30b32732e367266f06ecf6e817df32ac1b9 diff --git a/vim/plugged/zinit-vim-syntax b/vim/plugged/zinit-vim-syntax deleted file mode 160000 index d7c3e1c..0000000 --- a/vim/plugged/zinit-vim-syntax +++ /dev/null @@ -1 +0,0 @@ -Subproject commit d7c3e1c2fd73983dd4318b4646da39401529fefa diff --git a/vim/plugins.vim b/vim/plugins.vim deleted file mode 100644 index 2219cb6..0000000 --- a/vim/plugins.vim +++ /dev/null @@ -1,280 +0,0 @@ -scriptencoding utf-8 - -" © Alicia Sykes 2021 Licensed under MIT - -" Initiate Plugins -call plug#begin('~/.vim/plugged') - -" Layout and Navigation -Plug 'vim-airline/vim-airline' -Plug 'preservim/nerdtree' -Plug 'andymass/vim-matchup' -Plug 'preservim/tagbar' -Plug 'ludovicchabant/vim-gutentags' -Plug '~/.fzf' -Plug 'junegunn/fzf.vim' -Plug 'psliwka/vim-smoothie' -Plug 'ryanoasis/vim-devicons' -if has('nvim') - Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } -else - Plug 'Shougo/deoplete.nvim', { 'do': '!pip install --user --upgrade neovim' } -endif - -" Text Operations -Plug 'preservim/nerdcommenter' -Plug 'dense-analysis/ale' -Plug 'tpope/vim-surround' -Plug 'haya14busa/incsearch.vim' -Plug 'mg979/vim-visual-multi' -Plug 'triglav/vim-visual-increment' -Plug 'janko/vim-test' -Plug 'vim-syntastic/syntastic' - -" Git -Plug 'airblade/vim-gitgutter' -Plug 'tpope/vim-fugitive' -Plug 'rhysd/committia.vim' -Plug 'tpope/vim-git' - -" Specific File Types -Plug 'pangloss/vim-javascript', { 'for': ['javascript'] } -Plug 'HerringtonDarkholme/yats.vim', { 'for': ['typescript'] } -Plug 'MaxMEllon/vim-jsx-pretty', { 'for': ['jsx', 'tsx'] } -Plug 'ap/vim-css-color', { 'for': ['css', 'scss', 'sass'] } -Plug 'mustache/vim-mustache-handlebars', {'for': ['mustache', 'handlebars', 'html']} -Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' } -Plug 'vim-scripts/indentpython.vim', {'for': ['python']} -Plug 'tmhedberg/SimpylFold', {'for': ['python']} -Plug 'lervag/vimtex', { 'for': ['tex'] } -Plug 'ekalinin/Dockerfile.vim', { 'for': ['dockerfile', 'docker-compose', 'Dockerfile'], 'do': 'make install' } -Plug 'elzr/vim-json', {'for': ['json']} -Plug 'raimon49/requirements.txt.vim', {'for': ['requirements']} -Plug 'gabrielelana/vim-markdown', {'for': ['markdown']} -Plug 'zinit-zsh/zinit-vim-syntax' -Plug 'chr4/nginx.vim' -if has('nvim') - Plug 'numirias/semshi', {'for': ['python'], 'do': ':UpdateRemotePlugins' } -endif - -" Themes -Plug 'dracula/vim', { 'as': 'dracula' } - -call plug#end() - -" Plugin Configuration -" ===================== - -augroup vim_test_settings - autocmd! - let g:test#strategy = 'neovim' - let g:test#neovim#term_position = 'vertical' - - " Integrate with coverage tool - let g:test#python#pytest#options = '--cov-branch --cov-context=test' - - " disable vim-projectionist - let g:test#no_alternate = 1 - - nmap n :TestNearest - nmap f :TestFile - nmap s :TestSuite - nmap l :TestLast - nmap v :TestVisit - -augroup end - -augroup tagbar_plugin_settins - autocmd! - let g:tagbar_ctags_bin='ctags' - let g:tagbar_iconchars = ['►', '▼'] - let g:tagbar_autoclose = 1 - - let g:tagbar_type_markdown = { - \ 'ctagstype' : 'markdown', - \ 'kinds' : [ - \ 'h:headings', - \ 'l:links', - \ 'i:images' - \ ], - \ } - let g:tagbar_type_sh = { - \ 'ctagstype' : 'sh', - \ 'kinds' : [ - \ 'f:functions', - \ 'v:variables', - \ ], - \ } - let g:tagbar_type_elm = { - \ 'ctagstype' : 'elm', - \ 'kinds' : [ - \ 'm:module', - \ 'i:imports', - \ 't:types', - \ 'C:constructors', - \ 'c:constants', - \ 'f:functions', - \ 'p:ports' - \ ], - \ } - let g:tagbar_type_ansible = { - \ 'ctagstype' : 'ansible', - \ 'kinds' : [ - \ 't:tasks' - \ ], - \ } - - nmap :TagbarToggle -augroup END - - -if has_key(g:plugs, 'vim-airline') - augroup airline_plugin_settings - autocmd! - - let g:airline_powerline_fonts = 1 - let g:airline_left_sep='›' " Slightly fancier than '>' - let g:airline_right_sep='‹' " Slightly fancier than '<' - - let g:airline#extensions#ale#enabled = 1 - - let g:airline#extensions#tabline#formatter = 'unique_tail_improved' - let g:airline#extensions#tabline#enabled = 1 - let g:airline#extensions#tabline#left_sep=' ' - let g:airline#extensions#tabline#left_alt_sep=' ' - let g:airline#extensions#tabline#buffer_nr_format = '%s ' - let g:airline#extensions#tabline#buffer_nr_show = 1 - augroup END -endif - -" Commit Msg -let g:committia_hooks = {} -function! g:committia_hooks.edit_open(info) - " Scroll the diff window from insert mode - " Map and - imap (committia-scroll-diff-down-half) - imap (committia-scroll-diff-up-half) -endfunction - -" Python -let python_highlight_all = 1 -let g:pyenv#auto_create_ctags = 1 -let g:pyenv#auto_assign_ctags = 1 - -" Gutter -augroup gitgutter_options - autocmd! - let g:gitgutter_diff_args = '-w' " ignore whitespace changes - let g:gitgutter_sign_added = '' - - let g:gitgutter_sign_modified = '' - let g:gitgutter_sign_modified_removed = '' - - let g:gitgutter_sign_removed = '' - let g:gitgutter_sign_removed_first_line = '' - - let g:gitgutter_highlight_linenrs = 1 - - nmap (GitGutterUndoHunk) - nmap (GitGutterStageHunk) - nmap (GitGutterPreviewHunk) -augroup END - -augroup incremental_search_options - autocmd! - - map / (incsearch-forward) - map ? (incsearch-backward) - map g/ (incsearch-stay) - - " automatically turn off hlsearch - set hlsearch - let g:incsearch#auto_nohlsearch = 1 - - " and deal in some mappings - map n (incsearch-nohl-n) - map N (incsearch-nohl-N) - map * (incsearch-nohl-*) - map # (incsearch-nohl-#) - map g* (incsearch-nohl-g*) - map g# (incsearch-nohl-g#) - - " do not persist search end - let g:incsearch#do_not_save_error_message_history = 1 - - " different highlight colors - let g:incsearch#separate_highlight = 1 - -augroup END - -augroup gutentags_options - autocmd! - let g:gutentags_ctags_tagfile = '.git/tags' - let g:gutentags_file_list_command = { - \ 'markers': { - \ '.git': 'git grep --cached -I -l -e $""', - \ }, - \ } -augroup END - - -if has_key(g:plugs, 'fzf.vim') - augroup fzf_settings - autocmd! - - " fzf mappings - nmap t :Tags - nmap bt :BTags - nmap f :GFiles - nmap F :Files - nmap c :Commits - nmap b :Buffers - nmap (fzf-maps-n) - xmap (fzf-maps-x) - omap (fzf-maps-o) - - " floating window - let g:fzf_layout = { 'window': { 'width': 0.9, 'height': 0.6 } } - augroup END - - " ale settings - augroup ale_plugin_settings - autocmd! - - let g:ale_fix_on_save = 1 " run on save - let g:ale_lint_on_save = 1 " 2 options allow to lint only when file is saved - let g:ale_lint_on_text_changed = 'never' - let g:ale_lint_on_enter = 1 " lint when entering the buffer - let g:ale_completion_enabled = 0 " do not mix up stuff with deoplete - let g:ale_sign_error = '✖' " error sign - let g:ale_sign_warning = '⚠' " warning sign - let g:ale_fixers = ['trim_whitespace', 'remove_trailing_lines'] - - let g:ale_echo_msg_error_str = 'E' - let g:ale_echo_msg_warning_str = 'W' - let g:ale_echo_msg_format = '[%linter%] %s [%severity%]' - - let g:ale_set_balloons = 1 - - nmap (ale_fix) - nmap (ale_lint) - nmap (ale_detail) - nmap (ale_previous_wrap) - nmap (ale_next_wrap) - - nmap (ale_hover) - nmap (ale_go_to_definition) - - if has('nvim') - autocmd VimEnter * - \ set updatetime=1000 | - \ let g:ale_lint_on_text_changed = 0 - autocmd CursorHold * call ale#Queue(0) - autocmd CursorHoldI * call ale#Queue(0) - autocmd InsertEnter * call ale#Queue(0) - autocmd InsertLeave * call ale#Queue(0) - endif - augroup END -endif - - diff --git a/vim/snippets/Dockerfile.snippets b/vim/snippets/Dockerfile.snippets deleted file mode 100644 index bc0e59a..0000000 --- a/vim/snippets/Dockerfile.snippets +++ /dev/null @@ -1,67 +0,0 @@ -snippet F - FROM ${1:ubuntu} -snippet f - FROM ${1:ubuntu} -snippet M - LABEL maintainer="${1:name}" -snippet m - LABEL maintainer="${1:name}" -snippet R - RUN ${1:command} -snippet r - RUN ${1:command} -snippet C - CMD ${1:command} -snippet c - CMD ${1:command} -snippet CP - COPY ${1:src} ${2:dest} -snippet cp - COPY ${1:src} ${2:dest} -snippet EXP - EXPOSE ${1:port} -snippet exp - EXPOSE ${1:port} -snippet E - ENV ${1:key} ${2:value} -snippet e - ENV ${1:key} ${2:value} -snippet A - ADD ${1:src} ${2:dst} -snippet a - ADD ${1:src} ${2:dst} -snippet ENT - ENTRYPOINT ${1:command} -snippet ent - ENTRYPOINT ${1:command} -snippet V - VOLUME ["${1:path}"] -snippet v - VOLUME ["${1:path}"] -snippet U - USER ${1:name} -snippet u - USER ${1:name} -snippet W - WORKDIR ${1:path} -snippet w - WORKDIR ${1:path} -snippet upd - # update packages - RUN echo "deb http://archive.ubuntu.com/ubuntu ${1:precise} main universe" > /etc/apt/sources.list; \ - apt-get update && apt-get -y upgrade; \ - ${2} - ;rm -rf /var/lib/apt/lists/* -snippet head - # ${1:Description} - # - # VERSION ${2:0.1.0} - ${3} -snippet O - ONBUILD ${1} -snippet o - ONBUILD ${1} -snippet L - LABEL ${1:label}="${2:value}" -snippet l - LABEL ${1:label}="${2:value}" diff --git a/vim/snippets/docker-compose.snippets b/vim/snippets/docker-compose.snippets deleted file mode 100644 index 82617cd..0000000 --- a/vim/snippets/docker-compose.snippets +++ /dev/null @@ -1,166 +0,0 @@ -snippet ve - version: '${1:3}' -snippet volumes - volumes: - - ${1:value} -snippet volume_ - volume_driver: ${1:driver} -snippet volumes_ - volumes_from: - - ${1:name} -snippet exter - external: ${1:boolean} -snippet ser - services: - ${1:name} -snippet bu - build: - ${1:value} -snippet conte - context: ${1:dir} -snippet com - command: ${1:command} -snippet dep - depends_on: - ${1:value} -snippet env - environment: - ${1:name}: ${2:value} -snippet doc - dockerfile: ${1:file} -snippet ar - args: - ${1:name}: ${2:value} -snippet cap_a - cap_add: - - ${1:value} -snippet cap_d - cap_drop: - - ${1:value} -snippet cgr - cgroup_parent: ${1:cgroup} -snippet conta - container_name: ${1:name} -snippet dev - devices: - - ${1:value} -snippet dn - dns: - - ${1:ip} -snippet dns_ - dns_search: - - ${1:ip} -snippet tm - tmpfs: - - ${1:dir} -snippet ent - entrypoint: ${1:command} -snippet env_ - env_file: - - ${1:file} -snippet exp - expose: - - ${1:port} -snippet exten - extends: - file: ${1:file} - service: ${2:name} -snippet extr - extra_hosts: - - ${1:host}:${2:ip} -snippet gr - group_add: - - ${1:name} -snippet im - image: ${1:image} -snippet la - labels: - ${1:dns}: ${2:label} -snippet links - links: - - ${1:name} -snippet logg - logging: - driver: ${1:driver} - options: - ${2:value} -snippet log_d - log_driver: ${1:driver} -snippet log_o - log_opt: - ${1:value} -snippet net - net: ${1:value} -snippet network_ - network_mode: ${1:value} -snippet networks - networks: - - ${1:value} -snippet al - networks: - - ${1:name} -snippet ipv4 - ipv4_address: ${1:ip} -snippet ipv6 - ipv6_address: ${1:ip} -snippet link_ - link_local_ips: - - ${1:ip} -snippet pi - pid: ${1:host} -snippet po - ports: - - ${1:value} -snippet sec - security_opt: - - ${1:value} -snippet sto - stop_signal: ${1:signal} -snippet ul - ulimits: - ${1:value} -snippet cpu_s - cpu_shares: ${1:value} -snippet cpu_q - cpu_quota: ${1:value} -snippet cpus - cpuset: ${1:value} -snippet dom - domainname: ${1:name} -snippet ho - hostname: ${1:name} -snippet ipc - ipc: ${1:host} -snippet mem_ - mem_limit: ${1:value} -snippet mems - memswap_limit: ${1:value} -snippet pr - privileged: ${1:boolean} -snippet oom - oom_score_adj: ${1:value} -snippet res - restart: ${1:value} -snippet us - user: ${1:value} -snippet wo - working_dir: ${1:dir} -snippet rea - read_only: ${1:boolean} -snippet sh - shm_size: ${1:value} -snippet std - stdin_open: ${1:boolean} -snippet tt - tty: ${1:boolean} -snippet driver - driver: ${1:value} -snippet driver_ - driver_opts: - ${1:key}: ${2:value} -snippet ipa - ipam: - ${1:value} -snippet hc - healthcheck: - test: ${1:command} diff --git a/vim/spell/en.utf-8.add b/vim/spell/en.utf-8.add deleted file mode 100644 index ee79192..0000000 --- a/vim/spell/en.utf-8.add +++ /dev/null @@ -1,7 +0,0 @@ -whitelist -keypair -keypairs -github -dracula -UI -json diff --git a/vim/syntax/Dockerfile.vim b/vim/syntax/Dockerfile.vim deleted file mode 100644 index 4bae623..0000000 --- a/vim/syntax/Dockerfile.vim +++ /dev/null @@ -1,59 +0,0 @@ -" Vim syntax file -" Language: Dockerfile -" Maintainer: Eugene Kalinin -" Latest Revision: 11 September 2013 -" Source: http://docs.docker.io/en/latest/use/builder/ - -if exists("b:current_syntax") - finish -endif - -" case sensitivity (fix #17) -" syn case ignore - -" Keywords -syn keyword dockerfileKeywords FROM AS MAINTAINER RUN CMD COPY -syn keyword dockerfileKeywords EXPOSE ADD ENTRYPOINT -syn keyword dockerfileKeywords VOLUME USER WORKDIR ONBUILD -syn keyword dockerfileKeywords LABEL ARG HEALTHCHECK SHELL STOPSIGNAL - -" Bash statements -setlocal iskeyword+=- -syn keyword bashStatement add-apt-repository adduser apk apt-get aptitude apt-key autoconf bundle -syn keyword bashStatement cd chgrp chmod chown clear complete composer cp curl du echo egrep -syn keyword bashStatement expr fgrep find gem gnufind gnugrep gpg grep groupadd head less ln -syn keyword bashStatement ls make mkdir mv node npm pacman pip pip3 php python rails rm rmdir rpm ruby -syn keyword bashStatement sed sleep sort strip tar tail tailf touch useradd virtualenv yum -syn keyword bashStatement usermod bash cat a2ensite a2dissite a2enmod a2dismod apache2ctl -syn keyword bashStatement wget gzip - -" Strings -syn region dockerfileString start=/"/ skip=/\\"|\\\\/ end=/"/ -syn region dockerfileString1 start=/'/ skip=/\\'|\\\\/ end=/'/ - -" Emails -syn region dockerfileEmail start=// contains=@ oneline - -" Urls -syn match dockerfileUrl /\(http\|https\|ssh\|hg\|git\)\:\/\/[a-zA-Z0-9\/\-\._]\+/ - -" Task tags -syn keyword dockerfileTodo contained TODO FIXME XXX - -" Comments -syn region dockerfileComment start="#" end="\n" contains=dockerfileTodo -syn region dockerfileEnvWithComment start="^\s*ENV\>" end="\n" contains=dockerfileEnv -syn match dockerfileEnv contained /\/ - -" Highlighting -hi link dockerfileKeywords Keyword -hi link dockerfileEnv Keyword -hi link dockerfileString String -hi link dockerfileString1 String -hi link dockerfileComment Comment -hi link dockerfileEmail Identifier -hi link dockerfileUrl Identifier -hi link dockerfileTodo Todo -hi link bashStatement Function - -let b:current_syntax = "dockerfile" diff --git a/vim/syntax/docker-compose.vim b/vim/syntax/docker-compose.vim deleted file mode 100644 index 4769528..0000000 --- a/vim/syntax/docker-compose.vim +++ /dev/null @@ -1,80 +0,0 @@ -" Vim syntax file -" Language: Dockerfile -" Maintainer: Eugene Kalinin -" Latest Revision: 11 September 2013 -" Source: https://docs.docker.com/compose/ - -if !exists('main_syntax') - let main_syntax = 'yaml' -endif - -" case sensitivity (fix #17) -" syn case ignore - -" Keywords -syn keyword dockercomposeKeywords build context dockerfile args cap_add cap_drop -syn keyword dockercomposeKeywords command cgroup_parent container_name devices depends_on -syn keyword dockercomposeKeywords dns dns_search tmpfs entrypoint env_file environment -syn keyword dockercomposeKeywords expose extends extends external_links extra_hosts -syn keyword dockercomposeKeywords group_add image isolation labels links -syn keyword dockercomposeKeywords log_opt net network_mode networks aliases -syn keyword dockercomposeKeywords ipv4_address ipv6_address link_local_ips pid ports -syn keyword dockercomposeKeywords security_opt stop_signal ulimits volumes volume_driver -syn keyword dockercomposeKeywords volumes_from cpu_shares cpu_quota cpuset domainname hostname -syn keyword dockercomposeKeywords ipc mac_address mem_limit memswap_limit oom_score_adj privileged -syn keyword dockercomposeKeywords read_only restart shm_size stdin_open tty user working_dir -syn keyword dockercomposeKeywords healthcheck test interval timeout retries disable sysctls -syn keyword dockercomposeKeywords userns_mode secrets -"" Volume configuration reference -syn keyword dockercomposeKeywords driver driver_opts external labels -"" Network configuration reference -syn keyword dockercomposeKeywords driver driver_opts enable_ipv6 ipam internal labels external -"" Versioning -syn keyword dockercomposeKeywords version services -"" Logging -syn keyword dockercomposeKeywords logging log_driver env options max-size max-file -syn keyword dockercomposeKeywords syslog-address syslog-facility syslog-tls-ca-cert syslog-tls-cert -syn keyword dockercomposeKeywords syslog-tls-key syslog-tls-skip tag syslog-format gelf-address -syn keyword dockercomposeKeywords gelf-compression-type gelf-compression-level fluentd-address -syn keyword dockercomposeKeywords fluentd-buffer-limit fluentd-retry-wait fluentd-max-retries -syn keyword dockercomposeKeywords fluentd-async-connect awslogs-region awslogs-group awslogs-stream -syn keyword dockercomposeKeywords splunk-token splunk-url splunk-source splunk-sourcetype splunk-index -syn keyword dockercomposeKeywords splunk-capath splunk-caname splunk-insecureskipverify gcp-project log-cmd - -" Bash statements -setlocal iskeyword+=- -syn keyword bashStatement add-apt-repository adduser apk apt-get aptitude apt-key autoconf bundle -syn keyword bashStatement cd chgrp chmod chown clear complete composer cp curl du echo egrep -syn keyword bashStatement expr fgrep find gem gnufind gnugrep gpg grep groupadd head less ln -syn keyword bashStatement ls make mkdir mv node npm pacman pip pip3 php python rails rm rmdir rpm ruby -syn keyword bashStatement sed sleep sort strip tar tail tailf touch useradd virtualenv yum -syn keyword bashStatement usermod bash cat a2ensite a2dissite a2enmod a2dismod apache2ctl -syn keyword bashStatement wget gzip - -" Strings -syn region dockercomposeString start=/"/ skip=/\\"/ end=/"/ -syn region dockercomposeString1 start=/'/ skip=/\\'/ end=/'/ - -" Emails -syn region dockercomposeEmail start=// contains=@ oneline - -" Urls -syn match dockercomposeUrl /\(http\|https\|ssh\|hg\|git\)\:\/\/[a-zA-Z0-9\/\-\.]\+/ - -" Task tags -syn keyword dockercomposeTodo contained TODO FIXME XXX - -" Comments -syn region dockercomposeComment start="#" end="\n" contains=dockercomposeTodo - -" Highlighting -hi link dockercomposeKeywords Keyword -hi link dockercomposeString String -hi link dockercomposeString1 String -hi link dockercomposeComment Comment -hi link dockercomposeEmail Identifier -hi link dockercomposeUrl Identifier -hi link dockercomposeTodo Todo -hi link bashStatement Function - -let b:current_syntax = "dockercompose" diff --git a/vim/vimrc b/vim/vimrc deleted file mode 100644 index f9cfaad..0000000 --- a/vim/vimrc +++ /dev/null @@ -1,11 +0,0 @@ -" Import Plugins -source ~/.vim/plugins.vim - -" Main Vim config -source ~/.vim/editor.vim - -" Handle conditions based on file type -source ~/.vim/filetype.vim - - - diff --git a/zsh/aliases/ansible-aliases.zsh b/zsh/aliases/ansible-aliases.zsh deleted file mode 100644 index 75393b7..0000000 --- a/zsh/aliases/ansible-aliases.zsh +++ /dev/null @@ -1,28 +0,0 @@ -# Functions -function ansible-version(){ - ansible --version -} - -function ansible-role-init(){ - if ! [ -z $1 ] ; then - echo "Ansible Role : $1 Creating...." - ansible-galaxy init $1 - tree $1 - else - echo "Usage : ansible-role-init " - echo "Example : ansible-role-init role1" - fi -} - -# Alias -alias a='ansible ' -alias aconf='ansible-config ' -alias acon='ansible-console ' -alias aver='ansible-version' -alias arinit='ansible-role-init' -alias aplaybook='ansible-playbook ' -alias ainv='ansible-inventory ' -alias adoc='ansible-doc ' -alias agal='ansible-galaxy ' -alias apull='ansible-pull ' -alias aval='ansible-vault' diff --git a/zsh/aliases/common-aliases.zsh b/zsh/aliases/common-aliases.zsh deleted file mode 100644 index 5f44e6c..0000000 --- a/zsh/aliases/common-aliases.zsh +++ /dev/null @@ -1,94 +0,0 @@ -# Advanced Aliases. -# Use with caution - -# Checks if a given command is availible -command_exists () { - type "$1" &> /dev/null ; -} - -# Use exa package (if installed) for better ls -if command_exists exa ; then - alias ls='exa' - alias la='exa -a --icons' - alias tree='f() { exa -a --tree -L=${1:-2} --icons };f' - alias recent='exa -lahr --color-scale --icons --git --git-ignore -s=modified' -else - alias la='ls -a' -fi - -alias l='ls' # List files, will use exa if availible -alias ll='ls -laFh' # List all files, with details, type indicators and headings - -alias zshrc='${=EDITOR} ${ZDOTDIR:-$HOME}/.zshrc' # Quick access to the .zshrc file - -alias grep='grep --color' -alias sgrep='grep -R -n -H -C 5 --exclude-dir={.git,.svn,CVS} ' - -alias t='tail -f' - -# Command line head / tail shortcuts -alias -g H='| head' -alias -g T='| tail' -alias -g G='| grep' -alias -g L="| less" -alias -g M="| most" -alias -g LL="2>&1 | less" -alias -g CA="2>&1 | cat -A" -alias -g NE="2> /dev/null" -alias -g NUL="> /dev/null 2>&1" -alias -g P="2>&1| pygmentize -l pytb" - -alias dud='du -d 1 -h' -alias duf='du -sh *' -(( $+commands[fd] )) || alias fd='find . -type d -name' -alias ff='find . -type f -name' - -alias h='history' -alias hgrep="fc -El 0 | grep" -alias help='man' -alias p='ps -f' -alias sortnr='sort -n -r' -alias unexport='unset' - -alias rm='rm -i' -alias cp='cp -i' -alias mv='mv -i' - -# zsh is able to auto-do some kungfoo -# depends on the SUFFIX :) -autoload -Uz is-at-least -if is-at-least 4.2.0; then - # open browser on urls - if [[ -n "$BROWSER" ]]; then - _browser_fts=(htm html de org net com at cx nl se dk) - for ft in $_browser_fts; do alias -s $ft='$BROWSER'; done - fi - - _editor_fts=(cpp cxx cc c hh h inl asc txt TXT tex) - for ft in $_editor_fts; do alias -s $ft='$EDITOR'; done - - if [[ -n "$XIVIEWER" ]]; then - _image_fts=(jpg jpeg png gif mng tiff tif xpm) - for ft in $_image_fts; do alias -s $ft='$XIVIEWER'; done - fi - - _media_fts=(ape avi flv m4a mkv mov mp3 mpeg mpg ogg ogm rm wav webm) - for ft in $_media_fts; do alias -s $ft=mplayer; done - - #read documents - alias -s pdf=acroread - alias -s ps=gv - alias -s dvi=xdvi - alias -s chm=xchm - alias -s djvu=djview - - #list whats inside packed file - alias -s zip="unzip -l" - alias -s rar="unrar l" - alias -s tar="tar tf" - alias -s tar.gz="echo " - alias -s ace="unace l" -fi - -# Make zsh know about hosts already accessed by SSH -zstyle -e ':completion:*:(ssh|scp|sftp|rsh|rsync):hosts' hosts 'reply=(${=${${(f)"$(cat {/etc/ssh_,~/.ssh/known_}hosts(|2)(N) /dev/null)"}%%[# ]*}//,/ })' diff --git a/zsh/aliases/git-aliases.zsh b/zsh/aliases/git-aliases.zsh deleted file mode 100644 index 3868a1a..0000000 --- a/zsh/aliases/git-aliases.zsh +++ /dev/null @@ -1,307 +0,0 @@ -# Git version checking -autoload -Uz is-at-least -git_version="${${(As: :)$(git version 2>/dev/null)}[3]}" - -# -# Functions -# - -# The name of the current branch -# Back-compatibility wrapper for when this function was defined here in -# the plugin, before being pulled in to core lib/git.zsh as git_current_branch() -# to fix the core -> git plugin dependency. -function current_branch() { - git_current_branch -} - -# Pretty log messages -function _git_log_prettily(){ - if ! [ -z $1 ]; then - git log --pretty=$1 - fi -} -compdef _git _git_log_prettily=git-log - -# Warn if the current branch is a WIP -function work_in_progress() { - if $(git log -n 1 2>/dev/null | grep -q -c "\-\-wip\-\-"); then - echo "WIP!!" - fi -} - -# Check if main exists and use instead of master -function git_main_branch() { - command git rev-parse --git-dir &>/dev/null || return - local branch - for branch in main trunk; do - if command git show-ref -q --verify refs/heads/$branch; then - echo $branch - return - fi - done - echo master -} - -# -# Aliases -# (sorted alphabetically) -# - -alias g='git' - -alias ga='git add' -alias gaa='git add --all' -alias gapa='git add --patch' -alias gau='git add --update' -alias gav='git add --verbose' -alias gap='git apply' -alias gapt='git apply --3way' - -alias gb='git branch' -alias gba='git branch -a' -alias gbd='git branch -d' -alias gbda='git branch --no-color --merged | command grep -vE "^(\+|\*|\s*($(git_main_branch)|development|develop|devel|dev)\s*$)" | command xargs -n 1 git branch -d' -alias gbD='git branch -D' -alias gbl='git blame -b -w' -alias gbnm='git branch --no-merged' -alias gbr='git branch --remote' -alias gbs='git bisect' -alias gbsb='git bisect bad' -alias gbsg='git bisect good' -alias gbsr='git bisect reset' -alias gbss='git bisect start' - -alias gc='git commit -v' -alias gc!='git commit -v --amend' -alias gcn!='git commit -v --no-edit --amend' -alias gca='git commit -v -a' -alias gca!='git commit -v -a --amend' -alias gcan!='git commit -v -a --no-edit --amend' -alias gcans!='git commit -v -a -s --no-edit --amend' -alias gcam='git commit -a -m' -alias gcsm='git commit -s -m' -alias gcb='git checkout -b' -alias gcf='git config --list' -alias gcl='git clone --recurse-submodules' -alias gclean='git clean -id' -alias gpristine='git reset --hard && git clean -dffx' -alias gcm='git checkout $(git_main_branch)' -alias gcd='git checkout develop' -alias gcmsg='git commit -m' -alias gco='git checkout' -alias gcount='git shortlog -sn' -alias gcp='git cherry-pick' -alias gcpa='git cherry-pick --abort' -alias gcpc='git cherry-pick --continue' -alias gcs='git commit -S' - -alias gd='git diff' -alias gdca='git diff --cached' -alias gdcw='git diff --cached --word-diff' -alias gdct='git describe --tags $(git rev-list --tags --max-count=1)' -alias gds='git diff --staged' -alias gdt='git diff-tree --no-commit-id --name-only -r' -alias gdw='git diff --word-diff' - -function gdnolock() { - git diff "$@" ":(exclude)package-lock.json" ":(exclude)*.lock" -} -compdef _git gdnolock=git-diff - -function gdv() { git diff -w "$@" | view - } -compdef _git gdv=git-diff - -alias gf='git fetch' -# --jobs= was added in git 2.8 -is-at-least 2.8 "$git_version" \ - && alias gfa='git fetch --all --prune --jobs=10' \ - || alias gfa='git fetch --all --prune' -alias gfo='git fetch origin' - -alias gfg='git ls-files | grep' - -alias gg='git gui citool' -alias gga='git gui citool --amend' - -function ggf() { - [[ "$#" != 1 ]] && local b="$(git_current_branch)" - git push --force origin "${b:=$1}" -} -compdef _git ggf=git-checkout -function ggfl() { - [[ "$#" != 1 ]] && local b="$(git_current_branch)" - git push --force-with-lease origin "${b:=$1}" -} -compdef _git ggfl=git-checkout - -function ggl() { - if [[ "$#" != 0 ]] && [[ "$#" != 1 ]]; then - git pull origin "${*}" - else - [[ "$#" == 0 ]] && local b="$(git_current_branch)" - git pull origin "${b:=$1}" - fi -} -compdef _git ggl=git-checkout - -function ggp() { - if [[ "$#" != 0 ]] && [[ "$#" != 1 ]]; then - git push origin "${*}" - else - [[ "$#" == 0 ]] && local b="$(git_current_branch)" - git push origin "${b:=$1}" - fi -} -compdef _git ggp=git-checkout - -function ggpnp() { - if [[ "$#" == 0 ]]; then - ggl && ggp - else - ggl "${*}" && ggp "${*}" - fi -} -compdef _git ggpnp=git-checkout - -function ggu() { - [[ "$#" != 1 ]] && local b="$(git_current_branch)" - git pull --rebase origin "${b:=$1}" -} -compdef _git ggu=git-checkout - -alias ggpur='ggu' -alias ggpull='git pull origin "$(git_current_branch)"' -alias ggpush='git push origin "$(git_current_branch)"' - -alias ggsup='git branch --set-upstream-to=origin/$(git_current_branch)' -alias gpsup='git push --set-upstream origin $(git_current_branch)' - -alias ghh='git help' - -alias gignore='git update-index --assume-unchanged' -alias gignored='git ls-files -v | grep "^[[:lower:]]"' -alias git-svn-dcommit-push='git svn dcommit && git push github $(git_main_branch):svntrunk' - -alias gk='\gitk --all --branches' -alias gke='\gitk --all $(git log -g --pretty=%h)' - -alias gl='git pull' -alias glg='git log --stat' -alias glgp='git log --stat -p' -alias glgg='git log --graph' -alias glgga='git log --graph --decorate --all' -alias glgm='git log --graph --max-count=10' -alias glo='git log --oneline --decorate' -alias glol="git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'" -alias glols="git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --stat" -alias glod="git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset'" -alias glods="git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset' --date=short" -alias glola="git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --all" -alias glog='git log --oneline --decorate --graph' -alias gloga='git log --oneline --decorate --graph --all' -alias glp="_git_log_prettily" - -alias gm='git merge' -alias gmom='git merge origin/$(git_main_branch)' -alias gmt='git mergetool --no-prompt' -alias gmtvim='git mergetool --no-prompt --tool=vimdiff' -alias gmum='git merge upstream/$(git_main_branch)' -alias gma='git merge --abort' - -alias gp='git push' -alias gpd='git push --dry-run' -alias gpf='git push --force-with-lease' -alias gpf!='git push --force' -alias gpoat='git push origin --all && git push origin --tags' -alias gpu='git push upstream' -alias gpv='git push -v' - -alias gr='git remote' -alias gra='git remote add' -alias grb='git rebase' -alias grba='git rebase --abort' -alias grbc='git rebase --continue' -alias grbd='git rebase develop' -alias grbi='git rebase -i' -alias grbm='git rebase $(git_main_branch)' -alias grbs='git rebase --skip' -alias grev='git revert' -alias grh='git reset' -alias grhh='git reset --hard' -alias groh='git reset origin/$(git_current_branch) --hard' -alias grm='git rm' -alias grmc='git rm --cached' -alias grmv='git remote rename' -alias grrm='git remote remove' -alias grs='git restore' -alias grset='git remote set-url' -alias grss='git restore --source' -alias grst='git restore --staged' -alias grt='cd "$(git rev-parse --show-toplevel || echo .)"' -alias gru='git reset --' -alias grup='git remote update' -alias grv='git remote -v' - -alias gsb='git status -sb' -alias gsd='git svn dcommit' -alias gsh='git show' -alias gsi='git submodule init' -alias gsps='git show --pretty=short --show-signature' -alias gsr='git svn rebase' -alias gss='git status -s' -alias gst='git status' - -# use the default stash push on git 2.13 and newer -is-at-least 2.13 "$git_version" \ - && alias gsta='git stash push' \ - || alias gsta='git stash save' - -alias gstaa='git stash apply' -alias gstc='git stash clear' -alias gstd='git stash drop' -alias gstl='git stash list' -alias gstp='git stash pop' -alias gsts='git stash show --text' -alias gstu='git stash --include-untracked' -alias gstall='git stash --all' -alias gsu='git submodule update' -alias gsw='git switch' -alias gswc='git switch -c' - -alias gts='git tag -s' -alias gtv='git tag | sort -V' -alias gtl='gtl(){ git tag --sort=-v:refname -n -l "${1}*" }; noglob gtl' - -alias gunignore='git update-index --no-assume-unchanged' -alias gunwip='git log -n 1 | grep -q -c "\-\-wip\-\-" && git reset HEAD~1' -alias gup='git pull --rebase' -alias gupv='git pull --rebase -v' -alias gupa='git pull --rebase --autostash' -alias gupav='git pull --rebase --autostash -v' -alias glum='git pull upstream $(git_main_branch)' - -alias gwch='git whatchanged -p --abbrev-commit --pretty=medium' -alias gwip='git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign -m "--wip-- [skip ci]"' - -alias gam='git am' -alias gamc='git am --continue' -alias gams='git am --skip' -alias gama='git am --abort' -alias gamscp='git am --show-current-patch' - -function grename() { - if [[ -z "$1" || -z "$2" ]]; then - echo "Usage: $0 old_branch new_branch" - return 1 - fi - - # Rename branch locally - git branch -m "$1" "$2" - # Rename branch in origin remote - if git push origin :"$1"; then - git push --set-upstream origin "$2" - fi -} - -unset git_version - diff --git a/zsh/aliases/lol-aliases.zsh b/zsh/aliases/lol-aliases.zsh deleted file mode 100644 index 4dc6528..0000000 --- a/zsh/aliases/lol-aliases.zsh +++ /dev/null @@ -1,44 +0,0 @@ -# LOL!!1 -# Source: https://aur.archlinux.org/packages/lolbash/lolbash/lolbash.sh - -alias wtf='dmesg' -alias onoz='cat /var/log/errors.log' -alias rtfm='man' - -alias :3='echo' -alias visible='echo' -alias invisible='cat' -alias moar='more' -alias tldr='less' -alias alwayz='tail -f' - -alias icanhas='mkdir' -alias gimmeh='touch' -alias donotwant='rm' -alias dowant='cp' -alias gtfo='mv' -alias nowai='chmod' - -alias hai='cd' -alias iz='ls' -alias plz='pwd' -alias ihasbucket='df -h' - -alias inur='locate' -alias iminurbase='finger' - -alias btw='nice' -alias obtw='nohup' - -alias nomz='ps aux' -alias nomnom='killall' - -alias byes='exit' -alias cyal8r='reboot' - -alias rulz='git push' -alias bringz='git pull' -alias chicken='git add' -alias oanward='git commit -m' - - diff --git a/zsh/aliases/npm-aliases.zsh b/zsh/aliases/npm-aliases.zsh deleted file mode 100644 index a3f956a..0000000 --- a/zsh/aliases/npm-aliases.zsh +++ /dev/null @@ -1,61 +0,0 @@ -(( $+commands[npm] )) && { - rm -f "${ZSH_CACHE_DIR:-$ZSH/cache}/npm_completion" - - _npm_completion() { - local si=$IFS - compadd -- $(COMP_CWORD=$((CURRENT-1)) \ - COMP_LINE=$BUFFER \ - COMP_POINT=0 \ - npm completion -- "${words[@]}" \ - 2>/dev/null) - IFS=$si - } - if type "compdef" > /dev/null; then - compdef _npm_completion npm - fi -} - -# Install dependencies globally -alias npmg="npm i -g " - -# npm package names are lowercase -# Thus, we've used camelCase for the following aliases: - -# Install and save to dependencies in your package.json -# npms is used by https://www.npmjs.com/package/npms -alias npmS="npm i -S " - -# Install and save to dev-dependencies in your package.json -# npmd is used by https://github.com/dominictarr/npmd -alias npmD="npm i -D " - -# Execute command from node_modules folder based on current directory -# i.e npmE gulp -alias npmE='PATH="$(npm bin)":"$PATH"' - -# Check which npm modules are outdated -alias npmO="npm outdated" - -# Check package versions -alias npmV="npm -v" - -# List packages -alias npmL="npm list" - -# List top-level installed packages -alias npmL0="npm ls --depth=0" - -# Run npm start -alias npmst="npm start" - -# Run npm test -alias npmt="npm test" - -# Run npm scripts -alias npmR="npm run" - -# Run npm publish -alias npmP="npm publish" - -# Run npm init -alias npmI="npm init" diff --git a/zsh/aliases/tmux-aliases.zsh b/zsh/aliases/tmux-aliases.zsh deleted file mode 100644 index a8cf070..0000000 --- a/zsh/aliases/tmux-aliases.zsh +++ /dev/null @@ -1,97 +0,0 @@ -if ! (( $+commands[tmux] )); then - print "zsh tmux plugin: tmux not found. Please install tmux before using this plugin." >&2 - return 1 -fi - -# ALIASES - -alias ta='tmux attach -t' -alias tad='tmux attach -d -t' -alias ts='tmux new-session -s' -alias tl='tmux list-sessions' -alias tksv='tmux kill-server' -alias tkss='tmux kill-session -t' - -# CONFIGURATION VARIABLES -# Automatically start tmux -: ${ZSH_TMUX_AUTOSTART:=false} -# Only autostart once. If set to false, tmux will attempt to -# autostart every time your zsh configs are reloaded. -: ${ZSH_TMUX_AUTOSTART_ONCE:=true} -# Automatically connect to a previous session if it exists -: ${ZSH_TMUX_AUTOCONNECT:=true} -# Automatically close the terminal when tmux exits -: ${ZSH_TMUX_AUTOQUIT:=$ZSH_TMUX_AUTOSTART} -# Set term to screen or screen-256color based on current terminal support -: ${ZSH_TMUX_FIXTERM:=true} -# Set '-CC' option for iTerm2 tmux integration -: ${ZSH_TMUX_ITERM2:=false} -# The TERM to use for non-256 color terminals. -# Tmux states this should be screen, but you may need to change it on -# systems without the proper terminfo -: ${ZSH_TMUX_FIXTERM_WITHOUT_256COLOR:=screen} -# The TERM to use for 256 color terminals. -# Tmux states this should be screen-256color, but you may need to change it on -# systems without the proper terminfo -: ${ZSH_TMUX_FIXTERM_WITH_256COLOR:=screen-256color} -# Set the configuration path -: ${ZSH_TMUX_CONFIG:=$HOME/.tmux.conf} -# Set -u option to support unicode -: ${ZSH_TMUX_UNICODE:=false} - -# Determine if the terminal supports 256 colors -if [[ $terminfo[colors] == 256 ]]; then - export ZSH_TMUX_TERM=$ZSH_TMUX_FIXTERM_WITH_256COLOR -else - export ZSH_TMUX_TERM=$ZSH_TMUX_FIXTERM_WITHOUT_256COLOR -fi - -# Set the correct local config file to use. -if [[ "$ZSH_TMUX_ITERM2" == "false" && -e "$ZSH_TMUX_CONFIG" ]]; then - export ZSH_TMUX_CONFIG -fi - -# Wrapper function for tmux. -function _zsh_tmux_plugin_run() { - if [[ -n "$@" ]]; then - command tmux "$@" - return $? - fi - - local -a tmux_cmd - tmux_cmd=(command tmux) - [[ "$ZSH_TMUX_ITERM2" == "true" ]] && tmux_cmd+=(-CC) - [[ "$ZSH_TMUX_UNICODE" == "true" ]] && tmux_cmd+=(-u) - - # Try to connect to an existing session. - [[ "$ZSH_TMUX_AUTOCONNECT" == "true" ]] && $tmux_cmd attach - - # If failed, just run tmux, fixing the TERM variable if requested. - if [[ $? -ne 0 ]]; then - if [[ -e "$ZSH_TMUX_CONFIG" ]]; then - tmux_cmd+=(-f "$ZSH_TMUX_CONFIG") - fi - $tmux_cmd new-session - fi - - if [[ "$ZSH_TMUX_AUTOQUIT" == "true" ]]; then - exit - fi -} - -if hash compdef 2>/dev/null; then - # Use the completions for tmux for our function - compdef _tmux _zsh_tmux_plugin_run - # Alias tmux to our wrapper function. - alias tmux=_zsh_tmux_plugin_run -fi - - -# Autostart if not already in tmux and enabled. -if [[ -z "$TMUX" && "$ZSH_TMUX_AUTOSTART" == "true" && -z "$INSIDE_EMACS" && -z "$EMACS" && -z "$VIM" ]]; then - # Actually don't autostart if we already did and multiple autostarts are disabled. - if [[ "$ZSH_TMUX_AUTOSTART_ONCE" == "false" || "$ZSH_TMUX_AUTOSTARTED" != "true" ]]; then - export ZSH_TMUX_AUTOSTARTED=true - _zsh_tmux_plugin_run - fi -fi diff --git a/zsh/antigen b/zsh/antigen deleted file mode 160000 index 64de2dc..0000000 --- a/zsh/antigen +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 64de2dcd95d6a8e879cd2244c763d99f0144e78e diff --git a/zsh/antigen.zsh b/zsh/antigen.zsh deleted file mode 100644 index e813207..0000000 --- a/zsh/antigen.zsh +++ /dev/null @@ -1,2057 +0,0 @@ -###################################################################### -# This file was autogenerated by `make`. Do not edit it directly! -###################################################################### -# Antigen: A simple plugin manager for zsh - # Authors: Shrikant Sharat Kandula - # and Contributors - # Homepage: http://antigen.sharats.me - # License: MIT License -zmodload zsh/parameter -autoload -U is-at-least - -# While boot.zsh is part of the ext/cache functionallity it may be disabled -# with ANTIGEN_CACHE flag, and it's always compiled with antigen.zsh -if [[ $ANTIGEN_CACHE != false ]]; then - ANTIGEN_CACHE="${ANTIGEN_CACHE:-${ADOTDIR:-$HOME/.antigen}/init.zsh}" - ANTIGEN_RSRC="${ANTIGEN_RSRC:-${ADOTDIR:-$HOME/.antigen}/.resources}" - - # It may not be necessary to check ANTIGEN_AUTO_CONFIG. - if [[ $ANTIGEN_AUTO_CONFIG != false && -f $ANTIGEN_RSRC ]]; then - # Check the list of files for configuration changes (uses -nt comp) - ANTIGEN_CHECK_FILES=$(cat $ANTIGEN_RSRC 2> /dev/null) - ANTIGEN_CHECK_FILES=(${(@f)ANTIGEN_CHECK_FILES}) - - for config in $ANTIGEN_CHECK_FILES; do - if [[ "$config" -nt "$config.zwc" ]]; then - # Flag configuration file as newer - { zcompile "$config" } &! - # Kill cache file in order to force full loading (see a few lines below) - [[ -f "$ANTIGEN_CACHE" ]] && rm -f "$ANTIGEN_CACHE" - fi - done - fi - - # If there is a cache file do load from it - if [[ -f $ANTIGEN_CACHE && ! $_ANTIGEN_CACHE_LOADED == true ]]; then - # Wrap antigen in order to defer cache source until `antigen-apply` - antigen() { - if [[ $1 == "apply" ]]; then - source "$ANTIGEN_CACHE" - # Handle `antigen-init` command properly - elif [[ $1 == "init" ]]; then - source "$2" - fi - } - # Do not continue loading antigen as cache bundle takes care of it. - return 0 - fi -fi -[[ -z "$_ANTIGEN_INSTALL_DIR" ]] && _ANTIGEN_INSTALL_DIR=${0:A:h} - -# Each line in this string has the following entries separated by a space -# character. -# , , , -[[ $_ANTIGEN_CACHE_LOADED != true ]] && typeset -aU _ANTIGEN_BUNDLE_RECORD - -# Do not load anything if git is not available. -if (( ! $+commands[git] )); then - echo 'Antigen: Please install git to use Antigen.' >&2 - return 1 -fi - -# Used to defer compinit/compdef -typeset -a __deferred_compdefs -compdef () { __deferred_compdefs=($__deferred_compdefs "$*") } - -# A syntax sugar to avoid the `-` when calling antigen commands. With this -# function, you can write `antigen-bundle` as `antigen bundle` and so on. -antigen () { - local cmd="$1" - if [[ -z "$cmd" ]]; then - echo 'Antigen: Please give a command to run.' >&2 - return 1 - fi - shift - - if (( $+functions[antigen-$cmd] )); then - "antigen-$cmd" "$@" - return $? - else - echo "Antigen: Unknown command: $cmd" >&2 - return 1 - fi -} -# Returns the bundle's git revision -# -# Usage -# -antigen-bundle-rev bundle-name [is_local_clone] -# -# Returns -# Bundle rev-parse output (branch name or short ref name) --antigen-bundle-rev () { - local bundle=$1 - local is_local_clone=$2 - - local bundle_path=$bundle - # Get bunde path inside $ADOTDIR if bundle was effectively cloned - if [[ "$is_local_clone" == "true" ]]; then - bundle_path=$(-antigen-get-clone-dir $bundle) - fi - - local ref - ref=$(git --git-dir="$bundle_path/.git" rev-parse --abbrev-ref '@' 2>/dev/null) - - # Avoid 'HEAD' when in detached mode - if [[ $ref == "HEAD" ]]; then - ref=$(git --git-dir="$bundle_path/.git" describe --tags --exact-match 2>/dev/null \ - || git --git-dir="$bundle_path/.git" rev-parse --short '@' 2>/dev/null || "-") - fi - echo $ref -} -# Usage: -# -antigen-bundle-short-name "https://github.com/user/repo.git[|*]" "[branch/name]" -# Returns: -# user/repo@branch/name --antigen-bundle-short-name () { - local bundle_name="${1%|*}" - local bundle_branch="$2" - local match mbegin mend MATCH MBEGIN MEND - - [[ "$bundle_name" =~ '.*/(.*/.*).*$' ]] && bundle_name=$match[1] - bundle_name="${bundle_name%.git*}" - - if [[ -n $bundle_branch ]]; then - bundle_name="$bundle_name@$bundle_branch" - fi - - echo $bundle_name -} -# Echo the bundle specs as in the record. The first line is not echoed since it -# is a blank line. --antigen-echo-record () { - echo ${(j:\n:)_ANTIGEN_BUNDLE_RECORD} -} -# Filters _ANTIGEN_BUNDLE_RECORD for $1 -# -# Usage -# -antigen-find-bundle example/bundle -# -# Returns -# String if bundle is found --antigen-find-bundle () { - echo $(-antigen-find-record $1 | cut -d' ' -f1) -} - -# Filters _ANTIGEN_BUNDLE_RECORD for $1 -# -# Usage -# -antigen-find-record example/bundle -# -# Returns -# String if record is found --antigen-find-record () { - local bundle=$1 - - if [[ $# -eq 0 ]]; then - return 1 - fi - - local record=${bundle/\|/\\\|} - echo "${_ANTIGEN_BUNDLE_RECORD[(r)*$record*]}" -} -# Returns bundle names from _ANTIGEN_BUNDLE_RECORD -# -# Usage -# -antigen-get-bundles [--short|--simple|--long] -# -# Returns -# List of bundles installed --antigen-get-bundles () { - local mode revision url bundle_name bundle_entry loc no_local_clone - local record bundle make_local_clone - mode=${1:-"--short"} - - for record in $_ANTIGEN_BUNDLE_RECORD; do - bundle=(${(@s/ /)record}) - url=$bundle[1] - loc=$bundle[2] - make_local_clone=$bundle[4] - - bundle_name=$(-antigen-bundle-short-name $url) - - case "$mode" in - --short) - # Only check revision for bundle with a requested branch - if [[ $url == *\|* ]]; then - revision=$(-antigen-bundle-rev $url $make_local_clone) - else - revision="master" - fi - - if [[ $loc != '/' ]]; then - bundle_name="$bundle_name ~ $loc" - fi - echo "$bundle_name @ $revision" - ;; - --simple) - echo "$bundle_name" - ;; - --long) - echo "$record" - ;; - esac - done -} -# Usage: -# -antigen-get-clone-dir "https://github.com/zsh-users/zsh-syntax-highlighting.git[|feature/branch]" -# Returns: -# $ANTIGEN_BUNDLES/zsh-users/zsh-syntax-highlighting[-feature-branch] --antigen-get-clone-dir () { - local bundle="$1" - local url="${bundle%|*}" - local branch match mbegin mend MATCH MBEGIN MEND - [[ "$bundle" =~ "\|" ]] && branch="${bundle#*|}" - - # Takes a repo url and mangles it, giving the path that this url will be - # cloned to. Doesn't actually clone anything. - local clone_dir="$ANTIGEN_BUNDLES" - - url=$(-antigen-bundle-short-name $url) - - # Suffix with branch/tag name - [[ -n "$branch" ]] && url="$url-${branch//\//-}" - url=${url//\*/x} - - echo "$clone_dir/$url" -} -# Returns bundles flagged as make_local_clone -# -# Usage -# -antigen-cloned-bundles -# -# Returns -# Bundle metadata --antigen-get-cloned-bundles() { - -antigen-echo-record | - awk '$4 == "true" {print $1}' | - sort -u -} -# Returns a list of themes from a default library (omz) -# -# Usage -# -antigen-get-themes -# -# Returns -# List of themes by name --antigen-get-themes () { - local library='robbyrussell/oh-my-zsh' - local bundle=$(-antigen-find-bundle $library) - - if [[ -n "$bundle" ]]; then - local dir=$(-antigen-get-clone-dir $ANTIGEN_DEFAULT_REPO_URL) - echo $(ls $dir/themes/ | grep '.zsh-theme$' | sed 's/.zsh-theme//') - fi - - return 0 -} - -# This function check ZSH_EVAL_CONTEXT to determine if running in interactive shell. -# -# Usage -# -antigen-interactive-mode -# -# Returns -# Either true or false depending if we are running in interactive mode --antigen-interactive-mode () { - WARN "-antigen-interactive-mode: $ZSH_EVAL_CONTEXT \$_ANTIGEN_INTERACTIVE = $_ANTIGEN_INTERACTIVE" - if [[ $_ANTIGEN_INTERACTIVE != "" ]]; then - [[ $_ANTIGEN_INTERACTIVE == true ]]; - return - fi - - [[ "$ZSH_EVAL_CONTEXT" == toplevel* || "$ZSH_EVAL_CONTEXT" == cmdarg* ]]; -} -# Parses and retrieves a remote branch given a branch name. -# -# If the branch name contains '*' it will retrieve remote branches -# and try to match against tags and heads, returning the latest matching. -# -# Usage -# -antigen-parse-branch https://github.com/user/repo.git x.y.z -# -# Returns -# Branch name --antigen-parse-branch () { - local url="$1" branch="$2" branches - - local match mbegin mend MATCH MBEGIN MEND - - if [[ "$branch" =~ '\*' ]]; then - branches=$(git ls-remote --tags -q "$url" "$branch"|cut -d'/' -f3|sort -n|tail -1) - # There is no --refs flag in git 1.8 and below, this way we - # emulate this flag -- also git 1.8 ref order is undefined. - branch=${${branches#*/*/}%^*} # Why you are like this? - fi - - echo $branch -} --antigen-update-repos () { - local repo bundle url target - local log=/tmp/antigen-v2-migrate.log - - echo "It seems you have bundles cloned with Antigen v1.x." - echo "We'll try to convert directory structure to v2." - echo - - echo -n "Moving bundles to '\$ADOTDIR/bundles'... " - - # Migrate old repos -> bundles - local errors=0 - for repo in $ADOTDIR/repos/*; do - bundle=${repo/$ADOTDIR\/repos\//} - bundle=${bundle//-SLASH-/\/} - bundle=${bundle//-COLON-/\:} - bundle=${bundle//-STAR-/\*} - url=${bundle//-PIPE-/\|} - target=$(-antigen-get-clone-dir $url) - mkdir -p "${target:A:h}" - echo " ---> ${repo/$ADOTDIR\/} -> ${target/$ADOTDIR\/}" | tee > $log - mv "$repo" "$target" &> $log - if [[ $? != 0 ]]; then - echo "Failed to migrate '$repo'!." - errors+=1 - fi - done - - if [[ $errors == 0 ]]; then - echo "Done." - else - echo "An error ocurred!" - fi - echo - - if [[ "$(ls -A $ADOTDIR/repos | wc -l | xargs)" == 0 ]]; then - echo "You can safely remove \$ADOTDIR/repos." - else - echo "Some bundles couldn't be migrated. See \$ADOTDIR/repos." - fi - - echo - if [[ $errors == 0 ]]; then - echo "Bundles migrated successfuly." - rm $log - else - echo "Some errors occured. Review migration log in '$log'." - fi - antigen-reset -} -# Ensure that a clone exists for the given repo url and branch. If the first -# argument is `update` and if a clone already exists for the given repo -# and branch, it is pull-ed, i.e., updated. -# -# This function expects three arguments in order: -# - 'url=' -# - 'update=true|false' -# - 'verbose=true|false' -# -# Returns true|false Whether cloning/pulling was succesful --antigen-ensure-repo () { - # Argument defaults. Previously using ${1:?"missing url argument"} format - # but it seems to mess up with cram - if (( $# < 1 )); then - echo "Antigen: Missing url argument." - return 1 - fi - - # The url. No sane default for this, so just empty. - local url=$1 - # Check if we have to update. - local update=${2:-false} - # Verbose output. - local verbose=${3:-false} - - shift $# - - # Get the clone's directory as per the given repo url and branch. - local clone_dir=$(-antigen-get-clone-dir $url) - if [[ -d "$clone_dir" && $update == false ]]; then - return true - fi - - # A temporary function wrapping the `git` command with repeated arguments. - --plugin-git () { - (\cd -q "$clone_dir" && eval ${ANTIGEN_CLONE_ENV} git --git-dir="$clone_dir/.git" --no-pager "$@" &>>! $ANTIGEN_LOG) - } - - local success=false - - # If its a specific branch that we want, checkout that branch. - local branch="master" # TODO FIX THIS - if [[ $url == *\|* ]]; then - branch="$(-antigen-parse-branch ${url%|*} ${url#*|})" - fi - - if [[ ! -d $clone_dir ]]; then - eval ${ANTIGEN_CLONE_ENV} git clone ${=ANTIGEN_CLONE_OPTS} --branch "$branch" -- "${url%|*}" "$clone_dir" &>> $ANTIGEN_LOG - success=$? - elif $update; then - # Save current revision. - local old_rev="$(--plugin-git rev-parse HEAD)" - # Pull changes if update requested. - --plugin-git checkout "$branch" - --plugin-git pull origin "$branch" - success=$? - - # Update submodules. - --plugin-git submodule update ${=ANTIGEN_SUBMODULE_OPTS} - # Get the new revision. - local new_rev="$(--plugin-git rev-parse HEAD)" - fi - - if [[ -n $old_rev && $old_rev != $new_rev ]]; then - echo Updated from $old_rev[0,7] to $new_rev[0,7]. - if $verbose; then - --plugin-git log --oneline --reverse --no-merges --stat '@{1}..' - fi - fi - - # Remove the temporary git wrapper function. - unfunction -- --plugin-git - - return $success -} -# Helper function: Same as `$1=$2`, but will only happen if the name -# specified by `$1` is not already set. --antigen-set-default () { - local arg_name="$1" - local arg_value="$2" - eval "test -z \"\$$arg_name\" && typeset -g $arg_name='$arg_value'" -} - --antigen-env-setup () { - typeset -gU fpath path - - # Pre-startup initializations. - -antigen-set-default ANTIGEN_OMZ_REPO_URL \ - https://github.com/robbyrussell/oh-my-zsh.git - -antigen-set-default ANTIGEN_PREZTO_REPO_URL \ - https://github.com/sorin-ionescu/prezto.git - -antigen-set-default ANTIGEN_DEFAULT_REPO_URL $ANTIGEN_OMZ_REPO_URL - - # Default Antigen directory. - -antigen-set-default ADOTDIR $HOME/.antigen - [[ ! -d $ADOTDIR ]] && mkdir -p $ADOTDIR - - # Defaults bundles directory. - -antigen-set-default ANTIGEN_BUNDLES $ADOTDIR/bundles - - # If there is no bundles directory, create it. - if [[ ! -d $ANTIGEN_BUNDLES ]]; then - mkdir -p $ANTIGEN_BUNDLES - # Check for v1 repos directory, transform it to v2 format. - [[ -d $ADOTDIR/repos ]] && -antigen-update-repos - fi - - -antigen-set-default ANTIGEN_COMPDUMP "${ADOTDIR:-$HOME}/.zcompdump" - -antigen-set-default ANTIGEN_LOG /dev/null - - # CLONE_OPTS uses ${=CLONE_OPTS} expansion so don't use spaces - # for arguments that can be passed as `--key=value`. - -antigen-set-default ANTIGEN_CLONE_ENV "GIT_TERMINAL_PROMPT=0" - -antigen-set-default ANTIGEN_CLONE_OPTS "--single-branch --recursive --depth=1" - -antigen-set-default ANTIGEN_SUBMODULE_OPTS "--recursive --depth=1" - - # Complain when a bundle is already installed. - -antigen-set-default _ANTIGEN_WARN_DUPLICATES true - - # Compatibility with oh-my-zsh themes. - -antigen-set-default _ANTIGEN_THEME_COMPAT true - - # Add default built-in extensions to load at start up - -antigen-set-default _ANTIGEN_BUILTIN_EXTENSIONS 'lock parallel defer cache' - - # Setup antigen's own completion. - if -antigen-interactive-mode; then - TRACE "Gonna create compdump file @ env-setup" COMPDUMP - autoload -Uz compinit - compinit -d "$ANTIGEN_COMPDUMP" - compdef _antigen antigen - else - (( $+functions[antigen-ext-init] )) && antigen-ext-init - fi -} -# Load a given bundle by sourcing it. -# -# The function also modifies fpath to add the bundle path. -# -# Usage -# -antigen-load "bundle-url" ["location"] ["make_local_clone"] ["btype"] -# -# Returns -# Integer. 0 if success 1 if an error ocurred. --antigen-load () { - local bundle list - typeset -A bundle; bundle=($@) - - typeset -Ua list; list=() - local location="${bundle[dir]}/${bundle[loc]}" - - # Prioritize location when given. - if [[ -f "${location}" ]]; then - list=(${location}) - else - # Directory locations must be suffixed with slash - location="$location/" - - # Prioritize theme with antigen-theme - if [[ ${bundle[btype]} == "theme" ]]; then - list=(${location}*.zsh-theme(N[1])) - fi - - # Common frameworks - if [[ $#list == 0 ]]; then - # dot-plugin, init and functions support (omz, prezto) - # Support prezto function loading. See https://github.com/zsh-users/antigen/pull/428 - list=(${location}*.plugin.zsh(N[1]) ${location}init.zsh(N[1]) ${location}/functions(N[1])) - fi - - # Default to zsh and sh - if [[ $#list == 0 ]]; then - list=(${location}*.zsh(N) ${location}*.sh(N)) - fi - fi - - -antigen-load-env ${(kv)bundle} - - # If there is any sourceable try to load it - if ! -antigen-load-source "${list[@]}" && [[ ! -d ${location} ]]; then - return 1 - fi - - return 0 -} - --antigen-load-env () { - typeset -A bundle; bundle=($@) - local location=${bundle[dir]}/${bundle[loc]} - - # Load to path if there is no sourceable - if [[ -d ${location} ]]; then - PATH="$PATH:${location:A}" - fpath+=("${location:A}") - return - fi - - PATH="$PATH:${location:A:h}" - fpath+=("${location:A:h}") -} - --antigen-load-source () { - typeset -a list - list=($@) - local src match mbegin mend MATCH MBEGIN MEND - - # Return error when we're given an empty list - if [[ $#list == 0 ]]; then - return 1 - fi - - # Using a for rather than `source $list` as we need to check for zsh-themes - # In order to create antigen-compat file. This is only needed for interactive-mode - # theme switching, for static loading (cache) there is no need. - for src in $list; do - if [[ $_ANTIGEN_THEME_COMPAT == true && -f "$src" && "$src" == *.zsh-theme* ]]; then - local compat="${src:A}.antigen-compat" - echo "# Generated by Antigen. Do not edit!" >! "$compat" - cat $src | sed -Ee '/\{$/,/^\}/!{ - s/^local // - }' >>! "$compat" - src="$compat" - fi - - if ! source "$src" 2>/dev/null; then - return 1 - fi - done -} -# Usage: -# -antigen-parse-args output_assoc_arr --antigen-parse-args () { - local argkey key value index=0 args - local match mbegin mend MATCH MBEGIN MEND - - local var=$1 - shift - - # Bundle spec arguments' default values. - #setopt XTRACE VERBOSE - builtin typeset -A args - args[url]="$ANTIGEN_DEFAULT_REPO_URL" - #unsetopt XTRACE VERBOSE - args[loc]=/ - args[make_local_clone]=true - args[btype]=plugin - #args[branch]= # commented out as it may cause assoc array kv mismatch - - while [[ $# -gt 0 ]]; do - argkey="${1%\=*}" - key="${argkey//--/}" - value="${1#*=}" - - case "$argkey" in - --url|--loc|--branch|--btype) - if [[ "$value" == "$argkey" ]]; then - printf "Required argument for '%s' not provided.\n" $key >&2 - else - args[$key]="$value" - fi - ;; - --no-local-clone) - args[make_local_clone]=false - ;; - --*) - printf "Unknown argument '%s'.\n" $key >&2 - ;; - *) - value=$key - case $index in - 0) - key=url - local domain="" - local url_path=$value - # Full url with protocol or ssh github url (github.com:org/repo) - if [[ "$value" =~ "://" || "$value" =~ ":" ]]; then - if [[ "$value" =~ [@.][^/:]+[:]?[0-9]*[:/]?(.*)@?$ ]]; then - url_path=$match[1] - domain=${value/$url_path/} - fi - fi - - if [[ "$url_path" =~ '@' ]]; then - args[branch]="${url_path#*@}" - value="$domain${url_path%@*}" - else - value="$domain$url_path" - fi - ;; - 1) key=loc ;; - esac - let index+=1 - args[$key]="$value" - ;; - esac - - shift - done - - # Check if url is just the plugin name. Super short syntax. - if [[ "${args[url]}" != */* ]]; then - case "$ANTIGEN_DEFAULT_REPO_URL" in - "$ANTIGEN_OMZ_REPO_URL") - args[loc]="plugins/${args[url]}" - ;; - "$ANTIGEN_PREZTO_REPO_URL") - args[loc]="modules/${args[url]}" - ;; - *) - args[loc]="${args[url]}" - ;; - esac - args[url]="$ANTIGEN_DEFAULT_REPO_URL" - fi - - # Resolve the url. - # Expand short github url syntax: `username/reponame`. - local url="${args[url]}" - if [[ $url != git://* && - $url != https://* && - $url != http://* && - $url != ssh://* && - $url != /* && - $url != *github.com:*/* - ]]; then - url="https://github.com/${url%.git}.git" - fi - args[url]="$url" - - # Ignore local clone if url given is not a git directory - if [[ ${args[url]} == /* && ! -d ${args[url]}/.git ]]; then - args[make_local_clone]=false - fi - - # Add the branch information to the url if we need to create a local clone. - # Format url in bundle-metadata format: url[|branch] - if [[ ! -z "${args[branch]}" && ${args[make_local_clone]} == true ]]; then - args[url]="${args[url]}|${args[branch]}" - fi - - # Add the theme extension to `loc`, if this is a theme, but only - # if it's especified, ie, --loc=theme-name, in case when it's not - # specified antige-load-list will look for *.zsh-theme files - if [[ ${args[btype]} == "theme" && - ${args[loc]} != "/" && ${args[loc]} != *.zsh-theme ]]; then - args[loc]="${args[loc]}.zsh-theme" - fi - - local name="${args[url]%|*}" - local branch="${args[branch]}" - - # Extract bundle name. - if [[ "$name" =~ '.*/(.*/.*).*$' ]]; then - name="${match[1]}" - fi - name="${name%.git*}" - - # Format bundle name with optional branch. - if [[ -n "${branch}" ]]; then - args[name]="${name}@${branch}" - else - args[name]="${name}" - fi - - # Format bundle path. - if [[ ${args[make_local_clone]} == true ]]; then - local bpath="$name" - # Suffix with branch/tag name - if [[ -n "$branch" ]]; then - # bpath is in the form of repo/name@version => repo/name-version - # Replace / with - in bundle branch. - local bbranch=${branch//\//-} - # If branch/tag is semver-like do replace * by x. - bbranch=${bbranch//\*/x} - bpath="${name}-${bbranch}" - fi - - bpath="$ANTIGEN_BUNDLES/$bpath" - args[dir]="${(qq)bpath}" - else - # if it's local then path is just the "url" argument, loc remains the same - args[dir]=${args[url]} - fi - - # Escape url and branch (may contain semver-like and pipe characters) - args[url]="${(qq)args[url]}" - if [[ -n "${args[branch]}" ]]; then - args[branch]="${(qq)args[branch]}" - fi - - # Escape bundle name (may contain semver-like characters) - args[name]="${(qq)args[name]}" - - eval "${var}=(${(kv)args})" - - return 0 -} -# Updates revert-info data with git hash. -# -# This does process only cloned bundles. -# -# Usage -# -antigen-revert-info -# -# Returns -# Nothing. Generates/updates $ADOTDIR/revert-info. --antigen-revert-info() { - local url - # Update your bundles, i.e., `git pull` in all the plugin repos. - date >! $ADOTDIR/revert-info - - -antigen-get-cloned-bundles | while read url; do - local clone_dir="$(-antigen-get-clone-dir "$url")" - if [[ -d "$clone_dir" ]]; then - (echo -n "$clone_dir:" - \cd -q "$clone_dir" - git rev-parse HEAD) >> $ADOTDIR/revert-info - fi - done -} --antigen-use-oh-my-zsh () { - typeset -g ZSH ZSH_CACHE_DIR - ANTIGEN_DEFAULT_REPO_URL=$ANTIGEN_OMZ_REPO_URL - if [[ -z "$ZSH" ]]; then - ZSH="$(-antigen-get-clone-dir "$ANTIGEN_DEFAULT_REPO_URL")" - fi - if [[ -z "$ZSH_CACHE_DIR" ]]; then - ZSH_CACHE_DIR="$ZSH/cache/" - fi - antigen-bundle --loc=lib -} --antigen-use-prezto () { - ANTIGEN_DEFAULT_REPO_URL=$ANTIGEN_PREZTO_REPO_URL - antigen-bundle "$ANTIGEN_PREZTO_REPO_URL" -} -# Initialize completion -antigen-apply () { - LOG "Called antigen-apply" - - # Load the compinit module. This will readefine the `compdef` function to - # the one that actually initializes completions. - TRACE "Gonna create compdump file @ apply" COMPDUMP - autoload -Uz compinit - compinit -d "$ANTIGEN_COMPDUMP" - - # Apply all `compinit`s that have been deferred. - local cdef - for cdef in "${__deferred_compdefs[@]}"; do - compdef "$cdef" - done - - { zcompile "$ANTIGEN_COMPDUMP" } &! - - unset __deferred_compdefs -} -# Syntaxes -# antigen-bundle [=/] -# Keyword only arguments: -# branch - The branch of the repo to use for this bundle. -antigen-bundle () { - TRACE "Called antigen-bundle with $@" BUNDLE - if [[ -z "$1" ]]; then - printf "Antigen: Must provide a bundle url or name.\n" >&2 - return 1 - fi - - builtin typeset -A bundle; -antigen-parse-args 'bundle' ${=@} - if [[ -z ${bundle[btype]} ]]; then - bundle[btype]=bundle - fi - - local record="${bundle[url]} ${bundle[loc]} ${bundle[btype]} ${bundle[make_local_clone]}" - if [[ $_ANTIGEN_WARN_DUPLICATES == true && ! ${_ANTIGEN_BUNDLE_RECORD[(I)$record]} == 0 ]]; then - printf "Seems %s is already installed!\n" ${bundle[name]} - return 1 - fi - - # Clone bundle if we haven't done do already. - if [[ ! -d "${bundle[dir]}" ]]; then - if ! -antigen-bundle-install ${(kv)bundle}; then - return 1 - fi - fi - - # Load the plugin. - if ! -antigen-load ${(kv)bundle}; then - TRACE "-antigen-load failed to load ${bundle[name]}" BUNDLE - printf "Antigen: Failed to load %s.\n" ${bundle[btype]} >&2 - return 1 - fi - - # Only add it to the record if it could be installed and loaded. - _ANTIGEN_BUNDLE_RECORD+=("$record") -} - -# -# Usage: -# -antigen-bundle-install -# Returns: -# 1 if it fails to install bundle --antigen-bundle-install () { - typeset -A bundle; bundle=($@) - - # Ensure a clone exists for this repo, if needed. - # Get the clone's directory as per the given repo url and branch. - local bpath="${bundle[dir]}" - # Clone if it doesn't already exist. - local start=$(date +'%s') - - printf "Installing %s... " "${bundle[name]}" - - if ! -antigen-ensure-repo "${bundle[url]}"; then - # Return immediately if there is an error cloning - TRACE "-antigen-bundle-instal failed to clone ${bundle[url]}" BUNDLE - printf "Error! Activate logging and try again.\n" >&2 - return 1 - fi - - local took=$(( $(date +'%s') - $start )) - printf "Done. Took %ds.\n" $took -} -antigen-bundles () { - # Bulk add many bundles at one go. Empty lines and lines starting with a `#` - # are ignored. Everything else is given to `antigen-bundle` as is, no - # quoting rules applied. - local line - setopt localoptions no_extended_glob # See https://github.com/zsh-users/antigen/issues/456 - grep '^[[:space:]]*[^[:space:]#]' | while read line; do - antigen-bundle ${=line%#*} - done -} -# Cleanup unused repositories. -antigen-cleanup () { - local force=false - if [[ $1 == --force ]]; then - force=true - fi - - if [[ ! -d "$ANTIGEN_BUNDLES" || -z "$(\ls -A "$ANTIGEN_BUNDLES")" ]]; then - echo "You don't have any bundles." - return 0 - fi - - # Find directores in ANTIGEN_BUNDLES, that are not in the bundles record. - typeset -a unused_clones clones - - local url record clone - for record in $(-antigen-get-cloned-bundles); do - url=${record% /*} - clones+=("$(-antigen-get-clone-dir $url)") - done - - for clone in $ANTIGEN_BUNDLES/*/*(/); do - if [[ $clones[(I)$clone] == 0 ]]; then - unused_clones+=($clone) - fi - done - - if [[ -z $unused_clones ]]; then - echo "You don't have any unidentified bundles." - return 0 - fi - - echo 'You have clones for the following repos, but are not used.' - echo "\n${(j:\n:)unused_clones}" - - if $force || (echo -n '\nDelete them all? [y/N] '; read -q); then - echo - echo - for clone in $unused_clones; do - echo -n "Deleting clone \"$clone\"..." - \rm -rf "$clone" - - echo ' done.' - done - else - echo - echo "Nothing deleted." - fi -} -antigen-help () { - antigen-version - - cat < [args] - -Commands: - apply Must be called in the zshrc after all calls to 'antigen bundle'. - bundle Install and load a plugin. - cache-gen Generate Antigen's cache with currently loaded bundles. - cleanup Remove clones of repos not used by any loaded plugins. - init Use caching to quickly load bundles. - list List currently loaded plugins. - purge Remove a bundle from the filesystem. - reset Clean the generated cache. - restore Restore plugin state from a snapshot file. - revert Revert plugins to their state prior to the last time 'antigen - update' was run. - selfupdate Update antigen. - snapshot Create a snapshot of all active plugin repos and save it to a - snapshot file. - update Update plugins. - use Load a supported zsh pre-packaged framework. - -For further details and complete documentation, visit the project's page at -'http://antigen.sharats.me'. -EOF -} -# Antigen command to load antigen configuration -# -# This method is slighlty more performing than using various antigen-* methods. -# -# Usage -# Referencing an antigen configuration file: -# -# antigen-init "/path/to/antigenrc" -# -# or using HEREDOCS: -# -# antigen-init <&2 - return 1 - fi - fi - - # Otherwise we expect it to be a heredoc - grep '^[[:space:]]*[^[:space:]#]' | while read -r line; do - eval $line - done -} -# List instaled bundles either in long (record), short or simple format. -# -# Usage -# antigen-list [--short|--long|--simple] -# -# Returns -# List of bundles -antigen-list () { - local format=$1 - - # List all currently installed bundles. - if [[ -z $_ANTIGEN_BUNDLE_RECORD ]]; then - echo "You don't have any bundles." >&2 - return 1 - fi - - -antigen-get-bundles $format -} -# Remove a bundle from filesystem -# -# Usage -# antigen-purge example/bundle [--force] -# -# Returns -# Nothing. Removes bundle from filesystem. -antigen-purge () { - local bundle=$1 - local force=$2 - - if [[ $# -eq 0 ]]; then - echo "Antigen: Missing argument." >&2 - return 1 - fi - - if -antigen-purge-bundle $bundle $force; then - antigen-reset - else - return $? - fi - - return 0 -} - -# Remove a bundle from filesystem -# -# Usage -# antigen-purge example/bundle [--force] -# -# Returns -# Nothing. Removes bundle from filesystem. --antigen-purge-bundle () { - local bundle=$1 - local force=$2 - local clone_dir="" - - local record="" - local url="" - local make_local_clone="" - - if [[ $# -eq 0 ]]; then - echo "Antigen: Missing argument." >&2 - return 1 - fi - - # local keyword doesn't work on zsh <= 5.0.0 - record=$(-antigen-find-record $bundle) - - if [[ ! -n "$record" ]]; then - echo "Bundle not found in record. Try 'antigen bundle $bundle' first." >&2 - return 1 - fi - - url="$(echo "$record" | cut -d' ' -f1)" - make_local_clone=$(echo "$record" | cut -d' ' -f4) - - if [[ $make_local_clone == "false" ]]; then - echo "Bundle has no local clone. Will not be removed." >&2 - return 1 - fi - - clone_dir=$(-antigen-get-clone-dir "$url") - if [[ $force == "--force" ]] || read -q "?Remove '$clone_dir'? (y/n) "; then - # Need empty line after read -q - [[ ! -n $force ]] && echo "" || echo "Removing '$clone_dir'."; - rm -rf "$clone_dir" - return $? - fi - - return 1 -} -# Removes cache payload and metadata if available -# -# Usage -# antigen-reset -# -# Returns -# Nothing -antigen-reset () { - [[ -f "$ANTIGEN_CACHE" ]] && rm -f "$ANTIGEN_CACHE" "$ANTIGEN_CACHE.zwc" 1> /dev/null - [[ -f "$ANTIGEN_RSRC" ]] && rm -f "$ANTIGEN_RSRC" 1> /dev/null - [[ -f "$ANTIGEN_COMPDUMP" ]] && rm -f "$ANTIGEN_COMPDUMP" "$ANTIGEN_COMPDUMP.zwc" 1> /dev/null - [[ -f "$ANTIGEN_LOCK" ]] && rm -f "$ANTIGEN_LOCK" 1> /dev/null - echo 'Done. Please open a new shell to see the changes.' -} -antigen-restore () { - local line - if [[ $# == 0 ]]; then - echo 'Please provide a snapshot file to restore from.' >&2 - return 1 - fi - - local snapshot_file="$1" - - # TODO: Before doing anything with the snapshot file, verify its checksum. - # If it fails, notify this to the user and confirm if restore should - # proceed. - - echo -n "Restoring from $snapshot_file..." - - sed -n '1!p' "$snapshot_file" | - while read line; do - local version_hash="${line%% *}" - local url="${line##* }" - local clone_dir="$(-antigen-get-clone-dir "$url")" - - if [[ ! -d $clone_dir ]]; then - git clone "$url" "$clone_dir" &> /dev/null - fi - - (\cd -q "$clone_dir" && git checkout $version_hash) &> /dev/null - done - - echo ' done.' - echo 'Please open a new shell to get the restored changes.' -} -# Reads $ADORDIR/revert-info and restores bundles' revision -antigen-revert () { - local line - if [[ -f $ADOTDIR/revert-info ]]; then - cat $ADOTDIR/revert-info | sed -n '1!p' | while read line; do - local dir="$(echo "$line" | cut -d: -f1)" - git --git-dir="$dir/.git" --work-tree="$dir" \ - checkout "$(echo "$line" | cut -d: -f2)" 2> /dev/null - done - - echo "Reverted to state before running -update on $( - cat $ADOTDIR/revert-info | sed -n '1p')." - - else - echo 'No revert information available. Cannot revert.' >&2 - return 1 - fi -} -# Update (with `git pull`) antigen itself. -# TODO: Once update is finished, show a summary of the new commits, as a kind of -# "what's new" message. -antigen-selfupdate () { - (\cd -q $_ANTIGEN_INSTALL_DIR - if [[ ! ( -d .git || -f .git ) ]]; then - echo "Your copy of antigen doesn't appear to be a git clone. " \ - "The 'selfupdate' command cannot work in this case." - return 1 - fi - local head="$(git rev-parse --abbrev-ref HEAD)" - if [[ $head == "HEAD" ]]; then - # If current head is detached HEAD, checkout to master branch. - git checkout master - fi - git pull - - # TODO Should be transparently hooked by zcache - antigen-reset &>> /dev/null - ) -} -antigen-snapshot () { - local snapshot_file="${1:-antigen-shapshot}" - local urls url dir version_hash snapshot_content - local -a bundles - - # The snapshot content lines are pairs of repo-url and git version hash, in - # the form: - # - urls=$(-antigen-echo-record | awk '$4 == "true" {print $1}' | sort -u) - for url in ${(f)urls}; do - dir="$(-antigen-get-clone-dir "$url")" - version_hash="$(\cd -q "$dir" && git rev-parse HEAD)" - bundles+=("$version_hash $url"); - done - snapshot_content=${(j:\n:)bundles} - - { - # The first line in the snapshot file is for metadata, in the form: - # key='value'; key='value'; key='value'; - # Where `key`s are valid shell variable names. - - # Snapshot version. Has no relation to antigen version. If the snapshot - # file format changes, this number can be incremented. - echo -n "version='1';" - - # Snapshot creation date+time. - echo -n " created_on='$(date)';" - - # Add a checksum with the md5 checksum of all the snapshot lines. - chksum() { (md5sum; test $? = 127 && md5) 2>/dev/null | cut -d' ' -f1 } - local checksum="$(echo "$snapshot_content" | chksum)" - unset -f chksum; - echo -n " checksum='${checksum%% *}';" - - # A newline after the metadata and then the snapshot lines. - echo "\n$snapshot_content" - - } > "$snapshot_file" -} -# Loads a given theme. -# -# Shares the same syntax as antigen-bundle command. -# -# Usage -# antigen-theme zsh/theme[.zsh-theme] -# -# Returns -# 0 if everything was succesfully -antigen-theme () { - local name=$1 result=0 record - local match mbegin mend MATCH MBEGIN MEND - - if [[ -z "$1" ]]; then - printf "Antigen: Must provide a theme url or name.\n" >&2 - return 1 - fi - - -antigen-theme-reset-hooks - - record=$(-antigen-find-record "theme") - if [[ "$1" != */* && "$1" != --* ]]; then - # The first argument is just a name of the plugin, to be picked up from - # the default repo. - antigen-bundle --loc=themes/$name --btype=theme - - else - antigen-bundle "$@" --btype=theme - - fi - result=$? - - # Remove a theme from the record if the following conditions apply: - # - there was no error in bundling the given theme - # - there is a theme registered - # - registered theme is not the same as the current one - if [[ $result == 0 && -n $record ]]; then - # http://zsh-workers.zsh.narkive.com/QwfCWpW8/what-s-wrong-with-this-expression - if [[ "$record" =~ "$@" ]]; then - return $result - else - _ANTIGEN_BUNDLE_RECORD[$_ANTIGEN_BUNDLE_RECORD[(I)$record]]=() - fi - fi - - return $result -} - --antigen-theme-reset-hooks () { - # This is only needed on interactive mode - autoload -U add-zsh-hook is-at-least - local hook - - # Clear out prompts - PROMPT="" - if [[ -n $RPROMPT ]]; then - RPROMPT="" - fi - - for hook in chpwd precmd preexec periodic; do - add-zsh-hook -D "${hook}" "prompt_*" - # common in omz themes - add-zsh-hook -D "${hook}" "*_${hook}" - add-zsh-hook -d "${hook}" "vcs_info" - done -} -# Updates the bundles or a single bundle. -# -# Usage -# antigen-update [example/bundle] -# -# Returns -# Nothing. Performs a `git pull`. -antigen-update () { - local bundle=$1 url - - # Clear log - :> $ANTIGEN_LOG - - # Update revert-info data - -antigen-revert-info - - # If no argument is given we update all bundles - if [[ $# -eq 0 ]]; then - # Here we're ignoring all non cloned bundles (ie, --no-local-clone) - -antigen-get-cloned-bundles | while read url; do - -antigen-update-bundle $url - done - # TODO next minor version - # antigen-reset - else - if -antigen-update-bundle $bundle; then - # TODO next minor version - # antigen-reset - else - return $? - fi - fi -} - -# Updates a bundle performing a `git pull`. -# -# Usage -# -antigen-update-bundle example/bundle -# -# Returns -# Nothing. Performs a `git pull`. --antigen-update-bundle () { - local bundle="$1" - local record="" - local url="" - local make_local_clone="" - local start=$(date +'%s') - - if [[ $# -eq 0 ]]; then - printf "Antigen: Missing argument.\n" >&2 - return 1 - fi - - record=$(-antigen-find-record $bundle) - if [[ ! -n "$record" ]]; then - printf "Bundle not found in record. Try 'antigen bundle %s' first.\n" $bundle >&2 - return 1 - fi - - url="$(echo "$record" | cut -d' ' -f1)" - make_local_clone=$(echo "$record" | cut -d' ' -f4) - - local branch="master" - if [[ $url == *\|* ]]; then - branch="$(-antigen-parse-branch ${url%|*} ${url#*|})" - fi - - printf "Updating %s... " $(-antigen-bundle-short-name "$url" "$branch") - - if [[ $make_local_clone == "false" ]]; then - printf "Bundle has no local clone. Will not be updated.\n" >&2 - return 1 - fi - - # update=true verbose=false - if ! -antigen-ensure-repo "$url" true false; then - printf "Error! Activate logging and try again.\n" >&2 - return 1 - fi - - local took=$(( $(date +'%s') - $start )) - printf "Done. Took %ds.\n" $took -} -antigen-use () { - if [[ $1 == oh-my-zsh ]]; then - -antigen-use-oh-my-zsh - elif [[ $1 == prezto ]]; then - -antigen-use-prezto - elif [[ $1 != "" ]]; then - ANTIGEN_DEFAULT_REPO_URL=$1 - antigen-bundle $@ - else - echo 'Usage: antigen-use ' >&2 - echo 'Where is any one of the following:' >&2 - echo ' * oh-my-zsh' >&2 - echo ' * prezto' >&2 - echo ' is the full url.' >&2 - return 1 - fi -} -antigen-version () { - local version="v2.2.2" - local extensions revision="" - if [[ -d $_ANTIGEN_INSTALL_DIR/.git ]]; then - revision=" ($(git --git-dir=$_ANTIGEN_INSTALL_DIR/.git rev-parse --short '@'))" - fi - - printf "Antigen %s%s\n" $version $revision - if (( $+functions[antigen-ext] )); then - typeset -a extensions; extensions=($(antigen-ext-list)) - if [[ $#extensions -gt 0 ]]; then - printf "Extensions loaded: %s\n" ${(j:, :)extensions} - fi - fi -} -typeset -Ag _ANTIGEN_HOOKS; _ANTIGEN_HOOKS=() -typeset -Ag _ANTIGEN_HOOKS_META; _ANTIGEN_HOOKS_META=() -typeset -g _ANTIGEN_HOOK_PREFIX="-antigen-hook-" -typeset -g _ANTIGEN_EXTENSIONS; _ANTIGEN_EXTENSIONS=() - -# -antigen-add-hook antigen-apply antigen-apply-hook replace -# - Replaces hooked function with hook, do not call hooked function -# - Return -1 to stop calling further hooks -# -antigen-add-hook antigen-apply antigen-apply-hook pre (pre-call) -# - By default it will call hooked function -# -antigen-add-hook antigen-pply antigen-apply-hook post (post-call) -# - Calls antigen-apply and then calls hook function -# Usage: -# -antigen-add-hook antigen-apply antigen-apply-hook ["replace"|"pre"|"post"] ["once"|"repeat"] -antigen-add-hook () { - local target="$1" hook="$2" type="$3" mode="${4:-repeat}" - - if (( ! $+functions[$target] )); then - printf "Antigen: Function %s doesn't exist.\n" $target - return 1 - fi - - if (( ! $+functions[$hook] )); then - printf "Antigen: Function %s doesn't exist.\n" $hook - return 1 - fi - - if [[ "${_ANTIGEN_HOOKS[$target]}" == "" ]]; then - _ANTIGEN_HOOKS[$target]="${hook}" - else - _ANTIGEN_HOOKS[$target]="${_ANTIGEN_HOOKS[$target]}:${hook}" - fi - - _ANTIGEN_HOOKS_META[$hook]="target $target type $type mode $mode called 0" - - # Do shadow for this function if there is none already - local hook_function="${_ANTIGEN_HOOK_PREFIX}$target" - if (( ! $+functions[$hook_function] )); then - # Preserve hooked function - eval "function ${_ANTIGEN_HOOK_PREFIX}$(functions -- $target)" - - # Create hook, call hook-handler to further process hook functions - eval "function $target () { - noglob -antigen-hook-handler $target \$@ - return \$? - }" - fi - - return 0 -} - -# Private function to handle multiple hooks in a central point. --antigen-hook-handler () { - local target="$1" args hook called - local hooks meta - shift - typeset -a args; args=(${@}) - - typeset -a pre_hooks replace_hooks post_hooks; - typeset -a hooks; hooks=(${(s|:|)_ANTIGEN_HOOKS[$target]}) - - typeset -A meta; - for hook in $hooks; do - meta=(${(s: :)_ANTIGEN_HOOKS_META[$hook]}) - if [[ ${meta[mode]} == "once" && ${meta[called]} == 1 ]]; then - WARN "Ignoring hook due to mode ${meta[mode]}: $hook" - continue - fi - - let called=${meta[called]}+1 - meta[called]=$called - _ANTIGEN_HOOKS_META[$hook]="${(kv)meta}" - WARN "Updated meta: "${(kv)meta} - - case "${meta[type]}" in - "pre") - pre_hooks+=($hook) - ;; - "replace") - replace_hooks+=($hook) - ;; - "post") - post_hooks+=($hook) - ;; - esac - done - - WARN "Processing hooks: ${hooks}" - - for hook in $pre_hooks; do - WARN "Pre hook:" $hook $args - noglob $hook $args - [[ $? == -1 ]] && WARN "$hook shortcircuited" && return $ret - done - - # A replace hook will return inmediately - local replace_hook=0 ret=0 - for hook in $replace_hooks; do - replace_hook=1 - # Should not be needed if `antigen-remove-hook` removed unneeded hooks. - if (( $+functions[$hook] )); then - WARN "Replace hook:" $hook $args - noglob $hook $args - [[ $? == -1 ]] && WARN "$hook shortcircuited" && return $ret - fi - done - - if [[ $replace_hook == 0 ]]; then - WARN "${_ANTIGEN_HOOK_PREFIX}$target $args" - noglob ${_ANTIGEN_HOOK_PREFIX}$target $args - ret=$? - else - WARN "Replaced hooked function." - fi - - for hook in $post_hooks; do - WARN "Post hook:" $hook $args - noglob $hook $args - [[ $? == -1 ]] && WARN "$hook shortcircuited" && return $ret - done - - LOG "Return from hook ${target} with ${ret}" - - return $ret -} - -# Usage: -# -antigen-remove-hook antigen-apply-hook -antigen-remove-hook () { - local hook="$1" - typeset -A meta; meta=(${(s: :)_ANTIGEN_HOOKS_META[$hook]}) - local target="${meta[target]}" - local -a hooks; hooks=(${(s|:|)_ANTIGEN_HOOKS[$target]}) - - # Remove registered hook - if [[ $#hooks > 0 ]]; then - hooks[$hooks[(I)$hook]]=() - fi - _ANTIGEN_HOOKS[${target}]="${(j|:|)hooks}" - - if [[ $#hooks == 0 ]]; then - # Destroy base hook - eval "function $(functions -- ${_ANTIGEN_HOOK_PREFIX}$target | sed s/${_ANTIGEN_HOOK_PREFIX}//)" - if (( $+functions[${_ANTIGEN_HOOK_PREFIX}$target] )); then - unfunction -- "${_ANTIGEN_HOOK_PREFIX}$target" - fi - fi - - unfunction -- $hook 2> /dev/null -} - -# Remove all defined hooks. --antigen-reset-hooks () { - local target - - for target in ${(k)_ANTIGEN_HOOKS}; do - # Release all hooked functions - eval "function $(functions -- ${_ANTIGEN_HOOK_PREFIX}$target | sed s/${_ANTIGEN_HOOK_PREFIX}//)" - unfunction -- "${_ANTIGEN_HOOK_PREFIX}$target" 2> /dev/null - done - - _ANTIGEN_HOOKS=() - _ANTIGEN_HOOKS_META=() - _ANTIGEN_EXTENSIONS=() -} - -# Initializes an extension -# Usage: -# antigen-ext ext-name -antigen-ext () { - local ext=$1 - local func="-antigen-$ext-init" - if (( $+functions[$func] && $_ANTIGEN_EXTENSIONS[(I)$ext] == 0 )); then - eval $func - local ret=$? - WARN "$func return code was $ret" - if (( $ret == 0 )); then - LOG "LOADED EXTENSION $ext" EXT - -antigen-$ext-execute && _ANTIGEN_EXTENSIONS+=($ext) - else - WARN "IGNORING EXTENSION $func" EXT - return 1 - fi - - else - printf "Antigen: No extension defined or already loaded: %s\n" $func >&2 - return 1 - fi -} - -# List installed extensions -# Usage: -# antigen ext-list -antigen-ext-list () { - echo $_ANTIGEN_EXTENSIONS -} - -# Initializes built-in extensions -# Usage: -# antigen-ext-init -antigen-ext-init () { - # Initialize extensions. unless in interactive mode. - local ext - for ext in ${(s/ /)_ANTIGEN_BUILTIN_EXTENSIONS}; do - # Check if extension is loaded before intializing it - (( $+functions[-antigen-$ext-init] )) && antigen-ext $ext - done -} -# Initialize defer lib --antigen-defer-init () { - typeset -ga _DEFERRED_BUNDLE; _DEFERRED_BUNDLE=() - if -antigen-interactive-mode; then - return 1 - fi -} - --antigen-defer-execute () { - # Hooks antigen-bundle in order to defer its execution. - antigen-bundle-defer () { - _DEFERRED_BUNDLE+=("${(j: :)${@}}") - return -1 # Stop right there - } - antigen-add-hook antigen-bundle antigen-bundle-defer replace - - # Hooks antigen-apply in order to release hooked functions - antigen-apply-defer () { - WARN "Defer pre-apply" DEFER PRE-APPLY - antigen-remove-hook antigen-bundle-defer - - # Process all deferred bundles. - local bundle - for bundle in ${_DEFERRED_BUNDLE[@]}; do - LOG "Processing deferred bundle: ${bundle}" DEFER - antigen-bundle $bundle - done - - unset _DEFERRED_BUNDLE - } - antigen-add-hook antigen-apply antigen-apply-defer pre once -} -# Initialize lock lib --antigen-lock-init () { - # Default lock path. - -antigen-set-default ANTIGEN_LOCK $ADOTDIR/.lock - typeset -g _ANTIGEN_LOCK_PROCESS=false - - # Use env variable to determine if we should load this extension - -antigen-set-default ANTIGEN_MUTEX true - # Set ANTIGEN_MUTEX to false to avoid loading this extension - if [[ $ANTIGEN_MUTEX == true ]]; then - return 0; - fi - - # Do not use mutex - return 1; -} - --antigen-lock-execute () { - # Hook antigen command in order to check/create a lock file. - # This hook is only run once then releases itself. - antigen-lock () { - LOG "antigen-lock called" - # If there is a lock set up then we won't process anything. - if [[ -f $ANTIGEN_LOCK ]]; then - # Set up flag do the message is not repeated for each antigen-* command - [[ $_ANTIGEN_LOCK_PROCESS == false ]] && printf "Antigen: Another process in running.\n" - _ANTIGEN_LOCK_PROCESS=true - # Do not further process hooks. For this hook to properly work it - # should be registered first. - return -1 - fi - - WARN "Creating antigen-lock file at $ANTIGEN_LOCK" - touch $ANTIGEN_LOCK - } - antigen-add-hook antigen antigen-lock pre once - - # Hook antigen-apply in order to release .lock file. - antigen-apply-lock () { - WARN "Freeing antigen-lock file at $ANTIGEN_LOCK" - unset _ANTIGEN_LOCK_PROCESS - rm -f $ANTIGEN_LOCK &> /dev/null - } - antigen-add-hook antigen-apply antigen-apply-lock post once -} -# Initialize parallel lib --antigen-parallel-init () { - WARN "Init parallel extension" PARALLEL - typeset -ga _PARALLEL_BUNDLE; _PARALLEL_BUNDLE=() - if -antigen-interactive-mode; then - return 1 - fi -} - --antigen-parallel-execute() { - WARN "Exec parallel extension" PARALLEL - # Install bundles in parallel - antigen-bundle-parallel-execute () { - WARN "Parallel antigen-bundle-parallel-execute" PARALLEL - typeset -a pids; pids=() - local args pid - - WARN "Gonna install in parallel ${#_PARALLEL_BUNDLE} bundles." PARALLEL - # Do ensure-repo in parallel - WARN "${_PARALLEL_BUNDLE}" PARALLEL - typeset -Ua repositories # Used to keep track of cloned repositories to avoid - # trying to clone it multiple times. - for args in ${_PARALLEL_BUNDLE}; do - typeset -A bundle; -antigen-parse-args 'bundle' ${=args} - - if [[ ! -d ${bundle[dir]} && $repositories[(I)${bundle[url]}] == 0 ]]; then - WARN "Install in parallel ${bundle[name]}." PARALLEL - echo "Installing ${bundle[name]}!..." - # $bundle[url]'s format is "url|branch" as to create "$ANTIGEN_BUNDLES/bundle/name-branch", - # this way you may require multiple branches from the same repository. - -antigen-ensure-repo "${bundle[url]}" > /dev/null &! - pids+=($!) - else - WARN "Bundle ${bundle[name]} already cloned locally." PARALLEL - fi - - repositories+=(${bundle[url]}) - done - - # Wait for all background processes to end - while [[ $#pids > 0 ]]; do - for pid in $pids; do - # `ps` may diplay an error message such "Signal 18 (CONT) caught by ps - # (procps-ng version 3.3.9).", see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=732410 - if [[ $(ps -o pid= -p $pid 2>/dev/null) == "" ]]; then - pids[$pids[(I)$pid]]=() - fi - done - sleep .5 - done - - builtin local bundle &> /dev/null - for bundle in ${_PARALLEL_BUNDLE[@]}; do - antigen-bundle $bundle - done - - - WARN "Parallel install done" PARALLEL - } - - # Hooks antigen-apply in order to release hooked functions - antigen-apply-parallel () { - WARN "Parallel pre-apply" PARALLEL PRE-APPLY - #antigen-remove-hook antigen-pre-apply-parallel - # Hooks antigen-bundle in order to parallel its execution. - antigen-bundle-parallel () { - TRACE "antigen-bundle-parallel: $@" PARALLEL - _PARALLEL_BUNDLE+=("${(j: :)${@}}") - } - antigen-add-hook antigen-bundle antigen-bundle-parallel replace - } - antigen-add-hook antigen-apply antigen-apply-parallel pre once - - antigen-apply-parallel-execute () { - WARN "Parallel replace-apply" PARALLEL REPLACE-APPLY - antigen-remove-hook antigen-bundle-parallel - # Process all parallel bundles. - antigen-bundle-parallel-execute - - unset _PARALLEL_BUNDLE - antigen-remove-hook antigen-apply-parallel-execute - antigen-apply - } - antigen-add-hook antigen-apply antigen-apply-parallel-execute replace once -} -typeset -ga _ZCACHE_BUNDLE_SOURCE _ZCACHE_CAPTURE_BUNDLE -typeset -g _ZCACHE_CAPTURE_PREFIX - -# Generates cache from listed bundles. -# -# Iterates over _ANTIGEN_BUNDLE_RECORD and join all needed sources into one, -# if this is done through -antigen-load-list. -# Result is stored in ANTIGEN_CACHE. -# -# _ANTIGEN_BUNDLE_RECORD and fpath is stored in cache. -# -# Usage -# -zcache-generate-cache -# -# Returns -# Nothing. Generates ANTIGEN_CACHE --antigen-cache-generate () { - local -aU _fpath _PATH _sources - local record - - LOG "Gonna generate cache for $_ZCACHE_BUNDLE_SOURCE" - for record in $_ZCACHE_BUNDLE_SOURCE; do - record=${record:A} - # LOG "Caching $record" - if [[ -f $record ]]; then - # Adding $'\n' as a suffix as j:\n: doesn't work inside a heredoc. - if [[ $_ANTIGEN_THEME_COMPAT == true && "$record" == *.zsh-theme* ]]; then - local compat="${record:A}.antigen-compat" - echo "# Generated by Antigen. Do not edit!" >! "$compat" - cat $record | sed -Ee '/\{$/,/^\}/!{ - s/^local // - }' >>! "$compat" - record="$compat" - fi - _sources+=("source '${record}';"$'\n') - elif [[ -d $record ]]; then - _PATH+=("${record}") - _fpath+=("${record}") - fi - done - -cat > $ANTIGEN_CACHE <! "$ANTIGEN_RSRC" - for rsrc in $ANTIGEN_CHECK_FILES; do - zcompile $rsrc - done - } &! - - return true -} - -# Initializes caching mechanism. -# -# Hooks `antigen-bundle` and `antigen-apply` in order to defer bundle install -# and load. All bundles are loaded from generated cache rather than dynamically -# as these are bundled. -# -# Usage -# -antigen-cache-init -# Returns -# Nothing --antigen-cache-init () { - if -antigen-interactive-mode; then - return 1 - fi - - _ZCACHE_CAPTURE_PREFIX=${_ZCACHE_CAPTURE_PREFIX:-"--zcache-"} - _ZCACHE_BUNDLE_SOURCE=(); _ZCACHE_CAPTURE_BUNDLE=() - - # Cache auto config files to check for changes (.zshrc, .antigenrc etc) - -antigen-set-default ANTIGEN_AUTO_CONFIG true - - # Default cache path. - -antigen-set-default ANTIGEN_CACHE $ADOTDIR/init.zsh - -antigen-set-default ANTIGEN_RSRC $ADOTDIR/.resources - if [[ $ANTIGEN_CACHE == false ]]; then - return 1 - fi - - return 0 -} - --antigen-cache-execute () { - # Main function. Deferred antigen-apply. - antigen-apply-cached () { - # TRACE "APPLYING CACHE" EXT - # Auto determine check_files - # There always should be 5 steps from original source as the correct way is to use - # `antigen` wrapper not `antigen-apply` directly and it's called by an extension. - LOG "TRACE: ${funcfiletrace}" - if [[ $ANTIGEN_AUTO_CONFIG == true && $#ANTIGEN_CHECK_FILES -eq 0 ]]; then - ANTIGEN_CHECK_FILES+=(~/.zshrc) - if [[ $#funcfiletrace -ge 6 ]]; then - ANTIGEN_CHECK_FILES+=("${${funcfiletrace[6]%:*}##* }") - fi - fi - - # Generate and compile cache - -antigen-cache-generate - [[ -f "$ANTIGEN_CACHE" ]] && source "$ANTIGEN_CACHE"; - - # Commented out in order to have a working `cache-gen` command - #unset _ZCACHE_BUNDLE_SOURCE - unset _ZCACHE_CAPTURE_BUNDLE _ZCACHE_CAPTURE_FUNCTIONS - - # Release all hooked functions - antigen-remove-hook -antigen-load-env-cached - antigen-remove-hook -antigen-load-source-cached - antigen-remove-hook antigen-bundle-cached - } - - antigen-add-hook antigen-apply antigen-apply-cached post once - - # Defer antigen-bundle. - antigen-bundle-cached () { - _ZCACHE_CAPTURE_BUNDLE+=("${(j: :)${@}}") - } - antigen-add-hook antigen-bundle antigen-bundle-cached pre - - # Defer loading. - -antigen-load-env-cached () { - local bundle - typeset -A bundle; bundle=($@) - local location=${bundle[dir]}/${bundle[loc]} - - # Load to path if there is no sourceable - if [[ ${bundle[loc]} == "/" ]]; then - _ZCACHE_BUNDLE_SOURCE+=("${location}") - return - fi - - _ZCACHE_BUNDLE_SOURCE+=("${location}") - } - antigen-add-hook -antigen-load-env -antigen-load-env-cached replace - - # Defer sourcing. - -antigen-load-source-cached () { - _ZCACHE_BUNDLE_SOURCE+=($@) - } - antigen-add-hook -antigen-load-source -antigen-load-source-cached replace - - return 0 -} - -# Generate static-cache file at $ANTIGEN_CACHE using currently loaded -# bundles from $_ANTIGEN_BUNDLE_RECORD -# -# Usage -# antigen-cache-gen -# -# Returns -# Nothing -antigen-cache-gen () { - -antigen-cache-generate -} -#compdef _antigen -# Setup antigen's autocompletion -_antigen () { - local -a _1st_arguments - _1st_arguments=( - 'apply:Load all bundle completions' - 'bundle:Install and load the given plugin' - 'bundles:Bulk define bundles' - 'cleanup:Clean up the clones of repos which are not used by any bundles currently loaded' - 'cache-gen:Generate cache' - 'init:Load Antigen configuration from file' - 'list:List out the currently loaded bundles' - 'purge:Remove a cloned bundle from filesystem' - 'reset:Clears cache' - 'restore:Restore the bundles state as specified in the snapshot' - 'revert:Revert the state of all bundles to how they were before the last antigen update' - 'selfupdate:Update antigen itself' - 'snapshot:Create a snapshot of all the active clones' - 'theme:Switch the prompt theme' - 'update:Update all bundles' - 'use:Load any (supported) zsh pre-packaged framework' - ); - - _1st_arguments+=( - 'help:Show this message' - 'version:Display Antigen version' - ) - - __bundle() { - _arguments \ - '--loc[Path to the location ]' \ - '--url[Path to the repository ]' \ - '--branch[Git branch name]' \ - '--no-local-clone[Do not create a clone]' - } - __list() { - _arguments \ - '--simple[Show only bundle name]' \ - '--short[Show only bundle name and branch]' \ - '--long[Show bundle records]' - } - - - __cleanup() { - _arguments \ - '--force[Do not ask for confirmation]' - } - - _arguments '*:: :->command' - - if (( CURRENT == 1 )); then - _describe -t commands "antigen command" _1st_arguments - return - fi - - local -a _command_args - case "$words[1]" in - bundle) - __bundle - ;; - use) - compadd "$@" "oh-my-zsh" "prezto" - ;; - cleanup) - __cleanup - ;; - (update|purge) - compadd $(type -f \-antigen-get-bundles &> /dev/null || antigen &> /dev/null; -antigen-get-bundles --simple 2> /dev/null) - ;; - theme) - compadd $(type -f \-antigen-get-themes &> /dev/null || antigen &> /dev/null; -antigen-get-themes 2> /dev/null) - ;; - list) - __list - ;; - esac -} -zmodload zsh/datetime -ANTIGEN_DEBUG_LOG=${ANTIGEN_DEBUG_LOG:-${ADOTDIR:-$HOME/.antigen}/debug.log} -LOG () { - local PREFIX="[LOG][${EPOCHREALTIME}]" - echo "${PREFIX} ${funcfiletrace[1]}\n${PREFIX} $@" >> $ANTIGEN_DEBUG_LOG -} - -ERR () { - local PREFIX="[ERR][${EPOCHREALTIME}]" - echo "${PREFIX} ${funcfiletrace[1]}\n${PREFIX} $@" >> $ANTIGEN_DEBUG_LOG -} - -WARN () { - local PREFIX="[WRN][${EPOCHREALTIME}]" - echo "${PREFIX} ${funcfiletrace[1]}\n${PREFIX} $@" >> $ANTIGEN_DEBUG_LOG -} - -TRACE () { - local PREFIX="[TRA][${EPOCHREALTIME}]" - echo "${PREFIX} ${funcfiletrace[1]}\n${PREFIX} $@\n${PREFIX} ${(j:\n:)funcstack}" >> $ANTIGEN_DEBUG_LOG -} --antigen-env-setup diff --git a/zsh/p10k.zsh b/zsh/p10k.zsh deleted file mode 100644 index 4dbdc31..0000000 --- a/zsh/p10k.zsh +++ /dev/null @@ -1,1584 +0,0 @@ -# Generated by Powerlevel10k configuration wizard on 2021-02-04 at 14:15 GMT. -# Based on romkatv/powerlevel10k/config/p10k-lean-8colors.zsh, checksum 27244. -# Wizard options: compatible, lean_8colors, unicode, 24h time, 2 lines, solid, -# left frame, white-ornaments, sparse, concise, transient_prompt, -# instant_prompt=verbose. -# Type `p10k configure` to generate another config. -# -# Config for Powerlevel10k with 8-color lean prompt style. Type `p10k configure` to generate -# your own config based on it. -# -# Tip: Looking for a nice color? Here's a one-liner to print colormap. -# -# for i in {0..255}; do print -Pn "%K{$i} %k%F{$i}${(l:3::0:)i}%f " ${${(M)$((i%6)):#3}:+$'\n'}; done - -# Temporarily change options. -'builtin' 'local' '-a' 'p10k_config_opts' -[[ ! -o 'aliases' ]] || p10k_config_opts+=('aliases') -[[ ! -o 'sh_glob' ]] || p10k_config_opts+=('sh_glob') -[[ ! -o 'no_brace_expand' ]] || p10k_config_opts+=('no_brace_expand') -'builtin' 'setopt' 'no_aliases' 'no_sh_glob' 'brace_expand' - -() { - emulate -L zsh -o extended_glob - - # Unset all configuration options. This allows you to apply configuration changes without - # restarting zsh. Edit ~/.p10k.zsh and type `source ~/.p10k.zsh`. - unset -m '(POWERLEVEL9K_*|DEFAULT_USER)~POWERLEVEL9K_GITSTATUS_DIR' - - # Zsh >= 5.1 is required. - autoload -Uz is-at-least && is-at-least 5.1 || return - - # The list of segments shown on the left. Fill it with the most important segments. - typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=( - # =========================[ Line #1 ]========================= - # os_icon # os identifier - dir # current directory - vcs # git status - # =========================[ Line #2 ]========================= - newline # \n - prompt_char # prompt symbol - ) - - # The list of segments shown on the right. Fill it with less important segments. - # Right prompt on the last prompt line (where you are typing your commands) gets - # automatically hidden when the input line reaches it. Right prompt above the - # last prompt line gets hidden if it would overlap with left prompt. - typeset -g POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=( - # =========================[ Line #1 ]========================= - status # exit code of the last command - command_execution_time # duration of the last command - background_jobs # presence of background jobs - direnv # direnv status (https://direnv.net/) - asdf # asdf version manager (https://github.com/asdf-vm/asdf) - virtualenv # python virtual environment (https://docs.python.org/3/library/venv.html) - anaconda # conda environment (https://conda.io/) - pyenv # python environment (https://github.com/pyenv/pyenv) - goenv # go environment (https://github.com/syndbg/goenv) - nodenv # node.js version from nodenv (https://github.com/nodenv/nodenv) - nvm # node.js version from nvm (https://github.com/nvm-sh/nvm) - nodeenv # node.js environment (https://github.com/ekalinin/nodeenv) - # node_version # node.js version - # go_version # go version (https://golang.org) - # rust_version # rustc version (https://www.rust-lang.org) - # dotnet_version # .NET version (https://dotnet.microsoft.com) - # php_version # php version (https://www.php.net/) - # laravel_version # laravel php framework version (https://laravel.com/) - # java_version # java version (https://www.java.com/) - # package # name@version from package.json (https://docs.npmjs.com/files/package.json) - rbenv # ruby version from rbenv (https://github.com/rbenv/rbenv) - rvm # ruby version from rvm (https://rvm.io) - fvm # flutter version management (https://github.com/leoafarias/fvm) - luaenv # lua version from luaenv (https://github.com/cehoffman/luaenv) - jenv # java version from jenv (https://github.com/jenv/jenv) - plenv # perl version from plenv (https://github.com/tokuhirom/plenv) - phpenv # php version from phpenv (https://github.com/phpenv/phpenv) - scalaenv # scala version from scalaenv (https://github.com/scalaenv/scalaenv) - haskell_stack # haskell version from stack (https://haskellstack.org/) - kubecontext # current kubernetes context (https://kubernetes.io/) - terraform # terraform workspace (https://www.terraform.io) - aws # aws profile (https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html) - aws_eb_env # aws elastic beanstalk environment (https://aws.amazon.com/elasticbeanstalk/) - azure # azure account name (https://docs.microsoft.com/en-us/cli/azure) - gcloud # google cloud cli account and project (https://cloud.google.com/) - google_app_cred # google application credentials (https://cloud.google.com/docs/authentication/production) - context # user@hostname - nordvpn # nordvpn connection status, linux only (https://nordvpn.com/) - ranger # ranger shell (https://github.com/ranger/ranger) - nnn # nnn shell (https://github.com/jarun/nnn) - vim_shell # vim shell indicator (:sh) - midnight_commander # midnight commander shell (https://midnight-commander.org/) - nix_shell # nix shell (https://nixos.org/nixos/nix-pills/developing-with-nix-shell.html) - # vpn_ip # virtual private network indicator - # load # CPU load - # disk_usage # disk usage - # ram # free RAM - # swap # used swap - todo # todo items (https://github.com/todotxt/todo.txt-cli) - timewarrior # timewarrior tracking status (https://timewarrior.net/) - taskwarrior # taskwarrior task count (https://taskwarrior.org/) - time # current time - # =========================[ Line #2 ]========================= - newline # \n - # ip # ip address and bandwidth usage for a specified network interface - # public_ip # public IP address - # proxy # system-wide http/https/ftp proxy - # battery # internal battery - # wifi # wifi speed - # example # example user-defined segment (see prompt_example function below) - ) - - # Defines character set used by powerlevel10k. It's best to let `p10k configure` set it for you. - typeset -g POWERLEVEL9K_MODE=compatible - # When set to `moderate`, some icons will have an extra space after them. This is meant to avoid - # icon overlap when using non-monospace fonts. When set to `none`, spaces are not added. - typeset -g POWERLEVEL9K_ICON_PADDING=none - - # Basic style options that define the overall look of your prompt. You probably don't want to - # change them. - typeset -g POWERLEVEL9K_BACKGROUND= # transparent background - typeset -g POWERLEVEL9K_{LEFT,RIGHT}_{LEFT,RIGHT}_WHITESPACE= # no surrounding whitespace - typeset -g POWERLEVEL9K_{LEFT,RIGHT}_SUBSEGMENT_SEPARATOR=' ' # separate segments with a space - typeset -g POWERLEVEL9K_{LEFT,RIGHT}_SEGMENT_SEPARATOR= # no end-of-line symbol - - # When set to true, icons appear before content on both sides of the prompt. When set - # to false, icons go after content. If empty or not set, icons go before content in the left - # prompt and after content in the right prompt. - # - # You can also override it for a specific segment: - # - # POWERLEVEL9K_STATUS_ICON_BEFORE_CONTENT=false - # - # Or for a specific segment in specific state: - # - # POWERLEVEL9K_DIR_NOT_WRITABLE_ICON_BEFORE_CONTENT=false - typeset -g POWERLEVEL9K_ICON_BEFORE_CONTENT=true - - # Add an empty line before each prompt. - typeset -g POWERLEVEL9K_PROMPT_ADD_NEWLINE=true - - # Connect left prompt lines with these symbols. - typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX='%7F╭─' - typeset -g POWERLEVEL9K_MULTILINE_NEWLINE_PROMPT_PREFIX='%7F├─' - typeset -g POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX='%7F╰─' - # Connect right prompt lines with these symbols. - typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_SUFFIX= - typeset -g POWERLEVEL9K_MULTILINE_NEWLINE_PROMPT_SUFFIX= - typeset -g POWERLEVEL9K_MULTILINE_LAST_PROMPT_SUFFIX= - - # The left end of left prompt. - typeset -g POWERLEVEL9K_LEFT_PROMPT_FIRST_SEGMENT_START_SYMBOL=' ' - # The right end of right prompt. - typeset -g POWERLEVEL9K_RIGHT_PROMPT_LAST_SEGMENT_END_SYMBOL= - - # Ruler, a.k.a. the horizontal line before each prompt. If you set it to true, you'll - # probably want to set POWERLEVEL9K_PROMPT_ADD_NEWLINE=false above and - # POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_CHAR=' ' below. - typeset -g POWERLEVEL9K_SHOW_RULER=false - typeset -g POWERLEVEL9K_RULER_CHAR='─' # reasonable alternative: '·' - typeset -g POWERLEVEL9K_RULER_FOREGROUND=7 - - # Filler between left and right prompt on the first prompt line. You can set it to '·' or '─' - # to make it easier to see the alignment between left and right prompt and to separate prompt - # from command output. It serves the same purpose as ruler (see above) without increasing - # the number of prompt lines. You'll probably want to set POWERLEVEL9K_SHOW_RULER=false - # if using this. You might also like POWERLEVEL9K_PROMPT_ADD_NEWLINE=false for more compact - # prompt. - typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_CHAR='─' - if [[ $POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_CHAR != ' ' ]]; then - # The color of the filler. - typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_FOREGROUND=7 - # Add a space between the end of left prompt and the filler. - typeset -g POWERLEVEL9K_LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL=' ' - # Add a space between the filler and the start of right prompt. - typeset -g POWERLEVEL9K_RIGHT_PROMPT_FIRST_SEGMENT_START_SYMBOL=' ' - # Start filler from the edge of the screen if there are no left segments on the first line. - typeset -g POWERLEVEL9K_EMPTY_LINE_LEFT_PROMPT_FIRST_SEGMENT_END_SYMBOL='%{%}' - # End filler on the edge of the screen if there are no right segments on the first line. - typeset -g POWERLEVEL9K_EMPTY_LINE_RIGHT_PROMPT_FIRST_SEGMENT_START_SYMBOL='%{%}' - fi - - #################################[ os_icon: os identifier ]################################## - # OS identifier color. - typeset -g POWERLEVEL9K_OS_ICON_FOREGROUND= - # Custom icon. - # typeset -g POWERLEVEL9K_OS_ICON_CONTENT_EXPANSION='⭐' - - ################################[ prompt_char: prompt symbol ]################################ - # Green prompt symbol if the last command succeeded. - typeset -g POWERLEVEL9K_PROMPT_CHAR_OK_{VIINS,VICMD,VIVIS,VIOWR}_FOREGROUND=2 - # Red prompt symbol if the last command failed. - typeset -g POWERLEVEL9K_PROMPT_CHAR_ERROR_{VIINS,VICMD,VIVIS,VIOWR}_FOREGROUND=1 - # Default prompt symbol. - typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIINS_CONTENT_EXPANSION='❯' - # Prompt symbol in command vi mode. - typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VICMD_CONTENT_EXPANSION='❮' - # Prompt symbol in visual vi mode. - typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIVIS_CONTENT_EXPANSION='V' - # Prompt symbol in overwrite vi mode. - typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIOWR_CONTENT_EXPANSION='▶' - typeset -g POWERLEVEL9K_PROMPT_CHAR_OVERWRITE_STATE=true - # No line terminator if prompt_char is the last segment. - typeset -g POWERLEVEL9K_PROMPT_CHAR_LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL='' - # No line introducer if prompt_char is the first segment. - typeset -g POWERLEVEL9K_PROMPT_CHAR_LEFT_PROMPT_FIRST_SEGMENT_START_SYMBOL= - - ##################################[ dir: current directory ]################################## - # Default current directory color. - typeset -g POWERLEVEL9K_DIR_FOREGROUND=4 - # If directory is too long, shorten some of its segments to the shortest possible unique - # prefix. The shortened directory can be tab-completed to the original. - typeset -g POWERLEVEL9K_SHORTEN_STRATEGY=truncate_to_unique - # Replace removed segment suffixes with this symbol. - typeset -g POWERLEVEL9K_SHORTEN_DELIMITER= - # Color of the shortened directory segments. - typeset -g POWERLEVEL9K_DIR_SHORTENED_FOREGROUND=4 - # Color of the anchor directory segments. Anchor segments are never shortened. The first - # segment is always an anchor. - typeset -g POWERLEVEL9K_DIR_ANCHOR_FOREGROUND=4 - # Set to true to display anchor directory segments in bold. - typeset -g POWERLEVEL9K_DIR_ANCHOR_BOLD=false - # Don't shorten directories that contain any of these files. They are anchors. - local anchor_files=( - .bzr - .citc - .git - .hg - .node-version - .python-version - .go-version - .ruby-version - .lua-version - .java-version - .perl-version - .php-version - .tool-version - .shorten_folder_marker - .svn - .terraform - CVS - Cargo.toml - composer.json - go.mod - package.json - stack.yaml - ) - typeset -g POWERLEVEL9K_SHORTEN_FOLDER_MARKER="(${(j:|:)anchor_files})" - # If set to "first" ("last"), remove everything before the first (last) subdirectory that contains - # files matching $POWERLEVEL9K_SHORTEN_FOLDER_MARKER. For example, when the current directory is - # /foo/bar/git_repo/nested_git_repo/baz, prompt will display git_repo/nested_git_repo/baz (first) - # or nested_git_repo/baz (last). This assumes that git_repo and nested_git_repo contain markers - # and other directories don't. - # - # Optionally, "first" and "last" can be followed by ":" where is an integer. - # This moves the truncation point to the right (positive offset) or to the left (negative offset) - # relative to the marker. Plain "first" and "last" are equivalent to "first:0" and "last:0" - # respectively. - typeset -g POWERLEVEL9K_DIR_TRUNCATE_BEFORE_MARKER=false - # Don't shorten this many last directory segments. They are anchors. - typeset -g POWERLEVEL9K_SHORTEN_DIR_LENGTH=1 - # Shorten directory if it's longer than this even if there is space for it. The value can - # be either absolute (e.g., '80') or a percentage of terminal width (e.g, '50%'). If empty, - # directory will be shortened only when prompt doesn't fit or when other parameters demand it - # (see POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS and POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS_PCT below). - # If set to `0`, directory will always be shortened to its minimum length. - typeset -g POWERLEVEL9K_DIR_MAX_LENGTH=80 - # When `dir` segment is on the last prompt line, try to shorten it enough to leave at least this - # many columns for typing commands. - typeset -g POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS=40 - # When `dir` segment is on the last prompt line, try to shorten it enough to leave at least - # COLUMNS * POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS_PCT * 0.01 columns for typing commands. - typeset -g POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS_PCT=50 - # If set to true, embed a hyperlink into the directory. Useful for quickly - # opening a directory in the file manager simply by clicking the link. - # Can also be handy when the directory is shortened, as it allows you to see - # the full directory that was used in previous commands. - typeset -g POWERLEVEL9K_DIR_HYPERLINK=false - - # Enable special styling for non-writable directories. See POWERLEVEL9K_LOCK_ICON and - # POWERLEVEL9K_DIR_CLASSES below. - typeset -g POWERLEVEL9K_DIR_SHOW_WRITABLE=v2 - - # Enable special styling for non-writable and non-existent directories. See POWERLEVEL9K_LOCK_ICON - # and POWERLEVEL9K_DIR_CLASSES below. - typeset -g POWERLEVEL9K_DIR_SHOW_WRITABLE=v3 - - # The default icon shown next to non-writable and non-existent directories when - # POWERLEVEL9K_DIR_SHOW_WRITABLE is set to v3. - typeset -g POWERLEVEL9K_LOCK_ICON='∅' - - # POWERLEVEL9K_DIR_CLASSES allows you to specify custom icons and colors for different - # directories. It must be an array with 3 * N elements. Each triplet consists of: - # - # 1. A pattern against which the current directory ($PWD) is matched. Matching is done with - # extended_glob option enabled. - # 2. Directory class for the purpose of styling. - # 3. An empty string. - # - # Triplets are tried in order. The first triplet whose pattern matches $PWD wins. - # - # If POWERLEVEL9K_DIR_SHOW_WRITABLE is set to v3, non-writable and non-existent directories - # acquire class suffix _NOT_WRITABLE and NON_EXISTENT respectively. - # - # For example, given these settings: - # - # typeset -g POWERLEVEL9K_DIR_CLASSES=( - # '~/work(|/*)' WORK '' - # '~(|/*)' HOME '' - # '*' DEFAULT '') - # - # Whenever the current directory is ~/work or a subdirectory of ~/work, it gets styled with one - # of the following classes depending on its writability and existence: WORK, WORK_NOT_WRITABLE or - # WORK_NON_EXISTENT. - # - # Simply assigning classes to directories doesn't have any visible effects. It merely gives you an - # option to define custom colors and icons for different directory classes. - # - # # Styling for WORK. - # typeset -g POWERLEVEL9K_DIR_WORK_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_DIR_WORK_FOREGROUND=4 - # typeset -g POWERLEVEL9K_DIR_WORK_SHORTENED_FOREGROUND=4 - # typeset -g POWERLEVEL9K_DIR_WORK_ANCHOR_FOREGROUND=4 - # - # # Styling for WORK_NOT_WRITABLE. - # typeset -g POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_FOREGROUND=4 - # typeset -g POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_SHORTENED_FOREGROUND=4 - # typeset -g POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_ANCHOR_FOREGROUND=4# - # - # Styling for WORK_NON_EXISTENT. - # typeset -g POWERLEVEL9K_DIR_WORK_NON_EXISTENT_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_DIR_WORK_NON_EXISTENT_FOREGROUND=4 - # typeset -g POWERLEVEL9K_DIR_WORK_NON_EXISTENT_SHORTENED_FOREGROUND=4 - # typeset -g POWERLEVEL9K_DIR_WORK_NON_EXISTENT_ANCHOR_FOREGROUND=4 - # - # If a styling parameter isn't explicitly defined for some class, it falls back to the classless - # parameter. For example, if POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_FOREGROUND is not set, it falls - # back to POWERLEVEL9K_DIR_FOREGROUND. - # - typeset -g POWERLEVEL9K_DIR_CLASSES=() - - # Custom prefix. - # typeset -g POWERLEVEL9K_DIR_PREFIX='%fin ' - - #####################################[ vcs: git status ]###################################### - # Branch icon. Set this parameter to '\uF126 ' for the popular Powerline branch icon. - typeset -g POWERLEVEL9K_VCS_BRANCH_ICON= - - # Untracked files icon. It's really a question mark, your font isn't broken. - # Change the value of this parameter to show a different icon. - typeset -g POWERLEVEL9K_VCS_UNTRACKED_ICON='?' - - # Formatter for Git status. - # - # Example output: master ⇣42⇡42 *42 merge ~42 +42 !42 ?42. - # - # You can edit the function to customize how Git status looks. - # - # VCS_STATUS_* parameters are set by gitstatus plugin. See reference: - # https://github.com/romkatv/gitstatus/blob/master/gitstatus.plugin.zsh. - function my_git_formatter() { - emulate -L zsh - - if [[ -n $P9K_CONTENT ]]; then - # If P9K_CONTENT is not empty, use it. It's either "loading" or from vcs_info (not from - # gitstatus plugin). VCS_STATUS_* parameters are not available in this case. - typeset -g my_git_format=$P9K_CONTENT - return - fi - - if (( $1 )); then - # Styling for up-to-date Git status. - local meta='%f' # default foreground - local clean='%2F' # green foreground - local modified='%3F' # yellow foreground - local untracked='%4F' # blue foreground - local conflicted='%1F' # red foreground - else - # Styling for incomplete and stale Git status. - local meta='%f' # default foreground - local clean='%f' # default foreground - local modified='%f' # default foreground - local untracked='%f' # default foreground - local conflicted='%f' # default foreground - fi - - local res - - if [[ -n $VCS_STATUS_LOCAL_BRANCH ]]; then - local branch=${(V)VCS_STATUS_LOCAL_BRANCH} - # If local branch name is at most 32 characters long, show it in full. - # Otherwise show the first 12 … the last 12. - # Tip: To always show local branch name in full without truncation, delete the next line. - (( $#branch > 32 )) && branch[13,-13]="…" # <-- this line - res+="${clean}${(g::)POWERLEVEL9K_VCS_BRANCH_ICON}${branch//\%/%%}" - fi - - if [[ -n $VCS_STATUS_TAG - # Show tag only if not on a branch. - # Tip: To always show tag, delete the next line. - && -z $VCS_STATUS_LOCAL_BRANCH # <-- this line - ]]; then - local tag=${(V)VCS_STATUS_TAG} - # If tag name is at most 32 characters long, show it in full. - # Otherwise show the first 12 … the last 12. - # Tip: To always show tag name in full without truncation, delete the next line. - (( $#tag > 32 )) && tag[13,-13]="…" # <-- this line - res+="${meta}#${clean}${tag//\%/%%}" - fi - - # Display the current Git commit if there is no branch and no tag. - # Tip: To always display the current Git commit, delete the next line. - [[ -z $VCS_STATUS_LOCAL_BRANCH && -z $VCS_STATUS_LOCAL_BRANCH ]] && # <-- this line - res+="${meta}@${clean}${VCS_STATUS_COMMIT[1,8]}" - - # Show tracking branch name if it differs from local branch. - if [[ -n ${VCS_STATUS_REMOTE_BRANCH:#$VCS_STATUS_LOCAL_BRANCH} ]]; then - res+="${meta}:${clean}${(V)VCS_STATUS_REMOTE_BRANCH//\%/%%}" - fi - - # ⇣42 if behind the remote. - (( VCS_STATUS_COMMITS_BEHIND )) && res+=" ${clean}⇣${VCS_STATUS_COMMITS_BEHIND}" - # ⇡42 if ahead of the remote; no leading space if also behind the remote: ⇣42⇡42. - (( VCS_STATUS_COMMITS_AHEAD && !VCS_STATUS_COMMITS_BEHIND )) && res+=" " - (( VCS_STATUS_COMMITS_AHEAD )) && res+="${clean}⇡${VCS_STATUS_COMMITS_AHEAD}" - # ⇠42 if behind the push remote. - (( VCS_STATUS_PUSH_COMMITS_BEHIND )) && res+=" ${clean}⇠${VCS_STATUS_PUSH_COMMITS_BEHIND}" - (( VCS_STATUS_PUSH_COMMITS_AHEAD && !VCS_STATUS_PUSH_COMMITS_BEHIND )) && res+=" " - # ⇢42 if ahead of the push remote; no leading space if also behind: ⇠42⇢42. - (( VCS_STATUS_PUSH_COMMITS_AHEAD )) && res+="${clean}⇢${VCS_STATUS_PUSH_COMMITS_AHEAD}" - # *42 if have stashes. - (( VCS_STATUS_STASHES )) && res+=" ${clean}*${VCS_STATUS_STASHES}" - # 'merge' if the repo is in an unusual state. - [[ -n $VCS_STATUS_ACTION ]] && res+=" ${conflicted}${VCS_STATUS_ACTION}" - # ~42 if have merge conflicts. - (( VCS_STATUS_NUM_CONFLICTED )) && res+=" ${conflicted}~${VCS_STATUS_NUM_CONFLICTED}" - # +42 if have staged changes. - (( VCS_STATUS_NUM_STAGED )) && res+=" ${modified}+${VCS_STATUS_NUM_STAGED}" - # !42 if have unstaged changes. - (( VCS_STATUS_NUM_UNSTAGED )) && res+=" ${modified}!${VCS_STATUS_NUM_UNSTAGED}" - # ?42 if have untracked files. It's really a question mark, your font isn't broken. - # See POWERLEVEL9K_VCS_UNTRACKED_ICON above if you want to use a different icon. - # Remove the next line if you don't want to see untracked files at all. - (( VCS_STATUS_NUM_UNTRACKED )) && res+=" ${untracked}${(g::)POWERLEVEL9K_VCS_UNTRACKED_ICON}${VCS_STATUS_NUM_UNTRACKED}" - # "─" if the number of unstaged files is unknown. This can happen due to - # POWERLEVEL9K_VCS_MAX_INDEX_SIZE_DIRTY (see below) being set to a non-negative number lower - # than the number of files in the Git index, or due to bash.showDirtyState being set to false - # in the repository config. The number of staged and untracked files may also be unknown - # in this case. - (( VCS_STATUS_HAS_UNSTAGED == -1 )) && res+=" ${modified}─" - - typeset -g my_git_format=$res - } - functions -M my_git_formatter 2>/dev/null - - # Don't count the number of unstaged, untracked and conflicted files in Git repositories with - # more than this many files in the index. Negative value means infinity. - # - # If you are working in Git repositories with tens of millions of files and seeing performance - # sagging, try setting POWERLEVEL9K_VCS_MAX_INDEX_SIZE_DIRTY to a number lower than the output - # of `git ls-files | wc -l`. Alternatively, add `bash.showDirtyState = false` to the repository's - # config: `git config bash.showDirtyState false`. - typeset -g POWERLEVEL9K_VCS_MAX_INDEX_SIZE_DIRTY=-1 - - # Don't show Git status in prompt for repositories whose workdir matches this pattern. - # For example, if set to '~', the Git repository at $HOME/.git will be ignored. - # Multiple patterns can be combined with '|': '~(|/foo)|/bar/baz/*'. - typeset -g POWERLEVEL9K_VCS_DISABLED_WORKDIR_PATTERN='~' - - # Disable the default Git status formatting. - typeset -g POWERLEVEL9K_VCS_DISABLE_GITSTATUS_FORMATTING=true - # Install our own Git status formatter. - typeset -g POWERLEVEL9K_VCS_CONTENT_EXPANSION='${$((my_git_formatter(1)))+${my_git_format}}' - typeset -g POWERLEVEL9K_VCS_LOADING_CONTENT_EXPANSION='${$((my_git_formatter(0)))+${my_git_format}}' - # Enable counters for staged, unstaged, etc. - typeset -g POWERLEVEL9K_VCS_{STAGED,UNSTAGED,UNTRACKED,CONFLICTED,COMMITS_AHEAD,COMMITS_BEHIND}_MAX_NUM=-1 - - # Icon color. - typeset -g POWERLEVEL9K_VCS_VISUAL_IDENTIFIER_COLOR=2 - typeset -g POWERLEVEL9K_VCS_LOADING_VISUAL_IDENTIFIER_COLOR= - # Custom icon. - typeset -g POWERLEVEL9K_VCS_VISUAL_IDENTIFIER_EXPANSION= - # Custom prefix. - # typeset -g POWERLEVEL9K_VCS_PREFIX='%fon ' - - # Show status of repositories of these types. You can add svn and/or hg if you are - # using them. If you do, your prompt may become slow even when your current directory - # isn't in an svn or hg reposotiry. - typeset -g POWERLEVEL9K_VCS_BACKENDS=(git) - - # These settings are used for repositories other than Git or when gitstatusd fails and - # Powerlevel10k has to fall back to using vcs_info. - typeset -g POWERLEVEL9K_VCS_CLEAN_FOREGROUND=2 - typeset -g POWERLEVEL9K_VCS_UNTRACKED_FOREGROUND=2 - typeset -g POWERLEVEL9K_VCS_MODIFIED_FOREGROUND=3 - - ##########################[ status: exit code of the last command ]########################### - # Enable OK_PIPE, ERROR_PIPE and ERROR_SIGNAL status states to allow us to enable, disable and - # style them independently from the regular OK and ERROR state. - typeset -g POWERLEVEL9K_STATUS_EXTENDED_STATES=true - - # Status on success. No content, just an icon. No need to show it if prompt_char is enabled as - # it will signify success by turning green. - typeset -g POWERLEVEL9K_STATUS_OK=false - typeset -g POWERLEVEL9K_STATUS_OK_FOREGROUND=2 - typeset -g POWERLEVEL9K_STATUS_OK_VISUAL_IDENTIFIER_EXPANSION='✔' - - # Status when some part of a pipe command fails but the overall exit status is zero. It may look - # like this: 1|0. - typeset -g POWERLEVEL9K_STATUS_OK_PIPE=true - typeset -g POWERLEVEL9K_STATUS_OK_PIPE_FOREGROUND=2 - typeset -g POWERLEVEL9K_STATUS_OK_PIPE_VISUAL_IDENTIFIER_EXPANSION='✔' - - # Status when it's just an error code (e.g., '1'). No need to show it if prompt_char is enabled as - # it will signify error by turning red. - typeset -g POWERLEVEL9K_STATUS_ERROR=false - typeset -g POWERLEVEL9K_STATUS_ERROR_FOREGROUND=1 - typeset -g POWERLEVEL9K_STATUS_ERROR_VISUAL_IDENTIFIER_EXPANSION='х' - - # Status when the last command was terminated by a signal. - typeset -g POWERLEVEL9K_STATUS_ERROR_SIGNAL=true - typeset -g POWERLEVEL9K_STATUS_ERROR_SIGNAL_FOREGROUND=1 - # Use terse signal names: "INT" instead of "SIGINT(2)". - typeset -g POWERLEVEL9K_STATUS_VERBOSE_SIGNAME=false - typeset -g POWERLEVEL9K_STATUS_ERROR_SIGNAL_VISUAL_IDENTIFIER_EXPANSION='х' - - # Status when some part of a pipe command fails and the overall exit status is also non-zero. - # It may look like this: 1|0. - typeset -g POWERLEVEL9K_STATUS_ERROR_PIPE=true - typeset -g POWERLEVEL9K_STATUS_ERROR_PIPE_FOREGROUND=1 - typeset -g POWERLEVEL9K_STATUS_ERROR_PIPE_VISUAL_IDENTIFIER_EXPANSION='х' - - ###################[ command_execution_time: duration of the last command ]################### - # Show duration of the last command if takes at least this many seconds. - typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=3 - # Show this many fractional digits. Zero means round to seconds. - typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION=0 - # Execution time color. - typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FOREGROUND=3 - # Duration format: 1d 2h 3m 4s. - typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FORMAT='d h m s' - # Custom icon. - typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_VISUAL_IDENTIFIER_EXPANSION= - # Custom prefix. - # typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_PREFIX='%ftook ' - - #######################[ background_jobs: presence of background jobs ]####################### - # Don't show the number of background jobs. - typeset -g POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE=false - # Background jobs color. - typeset -g POWERLEVEL9K_BACKGROUND_JOBS_FOREGROUND=1 - # Custom icon. - typeset -g POWERLEVEL9K_BACKGROUND_JOBS_VISUAL_IDENTIFIER_EXPANSION='≡' - - #######################[ direnv: direnv status (https://direnv.net/) ]######################## - # Direnv color. - typeset -g POWERLEVEL9K_DIRENV_FOREGROUND=3 - # Custom icon. - # typeset -g POWERLEVEL9K_DIRENV_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ###############[ asdf: asdf version manager (https://github.com/asdf-vm/asdf) ]############### - # Default asdf color. Only used to display tools for which there is no color override (see below). - # Tip: Override this parameter for ${TOOL} with POWERLEVEL9K_ASDF_${TOOL}_FOREGROUND. - typeset -g POWERLEVEL9K_ASDF_FOREGROUND=6 - - # There are four parameters that can be used to hide asdf tools. Each parameter describes - # conditions under which a tool gets hidden. Parameters can hide tools but not unhide them. If at - # least one parameter decides to hide a tool, that tool gets hidden. If no parameter decides to - # hide a tool, it gets shown. - # - # Special note on the difference between POWERLEVEL9K_ASDF_SOURCES and - # POWERLEVEL9K_ASDF_PROMPT_ALWAYS_SHOW. Consider the effect of the following commands: - # - # asdf local python 3.8.1 - # asdf global python 3.8.1 - # - # After running both commands the current python version is 3.8.1 and its source is "local" as - # it takes precedence over "global". If POWERLEVEL9K_ASDF_PROMPT_ALWAYS_SHOW is set to false, - # it'll hide python version in this case because 3.8.1 is the same as the global version. - # POWERLEVEL9K_ASDF_SOURCES will hide python version only if the value of this parameter doesn't - # contain "local". - - # Hide tool versions that don't come from one of these sources. - # - # Available sources: - # - # - shell `asdf current` says "set by ASDF_${TOOL}_VERSION environment variable" - # - local `asdf current` says "set by /some/not/home/directory/file" - # - global `asdf current` says "set by /home/username/file" - # - # Note: If this parameter is set to (shell local global), it won't hide tools. - # Tip: Override this parameter for ${TOOL} with POWERLEVEL9K_ASDF_${TOOL}_SOURCES. - typeset -g POWERLEVEL9K_ASDF_SOURCES=(shell local global) - - # If set to false, hide tool versions that are the same as global. - # - # Note: The name of this parameter doesn't reflect its meaning at all. - # Note: If this parameter is set to true, it won't hide tools. - # Tip: Override this parameter for ${TOOL} with POWERLEVEL9K_ASDF_${TOOL}_PROMPT_ALWAYS_SHOW. - typeset -g POWERLEVEL9K_ASDF_PROMPT_ALWAYS_SHOW=false - - # If set to false, hide tool versions that are equal to "system". - # - # Note: If this parameter is set to true, it won't hide tools. - # Tip: Override this parameter for ${TOOL} with POWERLEVEL9K_ASDF_${TOOL}_SHOW_SYSTEM. - typeset -g POWERLEVEL9K_ASDF_SHOW_SYSTEM=true - - # If set to non-empty value, hide tools unless there is a file matching the specified file pattern - # in the current directory, or its parent directory, or its grandparent directory, and so on. - # - # Note: If this parameter is set to empty value, it won't hide tools. - # Note: SHOW_ON_UPGLOB isn't specific to asdf. It works with all prompt segments. - # Tip: Override this parameter for ${TOOL} with POWERLEVEL9K_ASDF_${TOOL}_SHOW_ON_UPGLOB. - # - # Example: Hide nodejs version when there is no package.json and no *.js files in the current - # directory, in `..`, in `../..` and so on. - # - # typeset -g POWERLEVEL9K_ASDF_NODEJS_SHOW_ON_UPGLOB='*.js|package.json' - typeset -g POWERLEVEL9K_ASDF_SHOW_ON_UPGLOB= - - # Ruby version from asdf. - typeset -g POWERLEVEL9K_ASDF_RUBY_FOREGROUND=1 - # typeset -g POWERLEVEL9K_ASDF_RUBY_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_RUBY_SHOW_ON_UPGLOB='*.foo|*.bar' - - # Python version from asdf. - typeset -g POWERLEVEL9K_ASDF_PYTHON_FOREGROUND=6 - # typeset -g POWERLEVEL9K_ASDF_PYTHON_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_PYTHON_SHOW_ON_UPGLOB='*.foo|*.bar' - - # Go version from asdf. - typeset -g POWERLEVEL9K_ASDF_GOLANG_FOREGROUND=6 - # typeset -g POWERLEVEL9K_ASDF_GOLANG_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_GOLANG_SHOW_ON_UPGLOB='*.foo|*.bar' - - # Node.js version from asdf. - typeset -g POWERLEVEL9K_ASDF_NODEJS_FOREGROUND=2 - # typeset -g POWERLEVEL9K_ASDF_NODEJS_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_NODEJS_SHOW_ON_UPGLOB='*.foo|*.bar' - - # Rust version from asdf. - typeset -g POWERLEVEL9K_ASDF_RUST_FOREGROUND=4 - # typeset -g POWERLEVEL9K_ASDF_RUST_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_RUST_SHOW_ON_UPGLOB='*.foo|*.bar' - - # .NET Core version from asdf. - typeset -g POWERLEVEL9K_ASDF_DOTNET_CORE_FOREGROUND=5 - # typeset -g POWERLEVEL9K_ASDF_DOTNET_CORE_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_DOTNET_CORE_SHOW_ON_UPGLOB='*.foo|*.bar' - - # Flutter version from asdf. - typeset -g POWERLEVEL9K_ASDF_FLUTTER_FOREGROUND=4 - # typeset -g POWERLEVEL9K_ASDF_FLUTTER_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_FLUTTER_SHOW_ON_UPGLOB='*.foo|*.bar' - - # Lua version from asdf. - typeset -g POWERLEVEL9K_ASDF_LUA_FOREGROUND=4 - # typeset -g POWERLEVEL9K_ASDF_LUA_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_LUA_SHOW_ON_UPGLOB='*.foo|*.bar' - - # Java version from asdf. - typeset -g POWERLEVEL9K_ASDF_JAVA_FOREGROUND=4 - # typeset -g POWERLEVEL9K_ASDF_JAVA_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_JAVA_SHOW_ON_UPGLOB='*.foo|*.bar' - - # Perl version from asdf. - typeset -g POWERLEVEL9K_ASDF_PERL_FOREGROUND=6 - # typeset -g POWERLEVEL9K_ASDF_PERL_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_PERL_SHOW_ON_UPGLOB='*.foo|*.bar' - - # Erlang version from asdf. - typeset -g POWERLEVEL9K_ASDF_ERLANG_FOREGROUND=1 - # typeset -g POWERLEVEL9K_ASDF_ERLANG_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_ERLANG_SHOW_ON_UPGLOB='*.foo|*.bar' - - # Elixir version from asdf. - typeset -g POWERLEVEL9K_ASDF_ELIXIR_FOREGROUND=5 - # typeset -g POWERLEVEL9K_ASDF_ELIXIR_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_ELIXIR_SHOW_ON_UPGLOB='*.foo|*.bar' - - # Postgres version from asdf. - typeset -g POWERLEVEL9K_ASDF_POSTGRES_FOREGROUND=6 - # typeset -g POWERLEVEL9K_ASDF_POSTGRES_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_POSTGRES_SHOW_ON_UPGLOB='*.foo|*.bar' - - # PHP version from asdf. - typeset -g POWERLEVEL9K_ASDF_PHP_FOREGROUND=5 - # typeset -g POWERLEVEL9K_ASDF_PHP_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_PHP_SHOW_ON_UPGLOB='*.foo|*.bar' - - # Haskell version from asdf. - typeset -g POWERLEVEL9K_ASDF_HASKELL_FOREGROUND=3 - # typeset -g POWERLEVEL9K_ASDF_HASKELL_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_HASKELL_SHOW_ON_UPGLOB='*.foo|*.bar' - - # Julia version from asdf. - typeset -g POWERLEVEL9K_ASDF_JULIA_FOREGROUND=2 - # typeset -g POWERLEVEL9K_ASDF_JULIA_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_JULIA_SHOW_ON_UPGLOB='*.foo|*.bar' - - ##########[ nordvpn: nordvpn connection status, linux only (https://nordvpn.com/) ]########### - # NordVPN connection indicator color. - typeset -g POWERLEVEL9K_NORDVPN_FOREGROUND=6 - # Hide NordVPN connection indicator when not connected. - typeset -g POWERLEVEL9K_NORDVPN_{DISCONNECTED,CONNECTING,DISCONNECTING}_CONTENT_EXPANSION= - typeset -g POWERLEVEL9K_NORDVPN_{DISCONNECTED,CONNECTING,DISCONNECTING}_VISUAL_IDENTIFIER_EXPANSION= - # Custom icon. - typeset -g POWERLEVEL9K_NORDVPN_VISUAL_IDENTIFIER_EXPANSION='nord' - - #################[ ranger: ranger shell (https://github.com/ranger/ranger) ]################## - # Ranger shell color. - typeset -g POWERLEVEL9K_RANGER_FOREGROUND=3 - # Custom icon. - typeset -g POWERLEVEL9K_RANGER_VISUAL_IDENTIFIER_EXPANSION='▲' - - ######################[ nnn: nnn shell (https://github.com/jarun/nnn) ]####################### - # Nnn shell color. - typeset -g POWERLEVEL9K_NNN_FOREGROUND=3 - # Custom icon. - # typeset -g POWERLEVEL9K_NNN_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ###########################[ vim_shell: vim shell indicator (:sh) ]########################### - # Vim shell indicator color. - typeset -g POWERLEVEL9K_VIM_SHELL_FOREGROUND=3 - # Custom icon. - # typeset -g POWERLEVEL9K_VIM_SHELL_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ######[ midnight_commander: midnight commander shell (https://midnight-commander.org/) ]###### - # Midnight Commander shell color. - typeset -g POWERLEVEL9K_MIDNIGHT_COMMANDER_FOREGROUND=3 - # Custom icon. - # typeset -g POWERLEVEL9K_MIDNIGHT_COMMANDER_VISUAL_IDENTIFIER_EXPANSION='⭐' - - #[ nix_shell: nix shell (https://nixos.org/nixos/nix-pills/developing-with-nix-shell.html) ]## - # Nix shell color. - typeset -g POWERLEVEL9K_NIX_SHELL_FOREGROUND=4 - - # Tip: If you want to see just the icon without "pure" and "impure", uncomment the next line. - # typeset -g POWERLEVEL9K_NIX_SHELL_CONTENT_EXPANSION= - - # Custom icon. - # typeset -g POWERLEVEL9K_NIX_SHELL_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ##################################[ disk_usage: disk usage ]################################## - # Colors for different levels of disk usage. - typeset -g POWERLEVEL9K_DISK_USAGE_NORMAL_FOREGROUND=2 - typeset -g POWERLEVEL9K_DISK_USAGE_WARNING_FOREGROUND=3 - typeset -g POWERLEVEL9K_DISK_USAGE_CRITICAL_FOREGROUND=1 - # Thresholds for different levels of disk usage (percentage points). - typeset -g POWERLEVEL9K_DISK_USAGE_WARNING_LEVEL=90 - typeset -g POWERLEVEL9K_DISK_USAGE_CRITICAL_LEVEL=95 - # If set to true, hide disk usage when below $POWERLEVEL9K_DISK_USAGE_WARNING_LEVEL percent. - typeset -g POWERLEVEL9K_DISK_USAGE_ONLY_WARNING=false - # Custom icon. - # typeset -g POWERLEVEL9K_DISK_USAGE_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ######################################[ ram: free RAM ]####################################### - # RAM color. - typeset -g POWERLEVEL9K_RAM_FOREGROUND=2 - # Custom icon. - # typeset -g POWERLEVEL9K_RAM_VISUAL_IDENTIFIER_EXPANSION='⭐' - - #####################################[ swap: used swap ]###################################### - # Swap color. - typeset -g POWERLEVEL9K_SWAP_FOREGROUND=3 - # Custom icon. - # typeset -g POWERLEVEL9K_SWAP_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ######################################[ load: CPU load ]###################################### - # Show average CPU load over this many last minutes. Valid values are 1, 5 and 15. - typeset -g POWERLEVEL9K_LOAD_WHICH=5 - # Load color when load is under 50%. - typeset -g POWERLEVEL9K_LOAD_NORMAL_FOREGROUND=2 - # Load color when load is between 50% and 70%. - typeset -g POWERLEVEL9K_LOAD_WARNING_FOREGROUND=3 - # Load color when load is over 70%. - typeset -g POWERLEVEL9K_LOAD_CRITICAL_FOREGROUND=1 - # Custom icon. - # typeset -g POWERLEVEL9K_LOAD_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ################[ todo: todo items (https://github.com/todotxt/todo.txt-cli) ]################ - # Todo color. - typeset -g POWERLEVEL9K_TODO_FOREGROUND=4 - # Hide todo when the total number of tasks is zero. - typeset -g POWERLEVEL9K_TODO_HIDE_ZERO_TOTAL=true - # Hide todo when the number of tasks after filtering is zero. - typeset -g POWERLEVEL9K_TODO_HIDE_ZERO_FILTERED=false - - # Todo format. The following parameters are available within the expansion. - # - # - P9K_TODO_TOTAL_TASK_COUNT The total number of tasks. - # - P9K_TODO_FILTERED_TASK_COUNT The number of tasks after filtering. - # - # These variables correspond to the last line of the output of `todo.sh -p ls`: - # - # TODO: 24 of 42 tasks shown - # - # Here 24 is P9K_TODO_FILTERED_TASK_COUNT and 42 is P9K_TODO_TOTAL_TASK_COUNT. - # - # typeset -g POWERLEVEL9K_TODO_CONTENT_EXPANSION='$P9K_TODO_FILTERED_TASK_COUNT' - - # Custom icon. - # typeset -g POWERLEVEL9K_TODO_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ###########[ timewarrior: timewarrior tracking status (https://timewarrior.net/) ]############ - # Timewarrior color. - typeset -g POWERLEVEL9K_TIMEWARRIOR_FOREGROUND=4 - # If the tracked task is longer than 24 characters, truncate and append "…". - # Tip: To always display tasks without truncation, delete the following parameter. - # Tip: To hide task names and display just the icon when time tracking is enabled, set the - # value of the following parameter to "". - typeset -g POWERLEVEL9K_TIMEWARRIOR_CONTENT_EXPANSION='${P9K_CONTENT:0:24}${${P9K_CONTENT:24}:+…}' - - # Custom icon. - # typeset -g POWERLEVEL9K_TIMEWARRIOR_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ##############[ taskwarrior: taskwarrior task count (https://taskwarrior.org/) ]############## - # Taskwarrior color. - typeset -g POWERLEVEL9K_TASKWARRIOR_FOREGROUND=6 - - # Taskwarrior segment format. The following parameters are available within the expansion. - # - # - P9K_TASKWARRIOR_PENDING_COUNT The number of pending tasks: `task +PENDING count`. - # - P9K_TASKWARRIOR_OVERDUE_COUNT The number of overdue tasks: `task +OVERDUE count`. - # - # Zero values are represented as empty parameters. - # - # The default format: - # - # '${P9K_TASKWARRIOR_OVERDUE_COUNT:+"!$P9K_TASKWARRIOR_OVERDUE_COUNT/"}$P9K_TASKWARRIOR_PENDING_COUNT' - # - # typeset -g POWERLEVEL9K_TASKWARRIOR_CONTENT_EXPANSION='$P9K_TASKWARRIOR_PENDING_COUNT' - - # Custom icon. - # typeset -g POWERLEVEL9K_TASKWARRIOR_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ##################################[ context: user@hostname ]################################## - # Context color when running with privileges. - typeset -g POWERLEVEL9K_CONTEXT_ROOT_FOREGROUND=1 - # Context color in SSH without privileges. - typeset -g POWERLEVEL9K_CONTEXT_{REMOTE,REMOTE_SUDO}_FOREGROUND=7 - # Default context color (no privileges, no SSH). - typeset -g POWERLEVEL9K_CONTEXT_FOREGROUND=7 - - # Context format when running with privileges: bold user@hostname. - typeset -g POWERLEVEL9K_CONTEXT_ROOT_TEMPLATE='%B%n@%m' - # Context format when in SSH without privileges: user@hostname. - typeset -g POWERLEVEL9K_CONTEXT_{REMOTE,REMOTE_SUDO}_TEMPLATE='%n@%m' - # Default context format (no privileges, no SSH): user@hostname. - typeset -g POWERLEVEL9K_CONTEXT_TEMPLATE='%n@%m' - - # Don't show context unless running with privileges or in SSH. - # Tip: Remove the next line to always show context. - typeset -g POWERLEVEL9K_CONTEXT_{DEFAULT,SUDO}_{CONTENT,VISUAL_IDENTIFIER}_EXPANSION= - - # Custom icon. - # typeset -g POWERLEVEL9K_CONTEXT_VISUAL_IDENTIFIER_EXPANSION='⭐' - # Custom prefix. - # typeset -g POWERLEVEL9K_CONTEXT_PREFIX='%fwith ' - - ###[ virtualenv: python virtual environment (https://docs.python.org/3/library/venv.html) ]### - # Python virtual environment color. - typeset -g POWERLEVEL9K_VIRTUALENV_FOREGROUND=6 - # Don't show Python version next to the virtual environment name. - typeset -g POWERLEVEL9K_VIRTUALENV_SHOW_PYTHON_VERSION=false - # If set to "false", won't show virtualenv if pyenv is already shown. - # If set to "if-different", won't show virtualenv if it's the same as pyenv. - typeset -g POWERLEVEL9K_VIRTUALENV_SHOW_WITH_PYENV=false - # Separate environment name from Python version only with a space. - typeset -g POWERLEVEL9K_VIRTUALENV_{LEFT,RIGHT}_DELIMITER= - # Custom icon. - # typeset -g POWERLEVEL9K_VIRTUALENV_VISUAL_IDENTIFIER_EXPANSION='⭐' - - #####################[ anaconda: conda environment (https://conda.io/) ]###################### - # Anaconda environment color. - typeset -g POWERLEVEL9K_ANACONDA_FOREGROUND=6 - - # Anaconda segment format. The following parameters are available within the expansion. - # - # - CONDA_PREFIX Absolute path to the active Anaconda/Miniconda environment. - # - CONDA_DEFAULT_ENV Name of the active Anaconda/Miniconda environment. - # - CONDA_PROMPT_MODIFIER Configurable prompt modifier (see below). - # - P9K_ANACONDA_PYTHON_VERSION Current python version (python --version). - # - # CONDA_PROMPT_MODIFIER can be configured with the following command: - # - # conda config --set env_prompt '({default_env}) ' - # - # The last argument is a Python format string that can use the following variables: - # - # - prefix The same as CONDA_PREFIX. - # - default_env The same as CONDA_DEFAULT_ENV. - # - name The last segment of CONDA_PREFIX. - # - stacked_env Comma-separated list of names in the environment stack. The first element is - # always the same as default_env. - # - # Note: '({default_env}) ' is the default value of env_prompt. - # - # The default value of POWERLEVEL9K_ANACONDA_CONTENT_EXPANSION expands to $CONDA_PROMPT_MODIFIER - # without the surrounding parentheses, or to the last path component of CONDA_PREFIX if the former - # is empty. - typeset -g POWERLEVEL9K_ANACONDA_CONTENT_EXPANSION='${${${${CONDA_PROMPT_MODIFIER#\(}% }%\)}:-${CONDA_PREFIX:t}}' - - # Custom icon. - # typeset -g POWERLEVEL9K_ANACONDA_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ################[ pyenv: python environment (https://github.com/pyenv/pyenv) ]################ - # Pyenv color. - typeset -g POWERLEVEL9K_PYENV_FOREGROUND=6 - # Hide python version if it doesn't come from one of these sources. - typeset -g POWERLEVEL9K_PYENV_SOURCES=(shell local global) - # If set to false, hide python version if it's the same as global: - # $(pyenv version-name) == $(pyenv global). - typeset -g POWERLEVEL9K_PYENV_PROMPT_ALWAYS_SHOW=false - # If set to false, hide python version if it's equal to "system". - typeset -g POWERLEVEL9K_PYENV_SHOW_SYSTEM=true - - # Pyenv segment format. The following parameters are available within the expansion. - # - # - P9K_CONTENT Current pyenv environment (pyenv version-name). - # - P9K_PYENV_PYTHON_VERSION Current python version (python --version). - # - # The default format has the following logic: - # - # 1. Display "$P9K_CONTENT $P9K_PYENV_PYTHON_VERSION" if $P9K_PYENV_PYTHON_VERSION is not - # empty and unequal to $P9K_CONTENT. - # 2. Otherwise display just "$P9K_CONTENT". - typeset -g POWERLEVEL9K_PYENV_CONTENT_EXPANSION='${P9K_CONTENT}${${P9K_PYENV_PYTHON_VERSION:#$P9K_CONTENT}:+ $P9K_PYENV_PYTHON_VERSION}' - - # Custom icon. - # typeset -g POWERLEVEL9K_PYENV_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ################[ goenv: go environment (https://github.com/syndbg/goenv) ]################ - # Goenv color. - typeset -g POWERLEVEL9K_GOENV_FOREGROUND=6 - # Hide go version if it doesn't come from one of these sources. - typeset -g POWERLEVEL9K_GOENV_SOURCES=(shell local global) - # If set to false, hide go version if it's the same as global: - # $(goenv version-name) == $(goenv global). - typeset -g POWERLEVEL9K_GOENV_PROMPT_ALWAYS_SHOW=false - # If set to false, hide go version if it's equal to "system". - typeset -g POWERLEVEL9K_GOENV_SHOW_SYSTEM=true - # Custom icon. - # typeset -g POWERLEVEL9K_GOENV_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ##########[ nodenv: node.js version from nodenv (https://github.com/nodenv/nodenv) ]########## - # Nodenv color. - typeset -g POWERLEVEL9K_NODENV_FOREGROUND=2 - # Hide node version if it doesn't come from one of these sources. - typeset -g POWERLEVEL9K_NODENV_SOURCES=(shell local global) - # If set to false, hide node version if it's the same as global: - # $(nodenv version-name) == $(nodenv global). - typeset -g POWERLEVEL9K_NODENV_PROMPT_ALWAYS_SHOW=false - # If set to false, hide node version if it's equal to "system". - typeset -g POWERLEVEL9K_NODENV_SHOW_SYSTEM=true - # Custom icon. - # typeset -g POWERLEVEL9K_NODENV_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ##############[ nvm: node.js version from nvm (https://github.com/nvm-sh/nvm) ]############### - # Nvm color. - typeset -g POWERLEVEL9K_NVM_FOREGROUND=2 - # Custom icon. - # typeset -g POWERLEVEL9K_NVM_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ############[ nodeenv: node.js environment (https://github.com/ekalinin/nodeenv) ]############ - # Nodeenv color. - typeset -g POWERLEVEL9K_NODEENV_FOREGROUND=2 - # Don't show Node version next to the environment name. - typeset -g POWERLEVEL9K_NODEENV_SHOW_NODE_VERSION=false - # Separate environment name from Node version only with a space. - typeset -g POWERLEVEL9K_NODEENV_{LEFT,RIGHT}_DELIMITER= - # Custom icon. - # typeset -g POWERLEVEL9K_NODEENV_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ##############################[ node_version: node.js version ]############################### - # Node version color. - typeset -g POWERLEVEL9K_NODE_VERSION_FOREGROUND=2 - # Show node version only when in a directory tree containing package.json. - typeset -g POWERLEVEL9K_NODE_VERSION_PROJECT_ONLY=true - # Custom icon. - # typeset -g POWERLEVEL9K_NODE_VERSION_VISUAL_IDENTIFIER_EXPANSION='⭐' - - #######################[ go_version: go version (https://golang.org) ]######################## - # Go version color. - typeset -g POWERLEVEL9K_GO_VERSION_FOREGROUND=6 - # Show go version only when in a go project subdirectory. - typeset -g POWERLEVEL9K_GO_VERSION_PROJECT_ONLY=true - # Custom icon. - # typeset -g POWERLEVEL9K_GO_VERSION_VISUAL_IDENTIFIER_EXPANSION='⭐' - - #################[ rust_version: rustc version (https://www.rust-lang.org) ]################## - # Rust version color. - typeset -g POWERLEVEL9K_RUST_VERSION_FOREGROUND=4 - # Show rust version only when in a rust project subdirectory. - typeset -g POWERLEVEL9K_RUST_VERSION_PROJECT_ONLY=true - # Custom icon. - # typeset -g POWERLEVEL9K_RUST_VERSION_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ###############[ dotnet_version: .NET version (https://dotnet.microsoft.com) ]################ - # .NET version color. - typeset -g POWERLEVEL9K_DOTNET_VERSION_FOREGROUND=5 - # Show .NET version only when in a .NET project subdirectory. - typeset -g POWERLEVEL9K_DOTNET_VERSION_PROJECT_ONLY=true - # Custom icon. - # typeset -g POWERLEVEL9K_DOTNET_VERSION_VISUAL_IDENTIFIER_EXPANSION='⭐' - - #####################[ php_version: php version (https://www.php.net/) ]###################### - # PHP version color. - typeset -g POWERLEVEL9K_PHP_VERSION_FOREGROUND=5 - # Show PHP version only when in a PHP project subdirectory. - typeset -g POWERLEVEL9K_PHP_VERSION_PROJECT_ONLY=true - # Custom icon. - # typeset -g POWERLEVEL9K_PHP_VERSION_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ##########[ laravel_version: laravel php framework version (https://laravel.com/) ]########### - # Laravel version color. - typeset -g POWERLEVEL9K_LARAVEL_VERSION_FOREGROUND=1 - # Custom icon. - # typeset -g POWERLEVEL9K_LARAVEL_VERSION_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ####################[ java_version: java version (https://www.java.com/) ]#################### - # Java version color. - typeset -g POWERLEVEL9K_JAVA_VERSION_FOREGROUND=4 - # Show java version only when in a java project subdirectory. - typeset -g POWERLEVEL9K_JAVA_VERSION_PROJECT_ONLY=true - # Show brief version. - typeset -g POWERLEVEL9K_JAVA_VERSION_FULL=false - # Custom icon. - # typeset -g POWERLEVEL9K_JAVA_VERSION_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ###[ package: name@version from package.json (https://docs.npmjs.com/files/package.json) ]#### - # Package color. - typeset -g POWERLEVEL9K_PACKAGE_FOREGROUND=6 - # Package format. The following parameters are available within the expansion. - # - # - P9K_PACKAGE_NAME The value of `name` field in package.json. - # - P9K_PACKAGE_VERSION The value of `version` field in package.json. - # - # typeset -g POWERLEVEL9K_PACKAGE_CONTENT_EXPANSION='${P9K_PACKAGE_NAME//\%/%%}@${P9K_PACKAGE_VERSION//\%/%%}' - # Custom icon. - # typeset -g POWERLEVEL9K_PACKAGE_VISUAL_IDENTIFIER_EXPANSION='⭐' - - #############[ rbenv: ruby version from rbenv (https://github.com/rbenv/rbenv) ]############## - # Rbenv color. - typeset -g POWERLEVEL9K_RBENV_FOREGROUND=1 - # Hide ruby version if it doesn't come from one of these sources. - typeset -g POWERLEVEL9K_RBENV_SOURCES=(shell local global) - # If set to false, hide ruby version if it's the same as global: - # $(rbenv version-name) == $(rbenv global). - typeset -g POWERLEVEL9K_RBENV_PROMPT_ALWAYS_SHOW=false - # If set to false, hide ruby version if it's equal to "system". - typeset -g POWERLEVEL9K_RBENV_SHOW_SYSTEM=true - # Custom icon. - # typeset -g POWERLEVEL9K_RBENV_VISUAL_IDENTIFIER_EXPANSION='⭐' - - #######################[ rvm: ruby version from rvm (https://rvm.io) ]######################## - # Rvm color. - typeset -g POWERLEVEL9K_RVM_FOREGROUND=1 - # Don't show @gemset at the end. - typeset -g POWERLEVEL9K_RVM_SHOW_GEMSET=false - # Don't show ruby- at the front. - typeset -g POWERLEVEL9K_RVM_SHOW_PREFIX=false - # Custom icon. - # typeset -g POWERLEVEL9K_RVM_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ###########[ fvm: flutter version management (https://github.com/leoafarias/fvm) ]############ - # Fvm color. - typeset -g POWERLEVEL9K_FVM_FOREGROUND=4 - # Custom icon. - # typeset -g POWERLEVEL9K_FVM_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ##########[ luaenv: lua version from luaenv (https://github.com/cehoffman/luaenv) ]########### - # Lua color. - typeset -g POWERLEVEL9K_LUAENV_FOREGROUND=4 - # Hide lua version if it doesn't come from one of these sources. - typeset -g POWERLEVEL9K_LUAENV_SOURCES=(shell local global) - # If set to false, hide lua version if it's the same as global: - # $(luaenv version-name) == $(luaenv global). - typeset -g POWERLEVEL9K_LUAENV_PROMPT_ALWAYS_SHOW=false - # If set to false, hide lua version if it's equal to "system". - typeset -g POWERLEVEL9K_LUAENV_SHOW_SYSTEM=true - # Custom icon. - # typeset -g POWERLEVEL9K_LUAENV_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ###############[ jenv: java version from jenv (https://github.com/jenv/jenv) ]################ - # Java color. - typeset -g POWERLEVEL9K_JENV_FOREGROUND=4 - # Hide java version if it doesn't come from one of these sources. - typeset -g POWERLEVEL9K_JENV_SOURCES=(shell local global) - # If set to false, hide java version if it's the same as global: - # $(jenv version-name) == $(jenv global). - typeset -g POWERLEVEL9K_JENV_PROMPT_ALWAYS_SHOW=false - # If set to false, hide java version if it's equal to "system". - typeset -g POWERLEVEL9K_JENV_SHOW_SYSTEM=true - # Custom icon. - # typeset -g POWERLEVEL9K_JENV_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ###########[ plenv: perl version from plenv (https://github.com/tokuhirom/plenv) ]############ - # Perl color. - typeset -g POWERLEVEL9K_PLENV_FOREGROUND=6 - # Hide perl version if it doesn't come from one of these sources. - typeset -g POWERLEVEL9K_PLENV_SOURCES=(shell local global) - # If set to false, hide perl version if it's the same as global: - # $(plenv version-name) == $(plenv global). - typeset -g POWERLEVEL9K_PLENV_PROMPT_ALWAYS_SHOW=false - # If set to false, hide perl version if it's equal to "system". - typeset -g POWERLEVEL9K_PLENV_SHOW_SYSTEM=true - # Custom icon. - # typeset -g POWERLEVEL9K_PLENV_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ############[ phpenv: php version from phpenv (https://github.com/phpenv/phpenv) ]############ - # PHP color. - typeset -g POWERLEVEL9K_PHPENV_FOREGROUND=5 - # Hide php version if it doesn't come from one of these sources. - typeset -g POWERLEVEL9K_PHPENV_SOURCES=(shell local global) - # If set to false, hide php version if it's the same as global: - # $(phpenv version-name) == $(phpenv global). - typeset -g POWERLEVEL9K_PHPENV_PROMPT_ALWAYS_SHOW=false - # If set to false, hide php version if it's equal to "system". - typeset -g POWERLEVEL9K_PHPENV_SHOW_SYSTEM=true - # Custom icon. - # typeset -g POWERLEVEL9K_PHPENV_VISUAL_IDENTIFIER_EXPANSION='⭐' - - #######[ scalaenv: scala version from scalaenv (https://github.com/scalaenv/scalaenv) ]####### - # Scala color. - typeset -g POWERLEVEL9K_SCALAENV_FOREGROUND=1 - # Hide scala version if it doesn't come from one of these sources. - typeset -g POWERLEVEL9K_SCALAENV_SOURCES=(shell local global) - # If set to false, hide scala version if it's the same as global: - # $(scalaenv version-name) == $(scalaenv global). - typeset -g POWERLEVEL9K_SCALAENV_PROMPT_ALWAYS_SHOW=false - # If set to false, hide scala version if it's equal to "system". - typeset -g POWERLEVEL9K_SCALAENV_SHOW_SYSTEM=true - # Custom icon. - # typeset -g POWERLEVEL9K_SCALAENV_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ##########[ haskell_stack: haskell version from stack (https://haskellstack.org/) ]########### - # Haskell color. - typeset -g POWERLEVEL9K_HASKELL_STACK_FOREGROUND=3 - # Hide haskell version if it doesn't come from one of these sources. - # - # shell: version is set by STACK_YAML - # local: version is set by stack.yaml up the directory tree - # global: version is set by the implicit global project (~/.stack/global-project/stack.yaml) - typeset -g POWERLEVEL9K_HASKELL_STACK_SOURCES=(shell local) - # If set to false, hide haskell version if it's the same as in the implicit global project. - typeset -g POWERLEVEL9K_HASKELL_STACK_ALWAYS_SHOW=true - # Custom icon. - # typeset -g POWERLEVEL9K_HASKELL_STACK_VISUAL_IDENTIFIER_EXPANSION='⭐' - - #############[ kubecontext: current kubernetes context (https://kubernetes.io/) ]############# - # Show kubecontext only when the the command you are typing invokes one of these tools. - # Tip: Remove the next line to always show kubecontext. - typeset -g POWERLEVEL9K_KUBECONTEXT_SHOW_ON_COMMAND='kubectl|helm|kubens|kubectx|oc|istioctl|kogito|k9s|helmfile' - - # Kubernetes context classes for the purpose of using different colors, icons and expansions with - # different contexts. - # - # POWERLEVEL9K_KUBECONTEXT_CLASSES is an array with even number of elements. The first element - # in each pair defines a pattern against which the current kubernetes context gets matched. - # More specifically, it's P9K_CONTENT prior to the application of context expansion (see below) - # that gets matched. If you unset all POWERLEVEL9K_KUBECONTEXT_*CONTENT_EXPANSION parameters, - # you'll see this value in your prompt. The second element of each pair in - # POWERLEVEL9K_KUBECONTEXT_CLASSES defines the context class. Patterns are tried in order. The - # first match wins. - # - # For example, given these settings: - # - # typeset -g POWERLEVEL9K_KUBECONTEXT_CLASSES=( - # '*prod*' PROD - # '*test*' TEST - # '*' DEFAULT) - # - # If your current kubernetes context is "deathray-testing/default", its class is TEST - # because "deathray-testing/default" doesn't match the pattern '*prod*' but does match '*test*'. - # - # You can define different colors, icons and content expansions for different classes: - # - # typeset -g POWERLEVEL9K_KUBECONTEXT_TEST_FOREGROUND=3 - # typeset -g POWERLEVEL9K_KUBECONTEXT_TEST_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_KUBECONTEXT_TEST_CONTENT_EXPANSION='> ${P9K_CONTENT} <' - typeset -g POWERLEVEL9K_KUBECONTEXT_CLASSES=( - # '*prod*' PROD # These values are examples that are unlikely - # '*test*' TEST # to match your needs. Customize them as needed. - '*' DEFAULT) - typeset -g POWERLEVEL9K_KUBECONTEXT_DEFAULT_FOREGROUND=5 - typeset -g POWERLEVEL9K_KUBECONTEXT_DEFAULT_VISUAL_IDENTIFIER_EXPANSION='○' - - # Use POWERLEVEL9K_KUBECONTEXT_CONTENT_EXPANSION to specify the content displayed by kubecontext - # segment. Parameter expansions are very flexible and fast, too. See reference: - # http://zsh.sourceforge.net/Doc/Release/Expansion.html#Parameter-Expansion. - # - # Within the expansion the following parameters are always available: - # - # - P9K_CONTENT The content that would've been displayed if there was no content - # expansion defined. - # - P9K_KUBECONTEXT_NAME The current context's name. Corresponds to column NAME in the - # output of `kubectl config get-contexts`. - # - P9K_KUBECONTEXT_CLUSTER The current context's cluster. Corresponds to column CLUSTER in the - # output of `kubectl config get-contexts`. - # - P9K_KUBECONTEXT_NAMESPACE The current context's namespace. Corresponds to column NAMESPACE - # in the output of `kubectl config get-contexts`. If there is no - # namespace, the parameter is set to "default". - # - P9K_KUBECONTEXT_USER The current context's user. Corresponds to column AUTHINFO in the - # output of `kubectl config get-contexts`. - # - # If the context points to Google Kubernetes Engine (GKE) or Elastic Kubernetes Service (EKS), - # the following extra parameters are available: - # - # - P9K_KUBECONTEXT_CLOUD_NAME Either "gke" or "eks". - # - P9K_KUBECONTEXT_CLOUD_ACCOUNT Account/project ID. - # - P9K_KUBECONTEXT_CLOUD_ZONE Availability zone. - # - P9K_KUBECONTEXT_CLOUD_CLUSTER Cluster. - # - # P9K_KUBECONTEXT_CLOUD_* parameters are derived from P9K_KUBECONTEXT_CLUSTER. For example, - # if P9K_KUBECONTEXT_CLUSTER is "gke_my-account_us-east1-a_my-cluster-01": - # - # - P9K_KUBECONTEXT_CLOUD_NAME=gke - # - P9K_KUBECONTEXT_CLOUD_ACCOUNT=my-account - # - P9K_KUBECONTEXT_CLOUD_ZONE=us-east1-a - # - P9K_KUBECONTEXT_CLOUD_CLUSTER=my-cluster-01 - # - # If P9K_KUBECONTEXT_CLUSTER is "arn:aws:eks:us-east-1:123456789012:cluster/my-cluster-01": - # - # - P9K_KUBECONTEXT_CLOUD_NAME=eks - # - P9K_KUBECONTEXT_CLOUD_ACCOUNT=123456789012 - # - P9K_KUBECONTEXT_CLOUD_ZONE=us-east-1 - # - P9K_KUBECONTEXT_CLOUD_CLUSTER=my-cluster-01 - typeset -g POWERLEVEL9K_KUBECONTEXT_DEFAULT_CONTENT_EXPANSION= - # Show P9K_KUBECONTEXT_CLOUD_CLUSTER if it's not empty and fall back to P9K_KUBECONTEXT_NAME. - POWERLEVEL9K_KUBECONTEXT_DEFAULT_CONTENT_EXPANSION+='${P9K_KUBECONTEXT_CLOUD_CLUSTER:-${P9K_KUBECONTEXT_NAME}}' - # Append the current context's namespace if it's not "default". - POWERLEVEL9K_KUBECONTEXT_DEFAULT_CONTENT_EXPANSION+='${${:-/$P9K_KUBECONTEXT_NAMESPACE}:#/default}' - - # Custom prefix. - # typeset -g POWERLEVEL9K_KUBECONTEXT_PREFIX='%fat ' - - ################[ terraform: terraform workspace (https://www.terraform.io) ]################# - # Don't show terraform workspace if it's literally "default". - typeset -g POWERLEVEL9K_TERRAFORM_SHOW_DEFAULT=false - # POWERLEVEL9K_TERRAFORM_CLASSES is an array with even number of elements. The first element - # in each pair defines a pattern against which the current terraform workspace gets matched. - # More specifically, it's P9K_CONTENT prior to the application of context expansion (see below) - # that gets matched. If you unset all POWERLEVEL9K_TERRAFORM_*CONTENT_EXPANSION parameters, - # you'll see this value in your prompt. The second element of each pair in - # POWERLEVEL9K_TERRAFORM_CLASSES defines the workspace class. Patterns are tried in order. The - # first match wins. - # - # For example, given these settings: - # - # typeset -g POWERLEVEL9K_TERRAFORM_CLASSES=( - # '*prod*' PROD - # '*test*' TEST - # '*' OTHER) - # - # If your current terraform workspace is "project_test", its class is TEST because "project_test" - # doesn't match the pattern '*prod*' but does match '*test*'. - # - # You can define different colors, icons and content expansions for different classes: - # - # typeset -g POWERLEVEL9K_TERRAFORM_TEST_FOREGROUND=2 - # typeset -g POWERLEVEL9K_TERRAFORM_TEST_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_TERRAFORM_TEST_CONTENT_EXPANSION='> ${P9K_CONTENT} <' - typeset -g POWERLEVEL9K_TERRAFORM_CLASSES=( - # '*prod*' PROD # These values are examples that are unlikely - # '*test*' TEST # to match your needs. Customize them as needed. - '*' OTHER) - typeset -g POWERLEVEL9K_TERRAFORM_OTHER_FOREGROUND=4 - # typeset -g POWERLEVEL9K_TERRAFORM_OTHER_VISUAL_IDENTIFIER_EXPANSION='⭐' - - #[ aws: aws profile (https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html) ]# - # Show aws only when the the command you are typing invokes one of these tools. - # Tip: Remove the next line to always show aws. - typeset -g POWERLEVEL9K_AWS_SHOW_ON_COMMAND='aws|awless|terraform|pulumi|terragrunt' - - # POWERLEVEL9K_AWS_CLASSES is an array with even number of elements. The first element - # in each pair defines a pattern against which the current AWS profile gets matched. - # More specifically, it's P9K_CONTENT prior to the application of context expansion (see below) - # that gets matched. If you unset all POWERLEVEL9K_AWS_*CONTENT_EXPANSION parameters, - # you'll see this value in your prompt. The second element of each pair in - # POWERLEVEL9K_AWS_CLASSES defines the profile class. Patterns are tried in order. The - # first match wins. - # - # For example, given these settings: - # - # typeset -g POWERLEVEL9K_AWS_CLASSES=( - # '*prod*' PROD - # '*test*' TEST - # '*' DEFAULT) - # - # If your current AWS profile is "company_test", its class is TEST - # because "company_test" doesn't match the pattern '*prod*' but does match '*test*'. - # - # You can define different colors, icons and content expansions for different classes: - # - # typeset -g POWERLEVEL9K_AWS_TEST_FOREGROUND=2 - # typeset -g POWERLEVEL9K_AWS_TEST_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_AWS_TEST_CONTENT_EXPANSION='> ${P9K_CONTENT} <' - typeset -g POWERLEVEL9K_AWS_CLASSES=( - # '*prod*' PROD # These values are examples that are unlikely - # '*test*' TEST # to match your needs. Customize them as needed. - '*' DEFAULT) - typeset -g POWERLEVEL9K_AWS_DEFAULT_FOREGROUND=3 - # typeset -g POWERLEVEL9K_AWS_DEFAULT_VISUAL_IDENTIFIER_EXPANSION='⭐' - - #[ aws_eb_env: aws elastic beanstalk environment (https://aws.amazon.com/elasticbeanstalk/) ]# - # AWS Elastic Beanstalk environment color. - typeset -g POWERLEVEL9K_AWS_EB_ENV_FOREGROUND=2 - # Custom icon. - typeset -g POWERLEVEL9K_AWS_EB_ENV_VISUAL_IDENTIFIER_EXPANSION='eb' - - ##########[ azure: azure account name (https://docs.microsoft.com/en-us/cli/azure) ]########## - # Show azure only when the the command you are typing invokes one of these tools. - # Tip: Remove the next line to always show azure. - typeset -g POWERLEVEL9K_AZURE_SHOW_ON_COMMAND='az|terraform|pulumi|terragrunt' - # Azure account name color. - typeset -g POWERLEVEL9K_AZURE_FOREGROUND=4 - # Custom icon. - typeset -g POWERLEVEL9K_AZURE_VISUAL_IDENTIFIER_EXPANSION='az' - - ##########[ gcloud: google cloud account and project (https://cloud.google.com/) ]########### - # Show gcloud only when the the command you are typing invokes one of these tools. - # Tip: Remove the next line to always show gcloud. - typeset -g POWERLEVEL9K_GCLOUD_SHOW_ON_COMMAND='gcloud|gcs' - # Google cloud color. - typeset -g POWERLEVEL9K_GCLOUD_FOREGROUND=4 - - # Google cloud format. Change the value of POWERLEVEL9K_GCLOUD_PARTIAL_CONTENT_EXPANSION and/or - # POWERLEVEL9K_GCLOUD_COMPLETE_CONTENT_EXPANSION if the default is too verbose or not informative - # enough. You can use the following parameters in the expansions. Each of them corresponds to the - # output of `gcloud` tool. - # - # Parameter | Source - # -------------------------|-------------------------------------------------------------------- - # P9K_GCLOUD_CONFIGURATION | gcloud config configurations list --format='value(name)' - # P9K_GCLOUD_ACCOUNT | gcloud config get-value account - # P9K_GCLOUD_PROJECT_ID | gcloud config get-value project - # P9K_GCLOUD_PROJECT_NAME | gcloud projects describe $P9K_GCLOUD_PROJECT_ID --format='value(name)' - # - # Note: ${VARIABLE//\%/%%} expands to ${VARIABLE} with all occurrences of '%' replaced with '%%'. - # - # Obtaining project name requires sending a request to Google servers. This can take a long time - # and even fail. When project name is unknown, P9K_GCLOUD_PROJECT_NAME is not set and gcloud - # prompt segment is in state PARTIAL. When project name gets known, P9K_GCLOUD_PROJECT_NAME gets - # set and gcloud prompt segment transitions to state COMPLETE. - # - # You can customize the format, icon and colors of gcloud segment separately for states PARTIAL - # and COMPLETE. You can also hide gcloud in state PARTIAL by setting - # POWERLEVEL9K_GCLOUD_PARTIAL_VISUAL_IDENTIFIER_EXPANSION and - # POWERLEVEL9K_GCLOUD_PARTIAL_CONTENT_EXPANSION to empty. - typeset -g POWERLEVEL9K_GCLOUD_PARTIAL_CONTENT_EXPANSION='${P9K_GCLOUD_PROJECT_ID//\%/%%}' - typeset -g POWERLEVEL9K_GCLOUD_COMPLETE_CONTENT_EXPANSION='${P9K_GCLOUD_PROJECT_NAME//\%/%%}' - - # Send a request to Google (by means of `gcloud projects describe ...`) to obtain project name - # this often. Negative value disables periodic polling. In this mode project name is retrieved - # only when the current configuration, account or project id changes. - typeset -g POWERLEVEL9K_GCLOUD_REFRESH_PROJECT_NAME_SECONDS=60 - - # Custom icon. - # typeset -g POWERLEVEL9K_GCLOUD_VISUAL_IDENTIFIER_EXPANSION='⭐' - - #[ google_app_cred: google application credentials (https://cloud.google.com/docs/authentication/production) ]# - # Show google_app_cred only when the the command you are typing invokes one of these tools. - # Tip: Remove the next line to always show google_app_cred. - typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_SHOW_ON_COMMAND='terraform|pulumi|terragrunt' - - # Google application credentials classes for the purpose of using different colors, icons and - # expansions with different credentials. - # - # POWERLEVEL9K_GOOGLE_APP_CRED_CLASSES is an array with even number of elements. The first - # element in each pair defines a pattern against which the current kubernetes context gets - # matched. More specifically, it's P9K_CONTENT prior to the application of context expansion - # (see below) that gets matched. If you unset all POWERLEVEL9K_GOOGLE_APP_CRED_*CONTENT_EXPANSION - # parameters, you'll see this value in your prompt. The second element of each pair in - # POWERLEVEL9K_GOOGLE_APP_CRED_CLASSES defines the context class. Patterns are tried in order. - # The first match wins. - # - # For example, given these settings: - # - # typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_CLASSES=( - # '*:*prod*:*' PROD - # '*:*test*:*' TEST - # '*' DEFAULT) - # - # If your current Google application credentials is "service_account deathray-testing x@y.com", - # its class is TEST because it doesn't match the pattern '* *prod* *' but does match '* *test* *'. - # - # You can define different colors, icons and content expansions for different classes: - # - # typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_TEST_FOREGROUND=3 - # typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_TEST_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_TEST_CONTENT_EXPANSION='$P9K_GOOGLE_APP_CRED_PROJECT_ID' - typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_CLASSES=( - # '*:*prod*:*' PROD # These values are examples that are unlikely - # '*:*test*:*' TEST # to match your needs. Customize them as needed. - '*' DEFAULT) - typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_DEFAULT_FOREGROUND=5 - # typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_DEFAULT_VISUAL_IDENTIFIER_EXPANSION='⭐' - - # Use POWERLEVEL9K_GOOGLE_APP_CRED_CONTENT_EXPANSION to specify the content displayed by - # google_app_cred segment. Parameter expansions are very flexible and fast, too. See reference: - # http://zsh.sourceforge.net/Doc/Release/Expansion.html#Parameter-Expansion. - # - # You can use the following parameters in the expansion. Each of them corresponds to one of the - # fields in the JSON file pointed to by GOOGLE_APPLICATION_CREDENTIALS. - # - # Parameter | JSON key file field - # ---------------------------------+--------------- - # P9K_GOOGLE_APP_CRED_TYPE | type - # P9K_GOOGLE_APP_CRED_PROJECT_ID | project_id - # P9K_GOOGLE_APP_CRED_CLIENT_EMAIL | client_email - # - # Note: ${VARIABLE//\%/%%} expands to ${VARIABLE} with all occurrences of '%' replaced by '%%'. - typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_DEFAULT_CONTENT_EXPANSION='${P9K_GOOGLE_APP_CRED_PROJECT_ID//\%/%%}' - - ###############################[ public_ip: public IP address ]############################### - # Public IP color. - typeset -g POWERLEVEL9K_PUBLIC_IP_FOREGROUND=6 - # Custom icon. - # typeset -g POWERLEVEL9K_PUBLIC_IP_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ########################[ vpn_ip: virtual private network indicator ]######################### - # VPN IP color. - typeset -g POWERLEVEL9K_VPN_IP_FOREGROUND=3 - # When on VPN, show just an icon without the IP address. - # Tip: To display the private IP address when on VPN, remove the next line. - typeset -g POWERLEVEL9K_VPN_IP_CONTENT_EXPANSION= - # Regular expression for the VPN network interface. Run `ifconfig` or `ip -4 a show` while on VPN - # to see the name of the interface. - typeset -g POWERLEVEL9K_VPN_IP_INTERFACE='(gpd|wg|(.*tun)|tailscale)[0-9]*' - # If set to true, show one segment per matching network interface. If set to false, show only - # one segment corresponding to the first matching network interface. - # Tip: If you set it to true, you'll probably want to unset POWERLEVEL9K_VPN_IP_CONTENT_EXPANSION. - typeset -g POWERLEVEL9K_VPN_IP_SHOW_ALL=false - # Custom icon. - # typeset -g POWERLEVEL9K_VPN_IP_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ###########[ ip: ip address and bandwidth usage for a specified network interface ]########### - # IP color. - typeset -g POWERLEVEL9K_IP_FOREGROUND=4 - # The following parameters are accessible within the expansion: - # - # Parameter | Meaning - # ----------------------+--------------- - # P9K_IP_IP | IP address - # P9K_IP_INTERFACE | network interface - # P9K_IP_RX_BYTES | total number of bytes received - # P9K_IP_TX_BYTES | total number of bytes sent - # P9K_IP_RX_RATE | receive rate (since last prompt) - # P9K_IP_TX_RATE | send rate (since last prompt) - typeset -g POWERLEVEL9K_IP_CONTENT_EXPANSION='$P9K_IP_IP${P9K_IP_RX_RATE:+ %2F⇣$P9K_IP_RX_RATE}${P9K_IP_TX_RATE:+ %3F⇡$P9K_IP_TX_RATE}' - # Show information for the first network interface whose name matches this regular expression. - # Run `ifconfig` or `ip -4 a show` to see the names of all network interfaces. - typeset -g POWERLEVEL9K_IP_INTERFACE='[ew].*' - # Custom icon. - # typeset -g POWERLEVEL9K_IP_VISUAL_IDENTIFIER_EXPANSION='⭐' - - #########################[ proxy: system-wide http/https/ftp proxy ]########################## - # Proxy color. - typeset -g POWERLEVEL9K_PROXY_FOREGROUND=2 - # Custom icon. - # typeset -g POWERLEVEL9K_PROXY_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ################################[ battery: internal battery ]################################# - # Show battery in red when it's below this level and not connected to power supply. - typeset -g POWERLEVEL9K_BATTERY_LOW_THRESHOLD=20 - typeset -g POWERLEVEL9K_BATTERY_LOW_FOREGROUND=1 - # Show battery in green when it's charging or fully charged. - typeset -g POWERLEVEL9K_BATTERY_{CHARGING,CHARGED}_FOREGROUND=2 - # Show battery in yellow when it's discharging. - typeset -g POWERLEVEL9K_BATTERY_DISCONNECTED_FOREGROUND=3 - # Battery pictograms going from low to high level of charge. - typeset -g POWERLEVEL9K_BATTERY_STAGES=('%K{0}▁' '%K{0}▂' '%K{0}▃' '%K{0}▄' '%K{0}▅' '%K{0}▆' '%K{0}▇' '%K{0}█') - # Don't show the remaining time to charge/discharge. - typeset -g POWERLEVEL9K_BATTERY_VERBOSE=false - - #####################################[ wifi: wifi speed ]##################################### - # WiFi color. - typeset -g POWERLEVEL9K_WIFI_FOREGROUND=4 - # Custom icon. - # typeset -g POWERLEVEL9K_WIFI_VISUAL_IDENTIFIER_EXPANSION='⭐' - - # Use different colors and icons depending on signal strength ($P9K_WIFI_BARS). - # - # # Wifi colors and icons for different signal strength levels (low to high). - # typeset -g my_wifi_fg=(4 4 4 4 4) # <-- change these values - # typeset -g my_wifi_icon=('WiFi' 'WiFi' 'WiFi' 'WiFi' 'WiFi') # <-- change these values - # - # typeset -g POWERLEVEL9K_WIFI_CONTENT_EXPANSION='%F{${my_wifi_fg[P9K_WIFI_BARS+1]}}$P9K_WIFI_LAST_TX_RATE Mbps' - # typeset -g POWERLEVEL9K_WIFI_VISUAL_IDENTIFIER_EXPANSION='%F{${my_wifi_fg[P9K_WIFI_BARS+1]}}${my_wifi_icon[P9K_WIFI_BARS+1]}' - # - # The following parameters are accessible within the expansions: - # - # Parameter | Meaning - # ----------------------+--------------- - # P9K_WIFI_SSID | service set identifier, a.k.a. network name - # P9K_WIFI_LINK_AUTH | authentication protocol such as "wpa2-psk" or "none"; empty if unknown - # P9K_WIFI_LAST_TX_RATE | wireless transmit rate in megabits per second - # P9K_WIFI_RSSI | signal strength in dBm, from -120 to 0 - # P9K_WIFI_NOISE | noise in dBm, from -120 to 0 - # P9K_WIFI_BARS | signal strength in bars, from 0 to 4 (derived from P9K_WIFI_RSSI and P9K_WIFI_NOISE) - - ####################################[ time: current time ]#################################### - # Current time color. - typeset -g POWERLEVEL9K_TIME_FOREGROUND=6 - # Format for the current time: 09:51:02. See `man 3 strftime`. - typeset -g POWERLEVEL9K_TIME_FORMAT='%D{%H:%M:%S}' - # If set to true, time will update when you hit enter. This way prompts for the past - # commands will contain the start times of their commands as opposed to the default - # behavior where they contain the end times of their preceding commands. - typeset -g POWERLEVEL9K_TIME_UPDATE_ON_COMMAND=false - # Custom icon. - typeset -g POWERLEVEL9K_TIME_VISUAL_IDENTIFIER_EXPANSION= - # Custom prefix. - # typeset -g POWERLEVEL9K_TIME_PREFIX='%fat ' - - # Example of a user-defined prompt segment. Function prompt_example will be called on every - # prompt if `example` prompt segment is added to POWERLEVEL9K_LEFT_PROMPT_ELEMENTS or - # POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS. It displays an icon and green text greeting the user. - # - # Type `p10k help segment` for documentation and a more sophisticated example. - function prompt_example() { - p10k segment -f 2 -i '⭐' -t 'hello, %n' - } - - # User-defined prompt segments may optionally provide an instant_prompt_* function. Its job - # is to generate the prompt segment for display in instant prompt. See - # https://github.com/romkatv/powerlevel10k/blob/master/README.md#instant-prompt. - # - # Powerlevel10k will call instant_prompt_* at the same time as the regular prompt_* function - # and will record all `p10k segment` calls it makes. When displaying instant prompt, Powerlevel10k - # will replay these calls without actually calling instant_prompt_*. It is imperative that - # instant_prompt_* always makes the same `p10k segment` calls regardless of environment. If this - # rule is not observed, the content of instant prompt will be incorrect. - # - # Usually, you should either not define instant_prompt_* or simply call prompt_* from it. If - # instant_prompt_* is not defined for a segment, the segment won't be shown in instant prompt. - function instant_prompt_example() { - # Since prompt_example always makes the same `p10k segment` calls, we can call it from - # instant_prompt_example. This will give us the same `example` prompt segment in the instant - # and regular prompts. - prompt_example - } - - # User-defined prompt segments can be customized the same way as built-in segments. - # typeset -g POWERLEVEL9K_EXAMPLE_FOREGROUND=208 - # typeset -g POWERLEVEL9K_EXAMPLE_VISUAL_IDENTIFIER_EXPANSION='⭐' - - # Transient prompt works similarly to the builtin transient_rprompt option. It trims down prompt - # when accepting a command line. Supported values: - # - # - off: Don't change prompt when accepting a command line. - # - always: Trim down prompt when accepting a command line. - # - same-dir: Trim down prompt when accepting a command line unless this is the first command - # typed after changing current working directory. - typeset -g POWERLEVEL9K_TRANSIENT_PROMPT=always - - # Instant prompt mode. - # - # - off: Disable instant prompt. Choose this if you've tried instant prompt and found - # it incompatible with your zsh configuration files. - # - quiet: Enable instant prompt and don't print warnings when detecting console output - # during zsh initialization. Choose this if you've read and understood - # https://github.com/romkatv/powerlevel10k/blob/master/README.md#instant-prompt. - # - verbose: Enable instant prompt and print a warning when detecting console output during - # zsh initialization. Choose this if you've never tried instant prompt, haven't - # seen the warning, or if you are unsure what this all means. - typeset -g POWERLEVEL9K_INSTANT_PROMPT=quiet - - # Hot reload allows you to change POWERLEVEL9K options after Powerlevel10k has been initialized. - # For example, you can type POWERLEVEL9K_BACKGROUND=red and see your prompt turn red. Hot reload - # can slow down prompt by 1-2 milliseconds, so it's better to keep it turned off unless you - # really need it. - typeset -g POWERLEVEL9K_DISABLE_HOT_RELOAD=true - - # If p10k is already loaded, reload configuration. - # This works even with POWERLEVEL9K_DISABLE_HOT_RELOAD=true. - (( ! $+functions[p10k] )) || p10k reload -} - -# Tell `p10k configure` which file it should overwrite. -typeset -g POWERLEVEL9K_CONFIG_FILE=${${(%):-%x}:a} - -(( ${#p10k_config_opts} )) && setopt ${p10k_config_opts[@]} -'builtin' 'unset' 'p10k_config_opts' diff --git a/zsh/plugins/colored-man-pages.zsh b/zsh/plugins/colored-man-pages.zsh deleted file mode 100644 index 37faed6..0000000 --- a/zsh/plugins/colored-man-pages.zsh +++ /dev/null @@ -1,48 +0,0 @@ -# Requires colors autoload. -# See termcap(5). - -# Set up once, and then reuse. This way it supports user overrides after the -# plugin is loaded. -typeset -AHg less_termcap - -# bold & blinking mode -less_termcap[mb]="${fg_bold[red]}" -less_termcap[md]="${fg_bold[red]}" -less_termcap[me]="${reset_color}" -# standout mode -less_termcap[so]="${fg_bold[yellow]}${bg[blue]}" -less_termcap[se]="${reset_color}" -# underlining -less_termcap[us]="${fg_bold[green]}" -less_termcap[ue]="${reset_color}" - -# Absolute path to this file's directory. -typeset __colored_man_pages_dir="${0:A:h}" - -function colored() { - local -a environment - - # Convert associative array to plain array of NAME=VALUE items. - local k v - for k v in "${(@kv)less_termcap}"; do - environment+=( "LESS_TERMCAP_${k}=${v}" ) - done - - # Prefer `less` whenever available, since we specifically configured - # environment for it. - environment+=( PAGER="${commands[less]:-$PAGER}" ) - - # See ./nroff script. - if [[ "$OSTYPE" = solaris* ]]; then - environment+=( PATH="${__colored_man_pages_dir}:$PATH" ) - fi - - command env $environment "$@" -} - -# Colorize man and dman/debman (from debian-goodies) -function man \ - dman \ - debman { - colored $0 "$@" -} diff --git a/zsh/plugins/colorize.zsh b/zsh/plugins/colorize.zsh deleted file mode 100644 index 8ea98f8..0000000 --- a/zsh/plugins/colorize.zsh +++ /dev/null @@ -1,114 +0,0 @@ -# Easier alias to use the plugin -alias ccat="colorize_cat" -alias cless="colorize_less" - -# '$0:A' gets the absolute path of this file -ZSH_COLORIZE_PLUGIN_PATH=$0:A - -colorize_check_requirements() { - local -a available_tools - available_tools=("chroma" "pygmentize") - - if [ -z "$ZSH_COLORIZE_TOOL" ]; then - if (( $+commands[pygmentize] )); then - ZSH_COLORIZE_TOOL="pygmentize" - elif (( $+commands[chroma] )); then - ZSH_COLORIZE_TOOL="chroma" - else - echo "Neither 'pygments' nor 'chroma' is installed!" >&2 - return 1 - fi - fi - - if [[ ${available_tools[(Ie)$ZSH_COLORIZE_TOOL]} -eq 0 ]]; then - echo "ZSH_COLORIZE_TOOL '$ZSH_COLORIZE_TOOL' not recognized. Available options are 'pygmentize' and 'chroma'." >&2 - return 1 - elif (( $+commands["$ZSH_COLORIZE_TOOL"] )); then - echo "Package '$ZSH_COLORIZE_TOOL' is not installed!" >&2 - return 1 - fi -} - -colorize_cat() { - if ! colorize_check_requirements; then - return 1 - fi - - # If the environment variable ZSH_COLORIZE_STYLE - # is set, use that theme instead. Otherwise, - # use the default. - if [ -z "$ZSH_COLORIZE_STYLE" ]; then - # Both pygmentize & chroma support 'emacs' - ZSH_COLORIZE_STYLE="emacs" - fi - - # Use stdin if no arguments have been passed. - if [ $# -eq 0 ]; then - if [[ "$ZSH_COLORIZE_TOOL" == "pygmentize" ]]; then - pygmentize -O style="$ZSH_COLORIZE_STYLE" -g - else - chroma --style="$ZSH_COLORIZE_STYLE" --formatter="${ZSH_COLORIZE_CHROMA_FORMATTER:-terminal}" - fi - return $? - fi - - # Guess lexer from file extension, or guess it from file contents if unsuccessful. - local FNAME lexer - for FNAME in "$@"; do - if [[ "$ZSH_COLORIZE_TOOL" == "pygmentize" ]]; then - lexer=$(pygmentize -N "$FNAME") - if [[ $lexer != text ]]; then - pygmentize -O style="$ZSH_COLORIZE_STYLE" -l "$lexer" "$FNAME" - else - pygmentize -O style="$ZSH_COLORIZE_STYLE" -g "$FNAME" - fi - else - chroma --style="$ZSH_COLORIZE_STYLE" --formatter="${ZSH_COLORIZE_CHROMA_FORMATTER:-terminal}" "$FNAME" - fi - done -} - -# The less option 'F - Forward forever; like "tail -f".' will not work in this implementation -# caused by the lack of the ability to follow the file within pygmentize. -colorize_less() { - if ! colorize_check_requirements; then - return 1 - fi - - _cless() { - # LESS="-R $LESS" enables raw ANSI colors, while maintain already set options. - local LESS="-R $LESS" - - # This variable tells less to pipe every file through the specified command - # (see the man page of less INPUT PREPROCESSOR). - # 'zsh -ic "colorize_cat %s 2> /dev/null"' would not work for huge files like - # the ~/.zsh_history. For such files the tty of the preprocessor will be supended. - # Therefore we must source this file to make colorize_cat available in the - # preprocessor without the interactive mode. - # `2>/dev/null` will suppress the error for large files 'broken pipe' of the python - # script pygmentize, which will show up if less has not fully "loaded the file" - # (e.g. when not scrolled to the bottom) while already the next file will be displayed. - local LESSOPEN="| zsh -c 'source \"$ZSH_COLORIZE_PLUGIN_PATH\"; \ - ZSH_COLORIZE_TOOL=$ZSH_COLORIZE_TOOL ZSH_COLORIZE_STYLE=$ZSH_COLORIZE_STYLE \ - colorize_cat %s 2> /dev/null'" - - # LESSCLOSE will be set to prevent any errors by executing a user script - # which assumes that his LESSOPEN has been executed. - local LESSCLOSE="" - - LESS="$LESS" LESSOPEN="$LESSOPEN" LESSCLOSE="$LESSCLOSE" command less "$@" - } - - if [ -t 0 ]; then - _cless "$@" - else - # The input is not associated with a terminal, therefore colorize_cat will - # colorize this input and pass it to less. - # Less has now to decide what to use. If any files have been provided, less - # will ignore the input by default, otherwise the colorized input will be used. - # If files have been supplied and the input has been redirected, this will - # lead to unnecessary overhead, but retains the ability to use the less options - # without checking for them inside this script. - colorize_cat | _cless "$@" - fi -} diff --git a/zsh/plugins/docker-auto-complete.zsh b/zsh/plugins/docker-auto-complete.zsh deleted file mode 100644 index 7fe2043..0000000 --- a/zsh/plugins/docker-auto-complete.zsh +++ /dev/null @@ -1,3049 +0,0 @@ -#compdef docker dockerd -# -# zsh completion for docker (http://docker.com) -# -# version: 0.3.0 -# github: https://github.com/felixr/docker-zsh-completion -# -# contributors: -# - Felix Riedel -# - Steve Durrheimer -# - Vincent Bernat -# - Rohan Verma -# -# license: -# -# Copyright (c) 2013, Felix Riedel -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# * Neither the name of the nor the -# names of its contributors may be used to endorse or promote products -# derived from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY -# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# - -# Short-option stacking can be enabled with: -# zstyle ':completion:*:*:docker:*' option-stacking yes -# zstyle ':completion:*:*:docker-*:*' option-stacking yes -__docker_arguments() { - if zstyle -t ":completion:${curcontext}:" option-stacking; then - print -- -s - fi -} - -__docker_get_containers() { - [[ $PREFIX = -* ]] && return 1 - integer ret=1 - local kind type line s - declare -a running stopped lines args names - - kind=$1; shift - type=$1; shift - [[ $kind = (stopped|all) ]] && args=($args -a) - - lines=(${(f)${:-"$(_call_program commands docker $docker_options ps --format 'table' --no-trunc $args)"$'\n'}}) - - # Parse header line to find columns - local i=1 j=1 k header=${lines[1]} - declare -A begin end - while (( j < ${#header} - 1 )); do - i=$(( j + ${${header[$j,-1]}[(i)[^ ]]} - 1 )) - j=$(( i + ${${header[$i,-1]}[(i) ]} - 1 )) - k=$(( j + ${${header[$j,-1]}[(i)[^ ]]} - 2 )) - begin[${header[$i,$((j-1))]}]=$i - end[${header[$i,$((j-1))]}]=$k - done - end[${header[$i,$((j-1))]}]=-1 # Last column, should go to the end of the line - lines=(${lines[2,-1]}) - - # Container ID - if [[ $type = (ids|all) ]]; then - for line in $lines; do - s="${${line[${begin[CONTAINER ID]},${end[CONTAINER ID]}]%% ##}[0,12]}" - s="$s:${(l:15:: :::)${${line[${begin[CREATED]},${end[CREATED]}]/ ago/}%% ##}}" - s="$s, ${${${line[${begin[IMAGE]},${end[IMAGE]}]}/:/\\:}%% ##}" - if [[ ${line[${begin[STATUS]},${end[STATUS]}]} = (Exit*|Created*) ]]; then - stopped=($stopped $s) - else - running=($running $s) - fi - done - fi - - # Names: we only display the one without slash. All other names - # are generated and may clutter the completion. However, with - # Swarm, all names may be prefixed by the swarm node name. - if [[ $type = (names|all) ]]; then - for line in $lines; do - names=(${(ps:,:)${${line[${begin[NAMES]},${end[NAMES]}]}%% *}}) - # First step: find a common prefix and strip it (swarm node case) - (( ${#${(u)names%%/*}} == 1 )) && names=${names#${names[1]%%/*}/} - # Second step: only keep the first name without a / - s=${${names:#*/*}[1]} - # If no name, well give up. - (( $#s != 0 )) || continue - s="$s:${(l:15:: :::)${${line[${begin[CREATED]},${end[CREATED]}]/ ago/}%% ##}}" - s="$s, ${${${line[${begin[IMAGE]},${end[IMAGE]}]}/:/\\:}%% ##}" - if [[ ${line[${begin[STATUS]},${end[STATUS]}]} = (Exit*|Created*) ]]; then - stopped=($stopped $s) - else - running=($running $s) - fi - done - fi - - [[ $kind = (running|all) ]] && _describe -t containers-running "running containers" running "$@" && ret=0 - [[ $kind = (stopped|all) ]] && _describe -t containers-stopped "stopped containers" stopped "$@" && ret=0 - return ret -} - -__docker_complete_stopped_containers() { - [[ $PREFIX = -* ]] && return 1 - __docker_get_containers stopped all "$@" -} - -__docker_complete_running_containers() { - [[ $PREFIX = -* ]] && return 1 - __docker_get_containers running all "$@" -} - -__docker_complete_containers() { - [[ $PREFIX = -* ]] && return 1 - __docker_get_containers all all "$@" -} - -__docker_complete_containers_ids() { - [[ $PREFIX = -* ]] && return 1 - __docker_get_containers all ids "$@" -} - -__docker_complete_containers_names() { - [[ $PREFIX = -* ]] && return 1 - __docker_get_containers all names "$@" -} - -__docker_complete_info_plugins() { - [[ $PREFIX = -* ]] && return 1 - integer ret=1 - emulate -L zsh - setopt extendedglob - local -a plugins - plugins=(${(ps: :)${(M)${(f)${${"$(_call_program commands docker $docker_options info)"##*$'\n'Plugins:}%%$'\n'^ *}}:# $1: *}## $1: }) - _describe -t plugins "$1 plugins" plugins && ret=0 - return ret -} - -__docker_complete_images() { - [[ $PREFIX = -* ]] && return 1 - integer ret=1 - declare -a images - images=(${${${(f)${:-"$(_call_program commands docker $docker_options images)"$'\n'}}[2,-1]}/(#b)([^ ]##) ##([^ ]##) ##([^ ]##)*/${match[3]}:${(r:15:: :::)match[2]} in ${match[1]}}) - _describe -t docker-images "images" images && ret=0 - __docker_complete_repositories_with_tags && ret=0 - return ret -} - -__docker_complete_repositories() { - [[ $PREFIX = -* ]] && return 1 - integer ret=1 - declare -a repos - repos=(${${${(f)${:-"$(_call_program commands docker $docker_options images)"$'\n'}}%% *}[2,-1]}) - repos=(${repos#}) - _describe -t docker-repos "repositories" repos && ret=0 - return ret -} - -__docker_complete_repositories_with_tags() { - [[ $PREFIX = -* ]] && return 1 - integer ret=1 - declare -a repos onlyrepos matched - declare m - repos=(${${${${(f)${:-"$(_call_program commands docker $docker_options images)"$'\n'}}[2,-1]}/ ##/:::}%% *}) - repos=(${${repos%:::}#}) - # Check if we have a prefix-match for the current prefix. - onlyrepos=(${repos%::*}) - for m in $onlyrepos; do - [[ ${PREFIX##${~~m}} != ${PREFIX} ]] && { - # Yes, complete with tags - repos=(${${repos/:::/:}/:/\\:}) - _describe -t docker-repos-with-tags "repositories with tags" repos && ret=0 - return ret - } - done - # No, only complete repositories - onlyrepos=(${${repos%:::*}/:/\\:}) - _describe -t docker-repos "repositories" onlyrepos -qS : && ret=0 - - return ret -} - -__docker_search() { - [[ $PREFIX = -* ]] && return 1 - local cache_policy - zstyle -s ":completion:${curcontext}:" cache-policy cache_policy - if [[ -z "$cache_policy" ]]; then - zstyle ":completion:${curcontext}:" cache-policy __docker_caching_policy - fi - - local searchterm cachename - searchterm="${words[$CURRENT]%/}" - cachename=_docker-search-$searchterm - - local expl - local -a result - if ( [[ ${(P)+cachename} -eq 0 ]] || _cache_invalid ${cachename#_} ) \ - && ! _retrieve_cache ${cachename#_}; then - _message "Searching for ${searchterm}..." - result=(${${${(f)${:-"$(_call_program commands docker $docker_options search $searchterm)"$'\n'}}%% *}[2,-1]}) - _store_cache ${cachename#_} result - fi - _wanted dockersearch expl 'available images' compadd -a result -} - -__docker_get_log_options() { - [[ $PREFIX = -* ]] && return 1 - - integer ret=1 - local log_driver=${opt_args[--log-driver]:-"all"} - local -a common_options common_options2 awslogs_options fluentd_options gelf_options journald_options json_file_options logentries_options syslog_options splunk_options - - common_options=("max-buffer-size" "mode") - common_options2=("env" "env-regex" "labels") - awslogs_options=($common_options "awslogs-create-group" "awslogs-datetime-format" "awslogs-group" "awslogs-multiline-pattern" "awslogs-region" "awslogs-stream" "tag") - fluentd_options=($common_options $common_options2 "fluentd-address" "fluentd-async-connect" "fluentd-buffer-limit" "fluentd-retry-wait" "fluentd-max-retries" "fluentd-sub-second-precision" "tag") - gcplogs_options=($common_options $common_options2 "gcp-log-cmd" "gcp-meta-id" "gcp-meta-name" "gcp-meta-zone" "gcp-project") - gelf_options=($common_options $common_options2 "gelf-address" "gelf-compression-level" "gelf-compression-type" "tag") - journald_options=($common_options $common_options2 "tag") - json_file_options=($common_options $common_options2 "max-file" "max-size") - logentries_options=($common_options $common_options2 "logentries-token" "tag") - syslog_options=($common_options $common_options2 "syslog-address" "syslog-facility" "syslog-format" "syslog-tls-ca-cert" "syslog-tls-cert" "syslog-tls-key" "syslog-tls-skip-verify" "tag") - splunk_options=($common_options $common_options2 "splunk-caname" "splunk-capath" "splunk-format" "splunk-gzip" "splunk-gzip-level" "splunk-index" "splunk-insecureskipverify" "splunk-source" "splunk-sourcetype" "splunk-token" "splunk-url" "splunk-verify-connection" "tag") - - [[ $log_driver = (awslogs|all) ]] && _describe -t awslogs-options "awslogs options" awslogs_options "$@" && ret=0 - [[ $log_driver = (fluentd|all) ]] && _describe -t fluentd-options "fluentd options" fluentd_options "$@" && ret=0 - [[ $log_driver = (gcplogs|all) ]] && _describe -t gcplogs-options "gcplogs options" gcplogs_options "$@" && ret=0 - [[ $log_driver = (gelf|all) ]] && _describe -t gelf-options "gelf options" gelf_options "$@" && ret=0 - [[ $log_driver = (journald|all) ]] && _describe -t journald-options "journald options" journald_options "$@" && ret=0 - [[ $log_driver = (json-file|all) ]] && _describe -t json-file-options "json-file options" json_file_options "$@" && ret=0 - [[ $log_driver = (logentries|all) ]] && _describe -t logentries-options "logentries options" logentries_options "$@" && ret=0 - [[ $log_driver = (syslog|all) ]] && _describe -t syslog-options "syslog options" syslog_options "$@" && ret=0 - [[ $log_driver = (splunk|all) ]] && _describe -t splunk-options "splunk options" splunk_options "$@" && ret=0 - - return ret -} - -__docker_complete_log_drivers() { - [[ $PREFIX = -* ]] && return 1 - integer ret=1 - drivers=(awslogs etwlogs fluentd gcplogs gelf journald json-file none splunk syslog) - _describe -t log-drivers "log drivers" drivers && ret=0 - return ret -} - -__docker_complete_log_options() { - [[ $PREFIX = -* ]] && return 1 - integer ret=1 - - if compset -P '*='; then - case "${${words[-1]%=*}#*=}" in - (syslog-format) - local opts=('rfc3164' 'rfc5424' 'rfc5424micro') - _describe -t syslog-format-opts "syslog format options" opts && ret=0 - ;; - (mode) - local opts=('blocking' 'non-blocking') - _describe -t mode-opts "mode options" opts && ret=0 - ;; - *) - _message 'value' && ret=0 - ;; - esac - else - __docker_get_log_options -qS "=" && ret=0 - fi - - return ret -} - -__docker_complete_detach_keys() { - [[ $PREFIX = -* ]] && return 1 - integer ret=1 - - compset -P "*," - keys=(${:-{a-z}}) - ctrl_keys=(${:-ctrl-{{a-z},{@,'[','\\','^',']',_}}}) - _describe -t detach_keys "[a-z]" keys -qS "," && ret=0 - _describe -t detach_keys-ctrl "'ctrl-' + 'a-z @ [ \\\\ ] ^ _'" ctrl_keys -qS "," && ret=0 -} - -__docker_complete_pid() { - [[ $PREFIX = -* ]] && return 1 - integer ret=1 - local -a opts vopts - - opts=('host') - vopts=('container') - - if compset -P '*:'; then - case "${${words[-1]%:*}#*=}" in - (container) - __docker_complete_running_containers && ret=0 - ;; - *) - _message 'value' && ret=0 - ;; - esac - else - _describe -t pid-value-opts "PID Options with value" vopts -qS ":" && ret=0 - _describe -t pid-opts "PID Options" opts && ret=0 - fi - - return ret -} - -__docker_complete_runtimes() { - [[ $PREFIX = -* ]] && return 1 - integer ret=1 - - emulate -L zsh - setopt extendedglob - local -a runtimes_opts - runtimes_opts=(${(ps: :)${(f)${${"$(_call_program commands docker $docker_options info)"##*$'\n'Runtimes: }%%$'\n'^ *}}}) - _describe -t runtimes-opts "runtimes options" runtimes_opts && ret=0 -} - -__docker_complete_ps_filters() { - [[ $PREFIX = -* ]] && return 1 - integer ret=1 - - if compset -P '*='; then - case "${${words[-1]%=*}#*=}" in - (ancestor) - __docker_complete_images && ret=0 - ;; - (before|since) - __docker_complete_containers && ret=0 - ;; - (health) - health_opts=('healthy' 'none' 'starting' 'unhealthy') - _describe -t health-filter-opts "health filter options" health_opts && ret=0 - ;; - (id) - __docker_complete_containers_ids && ret=0 - ;; - (is-task) - _describe -t boolean-filter-opts "filter options" boolean_opts && ret=0 - ;; - (name) - __docker_complete_containers_names && ret=0 - ;; - (network) - __docker_complete_networks && ret=0 - ;; - (status) - status_opts=('created' 'dead' 'exited' 'paused' 'restarting' 'running' 'removing') - _describe -t status-filter-opts "status filter options" status_opts && ret=0 - ;; - (volume) - __docker_complete_volumes && ret=0 - ;; - *) - _message 'value' && ret=0 - ;; - esac - else - opts=('ancestor' 'before' 'exited' 'expose' 'health' 'id' 'label' 'name' 'network' 'publish' 'since' 'status' 'volume') - _describe -t filter-opts "Filter Options" opts -qS "=" && ret=0 - fi - - return ret -} - -__docker_complete_search_filters() { - [[ $PREFIX = -* ]] && return 1 - integer ret=1 - declare -a boolean_opts opts - - boolean_opts=('true' 'false') - opts=('is-automated' 'is-official' 'stars') - - if compset -P '*='; then - case "${${words[-1]%=*}#*=}" in - (is-automated|is-official) - _describe -t boolean-filter-opts "filter options" boolean_opts && ret=0 - ;; - *) - _message 'value' && ret=0 - ;; - esac - else - _describe -t filter-opts "filter options" opts -qS "=" && ret=0 - fi - - return ret -} - -__docker_complete_images_filters() { - [[ $PREFIX = -* ]] && return 1 - integer ret=1 - declare -a boolean_opts opts - - boolean_opts=('true' 'false') - opts=('before' 'dangling' 'label' 'reference' 'since') - - if compset -P '*='; then - case "${${words[-1]%=*}#*=}" in - (before|reference|since) - __docker_complete_images && ret=0 - ;; - (dangling) - _describe -t boolean-filter-opts "filter options" boolean_opts && ret=0 - ;; - *) - _message 'value' && ret=0 - ;; - esac - else - _describe -t filter-opts "Filter Options" opts -qS "=" && ret=0 - fi - - return ret -} - -__docker_complete_events_filter() { - [[ $PREFIX = -* ]] && return 1 - integer ret=1 - declare -a opts - - opts=('container' 'daemon' 'event' 'image' 'label' 'network' 'scope' 'type' 'volume') - - if compset -P '*='; then - case "${${words[-1]%=*}#*=}" in - (container) - __docker_complete_containers && ret=0 - ;; - (daemon) - emulate -L zsh - setopt extendedglob - local -a daemon_opts - daemon_opts=( - ${(f)${${"$(_call_program commands docker $docker_options info)"##*$'\n'Name: }%%$'\n'^ *}} - ${${(f)${${"$(_call_program commands docker $docker_options info)"##*$'\n'ID: }%%$'\n'^ *}}//:/\\:} - ) - _describe -t daemon-filter-opts "daemon filter options" daemon_opts && ret=0 - ;; - (event) - local -a event_opts - event_opts=('attach' 'commit' 'connect' 'copy' 'create' 'delete' 'destroy' 'detach' 'die' 'disable' 'disconnect' 'enable' 'exec_create' 'exec_detach' - 'exec_start' 'export' 'health_status' 'import' 'install' 'kill' 'load' 'mount' 'oom' 'pause' 'pull' 'push' 'reload' 'remove' 'rename' 'resize' - 'restart' 'save' 'start' 'stop' 'tag' 'top' 'unmount' 'unpause' 'untag' 'update') - _describe -t event-filter-opts "event filter options" event_opts && ret=0 - ;; - (image) - __docker_complete_images && ret=0 - ;; - (network) - __docker_complete_networks && ret=0 - ;; - (scope) - local -a scope_opts - scope_opts=('local' 'swarm') - _describe -t scope-filter-opts "scope filter options" scope_opts && ret=0 - ;; - (type) - local -a type_opts - type_opts=('container' 'daemon' 'image' 'network' 'volume') - _describe -t type-filter-opts "type filter options" type_opts && ret=0 - ;; - (volume) - __docker_complete_volumes && ret=0 - ;; - *) - _message 'value' && ret=0 - ;; - esac - else - _describe -t filter-opts "filter options" opts -qS "=" && ret=0 - fi - - return ret -} - -__docker_complete_prune_filters() { - [[ $PREFIX = -* ]] && return 1 - integer ret=1 - declare -a opts - - opts=('until') - - if compset -P '*='; then - case "${${words[-1]%=*}#*=}" in - *) - _message 'value' && ret=0 - ;; - esac - else - _describe -t filter-opts "filter options" opts -qS "=" && ret=0 - fi - - return ret -} - -# BO checkpoint - -__docker_checkpoint_commands() { - local -a _docker_checkpoint_subcommands - _docker_checkpoint_subcommands=( - "create:Create a checkpoint from a running container" - "ls:List checkpoints for a container" - "rm:Remove a checkpoint" - ) - _describe -t docker-checkpoint-commands "docker checkpoint command" _docker_checkpoint_subcommands -} - -__docker_checkpoint_subcommand() { - local -a _command_args opts_help - local expl help="--help" - integer ret=1 - - opts_help=("(: -)--help[Print usage]") - - case "$words[1]" in - (create) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help)--checkpoint-dir=[Use a custom checkpoint storage directory]:dir:_directories" \ - "($help)--leave-running[Leave the container running after checkpoint]" \ - "($help -)1:container:__docker_complete_running_containers" \ - "($help -)2:checkpoint: " && ret=0 - ;; - (ls|list) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help)--checkpoint-dir=[Use a custom checkpoint storage directory]:dir:_directories" \ - "($help -)1:container:__docker_complete_containers" && ret=0 - ;; - (rm|remove) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help)--checkpoint-dir=[Use a custom checkpoint storage directory]:dir:_directories" \ - "($help -)1:container:__docker_complete_containers" \ - "($help -)2:checkpoint: " && ret=0 - ;; - (help) - _arguments $(__docker_arguments) ":subcommand:__docker_checkpoint_commands" && ret=0 - ;; - esac - - return ret -} - -# EO checkpoint - -# BO container - -__docker_container_commands() { - local -a _docker_container_subcommands - _docker_container_subcommands=( - "attach:Attach to a running container" - "commit:Create a new image from a container's changes" - "cp:Copy files/folders between a container and the local filesystem" - "create:Create a new container" - "diff:Inspect changes on a container's filesystem" - "exec:Run a command in a running container" - "export:Export a container's filesystem as a tar archive" - "inspect:Display detailed information on one or more containers" - "kill:Kill one or more running containers" - "logs:Fetch the logs of a container" - "ls:List containers" - "pause:Pause all processes within one or more containers" - "port:List port mappings or a specific mapping for the container" - "prune:Remove all stopped containers" - "rename:Rename a container" - "restart:Restart one or more containers" - "rm:Remove one or more containers" - "run:Run a command in a new container" - "start:Start one or more stopped containers" - "stats:Display a live stream of container(s) resource usage statistics" - "stop:Stop one or more running containers" - "top:Display the running processes of a container" - "unpause:Unpause all processes within one or more containers" - "update:Update configuration of one or more containers" - "wait:Block until one or more containers stop, then print their exit codes" - ) - _describe -t docker-container-commands "docker container command" _docker_container_subcommands -} - -__docker_container_subcommand() { - local -a _command_args opts_help opts_attach_exec_run_start opts_create_run opts_create_run_update - local expl help="--help" - integer ret=1 - - opts_attach_exec_run_start=( - "($help)--detach-keys=[Escape key sequence used to detach a container]:sequence:__docker_complete_detach_keys" - ) - opts_create_run=( - "($help -a --attach)"{-a=,--attach=}"[Attach to stdin, stdout or stderr]:device:(STDIN STDOUT STDERR)" - "($help)*--add-host=[Add a custom host-to-IP mapping]:host\:ip mapping: " - "($help)*--blkio-weight-device=[Block IO (relative device weight)]:device:Block IO weight: " - "($help)*--cap-add=[Add Linux capabilities]:capability: " - "($help)*--cap-drop=[Drop Linux capabilities]:capability: " - "($help)--cgroupns=[Cgroup namespace mode to use]:cgroup namespace mode: " - "($help)--cgroup-parent=[Parent cgroup for the container]:cgroup: " - "($help)--cidfile=[Write the container ID to the file]:CID file:_files" - "($help)--cpus=[Number of CPUs (default 0.000)]:cpus: " - "($help)*--device=[Add a host device to the container]:device:_files" - "($help)*--device-cgroup-rule=[Add a rule to the cgroup allowed devices list]:device:cgroup: " - "($help)*--device-read-bps=[Limit the read rate (bytes per second) from a device]:device:IO rate: " - "($help)*--device-read-iops=[Limit the read rate (IO per second) from a device]:device:IO rate: " - "($help)*--device-write-bps=[Limit the write rate (bytes per second) to a device]:device:IO rate: " - "($help)*--device-write-iops=[Limit the write rate (IO per second) to a device]:device:IO rate: " - "($help)--disable-content-trust[Skip image verification]" - "($help)*--dns=[Custom DNS servers]:DNS server: " - "($help)*--dns-option=[Custom DNS options]:DNS option: " - "($help)*--dns-search=[Custom DNS search domains]:DNS domains: " - "($help)*--domainname=[Container NIS domain name]:domainname:_hosts" - "($help)*"{-e=,--env=}"[Environment variables]:environment variable: " - "($help)--entrypoint=[Overwrite the default entrypoint of the image]:entry point: " - "($help)*--env-file=[Read environment variables from a file]:environment file:_files" - "($help)*--expose=[Expose a port from the container without publishing it]: " - "($help)*--gpus=[GPU devices to add to the container ('all' to pass all GPUs)]:device: " - "($help)*--group-add=[Set one or more supplementary user groups for the container]:group:_groups" - "($help -h --hostname)"{-h=,--hostname=}"[Container host name]:hostname:_hosts" - "($help -i --interactive)"{-i,--interactive}"[Keep stdin open even if not attached]" - "($help)--init[Run an init inside the container that forwards signals and reaps processes]" - "($help)--ip=[IPv4 address]:IPv4: " - "($help)--ip6=[IPv6 address]:IPv6: " - "($help)--ipc=[IPC namespace to use]:IPC namespace: " - "($help)--isolation=[Container isolation technology]:isolation:(default hyperv process)" - "($help)*--link=[Add link to another container]:link:->link" - "($help)*--link-local-ip=[Container IPv4/IPv6 link-local addresses]:IPv4/IPv6: " - "($help)*"{-l=,--label=}"[Container metadata]:label: " - "($help)--log-driver=[Default driver for container logs]:logging driver:__docker_complete_log_drivers" - "($help)*--log-opt=[Log driver specific options]:log driver options:__docker_complete_log_options" - "($help)--mac-address=[Container MAC address]:MAC address: " - "($help)*--mount=[Attach a filesystem mount to the container]:mount: " - "($help)--name=[Container name]:name: " - "($help)--network=[Connect a container to a network]:network mode:(bridge none container host)" - "($help)*--network-alias=[Add network-scoped alias for the container]:alias: " - "($help)--oom-kill-disable[Disable OOM Killer]" - "($help)--oom-score-adj[Tune the host's OOM preferences for containers (accepts -1000 to 1000)]" - "($help)--pids-limit[Tune container pids limit (set -1 for unlimited)]" - "($help -P --publish-all)"{-P,--publish-all}"[Publish all exposed ports]" - "($help)*"{-p=,--publish=}"[Expose a container's port to the host]:port:_ports" - "($help)--pid=[PID namespace to use]:PID namespace:__docker_complete_pid" - "($help)--privileged[Give extended privileges to this container]" - "($help)--read-only[Mount the container's root filesystem as read only]" - "($help)*--security-opt=[Security options]:security option: " - "($help)*--shm-size=[Size of '/dev/shm' (format is '')]:shm size: " - "($help)--stop-signal=[Signal to kill a container]:signal:_signals" - "($help)--stop-timeout=[Timeout (in seconds) to stop a container]:time: " - "($help)*--sysctl=-[sysctl options]:sysctl: " - "($help -t --tty)"{-t,--tty}"[Allocate a pseudo-tty]" - "($help -u --user)"{-u=,--user=}"[Username or UID]:user:_users" - "($help)*--ulimit=[ulimit options]:ulimit: " - "($help)--userns=[Container user namespace]:user namespace:(host)" - "($help)--tmpfs[mount tmpfs]" - "($help)*-v[Bind mount a volume]:volume: " - "($help)--volume-driver=[Optional volume driver for the container]:volume driver:(local)" - "($help)*--volumes-from=[Mount volumes from the specified container]:volume: " - "($help -w --workdir)"{-w=,--workdir=}"[Working directory inside the container]:directory:_directories" - ) - opts_create_run_update=( - "($help)--blkio-weight=[Block IO (relative weight), between 10 and 1000]:Block IO weight:(10 100 500 1000)" - "($help -c --cpu-shares)"{-c=,--cpu-shares=}"[CPU shares (relative weight)]:CPU shares:(0 10 100 200 500 800 1000)" - "($help)--cpu-period=[Limit the CPU CFS (Completely Fair Scheduler) period]:CPU period: " - "($help)--cpu-quota=[Limit the CPU CFS (Completely Fair Scheduler) quota]:CPU quota: " - "($help)--cpu-rt-period=[Limit the CPU real-time period]:CPU real-time period in microseconds: " - "($help)--cpu-rt-runtime=[Limit the CPU real-time runtime]:CPU real-time runtime in microseconds: " - "($help)--cpuset-cpus=[CPUs in which to allow execution]:CPUs: " - "($help)--cpuset-mems=[MEMs in which to allow execution]:MEMs: " - "($help)--kernel-memory=[Kernel memory limit in bytes]:Memory limit: " - "($help -m --memory)"{-m=,--memory=}"[Memory limit]:Memory limit: " - "($help)--memory-reservation=[Memory soft limit]:Memory limit: " - "($help)--memory-swap=[Total memory limit with swap]:Memory limit: " - "($help)--pids-limit[Tune container pids limit (set -1 for unlimited)]" - "($help)--restart=[Restart policy]:restart policy:(no on-failure always unless-stopped)" - ) - opts_help=("(: -)--help[Print usage]") - - case "$words[1]" in - (attach) - _arguments $(__docker_arguments) \ - $opts_help \ - $opts_attach_exec_run_start \ - "($help)--no-stdin[Do not attach stdin]" \ - "($help)--sig-proxy[Proxy all received signals to the process (non-TTY mode only)]" \ - "($help -):containers:__docker_complete_running_containers" && ret=0 - ;; - (commit) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -a --author)"{-a=,--author=}"[Author]:author: " \ - "($help)*"{-c=,--change=}"[Apply Dockerfile instruction to the created image]:Dockerfile:_files" \ - "($help -m --message)"{-m=,--message=}"[Commit message]:message: " \ - "($help -p --pause)"{-p,--pause}"[Pause container during commit]" \ - "($help -):container:__docker_complete_containers" \ - "($help -): :__docker_complete_repositories_with_tags" && ret=0 - ;; - (cp) - local state - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -L --follow-link)"{-L,--follow-link}"[Always follow symbol link]" \ - "($help -)1:container:->container" \ - "($help -)2:hostpath:_files" && ret=0 - case $state in - (container) - if compset -P "*:"; then - _files && ret=0 - else - __docker_complete_containers -qS ":" && ret=0 - fi - ;; - esac - ;; - (create) - local state - _arguments $(__docker_arguments) \ - $opts_help \ - $opts_create_run \ - $opts_create_run_update \ - "($help -): :__docker_complete_images" \ - "($help -):command: _command_names -e" \ - "($help -)*::arguments: _normal" && ret=0 - case $state in - (link) - if compset -P "*:"; then - _wanted alias expl "Alias" compadd -E "" && ret=0 - else - __docker_complete_running_containers -qS ":" && ret=0 - fi - ;; - esac - ;; - (diff) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -)*:containers:__docker_complete_containers" && ret=0 - ;; - (exec) - local state - _arguments $(__docker_arguments) \ - $opts_help \ - $opts_attach_exec_run_start \ - "($help -d --detach)"{-d,--detach}"[Detached mode: leave the container running in the background]" \ - "($help)*"{-e=,--env=}"[Set environment variables]:environment variable: " \ - "($help)*--env-file=[Read environment variables from a file]:environment file:_files" \ - "($help -i --interactive)"{-i,--interactive}"[Keep stdin open even if not attached]" \ - "($help)--privileged[Give extended Linux capabilities to the command]" \ - "($help -t --tty)"{-t,--tty}"[Allocate a pseudo-tty]" \ - "($help -u --user)"{-u=,--user=}"[Username or UID]:user:_users" \ - "($help -w --workdir)"{-w=,--workdir=}"[Working directory inside the container]:directory:_directories" \ - "($help -):containers:__docker_complete_running_containers" \ - "($help -)*::command:->anycommand" && ret=0 - case $state in - (anycommand) - shift 1 words - (( CURRENT-- )) - _normal && ret=0 - ;; - esac - ;; - (export) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -o --output)"{-o=,--output=}"[Write to a file, instead of stdout]:output file:_files" \ - "($help -)*:containers:__docker_complete_containers" && ret=0 - ;; - (inspect) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -f --format)"{-f=,--format=}"[Format the output using the given go template]:template: " \ - "($help -s --size)"{-s,--size}"[Display total file sizes]" \ - "($help -)*:containers:__docker_complete_containers" && ret=0 - ;; - (kill) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -s --signal)"{-s=,--signal=}"[Signal to send]:signal:_signals" \ - "($help -)*:containers:__docker_complete_running_containers" && ret=0 - ;; - (logs) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help)--details[Show extra details provided to logs]" \ - "($help -f --follow)"{-f,--follow}"[Follow log output]" \ - "($help -s --since)"{-s=,--since=}"[Show logs since this timestamp]:timestamp: " \ - "($help -t --timestamps)"{-t,--timestamps}"[Show timestamps]" \ - "($help -n --tail)"{-n=,--tail=}"[Number of lines to show from the end of the logs]:lines:(1 10 20 50 all)" \ - "($help -)*:containers:__docker_complete_containers" && ret=0 - ;; - (ls|list) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -a --all)"{-a,--all}"[Show all containers]" \ - "($help)--before=[Show only container created before...]:containers:__docker_complete_containers" \ - "($help)*"{-f=,--filter=}"[Filter values]:filter:__docker_complete_ps_filters" \ - "($help)--format=[Pretty-print containers using a Go template]:template: " \ - "($help -l --latest)"{-l,--latest}"[Show only the latest created container]" \ - "($help -n --last)"{-n=,--last=}"[Show n last created containers (includes all states)]:n:(1 5 10 25 50)" \ - "($help)--no-trunc[Do not truncate output]" \ - "($help -q --quiet)"{-q,--quiet}"[Only show container IDs]" \ - "($help -s --size)"{-s,--size}"[Display total file sizes]" \ - "($help)--since=[Show only containers created since...]:containers:__docker_complete_containers" && ret=0 - ;; - (pause|unpause) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -)*:containers:__docker_complete_running_containers" && ret=0 - ;; - (port) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -)1:containers:__docker_complete_running_containers" \ - "($help -)2:port:_ports" && ret=0 - ;; - (prune) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help)*--filter=[Filter values]:filter:__docker_complete_prune_filters" \ - "($help -f --force)"{-f,--force}"[Do not prompt for confirmation]" && ret=0 - ;; - (rename) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -):old name:__docker_complete_containers" \ - "($help -):new name: " && ret=0 - ;; - (restart) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -t --time)"{-t=,--time=}"[Number of seconds to try to stop for before killing the container]:seconds to before killing:(1 5 10 30 60)" \ - "($help -)*:containers:__docker_complete_containers" && ret=0 - ;; - (rm) - local state - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -f --force)"{-f,--force}"[Force removal]" \ - "($help -l --link)"{-l,--link}"[Remove the specified link and not the underlying container]" \ - "($help -v --volumes)"{-v,--volumes}"[Remove the volumes associated to the container]" \ - "($help -)*:containers:->values" && ret=0 - case $state in - (values) - if [[ ${words[(r)-f]} == -f || ${words[(r)--force]} == --force ]]; then - __docker_complete_containers && ret=0 - else - __docker_complete_stopped_containers && ret=0 - fi - ;; - esac - ;; - (run) - local state - _arguments $(__docker_arguments) \ - $opts_help \ - $opts_create_run \ - $opts_create_run_update \ - $opts_attach_exec_run_start \ - "($help -d --detach)"{-d,--detach}"[Detached mode: leave the container running in the background]" \ - "($help)--health-cmd=[Command to run to check health]:command: " \ - "($help)--health-interval=[Time between running the check]:time: " \ - "($help)--health-retries=[Consecutive failures needed to report unhealthy]:retries:(1 2 3 4 5)" \ - "($help)--health-timeout=[Maximum time to allow one check to run]:time: " \ - "($help)--no-healthcheck[Disable any container-specified HEALTHCHECK]" \ - "($help)--rm[Remove intermediate containers when it exits]" \ - "($help)--runtime=[Name of the runtime to be used for that container]:runtime:__docker_complete_runtimes" \ - "($help)--sig-proxy[Proxy all received signals to the process (non-TTY mode only)]" \ - "($help)--storage-opt=[Storage driver options for the container]:storage options:->storage-opt" \ - "($help -): :__docker_complete_images" \ - "($help -):command: _command_names -e" \ - "($help -)*::arguments: _normal" && ret=0 - case $state in - (link) - if compset -P "*:"; then - _wanted alias expl "Alias" compadd -E "" && ret=0 - else - __docker_complete_running_containers -qS ":" && ret=0 - fi - ;; - (storage-opt) - if compset -P "*="; then - _message "value" && ret=0 - else - opts=('size') - _describe -t filter-opts "storage options" opts -qS "=" && ret=0 - fi - ;; - esac - ;; - (start) - _arguments $(__docker_arguments) \ - $opts_help \ - $opts_attach_exec_run_start \ - "($help -a --attach)"{-a,--attach}"[Attach container's stdout/stderr and forward all signals]" \ - "($help -i --interactive)"{-i,--interactive}"[Attach container's stdin]" \ - "($help -)*:containers:__docker_complete_stopped_containers" && ret=0 - ;; - (stats) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -a --all)"{-a,--all}"[Show all containers (default shows just running)]" \ - "($help)--format=[Pretty-print images using a Go template]:template: " \ - "($help)--no-stream[Disable streaming stats and only pull the first result]" \ - "($help)--no-trunc[Do not truncate output]" \ - "($help -)*:containers:__docker_complete_running_containers" && ret=0 - ;; - (stop) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -t --time)"{-t=,--time=}"[Number of seconds to try to stop for before killing the container]:seconds to before killing:(1 5 10 30 60)" \ - "($help -)*:containers:__docker_complete_running_containers" && ret=0 - ;; - (top) - local state - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -)1:containers:__docker_complete_running_containers" \ - "($help -)*:: :->ps-arguments" && ret=0 - case $state in - (ps-arguments) - _ps && ret=0 - ;; - esac - ;; - (update) - local state - _arguments $(__docker_arguments) \ - $opts_help \ - $opts_create_run_update \ - "($help -)*: :->values" && ret=0 - case $state in - (values) - if [[ ${words[(r)--kernel-memory*]} = (--kernel-memory*) ]]; then - __docker_complete_stopped_containers && ret=0 - else - __docker_complete_containers && ret=0 - fi - ;; - esac - ;; - (wait) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -)*:containers:__docker_complete_running_containers" && ret=0 - ;; - (help) - _arguments $(__docker_arguments) ":subcommand:__docker_container_commands" && ret=0 - ;; - esac - - return ret -} - -# EO container - -# BO image - -__docker_image_commands() { - local -a _docker_image_subcommands - _docker_image_subcommands=( - "build:Build an image from a Dockerfile" - "history:Show the history of an image" - "import:Import the contents from a tarball to create a filesystem image" - "inspect:Display detailed information on one or more images" - "load:Load an image from a tar archive or STDIN" - "ls:List images" - "prune:Remove unused images" - "pull:Pull an image or a repository from a registry" - "push:Push an image or a repository to a registry" - "rm:Remove one or more images" - "save:Save one or more images to a tar archive (streamed to STDOUT by default)" - "tag:Tag an image into a repository" - ) - _describe -t docker-image-commands "docker image command" _docker_image_subcommands -} - -__docker_image_subcommand() { - local -a _command_args opts_help - local expl help="--help" - integer ret=1 - - opts_help=("(: -)--help[Print usage]") - - case "$words[1]" in - (build) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help)*--add-host=[Add a custom host-to-IP mapping]:host\:ip mapping: " \ - "($help)*--build-arg=[Build-time variables]:=: " \ - "($help)*--cache-from=[Images to consider as cache sources]: :__docker_complete_repositories_with_tags" \ - "($help -c --cpu-shares)"{-c=,--cpu-shares=}"[CPU shares (relative weight)]:CPU shares:(0 10 100 200 500 800 1000)" \ - "($help)--cgroup-parent=[Parent cgroup for the container]:cgroup: " \ - "($help)--compress[Compress the build context using gzip]" \ - "($help)--cpu-period=[Limit the CPU CFS (Completely Fair Scheduler) period]:CPU period: " \ - "($help)--cpu-quota=[Limit the CPU CFS (Completely Fair Scheduler) quota]:CPU quota: " \ - "($help)--cpu-rt-period=[Limit the CPU real-time period]:CPU real-time period in microseconds: " \ - "($help)--cpu-rt-runtime=[Limit the CPU real-time runtime]:CPU real-time runtime in microseconds: " \ - "($help)--cpuset-cpus=[CPUs in which to allow execution]:CPUs: " \ - "($help)--cpuset-mems=[MEMs in which to allow execution]:MEMs: " \ - "($help)--disable-content-trust[Skip image verification]" \ - "($help -f --file)"{-f=,--file=}"[Name of the Dockerfile]:Dockerfile:_files" \ - "($help)--force-rm[Always remove intermediate containers]" \ - "($help)--isolation=[Container isolation technology]:isolation:(default hyperv process)" \ - "($help)*--label=[Set metadata for an image]:label=value: " \ - "($help -m --memory)"{-m=,--memory=}"[Memory limit]:Memory limit: " \ - "($help)--memory-swap=[Total memory limit with swap]:Memory limit: " \ - "($help)--network=[Connect a container to a network]:network mode:(bridge none container host)" \ - "($help)--no-cache[Do not use cache when building the image]" \ - "($help)--pull[Attempt to pull a newer version of the image]" \ - "($help -q --quiet)"{-q,--quiet}"[Suppress verbose build output]" \ - "($help)--rm[Remove intermediate containers after a successful build]" \ - "($help)*--shm-size=[Size of '/dev/shm' (format is '')]:shm size: " \ - "($help)--squash[Squash newly built layers into a single new layer]" \ - "($help -t --tag)*"{-t=,--tag=}"[Repository, name and tag for the image]: :__docker_complete_repositories_with_tags" \ - "($help)--target=[Set the target build stage to build.]" \ - "($help)*--ulimit=[ulimit options]:ulimit: " \ - "($help)--userns=[Container user namespace]:user namespace:(host)" \ - "($help -):path or URL:_directories" && ret=0 - ;; - (history) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -H --human)"{-H,--human}"[Print sizes and dates in human readable format]" \ - "($help)--no-trunc[Do not truncate output]" \ - "($help -q --quiet)"{-q,--quiet}"[Only show image IDs]" \ - "($help -)*: :__docker_complete_images" && ret=0 - ;; - (import) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help)*"{-c=,--change=}"[Apply Dockerfile instruction to the created image]:Dockerfile:_files" \ - "($help -m --message)"{-m=,--message=}"[Commit message for imported image]:message: " \ - "($help -):URL:(- http:// file://)" \ - "($help -): :__docker_complete_repositories_with_tags" && ret=0 - ;; - (inspect) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -f --format)"{-f=,--format=}"[Format the output using the given go template]:template: " \ - "($help -)*:images:__docker_complete_images" && ret=0 - ;; - (load) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -i --input)"{-i=,--input=}"[Read from tar archive file]:archive file:_files -g \"*.((tar|TAR)(.gz|.GZ|.Z|.bz2|.lzma|.xz|)|(tbz|tgz|txz))(-.)\"" \ - "($help -q --quiet)"{-q,--quiet}"[Suppress the load output]" && ret=0 - ;; - (ls|list) - local state - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -a --all)"{-a,--all}"[Show all images]" \ - "($help)--digests[Show digests]" \ - "($help)*"{-f=,--filter=}"[Filter values]:filter:__docker_complete_images_filters" \ - "($help)--format=[Pretty-print images using a Go template]:template: " \ - "($help)--no-trunc[Do not truncate output]" \ - "($help -q --quiet)"{-q,--quiet}"[Only show image IDs]" \ - "($help -): :__docker_complete_repositories" && ret=0 - ;; - (prune) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -a --all)"{-a,--all}"[Remove all unused images, not just dangling ones]" \ - "($help)*--filter=[Filter values]:filter:__docker_complete_prune_filters" \ - "($help -f --force)"{-f,--force}"[Do not prompt for confirmation]" && ret=0 - ;; - (pull) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -a --all-tags)"{-a,--all-tags}"[Download all tagged images]" \ - "($help)--disable-content-trust[Skip image verification]" \ - "($help -):name:__docker_search" && ret=0 - ;; - (push) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -a --all-tags)"{-a,--all-tags}"[Push all tagged images in the repository]" \ - "($help)--disable-content-trust[Skip image signing]" \ - "($help -): :__docker_complete_images" && ret=0 - ;; - (rm) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -f --force)"{-f,--force}"[Force removal]" \ - "($help)--no-prune[Do not delete untagged parents]" \ - "($help -)*: :__docker_complete_images" && ret=0 - ;; - (save) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -o --output)"{-o=,--output=}"[Write to file]:file:_files" \ - "($help -)*: :__docker_complete_images" && ret=0 - ;; - (tag) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -):source:__docker_complete_images"\ - "($help -):destination:__docker_complete_repositories_with_tags" && ret=0 - ;; - (help) - _arguments $(__docker_arguments) ":subcommand:__docker_container_commands" && ret=0 - ;; - esac - - return ret -} - -# EO image - -# BO network - -__docker_network_complete_ls_filters() { - [[ $PREFIX = -* ]] && return 1 - integer ret=1 - - if compset -P '*='; then - case "${${words[-1]%=*}#*=}" in - (driver) - __docker_complete_info_plugins Network && ret=0 - ;; - (id) - __docker_complete_networks_ids && ret=0 - ;; - (name) - __docker_complete_networks_names && ret=0 - ;; - (scope) - opts=('global' 'local' 'swarm') - _describe -t scope-filter-opts "Scope filter options" opts && ret=0 - ;; - (type) - opts=('builtin' 'custom') - _describe -t type-filter-opts "Type filter options" opts && ret=0 - ;; - *) - _message 'value' && ret=0 - ;; - esac - else - opts=('driver' 'id' 'label' 'name' 'scope' 'type') - _describe -t filter-opts "Filter Options" opts -qS "=" && ret=0 - fi - - return ret -} - -__docker_get_networks() { - [[ $PREFIX = -* ]] && return 1 - integer ret=1 - local line s - declare -a lines networks - - type=$1; shift - - lines=(${(f)${:-"$(_call_program commands docker $docker_options network ls)"$'\n'}}) - - # Parse header line to find columns - local i=1 j=1 k header=${lines[1]} - declare -A begin end - while (( j < ${#header} - 1 )); do - i=$(( j + ${${header[$j,-1]}[(i)[^ ]]} - 1 )) - j=$(( i + ${${header[$i,-1]}[(i) ]} - 1 )) - k=$(( j + ${${header[$j,-1]}[(i)[^ ]]} - 2 )) - begin[${header[$i,$((j-1))]}]=$i - end[${header[$i,$((j-1))]}]=$k - done - end[${header[$i,$((j-1))]}]=-1 - lines=(${lines[2,-1]}) - - # Network ID - if [[ $type = (ids|all) ]]; then - for line in $lines; do - s="${line[${begin[NETWORK ID]},${end[NETWORK ID]}]%% ##}" - s="$s:${(l:7:: :::)${${line[${begin[DRIVER]},${end[DRIVER]}]}%% ##}}" - s="$s, ${${line[${begin[SCOPE]},${end[SCOPE]}]}%% ##}" - networks=($networks $s) - done - fi - - # Names - if [[ $type = (names|all) ]]; then - for line in $lines; do - s="${line[${begin[NAME]},${end[NAME]}]%% ##}" - s="$s:${(l:7:: :::)${${line[${begin[DRIVER]},${end[DRIVER]}]}%% ##}}" - s="$s, ${${line[${begin[SCOPE]},${end[SCOPE]}]}%% ##}" - networks=($networks $s) - done - fi - - _describe -t networks-list "networks" networks "$@" && ret=0 - return ret -} - -__docker_complete_networks() { - [[ $PREFIX = -* ]] && return 1 - __docker_get_networks all "$@" -} - -__docker_complete_networks_ids() { - [[ $PREFIX = -* ]] && return 1 - __docker_get_networks ids "$@" -} - -__docker_complete_networks_names() { - [[ $PREFIX = -* ]] && return 1 - __docker_get_networks names "$@" -} - -__docker_network_commands() { - local -a _docker_network_subcommands - _docker_network_subcommands=( - "connect:Connect a container to a network" - "create:Creates a new network with a name specified by the user" - "disconnect:Disconnects a container from a network" - "inspect:Displays detailed information on a network" - "ls:Lists all the networks created by the user" - "prune:Remove all unused networks" - "rm:Deletes one or more networks" - ) - _describe -t docker-network-commands "docker network command" _docker_network_subcommands -} - -__docker_network_subcommand() { - local -a _command_args opts_help - local expl help="--help" - integer ret=1 - - opts_help=("(: -)--help[Print usage]") - - case "$words[1]" in - (connect) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help)*--alias=[Add network-scoped alias for the container]:alias: " \ - "($help)--ip=[IPv4 address]:IPv4: " \ - "($help)--ip6=[IPv6 address]:IPv6: " \ - "($help)*--link=[Add a link to another container]:link:->link" \ - "($help)*--link-local-ip=[Add a link-local address for the container]:IPv4/IPv6: " \ - "($help -)1:network:__docker_complete_networks" \ - "($help -)2:containers:__docker_complete_containers" && ret=0 - - case $state in - (link) - if compset -P "*:"; then - _wanted alias expl "Alias" compadd -E "" && ret=0 - else - __docker_complete_running_containers -qS ":" && ret=0 - fi - ;; - esac - ;; - (create) - _arguments $(__docker_arguments) -A '-*' \ - $opts_help \ - "($help)--attachable[Enable manual container attachment]" \ - "($help)*--aux-address[Auxiliary IPv4 or IPv6 addresses used by network driver]:key=IP: " \ - "($help -d --driver)"{-d=,--driver=}"[Driver to manage the Network]:driver:(null host bridge overlay)" \ - "($help)*--gateway=[IPv4 or IPv6 Gateway for the master subnet]:IP: " \ - "($help)--internal[Restricts external access to the network]" \ - "($help)*--ip-range=[Allocate container ip from a sub-range]:IP/mask: " \ - "($help)--ipam-driver=[IP Address Management Driver]:driver:(default)" \ - "($help)*--ipam-opt=[Custom IPAM plugin options]:opt=value: " \ - "($help)--ipv6[Enable IPv6 networking]" \ - "($help)*--label=[Set metadata on a network]:label=value: " \ - "($help)*"{-o=,--opt=}"[Driver specific options]:opt=value: " \ - "($help)*--subnet=[Subnet in CIDR format that represents a network segment]:IP/mask: " \ - "($help -)1:Network Name: " && ret=0 - ;; - (disconnect) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -)1:network:__docker_complete_networks" \ - "($help -)2:containers:__docker_complete_containers" && ret=0 - ;; - (inspect) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -f --format)"{-f=,--format=}"[Format the output using the given go template]:template: " \ - "($help)--verbose[Show detailed information]" \ - "($help -)*:network:__docker_complete_networks" && ret=0 - ;; - (ls) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help)--no-trunc[Do not truncate the output]" \ - "($help)*"{-f=,--filter=}"[Provide filter values]:filter:__docker_network_complete_ls_filters" \ - "($help)--format=[Pretty-print networks using a Go template]:template: " \ - "($help -q --quiet)"{-q,--quiet}"[Only display network IDs]" && ret=0 - ;; - (prune) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help)*--filter=[Filter values]:filter:__docker_complete_prune_filters" \ - "($help -f --force)"{-f,--force}"[Do not prompt for confirmation]" && ret=0 - ;; - (rm) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -)*:network:__docker_complete_networks" && ret=0 - ;; - (help) - _arguments $(__docker_arguments) ":subcommand:__docker_network_commands" && ret=0 - ;; - esac - - return ret -} - -# EO network - -# BO node - -__docker_node_complete_ls_filters() { - [[ $PREFIX = -* ]] && return 1 - integer ret=1 - - if compset -P '*='; then - case "${${words[-1]%=*}#*=}" in - (id) - __docker_complete_nodes_ids && ret=0 - ;; - (membership) - membership_opts=('accepted' 'pending' 'rejected') - _describe -t membership-opts "membership options" membership_opts && ret=0 - ;; - (name) - __docker_complete_nodes_names && ret=0 - ;; - (role) - role_opts=('manager' 'worker') - _describe -t role-opts "role options" role_opts && ret=0 - ;; - *) - _message 'value' && ret=0 - ;; - esac - else - opts=('id' 'label' 'membership' 'name' 'role') - _describe -t filter-opts "filter options" opts -qS "=" && ret=0 - fi - - return ret -} - -__docker_node_complete_ps_filters() { - [[ $PREFIX = -* ]] && return 1 - integer ret=1 - - if compset -P '*='; then - case "${${words[-1]%=*}#*=}" in - (desired-state) - state_opts=('accepted' 'running' 'shutdown') - _describe -t state-opts "desired state options" state_opts && ret=0 - ;; - *) - _message 'value' && ret=0 - ;; - esac - else - opts=('desired-state' 'id' 'label' 'name') - _describe -t filter-opts "filter options" opts -qS "=" && ret=0 - fi - - return ret -} - -__docker_nodes() { - [[ $PREFIX = -* ]] && return 1 - integer ret=1 - local line s - declare -a lines nodes args - - type=$1; shift - filter=$1; shift - [[ $filter != "none" ]] && args=("-f $filter") - - lines=(${(f)${:-"$(_call_program commands docker $docker_options node ls $args)"$'\n'}}) - # Parse header line to find columns - local i=1 j=1 k header=${lines[1]} - declare -A begin end - while (( j < ${#header} - 1 )); do - i=$(( j + ${${header[$j,-1]}[(i)[^ ]]} - 1 )) - j=$(( i + ${${header[$i,-1]}[(i) ]} - 1 )) - k=$(( j + ${${header[$j,-1]}[(i)[^ ]]} - 2 )) - begin[${header[$i,$((j-1))]}]=$i - end[${header[$i,$((j-1))]}]=$k - done - end[${header[$i,$((j-1))]}]=-1 - lines=(${lines[2,-1]}) - - # Node ID - if [[ $type = (ids|all) ]]; then - for line in $lines; do - s="${line[${begin[ID]},${end[ID]}]%% ##}" - nodes=($nodes $s) - done - fi - - # Names - if [[ $type = (names|all) ]]; then - for line in $lines; do - s="${line[${begin[HOSTNAME]},${end[HOSTNAME]}]%% ##}" - nodes=($nodes $s) - done - fi - - _describe -t nodes-list "nodes" nodes "$@" && ret=0 - return ret -} - -__docker_complete_nodes() { - [[ $PREFIX = -* ]] && return 1 - __docker_nodes all none "$@" -} - -__docker_complete_nodes_ids() { - [[ $PREFIX = -* ]] && return 1 - __docker_nodes ids none "$@" -} - -__docker_complete_nodes_names() { - [[ $PREFIX = -* ]] && return 1 - __docker_nodes names none "$@" -} - -__docker_complete_pending_nodes() { - [[ $PREFIX = -* ]] && return 1 - __docker_nodes all "membership=pending" "$@" -} - -__docker_complete_manager_nodes() { - [[ $PREFIX = -* ]] && return 1 - __docker_nodes all "role=manager" "$@" -} - -__docker_complete_worker_nodes() { - [[ $PREFIX = -* ]] && return 1 - __docker_nodes all "role=worker" "$@" -} - -__docker_node_commands() { - local -a _docker_node_subcommands - _docker_node_subcommands=( - "demote:Demote a node as manager in the swarm" - "inspect:Display detailed information on one or more nodes" - "ls:List nodes in the swarm" - "promote:Promote a node as manager in the swarm" - "rm:Remove one or more nodes from the swarm" - "ps:List tasks running on one or more nodes, defaults to current node" - "update:Update a node" - ) - _describe -t docker-node-commands "docker node command" _docker_node_subcommands -} - -__docker_node_subcommand() { - local -a _command_args opts_help - local expl help="--help" - integer ret=1 - - opts_help=("(: -)--help[Print usage]") - - case "$words[1]" in - (rm|remove) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -f --force)"{-f,--force}"[Force remove a node from the swarm]" \ - "($help -)*:node:__docker_complete_pending_nodes" && ret=0 - ;; - (demote) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -)*:node:__docker_complete_manager_nodes" && ret=0 - ;; - (inspect) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -f --format)"{-f=,--format=}"[Format the output using the given go template]:template: " \ - "($help)--pretty[Print the information in a human friendly format]" \ - "($help -)*:node:__docker_complete_nodes" && ret=0 - ;; - (ls|list) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help)*"{-f=,--filter=}"[Provide filter values]:filter:__docker_node_complete_ls_filters" \ - "($help -q --quiet)"{-q,--quiet}"[Only display IDs]" && ret=0 - ;; - (promote) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -)*:node:__docker_complete_worker_nodes" && ret=0 - ;; - (ps) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -a --all)"{-a,--all}"[Display all instances]" \ - "($help)*"{-f=,--filter=}"[Provide filter values]:filter:__docker_node_complete_ps_filters" \ - "($help)--format=[Format the output using the given go template]:template: " \ - "($help)--no-resolve[Do not map IDs to Names]" \ - "($help)--no-trunc[Do not truncate output]" \ - "($help -q --quiet)"{-q,--quiet}"[Only display IDs]" \ - "($help -)*:node:__docker_complete_nodes" && ret=0 - ;; - (update) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help)--availability=[Availability of the node]:availability:(active pause drain)" \ - "($help)*--label-add=[Add or update a node label]:key=value: " \ - "($help)*--label-rm=[Remove a node label if exists]:label: " \ - "($help)--role=[Role of the node]:role:(manager worker)" \ - "($help -)1:node:__docker_complete_nodes" && ret=0 - ;; - (help) - _arguments $(__docker_arguments) ":subcommand:__docker_node_commands" && ret=0 - ;; - esac - - return ret -} - -# EO node - -# BO plugin - -__docker_plugin_complete_ls_filters() { - [[ $PREFIX = -* ]] && return 1 - integer ret=1 - - if compset -P '*='; then - case "${${words[-1]%=*}#*=}" in - (capability) - opts=('authz' 'ipamdriver' 'logdriver' 'metricscollector' 'networkdriver' 'volumedriver') - _describe -t capability-opts "capability options" opts && ret=0 - ;; - (enabled) - opts=('false' 'true') - _describe -t enabled-opts "enabled options" opts && ret=0 - ;; - *) - _message 'value' && ret=0 - ;; - esac - else - opts=('capability' 'enabled') - _describe -t filter-opts "filter options" opts -qS "=" && ret=0 - fi - - return ret -} - -__docker_plugins() { - [[ $PREFIX = -* ]] && return 1 - integer ret=1 - local line s - declare -a lines plugins args - - filter=$1; shift - [[ $filter != "none" ]] && args=("-f $filter") - - lines=(${(f)${:-"$(_call_program commands docker $docker_options plugin ls $args)"$'\n'}}) - - # Parse header line to find columns - local i=1 j=1 k header=${lines[1]} - declare -A begin end - while (( j < ${#header} - 1 )); do - i=$(( j + ${${header[$j,-1]}[(i)[^ ]]} - 1 )) - j=$(( i + ${${header[$i,-1]}[(i) ]} - 1 )) - k=$(( j + ${${header[$j,-1]}[(i)[^ ]]} - 2 )) - begin[${header[$i,$((j-1))]}]=$i - end[${header[$i,$((j-1))]}]=$k - done - end[${header[$i,$((j-1))]}]=-1 - lines=(${lines[2,-1]}) - - # Name - for line in $lines; do - s="${line[${begin[NAME]},${end[NAME]}]%% ##}" - s="$s:${(l:7:: :::)${${line[${begin[TAG]},${end[TAG]}]}%% ##}}" - plugins=($plugins $s) - done - - _describe -t plugins-list "plugins" plugins "$@" && ret=0 - return ret -} - -__docker_complete_plugins() { - [[ $PREFIX = -* ]] && return 1 - __docker_plugins none "$@" -} - -__docker_complete_enabled_plugins() { - [[ $PREFIX = -* ]] && return 1 - __docker_plugins enabled=true "$@" -} - -__docker_complete_disabled_plugins() { - [[ $PREFIX = -* ]] && return 1 - __docker_plugins enabled=false "$@" -} - -__docker_plugin_commands() { - local -a _docker_plugin_subcommands - _docker_plugin_subcommands=( - "disable:Disable a plugin" - "enable:Enable a plugin" - "inspect:Return low-level information about a plugin" - "install:Install a plugin" - "ls:List plugins" - "push:Push a plugin" - "rm:Remove a plugin" - "set:Change settings for a plugin" - "upgrade:Upgrade an existing plugin" - ) - _describe -t docker-plugin-commands "docker plugin command" _docker_plugin_subcommands -} - -__docker_plugin_subcommand() { - local -a _command_args opts_help - local expl help="--help" - integer ret=1 - - opts_help=("(: -)--help[Print usage]") - - case "$words[1]" in - (disable) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -f --force)"{-f,--force}"[Force the disable of an active plugin]" \ - "($help -)1:plugin:__docker_complete_enabled_plugins" && ret=0 - ;; - (enable) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help)--timeout=[HTTP client timeout (in seconds)]:timeout: " \ - "($help -)1:plugin:__docker_complete_disabled_plugins" && ret=0 - ;; - (inspect) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -f --format)"{-f=,--format=}"[Format the output using the given Go template]:template: " \ - "($help -)*:plugin:__docker_complete_plugins" && ret=0 - ;; - (install) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help)--alias=[Local name for plugin]:alias: " \ - "($help)--disable[Do not enable the plugin on install]" \ - "($help)--disable-content-trust[Skip image verification (default true)]" \ - "($help)--grant-all-permissions[Grant all permissions necessary to run the plugin]" \ - "($help -)1:plugin:__docker_complete_plugins" \ - "($help -)*:key=value: " && ret=0 - ;; - (ls|list) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help)*"{-f=,--filter=}"[Filter output based on conditions provided]:filter:__docker_plugin_complete_ls_filters" \ - "($help --format)--format=[Format the output using the given Go template]:template: " \ - "($help)--no-trunc[Don't truncate output]" \ - "($help -q --quiet)"{-q,--quiet}"[Only display IDs]" && ret=0 - ;; - (push) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help)--disable-content-trust[Skip image verification (default true)]" \ - "($help -)1:plugin:__docker_complete_plugins" && ret=0 - ;; - (rm|remove) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -f --force)"{-f,--force}"[Force the removal of an active plugin]" \ - "($help -)*:plugin:__docker_complete_plugins" && ret=0 - ;; - (set) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -)1:plugin:__docker_complete_plugins" \ - "($help -)*:key=value: " && ret=0 - ;; - (upgrade) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help)--disable-content-trust[Skip image verification (default true)]" \ - "($help)--grant-all-permissions[Grant all permissions necessary to run the plugin]" \ - "($help)--skip-remote-check[Do not check if specified remote plugin matches existing plugin image]" \ - "($help -)1:plugin:__docker_complete_plugins" \ - "($help -):remote: " && ret=0 - ;; - (help) - _arguments $(__docker_arguments) ":subcommand:__docker_plugin_commands" && ret=0 - ;; - esac - - return ret -} - -# EO plugin - -# BO secret - -__docker_secrets() { - [[ $PREFIX = -* ]] && return 1 - integer ret=1 - local line s - declare -a lines secrets - - type=$1; shift - - lines=(${(f)${:-"$(_call_program commands docker $docker_options secret ls)"$'\n'}}) - - # Parse header line to find columns - local i=1 j=1 k header=${lines[1]} - declare -A begin end - while (( j < ${#header} - 1 )); do - i=$(( j + ${${header[$j,-1]}[(i)[^ ]]} - 1 )) - j=$(( i + ${${header[$i,-1]}[(i) ]} - 1 )) - k=$(( j + ${${header[$j,-1]}[(i)[^ ]]} - 2 )) - begin[${header[$i,$((j-1))]}]=$i - end[${header[$i,$((j-1))]}]=$k - done - end[${header[$i,$((j-1))]}]=-1 - lines=(${lines[2,-1]}) - - # ID - if [[ $type = (ids|all) ]]; then - for line in $lines; do - s="${line[${begin[ID]},${end[ID]}]%% ##}" - secrets=($secrets $s) - done - fi - - # Names - if [[ $type = (names|all) ]]; then - for line in $lines; do - s="${line[${begin[NAME]},${end[NAME]}]%% ##}" - secrets=($secrets $s) - done - fi - - _describe -t secrets-list "secrets" secrets "$@" && ret=0 - return ret -} - -__docker_complete_secrets() { - [[ $PREFIX = -* ]] && return 1 - __docker_secrets all "$@" -} - -__docker_secret_commands() { - local -a _docker_secret_subcommands - _docker_secret_subcommands=( - "create:Create a secret using stdin as content" - "inspect:Display detailed information on one or more secrets" - "ls:List secrets" - "rm:Remove one or more secrets" - ) - _describe -t docker-secret-commands "docker secret command" _docker_secret_subcommands -} - -__docker_secret_subcommand() { - local -a _command_args opts_help - local expl help="--help" - integer ret=1 - - opts_help=("(: -)--help[Print usage]") - - case "$words[1]" in - (create) - _arguments $(__docker_arguments) -A '-*' \ - $opts_help \ - "($help)*"{-l=,--label=}"[Secret labels]:label: " \ - "($help -):secret: " && ret=0 - ;; - (inspect) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -f --format)"{-f=,--format=}"[Format the output using the given Go template]:template: " \ - "($help -)*:secret:__docker_complete_secrets" && ret=0 - ;; - (ls|list) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help)--format=[Format the output using the given go template]:template: " \ - "($help -q --quiet)"{-q,--quiet}"[Only display IDs]" && ret=0 - ;; - (rm|remove) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -)*:secret:__docker_complete_secrets" && ret=0 - ;; - (help) - _arguments $(__docker_arguments) ":subcommand:__docker_secret_commands" && ret=0 - ;; - esac - - return ret -} - -# EO secret - -# BO service - -__docker_service_complete_ls_filters() { - [[ $PREFIX = -* ]] && return 1 - integer ret=1 - - if compset -P '*='; then - case "${${words[-1]%=*}#*=}" in - (id) - __docker_complete_services_ids && ret=0 - ;; - (mode) - opts=('global' 'replicated') - _describe -t mode-opts "mode options" opts && ret=0 - ;; - (name) - __docker_complete_services_names && ret=0 - ;; - *) - _message 'value' && ret=0 - ;; - esac - else - opts=('id' 'label' 'mode' 'name') - _describe -t filter-opts "filter options" opts -qS "=" && ret=0 - fi - - return ret -} - -__docker_service_complete_ps_filters() { - [[ $PREFIX = -* ]] && return 1 - integer ret=1 - - if compset -P '*='; then - case "${${words[-1]%=*}#*=}" in - (desired-state) - state_opts=('accepted' 'running' 'shutdown') - _describe -t state-opts "desired state options" state_opts && ret=0 - ;; - *) - _message 'value' && ret=0 - ;; - esac - else - opts=('desired-state' 'id' 'label' 'name') - _describe -t filter-opts "filter options" opts -qS "=" && ret=0 - fi - - return ret -} - -__docker_service_complete_placement_pref() { - [[ $PREFIX = -* ]] && return 1 - integer ret=1 - - if compset -P '*='; then - case "${${words[-1]%=*}#*=}" in - (spread) - opts=('engine.labels' 'node.labels') - _describe -t spread-opts "spread options" opts -qS "." && ret=0 - ;; - *) - _message 'value' && ret=0 - ;; - esac - else - opts=('spread') - _describe -t pref-opts "placement pref options" opts -qS "=" && ret=0 - fi - - return ret -} - -__docker_services() { - [[ $PREFIX = -* ]] && return 1 - integer ret=1 - local line s - declare -a lines services - - type=$1; shift - - lines=(${(f)${:-"$(_call_program commands docker $docker_options service ls)"$'\n'}}) - - # Parse header line to find columns - local i=1 j=1 k header=${lines[1]} - declare -A begin end - while (( j < ${#header} - 1 )); do - i=$(( j + ${${header[$j,-1]}[(i)[^ ]]} - 1 )) - j=$(( i + ${${header[$i,-1]}[(i) ]} - 1 )) - k=$(( j + ${${header[$j,-1]}[(i)[^ ]]} - 2 )) - begin[${header[$i,$((j-1))]}]=$i - end[${header[$i,$((j-1))]}]=$k - done - end[${header[$i,$((j-1))]}]=-1 - lines=(${lines[2,-1]}) - - # Service ID - if [[ $type = (ids|all) ]]; then - for line in $lines; do - s="${line[${begin[ID]},${end[ID]}]%% ##}" - s="$s:${(l:7:: :::)${${line[${begin[IMAGE]},${end[IMAGE]}]}%% ##}}" - services=($services $s) - done - fi - - # Names - if [[ $type = (names|all) ]]; then - for line in $lines; do - s="${line[${begin[NAME]},${end[NAME]}]%% ##}" - s="$s:${(l:7:: :::)${${line[${begin[IMAGE]},${end[IMAGE]}]}%% ##}}" - services=($services $s) - done - fi - - _describe -t services-list "services" services "$@" && ret=0 - return ret -} - -__docker_complete_services() { - [[ $PREFIX = -* ]] && return 1 - __docker_services all "$@" -} - -__docker_complete_services_ids() { - [[ $PREFIX = -* ]] && return 1 - __docker_services ids "$@" -} - -__docker_complete_services_names() { - [[ $PREFIX = -* ]] && return 1 - __docker_services names "$@" -} - -__docker_service_commands() { - local -a _docker_service_subcommands - _docker_service_subcommands=( - "create:Create a new service" - "inspect:Display detailed information on one or more services" - "logs:Fetch the logs of a service or task" - "ls:List services" - "rm:Remove one or more services" - "rollback:Revert changes to a service's configuration" - "scale:Scale one or multiple replicated services" - "ps:List the tasks of a service" - "update:Update a service" - ) - _describe -t docker-service-commands "docker service command" _docker_service_subcommands -} - -__docker_service_subcommand() { - local -a _command_args opts_help opts_create_update - local expl help="--help" - integer ret=1 - - opts_help=("(: -)--help[Print usage]") - opts_create_update=( - "($help)*--cap-add=[Add Linux capabilities]:capability: " - "($help)*--cap-drop=[Drop Linux capabilities]:capability: " - "($help)*--constraint=[Placement constraints]:constraint: " - "($help)--endpoint-mode=[Placement constraints]:mode:(dnsrr vip)" - "($help)*"{-e=,--env=}"[Set environment variables]:env: " - "($help)--health-cmd=[Command to run to check health]:command: " - "($help)--health-interval=[Time between running the check]:time: " - "($help)--health-retries=[Consecutive failures needed to report unhealthy]:retries:(1 2 3 4 5)" - "($help)--health-timeout=[Maximum time to allow one check to run]:time: " - "($help)--hostname=[Service container hostname]:hostname: " \ - "($help)--isolation=[Service container isolation mode]:isolation:(default process hyperv)" \ - "($help)*--label=[Service labels]:label: " - "($help)--limit-cpu=[Limit CPUs]:value: " - "($help)--limit-memory=[Limit Memory]:value: " - "($help)--limit-pids[Limit maximum number of processes (default 0 = unlimited)]" - "($help)--log-driver=[Logging driver for service]:logging driver:__docker_complete_log_drivers" - "($help)*--log-opt=[Logging driver options]:log driver options:__docker_complete_log_options" - "($help)*--mount=[Attach a filesystem mount to the service]:mount: " - "($help)*--network=[Network attachments]:network: " - "($help)--no-healthcheck[Disable any container-specified HEALTHCHECK]" - "($help)--read-only[Mount the container's root filesystem as read only]" - "($help)--replicas=[Number of tasks]:replicas: " - "($help)--reserve-cpu=[Reserve CPUs]:value: " - "($help)--reserve-memory=[Reserve Memory]:value: " - "($help)--restart-condition=[Restart when condition is met]:mode:(any none on-failure)" - "($help)--restart-delay=[Delay between restart attempts]:delay: " - "($help)--restart-max-attempts=[Maximum number of restarts before giving up]:max-attempts: " - "($help)--restart-window=[Window used to evaluate the restart policy]:duration: " - "($help)--rollback-delay=[Delay between task rollbacks]:duration: " - "($help)--rollback-failure-action=[Action on rollback failure]:action:(continue pause)" - "($help)--rollback-max-failure-ratio=[Failure rate to tolerate during a rollback]:failure rate: " - "($help)--rollback-monitor=[Duration after each task rollback to monitor for failure]:duration: " - "($help)--rollback-parallelism=[Maximum number of tasks rolled back simultaneously]:number: " - "($help)*--secret=[Specify secrets to expose to the service]:secret:__docker_complete_secrets" - "($help)--stop-grace-period=[Time to wait before force killing a container]:grace period: " - "($help)--stop-signal=[Signal to stop the container]:signal:_signals" - "($help -t --tty)"{-t,--tty}"[Allocate a pseudo-TTY]" - "($help)--update-delay=[Delay between updates]:delay: " - "($help)--update-failure-action=[Action on update failure]:mode:(continue pause rollback)" - "($help)--update-max-failure-ratio=[Failure rate to tolerate during an update]:fraction: " - "($help)--update-monitor=[Duration after each task update to monitor for failure]:window: " - "($help)--update-parallelism=[Maximum number of tasks updated simultaneously]:number: " - "($help -u --user)"{-u=,--user=}"[Username or UID]:user:_users" - "($help)--with-registry-auth[Send registry authentication details to swarm agents]" - "($help -w --workdir)"{-w=,--workdir=}"[Working directory inside the container]:directory:_directories" - ) - - case "$words[1]" in - (create) - _arguments $(__docker_arguments) \ - $opts_help \ - $opts_create_update \ - "($help)*--container-label=[Container labels]:label: " \ - "($help)*--dns=[Set custom DNS servers]:DNS: " \ - "($help)*--dns-option=[Set DNS options]:DNS option: " \ - "($help)*--dns-search=[Set custom DNS search domains]:DNS search: " \ - "($help)*--env-file=[Read environment variables from a file]:environment file:_files" \ - "($help)*--group=[Set one or more supplementary user groups for the container]:group: _groups " \ - "($help)--mode=[Service Mode]:mode:(global replicated)" \ - "($help)--name=[Service name]:name: " \ - "($help)*--placement-pref=[Add a placement preference]:pref:__docker_service_complete_placement_pref" \ - "($help)*"{-p=,--publish=}"[Publish a port as a node port]:port: " \ - "($help -): :__docker_complete_images" \ - "($help -):command: _command_names -e" \ - "($help -)*::arguments: _normal" && ret=0 - ;; - (inspect) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -f --format)"{-f=,--format=}"[Format the output using the given go template]:template: " \ - "($help)--pretty[Print the information in a human friendly format]" \ - "($help -)*:service:__docker_complete_services" && ret=0 - ;; - (logs) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -f --follow)"{-f,--follow}"[Follow log output]" \ - "($help)--no-resolve[Do not map IDs to Names]" \ - "($help)--no-task-ids[Do not include task IDs]" \ - "($help)--no-trunc[Do not truncate output]" \ - "($help)--since=[Show logs since timestamp]:timestamp: " \ - "($help -n --tail)"{-n=,--tail=}"[Number of lines to show from the end of the logs]:lines:(1 10 20 50 all)" \ - "($help -t --timestamps)"{-t,--timestamps}"[Show timestamps]" \ - "($help -)1:service:__docker_complete_services" && ret=0 - ;; - (ls|list) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help)*"{-f=,--filter=}"[Filter output based on conditions provided]:filter:__docker_service_complete_ls_filters" \ - "($help)--format=[Pretty-print services using a Go template]:template: " \ - "($help -q --quiet)"{-q,--quiet}"[Only display IDs]" && ret=0 - ;; - (rm|remove) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -)*:service:__docker_complete_services" && ret=0 - ;; - (rollback) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -d --detach)"{-d=false,--detach=false}"[Disable detached mode]" \ - "($help -q --quiet)"{-q,--quiet}"[Suppress progress output]" \ - "($help -)*:service:__docker_complete_services" && ret=0 - ;; - (scale) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -d --detach)"{-d=false,--detach=false}"[Disable detached mode]" \ - "($help -)*:service:->values" && ret=0 - case $state in - (values) - if compset -P '*='; then - _message 'replicas' && ret=0 - else - __docker_complete_services -qS "=" - fi - ;; - esac - ;; - (ps) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help)*"{-f=,--filter=}"[Provide filter values]:filter:__docker_service_complete_ps_filters" \ - "($help)--format=[Format the output using the given go template]:template: " \ - "($help)--no-resolve[Do not map IDs to Names]" \ - "($help)--no-trunc[Do not truncate output]" \ - "($help -q --quiet)"{-q,--quiet}"[Only display task IDs]" \ - "($help -)*:service:__docker_complete_services" && ret=0 - ;; - (update) - _arguments $(__docker_arguments) \ - $opts_help \ - $opts_create_update \ - "($help)--arg=[Service command args]:arguments: _normal" \ - "($help)*--container-label-add=[Add or update container labels]:label: " \ - "($help)*--container-label-rm=[Remove a container label by its key]:label: " \ - "($help)*--dns-add=[Add or update custom DNS servers]:DNS: " \ - "($help)*--dns-rm=[Remove custom DNS servers]:DNS: " \ - "($help)*--dns-option-add=[Add or update DNS options]:DNS option: " \ - "($help)*--dns-option-rm=[Remove DNS options]:DNS option: " \ - "($help)*--dns-search-add=[Add or update custom DNS search domains]:DNS search: " \ - "($help)*--dns-search-rm=[Remove DNS search domains]:DNS search: " \ - "($help)--force[Force update]" \ - "($help)*--group-add=[Add additional supplementary user groups to the container]:group:_groups" \ - "($help)*--group-rm=[Remove previously added supplementary user groups from the container]:group:_groups" \ - "($help)--image=[Service image tag]:image:__docker_complete_repositories" \ - "($help)*--placement-pref-add=[Add a placement preference]:pref:__docker_service_complete_placement_pref" \ - "($help)*--placement-pref-rm=[Remove a placement preference]:pref:__docker_service_complete_placement_pref" \ - "($help)*--publish-add=[Add or update a port]:port: " \ - "($help)*--publish-rm=[Remove a port(target-port mandatory)]:port: " \ - "($help)--rollback[Rollback to previous specification]" \ - "($help -)1:service:__docker_complete_services" && ret=0 - ;; - (help) - _arguments $(__docker_arguments) ":subcommand:__docker_service_commands" && ret=0 - ;; - esac - - return ret -} - -# EO service - -# BO stack - -__docker_stack_complete_ps_filters() { - [[ $PREFIX = -* ]] && return 1 - integer ret=1 - - if compset -P '*='; then - case "${${words[-1]%=*}#*=}" in - (desired-state) - state_opts=('accepted' 'running' 'shutdown') - _describe -t state-opts "desired state options" state_opts && ret=0 - ;; - *) - _message 'value' && ret=0 - ;; - esac - else - opts=('desired-state' 'id' 'name') - _describe -t filter-opts "filter options" opts -qS "=" && ret=0 - fi - - return ret -} - -__docker_stack_complete_services_filters() { - [[ $PREFIX = -* ]] && return 1 - integer ret=1 - - if compset -P '*='; then - case "${${words[-1]%=*}#*=}" in - *) - _message 'value' && ret=0 - ;; - esac - else - opts=('id' 'label' 'name') - _describe -t filter-opts "filter options" opts -qS "=" && ret=0 - fi - - return ret -} - -__docker_stacks() { - [[ $PREFIX = -* ]] && return 1 - integer ret=1 - local line s - declare -a lines stacks - - lines=(${(f)${:-"$(_call_program commands docker $docker_options stack ls)"$'\n'}}) - - # Parse header line to find columns - local i=1 j=1 k header=${lines[1]} - declare -A begin end - while (( j < ${#header} - 1 )); do - i=$(( j + ${${header[$j,-1]}[(i)[^ ]]} - 1 )) - j=$(( i + ${${header[$i,-1]}[(i) ]} - 1 )) - k=$(( j + ${${header[$j,-1]}[(i)[^ ]]} - 2 )) - begin[${header[$i,$((j-1))]}]=$i - end[${header[$i,$((j-1))]}]=$k - done - end[${header[$i,$((j-1))]}]=-1 - lines=(${lines[2,-1]}) - - # Service NAME - for line in $lines; do - s="${line[${begin[NAME]},${end[NAME]}]%% ##}" - stacks=($stacks $s) - done - - _describe -t stacks-list "stacks" stacks "$@" && ret=0 - return ret -} - -__docker_complete_stacks() { - [[ $PREFIX = -* ]] && return 1 - __docker_stacks "$@" -} - -__docker_stack_commands() { - local -a _docker_stack_subcommands - _docker_stack_subcommands=( - "deploy:Deploy a new stack or update an existing stack" - "ls:List stacks" - "ps:List the tasks in the stack" - "rm:Remove the stack" - "services:List the services in the stack" - ) - _describe -t docker-stack-commands "docker stack command" _docker_stack_subcommands -} - -__docker_stack_subcommand() { - local -a _command_args opts_help - local expl help="--help" - integer ret=1 - - opts_help=("(: -)--help[Print usage]") - - case "$words[1]" in - (deploy|up) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -c --compose-file)"{-c=,--compose-file=}"[Path to a Compose file, or '-' to read from stdin]:compose file:_files -g \"*.(yml|yaml)\"" \ - "($help)--with-registry-auth[Send registry authentication details to Swarm agents]" \ - "($help -):stack:__docker_complete_stacks" && ret=0 - ;; - (ls|list) - _arguments $(__docker_arguments) \ - $opts_help && ret=0 - ;; - (ps) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -a --all)"{-a,--all}"[Display all tasks]" \ - "($help)*"{-f=,--filter=}"[Filter output based on conditions provided]:filter:__docker_stack_complete_ps_filters" \ - "($help)--format=[Format the output using the given go template]:template: " \ - "($help)--no-resolve[Do not map IDs to Names]" \ - "($help)--no-trunc[Do not truncate output]" \ - "($help -q --quiet)"{-q,--quiet}"[Only display task IDs]" \ - "($help -):stack:__docker_complete_stacks" && ret=0 - ;; - (rm|remove|down) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -):stack:__docker_complete_stacks" && ret=0 - ;; - (services) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help)*"{-f=,--filter=}"[Filter output based on conditions provided]:filter:__docker_stack_complete_services_filters" \ - "($help)--format=[Pretty-print services using a Go template]:template: " \ - "($help -q --quiet)"{-q,--quiet}"[Only display IDs]" \ - "($help -):stack:__docker_complete_stacks" && ret=0 - ;; - (help) - _arguments $(__docker_arguments) ":subcommand:__docker_stack_commands" && ret=0 - ;; - esac - - return ret -} - -# EO stack - -# BO swarm - -__docker_swarm_commands() { - local -a _docker_swarm_subcommands - _docker_swarm_subcommands=( - "init:Initialize a swarm" - "join:Join a swarm as a node and/or manager" - "join-token:Manage join tokens" - "leave:Leave a swarm" - "unlock:Unlock swarm" - "unlock-key:Manage the unlock key" - "update:Update the swarm" - ) - _describe -t docker-swarm-commands "docker swarm command" _docker_swarm_subcommands -} - -__docker_swarm_subcommand() { - local -a _command_args opts_help - local expl help="--help" - integer ret=1 - - opts_help=("(: -)--help[Print usage]") - - case "$words[1]" in - (init) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help)--advertise-addr=[Advertised address]:ip\:port: " \ - "($help)--data-path-addr=[Data path IP or interface]:ip " \ - "($help)--data-path-port=[Data Path Port]:port " \ - "($help)--default-addr-pool=[Default address pool]" \ - "($help)--default-addr-pool-mask-length=[Default address pool subnet mask length]" \ - "($help)--autolock[Enable manager autolocking]" \ - "($help)--availability=[Availability of the node]:availability:(active drain pause)" \ - "($help)--cert-expiry=[Validity period for node certificates]:duration: " \ - "($help)--dispatcher-heartbeat=[Dispatcher heartbeat period]:duration: " \ - "($help)*--external-ca=[Specifications of one or more certificate signing endpoints]:endpoint: " \ - "($help)--force-new-cluster[Force create a new cluster from current state]" \ - "($help)--listen-addr=[Listen address]:ip\:port: " \ - "($help)--max-snapshots[Number of additional Raft snapshots to retain]" \ - "($help)--snapshot-interval[Number of log entries between Raft snapshots]" \ - "($help)--task-history-limit=[Task history retention limit]:limit: " && ret=0 - ;; - (join) - _arguments $(__docker_arguments) -A '-*' \ - $opts_help \ - "($help)--advertise-addr=[Advertised address]:ip\:port: " \ - "($help)--data-path-addr=[Data path IP or interface]:ip " \ - "($help)--availability=[Availability of the node]:availability:(active drain pause)" \ - "($help)--listen-addr=[Listen address]:ip\:port: " \ - "($help)--token=[Token for entry into the swarm]:secret: " \ - "($help -):host\:port: " && ret=0 - ;; - (join-token) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -q --quiet)"{-q,--quiet}"[Only display token]" \ - "($help)--rotate[Rotate join token]" \ - "($help -):role:(manager worker)" && ret=0 - ;; - (leave) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -f --force)"{-f,--force}"[Force this node to leave the swarm, ignoring warnings]" && ret=0 - ;; - (unlock) - _arguments $(__docker_arguments) \ - $opts_help && ret=0 - ;; - (unlock-key) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -q --quiet)"{-q,--quiet}"[Only display token]" \ - "($help)--rotate[Rotate unlock token]" && ret=0 - ;; - (update) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help)--autolock[Enable manager autolocking]" \ - "($help)--cert-expiry=[Validity period for node certificates]:duration: " \ - "($help)--dispatcher-heartbeat=[Dispatcher heartbeat period]:duration: " \ - "($help)*--external-ca=[Specifications of one or more certificate signing endpoints]:endpoint: " \ - "($help)--max-snapshots[Number of additional Raft snapshots to retain]" \ - "($help)--snapshot-interval[Number of log entries between Raft snapshots]" \ - "($help)--task-history-limit=[Task history retention limit]:limit: " && ret=0 - ;; - (help) - _arguments $(__docker_arguments) ":subcommand:__docker_network_commands" && ret=0 - ;; - esac - - return ret -} - -# EO swarm - -# BO system - -__docker_system_commands() { - local -a _docker_system_subcommands - _docker_system_subcommands=( - "df:Show docker filesystem usage" - "events:Get real time events from the server" - "info:Display system-wide information" - "prune:Remove unused data" - ) - _describe -t docker-system-commands "docker system command" _docker_system_subcommands -} - -__docker_system_subcommand() { - local -a _command_args opts_help - local expl help="--help" - integer ret=1 - - opts_help=("(: -)--help[Print usage]") - - case "$words[1]" in - (df) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -v --verbose)"{-v,--verbose}"[Show detailed information on space usage]" && ret=0 - ;; - (events) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help)*"{-f=,--filter=}"[Filter values]:filter:__docker_complete_events_filter" \ - "($help)--since=[Events created since this timestamp]:timestamp: " \ - "($help)--until=[Events created until this timestamp]:timestamp: " \ - "($help)--format=[Format the output using the given go template]:template: " && ret=0 - ;; - (info) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -f --format)"{-f=,--format=}"[Format the output using the given go template]:template: " && ret=0 - ;; - (prune) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -a --all)"{-a,--all}"[Remove all unused data, not just dangling ones]" \ - "($help)*--filter=[Filter values]:filter:__docker_complete_prune_filters" \ - "($help -f --force)"{-f,--force}"[Do not prompt for confirmation]" \ - "($help)--volumes=[Remove all unused volumes]" && ret=0 - ;; - (help) - _arguments $(__docker_arguments) ":subcommand:__docker_volume_commands" && ret=0 - ;; - esac - - return ret -} - -# EO system - -# BO volume - -__docker_volume_complete_ls_filters() { - [[ $PREFIX = -* ]] && return 1 - integer ret=1 - - if compset -P '*='; then - case "${${words[-1]%=*}#*=}" in - (dangling) - dangling_opts=('true' 'false') - _describe -t dangling-filter-opts "Dangling Filter Options" dangling_opts && ret=0 - ;; - (driver) - __docker_complete_info_plugins Volume && ret=0 - ;; - (name) - __docker_complete_volumes && ret=0 - ;; - *) - _message 'value' && ret=0 - ;; - esac - else - opts=('dangling' 'driver' 'label' 'name') - _describe -t filter-opts "Filter Options" opts -qS "=" && ret=0 - fi - - return ret -} - -__docker_complete_volumes() { - [[ $PREFIX = -* ]] && return 1 - integer ret=1 - declare -a lines volumes - - lines=(${(f)${:-"$(_call_program commands docker $docker_options volume ls)"$'\n'}}) - - # Parse header line to find columns - local i=1 j=1 k header=${lines[1]} - declare -A begin end - while (( j < ${#header} - 1 )); do - i=$(( j + ${${header[$j,-1]}[(i)[^ ]]} - 1 )) - j=$(( i + ${${header[$i,-1]}[(i) ]} - 1 )) - k=$(( j + ${${header[$j,-1]}[(i)[^ ]]} - 2 )) - begin[${header[$i,$((j-1))]}]=$i - end[${header[$i,$((j-1))]}]=$k - done - end[${header[$i,$((j-1))]}]=-1 - lines=(${lines[2,-1]}) - - # Names - local line s - for line in $lines; do - s="${line[${begin[VOLUME NAME]},${end[VOLUME NAME]}]%% ##}" - s="$s:${(l:7:: :::)${${line[${begin[DRIVER]},${end[DRIVER]}]}%% ##}}" - volumes=($volumes $s) - done - - _describe -t volumes-list "volumes" volumes && ret=0 - return ret -} - -__docker_volume_commands() { - local -a _docker_volume_subcommands - _docker_volume_subcommands=( - "create:Create a volume" - "inspect:Display detailed information on one or more volumes" - "ls:List volumes" - "prune:Remove all unused volumes" - "rm:Remove one or more volumes" - ) - _describe -t docker-volume-commands "docker volume command" _docker_volume_subcommands -} - -__docker_volume_subcommand() { - local -a _command_args opts_help - local expl help="--help" - integer ret=1 - - opts_help=("(: -)--help[Print usage]") - - case "$words[1]" in - (create) - _arguments $(__docker_arguments) -A '-*' \ - $opts_help \ - "($help -d --driver)"{-d=,--driver=}"[Volume driver name]:Driver name:(local)" \ - "($help)*--label=[Set metadata for a volume]:label=value: " \ - "($help)*"{-o=,--opt=}"[Driver specific options]:Driver option: " \ - "($help -)1:Volume name: " && ret=0 - ;; - (inspect) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -f --format)"{-f=,--format=}"[Format the output using the given go template]:template: " \ - "($help -)1:volume:__docker_complete_volumes" && ret=0 - ;; - (ls) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help)*"{-f=,--filter=}"[Provide filter values]:filter:__docker_volume_complete_ls_filters" \ - "($help)--format=[Pretty-print volumes using a Go template]:template: " \ - "($help -q --quiet)"{-q,--quiet}"[Only display volume names]" && ret=0 - ;; - (prune) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -f --force)"{-f,--force}"[Do not prompt for confirmation]" && ret=0 - ;; - (rm) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -f --force)"{-f,--force}"[Force the removal of one or more volumes]" \ - "($help -):volume:__docker_complete_volumes" && ret=0 - ;; - (help) - _arguments $(__docker_arguments) ":subcommand:__docker_volume_commands" && ret=0 - ;; - esac - - return ret -} - -# EO volume - -__docker_caching_policy() { - oldp=( "$1"(Nmh+1) ) # 1 hour - (( $#oldp )) -} - -__docker_commands() { - local cache_policy - integer force_invalidation=0 - - zstyle -s ":completion:${curcontext}:" cache-policy cache_policy - if [[ -z "$cache_policy" ]]; then - zstyle ":completion:${curcontext}:" cache-policy __docker_caching_policy - fi - - if ( (( ! ${+_docker_hide_legacy_commands} )) || _cache_invalid docker_hide_legacy_commands ) \ - && ! _retrieve_cache docker_hide_legacy_commands; - then - _docker_hide_legacy_commands="${DOCKER_HIDE_LEGACY_COMMANDS}" - _store_cache docker_hide_legacy_commands _docker_hide_legacy_commands - fi - - if [[ "${_docker_hide_legacy_commands}" != "${DOCKER_HIDE_LEGACY_COMMANDS}" ]]; then - force_invalidation=1 - _docker_hide_legacy_commands="${DOCKER_HIDE_LEGACY_COMMANDS}" - _store_cache docker_hide_legacy_commands _docker_hide_legacy_commands - fi - - if ( [[ ${+_docker_subcommands} -eq 0 ]] || _cache_invalid docker_subcommands ) \ - && ! _retrieve_cache docker_subcommands || [[ ${force_invalidation} -eq 1 ]]; - then - local -a lines - lines=(${(f)"$(_call_program commands docker 2>&1)"}) - _docker_subcommands=(${${${(M)${lines[$((${lines[(i)*Commands:]} + 1)),-1]}:# *}## #}/ ##/:}) - _docker_subcommands=($_docker_subcommands 'daemon:Enable daemon mode' 'help:Show help for a command') - (( $#_docker_subcommands > 2 )) && _store_cache docker_subcommands _docker_subcommands - fi - _describe -t docker-commands "docker command" _docker_subcommands -} - -__docker_subcommand() { - local -a _command_args opts_help - local expl help="--help" - integer ret=1 - - opts_help=("(: -)--help[Print usage]") - - case "$words[1]" in - (attach|commit|cp|create|diff|exec|export|kill|logs|pause|unpause|port|rename|restart|rm|run|start|stats|stop|top|update|wait) - __docker_container_subcommand && ret=0 - ;; - (build|history|import|load|pull|push|save|tag) - __docker_image_subcommand && ret=0 - ;; - (checkpoint) - local curcontext="$curcontext" state - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -): :->command" \ - "($help -)*:: :->option-or-argument" && ret=0 - - case $state in - (command) - __docker_checkpoint_commands && ret=0 - ;; - (option-or-argument) - curcontext=${curcontext%:*:*}:docker-${words[-1]}: - __docker_checkpoint_subcommand && ret=0 - ;; - esac - ;; - (container) - local curcontext="$curcontext" state - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -): :->command" \ - "($help -)*:: :->option-or-argument" && ret=0 - - case $state in - (command) - __docker_container_commands && ret=0 - ;; - (option-or-argument) - curcontext=${curcontext%:*:*}:docker-${words[-1]}: - __docker_container_subcommand && ret=0 - ;; - esac - ;; - (daemon) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help)*--add-runtime=[Register an additional OCI compatible runtime]:runtime:__docker_complete_runtimes" \ - "($help)*--allow-nondistributable-artifacts=[Push nondistributable artifacts to specified registries]:registry: " \ - "($help)--api-cors-header=[CORS headers in the Engine API]:CORS headers: " \ - "($help)*--authorization-plugin=[Authorization plugins to load]" \ - "($help -b --bridge)"{-b=,--bridge=}"[Attach containers to a network bridge]:bridge:_net_interfaces" \ - "($help)--bip=[Network bridge IP]:IP address: " \ - "($help)--cgroup-parent=[Parent cgroup for all containers]:cgroup: " \ - "($help)--cluster-advertise=[Address or interface name to advertise]:Instance to advertise (host\:port): " \ - "($help)--cluster-store=[URL of the distributed storage backend]:Cluster Store:->cluster-store" \ - "($help)*--cluster-store-opt=[Cluster store options]:Cluster options:->cluster-store-options" \ - "($help)--config-file=[Path to daemon configuration file]:Config File:_files" \ - "($help)--containerd=[Path to containerd socket]:socket:_files -g \"*.sock\"" \ - "($help)--containerd-namespace=[Containerd namespace to use]:containerd namespace:" \ - "($help)--containerd-plugins-namespace=[Containerd namespace to use for plugins]:containerd namespace:" \ - "($help)--data-root=[Root directory of persisted Docker data]:path:_directories" \ - "($help -D --debug)"{-D,--debug}"[Enable debug mode]" \ - "($help)--default-gateway[Container default gateway IPv4 address]:IPv4 address: " \ - "($help)--default-gateway-v6[Container default gateway IPv6 address]:IPv6 address: " \ - "($help)--default-shm-size=[Default shm size for containers]:size:" \ - "($help)*--default-ulimit=[Default ulimits for containers]:ulimit: " \ - "($help)*--dns=[DNS server to use]:DNS: " \ - "($help)*--dns-opt=[DNS options to use]:DNS option: " \ - "($help)*--dns-search=[DNS search domains to use]:DNS search: " \ - "($help)*--exec-opt=[Runtime execution options]:runtime execution options: " \ - "($help)--exec-root=[Root directory for execution state files]:path:_directories" \ - "($help)--experimental[Enable experimental features]" \ - "($help)--fixed-cidr=[IPv4 subnet for fixed IPs]:IPv4 subnet: " \ - "($help)--fixed-cidr-v6=[IPv6 subnet for fixed IPs]:IPv6 subnet: " \ - "($help -G --group)"{-G=,--group=}"[Group for the unix socket]:group:_groups" \ - "($help -H --host)"{-H=,--host=}"[tcp://host:port to bind/connect to]:host: " \ - "($help)--icc[Enable inter-container communication]" \ - "($help)--init[Run an init inside containers to forward signals and reap processes]" \ - "($help)--init-path=[Path to the docker-init binary]:docker-init binary:_files" \ - "($help)*--insecure-registry=[Enable insecure registry communication]:registry: " \ - "($help)--ip=[Default IP when binding container ports]" \ - "($help)--ip-forward[Enable net.ipv4.ip_forward]" \ - "($help)--ip-masq[Enable IP masquerading]" \ - "($help)--iptables[Enable addition of iptables rules]" \ - "($help)--ipv6[Enable IPv6 networking]" \ - "($help -l --log-level)"{-l=,--log-level=}"[Logging level]:level:(debug info warn error fatal)" \ - "($help)*--label=[Key=value labels]:label: " \ - "($help)--live-restore[Enable live restore of docker when containers are still running]" \ - "($help)--log-driver=[Default driver for container logs]:logging driver:__docker_complete_log_drivers" \ - "($help)*--log-opt=[Default log driver options for containers]:log driver options:__docker_complete_log_options" \ - "($help)--max-concurrent-downloads[Set the max concurrent downloads for each pull]" \ - "($help)--max-concurrent-uploads[Set the max concurrent uploads for each push]" \ - "($help)--max-download-attempts[Set the max download attempts for each pull]" \ - "($help)--mtu=[Network MTU]:mtu:(0 576 1420 1500 9000)" \ - "($help)--oom-score-adjust=[Set the oom_score_adj for the daemon]:oom-score:(-500)" \ - "($help -p --pidfile)"{-p=,--pidfile=}"[Path to use for daemon PID file]:PID file:_files" \ - "($help)--raw-logs[Full timestamps without ANSI coloring]" \ - "($help)*--registry-mirror=[Preferred Docker registry mirror]:registry mirror: " \ - "($help)--seccomp-profile=[Path to seccomp profile]:path:_files -g \"*.json\"" \ - "($help -s --storage-driver)"{-s=,--storage-driver=}"[Storage driver to use]:driver:(aufs btrfs devicemapper overlay overlay2 vfs zfs)" \ - "($help)--selinux-enabled[Enable selinux support]" \ - "($help)--shutdown-timeout=[Set the shutdown timeout value in seconds]:time: " \ - "($help)*--storage-opt=[Storage driver options]:storage driver options: " \ - "($help)--tls[Use TLS]" \ - "($help)--tlscacert=[Trust certs signed only by this CA]:PEM file:_files -g \"*.(pem|crt)\"" \ - "($help)--tlscert=[Path to TLS certificate file]:PEM file:_files -g \"*.(pem|crt)\"" \ - "($help)--tlskey=[Path to TLS key file]:Key file:_files -g \"*.(pem|key)\"" \ - "($help)--tlsverify[Use TLS and verify the remote]" \ - "($help)--userns-remap=[User/Group setting for user namespaces]:user\:group:->users-groups" \ - "($help)--userland-proxy[Use userland proxy for loopback traffic]" \ - "($help)--userland-proxy-path=[Path to the userland proxy binary]:binary:_files" && ret=0 - - case $state in - (cluster-store) - if compset -P '*://'; then - _message 'host:port' && ret=0 - else - store=('consul' 'etcd' 'zk') - _describe -t cluster-store "Cluster Store" store -qS "://" && ret=0 - fi - ;; - (cluster-store-options) - if compset -P '*='; then - _files && ret=0 - else - opts=('discovery.heartbeat' 'discovery.ttl' 'kv.cacertfile' 'kv.certfile' 'kv.keyfile' 'kv.path') - _describe -t cluster-store-opts "Cluster Store Options" opts -qS "=" && ret=0 - fi - ;; - (users-groups) - if compset -P '*:'; then - _groups && ret=0 - else - _describe -t userns-default "default Docker user management" '(default)' && ret=0 - _users && ret=0 - fi - ;; - esac - ;; - (events|info) - __docker_system_subcommand && ret=0 - ;; - (image) - local curcontext="$curcontext" state - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -): :->command" \ - "($help -)*:: :->option-or-argument" && ret=0 - - case $state in - (command) - __docker_image_commands && ret=0 - ;; - (option-or-argument) - curcontext=${curcontext%:*:*}:docker-${words[-1]}: - __docker_image_subcommand && ret=0 - ;; - esac - ;; - (images) - words[1]='ls' - __docker_image_subcommand && ret=0 - ;; - (inspect) - local state - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -f --format)"{-f=,--format=}"[Format the output using the given go template]:template: " \ - "($help -s --size)"{-s,--size}"[Display total file sizes if the type is container]" \ - "($help)--type=[Return JSON for specified type]:type:(container image network node plugin service volume)" \ - "($help -)*: :->values" && ret=0 - - case $state in - (values) - if [[ ${words[(r)--type=container]} == --type=container ]]; then - __docker_complete_containers && ret=0 - elif [[ ${words[(r)--type=image]} == --type=image ]]; then - __docker_complete_images && ret=0 - elif [[ ${words[(r)--type=network]} == --type=network ]]; then - __docker_complete_networks && ret=0 - elif [[ ${words[(r)--type=node]} == --type=node ]]; then - __docker_complete_nodes && ret=0 - elif [[ ${words[(r)--type=plugin]} == --type=plugin ]]; then - __docker_complete_plugins && ret=0 - elif [[ ${words[(r)--type=service]} == --type=secrets ]]; then - __docker_complete_secrets && ret=0 - elif [[ ${words[(r)--type=service]} == --type=service ]]; then - __docker_complete_services && ret=0 - elif [[ ${words[(r)--type=volume]} == --type=volume ]]; then - __docker_complete_volumes && ret=0 - else - __docker_complete_containers - __docker_complete_images - __docker_complete_networks - __docker_complete_nodes - __docker_complete_plugins - __docker_complete_secrets - __docker_complete_services - __docker_complete_volumes && ret=0 - fi - ;; - esac - ;; - (login) - _arguments $(__docker_arguments) -A '-*' \ - $opts_help \ - "($help -p --password)"{-p=,--password=}"[Password]:password: " \ - "($help)--password-stdin[Read password from stdin]" \ - "($help -u --username)"{-u=,--username=}"[Username]:username: " \ - "($help -)1:server: " && ret=0 - ;; - (logout) - _arguments $(__docker_arguments) -A '-*' \ - $opts_help \ - "($help -)1:server: " && ret=0 - ;; - (network) - local curcontext="$curcontext" state - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -): :->command" \ - "($help -)*:: :->option-or-argument" && ret=0 - - case $state in - (command) - __docker_network_commands && ret=0 - ;; - (option-or-argument) - curcontext=${curcontext%:*:*}:docker-${words[-1]}: - __docker_network_subcommand && ret=0 - ;; - esac - ;; - (node) - local curcontext="$curcontext" state - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -): :->command" \ - "($help -)*:: :->option-or-argument" && ret=0 - - case $state in - (command) - __docker_node_commands && ret=0 - ;; - (option-or-argument) - curcontext=${curcontext%:*:*}:docker-${words[-1]}: - __docker_node_subcommand && ret=0 - ;; - esac - ;; - (plugin) - local curcontext="$curcontext" state - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -): :->command" \ - "($help -)*:: :->option-or-argument" && ret=0 - - case $state in - (command) - __docker_plugin_commands && ret=0 - ;; - (option-or-argument) - curcontext=${curcontext%:*:*}:docker-${words[-1]}: - __docker_plugin_subcommand && ret=0 - ;; - esac - ;; - (ps) - words[1]='ls' - __docker_container_subcommand && ret=0 - ;; - (rmi) - words[1]='rm' - __docker_image_subcommand && ret=0 - ;; - (search) - _arguments $(__docker_arguments) -A '-*' \ - $opts_help \ - "($help)*"{-f=,--filter=}"[Filter values]:filter:__docker_complete_search_filters" \ - "($help)--limit=[Maximum returned search results]:limit:(1 5 10 25 50)" \ - "($help)--no-trunc[Do not truncate output]" \ - "($help -):term: " && ret=0 - ;; - (secret) - local curcontext="$curcontext" state - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -): :->command" \ - "($help -)*:: :->option-or-argument" && ret=0 - - case $state in - (command) - __docker_secret_commands && ret=0 - ;; - (option-or-argument) - curcontext=${curcontext%:*:*}:docker-${words[-1]}: - __docker_secret_subcommand && ret=0 - ;; - esac - ;; - (service) - local curcontext="$curcontext" state - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -): :->command" \ - "($help -)*:: :->option-or-argument" && ret=0 - - case $state in - (command) - __docker_service_commands && ret=0 - ;; - (option-or-argument) - curcontext=${curcontext%:*:*}:docker-${words[-1]}: - __docker_service_subcommand && ret=0 - ;; - esac - ;; - (stack) - local curcontext="$curcontext" state - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -): :->command" \ - "($help -)*:: :->option-or-argument" && ret=0 - - case $state in - (command) - __docker_stack_commands && ret=0 - ;; - (option-or-argument) - curcontext=${curcontext%:*:*}:docker-${words[-1]}: - __docker_stack_subcommand && ret=0 - ;; - esac - ;; - (swarm) - local curcontext="$curcontext" state - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -): :->command" \ - "($help -)*:: :->option-or-argument" && ret=0 - - case $state in - (command) - __docker_swarm_commands && ret=0 - ;; - (option-or-argument) - curcontext=${curcontext%:*:*}:docker-${words[-1]}: - __docker_swarm_subcommand && ret=0 - ;; - esac - ;; - (system) - local curcontext="$curcontext" state - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -): :->command" \ - "($help -)*:: :->option-or-argument" && ret=0 - - case $state in - (command) - __docker_system_commands && ret=0 - ;; - (option-or-argument) - curcontext=${curcontext%:*:*}:docker-${words[-1]}: - __docker_system_subcommand && ret=0 - ;; - esac - ;; - (version) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -f --format)"{-f=,--format=}"[Format the output using the given go template]:template: " && ret=0 - ;; - (volume) - local curcontext="$curcontext" state - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -): :->command" \ - "($help -)*:: :->option-or-argument" && ret=0 - - case $state in - (command) - __docker_volume_commands && ret=0 - ;; - (option-or-argument) - curcontext=${curcontext%:*:*}:docker-${words[-1]}: - __docker_volume_subcommand && ret=0 - ;; - esac - ;; - (help) - _arguments $(__docker_arguments) ":subcommand:__docker_commands" && ret=0 - ;; - esac - - return ret -} - -_docker() { - # Support for subservices, which allows for `compdef _docker docker-shell=_docker_containers`. - # Based on /usr/share/zsh/functions/Completion/Unix/_git without support for `ret`. - if [[ $service != docker ]]; then - _call_function - _$service - return - fi - - local curcontext="$curcontext" state line help="-h --help" - integer ret=1 - typeset -A opt_args - - _arguments $(__docker_arguments) -C \ - "(: -)"{-h,--help}"[Print usage]" \ - "($help)--config[Location of client config files]:path:_directories" \ - "($help -D --debug)"{-D,--debug}"[Enable debug mode]" \ - "($help -H --host)"{-H=,--host=}"[tcp://host:port to bind/connect to]:host: " \ - "($help -l --log-level)"{-l=,--log-level=}"[Logging level]:level:(debug info warn error fatal)" \ - "($help)--tls[Use TLS]" \ - "($help)--tlscacert=[Trust certs signed only by this CA]:PEM file:_files -g "*.(pem|crt)"" \ - "($help)--tlscert=[Path to TLS certificate file]:PEM file:_files -g "*.(pem|crt)"" \ - "($help)--tlskey=[Path to TLS key file]:Key file:_files -g "*.(pem|key)"" \ - "($help)--tlsverify[Use TLS and verify the remote]" \ - "($help)--userland-proxy[Use userland proxy for loopback traffic]" \ - "($help -v --version)"{-v,--version}"[Print version information and quit]" \ - "($help -): :->command" \ - "($help -)*:: :->option-or-argument" && ret=0 - - local host=${opt_args[-H]}${opt_args[--host]} - local config=${opt_args[--config]} - local docker_options="${host:+--host $host} ${config:+--config $config}" - - case $state in - (command) - __docker_commands && ret=0 - ;; - (option-or-argument) - curcontext=${curcontext%:*:*}:docker-$words[1]: - __docker_subcommand && ret=0 - ;; - esac - - return ret -} - -_dockerd() { - integer ret=1 - words[1]='daemon' - __docker_subcommand && ret=0 - return ret -} - -_docker "$@" - -# Local Variables: -# mode: Shell-Script -# sh-indentation: 4 -# indent-tabs-mode: nil -# sh-basic-offset: 4 -# End: -# vim: ft=zsh sw=4 ts=4 et diff --git a/zsh/plugins/interactive-cd.zsh b/zsh/plugins/interactive-cd.zsh deleted file mode 100644 index b0520c2..0000000 --- a/zsh/plugins/interactive-cd.zsh +++ /dev/null @@ -1,148 +0,0 @@ -# Copyright (c) 2017 Henry Chang - -__zic_fzf_prog() { - [ -n "$TMUX_PANE" ] && [ "${FZF_TMUX:-0}" != 0 ] && [ ${LINES:-40} -gt 15 ] \ - && echo "fzf-tmux -d${FZF_TMUX_HEIGHT:-40%}" || echo "fzf" -} - -__zic_matched_subdir_list() { - local dir length seg starts_with_dir - if [[ "$1" == */ ]]; then - dir="$1" - if [[ "$dir" != / ]]; then - dir="${dir: : -1}" - fi - length=$(echo -n "$dir" | wc -c) - if [ "$dir" = "/" ]; then - length=0 - fi - find -L "$dir" -mindepth 1 -maxdepth 1 -type d 2>/dev/null \ - | cut -b $(( ${length} + 2 ))- | sed '/^$/d' | while read -r line; do - if [[ "${line[1]}" == "." ]]; then - continue - fi - echo "$line" - done - else - dir=$(dirname -- "$1") - length=$(echo -n "$dir" | wc -c) - if [ "$dir" = "/" ]; then - length=0 - fi - seg=$(basename -- "$1") - starts_with_dir=$( \ - find -L "$dir" -mindepth 1 -maxdepth 1 -type d \ - 2>/dev/null | cut -b $(( ${length} + 2 ))- | sed '/^$/d' \ - | while read -r line; do - if [[ "${seg[1]}" != "." && "${line[1]}" == "." ]]; then - continue - fi - if [[ "$line" == "$seg"* ]]; then - echo "$line" - fi - done - ) - if [ -n "$starts_with_dir" ]; then - echo "$starts_with_dir" - else - find -L "$dir" -mindepth 1 -maxdepth 1 -type d \ - 2>/dev/null | cut -b $(( ${length} + 2 ))- | sed '/^$/d' \ - | while read -r line; do - if [[ "${seg[1]}" != "." && "${line[1]}" == "." ]]; then - continue - fi - if [[ "$line" == *"$seg"* ]]; then - echo "$line" - fi - done - fi - fi -} - -_zic_list_generator() { - __zic_matched_subdir_list "${(Q)@[-1]}" | sort -} - -_zic_complete() { - setopt localoptions nonomatch - local l matches fzf tokens base - - l=$(_zic_list_generator $@) - - if [ -z "$l" ]; then - zle ${__zic_default_completion:-expand-or-complete} - return - fi - - fzf=$(__zic_fzf_prog) - - if [ $(echo $l | wc -l) -eq 1 ]; then - matches=${(q)l} - else - matches=$(echo $l \ - | FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} \ - --reverse $FZF_DEFAULT_OPTS $FZF_COMPLETION_OPTS \ - --bind 'shift-tab:up,tab:down'" ${=fzf} \ - | while read -r item; do - echo -n "${(q)item} " - done) - fi - - matches=${matches% } - if [ -n "$matches" ]; then - tokens=(${(z)LBUFFER}) - base="${(Q)@[-1]}" - if [[ "$base" != */ ]]; then - if [[ "$base" == */* ]]; then - base="$(dirname -- "$base")" - if [[ ${base[-1]} != / ]]; then - base="$base/" - fi - else - base="" - fi - fi - LBUFFER="${tokens[1]} " - if [ -n "$base" ]; then - base="${(q)base}" - if [ "${tokens[2][1]}" = "~" ]; then - base="${base/#$HOME/~}" - fi - LBUFFER="${LBUFFER}${base}" - fi - LBUFFER="${LBUFFER}${matches}/" - fi - zle redisplay - typeset -f zle-line-init >/dev/null && zle zle-line-init -} - -zic-completion() { - setopt localoptions noshwordsplit noksh_arrays noposixbuiltins - local tokens cmd - - tokens=(${(z)LBUFFER}) - cmd=${tokens[1]} - - if [[ "$LBUFFER" =~ "^\ *cd$" ]]; then - zle ${__zic_default_completion:-expand-or-complete} - elif [ "$cmd" = cd ]; then - _zic_complete ${tokens[2,${#tokens}]/#\~/$HOME} - else - zle ${__zic_default_completion:-expand-or-complete} - fi -} - -[ -z "$__zic_default_completion" ] && { - binding=$(bindkey '^I') - # $binding[(s: :w)2] - # The command substitution and following word splitting to determine the - # default zle widget for ^I formerly only works if the IFS parameter contains - # a space via $binding[(w)2]. Now it specifically splits at spaces, regardless - # of IFS. - [[ $binding =~ 'undefined-key' ]] || __zic_default_completion=$binding[(s: :w)2] - unset binding -} - -zle -N zic-completion -bindkey -M emacs '^I' zic-completion -bindkey -M viins '^I' zic-completion diff --git a/zsh/plugins/ufw.zsh b/zsh/plugins/ufw.zsh deleted file mode 100644 index f5ad033..0000000 --- a/zsh/plugins/ufw.zsh +++ /dev/null @@ -1,115 +0,0 @@ -#compdef ufw -#autoload - -typeset -A opt_args - -function _ufw_delete_rules { - if ufw status &> /dev/null ; then - ufw status numbered \ - | perl -n -e'/\[ +(\d+)\] +([^ ].+)/ && print "\"$1\[$2\]\" "' - fi -} - -function _ufw_app_profiles { - grep -rhoP "(?<=\[)[^\]]+" /etc/ufw/applications.d/ \ - | awk '{ print "\""$0"\""}' \ - | tr '\n' ' ' -} - -local -a _1st_arguments -_1st_arguments=( - 'allow:add allow rule' - 'app:Application profile commands' - 'default:set default policy' - 'delete:delete RULE' - 'deny:add deny rule' - 'disable:disables the firewall' - 'enable:enables the firewall' - 'insert:insert RULE at NUM' - 'limit:add limit rule' - 'logging:set logging to LEVEL' - 'reject:add reject rule' - 'reload:reloads firewall' - 'reset:reset firewall' - 'show:show firewall report' - 'status:show firewall status' - 'version:display version information' -) - -local context state line curcontext="$curcontext" - -_arguments -C \ - '(--dry-run)--dry-run[dry run]' \ - '1:: :->cmds' \ - '2:: :->subcmds' \ - '3:: :->subsubcmds' \ -&& return 0 - -local rules - -case "$state" in - (cmds) - _describe -t commands "ufw commands" _1st_arguments - return 0 - ;; - (subcmds) - case "$line[1]" in - (app) - _values 'app' \ - 'list[list application profiles]' \ - 'info[show information on PROFILE]' \ - 'update[update PROFILE]' \ - 'default[set default application policy]' \ - && ret=0 - ;; - (status) - _values 'status' \ - 'numbered[show firewall status as numbered list of RULES]' \ - 'verbose[show verbose firewall status]' \ - && ret=0 - ;; - (logging) - _values 'logging' \ - 'on' 'off' 'low' 'medium' 'high' 'full' \ - && ret=0 - ;; - (default) - _values 'default' \ - 'allow' 'deny' 'reject' \ - && ret=0 - ;; - (show) - _values 'show' \ - 'raw' 'builtins' 'before-rules' 'user-rules' 'after-rules' 'logging-rules' 'listening' 'added' \ - && ret=0 - ;; - (delete) - rules="$(_ufw_delete_rules)" - if [[ -n "$rules" ]] ; then - _values 'delete' \ - ${(Q)${(z)"$(_ufw_delete_rules)"}} \ - && ret=0 - fi - ;; - esac - ;; - (subsubcmds) - case "$line[1]" in - (app) - case "$line[2]" in - (info|update) - _values 'profiles' \ - ${(Q)${(z)"$(_ufw_app_profiles)"}} \ - && ret=0 - ;; - esac - ;; - (default) - _values 'default-direction' \ - 'incoming' 'outgoing' \ - && ret=0 - ;; - esac -esac - -return diff --git a/zsh/themes/alicia.zsh-theme b/zsh/themes/alicia.zsh-theme deleted file mode 100644 index b333b6f..0000000 --- a/zsh/themes/alicia.zsh-theme +++ /dev/null @@ -1,42 +0,0 @@ -# ------------------------------------------------------------------------------ -# FILE: alicia.zsh-theme -# DESCRIPTION: A minimal terminal prompt oh-my-zsh theme with git status -# AUTHOR: Alicia Sykes (alicia@omg.lol) -# VERSION: 1.0.0 -# SCREENSHOT: https://i.ibb.co/VWJr8GD/alicia-zsh-theme.gif -# REPO: https://github.com/Lissy93/minimal-terminal-prompt -# DIRECT LINK: https://raw.githubusercontent.com/Lissy93/minimal-terminal-prompt/master/minimal-terminal-prompt.zsh-theme -# ------------------------------------------------------------------------------ - -# Color vars -eval col_gray='$FG[240]' -eval col_primary='$FG[032]' -eval col_diff='$FG[214]' -eval col_diff='$FG[214]' -eval col_same='$FG[034]' - -if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="green"; fi -local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" - -# Primary prompt -PROMPT='$col_gray% ┌┄┈------------------------------------------------------ -$col_gray% ├%{$reset_color%}$col_primary%~\ -$(git_prompt_info) \ -$col_primary%(?.%{$col_primary%}.%{$col_diff%}) -└─▶%{$reset_color%} ' -PROMPT2='%{$fg[red]%}\ %{$reset_color%}' -RPS1='${return_code}' - -# Right prompt -if type "virtualenv_prompt_info" > /dev/null -then - RPROMPT='$(virtualenv_prompt_info)$col_gray%n@%m%{$reset_color%} [$(date +%H:%M)]%' -else - RPROMPT='$col_gray%n@%m%{$reset_color%} [$(date +%H:%M)]%%' -fi - -# Git settings -ZSH_THEME_GIT_PROMPT_PREFIX="$col_primary($col_same" -ZSH_THEME_GIT_PROMPT_CLEAN="" -ZSH_THEME_GIT_PROMPT_DIRTY="$col_diff+%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_SUFFIX="$col_primary)%{$reset_color%}" diff --git a/zsh/themes/angostar.zsh-theme b/zsh/themes/angostar.zsh-theme deleted file mode 100644 index a3beec2..0000000 --- a/zsh/themes/angostar.zsh-theme +++ /dev/null @@ -1,370 +0,0 @@ -# vim:ft=zsh ts=2 sw=2 sts=2 -# -# agnoster's Theme - https://gist.github.com/3712874 -# A Powerline-inspired theme for ZSH -# -# # README -# -# For the icons to work, you need a Powerline patched font -# Check out: https://github.com/powerline/fonts -# -# In addition, I recommend the -# [Solarized theme](https://github.com/altercation/solarized/) and, if you're -# using it on Mac OS X, [iTerm 2](http://www.iterm2.com/) over Terminal.app - -# it has significantly better color fidelity. -# -# # Goals -# -# The aim of this theme is to only show you *relevant* information. Like most -# prompts, it will only show git information when in a git working directory. -# However, it goes a step further: everything from the current user and -# hostname to whether the last call exited with an error to whether background -# jobs are running in this shell will all be displayed automatically when -# appropriate. - -### Segment drawing -# A few utility functions to make it easy and re-usable to draw segmented prompts - -CURRENT_BG='NONE' - -# Characters -SEGMENT_SEPARATOR="\ue0b0" -PLUSMINUS="\u00b1" -BRANCH="\ue0a0" -DETACHED="\u27a6" -CROSS="\u2718" -LIGHTNING="\u26a1" -GEAR="\u2699" - -# Begin a segment -# Takes two arguments, background and foreground. Both can be omitted, -# rendering default background/foreground. -prompt_segment() { - local bg fg - [[ -n $1 ]] && bg="%K{$1}" || bg="%k" - [[ -n $2 ]] && fg="%F{$2}" || fg="%f" - if [[ $CURRENT_BG != 'NONE' && $1 != $CURRENT_BG ]]; then - print -n " %{$bg%F{$CURRENT_BG}%}$SEGMENT_SEPARATOR%{$fg%} " - else - print -n "%{$bg%}%{$fg%} " - fi - CURRENT_BG=$1 - [[ -n $3 ]] && print -n $3 -} - -# End the prompt, closing any open segments -prompt_end() { - if [[ -n $CURRENT_BG ]]; then - print -n " %{%k%F{$CURRENT_BG}%}$SEGMENT_SEPARATOR" - else - print -n "%{%k%}" - fi - print -n "%{%f%}" - CURRENT_BG='' -} - -### Prompt components -# Each component will draw itself, and hide itself if no information needs to be shown - -# Context: user@hostname (who am I and where am I) -prompt_context() { - if [[ -n "$SSH_CLIENT" ]]; then - prompt_segment magenta white "%{$fg_bold[white]%(!.%{%F{white}%}.)%}$USER@%m%{$fg_no_bold[white]%}" - else - prompt_segment yellow magenta "%{$fg_bold[magenta]%(!.%{%F{magenta}%}.)%}@$USER%{$fg_no_bold[magenta]%}" - fi -} - -# Battery Level -prompt_battery() { - HEART='♥ ' - - if [[ $(uname) == "Darwin" ]] ; then - - function battery_is_charging() { - [ $(ioreg -rc AppleSmartBattery | grep -c '^.*"ExternalConnected"\ =\ No') -eq 1 ] - } - - function battery_pct() { - local smart_battery_status="$(ioreg -rc "AppleSmartBattery")" - typeset -F maxcapacity=$(echo $smart_battery_status | grep '^.*"MaxCapacity"\ =\ ' | sed -e 's/^.*"MaxCapacity"\ =\ //') - typeset -F currentcapacity=$(echo $smart_battery_status | grep '^.*"CurrentCapacity"\ =\ ' | sed -e 's/^.*CurrentCapacity"\ =\ //') - integer i=$(((currentcapacity/maxcapacity) * 100)) - echo $i - } - - function battery_pct_remaining() { - if battery_is_charging ; then - battery_pct - else - echo "External Power" - fi - } - - function battery_time_remaining() { - local smart_battery_status="$(ioreg -rc "AppleSmartBattery")" - if [[ $(echo $smart_battery_status | grep -c '^.*"ExternalConnected"\ =\ No') -eq 1 ]] ; then - timeremaining=$(echo $smart_battery_status | grep '^.*"AvgTimeToEmpty"\ =\ ' | sed -e 's/^.*"AvgTimeToEmpty"\ =\ //') - if [ $timeremaining -gt 720 ] ; then - echo "::" - else - echo "~$((timeremaining / 60)):$((timeremaining % 60))" - fi - fi - } - - b=$(battery_pct_remaining) - if [[ $(ioreg -rc AppleSmartBattery | grep -c '^.*"ExternalConnected"\ =\ No') -eq 1 ]] ; then - if [ $b -gt 50 ] ; then - prompt_segment green white - elif [ $b -gt 20 ] ; then - prompt_segment yellow white - else - prompt_segment red white - fi - echo -n "%{$fg_bold[white]%}$HEART$(battery_pct_remaining)%%%{$fg_no_bold[white]%}" - fi - fi - - if [[ $(uname) == "Linux" && -d /sys/module/battery ]] ; then - - function battery_is_charging() { - ! [[ $(acpi 2&>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]] - } - - function battery_pct() { - if (( $+commands[acpi] )) ; then - echo "$(acpi | cut -f2 -d ',' | tr -cd '[:digit:]')" - fi - } - - function battery_pct_remaining() { - if [ ! $(battery_is_charging) ] ; then - battery_pct - else - echo "External Power" - fi - } - - function battery_time_remaining() { - if [[ $(acpi 2&>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]] ; then - echo $(acpi | cut -f3 -d ',') - fi - } - - b=$(battery_pct_remaining) - if [[ $(acpi 2&>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]] ; then - if [ $b -gt 40 ] ; then - prompt_segment green white - elif [ $b -gt 20 ] ; then - prompt_segment yellow white - else - prompt_segment red white - fi - echo -n "%{$fg_bold[white]%}$HEART$(battery_pct_remaining)%%%{$fg_no_bold[white]%}" - fi - - fi -} - -# Git: branch/detached head, dirty status -prompt_git() { -#«»±˖˗‑‐‒ ━ ✚‐↔←↑↓→↭⇎⇔⋆━◂▸◄►◆☀★☗☊✔✖❮❯⚑⚙ - local PL_BRANCH_CHAR - () { - local LC_ALL="" LC_CTYPE="en_US.UTF-8" - PL_BRANCH_CHAR="$BRANCH" - } - local ref dirty mode repo_path clean has_upstream - local modified untracked added deleted tagged stashed - local ready_commit git_status bgclr fgclr - local commits_diff commits_ahead commits_behind has_diverged to_push to_pull - - repo_path=$(git rev-parse --git-dir 2>/dev/null) - - if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then - dirty=$(parse_git_dirty) - git_status=$(git status --porcelain 2> /dev/null) - ref=$(git symbolic-ref HEAD 2> /dev/null) || ref="➦ $(git rev-parse --short HEAD 2> /dev/null)" - if [[ -n $dirty ]]; then - clean='' - bgclr='yellow' - fgclr='magenta' - else - clean=' ✔' - bgclr='green' - fgclr='white' - fi - - local upstream=$(git rev-parse --symbolic-full-name --abbrev-ref @{upstream} 2> /dev/null) - if [[ -n "${upstream}" && "${upstream}" != "@{upstream}" ]]; then has_upstream=true; fi - - local current_commit_hash=$(git rev-parse HEAD 2> /dev/null) - - local number_of_untracked_files=$(\grep -c "^??" <<< "${git_status}") - # if [[ $number_of_untracked_files -gt 0 ]]; then untracked=" $number_of_untracked_files◆"; fi - if [[ $number_of_untracked_files -gt 0 ]]; then untracked=" $number_of_untracked_files☀"; fi - - local number_added=$(\grep -c "^A" <<< "${git_status}") - if [[ $number_added -gt 0 ]]; then added=" $number_added✚"; fi - - local number_modified=$(\grep -c "^.M" <<< "${git_status}") - if [[ $number_modified -gt 0 ]]; then - modified=" $number_modified●" - bgclr='red' - fgclr='white' - fi - - local number_added_modified=$(\grep -c "^M" <<< "${git_status}") - local number_added_renamed=$(\grep -c "^R" <<< "${git_status}") - if [[ $number_modified -gt 0 && $number_added_modified -gt 0 ]]; then - modified="$modified$((number_added_modified+number_added_renamed))±" - elif [[ $number_added_modified -gt 0 ]]; then - modified=" ●$((number_added_modified+number_added_renamed))±" - fi - - local number_deleted=$(\grep -c "^.D" <<< "${git_status}") - if [[ $number_deleted -gt 0 ]]; then - deleted=" $number_deleted‒" - bgclr='red' - fgclr='white' - fi - - local number_added_deleted=$(\grep -c "^D" <<< "${git_status}") - if [[ $number_deleted -gt 0 && $number_added_deleted -gt 0 ]]; then - deleted="$deleted$number_added_deleted±" - elif [[ $number_added_deleted -gt 0 ]]; then - deleted=" ‒$number_added_deleted±" - fi - - local tag_at_current_commit=$(git describe --exact-match --tags $current_commit_hash 2> /dev/null) - if [[ -n $tag_at_current_commit ]]; then tagged=" ☗$tag_at_current_commit "; fi - - local number_of_stashes="$(git stash list -n1 2> /dev/null | wc -l)" - if [[ $number_of_stashes -gt 0 ]]; then - stashed=" ${number_of_stashes##*( )}⚙" - bgclr='magenta' - fgclr='white' - fi - - if [[ $number_added -gt 0 || $number_added_modified -gt 0 || $number_added_deleted -gt 0 ]]; then ready_commit=' ⚑'; fi - - local upstream_prompt='' - if [[ $has_upstream == true ]]; then - commits_diff="$(git log --pretty=oneline --topo-order --left-right ${current_commit_hash}...${upstream} 2> /dev/null)" - commits_ahead=$(\grep -c "^<" <<< "$commits_diff") - commits_behind=$(\grep -c "^>" <<< "$commits_diff") - upstream_prompt="$(git rev-parse --symbolic-full-name --abbrev-ref @{upstream} 2> /dev/null)" - upstream_prompt=$(sed -e 's/\/.*$/ ☊ /g' <<< "$upstream_prompt") - fi - - has_diverged=false - if [[ $commits_ahead -gt 0 && $commits_behind -gt 0 ]]; then has_diverged=true; fi - if [[ $has_diverged == false && $commits_ahead -gt 0 ]]; then - if [[ $bgclr == 'red' || $bgclr == 'magenta' ]] then - to_push=" $fg_bold[white]↑$commits_ahead$fg_bold[$fgclr]" - else - to_push=" $fg_bold[black]↑$commits_ahead$fg_bold[$fgclr]" - fi - fi - if [[ $has_diverged == false && $commits_behind -gt 0 ]]; then to_pull=" $fg_bold[magenta]↓$commits_behind$fg_bold[$fgclr]"; fi - - if [[ -e "${repo_path}/BISECT_LOG" ]]; then - mode=" " - elif [[ -e "${repo_path}/MERGE_HEAD" ]]; then - mode=" >M<" - elif [[ -e "${repo_path}/rebase" || -e "${repo_path}/rebase-apply" || -e "${repo_path}/rebase-merge" || -e "${repo_path}/../.dotest" ]]; then - mode=" >R>" - fi - - prompt_segment $bgclr $fgclr - - print -n "%{$fg_bold[$fgclr]%}${ref/refs\/heads\//$PL_BRANCH_CHAR $upstream_prompt}${mode}$to_push$to_pull$clean$tagged$stashed$untracked$modified$deleted$added$ready_commit%{$fg_no_bold[$fgclr]%}" - fi -} - -prompt_hg() { - local rev status - if $(hg id >/dev/null 2>&1); then - if $(hg prompt >/dev/null 2>&1); then - if [[ $(hg prompt "{status|unknown}") = "?" ]]; then - # if files are not added - prompt_segment red white - st='±' - elif [[ -n $(hg prompt "{status|modified}") ]]; then - # if any modification - prompt_segment yellow black - st='±' - else - # if working copy is clean - prompt_segment green black - fi - print -n $(hg prompt "☿ {rev}@{branch}") $st - else - st="" - rev=$(hg id -n 2>/dev/null | sed 's/[^-0-9]//g') - branch=$(hg id -b 2>/dev/null) - if `hg st | grep -q "^\?"`; then - prompt_segment red black - st='±' - elif `hg st | grep -q "^[MA]"`; then - prompt_segment yellow black - st='±' - else - prompt_segment green black - fi - print -n "☿ $rev@$branch" $st - fi - fi -} - -# Dir: current working directory -prompt_dir() { - prompt_segment cyan white "%{$fg_bold[white]%}%~%{$fg_no_bold[white]%}" -} - -# Virtualenv: current working virtualenv -prompt_virtualenv() { - local virtualenv_path="$VIRTUAL_ENV" - if [[ -n $virtualenv_path && -n $VIRTUAL_ENV_DISABLE_PROMPT ]]; then - prompt_segment blue black "(`basename $virtualenv_path`)" - fi -} - -prompt_time() { - prompt_segment blue white "%{$fg_bold[white]%}%D{%a %e %b - %H:%M}%{$fg_no_bold[white]%}" -} - -# Status: -# - was there an error -# - am I root -# - are there background jobs? -prompt_status() { - local symbols - symbols=() - [[ $RETVAL -ne 0 ]] && symbols+="%{%F{red}%}$CROSS" - [[ $UID -eq 0 ]] && symbols+="%{%F{yellow}%}$LIGHTNING" - [[ $(jobs -l | wc -l) -gt 0 ]] && symbols+="%{%F{cyan}%}$GEAR" - - [[ -n "$symbols" ]] && prompt_segment black default "$symbols" -} - -## Main prompt -build_prompt() { - RETVAL=$? - print -n "\n" - prompt_status - prompt_battery - prompt_time - prompt_virtualenv - prompt_dir - prompt_git - prompt_hg - prompt_end - CURRENT_BG='NONE' - print -n "\n" - prompt_context - prompt_end -} - -PROMPT='%{%f%b%k%}$(build_prompt) ' \ No newline at end of file diff --git a/zsh/zshrc b/zsh/zshrc deleted file mode 100644 index 277bc49..0000000 --- a/zsh/zshrc +++ /dev/null @@ -1,49 +0,0 @@ -# Enable Powerlevel10k Prompt -if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then - source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" -fi - -# Specify directory for Antigen bundles -ADOTDIR=$HOME/.zsh/antigen-bundles - -# Include Antigen Script -source $HOME/.zsh/antigen/antigen.zsh - -# Load the oh-my-zsh's library. -antigen use oh-my-zsh - -# Import local plugins -source $HOME/.zsh/plugins/colored-man-pages.zsh -source $HOME/.zsh/plugins/colorize.zsh -source $HOME/.zsh/plugins/interactive-cd.zsh -#source $HOME/.zsh/plugins/docker-auto-complete.zsh # Requires Docker - -# Enable autocomplete -autoload -Uz compinit -compinit - -# Import local aliases -source $HOME/.zsh/aliases/ansible-aliases.zsh -source $HOME/.zsh/aliases/common-aliases.zsh -#source $HOME/.zsh/aliases/git-aliases.zsh -source $HOME/.zsh/aliases/lol-aliases.zsh -source $HOME/.zsh/aliases/npm-aliases.zsh -source $HOME/.zsh/aliases/tmux-aliases.zsh - -# Add plugins to bundle -antigen bundles <