From 4dbe2a4bcfbca8ea97b5d25b6d2b9a6fee1ff569 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sun, 28 Oct 2012 14:03:16 -0500 Subject: [PATCH 001/234] improve ps1 --- shells/zsh/lib/prompt.zsh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/shells/zsh/lib/prompt.zsh b/shells/zsh/lib/prompt.zsh index 5db829bf..e3672df9 100644 --- a/shells/zsh/lib/prompt.zsh +++ b/shells/zsh/lib/prompt.zsh @@ -100,7 +100,7 @@ function precmd { local cwd="$pr_blue`prompt_pwd`$pr_reset" local char="%0(?.$pr_green.$pr_red)♪$pr_reset" - local time="$pr_grey⌚ %*$pr_reset" + # local time="$pr_grey⌚ %*$pr_reset" local ruby which rvm-prompt &>/dev/null && ruby="❖ `rvm-prompt`" @@ -116,8 +116,6 @@ function precmd { left=($(user_at_host) $cwd $char) right=($rev $ruby $time) - PS1="$left [ " - RPS1="] $right" + PS1="$left " + RPS1=" $right" } - - From f88656cf36b9446b66aaaee953c3ae7b23700023 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sun, 28 Oct 2012 14:03:47 -0500 Subject: [PATCH 002/234] Change emacs colors --- editors/emacs/bjeanes/01_colors.el | 8 ++------ editors/emacs/init.el | 1 + 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/editors/emacs/bjeanes/01_colors.el b/editors/emacs/bjeanes/01_colors.el index 9b92c7be..29c19c81 100644 --- a/editors/emacs/bjeanes/01_colors.el +++ b/editors/emacs/bjeanes/01_colors.el @@ -1,7 +1,3 @@ -(defun plist-to-alist (&optional arg) nil) ; stop a weird error coming - ; from color-theme-molokai -(require 'color-theme) -(require 'color-theme-molokai) -(color-theme-molokai) +(require 'color-theme-sanityinc-tomorrow) -(set-face-background 'hl-line "#000") +(color-theme-sanityinc-tomorrow-night) diff --git a/editors/emacs/init.el b/editors/emacs/init.el index 07e68658..84de9129 100644 --- a/editors/emacs/init.el +++ b/editors/emacs/init.el @@ -24,6 +24,7 @@ markdown-mode color-theme color-theme-molokai + color-theme-sanityinc-tomorrow rainbow-delimiters ctags paredit From 3ac33311cade6b3af0edcf522effdcf1f3a8db4f Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sun, 28 Oct 2012 14:04:07 -0500 Subject: [PATCH 003/234] Change Ruby indentation style --- editors/emacs/bjeanes/ruby.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/editors/emacs/bjeanes/ruby.el b/editors/emacs/bjeanes/ruby.el index e40bf116..4f1fbba6 100644 --- a/editors/emacs/bjeanes/ruby.el +++ b/editors/emacs/bjeanes/ruby.el @@ -2,7 +2,8 @@ (require 'ruby-end) (require 'ruby-tools) -(custom-set-variables '(ruby-end-insert-newline nil)) +(custom-set-variables '(ruby-end-insert-newline nil) + '(ruby-deep-indent-paren nil)) (eval-after-load 'ruby-mode '(progn (add-hook 'ruby-mode-hook From 037ed4a679905cc6581263cf2573ec2eab79e696 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sun, 28 Oct 2012 14:04:26 -0500 Subject: [PATCH 004/234] Indent on new line --- editors/emacs/bjeanes/programming.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/editors/emacs/bjeanes/programming.el b/editors/emacs/bjeanes/programming.el index 934a1fad..5c297b20 100644 --- a/editors/emacs/bjeanes/programming.el +++ b/editors/emacs/bjeanes/programming.el @@ -6,6 +6,8 @@ (require 'autopair) (autopair-mode 1) + (define-key global-map (kbd "RET") 'newline-and-indent) + ;; TODO: Look into whitespace-cleanup instead? (add-hook 'before-save-hook 'delete-trailing-whitespace))) From 232576f0fd068a90cba198e6a00429d46cdd9067 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Fri, 23 Nov 2012 17:36:53 -0600 Subject: [PATCH 005/234] Kaleidoscope 2 --- vcs/git/gitconfig | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/vcs/git/gitconfig b/vcs/git/gitconfig index 68c0321a..19613f14 100644 --- a/vcs/git/gitconfig +++ b/vcs/git/gitconfig @@ -33,3 +33,15 @@ path = .gitconfig.local [credential] helper = osxkeychain +[difftool "Kaleidoscope"] + cmd = ksdiff --partial-changeset --relative-path \"$MERGED\" -- \"$LOCAL\" \"$REMOTE\" +[diff] + tool = Kaleidoscope +[difftool] + prompt = false +[mergetool "Kaleidoscope"] + cmd = ksdiff --merge --output \"$MERGED\" --base \"$BASE\" -- \"$LOCAL\" --snapshot \"$REMOTE\" --snapshot +[mergetool] + prompt = false +[merge] + tool = Kaleidoscope From cc4df524fe9a66efd89e0612ad3e9aa1a273affa Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Fri, 23 Nov 2012 17:37:01 -0600 Subject: [PATCH 006/234] Go emacs --- editors/emacs/bjeanes/go.el | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 editors/emacs/bjeanes/go.el diff --git a/editors/emacs/bjeanes/go.el b/editors/emacs/bjeanes/go.el new file mode 100644 index 00000000..2e4e7dde --- /dev/null +++ b/editors/emacs/bjeanes/go.el @@ -0,0 +1,2 @@ +(require 'go-mode) +(gofmt-before-save) From 10a2d1a43d254cabc7057494300fe7faca2eea30 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Tue, 4 Dec 2012 18:55:32 -0600 Subject: [PATCH 007/234] Fix history --- shells/zsh/lib/history.zsh | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 shells/zsh/lib/history.zsh diff --git a/shells/zsh/lib/history.zsh b/shells/zsh/lib/history.zsh new file mode 100644 index 00000000..876936b8 --- /dev/null +++ b/shells/zsh/lib/history.zsh @@ -0,0 +1,13 @@ +## Command history configuration +HISTFILE=$HOME/.zsh_history +HISTSIZE=10000 +SAVEHIST=10000 + +setopt append_history +setopt extended_history +setopt hist_expire_dups_first +setopt hist_ignore_dups # ignore duplication command history list +setopt hist_ignore_space +setopt hist_verify +setopt inc_append_history +setopt share_history # share command history data From 7b455a64a1e138e99b4134425750c09322f8a5ac Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Tue, 4 Dec 2012 18:55:49 -0600 Subject: [PATCH 008/234] see latest branches --- vcs/git/gitconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/vcs/git/gitconfig b/vcs/git/gitconfig index 19613f14..403e2e73 100644 --- a/vcs/git/gitconfig +++ b/vcs/git/gitconfig @@ -4,6 +4,7 @@ push-all = "!for i in $(git config --list | grep -E ^remote\\..+\\.url | sed -E 's/^remote\\.(.*)\\.url=.*/\\1/'); do git push $i master; done" unadd = reset HEAD ctags = !.git/hooks/ctags + latest = for-each-ref --sort=-committerdate --format='%(committerdate:relative) -> %(refname:short)' [apply] whitespace = nowarn [color] From c546df31560d7c68251cfc1cfe0c66b6b05a32a5 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sat, 9 Mar 2013 23:38:45 -0600 Subject: [PATCH 009/234] Ignore hub credentials --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 69c84937..21e2b8f1 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ Transmission Remote GUI vim/bundle/* Fritzing +hub From b6a3a935fa2d158a39513f98e6e91c66d54825cd Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sat, 9 Mar 2013 23:39:27 -0600 Subject: [PATCH 010/234] Show when ZSH is waiting for completion --- shells/zsh/lib/completion-waiting-dots.zsh | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 shells/zsh/lib/completion-waiting-dots.zsh diff --git a/shells/zsh/lib/completion-waiting-dots.zsh b/shells/zsh/lib/completion-waiting-dots.zsh new file mode 100644 index 00000000..b3cb37c1 --- /dev/null +++ b/shells/zsh/lib/completion-waiting-dots.zsh @@ -0,0 +1,8 @@ +# http://stackoverflow.com/a/844299 +expand-or-complete-with-dots() { + echo -n "\e[31m...\e[0m" + zle expand-or-complete + zle redisplay +} +zle -N expand-or-complete-with-dots +bindkey "^I" expand-or-complete-with-dots From f48931f4e89c8d709f4762ab959f9f602d7ae248 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sat, 9 Mar 2013 23:41:24 -0600 Subject: [PATCH 011/234] Try to get my zsh config loadable inside emacs shell --- editors/emacs/init.el | 17 +++++++++++++++++ shells/tmux.sh | 24 +++++++++++++----------- shells/zsh/config.zsh | 2 ++ shells/zsh/lib/prompt.zsh | 16 ++++++---------- 4 files changed, 38 insertions(+), 21 deletions(-) diff --git a/editors/emacs/init.el b/editors/emacs/init.el index 84de9129..6422ef44 100644 --- a/editors/emacs/init.el +++ b/editors/emacs/init.el @@ -38,3 +38,20 @@ (dolist (p my-packages) (when (not (package-installed-p p)) (package-install p))) + +;; This takes a really long time because ZSH init scripts are TOO slow! +;; Thoughts: +;; * Extract a lot of non-interactive ZSH stuff to spawn from +;; .zshenv and adjust exec-path-from-shell to not start interactive +;; shell +(when (memq window-system '(mac ns)) + (exec-path-from-shell-initialize)) + +;; TODO: +;; * Go snippets +;; * Custom ruby/rspec snippetts +;; * proper auto-complete / intellisense +;; * auto pop-up (~100ms) +;; * intuitive TAB/ENTER support +;; * can be backed by REPL, ctags, buffer words, etc +;; * Plug snippets into auto-complete diff --git a/shells/tmux.sh b/shells/tmux.sh index 2fc0fbdc..53efc42f 100644 --- a/shells/tmux.sh +++ b/shells/tmux.sh @@ -7,16 +7,18 @@ # If we aren't in Tmux, set it up if [ -z "$TMUX" ]; then - if which tmux 2>&1 >/dev/null; then - if [ -z "$(tmux ls | grep 'login:')" ]; then - tmux new-session -d -s login # Create a detached session called login - tmux new-session -t login # Create a *new* session bound to the same windows - else - last_session="$(tmux list-windows -t login | tail -n1 | cut -d: -f1)" - tmux new-session -t login \; new-window -a -t $last_session # Create a *new* session bound to "login" and create a new window - fi + if tty >/dev/null; then + if which tmux 2>&1 >/dev/null; then + if [ -z "$(tmux ls | grep 'login:')" ]; then + tmux new-session -d -s login # Create a detached session called login + tmux new-session -t login # Create a *new* session bound to the same windows + else + last_session="$(tmux list-windows -t login | tail -n1 | cut -d: -f1)" + tmux new-session -t login \; new-window -a -t $last_session # Create a *new* session bound to "login" and create a new window + fi - # When Tmux exits, we exit - exit - fi + # When Tmux exits, we exit + exit + fi + fi fi diff --git a/shells/zsh/config.zsh b/shells/zsh/config.zsh index 427b26ca..5ed3a444 100644 --- a/shells/zsh/config.zsh +++ b/shells/zsh/config.zsh @@ -1,5 +1,7 @@ alias reload="source ~/.zshrc" +[[ $EMACS = t ]] && unsetopt zle + fpath=($SHELL_FILES/completions $fpath) # Option-Left + Option-Right for moving word-by-word in OS X diff --git a/shells/zsh/lib/prompt.zsh b/shells/zsh/lib/prompt.zsh index e3672df9..20ba7152 100644 --- a/shells/zsh/lib/prompt.zsh +++ b/shells/zsh/lib/prompt.zsh @@ -1,19 +1,15 @@ -autoload zsh/terminfo - pr_reset="%f%u%k%s%b" # reset all codes -if [ "$terminfo[colors]" -eq 256 ]; then +pr_red="%F{red}" +pr_blue="%F{blue}" +pr_green="%F{green}" +pr_grey="%B%F{black}" + +if [ "$(tput colors 2>/dev/null)" -eq 256 ]; then pr_red="%F{52}" pr_blue="%F{25}" pr_green="%F{28}" pr_grey="%F{59}" -else - if [ "$terminfo[colors]" -eq 8 ]; then - pr_red="%F{red}" - pr_blue="%F{blue}" - pr_green="%F{green}" - pr_grey="%B%F{black}" - fi fi # VCS configuration From 126381994b297866d62d2743c365e733ec91238f Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sat, 9 Mar 2013 23:42:11 -0600 Subject: [PATCH 012/234] misc emacs stuff --- editors/emacs/bjeanes/99_vim.el | 54 ++++++++++++++++++++++++---- editors/emacs/bjeanes/bindings.el | 4 +++ editors/emacs/bjeanes/clojure.el | 1 + editors/emacs/bjeanes/programming.el | 16 +++++++-- editors/emacs/bjeanes/snippets.el | 8 +++++ editors/emacs/init.el | 36 ++++++++++--------- 6 files changed, 94 insertions(+), 25 deletions(-) create mode 100644 editors/emacs/bjeanes/snippets.el diff --git a/editors/emacs/bjeanes/99_vim.el b/editors/emacs/bjeanes/99_vim.el index 8c449892..d3da8088 100644 --- a/editors/emacs/bjeanes/99_vim.el +++ b/editors/emacs/bjeanes/99_vim.el @@ -1,11 +1,51 @@ -(require 'evil) -(add-hook 'prog-mode-hook 'evil-mode) -(require 'surround) -(add-hook 'prog-mode-hook 'global-surround-mode) - -(define-key evil-motion-state-map (kbd "C-u") 'evil-scroll-up) - ;; TODO ;; * Map D to C-k (i.e. preserve paredit's version) ;; * Make word motions obey subword-mode setting ;; * Put current Evil state into powerline + +(require 'evil) + +;; This is actually mapped but it doesn't seem to work reliably +;; without this +(define-key evil-motion-state-map (kbd "C-u") 'evil-scroll-up) + +;; Escape quits +;; https://github.com/mbriggs/.emacs.d/blob/d9e254ae/my-keymaps.el#L81-L89 +(define-key evil-normal-state-map [escape] 'keyboard-quit) +(define-key evil-visual-state-map [escape] 'keyboard-quit) +(define-key minibuffer-local-map [escape] 'minibuffer-keyboard-quit) +(define-key minibuffer-local-ns-map [escape] 'minibuffer-keyboard-quit) +(define-key minibuffer-local-completion-map [escape] 'minibuffer-keyboard-quit) +(define-key minibuffer-local-must-match-map [escape] 'minibuffer-keyboard-quit) +(define-key minibuffer-local-isearch-map [escape] 'minibuffer-keyboard-quit) + + +(require 'cl) ; for `flet` +(flet ((move-key (keymap-from keymap-to key) + (define-key keymap-to key (lookup-key keymap-from key)) + (define-key keymap-from key nil))) + ;; Keep space/return available for other modes + ;; http://emacswiki.org/emacs/Evil#toc11 + (move-key evil-motion-state-map evil-normal-state-map (kbd "RET")) + (move-key evil-motion-state-map evil-normal-state-map " ")) + +;; a la vim-surround +(require 'surround) +(add-hook 'prog-mode-hook + (lambda () + (turn-on-evil-mode) + (turn-on-surround-mode))) + +;; "tabs" (http://emacswiki.org/emacs/Evil#toc16) +(load "elscreen" "ElScreen" t) +(define-key evil-normal-state-map (kbd "C-w t") 'elscreen-create) ;create tab +(define-key evil-normal-state-map (kbd "C-w x") 'elscreen-kill) ;kill tab +(define-key evil-normal-state-map "gT" 'elscreen-previous) ;previous tab +(define-key evil-normal-state-map "gt" 'elscreen-next) ;next tab + +(require 'evil-paredit) +(add-hook 'emacs-lisp-mode-hook 'evil-paredit-mode) +(add-hook 'clojure-mode-hook 'evil-paredit-mode) +(add-hook 'common-lisp-mode-hook 'evil-paredit-mode) +(add-hook 'scheme-mode-hook 'evil-paredit-mode) +(add-hook 'lisp-mode-hook 'evil-paredit-mode) diff --git a/editors/emacs/bjeanes/bindings.el b/editors/emacs/bjeanes/bindings.el index ea957a56..56926bc5 100644 --- a/editors/emacs/bjeanes/bindings.el +++ b/editors/emacs/bjeanes/bindings.el @@ -1,3 +1,7 @@ (global-set-key (kbd "C-x M-f") 'ido-find-file-other-window) (global-set-key (kbd "C-x m") 'eshell) + +(define-key global-map (kbd "C-+") 'text-scale-increase) +(define-key global-map (kbd "C--") 'text-scale-decrease) + (define-key 'help-command "a" 'apropos) diff --git a/editors/emacs/bjeanes/clojure.el b/editors/emacs/bjeanes/clojure.el index f2a87db9..46739630 100644 --- a/editors/emacs/bjeanes/clojure.el +++ b/editors/emacs/bjeanes/clojure.el @@ -1,6 +1,7 @@ (require 'clojure-mode) (define-clojure-indent (defroutes 'defun) + (do-seq 1) (GET 2) (POST 2) (PUT 2) diff --git a/editors/emacs/bjeanes/programming.el b/editors/emacs/bjeanes/programming.el index 5c297b20..c101bebe 100644 --- a/editors/emacs/bjeanes/programming.el +++ b/editors/emacs/bjeanes/programming.el @@ -8,6 +8,18 @@ (define-key global-map (kbd "RET") 'newline-and-indent) - ;; TODO: Look into whitespace-cleanup instead? (add-hook 'before-save-hook - 'delete-trailing-whitespace))) + (lambda () + (gofmt-before-save) + (delete-trailing-whitespace))) + + (require 'auto-complete-config) + (ac-config-default))) + + +;;;;;;;; misc + +;; Auto-compile is really annoying if you have an existing +;; compilation process that puts the output elsewhere or names it +;; differently (e.g. Rails asset pipeline, Middleman, etc) +(setq scss-compile-at-save nil) diff --git a/editors/emacs/bjeanes/snippets.el b/editors/emacs/bjeanes/snippets.el new file mode 100644 index 00000000..d15468bb --- /dev/null +++ b/editors/emacs/bjeanes/snippets.el @@ -0,0 +1,8 @@ +(require 'yasnippet) + +(add-to-list 'yas-snippet-dirs + (concat esk-user-dir "/snippets")) + +(yas-reload-all) + +(add-hook 'prog-mode-hook 'yas-minor-mode) diff --git a/editors/emacs/init.el b/editors/emacs/init.el index 6422ef44..3b9b517c 100644 --- a/editors/emacs/init.el +++ b/editors/emacs/init.el @@ -9,30 +9,34 @@ (package-refresh-contents)) ;; Add in your own as you wish: -(defvar my-packages '(starter-kit - starter-kit-ruby - starter-kit-lisp - starter-kit-eshell - starter-kit-js +(defvar my-packages '(ac-nrepl + auto-complete + autopair clojure-mode clojure-test-mode clojurescript-mode - autopair - ruby-tools - ruby-end - ruby-electric - markdown-mode color-theme - color-theme-molokai color-theme-sanityinc-tomorrow - rainbow-delimiters ctags + evil + evil-paredit + exec-path-from-shell + find-file-in-repository + markdown-mode paredit - undo-tree - org powerline - evil - surround) + rainbow-delimiters + ruby-electric + ruby-end + ruby-tools + starter-kit + starter-kit-eshell + starter-kit-js + starter-kit-lisp + starter-kit-ruby + surround + undo-tree + yasnippet) "A list of packages to ensure are installed at launch.") (dolist (p my-packages) From 5ae1347376331d02df051c2f81cad73c9e0fbe52 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sat, 9 Mar 2013 23:42:32 -0600 Subject: [PATCH 013/234] Upgrade lein plugins --- languages/clojure/lein/profiles.clj | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/languages/clojure/lein/profiles.clj b/languages/clojure/lein/profiles.clj index 6cd92107..32249971 100644 --- a/languages/clojure/lein/profiles.clj +++ b/languages/clojure/lein/profiles.clj @@ -1,13 +1,11 @@ -{:user {:plugins [[lein-beanstalk "0.2.2"] - [lein-light "0.0.4"] +{:user {:plugins [[lein-beanstalk "0.2.6"] + [lein-light "0.0.16"] [lein-marginalia "0.7.1"] - [lein-clojars "0.9.0"] - [lein-tarsier "0.9.1"] - ;[lein-pedantic "0.0.2"] + [lein-clojars "0.9.1"] [lein-outdated "1.0.0"] - [lein-ring "0.7.5"] - [lein-swank "1.4.0"]] - :dependencies [[clj-stacktrace "0.2.4"]] + [lein-ring "0.8.2"] + [lein-swank "1.4.5"]] + :dependencies [[clj-stacktrace "0.2.5"]] :injections [(let [orig (ns-resolve (doto 'clojure.stacktrace require) 'print-cause-trace) new (ns-resolve (doto 'clj-stacktrace.repl require) From 63d76d8325f59b852df2697a73a1f9e6e5d8c12d Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sat, 9 Mar 2013 23:42:47 -0600 Subject: [PATCH 014/234] Trying 'le git' --- vcs/git/gitconfig | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/vcs/git/gitconfig b/vcs/git/gitconfig index 403e2e73..c95e3fff 100644 --- a/vcs/git/gitconfig +++ b/vcs/git/gitconfig @@ -5,6 +5,14 @@ unadd = reset HEAD ctags = !.git/hooks/ctags latest = for-each-ref --sort=-committerdate --format='%(committerdate:relative) -> %(refname:short)' + switch = !legit switch \"$@\" + branches = !legit branches + sprout = !legit sprout \"$@\" + unpublish = !legit unpublish \"$@\" + harvest = !legit harvest \"$@\" + sync = !legit sync \"$@\" + publish = !legit publish \"$@\" + graft = !legit graft \"$@\" [apply] whitespace = nowarn [color] From 0ddea1871f44447777ee56ed510681b189154930 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sat, 9 Mar 2013 23:43:00 -0600 Subject: [PATCH 015/234] Fix kaleidoscope diffing --- vcs/git/gitconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/vcs/git/gitconfig b/vcs/git/gitconfig index c95e3fff..b24d6cad 100644 --- a/vcs/git/gitconfig +++ b/vcs/git/gitconfig @@ -50,6 +50,7 @@ prompt = false [mergetool "Kaleidoscope"] cmd = ksdiff --merge --output \"$MERGED\" --base \"$BASE\" -- \"$LOCAL\" --snapshot \"$REMOTE\" --snapshot + trustExitCode = true [mergetool] prompt = false [merge] From 36cc66d65b134fb268d2674ee71d349ff3119f03 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Mon, 11 Mar 2013 12:55:32 -0500 Subject: [PATCH 016/234] Remove empty hook --- vcs/git/git_template/hooks/foo | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 vcs/git/git_template/hooks/foo diff --git a/vcs/git/git_template/hooks/foo b/vcs/git/git_template/hooks/foo deleted file mode 100644 index e69de29b..00000000 From 68cdd42e6ee6c9d9b83f61189b350f0cb3ecbaff Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Mon, 11 Mar 2013 12:56:16 -0500 Subject: [PATCH 017/234] Update vundle --- editors/vim/bundle/vundle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/editors/vim/bundle/vundle b/editors/vim/bundle/vundle index 3bf598d1..5dd478e1 160000 --- a/editors/vim/bundle/vundle +++ b/editors/vim/bundle/vundle @@ -1 +1 @@ -Subproject commit 3bf598d169993d703c21115876c36e460a51b100 +Subproject commit 5dd478e18e2a613466776c94f16dd5c329123cae From 7be8c80a644a4831358dc65e041bd030641ff592 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Mon, 11 Mar 2013 12:56:36 -0500 Subject: [PATCH 018/234] Add git alias for adding files without whitespace changes --- vcs/git/gitconfig | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/vcs/git/gitconfig b/vcs/git/gitconfig index b24d6cad..dcfd1c7c 100644 --- a/vcs/git/gitconfig +++ b/vcs/git/gitconfig @@ -1,7 +1,6 @@ [alias] - co = checkout - put = push origin HEAD - push-all = "!for i in $(git config --list | grep -E ^remote\\..+\\.url | sed -E 's/^remote\\.(.*)\\.url=.*/\\1/'); do git push $i master; done" + # Add file excluding whitespace changes (http://stackoverflow.com/a/7149602/56690) + addnw = !sh -c 'git diff -w --no-color "$@" | git apply --cached --ignore-whitespace' - unadd = reset HEAD ctags = !.git/hooks/ctags latest = for-each-ref --sort=-committerdate --format='%(committerdate:relative) -> %(refname:short)' From 6391e28ff22aef533a5105dffed9947211b5edac Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Mon, 11 Mar 2013 12:56:47 -0500 Subject: [PATCH 019/234] Improve git ctags alias --- vcs/git/gitconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vcs/git/gitconfig b/vcs/git/gitconfig index dcfd1c7c..85807f89 100644 --- a/vcs/git/gitconfig +++ b/vcs/git/gitconfig @@ -2,7 +2,7 @@ # Add file excluding whitespace changes (http://stackoverflow.com/a/7149602/56690) addnw = !sh -c 'git diff -w --no-color "$@" | git apply --cached --ignore-whitespace' - unadd = reset HEAD - ctags = !.git/hooks/ctags + ctags = "!$(git rev-parse --show-toplevel)/.git/hooks/ctags" latest = for-each-ref --sort=-committerdate --format='%(committerdate:relative) -> %(refname:short)' switch = !legit switch \"$@\" branches = !legit branches From ecea8cb317ea404f13951f5c8c18e464fc903865 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Thu, 21 Mar 2013 19:42:17 -0500 Subject: [PATCH 020/234] Rails 3+ has dbconsole now, so this isn't needed --- shells/common/ruby.sh | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/shells/common/ruby.sh b/shells/common/ruby.sh index 82ccefd8..675617bd 100644 --- a/shells/common/ruby.sh +++ b/shells/common/ruby.sh @@ -2,19 +2,3 @@ export GEM_OPEN_EDITOR="$editor" export IRBRC="$HOME/.irbrc" export RBXOPT="-Xrbc.db=/tmp/rbx -X19" export JRUBY_OPTS="--1.9" - -function __database_yml { - if [[ -f config/database.yml ]]; then - ruby -ryaml -rerb -e "puts YAML::load(ERB.new(IO.read('config/database.yml')).result)['${RAILS_ENV:-development}']['$1']" - fi -} - -export PSQL_EDITOR='vim +"set syntax=sql"' -function psql -{ - if [[ "$(__database_yml adapter)" == 'postgresql' ]]; then - PGDATABASE="$(__database_yml database)" "$(which psql)" "$@" - return $? - fi - "$(/usr/bin/which psql)" "$@" -} From 1d72b1f1cf3377dfca25e80f5aad33abd60bbcc8 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Fri, 22 Mar 2013 22:10:49 -0500 Subject: [PATCH 021/234] In-line rbenv stuff into ruby.sh --- shells/common/rbenv.sh | 2 -- shells/common/ruby.sh | 3 +++ 2 files changed, 3 insertions(+), 2 deletions(-) delete mode 100644 shells/common/rbenv.sh diff --git a/shells/common/rbenv.sh b/shells/common/rbenv.sh deleted file mode 100644 index fa039118..00000000 --- a/shells/common/rbenv.sh +++ /dev/null @@ -1,2 +0,0 @@ -which rbenv &>/dev/null || return -eval "$(rbenv init - $CURRENT_SHELL)" diff --git a/shells/common/ruby.sh b/shells/common/ruby.sh index 675617bd..eff51011 100644 --- a/shells/common/ruby.sh +++ b/shells/common/ruby.sh @@ -2,3 +2,6 @@ export GEM_OPEN_EDITOR="$editor" export IRBRC="$HOME/.irbrc" export RBXOPT="-Xrbc.db=/tmp/rbx -X19" export JRUBY_OPTS="--1.9" + +which rbenv &>/dev/null || return +eval "$(rbenv init - $CURRENT_SHELL)" From e903c13fe92a6ed3361910aa377f79c73ea6b943 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sun, 31 Mar 2013 16:03:20 -0500 Subject: [PATCH 022/234] Fix IRB history --- languages/ruby/irbrc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/languages/ruby/irbrc b/languages/ruby/irbrc index 9ece9ac1..a4015a41 100755 --- a/languages/ruby/irbrc +++ b/languages/ruby/irbrc @@ -5,6 +5,14 @@ rescue LoadError $stderr.puts "Please install 'irbtools' or add it to your Gemfile" end +require 'irb/ext/save-history' +require 'irb/completion' + +ARGV.concat [ "--readline", "--prompt-mode", "simple" ] + +IRB.conf[:SAVE_HISTORY] = 1000 +IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb-save-history" + class Object # Return a list of methods defined locally for a particular object. Useful # for seeing what it does whilst losing all the guff that's implemented From 06ab47e726e2e38ad856242dfac8162e1052c789 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sun, 31 Mar 2013 16:03:43 -0500 Subject: [PATCH 023/234] Support chruby --- shells/common/ruby.sh | 27 +++++++++++++++++++++++++-- shells/zsh/lib/prompt.zsh | 5 ++--- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/shells/common/ruby.sh b/shells/common/ruby.sh index eff51011..fce0e66b 100644 --- a/shells/common/ruby.sh +++ b/shells/common/ruby.sh @@ -3,5 +3,28 @@ export IRBRC="$HOME/.irbrc" export RBXOPT="-Xrbc.db=/tmp/rbx -X19" export JRUBY_OPTS="--1.9" -which rbenv &>/dev/null || return -eval "$(rbenv init - $CURRENT_SHELL)" +if [ -f "/usr/local/share/chruby/chruby.sh" ]; then + source /usr/local/share/chruby/chruby.sh + source /usr/local/share/chruby/auto.sh + chruby 2.0.0-p0 + + function current_ruby() { + if [ "x$RUBY_ROOT" != "x" ]; then + echo `basename $RUBY_ROOT` + else + return 1 + fi + } +elif [ `which rbenv &>/dev/null` ]; then + eval "$(rbenv init - $CURRENT_SHELL)" + + function current_ruby() { + echo `rbenv version-name` + } +elif [ `which rvm &>/dev/null` ]; then + source $HOME/.rvm/scripts/rvm + + function current_ruby() { + echo `rvm-prompt` + } +fi diff --git a/shells/zsh/lib/prompt.zsh b/shells/zsh/lib/prompt.zsh index 20ba7152..22c643b2 100644 --- a/shells/zsh/lib/prompt.zsh +++ b/shells/zsh/lib/prompt.zsh @@ -99,9 +99,8 @@ function precmd { # local time="$pr_grey⌚ %*$pr_reset" local ruby - which rvm-prompt &>/dev/null && ruby="❖ `rvm-prompt`" - which rbenv &>/dev/null && ruby="❖ `rbenv version-name`" - + ruby="$(current_ruby)" + [ "x$ruby" != "x" ] && ruby="❖ $ruby" local rev="$pr_grey$vcs_info_msg_0_$pr_reset" rev="${rev/\(git\)/±}" From 76fa447d9016a15515b4e6c65be6fd1f1b4bff80 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sun, 31 Mar 2013 16:03:55 -0500 Subject: [PATCH 024/234] Git improvements --- shells/common/git.sh | 19 ------------------- vcs/git/gitconfig | 12 ++++++++++-- 2 files changed, 10 insertions(+), 21 deletions(-) diff --git a/shells/common/git.sh b/shells/common/git.sh index bf9d00fb..d111a0af 100644 --- a/shells/common/git.sh +++ b/shells/common/git.sh @@ -1,27 +1,8 @@ -export GIT_EDITOR="$EDITOR" - alias gi='git init' alias gst='git status -s' alias gl='git pull --rebase' alias gp='git push' -alias gpa='git push-all' # see [alias] in ~/.gitconfig alias ga='git add' -alias gcl='git config --list' alias gc='git commit -v' alias gca='git commit -v -a' -alias gb='git branch --color' -alias gba='gb -a' -alias gco='git checkout' -alias gdc='git-svn dcommit' alias gd='git diff' -alias gk='gitk --all &' -alias gx="open -b nl.frim.GitX" -alias grm="git stat | grep deleted | awk '{print $3}' | xargs git rm" -alias gpatch='git diff master -p' -alias glg="git log --decorate --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative" -alias ignore_empty='find . \( -type d -empty \) -and \( -not -regex ./\.git.* \) -exec touch {}/.gitignore \;' - -if [[ -d "/usr/local/git" ]]; then - PATH="/usr/local/git/bin:$PATH" - MANPATH="/usr/local/git/man:$MANPATH" -fi diff --git a/vcs/git/gitconfig b/vcs/git/gitconfig index 85807f89..49dc4d6a 100644 --- a/vcs/git/gitconfig +++ b/vcs/git/gitconfig @@ -4,6 +4,7 @@ unadd = reset HEAD ctags = "!$(git rev-parse --show-toplevel)/.git/hooks/ctags" latest = for-each-ref --sort=-committerdate --format='%(committerdate:relative) -> %(refname:short)' + lg = log --decorate --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative switch = !legit switch \"$@\" branches = !legit branches sprout = !legit sprout \"$@\" @@ -13,7 +14,7 @@ publish = !legit publish \"$@\" graft = !legit graft \"$@\" [apply] - whitespace = nowarn + whitespace = fix [color] branch = auto diff = auto @@ -22,7 +23,9 @@ [core] attributesfile = ~/.gitattributes excludesfile = ~/.gitignore - whitespace = fix + whitespace = trailing-space,space-before-tab + precomposeunicode = true + editor = vim -u NONE +0 -c 'syntax on' [branch] autosetupmerge = always autosetuprebase = local @@ -40,11 +43,15 @@ path = .gitconfig.merge path = .gitconfig.local [credential] + username = bjeanes helper = osxkeychain [difftool "Kaleidoscope"] cmd = ksdiff --partial-changeset --relative-path \"$MERGED\" -- \"$LOCAL\" \"$REMOTE\" [diff] + algorithm = minimal + mnemonicprefix = true tool = Kaleidoscope + renames = copies [difftool] prompt = false [mergetool "Kaleidoscope"] @@ -53,4 +60,5 @@ [mergetool] prompt = false [merge] + conflictstyle = diff3 tool = Kaleidoscope From 810b84cf77f6c66a6989badf407243209a791d2c Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Mon, 1 Apr 2013 12:48:11 -0500 Subject: [PATCH 025/234] If no ruby switcher is installed, don't try to figure out version --- shells/common/ruby.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/shells/common/ruby.sh b/shells/common/ruby.sh index fce0e66b..45958ccc 100644 --- a/shells/common/ruby.sh +++ b/shells/common/ruby.sh @@ -27,4 +27,6 @@ elif [ `which rvm &>/dev/null` ]; then function current_ruby() { echo `rvm-prompt` } +else + function current_ruby() {} fi From dfc4ec4a53288fef394f01346f47516d0b0a19cc Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Mon, 1 Apr 2013 13:00:14 -0500 Subject: [PATCH 026/234] Fix ruby switcher detection for non-chruby --- shells/common/ruby.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/shells/common/ruby.sh b/shells/common/ruby.sh index 45958ccc..3e00e64e 100644 --- a/shells/common/ruby.sh +++ b/shells/common/ruby.sh @@ -3,6 +3,8 @@ export IRBRC="$HOME/.irbrc" export RBXOPT="-Xrbc.db=/tmp/rbx -X19" export JRUBY_OPTS="--1.9" +which=`which -a which | tail -n1` # avoid builtin + if [ -f "/usr/local/share/chruby/chruby.sh" ]; then source /usr/local/share/chruby/chruby.sh source /usr/local/share/chruby/auto.sh @@ -15,13 +17,13 @@ if [ -f "/usr/local/share/chruby/chruby.sh" ]; then return 1 fi } -elif [ `which rbenv &>/dev/null` ]; then +elif $which -s rbenv; then eval "$(rbenv init - $CURRENT_SHELL)" function current_ruby() { echo `rbenv version-name` } -elif [ `which rvm &>/dev/null` ]; then +elif $which -s rvm; then source $HOME/.rvm/scripts/rvm function current_ruby() { From 8c30f2c66f469c0519afc047c532eadfc26216ec Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Mon, 1 Apr 2013 13:00:33 -0500 Subject: [PATCH 027/234] Simplify current ruby output for rbenv/rvm --- shells/common/ruby.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/shells/common/ruby.sh b/shells/common/ruby.sh index 3e00e64e..609e3d90 100644 --- a/shells/common/ruby.sh +++ b/shells/common/ruby.sh @@ -12,7 +12,7 @@ if [ -f "/usr/local/share/chruby/chruby.sh" ]; then function current_ruby() { if [ "x$RUBY_ROOT" != "x" ]; then - echo `basename $RUBY_ROOT` + basename $RUBY_ROOT else return 1 fi @@ -21,13 +21,13 @@ elif $which -s rbenv; then eval "$(rbenv init - $CURRENT_SHELL)" function current_ruby() { - echo `rbenv version-name` + rbenv version-name } elif $which -s rvm; then source $HOME/.rvm/scripts/rvm function current_ruby() { - echo `rvm-prompt` + rvm-prompt } else function current_ruby() {} From 2244d39aa543229addf791df1513b6b4fbaed0bf Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Tue, 2 Apr 2013 16:29:28 -0500 Subject: [PATCH 028/234] bash compatibility issues --- shells/common/aliases.sh | 2 +- shells/common/ruby.sh | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/shells/common/aliases.sh b/shells/common/aliases.sh index bb4e9932..1e513db7 100644 --- a/shells/common/aliases.sh +++ b/shells/common/aliases.sh @@ -1,4 +1,4 @@ -which hub &>/dev/null && alias git='nocorrect hub' +which hub &>/dev/null && alias git='hub' alias ll='ls -lah' alias l='ls' diff --git a/shells/common/ruby.sh b/shells/common/ruby.sh index 609e3d90..dbb8efdc 100644 --- a/shells/common/ruby.sh +++ b/shells/common/ruby.sh @@ -30,5 +30,7 @@ elif $which -s rvm; then rvm-prompt } else - function current_ruby() {} + function current_ruby() { + exit 0 + } fi From 8968d4e856ab580e83ff01678a44ff40669d63c7 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Wed, 3 Apr 2013 22:13:13 -0500 Subject: [PATCH 029/234] Add go-mode to emacs --- editors/emacs/init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/editors/emacs/init.el b/editors/emacs/init.el index 3b9b517c..b337ae93 100644 --- a/editors/emacs/init.el +++ b/editors/emacs/init.el @@ -22,6 +22,7 @@ evil-paredit exec-path-from-shell find-file-in-repository + go-mode markdown-mode paredit powerline From e067430faadf19583fdd592a065756f511605fe4 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Thu, 4 Apr 2013 20:26:51 -0500 Subject: [PATCH 030/234] Fix pbcopy/pbpaste wrapper installer --- shells/common/osx.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shells/common/osx.sh b/shells/common/osx.sh index 72eb17b4..78831f30 100644 --- a/shells/common/osx.sh +++ b/shells/common/osx.sh @@ -20,8 +20,8 @@ if which reattach-to-user-namespace >/dev/null 2>&1; then else if [ -n "$TMUX" ]; then echo "Installing pbpaste/pbcopy wrappers to get them working in Tmux..." - formula="https://raw.github.com/phinze/homebrew/15e923f17f282e6dcd2b2155947163ffed7ec8c9/Library/Formula/reattach-to-user-namespace.rb" - brew install --HEAD "$formula" --wrap-pbpaste-and-pbcopy >/dev/null 2>&1 && echo "Done." || echo "Failed." + formula="--HEAD --wrap-pbcopy-and-pbpaste --wrap-launchctl reattach-to-user-namespace" + brew install $formula >/dev/null 2>&1 && echo "Done." || echo "Failed." __setup_tmux_wrappers fi fi From c78b9cbbc16df5ee3d3599f837828a36ff2051f5 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Thu, 4 Apr 2013 20:27:00 -0500 Subject: [PATCH 031/234] Slight performance tweak --- shells/zsh/zshenv | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/shells/zsh/zshenv b/shells/zsh/zshenv index bdd25030..33cf15ff 100644 --- a/shells/zsh/zshenv +++ b/shells/zsh/zshenv @@ -1,2 +1 @@ -which rbenv &>/dev/null || return -eval "$(rbenv init - zsh)" +skip_global_compinit=1 From 8c485fb6944d8127f5789a3a940ecfd2d7852769 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Thu, 4 Apr 2013 20:27:15 -0500 Subject: [PATCH 032/234] Fix powerline init --- editors/emacs/bjeanes/misc.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/editors/emacs/bjeanes/misc.el b/editors/emacs/bjeanes/misc.el index a36c1bdf..cf380c2a 100644 --- a/editors/emacs/bjeanes/misc.el +++ b/editors/emacs/bjeanes/misc.el @@ -1,5 +1,5 @@ (require 'powerline) -(command-execute 'powerline-default) +(command-execute 'powerline-default-theme) (global-auto-revert-mode t) From beaee2c785c7adacd6f4ff26fd252753bc0a8f13 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Fri, 5 Apr 2013 00:18:58 -0500 Subject: [PATCH 033/234] Update README.md --- README.md | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 8795fa51..607dcfe5 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,8 @@ -# TODO +# My dot files. -* Make ZSH/Bash PATH dynamically figured out (via globbing) like fish -* Make `rake install` install a .git pre-commit hook to remind about or automatically remove all API keys from dot files (gitconfig, etc) -* Make `rake install` set up a loop that will always try to `git pull` the dot-files (if working directory is clean) so they are always up to date -* Remove 'export' from variables that don't need them -* Make current directory red in prompt if non-writeable (ala fish) -* Fix shell $PATH. Intelligently build up from only existent directories and ensure no-duplicates -* Steal some awesome stuff from https://github.com/skwp/dotfiles/blob/master/osx +Please explore and/or suggest! + +# LICENSE Copyright (c) 2008-2011 Bodaniel Jeanes From 27427f961eabaca21c26ffa08c5af418c0dda0ca Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Fri, 5 Apr 2013 00:23:20 -0500 Subject: [PATCH 034/234] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 607dcfe5..90d553f1 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Please explore and/or suggest! # LICENSE -Copyright (c) 2008-2011 Bodaniel Jeanes +Copyright (c) 2008-2013 Bodaniel Jeanes Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the From a0ff32e951a2818f049085c7a68c91d956c25591 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Fri, 11 Oct 2013 10:01:55 -0700 Subject: [PATCH 035/234] Misc changes --- Rakefile | 1 + editors/vim/bundles.vim | 16 ---------------- languages/clojure/lein/profiles.clj | 11 ++++++----- languages/ruby/irbrc | 7 ------- languages/ruby/railsrc | 1 + shells/common/exports.sh | 2 ++ vcs/git/gitconfig | 6 ++++++ vcs/git/gitignore | 1 + 8 files changed, 17 insertions(+), 28 deletions(-) create mode 100644 languages/ruby/railsrc diff --git a/Rakefile b/Rakefile index e2c96a72..7020fd5e 100644 --- a/Rakefile +++ b/Rakefile @@ -13,6 +13,7 @@ task :install do languages/ruby/gemrc languages/ruby/irbrc languages/ruby/rdebugrc + languages/ruby/railsrc misc/ackrc misc/ctags misc/inputrc diff --git a/editors/vim/bundles.vim b/editors/vim/bundles.vim index 86dcaab4..39a5e998 100644 --- a/editors/vim/bundles.vim +++ b/editors/vim/bundles.vim @@ -128,22 +128,6 @@ augroup bundles map z :ZoomWin imap z :ZoomWina - Bundle 'vimwiki' - let g:vimwiki_hl_cb_checked = 1 - let g:vimwiki_menu = 'Plugin.Vimwiki' - let g:vimwiki_badsyms = ' ' - let g:vimwiki_use_mouse = 1 - let g:vimwiki_dir_link = 'index' - let g:vimwiki_list = [ - \ { - \ 'path': '~/Dropbox/Wiki/Text', - \ 'path_html': '~/Dropbox/Wiki/HTML', - \ 'nested_syntaxes': { - \ 'ruby': 'ruby' - \ } - \ } - \] - Bundle 'scrooloose/nerdtree' let g:NERDTreeIgnore = ['\.rbc$', '\~$', '.DS_Store$'] let g:NERDTreeChDirMode = 2 diff --git a/languages/clojure/lein/profiles.clj b/languages/clojure/lein/profiles.clj index 32249971..ba44a9b4 100644 --- a/languages/clojure/lein/profiles.clj +++ b/languages/clojure/lein/profiles.clj @@ -1,10 +1,11 @@ -{:user {:plugins [[lein-beanstalk "0.2.6"] - [lein-light "0.0.16"] +{:user {:plugins [[lein-beanstalk "0.2.7"] + [lein-light "0.0.27"] [lein-marginalia "0.7.1"] [lein-clojars "0.9.1"] - [lein-outdated "1.0.0"] - [lein-ring "0.8.2"] - [lein-swank "1.4.5"]] + [lein-outdated "1.0.1"] + [lein-depgraph "0.1.0"] + [lein-pprint "1.1.1"] + [lein-ring "0.8.7"]] :dependencies [[clj-stacktrace "0.2.5"]] :injections [(let [orig (ns-resolve (doto 'clojure.stacktrace require) 'print-cause-trace) diff --git a/languages/ruby/irbrc b/languages/ruby/irbrc index a4015a41..ee0f8ca8 100755 --- a/languages/ruby/irbrc +++ b/languages/ruby/irbrc @@ -1,10 +1,3 @@ -begin - require 'rubygems' unless defined? Gem - require 'irbtools' -rescue LoadError - $stderr.puts "Please install 'irbtools' or add it to your Gemfile" -end - require 'irb/ext/save-history' require 'irb/completion' diff --git a/languages/ruby/railsrc b/languages/ruby/railsrc new file mode 100644 index 00000000..76388d89 --- /dev/null +++ b/languages/ruby/railsrc @@ -0,0 +1 @@ +-d postgresql -T diff --git a/shells/common/exports.sh b/shells/common/exports.sh index 628576ff..a2d718c5 100644 --- a/shells/common/exports.sh +++ b/shells/common/exports.sh @@ -11,3 +11,5 @@ export CLICOLOR=1 export HISTSIZE=1000000 export HISTIGNORE="clear:bg:fg:cd:cd -:exit:date:w:* --help" +export GOPATH="$HOME/Code/Go" +PATH="./node_modules/.bin:$PATH:$GOPATH/bin" diff --git a/vcs/git/gitconfig b/vcs/git/gitconfig index 49dc4d6a..0935ac1c 100644 --- a/vcs/git/gitconfig +++ b/vcs/git/gitconfig @@ -62,3 +62,9 @@ [merge] conflictstyle = diff3 tool = Kaleidoscope +[pull] + rebase = true +[heroku] + account = heroku +[push] + default = simple diff --git a/vcs/git/gitignore b/vcs/git/gitignore index 08b6f048..5ec3a243 100755 --- a/vcs/git/gitignore +++ b/vcs/git/gitignore @@ -53,3 +53,4 @@ doc/tags # emacs .#* \#*# +*.pyc From 399212d582b41ba785456b85926097cdc37303f5 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Tue, 5 Nov 2013 23:39:35 -0800 Subject: [PATCH 036/234] Switch to NeoBundle and lazy-load most plugins for speedy vim boots --- .gitmodules | 6 +- editors/vim/bundle/neobundle.vim | 1 + editors/vim/bundle/vundle | 1 - editors/vim/bundles.vim | 120 ++++++++++++++++++------------- 4 files changed, 73 insertions(+), 55 deletions(-) create mode 160000 editors/vim/bundle/neobundle.vim delete mode 160000 editors/vim/bundle/vundle diff --git a/.gitmodules b/.gitmodules index bb6c5f27..56b6f917 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ -[submodule "editors/vim/bundle/vundle"] - path = editors/vim/bundle/vundle - url = git://github.com/gmarik/vundle.git +[submodule "editors/vim/bundle/neobundle.vim"] + path = editors/vim/bundle/neobundle.vim + url = git://github.com/Shougo/neobundle.vim diff --git a/editors/vim/bundle/neobundle.vim b/editors/vim/bundle/neobundle.vim new file mode 160000 index 00000000..2fda048c --- /dev/null +++ b/editors/vim/bundle/neobundle.vim @@ -0,0 +1 @@ +Subproject commit 2fda048ce43d0540e88f2763629713c6f9151473 diff --git a/editors/vim/bundle/vundle b/editors/vim/bundle/vundle deleted file mode 160000 index 5dd478e1..00000000 --- a/editors/vim/bundle/vundle +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 5dd478e18e2a613466776c94f16dd5c329123cae diff --git a/editors/vim/bundles.vim b/editors/vim/bundles.vim index 39a5e998..2209cfb8 100644 --- a/editors/vim/bundles.vim +++ b/editors/vim/bundles.vim @@ -1,70 +1,85 @@ augroup bundles autocmd! - filetype off + if has('vim_starting') + set nocompatible + set runtimepath+=~/.vim/bundle/neobundle.vim/ + endif - set rtp+=~/.vim/bundle/vundle/ - call vundle#rc() + call neobundle#rc(expand('~/.vim/bundle/')) - " Let Vundle manage Vundle - Bundle 'gmarik/vundle' + " Let NeoNeoBundle manage NeoBundle + NeoBundleFetch 'Shougo/neobundle.vim' + + NeoBundle 'Shougo/vimproc', { + \ 'build' : { + \ 'mac' : 'make -f make_mac.mak', + \ 'unix' : 'make -f make_unix.mak', + \ }, + \ } " Languages/Syntaxes/Frameworks {{{ " Ruby {{{ - Bundle 'vim-ruby/vim-ruby' - Bundle 'tpope/vim-endwise' - Bundle 'tpope/vim-rake' - Bundle 'tpope/vim-haml' - Bundle 'ecomba/vim-ruby-refactoring' - Bundle 'thisivan/vim-ruby-matchit' - - Bundle 'tpope/vim-cucumber' + NeoBundleLazy 'vim-ruby/vim-ruby' + NeoBundleLazy 'tpope/vim-endwise' + NeoBundleLazy 'tpope/vim-rake' + NeoBundleLazy 'thisivan/vim-ruby-matchit' + NeoBundleLazy 'nelstrom/vim-textobj-rubyblock', { 'depends' : 'kana/vim-textobj-user' } + autocmd FileType ruby NeoBundleSource + \ vim-ruby + \ vim-rake + \ vim-endwise + \ vim-haml + \ vim-ruby-matchit + \ vim-textobj-rubyblock " }}} " Clojure {{{ - Bundle 'paredit.vim' - Bundle 'VimClojure' + NeoBundleLazy 'paredit.vim' + NeoBundleLazy 'VimClojure' let g:vimclojure#ParenRainbow = 1 let vimclojure#FuzzyIndent = 1 - autocmd FileType clojure set lispwords-='->' - autocmd FileType clojure set lispwords-='->>' + autocmd FileType clojure,clojurescript set lispwords-='->' + autocmd FileType clojure,clojurescript set lispwords-='->>' + autocmd FileType clojure,clojurescript NeoBundleSource paredit.vim VimClojure " }}} " Markdown/Textile/etc {{{ - Bundle 'tpope/vim-markdown' - Bundle 'matthias-guenther/hammer.vim' + NeoBundleLazy 'tpope/vim-markdown' + NeoBundleLazy 'matthias-guenther/hammer.vim' + autocmd FileType markdown NeoBundleSource vim-markdown hammer.vim " }}} " HTML/CSS/Javascript {{{ - Bundle 'kchmck/vim-coffee-script' - Bundle 'pangloss/vim-javascript' - Bundle 'css3' - Bundle 'othree/html5-syntax.vim' + NeoBundleLazy 'tpope/vim-haml', { 'autoload' : { 'filetypes' : 'haml' } } + NeoBundleLazy 'kchmck/vim-coffee-script', { 'autoload' : { 'filetypes' : 'coffee' } } + NeoBundleLazy 'pangloss/vim-javascript', { 'autoload' : { 'filetypes' : 'javascript' } } + NeoBundleLazy 'css3', { 'autoload' : { 'filetypes' : 'css' } } + NeoBundleLazy 'othree/html5-syntax.vim', { 'autoload' : { 'filetypes' : 'html' } } + NeoBundleLazy 'slim-template/vim-slim', { 'autoload' : { 'filetypes' : 'slim' } } " }}} " }}} " Git {{{ - Bundle 'tpope/vim-fugitive' - Bundle 'tpope/vim-git' - Bundle 'tjennings/git-grep-vim' + NeoBundle 'tpope/vim-fugitive', { 'augroup': 'fugitive' } + NeoBundle 'tpope/vim-git' + NeoBundle 'tjennings/git-grep-vim' " }}} " Text objects {{{ - Bundle 'kana/vim-textobj-user' - Bundle 'nelstrom/vim-textobj-rubyblock' - Bundle 'michaeljsmith/vim-indent-object' - Bundle 'argtextobj.vim' + NeoBundle 'michaeljsmith/vim-indent-object' + NeoBundle 'argtextobj.vim' " }}} " Utility {{{ - Bundle 'tpope/vim-surround' + NeoBundle 'tpope/vim-surround' - Bundle 'Raimondi/delimitMate' + NeoBundle 'Raimondi/delimitMate' autocmd FileType clojure let delimitMate_quotes = "\"" - Bundle 'AutoComplPop' + NeoBundle 'AutoComplPop' let g:acp_enableAtStartup = 0 let g:acp_completeoptPreview = 1 let g:acp_behaviorKeywordLength = 3 @@ -74,27 +89,27 @@ augroup bundles \ 'case', 'done', 'do' \ ] - Bundle 'Lokaltog/vim-easymotion' + NeoBundle 'Lokaltog/vim-easymotion' let g:EasyMotion_keys = "arstdhneio" " Colemak home row - Bundle 'Lokaltog/vim-powerline' + NeoBundle 'Lokaltog/vim-powerline' - Bundle 'Gundo' + NeoBundle 'Gundo' nnoremap u :GundoToggle - Bundle 'kien/rainbow_parentheses.vim' + NeoBundle 'kien/rainbow_parentheses.vim' autocmd VimEnter *.{rb,coffee} RainbowParenthesesToggle autocmd Syntax *.{rb,coffee} RainbowParenthesesLoadRound autocmd Syntax *.{rb,coffee} RainbowParenthesesLoadSquare autocmd Syntax *.{rb,coffee} RainbowParenthesesLoadBraces - Bundle 'Tabular' + NeoBundle 'Tabular' autocmd VimEnter * AddTabularPattern! first_eq /\%(=.*\)\@=]\@!/l1c1l0 autocmd VimEnter * AddTabularPattern! first_rocket /\%(=>.*\)\@/l1c1l0 autocmd VimEnter * AddTabularPattern! first_key /\v%(%(\h\w*|"[^"]+"):.*)@ a = mT:Tabularize first_eq`T + nmap a= mT:Tabularize first_eq`T nmap a> mT:Tabularize first_rocket`T nmap a: mT:Tabularize first_key`T @@ -116,7 +131,7 @@ augroup bundles endif endfunction - Bundle 'scrooloose/nerdcommenter' + NeoBundle 'scrooloose/nerdcommenter' let NERDCreateDefaultMappings = 0 let NERDSpaceDelims = 1 " space between comment and code map // NERDCommenterToggle @@ -124,11 +139,11 @@ augroup bundles map / // vmap / // - Bundle 'ZoomWin' + NeoBundle 'ZoomWin' map z :ZoomWin imap z :ZoomWina - Bundle 'scrooloose/nerdtree' + NeoBundle 'scrooloose/nerdtree', { 'augroup' : 'NERDTreeHijackNetrw' } let g:NERDTreeIgnore = ['\.rbc$', '\~$', '.DS_Store$'] let g:NERDTreeChDirMode = 2 let g:NERDTreeMouseMode = 3 @@ -137,35 +152,38 @@ augroup bundles let g:NERDTreeDirArrows = 1 let g:NERDTreeHijackNetrw = 0 map n :NERDTreeToggle + map n :NERDTreeToggle map N :NERDTreeFind - Bundle 'Command-T' + NeoBundle 'wincent/Command-T', { + \ 'build' : { + \ 'mac' : '/usr/bin/ruby ruby/command-t/extconf.rb && make', + \ 'unix' : 'ruby ruby/command-t/extconf.rb && make' + \ } + \ } let g:CommandTMaxFiles = 20000 let g:CommandTMaxHeight = 10 nnoremap t :CommandT nnoremap b :CommandTBuffer nnoremap f :CommandTFlush - Bundle 'Indent-Guides' + NeoBundle 'Indent-Guides' let g:indent_guides_auto_colors = 0 let g:indent_guides_enable_on_vim_startup = 1 autocmd VimEnter * IndentGuidesEnable autocmd FileType clojure IndentGuidesDisable - Bundle 'Syntastic' + NeoBundle 'Syntastic' let g:syntastic_enable_signs = 1 let g:syntastic_auto_loc_list = 0 let g:syntastic_disabled_filetypes = ['cucumber'] " }}} " Other {{{ - Bundle 'AnsiEsc.vim' - Bundle 'thisivan/vim-matchit' - - Bundle 'aklt/plantuml-syntax' - au BufNewFile,BufRead *.uml set filetype=plantuml + NeoBundle 'thisivan/vim-matchit' " }}} - autocmd BufWritePost bundles.vim source ~/.vim/bundles.vim filetype plugin indent on + + NeoBundleCheck augroup END From f5dd7fe76ea94b2c5123d1033661120afc3239fd Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Tue, 5 Nov 2013 23:40:07 -0800 Subject: [PATCH 037/234] Clean up vimrc cruft and document some of my choices --- editors/vim/autocommands.vim | 9 --- editors/vim/ui.vim | 118 ++++++++++++----------------------- editors/vim/vimrc | 22 ++----- 3 files changed, 45 insertions(+), 104 deletions(-) diff --git a/editors/vim/autocommands.vim b/editors/vim/autocommands.vim index b7462711..3a06850c 100644 --- a/editors/vim/autocommands.vim +++ b/editors/vim/autocommands.vim @@ -14,13 +14,6 @@ endfunction " Strip trailing whitespace on command nmap sw :call StripTrailingWhitespaces() -" http://vim.wikia.com/wiki/Auto_highlight_current_word_when_idle -" augroup auto_highlight - " au! - " set updatetime=500 - " au CursorHold * let @/ = '\V\<'.escape(expand(''), '\').'\>' -" augroup end - augroup the_rest au! @@ -41,8 +34,6 @@ augroup the_rest autocmd FileType make set noexpandtab autocmd FileType python set noexpandtab - autocmd FileType scss syntax cluster sassCssAttributes add=@cssColors - " Thorfile, Rakefile and Gemfile are Ruby autocmd BufRead,BufNewFile {Gemfile,Rakefile,Thorfile,config.ru} set ft=ruby diff --git a/editors/vim/ui.vim b/editors/vim/ui.vim index 0feed9b7..8a5b0180 100644 --- a/editors/vim/ui.vim +++ b/editors/vim/ui.vim @@ -3,57 +3,56 @@ syntax on " Visual set ruler set guioptions=ce - set showmatch " Briefly jump to a paren once it's balanced + set showmatch " Briefly jump to a paren once it's balanced set linespace=2 set background=dark set laststatus=2 colorscheme molokai_mac " Tabs/Whitespace - set tabstop=2 - set shiftwidth=2 - set autoindent - set smarttab - set expandtab - set nowrap - set list + set tabstop=2 " a Tab take up 2 spaces + set shiftwidth=2 " (un)indent 2 spaces at at ime + set autoindent " preserve previous indent level when inserting new line + set smarttab " insert/delete a tab's work of spaces at a time + set expandtab " insert actual spaces, not tabs + set nowrap " don't wrap long lines set backspace=indent,eol,start " allow backspacing over everything in insert mode " Toggle show tabs and trailing spaces (,c) + set list set listchars=tab:▸\ ,trail:·,eol:¬,nbsp:_ set fillchars=vert:\ ,fold:- - nnoremap c :set nolist! + nnoremap c :set list! " Misc set switchbuf=useopen " Don't re-open already opened buffers set nostartofline " Avoid moving cursor to BOL when jumping around set virtualedit=all " Let cursor move past the last char set whichwrap=b,s,h,l,<,>,[,] - let mapleader = ',' + let mapleader = ',' " comma as leader key + " but be nice to people who are used to backslash: + nmap \ set autoread " watch for file changes - set mouse=a + set mouse=a " mouse can be handy sometimes set ttymouse=xterm2 " Needed to get mouse working when in Tmux/screen set fileformats=unix set history=1000 - set hidden + set nohidden " unload a buffer when abandoned, please set title " Show title in Terminal - set shortmess=atI + set shortmess=atI " abbreviate messages " Bells - set novisualbell " No blinking - set noerrorbells " No noise. - set vb t_vb= " disable any beeps or flashes on error + set novisualbell " No blinking + set noerrorbells " No noise. + set vb t_vb= " disable any beeps or flashes on error " Searching - set hlsearch - set incsearch - set ignorecase - set smartcase - - " Remove highlighting when entering insert (not working... ) - autocmd InsertEnter * nohlsearch + set hlsearch " highlight search matches and keep them highlighted + set incsearch " start matching search before hitting enter + set ignorecase " case-insensitive searching by default + set smartcase " but if searching with multiple cases, treat it as case-sensitive - " center result + " center current search result in middle of screen nnoremap n nzz nnoremap N Nzz nnoremap * *zz @@ -68,21 +67,9 @@ syntax on set wildmode=list:longest,list:full set wildignore+=*.o,*.obj,.git,*.rbc,*.swp -" Folding - set foldenable " Turn on folding - set foldmethod=syntax " Fold on the marker - set foldlevel=100 " Don't autofold anything (but I can still fold manually) - set foldopen=block,hor,mark,percent,quickfix,tag " what movements open folds - " Directories for swp files - " persistent undos - set undofile - set undodir=~/.vim/dirs/undos - - set backupdir=~/.vim/dirs/backups - set directory=~/.vim/dirs/swaps -" Nicer text navigation +" Navigate cursor up/down by lines on screen, not lines in file nmap j gj nmap k gk @@ -93,30 +80,12 @@ syntax on " Nicer splitting set splitbelow set splitright - map :new - map :vnew " Emacs-like keys for the command line cnoremap cnoremap cnoremap -" Move around in insert mode - inoremap - inoremap - inoremap - inoremap - -" way better... - map 0 ^ - - nmap ] :tabnext - nmap [ :tabprev - -" Opens an edit command with the path of the currently -" edited file filled in Normal mode: e - map e :e =expand("%:p:h") . "/" - " Always show cursorline, but only in current window. set scrolloff=3 set scrolljump=10 @@ -124,30 +93,23 @@ syntax on autocmd WinEnter * :setlocal cursorline autocmd WinLeave * :setlocal nocursorline - set number - - " For when other people use my setup - nmap \ - - " Easier - nnoremap ; : +set number " line numbers - " I keep deleting words when I want to switch windows - imap +" I keep deleting words when I want to switch windows +imap - " OS X clipboard when yanking/pasting - set clipboard=unnamed +set clipboard=unnamed " OS X clipboard when yanking/pasting - " May only work in iTerm2 and may have other bad effects, - " but this shows a block in normal mode, and vertical bar - " in insert mode. - if exists('$TMUX') - " https://github.com/sjl/vitality.vim/issues/8#issuecomment-7664649 - let &t_SI = "\[3 q" - let &t_EI = "\[0 q" - else - let &t_SI = "\]50;CursorShape=1\x7" - let &t_EI = "\]50;CursorShape=0\x7" - endif +" May only work in iTerm2 and may have other bad effects, +" but this shows a block in normal mode, and vertical bar +" in insert mode. +if exists('$TMUX') + " https://github.com/sjl/vitality.vim/issues/8#issuecomment-7664649 + let &t_SI = "\[3 q" + let &t_EI = "\[0 q" +else + let &t_SI = "\]50;CursorShape=1\x7" + let &t_EI = "\]50;CursorShape=0\x7" +endif - runtime macros/matchit.vim +runtime macros/matchit.vim diff --git a/editors/vim/vimrc b/editors/vim/vimrc index 1df194ee..19f4d4ad 100644 --- a/editors/vim/vimrc +++ b/editors/vim/vimrc @@ -4,34 +4,22 @@ source ~/.vim/ui.vim source ~/.vim/autocommands.vim source ~/.vim/bundles.vim -" This helps with RVM etc -set shell=zsh - -" http://tim.theenchanter.com/2008/07/crontab-temp-file-must-be-edited-in.html -set backupskip=/tmp/*,/private/tmp/*" +set backupdir=~/.vim/dirs/backups " store file backups here +set backupskip=/tmp/*,/private/tmp/*" " don't use backups for tmp files +set directory=~/.vim/dirs/swaps " store swap files here +set undofile " persistent undos +set undodir=~/.vim/dirs/undos " where to store undo histories " For when you forget to sudo.. Really Write the file. cmap w!! w !sudo tee % >/dev/null -" Send visual selection to gist.github.com -" Requires gist (brew install gist) -vnoremap G :w !gist -p -t %:e \| pbcopy - " CTags map rt :!ctags --extra=+f -R * set tags=tmp/tags;/,./tmp/tags;/,tags;/,./tags;/ -" ,w - write file -nnoremap ,w :write - set pastetoggle=p map p :set invpaste paste? -" Theme development help -nmap :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<' -\ . synIDattr(synID(line("."),col("."),0),"name") . "> lo<" -\ . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">" - " Quick editing of common dot-files map vv :edit $MYVIMRC map gg :edit $MYGVIMRC From cd9cca5910a2aae5482594a1b1f02af1e66d5fcb Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Wed, 6 Nov 2013 00:36:55 -0800 Subject: [PATCH 038/234] More vimming --- editors/vim/bundles.vim | 41 +++++++++++++++++------------------------ editors/vim/gvimrc | 2 -- editors/vim/ruby.vim | 11 +++++++++++ editors/vim/vimrc | 1 + 4 files changed, 29 insertions(+), 26 deletions(-) create mode 100644 editors/vim/ruby.vim diff --git a/editors/vim/bundles.vim b/editors/vim/bundles.vim index 2209cfb8..80dde9a7 100644 --- a/editors/vim/bundles.vim +++ b/editors/vim/bundles.vim @@ -18,17 +18,21 @@ augroup bundles \ }, \ } + NeoBundleLazy 'tpope/vim-endwise' " Auto-add 'end' etc appropriately in various languages + " Languages/Syntaxes/Frameworks {{{ " Ruby {{{ NeoBundleLazy 'vim-ruby/vim-ruby' - NeoBundleLazy 'tpope/vim-endwise' + NeoBundleLazy 'tpope/vim-rails' NeoBundleLazy 'tpope/vim-rake' + NeoBundleLazy 'tpope/vim-bundler' NeoBundleLazy 'thisivan/vim-ruby-matchit' - NeoBundleLazy 'nelstrom/vim-textobj-rubyblock', { 'depends' : 'kana/vim-textobj-user' } + NeoBundleLazy 'nelstrom/vim-textobj-rubyblock', { 'depends' : ['kana/vim-textobj-user', 'thisivan/vim-matchit'] } autocmd FileType ruby NeoBundleSource \ vim-ruby + \ vim-rails " <- how to maket his only load in rails projects? + \ vim-bundler \ vim-rake - \ vim-endwise \ vim-haml \ vim-ruby-matchit \ vim-textobj-rubyblock @@ -36,13 +40,12 @@ augroup bundles " Clojure {{{ NeoBundleLazy 'paredit.vim' - NeoBundleLazy 'VimClojure' - let g:vimclojure#ParenRainbow = 1 - let vimclojure#FuzzyIndent = 1 + autocmd FileType clojure,clojurescript NeoBundleSource paredit.vim autocmd FileType clojure,clojurescript set lispwords-='->' autocmd FileType clojure,clojurescript set lispwords-='->>' - autocmd FileType clojure,clojurescript NeoBundleSource paredit.vim VimClojure - " }}} + + NeoBundleLazy 'tpope/vim-fireplace', { 'depends' : 'guns/vim-clojure-static', 'autoload' : { 'filetypes' : 'clojure' } } + NeoBundleLazy 'tpope/vim-classpath', { 'autoload' : { 'filetypes' : ['clojure', 'java'] } } " Markdown/Textile/etc {{{ NeoBundleLazy 'tpope/vim-markdown' @@ -74,12 +77,9 @@ augroup bundles " Utility {{{ - NeoBundle 'tpope/vim-surround' + NeoBundle 'tpope/vim-surround', { 'depends' : 'tpope/vim-repeat' } - NeoBundle 'Raimondi/delimitMate' - autocmd FileType clojure let delimitMate_quotes = "\"" - - NeoBundle 'AutoComplPop' + NeoBundleLazy 'AutoComplPop', { 'autoload' : { 'insert' : 1 } } let g:acp_enableAtStartup = 0 let g:acp_completeoptPreview = 1 let g:acp_behaviorKeywordLength = 3 @@ -131,13 +131,10 @@ augroup bundles endif endfunction - NeoBundle 'scrooloose/nerdcommenter' - let NERDCreateDefaultMappings = 0 - let NERDSpaceDelims = 1 " space between comment and code - map // NERDCommenterToggle - vmap // NERDCommenterToggle gv - map / // - vmap / // + NeoBundle 'tpope/vim-commentary' + autocmd FileType clojure,clojurescript set commentstring=;\ %s + nmap // CommentaryLine + vmap // Commentary NeoBundle 'ZoomWin' map z :ZoomWin @@ -179,10 +176,6 @@ augroup bundles let g:syntastic_disabled_filetypes = ['cucumber'] " }}} - " Other {{{ - NeoBundle 'thisivan/vim-matchit' - " }}} - filetype plugin indent on NeoBundleCheck diff --git a/editors/vim/gvimrc b/editors/vim/gvimrc index 80623cc8..e44a28fe 100644 --- a/editors/vim/gvimrc +++ b/editors/vim/gvimrc @@ -2,8 +2,6 @@ set guioptions-=T " hide toolbar set guioptions+=Rr " Turn on scroll bars if has("gui_macvim") - set transparency=7 - " Fullscreen takes up entire screen set fuoptions=maxhorz,maxvert diff --git a/editors/vim/ruby.vim b/editors/vim/ruby.vim new file mode 100644 index 00000000..a9745c98 --- /dev/null +++ b/editors/vim/ruby.vim @@ -0,0 +1,11 @@ +autocmd FileType cucumber compiler cucumber | setl makeprg=cucumber\ \"%:p\" +autocmd FileType ruby + \ if expand('%') =~# '_test\.rb$' | + \ compiler rubyunit | setl makeprg=testrb\ \"%:p\" | + \ elseif expand('%') =~# '_spec\.rb$' | + \ compiler rspec | setl makeprg=rspec\ \"%:p\" | + \ else | + \ compiler ruby | setl makeprg=ruby\ -wc\ \"%:p\" | + \ endif +autocmd User Bundler + \ if &makeprg !~# 'bundle' | setl makeprg^=bundle\ exec\ | endif diff --git a/editors/vim/vimrc b/editors/vim/vimrc index 19f4d4ad..a3c462e4 100644 --- a/editors/vim/vimrc +++ b/editors/vim/vimrc @@ -3,6 +3,7 @@ set nocompatible source ~/.vim/ui.vim source ~/.vim/autocommands.vim source ~/.vim/bundles.vim +source ~/.vim/ruby.vim set backupdir=~/.vim/dirs/backups " store file backups here set backupskip=/tmp/*,/private/tmp/*" " don't use backups for tmp files From 0928f61de99cff1562e2692f1bfdb115eed95877 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Mon, 11 Nov 2013 20:05:10 -0800 Subject: [PATCH 039/234] Experiment with new powerline for Tmux and Vim --- .gitmodules | 3 + editors/vim/bundles.vim | 4 +- editors/vim/ui.vim | 3 + misc/tmux/tmux.conf | 26 +--- powerline/colors.json | 110 +++++++++++++++ powerline/colorschemes/ipython/default.json | 8 ++ powerline/colorschemes/shell/default.json | 18 +++ powerline/colorschemes/shell/solarized.json | 18 +++ powerline/colorschemes/tmux/default.json | 27 ++++ powerline/colorschemes/vim/default.json | 100 ++++++++++++++ powerline/colorschemes/vim/solarized.json | 97 ++++++++++++++ powerline/colorschemes/wm/default.json | 26 ++++ powerline/config.json | 53 ++++++++ powerline/themes/ipython/in.json | 26 ++++ powerline/themes/ipython/in2.json | 13 ++ powerline/themes/ipython/out.json | 25 ++++ powerline/themes/ipython/rewrite.json | 23 ++++ powerline/themes/shell/default.json | 45 +++++++ powerline/themes/shell/default_leftonly.json | 43 ++++++ powerline/themes/tmux/default.json | 46 +++++++ powerline/themes/vim/cmdwin.json | 18 +++ powerline/themes/vim/default.json | 126 ++++++++++++++++++ powerline/themes/vim/help.json | 36 +++++ powerline/themes/vim/plugin/ctrlp.json | 28 ++++ .../themes/vim/plugin/gundo-preview.json | 19 +++ powerline/themes/vim/plugin/gundo.json | 19 +++ powerline/themes/vim/plugin/nerdtree.json | 17 +++ powerline/themes/vim/quickfix.json | 37 +++++ powerline/themes/wm/default.json | 31 +++++ vendor/powerline | 1 + 30 files changed, 1020 insertions(+), 26 deletions(-) create mode 100644 powerline/colors.json create mode 100644 powerline/colorschemes/ipython/default.json create mode 100644 powerline/colorschemes/shell/default.json create mode 100644 powerline/colorschemes/shell/solarized.json create mode 100644 powerline/colorschemes/tmux/default.json create mode 100644 powerline/colorschemes/vim/default.json create mode 100644 powerline/colorschemes/vim/solarized.json create mode 100644 powerline/colorschemes/wm/default.json create mode 100644 powerline/config.json create mode 100644 powerline/themes/ipython/in.json create mode 100644 powerline/themes/ipython/in2.json create mode 100644 powerline/themes/ipython/out.json create mode 100644 powerline/themes/ipython/rewrite.json create mode 100644 powerline/themes/shell/default.json create mode 100644 powerline/themes/shell/default_leftonly.json create mode 100644 powerline/themes/tmux/default.json create mode 100644 powerline/themes/vim/cmdwin.json create mode 100644 powerline/themes/vim/default.json create mode 100644 powerline/themes/vim/help.json create mode 100644 powerline/themes/vim/plugin/ctrlp.json create mode 100644 powerline/themes/vim/plugin/gundo-preview.json create mode 100644 powerline/themes/vim/plugin/gundo.json create mode 100644 powerline/themes/vim/plugin/nerdtree.json create mode 100644 powerline/themes/vim/quickfix.json create mode 100644 powerline/themes/wm/default.json create mode 160000 vendor/powerline diff --git a/.gitmodules b/.gitmodules index 56b6f917..7d27ed47 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "editors/vim/bundle/neobundle.vim"] path = editors/vim/bundle/neobundle.vim url = git://github.com/Shougo/neobundle.vim +[submodule "vendor/powerline"] + path = vendor/powerline + url = git://github.com/Lokaltog/powerline.git diff --git a/editors/vim/bundles.vim b/editors/vim/bundles.vim index 80dde9a7..f03b52be 100644 --- a/editors/vim/bundles.vim +++ b/editors/vim/bundles.vim @@ -44,7 +44,7 @@ augroup bundles autocmd FileType clojure,clojurescript set lispwords-='->' autocmd FileType clojure,clojurescript set lispwords-='->>' - NeoBundleLazy 'tpope/vim-fireplace', { 'depends' : 'guns/vim-clojure-static', 'autoload' : { 'filetypes' : 'clojure' } } + NeoBundleLazy 'tpope/vim-classpath', { 'autoload' : { 'filetypes' : ['clojure', 'java'] } } " Markdown/Textile/etc {{{ @@ -92,8 +92,6 @@ augroup bundles NeoBundle 'Lokaltog/vim-easymotion' let g:EasyMotion_keys = "arstdhneio" " Colemak home row - NeoBundle 'Lokaltog/vim-powerline' - NeoBundle 'Gundo' nnoremap u :GundoToggle diff --git a/editors/vim/ui.vim b/editors/vim/ui.vim index 8a5b0180..f03ea619 100644 --- a/editors/vim/ui.vim +++ b/editors/vim/ui.vim @@ -9,6 +9,9 @@ syntax on set laststatus=2 colorscheme molokai_mac + set rtp+=~/.config/vendor/powerline/powerline/bindings/vim + + " Tabs/Whitespace set tabstop=2 " a Tab take up 2 spaces set shiftwidth=2 " (un)indent 2 spaces at at ime diff --git a/misc/tmux/tmux.conf b/misc/tmux/tmux.conf index 2b12185c..d9d09c33 100644 --- a/misc/tmux/tmux.conf +++ b/misc/tmux/tmux.conf @@ -64,33 +64,13 @@ bind z run ". ~/.config/misc/tmux/zoom.sh" # Statusbar settings set -g status-keys vi - set -g display-time 2000 # How long messages are displayed for - - # default statusbar colors - set-option -g status-utf8 on - set-option -g status-fg colour15 - set-option -g status-bg black - - setw -g window-status-fg colour15 - setw -g window-status-bg black - setw -g window-status-attr none - - setw -g window-status-current-fg black - setw -g window-status-current-bg colour15 - setw -g window-status-current-attr bold - - setw -g window-status-current-format '(#[fg=red]#I#[default] #W#F)' - setw -g window-status-format '(#[fg=yellow]#I#[default] #W#F)' - - set-option -g status-left ' ❐ #[fg=red]#S#[default] ▐' - set-option -g status-right '▐ ⌚ #[fg=green]#(date "+%H:%M")#[default] ▐ #[fg=colour210]#(whoami)@#H#[default]' - - set-option -g status-right-length 1000 - set-option -g status-left-length 60 + set -g display-time 4000 # How long messages are displayed for # https://github.com/sjl/vitality.vim/issues/8#issuecomment-7664649 set-option -g terminal-overrides '*88col*:colors=88,*256col*:colors=256,xterm*:XT:Ms=\E]52;%p1%s;%p2%s\007:Cc=\E]12;%p1%s\007:Cr=\E]112\007:Cs=\E]50;CursorShape=%?%p1%{3}%<%t%{0}%e%p1%{2}%-%;%d\007' set -sg escape-time 0 # needed to distinguish between ESC and Meta in emacs +source "~/.config/vendor/powerline/powerline/bindings/tmux/powerline.conf" + bind C-c run "tmux save-buffer - | pbcopy" bind C-v run "pbpaste | tmux load-buffer - && tmux paste-buffer" diff --git a/powerline/colors.json b/powerline/colors.json new file mode 100644 index 00000000..5b8a7645 --- /dev/null +++ b/powerline/colors.json @@ -0,0 +1,110 @@ +{ + "colors": { + "black": 16, + "white": 231, + + "darkestgreen": 22, + "darkgreen": 28, + "mediumgreen": 70, + "brightgreen": 148, + + "darkestcyan": 23, + "darkcyan": 74, + "mediumcyan": 117, + "brightcyan": 159, + + "darkestblue": 24, + "darkblue": 31, + + "darkestred": 52, + "darkred": 88, + "mediumred": 124, + "brightred": 160, + "brightestred": 196, + + "darkestpurple": 55, + "mediumpurple": 98, + "brightpurple": 189, + + "darkorange": 94, + "mediumorange": 166, + "brightorange": 208, + "brightestorange": 214, + + "brightyellow": 220, + + "gray0": 233, + "gray1": 235, + "gray2": 236, + "gray3": 239, + "gray4": 240, + "gray5": 241, + "gray6": 244, + "gray7": 245, + "gray8": 247, + "gray9": 250, + "gray10": 252, + + "gray61": [14, "93a1a1"], + "gray13": [8, "002b36"], + + "royalblue5": [0, "073642"], + "darkgreencopper": [10, "586e75"], + "lightskyblue4": [11, "657b83"], + "azure4": [12, "839496"], + "lightyellow": [7, "eee8d5"], + "oldlace": [15, "fdf6e3"], + + "green": [2, "719e07"], + "cyan": [6, "2aa198"], + "blue": [4, "268bd2"], + "red": [1, "dc322f"], + "magenta": [5, "d33682"], + "violet": [13, "6c71c4"], + "orange": [9, "cb4b16"], + "yellow": [3, "b58900"], + + "lightyellowgreen": 106, + "gold3": 178, + "orangered": 202, + + "steelblue": 67, + "darkorange3": 166, + "skyblue1": 117, + "khaki1": 228 + }, + "gradients": { + "dark_GREEN_Orange_red": [ + [22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 94, 94, 94, 94, 94, 94, 94, 52], + ["005f00", "015f00", "025f00", "035f00", "045f00", "055f00", "065f00", "075f00", "085f00", "095f00", "0b5f00", "0c5f00", "0d5f00", "0e5f00", "0f5f00", "105f00", "115f00", "125f00", "135f00", "145f00", "165f00", "175f00", "185f00", "195f00", "1a5f00", "1b5f00", "1c5f00", "1d5f00", "1e5f00", "1f5f00", "215f00", "225f00", "235f00", "245f00", "255f00", "265f00", "275f00", "285f00", "295f00", "2a5f00", "2c5f00", "2d5f00", "2e5f00", "2f5f00", "305f00", "315f00", "325f00", "335f00", "345f00", "355f00", "375f00", "385f00", "395f00", "3a5f00", "3b5f00", "3c5f00", "3d5f00", "3e5f00", "3f5f00", "415f00", "425f00", "435f00", "445f00", "455f00", "465f00", "475f00", "485f00", "495f00", "4a5f00", "4c5f00", "4d5f00", "4e5f00", "4f5f00", "505f00", "515f00", "525f00", "535f00", "545f00", "555f00", "575f00", "585f00", "595f00", "5a5f00", "5b5f00", "5c5f00", "5d5f00", "5e5f00", "615f00", "655f00", "685f00", "6c5f00", "6f5f00", "735f00", "765f00", "7a5f00", "7d5f00", "815f00", "845f00", "815200", "702900"] + ], + "GREEN_Orange_red": [ + [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1], + ["005f00", "015f00", "025f00", "035f00", "045f00", "055f00", "065f00", "075f00", "085f00", "095f00", "0b5f00", "0c5f00", "0d5f00", "0e5f00", "0f5f00", "105f00", "115f00", "125f00", "135f00", "145f00", "165f00", "175f00", "185f00", "195f00", "1a5f00", "1b5f00", "1c5f00", "1d5f00", "1e5f00", "1f5f00", "215f00", "225f00", "235f00", "245f00", "255f00", "265f00", "275f00", "285f00", "295f00", "2a5f00", "2c5f00", "2d5f00", "2e5f00", "2f5f00", "305f00", "315f00", "325f00", "335f00", "345f00", "355f00", "375f00", "385f00", "395f00", "3a5f00", "3b5f00", "3c5f00", "3d5f00", "3e5f00", "3f5f00", "415f00", "425f00", "435f00", "445f00", "455f00", "465f00", "475f00", "485f00", "495f00", "4a5f00", "4c5f00", "4d5f00", "4e5f00", "4f5f00", "505f00", "515f00", "525f00", "535f00", "545f00", "555f00", "575f00", "585f00", "595f00", "5a5f00", "5b5f00", "5c5f00", "5d5f00", "5e5f00", "615f00", "655f00", "685f00", "6c5f00", "6f5f00", "735f00", "765f00", "7a5f00", "7d5f00", "815f00", "845f00", "815200", "702900"] + ], + "green_yellow_red": [ + [190, 184, 178, 172, 166, 160], + ["8ae71c", "8ce71c", "8fe71c", "92e71c", "95e71d", "98e71d", "9ae71d", "9de71d", "a0e71e", "a3e71e", "a6e71e", "a8e71e", "abe71f", "aee71f", "b1e71f", "b4e71f", "b6e720", "b9e720", "bce720", "bfe720", "c2e821", "c3e721", "c5e621", "c7e521", "c9e522", "cbe422", "cde322", "cfe222", "d1e223", "d3e123", "d5e023", "d7df23", "d9df24", "dbde24", "dddd24", "dfdc24", "e1dc25", "e3db25", "e5da25", "e7d925", "e9d926", "e9d626", "e9d426", "e9d126", "e9cf27", "e9cc27", "e9ca27", "e9c727", "e9c528", "e9c228", "e9c028", "e9bd28", "e9bb29", "e9b829", "e9b629", "e9b329", "e9b12a", "e9ae2a", "e9ac2a", "e9a92a", "eaa72b", "eaa42b", "eaa22b", "ea9f2b", "ea9d2c", "ea9b2c", "ea982c", "ea962c", "ea942d", "ea912d", "ea8f2d", "ea8d2d", "ea8a2e", "ea882e", "ea862e", "ea832e", "ea812f", "ea7f2f", "ea7c2f", "ea7a2f", "eb7830", "eb7530", "eb7330", "eb7130", "eb6f31", "eb6c31", "eb6a31", "eb6831", "eb6632", "eb6332", "eb6132", "eb5f32", "eb5d33", "eb5a33", "eb5833", "eb5633", "eb5434", "eb5134", "eb4f34", "eb4d34", "ec4b35"] + ], + "green_yellow_orange_red": [ + [2, 3, 9, 1], + ["719e07", "739d06", "759c06", "779c06", "799b06", "7b9a05", "7d9a05", "7f9905", "819805", "839805", "859704", "879704", "899604", "8b9504", "8d9504", "8f9403", "919303", "949303", "969203", "989102", "9a9102", "9c9002", "9e9002", "a08f02", "a28e01", "a48e01", "a68d01", "a88c01", "aa8c01", "ac8b00", "ae8a00", "b08a00", "b28900", "b58900", "b58700", "b68501", "b78302", "b78102", "b87f03", "b97d04", "b97b04", "ba7905", "bb7806", "bb7606", "bc7407", "bd7208", "bd7008", "be6e09", "bf6c0a", "bf6a0a", "c0690b", "c1670c", "c1650c", "c2630d", "c3610e", "c35f0e", "c45d0f", "c55b10", "c55a10", "c65811", "c75612", "c75412", "c85213", "c95014", "c94e14", "ca4c15", "cb4b16", "cb4a16", "cc4917", "cc4818", "cd4719", "cd4719", "ce461a", "ce451b", "cf441c", "cf441c", "d0431d", "d0421e", "d1411f", "d1411f", "d24020", "d23f21", "d33e22", "d33e22", "d43d23", "d43c24", "d53b25", "d53b25", "d63a26", "d63927", "d73828", "d73828", "d83729", "d8362a", "d9352b", "d9352b", "da342c", "da332d", "db322e", "dc322f"] + ], + "yellow_red": [ + [220, 178, 172, 166, 160], + ["ffd700", "fdd500", "fbd300", "fad200", "f8d000", "f7cf00", "f5cd00", "f3cb00", "f2ca00", "f0c800", "efc700", "edc500", "ebc300", "eac200", "e8c000", "e7bf00", "e5bd00", "e3bb00", "e2ba00", "e0b800", "dfb700", "ddb500", "dbb300", "dab200", "d8b000", "d7af00", "d7ad00", "d7ab00", "d7aa00", "d7a800", "d7a700", "d7a500", "d7a300", "d7a200", "d7a000", "d79f00", "d79d00", "d79b00", "d79a00", "d79800", "d79700", "d79500", "d79300", "d79200", "d79000", "d78f00", "d78d00", "d78b00", "d78a00", "d78800", "d78700", "d78500", "d78300", "d78200", "d78000", "d77f00", "d77d00", "d77b00", "d77a00", "d77800", "d77700", "d77500", "d77300", "d77200", "d77000", "d76f00", "d76d00", "d76b00", "d76a00", "d76800", "d76700", "d76500", "d76300", "d76200", "d76000", "d75f00", "d75b00", "d75700", "d75300", "d74f00", "d74c00", "d74800", "d74400", "d74000", "d73c00", "d73900", "d73500", "d73100", "d72d00", "d72900", "d72600", "d72200", "d71e00", "d71a00", "d71600", "d71300", "d70f00", "d70b00", "d70700"] + ], + "yellow_orange_red": [ + [3, 9, 1], + ["b58900", "b58700", "b58600", "b68501", "b68401", "b78202", "b78102", "b88003", "b87f03", "b87d03", "b97c04", "b97b04", "ba7a05", "ba7805", "bb7706", "bb7606", "bc7507", "bc7307", "bc7207", "bd7108", "bd7008", "be6e09", "be6d09", "bf6c0a", "bf6b0a", "c06a0b", "c0680b", "c0670b", "c1660c", "c1650c", "c2630d", "c2620d", "c3610e", "c3600e", "c35e0e", "c45d0f", "c45c0f", "c55b10", "c55910", "c65811", "c65711", "c75612", "c75412", "c75312", "c85213", "c85113", "c94f14", "c94e14", "ca4d15", "ca4c15", "cb4b16", "cb4a16", "cb4a17", "cc4917", "cc4918", "cc4818", "cd4819", "cd4719", "cd471a", "ce461a", "ce461b", "ce451b", "cf451c", "cf441c", "cf441d", "d0431d", "d0431e", "d0421e", "d1421f", "d1411f", "d14120", "d24020", "d24021", "d23f21", "d33f22", "d33e22", "d33e23", "d43d23", "d43d24", "d43c24", "d53c25", "d53b25", "d53b26", "d63a26", "d63a27", "d63927", "d73928", "d73828", "d73829", "d83729", "d8372a", "d8362a", "d9362b", "d9352b", "d9352c", "da342c", "da342d", "da332d", "db332e"] + ], + "blue_red": [ + [39, 74, 68, 67, 103, 97, 96, 132, 131, 167, 203, 197], + ["19b4fe", "1bb2fc", "1db1fa", "1faff8", "22aef6", "24adf4", "26abf2", "29aaf0", "2ba9ee", "2da7ec", "30a6ea", "32a5e8", "34a3e6", "36a2e4", "39a0e2", "3b9fe1", "3d9edf", "409cdd", "429bdb", "449ad9", "4798d7", "4997d5", "4b96d3", "4d94d1", "5093cf", "5292cd", "5490cb", "578fc9", "598dc7", "5b8cc6", "5e8bc4", "6089c2", "6288c0", "6487be", "6785bc", "6984ba", "6b83b8", "6e81b6", "7080b4", "727eb2", "757db0", "777cae", "797aac", "7b79ab", "7e78a9", "8076a7", "8275a5", "8574a3", "8772a1", "89719f", "8c709d", "8e6e9b", "906d99", "926b97", "956a95", "976993", "996791", "9c668f", "9e658e", "a0638c", "a3628a", "a56188", "a75f86", "a95e84", "ac5c82", "ae5b80", "b05a7e", "b3587c", "b5577a", "b75678", "ba5476", "bc5374", "be5273", "c05071", "c34f6f", "c54e6d", "c74c6b", "ca4b69", "cc4967", "ce4865", "d14763", "d34561", "d5445f", "d7435d", "da415b", "dc4059", "de3f58", "e13d56", "e33c54", "e53a52", "e83950", "ea384e", "ec364c", "ee354a", "f13448", "f33246", "f53144", "f83042", "fa2e40"] + ], + "white_red": [ + [231, 223, 216, 209, 196], + ["ffffff", "fffe61", "fffcc4", "fffb28", "fff98b", "fff7ef", "fff651", "fff4b4", "fff318", "fff17b", "ffefdf", "ffee41", "ffeca4", "ffeb08", "ffe96b", "ffe7cf", "ffe631", "ffe494", "ffe2f8", "ffe15b", "ffdfbf", "ffde21", "ffdc84", "ffdae8", "ffd94b", "ffd7af", "ffd602", "ffd455", "ffd2aa", "ffd0fd", "ffcf50", "ffcda5", "ffcbf8", "ffca4b", "ffc8a0", "ffc6f3", "ffc546", "ffc39b", "ffc1ee", "ffc041", "ffbe96", "ffbce9", "ffbb3c", "ffb991", "ffb7e4", "ffb637", "ffb48c", "ffb2df", "ffb132", "ffaf87", "ffadda", "ffac2d", "ffaa82", "ffa8d5", "ffa728", "ffa57d", "ffa3d0", "ffa223", "ffa078", "ff9ecb", "ff9d1e", "ff9b73", "ff99c6", "ff9819", "ff966e", "ff94c1", "ff9314", "ff9169", "ff8fbc", "ff8e0f", "ff8c64", "ff8ab7", "ff890a", "ff875f", "ff81f4", "ff7c8a", "ff771f", "ff71b5", "ff6c4c", "ff66e1", "ff6177", "ff5c0c", "ff56a2", "ff5139", "ff4bce", "ff4664", "ff40f9", "ff3b8f", "ff3626", "ff30bb", "ff2b51", "ff25e6", "ff207c", "ff1b13", "ff15a8", "ff103e", "ff0ad3", "ff0569", "ff0000"] + ] + } +} diff --git a/powerline/colorschemes/ipython/default.json b/powerline/colorschemes/ipython/default.json new file mode 100644 index 00000000..d7875916 --- /dev/null +++ b/powerline/colorschemes/ipython/default.json @@ -0,0 +1,8 @@ +{ + "name": "Default color scheme for IPython prompt", + "groups": { + "virtualenv": { "fg": "white", "bg": "darkcyan" }, + "prompt": { "fg": "gray9", "bg": "gray4" }, + "prompt_count": { "fg": "white", "bg": "gray4" } + } +} diff --git a/powerline/colorschemes/shell/default.json b/powerline/colorschemes/shell/default.json new file mode 100644 index 00000000..9a5c5883 --- /dev/null +++ b/powerline/colorschemes/shell/default.json @@ -0,0 +1,18 @@ +{ + "name": "Default color scheme for shell prompts", + "groups": { + "user": { "fg": "white", "bg": "darkblue", "attr": ["bold"] }, + "superuser": { "fg": "white", "bg": "brightred", "attr": ["bold"] }, + "virtualenv": { "fg": "white", "bg": "darkcyan" }, + "branch": { "fg": "gray9", "bg": "gray2" }, + "branch_dirty": { "fg": "brightyellow", "bg": "gray2" }, + "branch_clean": { "fg": "gray9", "bg": "gray2" }, + "cwd": { "fg": "gray9", "bg": "gray4" }, + "cwd:current_folder": { "fg": "gray10", "bg": "gray4", "attr": ["bold"] }, + "cwd:divider": { "fg": "gray7", "bg": "gray4" }, + "hostname": { "fg": "brightyellow", "bg": "mediumorange" }, + "exit_fail": { "fg": "white", "bg": "darkestred" }, + "exit_success": { "fg": "white", "bg": "darkestgreen" }, + "environment": { "fg": "white", "bg": "darkestgreen" } + } +} diff --git a/powerline/colorschemes/shell/solarized.json b/powerline/colorschemes/shell/solarized.json new file mode 100644 index 00000000..70093ba7 --- /dev/null +++ b/powerline/colorschemes/shell/solarized.json @@ -0,0 +1,18 @@ +{ + "name": "Solarized Dark", + "groups": { + "user": { "fg": "oldlace", "bg": "blue", "attr": ["bold"] }, + "superuser": { "fg": "oldlace", "bg": "red", "attr": ["bold"] }, + "virtualenv": { "fg": "oldlace", "bg": "green" }, + "branch": { "fg": "gray61", "bg": "royalblue5" }, + "branch_dirty": { "fg": "yellow", "bg": "royalblue5" }, + "branch_clean": { "fg": "gray61", "bg": "royalblue5" }, + "cwd": { "fg": "lightyellow", "bg": "darkgreencopper" }, + "cwd:current_folder": { "fg": "oldlace", "bg": "darkgreencopper", "attr": ["bold"] }, + "cwd:divider": { "fg": "gray61", "bg": "darkgreencopper" }, + "hostname": { "fg": "oldlace", "bg": "darkgreencopper" }, + "exit_fail": { "fg": "oldlace", "bg": "red" }, + "exit_success": { "fg": "oldlace", "bg": "green" }, + "environment": { "fg": "oldlace", "bg": "green" } + } +} diff --git a/powerline/colorschemes/tmux/default.json b/powerline/colorschemes/tmux/default.json new file mode 100644 index 00000000..c7c76a47 --- /dev/null +++ b/powerline/colorschemes/tmux/default.json @@ -0,0 +1,27 @@ +{ + "name": "Default color scheme for terminal prompts", + "groups": { + "background:divider": { "fg": "gray5", "bg": "gray0" }, + "session": { "fg": "black", "bg": "gray10", "attr": ["bold"] }, + "date": { "fg": "gray8", "bg": "gray2" }, + "time": { "fg": "gray10", "bg": "gray2", "attr": ["bold"] }, + "time:divider": { "fg": "gray5", "bg": "gray2" }, + "email_alert": { "fg": "white", "bg": "brightred", "attr": ["bold"] }, + "email_alert_gradient": { "fg": "white", "bg": "yellow_orange_red", "attr": ["bold"] }, + "hostname": { "fg": "black", "bg": "gray10", "attr": ["bold"] }, + "weather": { "fg": "gray8", "bg": "gray0" }, + "weather_temp_gradient": { "fg": "blue_red", "bg": "gray0" }, + "weather_condition_hot": { "fg": "khaki1", "bg": "gray0" }, + "weather_condition_snowy": { "fg": "skyblue1", "bg": "gray0" }, + "weather_condition_rainy": { "fg": "skyblue1", "bg": "gray0" }, + "uptime": { "fg": "gray8", "bg": "gray0" }, + "external_ip": { "fg": "gray8", "bg": "gray0" }, + "network_load": { "fg": "gray8", "bg": "gray0" }, + "network_load_gradient": { "fg": "green_yellow_orange_red", "bg": "gray0" }, + "system_load": { "fg": "gray8", "bg": "gray0" }, + "system_load_gradient": { "fg": "green_yellow_orange_red", "bg": "gray0" }, + "environment": { "fg": "gray8", "bg": "gray0" }, + "battery": { "fg": "gray8", "bg": "gray0" }, + "battery_gradient": { "fg": "white_red", "bg": "gray0" } + } +} diff --git a/powerline/colorschemes/vim/default.json b/powerline/colorschemes/vim/default.json new file mode 100644 index 00000000..254383a1 --- /dev/null +++ b/powerline/colorschemes/vim/default.json @@ -0,0 +1,100 @@ +{ + "name": "Default color scheme", + "groups": { + "background": { "fg": "white", "bg": "gray2" }, + "background:divider": { "fg": "gray6", "bg": "gray2" }, + "mode": { "fg": "darkestgreen", "bg": "brightgreen", "attr": ["bold"] }, + "visual_range": { "fg": "brightestorange", "bg": "darkorange", "attr": ["bold"] }, + "modified_indicator": { "fg": "brightyellow", "bg": "gray4", "attr": ["bold"] }, + "paste_indicator": { "fg": "white", "bg": "mediumorange", "attr": ["bold"] }, + "readonly_indicator": { "fg": "brightestred", "bg": "gray4" }, + "branch": { "fg": "gray9", "bg": "gray4" }, + "branch_dirty": { "fg": "brightyellow", "bg": "gray4" }, + "branch_clean": { "fg": "gray9", "bg": "gray4" }, + "branch:divider": { "fg": "gray7", "bg": "gray4" }, + "file_directory": { "fg": "gray9", "bg": "gray4" }, + "file_name": { "fg": "white", "bg": "gray4", "attr": ["bold"] }, + "file_size": { "fg": "gray8", "bg": "gray2" }, + "file_name_no_file": { "fg": "gray9", "bg": "gray4", "attr": ["bold"] }, + "file_name_empty": { "fg": "gray9", "bg": "gray4" }, + "file_format": { "fg": "gray8", "bg": "gray2" }, + "file_encoding": { "fg": "gray8", "bg": "gray2" }, + "file_type": { "fg": "gray8", "bg": "gray2" }, + "file_vcs_status": { "fg": "brightestred", "bg": "gray4" }, + "file_vcs_status_M": { "fg": "brightyellow", "bg": "gray4" }, + "file_vcs_status_A": { "fg": "brightgreen", "bg": "gray4" }, + "line_percent": { "fg": "gray9", "bg": "gray4" }, + "line_percent_gradient": { "fg": "green_yellow_red", "bg": "gray4" }, + "line_current": { "fg": "gray1", "bg": "gray10", "attr": ["bold"] }, + "line_current_symbol": { "fg": "gray1", "bg": "gray10" }, + "virtcol_current_gradient": { "fg": "dark_GREEN_Orange_red", "bg": "gray10" }, + "col_current": { "fg": "gray6", "bg": "gray10" }, + "modified_buffers": { "fg": "brightyellow", "bg": "gray2" }, + "environment": { "fg": "gray8", "bg": "gray2" }, + "error": { "fg": "brightestred", "bg": "darkred", "attr": ["bold"] }, + "warning": { "fg": "brightyellow", "bg": "darkorange", "attr": ["bold"] }, + "current_tag": { "fg": "gray9", "bg": "gray2" } + }, + "mode_translations": { + "nc": { + "colors": { + "brightyellow": "darkorange", + "brightestred": "darkred", + "gray0": "gray0", + "gray1": "gray0", + "gray2": "gray0", + "gray3": "gray1", + "gray4": "gray1", + "gray5": "gray1", + "gray6": "gray1", + "gray7": "gray4", + "gray8": "gray4", + "gray9": "gray4", + "gray10": "gray5", + "white": "gray6", + "green_yellow_red": "gray5" + } + }, + "i": { + "colors": { + "gray0": "darkestblue", + "gray1": "darkestblue", + "gray2": "darkestblue", + "gray3": "darkblue", + "gray4": "darkblue", + "gray5": "darkestcyan", + "gray6": "darkestcyan", + "gray7": "darkestcyan", + "gray8": "mediumcyan", + "gray9": "mediumcyan", + "gray10": "mediumcyan", + "green_yellow_red": "gray5" + }, + "groups": { + "mode": { "fg": "darkestcyan", "bg": "white", "attr": ["bold"] }, + "background:divider": { "fg": "darkcyan", "bg": "darkestblue" }, + "branch:divider": { "fg": "darkcyan", "bg": "darkblue" } + } + }, + "v": { + "groups": { + "mode": { "fg": "darkorange", "bg": "brightestorange", "attr": ["bold"] } + } + }, + "V": { + "groups": { + "mode": { "fg": "darkorange", "bg": "brightestorange", "attr": ["bold"] } + } + }, + "^V": { + "groups": { + "mode": { "fg": "darkorange", "bg": "brightestorange", "attr": ["bold"] } + } + }, + "R": { + "groups": { + "mode": { "fg": "white", "bg": "brightred", "attr": ["bold"] } + } + } + } +} diff --git a/powerline/colorschemes/vim/solarized.json b/powerline/colorschemes/vim/solarized.json new file mode 100644 index 00000000..869ebf1d --- /dev/null +++ b/powerline/colorschemes/vim/solarized.json @@ -0,0 +1,97 @@ +{ + "name": "Solarized Dark", + "groups": { + "background": { "fg": "oldlace", "bg": "royalblue5" }, + "background:divider": { "fg": "lightskyblue4", "bg": "royalblue5" }, + "mode": { "fg": "oldlace", "bg": "green", "attr": ["bold"] }, + "visual_range": { "fg": "green", "bg": "oldlace", "attr": ["bold"] }, + "modified_indicator": { "fg": "yellow", "bg": "darkgreencopper", "attr": ["bold"] }, + "paste_indicator": { "fg": "oldlace", "bg": "orange", "attr": ["bold"] }, + "readonly_indicator": { "fg": "red", "bg": "darkgreencopper" }, + "branch": { "fg": "lightyellow", "bg": "darkgreencopper" }, + "branch_dirty": { "fg": "yellow", "bg": "darkgreencopper" }, + "branch_clean": { "fg": "lightyellow", "bg": "darkgreencopper" }, + "branch:divider": { "fg": "gray61", "bg": "darkgreencopper" }, + "file_directory": { "fg": "lightyellow", "bg": "darkgreencopper" }, + "file_name": { "fg": "oldlace", "bg": "darkgreencopper", "attr": ["bold"] }, + "file_size": { "fg": "oldlace", "bg": "darkgreencopper" }, + "file_name_no_file": { "fg": "oldlace", "bg": "darkgreencopper", "attr": ["bold"] }, + "file_name_empty": { "fg": "oldlace", "bg": "darkgreencopper" }, + "file_format": { "fg": "gray61", "bg": "royalblue5" }, + "file_encoding": { "fg": "gray61", "bg": "royalblue5" }, + "file_type": { "fg": "gray61", "bg": "royalblue5" }, + "file_vcs_status": { "fg": "red", "bg": "darkgreencopper" }, + "file_vcs_status_M": { "fg": "yellow", "bg": "darkgreencopper" }, + "file_vcs_status_A": { "fg": "green", "bg": "darkgreencopper" }, + "line_percent": { "fg": "oldlace", "bg": "lightskyblue4" }, + "line_percent_gradient": { "fg": "green_yellow_orange_red", "bg": "lightskyblue4" }, + "line_current": { "fg": "gray13", "bg": "lightyellow", "attr": ["bold"] }, + "line_current_symbol": { "fg": "gray13", "bg": "lightyellow" }, + "virtcol_current_gradient": { "fg": "GREEN_Orange_red", "bg": "gray10" }, + "col_current": { "fg": "azure4", "bg": "lightyellow" }, + "environment": { "fg": "gray61", "bg": "royalblue5" }, + "error": { "fg": "oldlace", "bg": "red", "attr": ["bold"] }, + "warning": { "fg": "oldlace", "bg": "orange", "attr": ["bold"] }, + "current_tag": { "fg": "oldlace", "bg": "royalblue5", "attr": ["bold"] } + }, + "mode_translations": { + "nc": { + "colors": { + "darkgreencopper": "royalblue5", + "lightskyblue4": "royalblue5", + "azure4": "darkgreencopper", + "gray61": "lightskyblue4", + "lightyellow": "azure4", + "oldlace": "gray61" + } + }, + "i": { + "groups": { + "background": { "fg": "oldlace", "bg": "darkgreencopper" }, + "background:divider": { "fg": "lightyellow", "bg": "darkgreencopper" }, + "mode": { "fg": "oldlace", "bg": "blue", "attr": ["bold"] }, + "modified_indicator": { "fg": "yellow", "bg": "lightyellow", "attr": ["bold"] }, + "paste_indicator": { "fg": "oldlace", "bg": "orange", "attr": ["bold"] }, + "readonly_indicator": { "fg": "red", "bg": "lightyellow" }, + "branch": { "fg": "darkgreencopper", "bg": "lightyellow" }, + "branch:divider": { "fg": "lightskyblue4", "bg": "lightyellow" }, + "file_directory": { "fg": "darkgreencopper", "bg": "lightyellow" }, + "file_name": { "fg": "royalblue5", "bg": "lightyellow", "attr": ["bold"] }, + "file_size": { "fg": "royalblue5", "bg": "lightyellow" }, + "file_name_no_file": { "fg": "royalblue5", "bg": "lightyellow", "attr": ["bold"] }, + "file_name_empty": { "fg": "royalblue5", "bg": "lightyellow" }, + "file_format": { "fg": "lightyellow", "bg": "darkgreencopper" }, + "file_encoding": { "fg": "lightyellow", "bg": "darkgreencopper" }, + "file_type": { "fg": "lightyellow", "bg": "darkgreencopper" }, + "file_vcs_status": { "fg": "red", "bg": "lightyellow" }, + "file_vcs_status_M": { "fg": "yellow", "bg": "lightyellow" }, + "file_vcs_status_A": { "fg": "green", "bg": "lightyellow" }, + "line_percent": { "fg": "oldlace", "bg": "gray61" }, + "line_percent_gradient": { "fg": "oldlace", "bg": "gray61" }, + "line_current": { "fg": "gray13", "bg": "oldlace", "attr": ["bold"] }, + "line_current_symbol": { "fg": "gray13", "bg": "oldlace" }, + "col_current": { "fg": "azure4", "bg": "oldlace" } + } + }, + "v": { + "groups": { + "mode": { "fg": "oldlace", "bg": "orange", "attr": ["bold"] } + } + }, + "V": { + "groups": { + "mode": { "fg": "oldlace", "bg": "orange", "attr": ["bold"] } + } + }, + "^V": { + "groups": { + "mode": { "fg": "oldlace", "bg": "orange", "attr": ["bold"] } + } + }, + "R": { + "groups": { + "mode": { "fg": "oldlace", "bg": "red", "attr": ["bold"] } + } + } + } +} diff --git a/powerline/colorschemes/wm/default.json b/powerline/colorschemes/wm/default.json new file mode 100644 index 00000000..445da4f6 --- /dev/null +++ b/powerline/colorschemes/wm/default.json @@ -0,0 +1,26 @@ +{ + "name": "Default color scheme for window managers", + "groups": { + "background:divider": { "fg": "gray5", "bg": "gray0" }, + "session": { "fg": "black", "bg": "gray10", "attr": ["bold"] }, + "date": { "fg": "gray8", "bg": "gray2" }, + "time": { "fg": "gray10", "bg": "gray2", "attr": ["bold"] }, + "time:divider": { "fg": "gray5", "bg": "gray2" }, + "email_alert": { "fg": "white", "bg": "brightred", "attr": ["bold"] }, + "email_alert_gradient": { "fg": "white", "bg": "yellow_orange_red", "attr": ["bold"] }, + "hostname": { "fg": "black", "bg": "gray10", "attr": ["bold"] }, + "weather": { "fg": "gray8", "bg": "gray0" }, + "weather_temp_gradient": { "fg": "blue_red", "bg": "gray0" }, + "weather_condition_hot": { "fg": "khaki1", "bg": "gray0" }, + "weather_condition_snowy": { "fg": "skyblue1", "bg": "gray0" }, + "weather_condition_rainy": { "fg": "skyblue1", "bg": "gray0" }, + "uptime": { "fg": "gray8", "bg": "gray0" }, + "external_ip": { "fg": "gray8", "bg": "gray0" }, + "network_load": { "fg": "gray8", "bg": "gray0" }, + "system_load": { "fg": "gray8", "bg": "gray0" }, + "system_load_good": { "fg": "lightyellowgreen", "bg": "gray0" }, + "system_load_bad": { "fg": "gold3", "bg": "gray0" }, + "system_load_ugly": { "fg": "orangered", "bg": "gray0" }, + "environment": { "fg": "gray8", "bg": "gray0" } + } +} diff --git a/powerline/config.json b/powerline/config.json new file mode 100644 index 00000000..e9a627e7 --- /dev/null +++ b/powerline/config.json @@ -0,0 +1,53 @@ +{ + "common": { + "term_truecolor": false, + "dividers": { + "left": { + "hard": " ", + "soft": " " + }, + "right": { + "hard": " ", + "soft": " " + } + }, + "spaces": 1 + }, + "ext": { + "ipython": { + "colorscheme": "default", + "theme": "in", + "local_themes": { + "rewrite": "rewrite", + "out": "out", + "in2": "in2" + } + }, + "shell": { + "colorscheme": "default", + "theme": "default" + }, + "tmux": { + "colorscheme": "default", + "theme": "default" + }, + "vim": { + "colorscheme": "default", + "theme": "default", + "local_themes": { + "cmdwin": "cmdwin", + "help": "help", + "quickfix": "quickfix", + + "powerline.matchers.plugin.nerdtree.nerdtree": "plugin/nerdtree", + "powerline.matchers.plugin.ctrlp.ctrlp": "plugin/ctrlp", + "powerline.matchers.plugin.gundo.gundo": "plugin/gundo", + "powerline.matchers.plugin.gundo.gundo_preview": "plugin/gundo-preview" + } + }, + "wm": { + "colorscheme": "default", + "theme": "default" + } + } +} diff --git a/powerline/themes/ipython/in.json b/powerline/themes/ipython/in.json new file mode 100644 index 00000000..ac979c5f --- /dev/null +++ b/powerline/themes/ipython/in.json @@ -0,0 +1,26 @@ +{ + "default_module": "powerline.segments.common", + "segments": { + "left": [ + { + "name": "virtualenv" + }, + { + "type": "string", + "contents": "In[", + "draw_soft_divider": false, + "highlight_group": ["prompt"] + }, + { + "name": "prompt_count", + "module": "powerline.segments.ipython", + "draw_soft_divider": false + }, + { + "type": "string", + "contents": "]", + "highlight_group": ["prompt"] + } + ] + } +} diff --git a/powerline/themes/ipython/in2.json b/powerline/themes/ipython/in2.json new file mode 100644 index 00000000..601fc9e5 --- /dev/null +++ b/powerline/themes/ipython/in2.json @@ -0,0 +1,13 @@ +{ + "default_module": "powerline.segments.common", + "segments": { + "left": [ + { + "type": "string", + "contents": "", + "width": "auto", + "highlight_group": ["prompt"] + } + ] + } +} diff --git a/powerline/themes/ipython/out.json b/powerline/themes/ipython/out.json new file mode 100644 index 00000000..11a63234 --- /dev/null +++ b/powerline/themes/ipython/out.json @@ -0,0 +1,25 @@ +{ + "default_module": "powerline.segments.common", + "segments": { + "left": [ + { + "type": "string", + "contents": "Out[", + "draw_soft_divider": false, + "width": "auto", + "align": "r", + "highlight_group": ["prompt"] + }, + { + "name": "prompt_count", + "module": "powerline.segments.ipython", + "draw_soft_divider": false + }, + { + "type": "string", + "contents": "]", + "highlight_group": ["prompt"] + } + ] + } +} diff --git a/powerline/themes/ipython/rewrite.json b/powerline/themes/ipython/rewrite.json new file mode 100644 index 00000000..47d8de0d --- /dev/null +++ b/powerline/themes/ipython/rewrite.json @@ -0,0 +1,23 @@ +{ + "segments": { + "left": [ + { + "type": "string", + "contents": "", + "draw_soft_divider": false, + "width": "auto", + "highlight_group": ["prompt"] + }, + { + "name": "prompt_count", + "module": "powerline.segments.ipython", + "draw_soft_divider": false + }, + { + "type": "string", + "contents": ">", + "highlight_group": ["prompt"] + } + ] + } +} diff --git a/powerline/themes/shell/default.json b/powerline/themes/shell/default.json new file mode 100644 index 00000000..6246a964 --- /dev/null +++ b/powerline/themes/shell/default.json @@ -0,0 +1,45 @@ +{ + "default_module": "powerline.segments.common", + "segment_data": { + "hostname": { + "before": " ", + "args": { + "only_if_ssh": true + } + }, + "virtualenv": { + "before": "ⓔ " + }, + "branch": { + "before": " " + } + }, + "segments": { + "left": [ + { + "name": "hostname" + }, + { + "name": "user" + }, + { + "name": "virtualenv" + }, + { + "name": "cwd", + "args": { + "dir_limit_depth": 3 + } + } + ], + "right": [ + { + "module": "powerline.segments.shell", + "name": "last_pipe_status" + }, + { + "name": "branch" + } + ] + } +} diff --git a/powerline/themes/shell/default_leftonly.json b/powerline/themes/shell/default_leftonly.json new file mode 100644 index 00000000..16af9755 --- /dev/null +++ b/powerline/themes/shell/default_leftonly.json @@ -0,0 +1,43 @@ +{ + "default_module": "powerline.segments.common", + "segment_data": { + "hostname": { + "before": " ", + "args": { + "only_if_ssh": true + } + }, + "virtualenv": { + "before": "ⓔ " + }, + "branch": { + "before": " " + } + }, + "segments": { + "left": [ + { + "name": "hostname" + }, + { + "name": "user" + }, + { + "name": "virtualenv" + }, + { + "name": "branch" + }, + { + "name": "cwd", + "args": { + "dir_limit_depth": 3 + } + }, + { + "name": "last_status", + "module": "powerline.segments.shell" + } + ] + } +} diff --git a/powerline/themes/tmux/default.json b/powerline/themes/tmux/default.json new file mode 100644 index 00000000..7d475c96 --- /dev/null +++ b/powerline/themes/tmux/default.json @@ -0,0 +1,46 @@ +{ + "default_module": "powerline.segments.common", + "segment_data": { + "uptime": { + "before": "⇑ " + }, + "external_ip": { + "before": "ⓦ " + }, + "date": { + "before": "⌚ " + }, + "email_imap_alert": { + "before": "✉ ", + "args": { + "username": "", + "password": "" + } + } + }, + "segments": { + "right": [ + { + "name": "uptime", + "priority": 50 + }, + { + "name": "system_load", + "priority": 50 + }, + { + "name": "date" + }, + { + "name": "date", + "args": { + "format": "%H:%M", + "istime": true + } + }, + { + "name": "hostname" + } + ] + } +} diff --git a/powerline/themes/vim/cmdwin.json b/powerline/themes/vim/cmdwin.json new file mode 100644 index 00000000..c300d948 --- /dev/null +++ b/powerline/themes/vim/cmdwin.json @@ -0,0 +1,18 @@ +{ + "segments": { + "left": [ + { + "type": "string", + "contents": "Command Line", + "highlight_group": ["file_name"] + }, + { + "type": "string", + "highlight_group": ["background"], + "draw_soft_divider": false, + "draw_hard_divider": false, + "width": "auto" + } + ] + } +} diff --git a/powerline/themes/vim/default.json b/powerline/themes/vim/default.json new file mode 100644 index 00000000..5f10912d --- /dev/null +++ b/powerline/themes/vim/default.json @@ -0,0 +1,126 @@ +{ + "segment_data": { + "branch": { + "before": " " + }, + "modified_indicator": { + "args": { "text": "+" } + }, + "line_percent": { + "args": { "gradient": true }, + "after": "%" + }, + "line_current_symbol": { + "contents": " " + } + }, + "segments": { + "left": [ + { + "name": "mode", + "exclude_modes": ["nc"] + }, + { + "name": "visual_range", + "exclude_modes": ["nc"], + "priority": 10 + }, + { + "name": "paste_indicator", + "exclude_modes": ["nc"], + "priority": 10 + }, + { + "name": "branch", + "exclude_modes": ["nc"], + "priority": 30 + }, + { + "name": "readonly_indicator", + "draw_soft_divider": false, + "after": " " + }, + { + "name": "file_directory", + "priority": 40, + "draw_soft_divider": false + }, + { + "name": "file_name", + "draw_soft_divider": false + }, + { + "name": "file_vcs_status", + "before": " ", + "draw_soft_divider": false + }, + { + "name": "modified_indicator", + "before": " " + }, + { + "exclude_modes": ["nc"], + "module": "powerline.segments.plugin.syntastic", + "name": "syntastic", + "priority": 50 + }, + { + "exclude_modes": ["nc"], + "module": "powerline.segments.plugin.tagbar", + "name": "current_tag", + "draw_soft_divider": false, + "priority": 50 + }, + { + "type": "string", + "highlight_group": ["background"], + "draw_soft_divider": false, + "draw_hard_divider": false, + "width": "auto" + } + ], + "right": [ + { + "name": "file_format", + "draw_soft_divider": false, + "exclude_modes": ["nc"], + "priority": 60 + }, + { + "name": "file_encoding", + "exclude_modes": ["nc"], + "priority": 60 + }, + { + "name": "file_type", + "exclude_modes": ["nc"], + "priority": 60 + }, + { + "name": "line_percent", + "priority": 50, + "width": 4, + "align": "r" + }, + { + "type": "string", + "name": "line_current_symbol", + "highlight_group": ["line_current_symbol", "line_current"] + }, + { + "name": "line_current", + "draw_soft_divider": false, + "width": 3, + "align": "r" + }, + { + "name": "virtcol_current", + "draw_soft_divider": false, + "priority": 20, + "before": ":", + "width": 3, + "align": "l" + } + ] + } +} diff --git a/powerline/themes/vim/help.json b/powerline/themes/vim/help.json new file mode 100644 index 00000000..74071057 --- /dev/null +++ b/powerline/themes/vim/help.json @@ -0,0 +1,36 @@ +{ + "segments": { + "left": [ + { + "name": "file_name", + "draw_soft_divider": false + }, + { + "type": "string", + "highlight_group": ["background"], + "draw_soft_divider": false, + "draw_hard_divider": false, + "width": "auto" + } + ], + "right": [ + { + "name": "line_percent", + "priority": 30, + "width": 4, + "align": "r" + }, + { + "type": "string", + "name": "line_current_symbol", + "highlight_group": ["line_current_symbol", "line_current"] + }, + { + "name": "line_current", + "draw_soft_divider": false, + "width": 3, + "align": "r" + } + ] + } +} diff --git a/powerline/themes/vim/plugin/ctrlp.json b/powerline/themes/vim/plugin/ctrlp.json new file mode 100644 index 00000000..02015b78 --- /dev/null +++ b/powerline/themes/vim/plugin/ctrlp.json @@ -0,0 +1,28 @@ +{ + "default_module": "powerline.segments.plugin.ctrlp", + "segments": { + "left": [ + { + "name": "ctrlp", + "args": { + "side": "left" + } + }, + { + "type": "string", + "highlight_group": ["ctrlp.background", "background"], + "draw_soft_divider": false, + "draw_hard_divider": false, + "width": "auto" + } + ], + "right": [ + { + "name": "ctrlp", + "args": { + "side": "right" + } + } + ] + } +} diff --git a/powerline/themes/vim/plugin/gundo-preview.json b/powerline/themes/vim/plugin/gundo-preview.json new file mode 100644 index 00000000..3ce202ea --- /dev/null +++ b/powerline/themes/vim/plugin/gundo-preview.json @@ -0,0 +1,19 @@ +{ + "default_module": "powerline.segments.plugin.gundo", + "segments": { + "left": [ + { + "type": "string", + "highlight_group": ["gundo.name", "file_name"], + "contents": "Undo diff" + }, + { + "type": "string", + "highlight_group": ["gundo.background", "background"], + "draw_soft_divider": false, + "draw_hard_divider": false, + "width": "auto" + } + ] + } +} diff --git a/powerline/themes/vim/plugin/gundo.json b/powerline/themes/vim/plugin/gundo.json new file mode 100644 index 00000000..0c1a336a --- /dev/null +++ b/powerline/themes/vim/plugin/gundo.json @@ -0,0 +1,19 @@ +{ + "default_module": "powerline.segments.plugin.gundo", + "segments": { + "left": [ + { + "type": "string", + "highlight_group": ["gundo.name", "file_name"], + "contents": "Undo tree" + }, + { + "type": "string", + "highlight_group": ["gundo.background", "background"], + "draw_soft_divider": false, + "draw_hard_divider": false, + "width": "auto" + } + ] + } +} diff --git a/powerline/themes/vim/plugin/nerdtree.json b/powerline/themes/vim/plugin/nerdtree.json new file mode 100644 index 00000000..95495db1 --- /dev/null +++ b/powerline/themes/vim/plugin/nerdtree.json @@ -0,0 +1,17 @@ +{ + "default_module": "powerline.segments.plugin.nerdtree", + "segments": { + "left": [ + { + "name": "nerdtree" + }, + { + "type": "string", + "highlight_group": ["background"], + "draw_soft_divider": false, + "draw_hard_divider": false, + "width": "auto" + } + ] + } +} diff --git a/powerline/themes/vim/quickfix.json b/powerline/themes/vim/quickfix.json new file mode 100644 index 00000000..da77d631 --- /dev/null +++ b/powerline/themes/vim/quickfix.json @@ -0,0 +1,37 @@ +{ + "segment_data": { + "buffer_name": { + "contents": "Location List" + } + }, + "segments": { + "left": [ + { + "type": "string", + "name": "buffer_name", + "highlight_group": ["file_name"], + "draw_soft_divider": false + }, + { + "type": "string", + "highlight_group": ["background"], + "draw_soft_divider": false, + "draw_hard_divider": false, + "width": "auto" + } + ], + "right": [ + { + "type": "string", + "name": "line_current_symbol", + "highlight_group": ["line_current_symbol", "line_current"] + }, + { + "name": "line_current", + "draw_soft_divider": false, + "width": 3, + "align": "r" + } + ] + } +} diff --git a/powerline/themes/wm/default.json b/powerline/themes/wm/default.json new file mode 100644 index 00000000..c1cee4b7 --- /dev/null +++ b/powerline/themes/wm/default.json @@ -0,0 +1,31 @@ +{ + "default_module": "powerline.segments.common", + "segments": { + "right": [ + { + "name": "weather", + "priority": 50 + }, + { + "name": "date" + }, + { + "name": "date", + "args": { + "format": "%H:%M", + "istime": true + }, + "before": "⌚ " + }, + { + "name": "email_imap_alert", + "before": "✉ ", + "priority": 10, + "args": { + "username": "", + "password": "" + } + } + ] + } +} diff --git a/vendor/powerline b/vendor/powerline new file mode 160000 index 00000000..db80fc95 --- /dev/null +++ b/vendor/powerline @@ -0,0 +1 @@ +Subproject commit db80fc95ed01d2c559c4bdc7da8514ed3cc7fcd9 From 597b1feda9f2b390db97abfac9308166a1afe9ce Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Mon, 11 Nov 2013 20:24:58 -0800 Subject: [PATCH 040/234] Submodule some zsh deps --- .gitmodules | 6 + shells/zsh/lib/fish.zsh | 12 + shells/zsh/lib/history-substring-search | 1 + .../lib/history-substring-search/README.md | 92 --- .../zsh-history-substring-search.plugin.zsh | 12 - .../zsh-history-substring-search.zsh | 554 ------------------ shells/zsh/lib/syntax-highlighting | 1 + shells/zsh/lib/syntax-highlighting/.gitignore | 1 - shells/zsh/lib/syntax-highlighting/COPYING.md | 23 - shells/zsh/lib/syntax-highlighting/README.md | 47 -- .../highlighters/README.md | 49 -- .../highlighters/brackets/README.md | 30 - .../brackets/brackets-highlighter.zsh | 110 ---- .../test-data/mismatch-patentheses.zsh | 38 -- .../brackets/test-data/nested-parentheses.zsh | 40 -- .../brackets/test-data/quoted-patentheses.zsh | 35 -- .../brackets/test-data/simple-parentheses.zsh | 38 -- .../test-data/unclosed-patentheses.zsh | 37 -- .../test-data/unclosed-patentheses2.zsh | 37 -- .../highlighters/cursor/README.md | 24 - .../cursor/cursor-highlighter.zsh | 45 -- .../highlighters/main/README.md | 58 -- .../highlighters/main/main-highlighter.zsh | 184 ------ .../highlighters/main/test-data/assign.zsh | 35 -- .../main/test-data/multiple-redirections.zsh | 47 -- .../main/test-data/path-space- .zsh | 36 -- .../main/test-data/path-tilde-home.zsh | 36 -- .../main/test-data/path-tilde-named.zsh | 38 -- .../highlighters/main/test-data/path.zsh | 36 -- .../main/test-data/simple-command.zsh | 35 -- .../main/test-data/simple-redirection.zsh | 39 -- .../main/test-data/unknown-command.zsh | 35 -- .../highlighters/pattern/README.md | 21 - .../pattern/pattern-highlighter.zsh | 59 -- .../highlighters/root/README.md | 24 - .../highlighters/root/root-highlighter.zsh | 45 -- .../lib/syntax-highlighting/tests/README.md | 20 - .../tests/test-highlighting.zsh | 115 ---- .../syntax-highlighting/tests/test-perfs.zsh | 75 --- .../zsh-syntax-highlighting.plugin.zsh | 1 - .../zsh-syntax-highlighting.zsh | 218 ------- 41 files changed, 20 insertions(+), 2369 deletions(-) create mode 160000 shells/zsh/lib/history-substring-search delete mode 100644 shells/zsh/lib/history-substring-search/README.md delete mode 100644 shells/zsh/lib/history-substring-search/zsh-history-substring-search.plugin.zsh delete mode 100644 shells/zsh/lib/history-substring-search/zsh-history-substring-search.zsh create mode 160000 shells/zsh/lib/syntax-highlighting delete mode 100644 shells/zsh/lib/syntax-highlighting/.gitignore delete mode 100644 shells/zsh/lib/syntax-highlighting/COPYING.md delete mode 100644 shells/zsh/lib/syntax-highlighting/README.md delete mode 100644 shells/zsh/lib/syntax-highlighting/highlighters/README.md delete mode 100644 shells/zsh/lib/syntax-highlighting/highlighters/brackets/README.md delete mode 100644 shells/zsh/lib/syntax-highlighting/highlighters/brackets/brackets-highlighter.zsh delete mode 100644 shells/zsh/lib/syntax-highlighting/highlighters/brackets/test-data/mismatch-patentheses.zsh delete mode 100644 shells/zsh/lib/syntax-highlighting/highlighters/brackets/test-data/nested-parentheses.zsh delete mode 100644 shells/zsh/lib/syntax-highlighting/highlighters/brackets/test-data/quoted-patentheses.zsh delete mode 100644 shells/zsh/lib/syntax-highlighting/highlighters/brackets/test-data/simple-parentheses.zsh delete mode 100644 shells/zsh/lib/syntax-highlighting/highlighters/brackets/test-data/unclosed-patentheses.zsh delete mode 100644 shells/zsh/lib/syntax-highlighting/highlighters/brackets/test-data/unclosed-patentheses2.zsh delete mode 100644 shells/zsh/lib/syntax-highlighting/highlighters/cursor/README.md delete mode 100644 shells/zsh/lib/syntax-highlighting/highlighters/cursor/cursor-highlighter.zsh delete mode 100644 shells/zsh/lib/syntax-highlighting/highlighters/main/README.md delete mode 100755 shells/zsh/lib/syntax-highlighting/highlighters/main/main-highlighter.zsh delete mode 100644 shells/zsh/lib/syntax-highlighting/highlighters/main/test-data/assign.zsh delete mode 100644 shells/zsh/lib/syntax-highlighting/highlighters/main/test-data/multiple-redirections.zsh delete mode 100644 shells/zsh/lib/syntax-highlighting/highlighters/main/test-data/path-space- .zsh delete mode 100644 shells/zsh/lib/syntax-highlighting/highlighters/main/test-data/path-tilde-home.zsh delete mode 100644 shells/zsh/lib/syntax-highlighting/highlighters/main/test-data/path-tilde-named.zsh delete mode 100644 shells/zsh/lib/syntax-highlighting/highlighters/main/test-data/path.zsh delete mode 100644 shells/zsh/lib/syntax-highlighting/highlighters/main/test-data/simple-command.zsh delete mode 100644 shells/zsh/lib/syntax-highlighting/highlighters/main/test-data/simple-redirection.zsh delete mode 100644 shells/zsh/lib/syntax-highlighting/highlighters/main/test-data/unknown-command.zsh delete mode 100644 shells/zsh/lib/syntax-highlighting/highlighters/pattern/README.md delete mode 100644 shells/zsh/lib/syntax-highlighting/highlighters/pattern/pattern-highlighter.zsh delete mode 100644 shells/zsh/lib/syntax-highlighting/highlighters/root/README.md delete mode 100644 shells/zsh/lib/syntax-highlighting/highlighters/root/root-highlighter.zsh delete mode 100644 shells/zsh/lib/syntax-highlighting/tests/README.md delete mode 100755 shells/zsh/lib/syntax-highlighting/tests/test-highlighting.zsh delete mode 100755 shells/zsh/lib/syntax-highlighting/tests/test-perfs.zsh delete mode 120000 shells/zsh/lib/syntax-highlighting/zsh-syntax-highlighting.plugin.zsh delete mode 100644 shells/zsh/lib/syntax-highlighting/zsh-syntax-highlighting.zsh diff --git a/.gitmodules b/.gitmodules index 7d27ed47..ea911ebe 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,3 +4,9 @@ [submodule "vendor/powerline"] path = vendor/powerline url = git://github.com/Lokaltog/powerline.git +[submodule "shells/zsh/lib/syntax-highlighting"] + path = shells/zsh/lib/syntax-highlighting + url = git://github.com/zsh-users/zsh-syntax-highlighting.git +[submodule "shells/zsh/lib/history-substring-search"] + path = shells/zsh/lib/history-substring-search + url = git://github.com/zsh-users/zsh-history-substring-search.git diff --git a/shells/zsh/lib/fish.zsh b/shells/zsh/lib/fish.zsh index b2c380d5..8ff737ee 100644 --- a/shells/zsh/lib/fish.zsh +++ b/shells/zsh/lib/fish.zsh @@ -1,2 +1,14 @@ source $SHELL_FILES/lib/syntax-highlighting/zsh-syntax-highlighting.zsh source $SHELL_FILES/lib/history-substring-search/zsh-history-substring-search.zsh + +# bind UP and DOWN arrow keys +bindkey '^[[A' history-substring-search-up +bindkey '^[[B' history-substring-search-down + +# bind P and N for EMACS mode +bindkey -M emacs '^P' history-substring-search-up +bindkey -M emacs '^N' history-substring-search-down + +# bind k and j for VI mode +bindkey -M vicmd 'k' history-substring-search-up +bindkey -M vicmd 'j' history-substring-search-down diff --git a/shells/zsh/lib/history-substring-search b/shells/zsh/lib/history-substring-search new file mode 160000 index 00000000..1e768040 --- /dev/null +++ b/shells/zsh/lib/history-substring-search @@ -0,0 +1 @@ +Subproject commit 1e7680405239a835aa403a7457cad23750f98e72 diff --git a/shells/zsh/lib/history-substring-search/README.md b/shells/zsh/lib/history-substring-search/README.md deleted file mode 100644 index 64fe5282..00000000 --- a/shells/zsh/lib/history-substring-search/README.md +++ /dev/null @@ -1,92 +0,0 @@ -zsh-history-substring-search -============================================================================== - -This is a clean-room implementation of the [Fish shell][1]'s history search -feature, where you can type in any part of any previously entered command -and press the UP and DOWN arrow keys to cycle through the matching commands. - -[1]: http://fishshell.com -[2]: http://www.zsh.org/mla/users/2009/msg00818.html -[3]: http://sourceforge.net/projects/fizsh/ -[4]: https://github.com/robbyrussell/oh-my-zsh/pull/215 -[5]: https://github.com/zsh-users/zsh-history-substring-search -[6]: https://github.com/zsh-users/zsh-syntax-highlighting - ----------------------------------------------------------------------------- -Usage ----------------------------------------------------------------------------- - -1. Load this script into your interactive ZSH session: - - % source zsh-history-substring-search.zsh - - If you want to use [zsh-syntax-highlighting][6] along with this script, - then make sure that you load it *before* you load this script: - - % source zsh-syntax-highlighting.zsh - % source zsh-history-substring-search.zsh - -2. Type any part of any previous command and then: - - * Press the UP arrow key to select the nearest command that (1) contains - your query and (2) is older than the current command in the command - history. - - * Press the DOWN arrow key to select the nearest command that (1) - contains your query and (2) is newer than the current command in the - command history. - - * Press ^U (the Control and U keys simultaneously) to abort the search. - -3. If a matching command spans more than one line of text, press the LEFT - arrow key to move the cursor away from the end of the command, and then: - - * Press the UP arrow key to move the cursor to the line above. When the - cursor reaches the first line of the command, pressing the UP arrow - key again will cause this script to perform another search. - - * Press the DOWN arrow key to move the cursor to the line below. When - the cursor reaches the last line of the command, pressing the DOWN - arrow key again will cause this script to perform another search. - ----------------------------------------------------------------------------- -Configuration ----------------------------------------------------------------------------- - -This script defines the following global variables. You may override their -default values only after having loaded this script into your ZSH session. - -* HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND is a global variable that defines - how the query should be highlighted inside a matching command. Its default - value causes this script to highlight using bold, white text on a magenta - background. See the "Character Highlighting" section in the zshzle(1) man - page to learn about the kinds of values you may assign to this variable. - -* HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND is a global variable that - defines how the query should be highlighted when no commands in the - history match it. Its default value causes this script to highlight using - bold, white text on a red background. See the "Character Highlighting" - section in the zshzle(1) man page to learn about the kinds of values you - may assign to this variable. - -* HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS is a global variable that defines - how the command history will be searched for your query. Its default value - causes this script to perform a case-insensitive search. See the "Globbing - Flags" section in the zshexpn(1) man page to learn about the kinds of - values you may assign to this variable. - ----------------------------------------------------------------------------- -History ----------------------------------------------------------------------------- - -This script was originally written by [Peter Stephenson][2], who published it -to the ZSH users mailing list (thereby making it public domain) in September -2009. It was later revised by Guido van Steen and released under the BSD -license (see below) as part of [the fizsh project][3] in January 2011. - -It was later extracted from fizsh release 1.0.1, refactored heavily, and -repackaged as both an [oh-my-zsh plugin][4] and as an independently loadable -[ZSH script][5] by Suraj N. Kurapati in 2011. - -It was [further developed][4] by Guido van Steen, Suraj N. Kurapati, Sorin -Ionescu, and Vincent Guerci in 2011. diff --git a/shells/zsh/lib/history-substring-search/zsh-history-substring-search.plugin.zsh b/shells/zsh/lib/history-substring-search/zsh-history-substring-search.plugin.zsh deleted file mode 100644 index b393f66d..00000000 --- a/shells/zsh/lib/history-substring-search/zsh-history-substring-search.plugin.zsh +++ /dev/null @@ -1,12 +0,0 @@ -# This file integrates the zsh-history-substring-search script into oh-my-zsh. - -source "${0:r:r}.zsh" - -if test "$CASE_SENSITIVE" = true; then - unset HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS -fi - -if test "$DISABLE_COLOR" = true; then - unset HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND - unset HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND -fi diff --git a/shells/zsh/lib/history-substring-search/zsh-history-substring-search.zsh b/shells/zsh/lib/history-substring-search/zsh-history-substring-search.zsh deleted file mode 100644 index e03e3103..00000000 --- a/shells/zsh/lib/history-substring-search/zsh-history-substring-search.zsh +++ /dev/null @@ -1,554 +0,0 @@ -#!/usr/bin/env zsh -############################################################################## -# -# Copyright (c) 2009 Peter Stephenson -# Copyright (c) 2011 Guido van Steen -# Copyright (c) 2011 Suraj N. Kurapati -# Copyright (c) 2011 Sorin Ionescu -# Copyright (c) 2011 Vincent Guerci -# 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 FIZSH 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 THE COPYRIGHT HOLDER OR CONTRIBUTORS 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. -# -############################################################################## - -#----------------------------------------------------------------------------- -# configuration variables -#----------------------------------------------------------------------------- - -HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND='bg=magenta,fg=white,bold' -HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND='bg=red,fg=white,bold' -HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS='i' - -#----------------------------------------------------------------------------- -# the main ZLE widgets -#----------------------------------------------------------------------------- - -function history-substring-search-up() { - _history-substring-search-begin - - _history-substring-search-up-history || - _history-substring-search-up-buffer || - _history-substring-search-up-search - - _history-substring-search-end -} - -function history-substring-search-down() { - _history-substring-search-begin - - _history-substring-search-down-history || - _history-substring-search-down-buffer || - _history-substring-search-down-search - - _history-substring-search-end -} - -zle -N history-substring-search-up -zle -N history-substring-search-down - -bindkey '\e[A' history-substring-search-up -bindkey '\e[B' history-substring-search-down - -#----------------------------------------------------------------------------- -# implementation details -#----------------------------------------------------------------------------- - -zmodload -F zsh/parameter - -# -# We have to "override" some keys and widgets if the -# zsh-syntax-highlighting plugin has not been loaded: -# -# https://github.com/nicoulaj/zsh-syntax-highlighting -# -if [[ $+functions[_zsh_highlight] -eq 0 ]]; then - # - # Dummy implementation of _zsh_highlight() - # that simply removes existing highlights - # - function _zsh_highlight() { - region_highlight=() - } - - # - # Remove existing highlights when the user - # inserts printable characters into $BUFFER - # - function ordinary-key-press() { - if [[ $KEYS == [[:print:]] ]]; then - region_highlight=() - fi - zle .self-insert - } - zle -N self-insert ordinary-key-press - - # - # Override ZLE widgets to invoke _zsh_highlight() - # - # https://github.com/nicoulaj/zsh-syntax-highlighting/blob/ - # bb7fcb79fad797a40077bebaf6f4e4a93c9d8163/zsh-syntax-highlighting.zsh#L121 - # - #--------------8<-------------------8<-------------------8<----------------- - # - # Copyright (c) 2010-2011 zsh-syntax-highlighting contributors - # 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 zsh-syntax-highlighting contributors 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 THE COPYRIGHT HOLDER OR - # CONTRIBUTORS 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. - - # Load ZSH module zsh/zleparameter, needed to override user defined widgets. - zmodload zsh/zleparameter 2>/dev/null || { - echo 'zsh-syntax-highlighting: failed loading zsh/zleparameter, exiting.' >&2 - return -1 - } - - # Override ZLE widgets to make them invoke _zsh_highlight. - for event in ${${(f)"$(zle -la)"}:#(_*|orig-*|.run-help|.which-command)}; do - if [[ "$widgets[$event]" == completion:* ]]; then - eval "zle -C orig-$event ${${${widgets[$event]}#*:}/:/ } ; $event() { builtin zle orig-$event && _zsh_highlight } ; zle -N $event" - else - case $event in - accept-and-menu-complete) - eval "$event() { builtin zle .$event && _zsh_highlight } ; zle -N $event" - ;; - - # The following widgets should NOT remove any previously - # applied highlighting. Therefore we do not remap them. - .forward-char|.backward-char|.up-line-or-history|.down-line-or-history) - ;; - - .*) - clean_event=$event[2,${#event}] # Remove the leading dot in the event name - case ${widgets[$clean_event]-} in - (completion|user):*) - ;; - *) - eval "$clean_event() { builtin zle $event && _zsh_highlight } ; zle -N $clean_event" - ;; - esac - ;; - *) - ;; - esac - fi - done - unset event clean_event - #-------------->8------------------->8------------------->8----------------- -fi - -function _history-substring-search-begin() { - setopt localoptions extendedglob - - _history_substring_search_move_cursor_eol=false - _history_substring_search_query_highlight= - - # - # Continue using the previous $_history_substring_search_result by default, - # unless the current query was cleared or a new/different query was entered. - # - if [[ -z $BUFFER || $BUFFER != $_history_substring_search_result ]]; then - # - # For the purpose of highlighting we will also keep - # a version without doubly-escaped meta characters. - # - _history_substring_search_query=$BUFFER - - # - # $BUFFER contains the text that is in the command-line currently. - # we put an extra "\\" before meta characters such as "\(" and "\)", - # so that they become "\\\(" and "\\\)". - # - _history_substring_search_query_escaped=${BUFFER//(#m)[\][()|\\*?#<>~^]/\\$MATCH} - - # - # Find all occurrences of the search query in the history file. - # - # (k) turns it an array of line numbers. - # - # (on) seems to remove duplicates, which are default - # options. They can be turned off by (ON). - # - _history_substring_search_matches=(${(kon)history[(R)(#$HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS)*${_history_substring_search_query_escaped}*]}) - - # - # Define the range of values that $_history_substring_search_match_index - # can take: [0, $_history_substring_search_matches_count_plus]. - # - _history_substring_search_matches_count=$#_history_substring_search_matches - _history_substring_search_matches_count_plus=$(( _history_substring_search_matches_count + 1 )) - _history_substring_search_matches_count_sans=$(( _history_substring_search_matches_count - 1 )) - - # - # If $_history_substring_search_match_index is equal to - # $_history_substring_search_matches_count_plus, this indicates that we - # are beyond the beginning of $_history_substring_search_matches. - # - # If $_history_substring_search_match_index is equal to 0, this indicates - # that we are beyond the end of $_history_substring_search_matches. - # - # If we have initially pressed "up" we have to initialize - # $_history_substring_search_match_index to - # $_history_substring_search_matches_count_plus so that it will be - # decreased to $_history_substring_search_matches_count. - # - # If we have initially pressed "down" we have to initialize - # $_history_substring_search_match_index to - # $_history_substring_search_matches_count so that it will be increased to - # $_history_substring_search_matches_count_plus. - # - if [[ $WIDGET == history-substring-search-down ]]; then - _history_substring_search_match_index=$_history_substring_search_matches_count - else - _history_substring_search_match_index=$_history_substring_search_matches_count_plus - fi - fi -} - -function _history-substring-search-end() { - setopt localoptions extendedglob - - _history_substring_search_result=$BUFFER - - # move the cursor to the end of the command line - if [[ $_history_substring_search_move_cursor_eol == true ]]; then - CURSOR=${#BUFFER} - fi - - # highlight command line using zsh-syntax-highlighting - _zsh_highlight - - # highlight the search query inside the command line - if [[ -n $_history_substring_search_query_highlight && -n $_history_substring_search_query ]]; then - # - # The following expression yields a variable $MBEGIN, which - # indicates the begin position + 1 of the first occurrence - # of _history_substring_search_query_escaped in $BUFFER. - # - : ${(S)BUFFER##(#m$HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS)($_history_substring_search_query##)} - local begin=$(( MBEGIN - 1 )) - local end=$(( begin + $#_history_substring_search_query )) - region_highlight+=("$begin $end $_history_substring_search_query_highlight") - fi - - # For debugging purposes: - # zle -R "mn: "$_history_substring_search_match_index" m#: "${#_history_substring_search_matches} - # read -k -t 200 && zle -U $REPLY - - # Exit successfully from the history-substring-search-* widgets. - true -} - -function _history-substring-search-up-buffer() { - # - # Check if the UP arrow was pressed to move the cursor within a multi-line - # buffer. This amounts to three tests: - # - # 1. $#buflines -gt 1. - # - # 2. $CURSOR -ne $#BUFFER. - # - # 3. Check if we are on the first line of the current multi-line buffer. - # If so, pressing UP would amount to leaving the multi-line buffer. - # - # We check this by adding an extra "x" to $LBUFFER, which makes - # sure that xlbuflines is always equal to the number of lines - # until $CURSOR (including the line with the cursor on it). - # - local buflines XLBUFFER xlbuflines - buflines=(${(f)BUFFER}) - XLBUFFER=$LBUFFER"x" - xlbuflines=(${(f)XLBUFFER}) - - if [[ $#buflines -gt 1 && $CURSOR -ne $#BUFFER && $#xlbuflines -ne 1 ]]; then - zle up-line-or-history - return true - fi - - false -} - -function _history-substring-search-down-buffer() { - # - # Check if the DOWN arrow was pressed to move the cursor within a multi-line - # buffer. This amounts to three tests: - # - # 1. $#buflines -gt 1. - # - # 2. $CURSOR -ne $#BUFFER. - # - # 3. Check if we are on the last line of the current multi-line buffer. - # If so, pressing DOWN would amount to leaving the multi-line buffer. - # - # We check this by adding an extra "x" to $RBUFFER, which makes - # sure that xrbuflines is always equal to the number of lines - # from $CURSOR (including the line with the cursor on it). - # - local buflines XRBUFFER xrbuflines - buflines=(${(f)BUFFER}) - XRBUFFER="x"$RBUFFER - xrbuflines=(${(f)XRBUFFER}) - - if [[ $#buflines -gt 1 && $CURSOR -ne $#BUFFER && $#xrbuflines -ne 1 ]]; then - zle down-line-or-history - return true - fi - - false -} - -function _history-substring-search-up-history() { - # - # Behave like up in ZSH, except clear the $BUFFER - # when beginning of history is reached like in Fish. - # - if [[ -z $_history_substring_search_query ]]; then - - # we have reached the absolute top of history - if [[ $HISTNO -eq 1 ]]; then - BUFFER= - - # going up from somewhere below the top of history - else - zle up-line-or-history - fi - - return true - fi - - false -} - -function _history-substring-search-down-history() { - # - # Behave like down-history in ZSH, except clear the - # $BUFFER when end of history is reached like in Fish. - # - if [[ -z $_history_substring_search_query ]]; then - - # going down from the absolute top of history - if [[ $HISTNO -eq 1 && -z $BUFFER ]]; then - BUFFER=${history[1]} - _history_substring_search_move_cursor_eol=true - - # going down from somewhere above the bottom of history - else - zle down-line-or-history - fi - - return true - fi - - false -} - -function _history-substring-search-up-search() { - _history_substring_search_move_cursor_eol=true - - # - # Highlight matches during history-substring-up-search: - # - # The following constants have been initialized in - # _history-substring-search-up/down-search(): - # - # $_history_substring_search_matches is the current list of matches - # $_history_substring_search_matches_count is the current number of matches - # $_history_substring_search_matches_count_plus is the current number of matches + 1 - # $_history_substring_search_matches_count_sans is the current number of matches - 1 - # $_history_substring_search_match_index is the index of the current match - # - # The range of values that $_history_substring_search_match_index can take - # is: [0, $_history_substring_search_matches_count_plus]. A value of 0 - # indicates that we are beyond the end of - # $_history_substring_search_matches. A value of - # $_history_substring_search_matches_count_plus indicates that we are beyond - # the beginning of $_history_substring_search_matches. - # - # In _history-substring-search-up-search() the initial value of - # $_history_substring_search_match_index is - # $_history_substring_search_matches_count_plus. This value is set in - # _history-substring-search-begin(). _history-substring-search-up-search() - # will initially decrease it to $_history_substring_search_matches_count. - # - if [[ $_history_substring_search_match_index -ge 2 ]]; then - # - # Highlight the next match: - # - # 1. Decrease the value of $_history_substring_search_match_index. - # - # 2. Use $HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND - # to highlight the current buffer. - # - (( _history_substring_search_match_index-- )) - BUFFER=$history[$_history_substring_search_matches[$_history_substring_search_match_index]] - _history_substring_search_query_highlight=$HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND - - elif [[ $_history_substring_search_match_index -eq 1 ]]; then - # - # We will move beyond the end of $_history_substring_search_matches: - # - # 1. Decrease the value of $_history_substring_search_match_index. - # - # 2. Save the current buffer in $_history_substring_search_old_buffer, - # so that it can be retrieved by - # _history-substring-search-down-search() later. - # - # 3. Make $BUFFER equal to $_history_substring_search_query. - # - # 4. Use $HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND - # to highlight the current buffer. - # - (( _history_substring_search_match_index-- )) - _history_substring_search_old_buffer=$BUFFER - BUFFER=$_history_substring_search_query - _history_substring_search_query_highlight=$HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND - - elif [[ $_history_substring_search_match_index -eq $_history_substring_search_matches_count_plus ]]; then - # - # We were beyond the beginning of $_history_substring_search_matches but - # UP makes us move back to $_history_substring_search_matches: - # - # 1. Decrease the value of $_history_substring_search_match_index. - # - # 2. Restore $BUFFER from $_history_substring_search_old_buffer. - # - # 3. Use $HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND - # to highlight the current buffer. - # - (( _history_substring_search_match_index-- )) - BUFFER=$_history_substring_search_old_buffer - _history_substring_search_query_highlight=$HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND - fi -} - -function _history-substring-search-down-search() { - _history_substring_search_move_cursor_eol=true - - # - # Highlight matches during history-substring-up-search: - # - # The following constants have been initialized in - # _history-substring-search-up/down-search(): - # - # $_history_substring_search_matches is the current list of matches - # $_history_substring_search_matches_count is the current number of matches - # $_history_substring_search_matches_count_plus is the current number of matches + 1 - # $_history_substring_search_matches_count_sans is the current number of matches - 1 - # $_history_substring_search_match_index is the index of the current match - # - # The range of values that $_history_substring_search_match_index can take - # is: [0, $_history_substring_search_matches_count_plus]. A value of 0 - # indicates that we are beyond the end of - # $_history_substring_search_matches. A value of - # $_history_substring_search_matches_count_plus indicates that we are beyond - # the beginning of $_history_substring_search_matches. - # - # In _history-substring-search-down-search() the initial value of - # $_history_substring_search_match_index is - # $_history_substring_search_matches_count. This value is set in - # _history-substring-search-begin(). - # _history-substring-search-down-search() will initially increase it to - # $_history_substring_search_matches_count_plus. - # - if [[ $_history_substring_search_match_index -le $_history_substring_search_matches_count_sans ]]; then - # - # Highlight the next match: - # - # 1. Increase $_history_substring_search_match_index by 1. - # - # 2. Use $HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND - # to highlight the current buffer. - # - (( _history_substring_search_match_index++ )) - BUFFER=$history[$_history_substring_search_matches[$_history_substring_search_match_index]] - _history_substring_search_query_highlight=$HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND - - elif [[ $_history_substring_search_match_index -eq $_history_substring_search_matches_count ]]; then - # - # We will move beyond the beginning of $_history_substring_search_matches: - # - # 1. Increase $_history_substring_search_match_index by 1. - # - # 2. Save the current buffer in $_history_substring_search_old_buffer, so - # that it can be retrieved by _history-substring-search-up-search() - # later. - # - # 3. Make $BUFFER equal to $_history_substring_search_query. - # - # 4. Use $HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND - # to highlight the current buffer. - # - (( _history_substring_search_match_index++ )) - _history_substring_search_old_buffer=$BUFFER - BUFFER=$_history_substring_search_query - _history_substring_search_query_highlight=$HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND - - elif [[ $_history_substring_search_match_index -eq 0 ]]; then - # - # We were beyond the end of $_history_substring_search_matches but DOWN - # makes us move back to the $_history_substring_search_matches: - # - # 1. Increase $_history_substring_search_match_index by 1. - # - # 2. Restore $BUFFER from $_history_substring_search_old_buffer. - # - # 3. Use $HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND - # to highlight the current buffer. - # - (( _history_substring_search_match_index++ )) - BUFFER=$_history_substring_search_old_buffer - _history_substring_search_query_highlight=$HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND - fi -} - -# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- -# vim: ft=zsh sw=2 ts=2 et diff --git a/shells/zsh/lib/syntax-highlighting b/shells/zsh/lib/syntax-highlighting new file mode 160000 index 00000000..dbd27cb3 --- /dev/null +++ b/shells/zsh/lib/syntax-highlighting @@ -0,0 +1 @@ +Subproject commit dbd27cb30a710809dd070669c331574fdc15b397 diff --git a/shells/zsh/lib/syntax-highlighting/.gitignore b/shells/zsh/lib/syntax-highlighting/.gitignore deleted file mode 100644 index 13b92153..00000000 --- a/shells/zsh/lib/syntax-highlighting/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.zwc* diff --git a/shells/zsh/lib/syntax-highlighting/COPYING.md b/shells/zsh/lib/syntax-highlighting/COPYING.md deleted file mode 100644 index 2aa64389..00000000 --- a/shells/zsh/lib/syntax-highlighting/COPYING.md +++ /dev/null @@ -1,23 +0,0 @@ -Copyright (c) 2010-2011 zsh-syntax-highlighting contributors -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 zsh-syntax-highlighting contributors 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 THE COPYRIGHT HOLDER OR -CONTRIBUTORS 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. diff --git a/shells/zsh/lib/syntax-highlighting/README.md b/shells/zsh/lib/syntax-highlighting/README.md deleted file mode 100644 index 233870cb..00000000 --- a/shells/zsh/lib/syntax-highlighting/README.md +++ /dev/null @@ -1,47 +0,0 @@ -zsh-syntax-highlighting -======================= - -**[Fish shell](http://www.fishshell.com) like syntax highlighting for [Zsh](http://www.zsh.org).** - -*Requirements: zsh 4.3.9+.* - - -How to install --------------- - -### In your ~/.zshrc - -* Download the script or clone this repository: - - git clone git://github.com/zsh-users/zsh-syntax-highlighting.git - -* Source the script **at the end** of `~/.zshrc`: - - source /path/to/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh - -* Source `~/.zshrc` to take changes into account: - - source ~/.zshrc - - -### With oh-my-zsh - -* Download the script or clone this repository in [oh-my-zsh](http://github.com/robbyrussell/oh-my-zsh) plugins directory: - - cd ~/.oh-my-zsh/plugins/ - git clone git://github.com/zsh-users/zsh-syntax-highlighting.git - -* Activate the plugin in `~/.zshrc` (in **last** position): - - plugins=( [plugins...] zsh-syntax-highlighting) - -* Source `~/.zshrc` to take changes into account: - - source ~/.zshrc - - -How to tweak ------------- - -Syntax highlighting is done by pluggable highlighter scripts, see the [highlighters directory](zsh-syntax-highlighting/tree/master/highlighters) -for documentation and configuration settings. diff --git a/shells/zsh/lib/syntax-highlighting/highlighters/README.md b/shells/zsh/lib/syntax-highlighting/highlighters/README.md deleted file mode 100644 index 1b075649..00000000 --- a/shells/zsh/lib/syntax-highlighting/highlighters/README.md +++ /dev/null @@ -1,49 +0,0 @@ -zsh-syntax-highlighting / highlighters -====================================== - -Syntax highlighting is done by pluggable highlighters: - -* [***main***](highlighters/main) - the base highlighter, and the only one active by default. -* [***brackets***](highlighters/brackets) - matches brackets and parenthesis. -* [***pattern***](highlighters/pattern) - matches user-defined patterns. -* [***cursor***](highlighters/cursor) - matches the cursor position. -* [***root***](highlighters/root) - triggered if the current user is root. - - -How to activate highlighters ----------------------------- - -To activate an highlighter, add it to the `ZSH_HIGHLIGHT_HIGHLIGHTERS` array in `~/.zshrc`, for example: - - ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern cursor) - - -How to tweak highlighters -------------------------- - -Highlighters look up styles from the `ZSH_HIGHLIGHT_STYLES` array. Navigate into each highlighter directory to see what styles it defines and how to configure it. - - -How to implement a new highlighter ----------------------------------- - -To create your own ***myhighlighter*** highlighter: - -* Create your script at **highlighters/*myhighlighter*/*myhighlighter*-highlighter.zsh**. -* Implement the `_zsh_highlight_myhighlighter_highlighter_predicate` function. This function must return 0 when the highlighter needs to be called, for example: - - _zsh_highlight_myhighlighter_highlighter_predicate() { - # Call this highlighter in SVN repositories - [[ -d .svn ]] - } - -* Implement the `_zsh_highlight_myhighlighter_highlighter` function. This function does the actual syntax highlighting, by modifying `region_highlight`, for example: - - _zsh_highlight_myhighlighter_highlighter() { - # Colorize the whole buffer with blue background - region_highlight+=(0 $#BUFFER bg=blue) - } - -* Activate your highlighter in `~/.zshrc`: - - ZSH_HIGHLIGHT_HIGHLIGHTERS+=(myhighlighter) diff --git a/shells/zsh/lib/syntax-highlighting/highlighters/brackets/README.md b/shells/zsh/lib/syntax-highlighting/highlighters/brackets/README.md deleted file mode 100644 index 9fd4f96f..00000000 --- a/shells/zsh/lib/syntax-highlighting/highlighters/brackets/README.md +++ /dev/null @@ -1,30 +0,0 @@ -zsh-syntax-highlighting / highlighters / brackets -================================================= - -This is the ***brackets*** highlighter, that highlights brackets, parenthesis and matches them. - - -How to activate it ------------------- -To activate it, add it to `ZSH_HIGHLIGHT_HIGHLIGHTERS`: - - ZSH_HIGHLIGHT_HIGHLIGHTERS=( [...] brackets) - - -How to tweak it ---------------- -This highlighter defines the following styles: - -* `bracket-error` - unmatched brackets -* `bracket-level-N` - brackets with nest level N -* `cursor-matchingbracket` - the matching bracket, if cursor is on a bracket - -To override one of those styles, change its entry in `ZSH_HIGHLIGHT_STYLES`, for example in `~/.zshrc`: - - # To define styles for nested brackets up to level 4 - ZSH_HIGHLIGHT_STYLES[bracket-level-1]='fg=blue,bold' - ZSH_HIGHLIGHT_STYLES[bracket-level-2]='fg=red,bold' - ZSH_HIGHLIGHT_STYLES[bracket-level-3]='fg=yellow,bold' - ZSH_HIGHLIGHT_STYLES[bracket-level-4]='fg=magenta,bold' - -The syntax for declaring styles is [documented here](http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#SEC135). diff --git a/shells/zsh/lib/syntax-highlighting/highlighters/brackets/brackets-highlighter.zsh b/shells/zsh/lib/syntax-highlighting/highlighters/brackets/brackets-highlighter.zsh deleted file mode 100644 index 5166122d..00000000 --- a/shells/zsh/lib/syntax-highlighting/highlighters/brackets/brackets-highlighter.zsh +++ /dev/null @@ -1,110 +0,0 @@ -#!/usr/bin/env zsh -# ------------------------------------------------------------------------------------------------- -# Copyright (c) 2010-2011 zsh-syntax-highlighting contributors -# 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 zsh-syntax-highlighting contributors 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 THE COPYRIGHT HOLDER OR -# CONTRIBUTORS 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. -# ------------------------------------------------------------------------------------------------- -# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- -# vim: ft=zsh sw=2 ts=2 et -# ------------------------------------------------------------------------------------------------- - - -# Define default styles. -: ${ZSH_HIGHLIGHT_STYLES[bracket-error]:=fg=red,bold} -: ${ZSH_HIGHLIGHT_STYLES[bracket-level-1]:=fg=blue,bold} -: ${ZSH_HIGHLIGHT_STYLES[bracket-level-2]:=fg=green,bold} -: ${ZSH_HIGHLIGHT_STYLES[bracket-level-3]:=fg=magenta,bold} -: ${ZSH_HIGHLIGHT_STYLES[bracket-level-4]:=fg=yellow,bold} -: ${ZSH_HIGHLIGHT_STYLES[bracket-level-5]:=fg=cyan,bold} -: ${ZSH_HIGHLIGHT_STYLES[cursor-matchingbracket]:=standout} - -# Whether the brackets highlighter should be called or not. -_zsh_highlight_brackets_highlighter_predicate() -{ - _zsh_highlight_cursor_moved || _zsh_highlight_buffer_modified -} - -# Brackets highlighting function. -_zsh_highlight_brackets_highlighter() -{ - local level=0 pos - local -A levelpos lastoflevel matching typepos - - # Find all brackets and remember which one is matching - for (( pos = 0; $pos < ${#BUFFER}; pos++ )) ; do - local char=$BUFFER[pos+1] - case $char in - ["([{"]) - levelpos[$pos]=$((++level)) - lastoflevel[$level]=$pos - _zsh_highlight_brackets_highlighter_brackettype $char - ;; - [")]}"]) - matching[$lastoflevel[$level]]=$pos - matching[$pos]=$lastoflevel[$level] - levelpos[$pos]=$((level--)) - _zsh_highlight_brackets_highlighter_brackettype $char - ;; - ['"'\']) - # Skip everything inside quotes - local quotetype=$char - while (( $pos < ${#BUFFER} )) ; do - (( pos++ )) - [[ $BUFFER[$pos+1] == $quotetype ]] && break - done - ;; - esac - done - - # Now highlight all found brackets - for pos in ${(k)levelpos}; do - if [[ -n $matching[$pos] ]] && [[ $typepos[$pos] == $typepos[$matching[$pos]] ]]; then - local bracket_color_size=${#ZSH_HIGHLIGHT_STYLES[(I)bracket-level-*]} - local bracket_color_level=bracket-level-$(( (levelpos[$pos] - 1) % bracket_color_size + 1 )) - local style=$ZSH_HIGHLIGHT_STYLES[$bracket_color_level] - region_highlight+=("$pos $((pos + 1)) $style") - else - local style=$ZSH_HIGHLIGHT_STYLES[bracket-error] - region_highlight+=("$pos $((pos + 1)) $style") - fi - done - - # If cursor is on a bracket, then highlight corresponding bracket, if any - pos=$CURSOR - if [[ -n $levelpos[$pos] ]] && [[ -n $matching[$pos] ]]; then - local otherpos=$matching[$pos] - local style=$ZSH_HIGHLIGHT_STYLES[cursor-matchingbracket] - region_highlight+=("$otherpos $((otherpos + 1)) $style") - fi -} - -# Helper function to differentiate type -_zsh_highlight_brackets_highlighter_brackettype() -{ - case $1 in - ["()"]) typepos[$pos]=round;; - ["[]"]) typepos[$pos]=bracket;; - ["{}"]) typepos[$pos]=curly;; - *) ;; - esac -} diff --git a/shells/zsh/lib/syntax-highlighting/highlighters/brackets/test-data/mismatch-patentheses.zsh b/shells/zsh/lib/syntax-highlighting/highlighters/brackets/test-data/mismatch-patentheses.zsh deleted file mode 100644 index ad72f758..00000000 --- a/shells/zsh/lib/syntax-highlighting/highlighters/brackets/test-data/mismatch-patentheses.zsh +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env zsh -# ------------------------------------------------------------------------------------------------- -# Copyright (c) 2010-2011 zsh-syntax-highlighting contributors -# 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 zsh-syntax-highlighting contributors 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 THE COPYRIGHT HOLDER OR -# CONTRIBUTORS 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. -# ------------------------------------------------------------------------------------------------- -# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- -# vim: ft=zsh sw=2 ts=2 et -# ------------------------------------------------------------------------------------------------- - -BUFFER='echo ({x}]' - -expected_region_highlight=( - "5 5 $ZSH_HIGHLIGHT_STYLES[bracket-error]" # ( - "6 6 $ZSH_HIGHLIGHT_STYLES[bracket-level-2]" # { - "8 8 $ZSH_HIGHLIGHT_STYLES[bracket-level-2]" # } - "9 9 $ZSH_HIGHLIGHT_STYLES[bracket-error]" # ) -) diff --git a/shells/zsh/lib/syntax-highlighting/highlighters/brackets/test-data/nested-parentheses.zsh b/shells/zsh/lib/syntax-highlighting/highlighters/brackets/test-data/nested-parentheses.zsh deleted file mode 100644 index 68683e59..00000000 --- a/shells/zsh/lib/syntax-highlighting/highlighters/brackets/test-data/nested-parentheses.zsh +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env zsh -# ------------------------------------------------------------------------------------------------- -# Copyright (c) 2010-2011 zsh-syntax-highlighting contributors -# 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 zsh-syntax-highlighting contributors 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 THE COPYRIGHT HOLDER OR -# CONTRIBUTORS 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. -# ------------------------------------------------------------------------------------------------- -# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- -# vim: ft=zsh sw=2 ts=2 et -# ------------------------------------------------------------------------------------------------- - -BUFFER='echo $(echo ${(z)array})' - -expected_region_highlight=( - "6 6 $ZSH_HIGHLIGHT_STYLES[bracket-level-1]" # ( - "13 13 $ZSH_HIGHLIGHT_STYLES[bracket-level-2]" # { - "14 14 $ZSH_HIGHLIGHT_STYLES[bracket-level-3]" # ( - "16 16 $ZSH_HIGHLIGHT_STYLES[bracket-level-3]" # ) - "22 22 $ZSH_HIGHLIGHT_STYLES[bracket-level-2]" # } - "23 23 $ZSH_HIGHLIGHT_STYLES[bracket-level-1]" # ) -) diff --git a/shells/zsh/lib/syntax-highlighting/highlighters/brackets/test-data/quoted-patentheses.zsh b/shells/zsh/lib/syntax-highlighting/highlighters/brackets/test-data/quoted-patentheses.zsh deleted file mode 100644 index 25890109..00000000 --- a/shells/zsh/lib/syntax-highlighting/highlighters/brackets/test-data/quoted-patentheses.zsh +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env zsh -# ------------------------------------------------------------------------------------------------- -# Copyright (c) 2010-2011 zsh-syntax-highlighting contributors -# 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 zsh-syntax-highlighting contributors 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 THE COPYRIGHT HOLDER OR -# CONTRIBUTORS 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. -# ------------------------------------------------------------------------------------------------- -# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- -# vim: ft=zsh sw=2 ts=2 et -# ------------------------------------------------------------------------------------------------- - -BUFFER='echo "foo ( bar"' - -expected_region_highlight=( -"1 15 $ZSH_HIGHLIGHT_STYLES[none]" # We expect the brackets highlighter to do nothing -) diff --git a/shells/zsh/lib/syntax-highlighting/highlighters/brackets/test-data/simple-parentheses.zsh b/shells/zsh/lib/syntax-highlighting/highlighters/brackets/test-data/simple-parentheses.zsh deleted file mode 100644 index cd9a7599..00000000 --- a/shells/zsh/lib/syntax-highlighting/highlighters/brackets/test-data/simple-parentheses.zsh +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env zsh -# ------------------------------------------------------------------------------------------------- -# Copyright (c) 2010-2011 zsh-syntax-highlighting contributors -# 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 zsh-syntax-highlighting contributors 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 THE COPYRIGHT HOLDER OR -# CONTRIBUTORS 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. -# ------------------------------------------------------------------------------------------------- -# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- -# vim: ft=zsh sw=2 ts=2 et -# ------------------------------------------------------------------------------------------------- - -BUFFER='echo ({x})' - -expected_region_highlight=( - "5 5 $ZSH_HIGHLIGHT_STYLES[bracket-level-1]" # ( - "6 6 $ZSH_HIGHLIGHT_STYLES[bracket-level-2]" # { - "8 8 $ZSH_HIGHLIGHT_STYLES[bracket-level-2]" # } - "9 9 $ZSH_HIGHLIGHT_STYLES[bracket-level-1]" # ) -) diff --git a/shells/zsh/lib/syntax-highlighting/highlighters/brackets/test-data/unclosed-patentheses.zsh b/shells/zsh/lib/syntax-highlighting/highlighters/brackets/test-data/unclosed-patentheses.zsh deleted file mode 100644 index 879c6186..00000000 --- a/shells/zsh/lib/syntax-highlighting/highlighters/brackets/test-data/unclosed-patentheses.zsh +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/env zsh -# ------------------------------------------------------------------------------------------------- -# Copyright (c) 2010-2011 zsh-syntax-highlighting contributors -# 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 zsh-syntax-highlighting contributors 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 THE COPYRIGHT HOLDER OR -# CONTRIBUTORS 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. -# ------------------------------------------------------------------------------------------------- -# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- -# vim: ft=zsh sw=2 ts=2 et -# ------------------------------------------------------------------------------------------------- - -BUFFER='echo ({x}' - -expected_region_highlight=( - "5 5 $ZSH_HIGHLIGHT_STYLES[bracket-error]" # ( - "6 6 $ZSH_HIGHLIGHT_STYLES[bracket-level-2]" # { - "8 8 $ZSH_HIGHLIGHT_STYLES[bracket-level-2]" # } -) diff --git a/shells/zsh/lib/syntax-highlighting/highlighters/brackets/test-data/unclosed-patentheses2.zsh b/shells/zsh/lib/syntax-highlighting/highlighters/brackets/test-data/unclosed-patentheses2.zsh deleted file mode 100644 index c6534eff..00000000 --- a/shells/zsh/lib/syntax-highlighting/highlighters/brackets/test-data/unclosed-patentheses2.zsh +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/env zsh -# ------------------------------------------------------------------------------------------------- -# Copyright (c) 2010-2011 zsh-syntax-highlighting contributors -# 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 zsh-syntax-highlighting contributors 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 THE COPYRIGHT HOLDER OR -# CONTRIBUTORS 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. -# ------------------------------------------------------------------------------------------------- -# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- -# vim: ft=zsh sw=2 ts=2 et -# ------------------------------------------------------------------------------------------------- - -BUFFER='echo {x})' - -expected_region_highlight=( - "5 5 $ZSH_HIGHLIGHT_STYLES[bracket-level-1]" # { - "7 7 $ZSH_HIGHLIGHT_STYLES[bracket-level-1]" # } - "8 8 $ZSH_HIGHLIGHT_STYLES[bracket-error]" # ) -) diff --git a/shells/zsh/lib/syntax-highlighting/highlighters/cursor/README.md b/shells/zsh/lib/syntax-highlighting/highlighters/cursor/README.md deleted file mode 100644 index d28ac190..00000000 --- a/shells/zsh/lib/syntax-highlighting/highlighters/cursor/README.md +++ /dev/null @@ -1,24 +0,0 @@ -zsh-syntax-highlighting / highlighters / cursor -================================================= - -This is the ***cursor*** highlighter, that highlights the cursor. - - -How to activate it ------------------- -To activate it, add it to `ZSH_HIGHLIGHT_HIGHLIGHTERS`: - - ZSH_HIGHLIGHT_HIGHLIGHTERS=( [...] cursor) - - -How to tweak it ---------------- -This highlighter defines the following styles: - -* `cursor` - the style for the current cursor position - -To override one of those styles, change its entry in `ZSH_HIGHLIGHT_STYLES`, for example in `~/.zshrc`: - - ZSH_HIGHLIGHT_STYLES[cursor]='bg=blue' - -The syntax for declaring styles is [documented here](http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#SEC135). diff --git a/shells/zsh/lib/syntax-highlighting/highlighters/cursor/cursor-highlighter.zsh b/shells/zsh/lib/syntax-highlighting/highlighters/cursor/cursor-highlighter.zsh deleted file mode 100644 index b5868a46..00000000 --- a/shells/zsh/lib/syntax-highlighting/highlighters/cursor/cursor-highlighter.zsh +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env zsh -# ------------------------------------------------------------------------------------------------- -# Copyright (c) 2010-2011 zsh-syntax-highlighting contributors -# 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 zsh-syntax-highlighting contributors 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 THE COPYRIGHT HOLDER OR -# CONTRIBUTORS 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. -# ------------------------------------------------------------------------------------------------- -# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- -# vim: ft=zsh sw=2 ts=2 et -# ------------------------------------------------------------------------------------------------- - - -# Define default styles. -: ${ZSH_HIGHLIGHT_STYLES[cursor]:=standout} - -# Whether the cursor highlighter should be called or not. -_zsh_highlight_cursor_highlighter_predicate() -{ - _zsh_highlight_cursor_moved -} - -# Cursor highlighting function. -_zsh_highlight_cursor_highlighter() -{ - region_highlight+=("$CURSOR $(( $CURSOR + 1 )) $ZSH_HIGHLIGHT_STYLES[cursor]") -} diff --git a/shells/zsh/lib/syntax-highlighting/highlighters/main/README.md b/shells/zsh/lib/syntax-highlighting/highlighters/main/README.md deleted file mode 100644 index 6900bfbf..00000000 --- a/shells/zsh/lib/syntax-highlighting/highlighters/main/README.md +++ /dev/null @@ -1,58 +0,0 @@ -zsh-syntax-highlighting / highlighters / main -============================================= - -This is the ***main*** highlighter, that highlights: - -* Commands -* Options -* Arguments -* Paths -* Strings - -How to activate it ------------------- -To activate it, add it to `ZSH_HIGHLIGHT_HIGHLIGHTERS`: - - ZSH_HIGHLIGHT_HIGHLIGHTERS=( [...] main) - -This highlighter is active by default. - - -How to tweak it ---------------- -This highlighter defines the following styles: - -* `unknown-token` - unknown tokens / errors -* `reserved-word` - shell reserved words -* `alias` - aliases -* `builtin` - shell builtin commands -* `function` - functions -* `command` - commands -* `precommand` - precommands (i.e. exec, builtin, ...) -* `commandseparator` - command separation tokens -* `hashed-command` - hashed commands -* `path` - paths -* `globbing` - globbing expressions -* `history-expansion` - history expansion expressions -* `single-hyphen-option` - single hyphen options -* `double-hyphen-option` - double hyphen options -* `back-quoted-argument` - backquoted expressions -* `single-quoted-argument` - single quoted arguments -* `double-quoted-argument` - double quoted arguments -* `dollar-double-quoted-argument` - dollar double quoted arguments -* `back-double-quoted-argument` - back double quoted arguments -* `assign` - variable assignments -* `default` - parts of the buffer that do not match anything - -To override one of those styles, change its entry in `ZSH_HIGHLIGHT_STYLES`, for example in `~/.zshrc`: - - # To differentiate aliases from other command types - ZSH_HIGHLIGHT_STYLES[alias]='fg=magenta,bold' - - # To have paths colored instead of underlined - ZSH_HIGHLIGHT_STYLES[path]='fg=cyan' - - # To disable highlighting of globbing expressions - ZSH_HIGHLIGHT_STYLES[globbing]='none' - -The syntax for declaring styles is [documented here](http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#SEC135). diff --git a/shells/zsh/lib/syntax-highlighting/highlighters/main/main-highlighter.zsh b/shells/zsh/lib/syntax-highlighting/highlighters/main/main-highlighter.zsh deleted file mode 100755 index 7aede14d..00000000 --- a/shells/zsh/lib/syntax-highlighting/highlighters/main/main-highlighter.zsh +++ /dev/null @@ -1,184 +0,0 @@ -#!/usr/bin/env zsh -# ------------------------------------------------------------------------------------------------- -# Copyright (c) 2010-2011 zsh-syntax-highlighting contributors -# 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 zsh-syntax-highlighting contributors 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 THE COPYRIGHT HOLDER OR -# CONTRIBUTORS 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. -# ------------------------------------------------------------------------------------------------- -# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- -# vim: ft=zsh sw=2 ts=2 et -# ------------------------------------------------------------------------------------------------- - - -# Define default styles. -: ${ZSH_HIGHLIGHT_STYLES[default]:=none} -: ${ZSH_HIGHLIGHT_STYLES[unknown-token]:=fg=red,bold} -: ${ZSH_HIGHLIGHT_STYLES[reserved-word]:=fg=yellow} -: ${ZSH_HIGHLIGHT_STYLES[alias]:=fg=green} -: ${ZSH_HIGHLIGHT_STYLES[builtin]:=fg=green} -: ${ZSH_HIGHLIGHT_STYLES[function]:=fg=green} -: ${ZSH_HIGHLIGHT_STYLES[command]:=fg=green} -: ${ZSH_HIGHLIGHT_STYLES[precommand]:=fg=green,underline} -: ${ZSH_HIGHLIGHT_STYLES[commandseparator]:=none} -: ${ZSH_HIGHLIGHT_STYLES[hashed-command]:=fg=green} -: ${ZSH_HIGHLIGHT_STYLES[path]:=underline} -: ${ZSH_HIGHLIGHT_STYLES[globbing]:=fg=blue} -: ${ZSH_HIGHLIGHT_STYLES[history-expansion]:=fg=blue} -: ${ZSH_HIGHLIGHT_STYLES[single-hyphen-option]:=none} -: ${ZSH_HIGHLIGHT_STYLES[double-hyphen-option]:=none} -: ${ZSH_HIGHLIGHT_STYLES[back-quoted-argument]:=none} -: ${ZSH_HIGHLIGHT_STYLES[single-quoted-argument]:=fg=yellow} -: ${ZSH_HIGHLIGHT_STYLES[double-quoted-argument]:=fg=yellow} -: ${ZSH_HIGHLIGHT_STYLES[dollar-double-quoted-argument]:=fg=cyan} -: ${ZSH_HIGHLIGHT_STYLES[back-double-quoted-argument]:=fg=cyan} -: ${ZSH_HIGHLIGHT_STYLES[assign]:=none} - -# Whether the highlighter should be called or not. -_zsh_highlight_main_highlighter_predicate() -{ - _zsh_highlight_buffer_modified -} - -# Main syntax highlighting function. -_zsh_highlight_main_highlighter() -{ - setopt localoptions extendedglob bareglobqual - local start_pos=0 end_pos highlight_glob=true new_expression=true arg style - typeset -a ZSH_HIGHLIGHT_TOKENS_COMMANDSEPARATOR - typeset -a ZSH_HIGHLIGHT_TOKENS_PRECOMMANDS - typeset -a ZSH_HIGHLIGHT_TOKENS_FOLLOWED_BY_COMMANDS - region_highlight=() - - ZSH_HIGHLIGHT_TOKENS_COMMANDSEPARATOR=( - '|' '||' ';' '&' '&&' - ) - ZSH_HIGHLIGHT_TOKENS_PRECOMMANDS=( - 'builtin' 'command' 'exec' 'nocorrect' 'noglob' - ) - # Tokens that are always immediately followed by a command. - ZSH_HIGHLIGHT_TOKENS_FOLLOWED_BY_COMMANDS=( - $ZSH_HIGHLIGHT_TOKENS_COMMANDSEPARATOR $ZSH_HIGHLIGHT_TOKENS_PRECOMMANDS - ) - - for arg in ${(z)BUFFER}; do - local substr_color=0 - [[ $start_pos -eq 0 && $arg = 'noglob' ]] && highlight_glob=false - ((start_pos+=${#BUFFER[$start_pos+1,-1]}-${#${BUFFER[$start_pos+1,-1]##[[:space:]]#}})) - ((end_pos=$start_pos+${#arg})) - if $new_expression; then - new_expression=false - if [[ -n ${(M)ZSH_HIGHLIGHT_TOKENS_PRECOMMANDS:#"$arg"} ]]; then - style=$ZSH_HIGHLIGHT_STYLES[precommand] - else - res=$(LC_ALL=C builtin type -w $arg 2>/dev/null) - case $res in - *': reserved') style=$ZSH_HIGHLIGHT_STYLES[reserved-word];; - *': alias') style=$ZSH_HIGHLIGHT_STYLES[alias] - local aliased_command="${"$(alias $arg)"#*=}" - [[ -n ${(M)ZSH_HIGHLIGHT_TOKENS_FOLLOWED_BY_COMMANDS:#"$aliased_command"} && -z ${(M)ZSH_HIGHLIGHT_TOKENS_FOLLOWED_BY_COMMANDS:#"$arg"} ]] && ZSH_HIGHLIGHT_TOKENS_FOLLOWED_BY_COMMANDS+=($arg) - ;; - *': builtin') style=$ZSH_HIGHLIGHT_STYLES[builtin];; - *': function') style=$ZSH_HIGHLIGHT_STYLES[function];; - *': command') style=$ZSH_HIGHLIGHT_STYLES[command];; - *': hashed') style=$ZSH_HIGHLIGHT_STYLES[hashed-command];; - *) if _zsh_highlight_main_highlighter_check_assign; then - style=$ZSH_HIGHLIGHT_STYLES[assign] - new_expression=true - elif _zsh_highlight_main_highlighter_check_path; then - style=$ZSH_HIGHLIGHT_STYLES[path] - elif [[ $arg[0,1] = $histchars[0,1] ]]; then - style=$ZSH_HIGHLIGHT_STYLES[history-expansion] - else - style=$ZSH_HIGHLIGHT_STYLES[unknown-token] - fi - ;; - esac - fi - else - case $arg in - '--'*) style=$ZSH_HIGHLIGHT_STYLES[double-hyphen-option];; - '-'*) style=$ZSH_HIGHLIGHT_STYLES[single-hyphen-option];; - "'"*"'") style=$ZSH_HIGHLIGHT_STYLES[single-quoted-argument];; - '"'*'"') style=$ZSH_HIGHLIGHT_STYLES[double-quoted-argument] - region_highlight+=("$start_pos $end_pos $style") - _zsh_highlight_main_highlighter_highlight_string - substr_color=1 - ;; - '`'*'`') style=$ZSH_HIGHLIGHT_STYLES[back-quoted-argument];; - *"*"*) $highlight_glob && style=$ZSH_HIGHLIGHT_STYLES[globbing] || style=$ZSH_HIGHLIGHT_STYLES[default];; - *) if _zsh_highlight_main_highlighter_check_path; then - style=$ZSH_HIGHLIGHT_STYLES[path] - elif [[ $arg[0,1] = $histchars[0,1] ]]; then - style=$ZSH_HIGHLIGHT_STYLES[history-expansion] - elif [[ -n ${(M)ZSH_HIGHLIGHT_TOKENS_COMMANDSEPARATOR:#"$arg"} ]]; then - style=$ZSH_HIGHLIGHT_STYLES[commandseparator] - else - style=$ZSH_HIGHLIGHT_STYLES[default] - fi - ;; - esac - fi - [[ $substr_color = 0 ]] && region_highlight+=("$start_pos $end_pos $style") - [[ -n ${(M)ZSH_HIGHLIGHT_TOKENS_FOLLOWED_BY_COMMANDS:#"$arg"} ]] && new_expression=true - start_pos=$end_pos - done -} - -# Check if the argument is variable assignment -_zsh_highlight_main_highlighter_check_assign() -{ - setopt localoptions extended_glob - [[ ${(Q)arg} == [[:alpha:]_]([[:alnum:]_])#=* ]] -} - -# Check if the argument is a path. -_zsh_highlight_main_highlighter_check_path() -{ - setopt localoptions nonomatch - local expanded_path; : ${expanded_path:=${(Q)~arg}} - [[ -z $expanded_path ]] && return 1 - [[ -e $expanded_path ]] && return 0 - [[ ! -e ${expanded_path:h} ]] && return 1 - [[ ${BUFFER[1]} != "-" && ${#BUFFER} == $end_pos && -n $(print ${expanded_path}*(N)) ]] && return 0 - return 1 -} - -# Highlight special chars inside double-quoted strings -_zsh_highlight_main_highlighter_highlight_string() -{ - setopt localoptions noksharrays - local i j k style - # Starting quote is at 1, so start parsing at offset 2 in the string. - for (( i = 2 ; i < end_pos - start_pos ; i += 1 )) ; do - (( j = i + start_pos - 1 )) - (( k = j + 1 )) - case "$arg[$i]" in - '$') style=$ZSH_HIGHLIGHT_STYLES[dollar-double-quoted-argument];; - "\\") style=$ZSH_HIGHLIGHT_STYLES[back-double-quoted-argument] - (( k += 1 )) # Color following char too. - (( i += 1 )) # Skip parsing the escaped char. - ;; - *) continue;; - esac - region_highlight+=("$j $k $style") - done -} diff --git a/shells/zsh/lib/syntax-highlighting/highlighters/main/test-data/assign.zsh b/shells/zsh/lib/syntax-highlighting/highlighters/main/test-data/assign.zsh deleted file mode 100644 index 0401bf4d..00000000 --- a/shells/zsh/lib/syntax-highlighting/highlighters/main/test-data/assign.zsh +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env zsh -# ------------------------------------------------------------------------------------------------- -# Copyright (c) 2010-2011 zsh-syntax-highlighting contributors -# 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 zsh-syntax-highlighting contributors 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 THE COPYRIGHT HOLDER OR -# CONTRIBUTORS 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. -# ------------------------------------------------------------------------------------------------- -# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- -# vim: ft=zsh sw=2 ts=2 et -# ------------------------------------------------------------------------------------------------- - -BUFFER='A=1' - -expected_region_highlight=( - "1 3 $ZSH_HIGHLIGHT_STYLES[assign]" # A=1 -) diff --git a/shells/zsh/lib/syntax-highlighting/highlighters/main/test-data/multiple-redirections.zsh b/shells/zsh/lib/syntax-highlighting/highlighters/main/test-data/multiple-redirections.zsh deleted file mode 100644 index ac0606c9..00000000 --- a/shells/zsh/lib/syntax-highlighting/highlighters/main/test-data/multiple-redirections.zsh +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/env zsh -# ------------------------------------------------------------------------------------------------- -# Copyright (c) 2010-2011 zsh-syntax-highlighting contributors -# 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 zsh-syntax-highlighting contributors 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 THE COPYRIGHT HOLDER OR -# CONTRIBUTORS 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. -# ------------------------------------------------------------------------------------------------- -# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- -# vim: ft=zsh sw=2 ts=2 et -# ------------------------------------------------------------------------------------------------- - -BUFFER='ps aux | grep java | sort | uniq | tail | head' - -expected_region_highlight=( - "1 2 $ZSH_HIGHLIGHT_STYLES[command]" # ps - "4 6 $ZSH_HIGHLIGHT_STYLES[default]" # aux - "8 8 $ZSH_HIGHLIGHT_STYLES[default]" # | - "10 13 $ZSH_HIGHLIGHT_STYLES[command]" # grep - "15 18 $ZSH_HIGHLIGHT_STYLES[default]" # java - "20 20 $ZSH_HIGHLIGHT_STYLES[default]" # | - "22 25 $ZSH_HIGHLIGHT_STYLES[command]" # sort - "27 27 $ZSH_HIGHLIGHT_STYLES[default]" # | - "29 32 $ZSH_HIGHLIGHT_STYLES[command]" # uniq - "34 34 $ZSH_HIGHLIGHT_STYLES[default]" # | - "36 39 $ZSH_HIGHLIGHT_STYLES[command]" # tail - "41 41 $ZSH_HIGHLIGHT_STYLES[default]" # | - "43 46 $ZSH_HIGHLIGHT_STYLES[command]" # head -) diff --git a/shells/zsh/lib/syntax-highlighting/highlighters/main/test-data/path-space- .zsh b/shells/zsh/lib/syntax-highlighting/highlighters/main/test-data/path-space- .zsh deleted file mode 100644 index 91c38331..00000000 --- a/shells/zsh/lib/syntax-highlighting/highlighters/main/test-data/path-space- .zsh +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/env zsh -# ------------------------------------------------------------------------------------------------- -# Copyright (c) 2010-2011 zsh-syntax-highlighting contributors -# 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 zsh-syntax-highlighting contributors 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 THE COPYRIGHT HOLDER OR -# CONTRIBUTORS 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. -# ------------------------------------------------------------------------------------------------- -# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- -# vim: ft=zsh sw=2 ts=2 et -# ------------------------------------------------------------------------------------------------- - -BUFFER='ls highlighters/main/test-data/path-space-\ .zsh' - -expected_region_highlight=( - "1 2 $ZSH_HIGHLIGHT_STYLES[command]" # ls - "4 48 $ZSH_HIGHLIGHT_STYLES[path]" # highlighters/main/test-data/path-space-\ .zsh -) diff --git a/shells/zsh/lib/syntax-highlighting/highlighters/main/test-data/path-tilde-home.zsh b/shells/zsh/lib/syntax-highlighting/highlighters/main/test-data/path-tilde-home.zsh deleted file mode 100644 index 14f8e183..00000000 --- a/shells/zsh/lib/syntax-highlighting/highlighters/main/test-data/path-tilde-home.zsh +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/env zsh -# ------------------------------------------------------------------------------------------------- -# Copyright (c) 2010-2011 zsh-syntax-highlighting contributors -# 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 zsh-syntax-highlighting contributors 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 THE COPYRIGHT HOLDER OR -# CONTRIBUTORS 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. -# ------------------------------------------------------------------------------------------------- -# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- -# vim: ft=zsh sw=2 ts=2 et -# ------------------------------------------------------------------------------------------------- - -BUFFER='ls ~' - -expected_region_highlight=( - "1 2 $ZSH_HIGHLIGHT_STYLES[command]" # ls - "4 4 $ZSH_HIGHLIGHT_STYLES[path]" # ~ -) diff --git a/shells/zsh/lib/syntax-highlighting/highlighters/main/test-data/path-tilde-named.zsh b/shells/zsh/lib/syntax-highlighting/highlighters/main/test-data/path-tilde-named.zsh deleted file mode 100644 index 38b2bb57..00000000 --- a/shells/zsh/lib/syntax-highlighting/highlighters/main/test-data/path-tilde-named.zsh +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env zsh -# ------------------------------------------------------------------------------------------------- -# Copyright (c) 2010-2011 zsh-syntax-highlighting contributors -# 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 zsh-syntax-highlighting contributors 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 THE COPYRIGHT HOLDER OR -# CONTRIBUTORS 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. -# ------------------------------------------------------------------------------------------------- -# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- -# vim: ft=zsh sw=2 ts=2 et -# ------------------------------------------------------------------------------------------------- - -hash -d D=highlighters/main/test-data - -BUFFER='ls ~D/path-tilde-named.zsh' - -expected_region_highlight=( - "1 2 $ZSH_HIGHLIGHT_STYLES[command]" # ls - "4 23 $ZSH_HIGHLIGHT_STYLES[path]" # ~D/path-tilde-named.zsh -) diff --git a/shells/zsh/lib/syntax-highlighting/highlighters/main/test-data/path.zsh b/shells/zsh/lib/syntax-highlighting/highlighters/main/test-data/path.zsh deleted file mode 100644 index 52e3af14..00000000 --- a/shells/zsh/lib/syntax-highlighting/highlighters/main/test-data/path.zsh +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/env zsh -# ------------------------------------------------------------------------------------------------- -# Copyright (c) 2010-2011 zsh-syntax-highlighting contributors -# 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 zsh-syntax-highlighting contributors 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 THE COPYRIGHT HOLDER OR -# CONTRIBUTORS 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. -# ------------------------------------------------------------------------------------------------- -# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- -# vim: ft=zsh sw=2 ts=2 et -# ------------------------------------------------------------------------------------------------- - -BUFFER='ls highlighters/main/test-data/path.zsh' - -expected_region_highlight=( - "1 2 $ZSH_HIGHLIGHT_STYLES[command]" # ls - "4 39 $ZSH_HIGHLIGHT_STYLES[path]" # highlighters/main/test-data/path.zsh -) diff --git a/shells/zsh/lib/syntax-highlighting/highlighters/main/test-data/simple-command.zsh b/shells/zsh/lib/syntax-highlighting/highlighters/main/test-data/simple-command.zsh deleted file mode 100644 index 4227c80e..00000000 --- a/shells/zsh/lib/syntax-highlighting/highlighters/main/test-data/simple-command.zsh +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env zsh -# ------------------------------------------------------------------------------------------------- -# Copyright (c) 2010-2011 zsh-syntax-highlighting contributors -# 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 zsh-syntax-highlighting contributors 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 THE COPYRIGHT HOLDER OR -# CONTRIBUTORS 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. -# ------------------------------------------------------------------------------------------------- -# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- -# vim: ft=zsh sw=2 ts=2 et -# ------------------------------------------------------------------------------------------------- - -BUFFER='ls' - -expected_region_highlight=( - "1 2 $ZSH_HIGHLIGHT_STYLES[command]" # ls -) diff --git a/shells/zsh/lib/syntax-highlighting/highlighters/main/test-data/simple-redirection.zsh b/shells/zsh/lib/syntax-highlighting/highlighters/main/test-data/simple-redirection.zsh deleted file mode 100644 index 055b1cb8..00000000 --- a/shells/zsh/lib/syntax-highlighting/highlighters/main/test-data/simple-redirection.zsh +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/env zsh -# ------------------------------------------------------------------------------------------------- -# Copyright (c) 2010-2011 zsh-syntax-highlighting contributors -# 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 zsh-syntax-highlighting contributors 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 THE COPYRIGHT HOLDER OR -# CONTRIBUTORS 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. -# ------------------------------------------------------------------------------------------------- -# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- -# vim: ft=zsh sw=2 ts=2 et -# ------------------------------------------------------------------------------------------------- - -BUFFER='ps aux | grep java' - -expected_region_highlight=( - "1 2 $ZSH_HIGHLIGHT_STYLES[command]" # ps - "4 6 $ZSH_HIGHLIGHT_STYLES[default]" # aux - "8 8 $ZSH_HIGHLIGHT_STYLES[default]" # | - "9 12 $ZSH_HIGHLIGHT_STYLES[command]" # grep - "14 17 $ZSH_HIGHLIGHT_STYLES[default]" # java -) diff --git a/shells/zsh/lib/syntax-highlighting/highlighters/main/test-data/unknown-command.zsh b/shells/zsh/lib/syntax-highlighting/highlighters/main/test-data/unknown-command.zsh deleted file mode 100644 index 74854d42..00000000 --- a/shells/zsh/lib/syntax-highlighting/highlighters/main/test-data/unknown-command.zsh +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env zsh -# ------------------------------------------------------------------------------------------------- -# Copyright (c) 2010-2011 zsh-syntax-highlighting contributors -# 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 zsh-syntax-highlighting contributors 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 THE COPYRIGHT HOLDER OR -# CONTRIBUTORS 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. -# ------------------------------------------------------------------------------------------------- -# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- -# vim: ft=zsh sw=2 ts=2 et -# ------------------------------------------------------------------------------------------------- - -BUFFER='azertyuiop' - -expected_region_highlight=( - "1 10 $ZSH_HIGHLIGHT_STYLES[unknown-token]" # azertyuiop -) diff --git a/shells/zsh/lib/syntax-highlighting/highlighters/pattern/README.md b/shells/zsh/lib/syntax-highlighting/highlighters/pattern/README.md deleted file mode 100644 index 82a7c65f..00000000 --- a/shells/zsh/lib/syntax-highlighting/highlighters/pattern/README.md +++ /dev/null @@ -1,21 +0,0 @@ -zsh-syntax-highlighting / highlighters / pattern -================================================ - -This is the ***pattern*** highlighter, that highlights user defined patterns. - - -How to activate it ------------------- -To activate it, add it to `ZSH_HIGHLIGHT_HIGHLIGHTERS`: - - ZSH_HIGHLIGHT_HIGHLIGHTERS=( [...] pattern) - - -How to tweak it ---------------- -To use this highlighter, associate patterns with styles in the `ZSH_HIGHLIGHT_PATTERNS` array, for example in `~/.zshrc`: - - # To have commands starting with `rm -rf` in red: - ZSH_HIGHLIGHT_PATTERNS+=('rm -rf *' 'fg=white,bold,bg=red') - -The syntax for declaring styles is [documented here](http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#SEC135). diff --git a/shells/zsh/lib/syntax-highlighting/highlighters/pattern/pattern-highlighter.zsh b/shells/zsh/lib/syntax-highlighting/highlighters/pattern/pattern-highlighter.zsh deleted file mode 100644 index 93041a38..00000000 --- a/shells/zsh/lib/syntax-highlighting/highlighters/pattern/pattern-highlighter.zsh +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/env zsh -# ------------------------------------------------------------------------------------------------- -# Copyright (c) 2010-2011 zsh-syntax-highlighting contributors -# 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 zsh-syntax-highlighting contributors 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 THE COPYRIGHT HOLDER OR -# CONTRIBUTORS 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. -# ------------------------------------------------------------------------------------------------- -# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- -# vim: ft=zsh sw=2 ts=2 et -# ------------------------------------------------------------------------------------------------- - - -# List of keyword and color pairs. -typeset -gA ZSH_HIGHLIGHT_PATTERNS - -# Whether the pattern highlighter should be called or not. -_zsh_highlight_pattern_highlighter_predicate() -{ - _zsh_highlight_buffer_modified -} - -# Pattern syntax highlighting function. -_zsh_highlight_pattern_highlighter() -{ - setopt localoptions extendedglob - for pattern in ${(k)ZSH_HIGHLIGHT_PATTERNS}; do - _zsh_highlight_pattern_highlighter_loop "$BUFFER" "$pattern" - done -} - -_zsh_highlight_pattern_highlighter_loop() -{ - # This does *not* do its job syntactically, sorry. - local buf="$1" pat="$2" - local -a match mbegin mend - if [[ "$buf" == (#b)(*)(${~pat})* ]]; then - region_highlight+=("$((mbegin[2] - 1)) $mend[2] $ZSH_HIGHLIGHT_PATTERNS[$pat]") - "$0" "$match[1]" "$pat"; return $? - fi -} diff --git a/shells/zsh/lib/syntax-highlighting/highlighters/root/README.md b/shells/zsh/lib/syntax-highlighting/highlighters/root/README.md deleted file mode 100644 index 53c871bf..00000000 --- a/shells/zsh/lib/syntax-highlighting/highlighters/root/README.md +++ /dev/null @@ -1,24 +0,0 @@ -zsh-syntax-highlighting / highlighters / root -================================================= - -This is the ***root*** highlighter, that highlights the whole line if the current user is root. - - -How to activate it ------------------- -To activate it, add it to `ZSH_HIGHLIGHT_HIGHLIGHTERS`: - - ZSH_HIGHLIGHT_HIGHLIGHTERS=( [...] root) - - -How to tweak it ---------------- -This highlighter defines the following styles: - -* `root` - the style for the whole line if the current user is root. - -To override one of those styles, change its entry in `ZSH_HIGHLIGHT_STYLES`, for example in `~/.zshrc`: - - ZSH_HIGHLIGHT_STYLES[root]='bg=red' - -The syntax for declaring styles is [documented here](http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#SEC135). diff --git a/shells/zsh/lib/syntax-highlighting/highlighters/root/root-highlighter.zsh b/shells/zsh/lib/syntax-highlighting/highlighters/root/root-highlighter.zsh deleted file mode 100644 index 4ef87621..00000000 --- a/shells/zsh/lib/syntax-highlighting/highlighters/root/root-highlighter.zsh +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env zsh -# ------------------------------------------------------------------------------------------------- -# Copyright (c) 2010-2011 zsh-syntax-highlighting contributors -# 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 zsh-syntax-highlighting contributors 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 THE COPYRIGHT HOLDER OR -# CONTRIBUTORS 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. -# ------------------------------------------------------------------------------------------------- -# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- -# vim: ft=zsh sw=2 ts=2 et -# ------------------------------------------------------------------------------------------------- - - -# Define default styles. -: ${ZSH_HIGHLIGHT_STYLES[root]:=standout} - -# Whether the root highlighter should be called or not. -_zsh_highlight_root_highlighter_predicate() -{ - _zsh_highlight_buffer_modified -} - -# root highlighting function. -_zsh_highlight_root_highlighter() -{ - [[ $(command id -u) -eq 0 ]] && region_highlight+=("0 $#BUFFER $ZSH_HIGHLIGHT_STYLES[root]") -} diff --git a/shells/zsh/lib/syntax-highlighting/tests/README.md b/shells/zsh/lib/syntax-highlighting/tests/README.md deleted file mode 100644 index f8cac488..00000000 --- a/shells/zsh/lib/syntax-highlighting/tests/README.md +++ /dev/null @@ -1,20 +0,0 @@ -zsh-syntax-highlighting / tests -=============================== - -Utility scripts for testing zsh-syntax-highlighting highlighters. - -The tests expect the highlighter directory to contain a `test-data` directory with test data files. See the [main highlighter](../highlighters/main/test-data) for examples. - - -highlighting test ------------------ -[`test-highlighting.zsh`](tests/test-highlighting.zsh) tests the correctness of the highlighting. Usage: - - zsh test-highlighting.zsh - - -performance test ----------------- -[`test-perfs.zsh`](tests/test-perfs.zsh) measures the time spent doing the highlighting. Usage: - - zsh test-perfs.zsh diff --git a/shells/zsh/lib/syntax-highlighting/tests/test-highlighting.zsh b/shells/zsh/lib/syntax-highlighting/tests/test-highlighting.zsh deleted file mode 100755 index 2e72b2b1..00000000 --- a/shells/zsh/lib/syntax-highlighting/tests/test-highlighting.zsh +++ /dev/null @@ -1,115 +0,0 @@ -#!/usr/bin/env zsh -# ------------------------------------------------------------------------------------------------- -# Copyright (c) 2010-2011 zsh-syntax-highlighting contributors -# 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 zsh-syntax-highlighting contributors 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 THE COPYRIGHT HOLDER OR -# CONTRIBUTORS 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. -# ------------------------------------------------------------------------------------------------- -# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- -# vim: ft=zsh sw=2 ts=2 et -# ------------------------------------------------------------------------------------------------- - - -# Check an highlighter was given as argument. -[[ -n "$1" ]] || { - echo "You must provide the name of a valid highlighter as argument." >&2 - exit 1 -} - -# Check the highlighter is valid. -[[ -f ${0:h:h}/highlighters/$1/$1-highlighter.zsh ]] || { - echo "Could not find highlighter '$1'." >&2 - exit 1 -} - -# Check the highlighter has test data. -[[ -d ${0:h:h}/highlighters/$1/test-data ]] || { - echo "Highlighter '$1' has no test data." >&2 - exit 1 -} - -local -a errors highlight_zone -local -A observed_result - -# Load the main script. -. ${0:h:h}/zsh-syntax-highlighting.zsh - -# Activate the highlighter. -ZSH_HIGHLIGHT_HIGHLIGHTERS=($1) - -# Process each test data file in test data directory. -for data_file in ${0:h:h}/highlighters/$1/test-data/*; do - - # Load the data and prepare checking it. - BUFFER= ; expected_region_highlight=(); errors=() - echo -n "* ${data_file:t:r}: " - . $data_file - - # Check the data declares $BUFFER. - if [[ ${#BUFFER} -eq 0 ]]; then - errors+=("'BUFFER' is not declared or blank.") - else - - # Check the data declares $expected_region_highlight. - if [[ ${#expected_region_highlight} -eq 0 ]]; then - errors+=("'expected_region_highlight' is not declared or empty.") - else - - # Process the data. - region_highlight=() - _zsh_highlight - - # Overlapping regions can be declared in region_highlight, so we first build an array of the - # observed highlighting. - observed_result=() - for i in {1..${#region_highlight}}; do - highlight_zone=${(z)region_highlight[$i]} - for j in {$highlight_zone[1]..$highlight_zone[2]}; do - observed_result[$j]=$highlight_zone[3] - done - done - - # Then we compare the observed result with the expected one. - for i in {1..${#expected_region_highlight}}; do - highlight_zone=${(z)expected_region_highlight[$i]} - for j in {$highlight_zone[1]..$highlight_zone[2]}; do - if [[ "$observed_result[$j]" != "$highlight_zone[3]" ]]; then - errors+=("'$BUFFER[$highlight_zone[1],$highlight_zone[2]]' [$highlight_zone[1],$highlight_zone[2]]: expected '$highlight_zone[3]', observed '$observed_result[$j]'.") - break - fi - done - done - - fi - fi - - # Format result/errors. - if [[ ${#errors} -eq 0 ]]; then - echo "OK" - else - echo "KO" - for error in $errors; do - echo " - $error" - done - fi - -done diff --git a/shells/zsh/lib/syntax-highlighting/tests/test-perfs.zsh b/shells/zsh/lib/syntax-highlighting/tests/test-perfs.zsh deleted file mode 100755 index 0d4adc3e..00000000 --- a/shells/zsh/lib/syntax-highlighting/tests/test-perfs.zsh +++ /dev/null @@ -1,75 +0,0 @@ -#!/usr/bin/env zsh -# ------------------------------------------------------------------------------------------------- -# Copyright (c) 2010-2011 zsh-syntax-highlighting contributors -# 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 zsh-syntax-highlighting contributors 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 THE COPYRIGHT HOLDER OR -# CONTRIBUTORS 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. -# ------------------------------------------------------------------------------------------------- -# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- -# vim: ft=zsh sw=2 ts=2 et -# ------------------------------------------------------------------------------------------------- - - -# Check an highlighter was given as argument. -[[ -n "$1" ]] || { - echo "You must provide the name of a valid highlighter as argument." >&2 - exit 1 -} - -# Check the highlighter is valid. -[[ -f ${0:h:h}/highlighters/$1/$1-highlighter.zsh ]] || { - echo "Could not find highlighter '$1'." >&2 - exit 1 -} - -# Check the highlighter has test data. -[[ -d ${0:h:h}/highlighters/$1/test-data ]] || { - echo "Highlighter '$1' has no test data." >&2 - exit 1 -} - -# Load the main script. -. ${0:h:h}/zsh-syntax-highlighting.zsh - -# Activate the highlighter. -ZSH_HIGHLIGHT_HIGHLIGHTERS=($1) - -# Process each test data file in test data directory. -for data_file in ${0:h:h}/highlighters/$1/test-data/*; do - - # Load the data and prepare checking it. - BUFFER= - echo -n "* ${data_file:t:r}: " - . $data_file - - # Check the data declares $BUFFER. - if [[ ${#BUFFER} -eq 0 ]]; then - echo "KO\n - 'BUFFER' is not declared or blank." - else - - # Measure the time taken by _zsh_highlight. - TIMEFMT="%*Es" - time ( BUFFER="$BUFFER" && _zsh_highlight) - - fi - -done diff --git a/shells/zsh/lib/syntax-highlighting/zsh-syntax-highlighting.plugin.zsh b/shells/zsh/lib/syntax-highlighting/zsh-syntax-highlighting.plugin.zsh deleted file mode 120000 index cc95cd49..00000000 --- a/shells/zsh/lib/syntax-highlighting/zsh-syntax-highlighting.plugin.zsh +++ /dev/null @@ -1 +0,0 @@ -zsh-syntax-highlighting.zsh \ No newline at end of file diff --git a/shells/zsh/lib/syntax-highlighting/zsh-syntax-highlighting.zsh b/shells/zsh/lib/syntax-highlighting/zsh-syntax-highlighting.zsh deleted file mode 100644 index 686daa43..00000000 --- a/shells/zsh/lib/syntax-highlighting/zsh-syntax-highlighting.zsh +++ /dev/null @@ -1,218 +0,0 @@ -#!/usr/bin/env zsh -# ------------------------------------------------------------------------------------------------- -# Copyright (c) 2010-2011 zsh-syntax-highlighting contributors -# 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 zsh-syntax-highlighting contributors 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 THE COPYRIGHT HOLDER OR -# CONTRIBUTORS 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. -# ------------------------------------------------------------------------------------------------- -# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- -# vim: ft=zsh sw=2 ts=2 et -# ------------------------------------------------------------------------------------------------- - - -# ------------------------------------------------------------------------------------------------- -# Core highlighting update system -# ------------------------------------------------------------------------------------------------- - -# Array declaring active highlighters names. -typeset -ga ZSH_HIGHLIGHT_HIGHLIGHTERS - -# Update ZLE buffer syntax highlighting. -# -# Invokes each highlighter that needs updating. -# This function is supposed to be called whenever the ZLE state changes. -_zsh_highlight() -{ - setopt localoptions nowarncreateglobal - - # Store the previous command return code to restore it whatever happens. - local ret=$? - - # Do not highlight if there are more than 300 chars in the buffer. It's most - # likely a pasted command or a huge list of files in that case.. - [[ -n ${ZSH_HIGHLIGHT_MAXLENGTH:-} ]] && [[ $#BUFFER -gt $ZSH_HIGHLIGHT_MAXLENGTH ]] && return $ret - - # Do not highlight if there are pending inputs (copy/paste). - [[ $PENDING -gt 0 ]] && return $ret - - { - local -a selected_highlighters - local cache_place - - # Select which highlighters in ZSH_HIGHLIGHT_HIGHLIGHTERS need to be invoked. - local highlighter; for highlighter in $ZSH_HIGHLIGHT_HIGHLIGHTERS; do - - # If highlighter needs to be invoked - if "_zsh_highlight_${highlighter}_highlighter_predicate"; then - - # Mark the highlighter as selected for update. - selected_highlighters+=($highlighter) - - # Remove what was stored in its cache from region_highlight. - cache_place="_zsh_highlight_${highlighter}_highlighter_cache" - typeset -ga ${cache_place} - [[ ${#${(P)cache_place}} -gt 0 ]] && [[ ! -z ${region_highlight-} ]] && region_highlight=(${region_highlight:#(${(P~j.|.)cache_place})}) - - fi - done - - # Invoke each selected highlighter and store the result in its cache. - local -a region_highlight_copy - for highlighter in $selected_highlighters; do - cache_place="_zsh_highlight_${highlighter}_highlighter_cache" - region_highlight_copy=($region_highlight) - { - "_zsh_highlight_${highlighter}_highlighter" - } always { - [[ ! -z ${region_highlight-} ]] && : ${(PA)cache_place::=${region_highlight:#(${(~j.|.)region_highlight_copy})}} - } - done - - } always { - _ZSH_HIGHLIGHT_PRIOR_BUFFER=$BUFFER - _ZSH_HIGHLIGHT_PRIOR_CURSOR=$CURSOR - return $ret - } -} - - -# ------------------------------------------------------------------------------------------------- -# API/utility functions for highlighters -# ------------------------------------------------------------------------------------------------- - -# Array used by highlighters to declare user overridable styles. -typeset -gA ZSH_HIGHLIGHT_STYLES - -# Whether the command line buffer has been modified or not. -# -# Returns 0 if the buffer has changed since _zsh_highlight was last called. -_zsh_highlight_buffer_modified() -{ - [[ ${_ZSH_HIGHLIGHT_PRIOR_BUFFER:-} != $BUFFER ]] -} - -# Whether the cursor has moved or not. -# -# Returns 0 if the cursor has moved since _zsh_highlight was last called. -_zsh_highlight_cursor_moved() -{ - [[ -n $CURSOR ]] && [[ -n ${_ZSH_HIGHLIGHT_PRIOR_CURSOR-} ]] && (($_ZSH_HIGHLIGHT_PRIOR_CURSOR != $CURSOR)) -} - - -# ------------------------------------------------------------------------------------------------- -# Setup functions -# ------------------------------------------------------------------------------------------------- - -# Rebind all ZLE widgets to make them invoke _zsh_highlights. -_zsh_highlight_bind_widgets() -{ - # Load ZSH module zsh/zleparameter, needed to override user defined widgets. - zmodload zsh/zleparameter 2>/dev/null || { - echo 'zsh-syntax-highlighting: failed loading zsh/zleparameter.' >&2 - return 1 - } - - # Override ZLE widgets to make them invoke _zsh_highlight. - local cur_widget - for cur_widget in ${${(f)"$(builtin zle -la)"}:#(.*|_*|orig-*|run-help|which-command|beep)}; do - case $widgets[$cur_widget] in - - # Already rebound event: do nothing. - user:$cur_widget|user:_zsh_highlight_widget_*);; - - # User defined widget: override and rebind old one with prefix "orig-". - user:*) eval "zle -N orig-$cur_widget ${widgets[$cur_widget]#*:}; \ - _zsh_highlight_widget_$cur_widget() { builtin zle orig-$cur_widget \"\$@\" && _zsh_highlight }; \ - zle -N $cur_widget _zsh_highlight_widget_$cur_widget";; - - # Completion widget: override and rebind old one with prefix "orig-". - completion:*) eval "zle -C orig-$cur_widget ${${widgets[$cur_widget]#*:}/:/ }; \ - _zsh_highlight_widget_$cur_widget() { builtin zle orig-$cur_widget \"\$@\" && _zsh_highlight }; \ - zle -N $cur_widget _zsh_highlight_widget_$cur_widget";; - - # Builtin widget: override and make it call the builtin ".widget". - builtin) eval "_zsh_highlight_widget_$cur_widget() { builtin zle .$cur_widget \"\$@\" && _zsh_highlight }; \ - zle -N $cur_widget _zsh_highlight_widget_$cur_widget";; - - # Default: unhandled case. - *) echo "zsh-syntax-highlighting: unhandled ZLE widget '$cur_widget'" >&2 ;; - esac - done -} - -# Load highlighters from directory. -# -# Arguments: -# 1) Path to the highlighters directory. -_zsh_highlight_load_highlighters() -{ - # Check the directory exists. - [[ -d "$1" ]] || { - echo "zsh-syntax-highlighting: highlighters directory '$1' not found." >&2 - return 1 - } - - # Load highlighters from highlighters directory and check they define required functions. - local highlighter highlighter_dir - for highlighter_dir ($1/*/); do - highlighter="${highlighter_dir:t}" - [[ -f "$highlighter_dir/${highlighter}-highlighter.zsh" ]] && { - . "$highlighter_dir/${highlighter}-highlighter.zsh" - type "_zsh_highlight_${highlighter}_highlighter" &> /dev/null && - type "_zsh_highlight_${highlighter}_highlighter_predicate" &> /dev/null || { - echo "zsh-syntax-highlighting: '${highlighter}' highlighter should define both required functions '_zsh_highlight_${highlighter}_highlighter' and '_zsh_highlight_${highlighter}_highlighter_predicate' in '${highlighter_dir}/${highlighter}-highlighter.zsh'." >&2 - } - } - done -} - - -# ------------------------------------------------------------------------------------------------- -# Setup -# ------------------------------------------------------------------------------------------------- - -# Try binding widgets. -_zsh_highlight_bind_widgets || { - echo 'zsh-syntax-highlighting: failed binding ZLE widgets, exiting.' >&2 - return 1 -} - -# Resolve highlighters directory location. -_zsh_highlight_load_highlighters "${ZSH_HIGHLIGHT_HIGHLIGHTERS_DIR:-${0:h}/highlighters}" || { - echo 'zsh-syntax-highlighting: failed loading highlighters, exiting.' >&2 - return 1 -} - -# Reset scratch variables when commandline is done. -_zsh_highlight_preexec_hook() -{ - _ZSH_HIGHLIGHT_PRIOR_BUFFER= - _ZSH_HIGHLIGHT_PRIOR_CURSOR= -} -autoload -U add-zsh-hook -add-zsh-hook preexec _zsh_highlight_preexec_hook 2>/dev/null || { - echo 'zsh-syntax-highlighting: failed loading add-zsh-hook.' >&2 - } - -# Initialize the array of active highlighters if needed. -[[ $#ZSH_HIGHLIGHT_HIGHLIGHTERS -eq 0 ]] && ZSH_HIGHLIGHT_HIGHLIGHTERS=(main) || true From 569c91010b1cba4494976699e8160734b9b57225 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Mon, 11 Nov 2013 20:36:54 -0800 Subject: [PATCH 041/234] No indent guides for lisp --- editors/vim/bundles.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/editors/vim/bundles.vim b/editors/vim/bundles.vim index f03b52be..50a310f0 100644 --- a/editors/vim/bundles.vim +++ b/editors/vim/bundles.vim @@ -166,7 +166,7 @@ augroup bundles let g:indent_guides_auto_colors = 0 let g:indent_guides_enable_on_vim_startup = 1 autocmd VimEnter * IndentGuidesEnable - autocmd FileType clojure IndentGuidesDisable + autocmd FileType clojure,lisp IndentGuidesDisable NeoBundle 'Syntastic' let g:syntastic_enable_signs = 1 From 846e0b9c273b4a1e95270afcf17985e8d6ae6760 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Tue, 3 Dec 2013 10:47:16 -0800 Subject: [PATCH 042/234] Don't set default ruby from shell start up --- shells/common/ruby.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/shells/common/ruby.sh b/shells/common/ruby.sh index dbb8efdc..637577e0 100644 --- a/shells/common/ruby.sh +++ b/shells/common/ruby.sh @@ -8,7 +8,6 @@ which=`which -a which | tail -n1` # avoid builtin if [ -f "/usr/local/share/chruby/chruby.sh" ]; then source /usr/local/share/chruby/chruby.sh source /usr/local/share/chruby/auto.sh - chruby 2.0.0-p0 function current_ruby() { if [ "x$RUBY_ROOT" != "x" ]; then From ca420fde39c23796b9b470d8a6ab4137dd607f9b Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Tue, 3 Dec 2013 10:47:34 -0800 Subject: [PATCH 043/234] psql config --- Rakefile | 1 + misc/psqlrc | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 misc/psqlrc diff --git a/Rakefile b/Rakefile index 7020fd5e..10d6956e 100644 --- a/Rakefile +++ b/Rakefile @@ -18,6 +18,7 @@ task :install do misc/ctags misc/inputrc misc/nanorc + misc/psqlrc misc/tmux/tmux.conf shells/bash/bash_profile shells/bash/bashrc diff --git a/misc/psqlrc b/misc/psqlrc new file mode 100644 index 00000000..5ff55465 --- /dev/null +++ b/misc/psqlrc @@ -0,0 +1,17 @@ +-- By default, NULL displays as an empty space. Is it actually an empty +-- string, or is it null? This makes that distinction visible. +\pset null '[NULL]' +-- Use table format (with headers across the top) by default, but switch to +-- expanded table format when there's a lot of data, which makes it much +-- easier to read. +\x auto +-- Verbose error reports. +\set VERBOSITY verbose +-- Use a separate history file per-database. +\set HISTFILE ~/.psql_history- :DBNAME +-- If a command is run more than once in a row, only store it once in the +-- history. +\set HISTCONTROL ignoredups +-- Autocomplete keywords (like SELECT) in upper-case, even if you started +-- typing them in lower case. +\set COMP_KEYWORD_CASE upper From 1d4ceca95e743adf18d2f16771c46f843b9601fb Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Tue, 3 Dec 2013 10:48:19 -0800 Subject: [PATCH 044/234] Shell overview --- Rakefile | 1 + shells/README.md | 144 ++++++++++++++++++++++++++++++++++++++++++++ shells/zsh/zprofile | 0 3 files changed, 145 insertions(+) create mode 100644 shells/README.md create mode 100644 shells/zsh/zprofile diff --git a/Rakefile b/Rakefile index 10d6956e..ab469675 100644 --- a/Rakefile +++ b/Rakefile @@ -24,6 +24,7 @@ task :install do shells/bash/bashrc shells/zsh/zshenv shells/zsh/zshrc + shells/zsh/zprofile vcs/git/gitattributes vcs/git/gitconfig vcs/git/gitconfig.merge diff --git a/shells/README.md b/shells/README.md new file mode 100644 index 00000000..ad250ce0 --- /dev/null +++ b/shells/README.md @@ -0,0 +1,144 @@ +# Unix shell initialization + +(NOTE: taken from https://github.com/sstephenson/rbenv/wiki/Unix-shell-initialization) + +Shell initialization files are ways to persist common shell configuration, such +as: + +* `$PATH` and other environment variables +* shell prompt +* shell tab-completion +* aliases, functions +* key bindings + + +## Shell modes + +Which initialization files get sourced by the shell is dependent on the +combination of modes in which a particular shell process runs. There are two +main, non-exclusive modes: + +* **login** - e.g. when user logs in to a system with non-graphical interface or + via SSH; +* **interactive** - shell that has a prompt and whose standard input and error + are both connected to terminals. + +These modes can be manually activated with the following flags to bash/zsh: + +* `-l`, `--login` +* `-i` + +Here are some common operations and shell modes they result in: + +* log in to a remote system via SSH: + **login + interactive** +* execute a script remotely, e.g. `ssh user@host 'echo $PWD'` or with + [Capistrano][]: **non‑login, non‑interactive** +* execute a script remotely and request a terminal, e.g. `ssh user@host -t 'echo $PWD'`: **non-login, interactive** +* start a new shell process, e.g. `bash`: + **non‑login, interactive** +* run a script, `bash myscript.sh`: + **non‑login, non‑interactive** +* run an executable with `#!/usr/bin/env bash` shebang: + **non‑login, non‑interactive** +* open a new graphical terminal window/tab: + * on Mac OS X: **login, interactive** + * on Linux: **non‑login, interactive** + + +## Shell init files + +In order of activation: + +### bash + +1. **login** mode: + 1. `/etc/profile` + 2. `~/.bash_profile`, `~/.bash_login`, `~/.profile` (only first one that exists) +2. interactive **non-login**: + 1. `/etc/bash.bashrc` (some Linux; not on Mac OS X) + 2. `~/.bashrc` +3. **non-interactive**: + 1. source file in `$BASH_ENV` + +### Zsh + +1. `/etc/zshenv` +2. `~/.zshenv` +3. **login** mode: + 1. `/etc/zprofile` + 2. `~/.zprofile` +4. **interactive**: + 1. `/etc/zshrc` + 2. `~/.zshrc` +5. **login** mode: + 1. `/etc/zlogin` + 2. `~/.zlogin` + +### [dash][] + +1. **login** mode: + 1. `/etc/profile` + 2. `~/.profile` +2. **interactive**: + 1. source file in `$ENV` + +### [fish][] + +1. `/config.fish` +2. `/etc/fish/config.fish` +3. `~/.config/fish/config.fish` + +### Practical guide to which files get sourced when + +* Opening a new Terminal window/tab: + * **bash** + * OS X: `.bash_profile` or `.profile` (1st found) + * Linux: `.profile` (Ubuntu, once per desktop login session) + `.bashrc` + * **Zsh** + * OS X: `.zshenv` + `.zprofile` + `.zshrc` + * Linux: `.profile` (Ubuntu, once per desktop login session) + `.zshenv` + `.zshrc` +* Logging into a system via SSH: + * **bash**: `.bash_profile` or `.profile` (1st found) + * **Zsh**: `.zshenv` + `.zprofile` + `.zshrc` +* Executing a command remotely with `ssh` or Capistrano: + * **bash**: `.bashrc` + * **Zsh**: `.zshenv` +* Remote git hook triggered by push over SSH: + * *no init files* get sourced, since hooks are running [within a restricted shell](http://git-scm.com/docs/git-shell) + * PATH will be roughly: `/usr/libexec/git-core:/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin` + +## Misc. things that affect `$PATH` + +* OS X: + * `/etc/paths`, `/etc/paths.d/*` + * [`~/.MacOSX/environment.plist`][plist] - affects **all** graphical programs + * `/etc/launchd.conf` + * TextMate: Preferences -> Advanced -> Shell Variables +* Linux: + * `/etc/environment` + +## Final notes + +This guide was tested with: + +* bash 4.2.37, 4.2.39 +* Zsh 4.3.11, 5.0 + +On these operating systems/apps: + +* Mac OS X 10.8 (Mountain Lion): Terminal.app, iTerm2 +* Ubuntu 12.10: Terminal + +See also: + +* [Environment Variables](https://help.ubuntu.com/community/EnvironmentVariables) +* path_helper(8) +* launchd.conf(5) +* pam_env(8) + + + [Capistrano]: https://github.com/capistrano/capistrano/wiki + [dash]: http://gondor.apana.org.au/~herbert/dash/ + [fish]: http://ridiculousfish.com/shell/user_doc/html/index.html#initialization + [plist]: http://developer.apple.com/library/mac/#documentation/MacOSX/Conceptual/BPRuntimeConfig/Articles/EnvironmentVars.html#//apple_ref/doc/uid/20002093-113982 diff --git a/shells/zsh/zprofile b/shells/zsh/zprofile new file mode 100644 index 00000000..e69de29b From 11be8ceabb358e7b9e6b0c3c5db21ea0bc5fdf93 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Tue, 3 Dec 2013 10:48:56 -0800 Subject: [PATCH 045/234] Fix tmux powerline loading --- misc/tmux/tmux.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/tmux/tmux.conf b/misc/tmux/tmux.conf index d9d09c33..85739519 100644 --- a/misc/tmux/tmux.conf +++ b/misc/tmux/tmux.conf @@ -70,7 +70,7 @@ bind z run ". ~/.config/misc/tmux/zoom.sh" set-option -g terminal-overrides '*88col*:colors=88,*256col*:colors=256,xterm*:XT:Ms=\E]52;%p1%s;%p2%s\007:Cc=\E]12;%p1%s\007:Cr=\E]112\007:Cs=\E]50;CursorShape=%?%p1%{3}%<%t%{0}%e%p1%{2}%-%;%d\007' set -sg escape-time 0 # needed to distinguish between ESC and Meta in emacs -source "~/.config/vendor/powerline/powerline/bindings/tmux/powerline.conf" +source ~/.config/vendor/powerline/powerline/bindings/tmux/powerline.conf bind C-c run "tmux save-buffer - | pbcopy" bind C-v run "pbpaste | tmux load-buffer - && tmux paste-buffer" From 16f9ad12b2246fe85ef613618e5a6ebd314e0672 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Tue, 3 Dec 2013 10:49:35 -0800 Subject: [PATCH 046/234] Fix weird background issue in term vim inside tmux --- editors/vim/ui.vim | 2 ++ 1 file changed, 2 insertions(+) diff --git a/editors/vim/ui.vim b/editors/vim/ui.vim index f03ea619..ac137b6f 100644 --- a/editors/vim/ui.vim +++ b/editors/vim/ui.vim @@ -110,6 +110,8 @@ if exists('$TMUX') " https://github.com/sjl/vitality.vim/issues/8#issuecomment-7664649 let &t_SI = "\[3 q" let &t_EI = "\[0 q" + + set term=screen-256color else let &t_SI = "\]50;CursorShape=1\x7" let &t_EI = "\]50;CursorShape=0\x7" From 8c50a48b268aea664fa66205085cb306e2fd07cd Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Tue, 3 Dec 2013 10:49:47 -0800 Subject: [PATCH 047/234] Git alias overhaul --- vcs/git/gitconfig | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/vcs/git/gitconfig b/vcs/git/gitconfig index 0935ac1c..bf922977 100644 --- a/vcs/git/gitconfig +++ b/vcs/git/gitconfig @@ -1,18 +1,28 @@ [alias] + st = status -s + pl = pull --rebase + p = push + co = checkout + c = commit + ca = commit -a + diff = diff --word-diff + dc = diff --cached + lp = log --patch + lg = log --decorate --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative + me = !sh -c 'echo `git config user.name` \\<`git config user.email`\\>' + f = "!git ls-files | grep -i" + # Add file excluding whitespace changes (http://stackoverflow.com/a/7149602/56690) addnw = !sh -c 'git diff -w --no-color "$@" | git apply --cached --ignore-whitespace' - unadd = reset HEAD ctags = "!$(git rev-parse --show-toplevel)/.git/hooks/ctags" latest = for-each-ref --sort=-committerdate --format='%(committerdate:relative) -> %(refname:short)' - lg = log --decorate --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative - switch = !legit switch \"$@\" - branches = !legit branches - sprout = !legit sprout \"$@\" - unpublish = !legit unpublish \"$@\" - harvest = !legit harvest \"$@\" - sync = !legit sync \"$@\" - publish = !legit publish \"$@\" - graft = !legit graft \"$@\" + branch-name = !git for-each-ref --format='%(refname:short)' `git symbolic-ref HEAD` + assume = update-index --assume-unchanged + unassume = update-index --no-assume-unchanged + assumed = "!git ls-files -v | grep ^h | cut -c 3-" + unassumeall = "!git assumed | xargs git update-index --no-assume-unchanged" + assumeall = "!git st -s | awk {'print $2'} | xargs git assume" [apply] whitespace = fix [color] From b23e6eb0386639247085347a60236ea1ff59269f Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Tue, 3 Dec 2013 10:51:01 -0800 Subject: [PATCH 048/234] Replace NERDtree and Command-T with Ctrl-P --- editors/vim/bundles.vim | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) diff --git a/editors/vim/bundles.vim b/editors/vim/bundles.vim index 50a310f0..7e7bbd03 100644 --- a/editors/vim/bundles.vim +++ b/editors/vim/bundles.vim @@ -138,35 +138,13 @@ augroup bundles map z :ZoomWin imap z :ZoomWina - NeoBundle 'scrooloose/nerdtree', { 'augroup' : 'NERDTreeHijackNetrw' } - let g:NERDTreeIgnore = ['\.rbc$', '\~$', '.DS_Store$'] - let g:NERDTreeChDirMode = 2 - let g:NERDTreeMouseMode = 3 - let g:NERDTreeQuitOnOpen = 1 - let g:NERDTreeMinimalUI = 1 - let g:NERDTreeDirArrows = 1 - let g:NERDTreeHijackNetrw = 0 - map n :NERDTreeToggle - map n :NERDTreeToggle - map N :NERDTreeFind - - NeoBundle 'wincent/Command-T', { - \ 'build' : { - \ 'mac' : '/usr/bin/ruby ruby/command-t/extconf.rb && make', - \ 'unix' : 'ruby ruby/command-t/extconf.rb && make' - \ } - \ } - let g:CommandTMaxFiles = 20000 - let g:CommandTMaxHeight = 10 - nnoremap t :CommandT - nnoremap b :CommandTBuffer - nnoremap f :CommandTFlush - NeoBundle 'Indent-Guides' let g:indent_guides_auto_colors = 0 let g:indent_guides_enable_on_vim_startup = 1 autocmd VimEnter * IndentGuidesEnable autocmd FileType clojure,lisp IndentGuidesDisable + NeoBundle 'kien/ctrlp.vim' + NeoBundle 'Shougo/unite.vim' NeoBundle 'Syntastic' let g:syntastic_enable_signs = 1 From 7e1ba7f4a3aa04bf8929805b11fc03cc0cd04a74 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Tue, 3 Dec 2013 10:51:37 -0800 Subject: [PATCH 049/234] Remove Indent-Guides --- editors/vim/bundles.vim | 5 ----- 1 file changed, 5 deletions(-) diff --git a/editors/vim/bundles.vim b/editors/vim/bundles.vim index 7e7bbd03..105f60f1 100644 --- a/editors/vim/bundles.vim +++ b/editors/vim/bundles.vim @@ -138,11 +138,6 @@ augroup bundles map z :ZoomWin imap z :ZoomWina - NeoBundle 'Indent-Guides' - let g:indent_guides_auto_colors = 0 - let g:indent_guides_enable_on_vim_startup = 1 - autocmd VimEnter * IndentGuidesEnable - autocmd FileType clojure,lisp IndentGuidesDisable NeoBundle 'kien/ctrlp.vim' NeoBundle 'Shougo/unite.vim' From 7cd6e7507e6b81319933275b645843441f94fb5c Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Tue, 3 Dec 2013 10:52:16 -0800 Subject: [PATCH 050/234] vim: Don't show cursorline --- editors/vim/ui.vim | 3 --- 1 file changed, 3 deletions(-) diff --git a/editors/vim/ui.vim b/editors/vim/ui.vim index ac137b6f..c93e43f5 100644 --- a/editors/vim/ui.vim +++ b/editors/vim/ui.vim @@ -92,9 +92,6 @@ syntax on " Always show cursorline, but only in current window. set scrolloff=3 set scrolljump=10 - set cursorline - autocmd WinEnter * :setlocal cursorline - autocmd WinLeave * :setlocal nocursorline set number " line numbers From cf145ae29a2de6d846304021342b18fef693de00 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Tue, 3 Dec 2013 10:52:46 -0800 Subject: [PATCH 051/234] vim: change colorscheme --- editors/vim/ui.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/editors/vim/ui.vim b/editors/vim/ui.vim index c93e43f5..ded2c0ca 100644 --- a/editors/vim/ui.vim +++ b/editors/vim/ui.vim @@ -7,7 +7,7 @@ syntax on set linespace=2 set background=dark set laststatus=2 - colorscheme molokai_mac + colorscheme tubster set rtp+=~/.config/vendor/powerline/powerline/bindings/vim From c5176ae4bb9f49f183839d560a7367c4c814231c Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Tue, 3 Dec 2013 10:53:01 -0800 Subject: [PATCH 052/234] vim: powerline fonts in gui vim --- editors/vim/gvimrc | 1 + 1 file changed, 1 insertion(+) diff --git a/editors/vim/gvimrc b/editors/vim/gvimrc index e44a28fe..8b08f980 100644 --- a/editors/vim/gvimrc +++ b/editors/vim/gvimrc @@ -4,6 +4,7 @@ set guioptions+=Rr " Turn on scroll bars if has("gui_macvim") " Fullscreen takes up entire screen set fuoptions=maxhorz,maxvert + set guifont=DejaVu\ Sans\ Mono\ for\ Powerline:h11 "Mac OS X style command line editing cnoremap From 843cf0c7b721c1051dfdc6e57237657b12b163ef Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Tue, 3 Dec 2013 11:13:24 -0800 Subject: [PATCH 053/234] Alias to view my own commits --- vcs/git/gitconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/vcs/git/gitconfig b/vcs/git/gitconfig index bf922977..aa02df61 100644 --- a/vcs/git/gitconfig +++ b/vcs/git/gitconfig @@ -10,6 +10,7 @@ lp = log --patch lg = log --decorate --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative me = !sh -c 'echo `git config user.name` \\<`git config user.email`\\>' + mine = !sh -c 'git lg --author=\"`git me`\"' f = "!git ls-files | grep -i" # Add file excluding whitespace changes (http://stackoverflow.com/a/7149602/56690) From 93fb672d753ae70366b10c9f04a52df1f9576f85 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Tue, 3 Dec 2013 11:23:05 -0800 Subject: [PATCH 054/234] Simpler install mechanism --- Rakefile | 86 ++++++++--------------------------------------------- install.yml | 33 ++++++++++++++++++++ 2 files changed, 45 insertions(+), 74 deletions(-) create mode 100644 install.yml diff --git a/Rakefile b/Rakefile index ab469675..b67fbb98 100644 --- a/Rakefile +++ b/Rakefile @@ -1,82 +1,20 @@ -require 'rake' -require 'fileutils' +require 'yaml' desc "install the dot files into user's home directory" task :install do - replace_all = false - dot_files = File.dirname(__FILE__) - files = %w( - editors/vim - editors/vim/gvimrc - editors/vim/vimrc - languages/ruby/autotest/autotest - languages/ruby/gemrc - languages/ruby/irbrc - languages/ruby/rdebugrc - languages/ruby/railsrc - misc/ackrc - misc/ctags - misc/inputrc - misc/nanorc - misc/psqlrc - misc/tmux/tmux.conf - shells/bash/bash_profile - shells/bash/bashrc - shells/zsh/zshenv - shells/zsh/zshrc - shells/zsh/zprofile - vcs/git/gitattributes - vcs/git/gitconfig - vcs/git/gitconfig.merge - vcs/git/gitconfig.pushurls - vcs/git/gitignore - vcs/git/gitk - vcs/git/git_template - vcs/hg/hgrc - ) - - files = Hash[files.zip(Array.new(files.size, "~/."))] - files["languages/clojure/lein/profiles.clj"] = "~/.lein/" - files["editors/emacs/init.el"] = "~/.emacs.d/" - files["editors/emacs/bjeanes"] = "~/.emacs.d/" - - system "cp -n vcs/git/gitconfig.local ~/.gitconfig.local" - - files.each do |file, destination| - file_name = file.split(/\//).last - source_file = File.join(dot_files, file) - destination_file = File.expand_path("#{destination}#{file_name}") - - if File.exist?(destination_file) || File.symlink?(destination_file) - if replace_all - replace_file(destination_file, source_file) - else - print "overwrite #{destination_file}? [ynaq] " - case $stdin.gets.chomp.downcase - when 'a' - replace_all = true - replace_file(destination_file, source_file) - when 'y' - replace_file(destination_file, source_file) - when 'q' - exit - else - puts "skipping #{destination_file}" - end - end - else - link_file(destination_file, source_file) + dot_files = File.dirname(__FILE__) + install = proc do |files, cmd| + files.each do |source, destination| + source = File.expand_path(source, dot_files) + destination = File.expand_path(destination, ENV['HOME']) + system 'mkdir', '-p', File.dirname(destination) + # puts [*cmd, source, destination].join(" ") + system *cmd, source, destination end end -end -def replace_file(old_file, new_file) - system %Q{rm "#{old_file}"} - link_file(old_file, new_file) -end + plan = YAML.load_file(File.expand_path("install.yml", dot_files)) -def link_file(old_file, new_file) - puts "#{old_file} => #{new_file}" - FileUtils.mkdir_p(File.dirname(new_file)) - system %Q{ln -fs "#{new_file}" "#{old_file}"} + install.call plan[:link], %w[ln -sinF] + install.call plan[:copy], %w[cp -n] end diff --git a/install.yml b/install.yml new file mode 100644 index 00000000..0a9c2604 --- /dev/null +++ b/install.yml @@ -0,0 +1,33 @@ +:link: + editors/emacs/init.el: ~/.emacs.d/init.el + editors/emacs/bjeanes: ~/.emacs.d/bjeanes + editors/vim: ~/.vim + editors/vim/gvimrc: ~/.gvimrc + editors/vim/vimrc: ~/.vimrc + languages/clojure/lein/profiles.clj: ~/.lein/profiles.clj + languages/ruby/autotest/autotest: ~/.autotest + languages/ruby/gemrc: ~/.gemrc + languages/ruby/irbrc: ~/.irbrc + languages/ruby/rdebugrc: ~/.rdebugrc + languages/ruby/railsrc: ~/.railsrc + misc/ackrc: ~/.ackrc + misc/ctags: ~/.ctags + misc/inputrc: ~/.inputrc + misc/nanorc: ~/.nanorc + misc/psqlrc: ~/.psqlrc + misc/tmux/tmux.conf: ~/.tmux.conf + shells/bash/bash_profile: ~/.bash_profile + shells/bash/bashrc: ~/.bashrc + shells/zsh/zshenv: ~/.zshenv + shells/zsh/zshrc: ~/.zshrc + shells/zsh/zprofile: ~/.zprofile + vcs/git/gitattributes: ~/.gitattributes + vcs/git/gitconfig: ~/.gitconfig + vcs/git/gitconfig.merge: ~/.gitconfig.merge + vcs/git/gitconfig.pushurls: ~/.gitconfig.pushurls + vcs/git/gitignore: ~/.gitignore + vcs/git/gitk: ~/.gitk + vcs/git/git_template: ~/.git_template + vcs/hg/hgrc: ~/.hgrc +:copy: + vcs/git/gitconfig.local: ~/.gitconfig.local From 00c7224b806baed36bf4f5806f53e70aaef4e26f Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Mon, 20 Jan 2014 23:48:33 -0800 Subject: [PATCH 055/234] Clojure in Vim --- editors/vim/bundles.vim | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/editors/vim/bundles.vim b/editors/vim/bundles.vim index 105f60f1..437148aa 100644 --- a/editors/vim/bundles.vim +++ b/editors/vim/bundles.vim @@ -39,12 +39,25 @@ augroup bundles " }}} " Clojure {{{ - NeoBundleLazy 'paredit.vim' - autocmd FileType clojure,clojurescript NeoBundleSource paredit.vim + NeoBundleLazy 'guns/vim-clojure-static' + NeoBundleLazy 'guns/vim-sexp', { 'depends' : ['tpope/vim-repeat'] } + NeoBundleLazy 'tpope/vim-sexp-mappings-for-regular-people', { 'depends' : ['guns/vim-sexp'] } + NeoBundleLazy 'tpope/vim-fireplace' + + autocmd FileType clojure,clojurescript NeoBundleSource + \ vim-clojure-static + \ vim-sexp-mappings-for-regular-people + + autocmd FileType clojure NeoBundleSource + \ vim-classpath + \ vim-fireplace + + autocmd FileType clojurescript NeoBundleSource vim-fireplace + autocmd FileType clojure,clojurescript set lispwords-='->' autocmd FileType clojure,clojurescript set lispwords-='->>' - + " Separate because useful for Java and Clojure NeoBundleLazy 'tpope/vim-classpath', { 'autoload' : { 'filetypes' : ['clojure', 'java'] } } " Markdown/Textile/etc {{{ From b90bab21c51d8cab9aa73db60c1c30aeb3f8142b Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Mon, 20 Jan 2014 23:51:48 -0800 Subject: [PATCH 056/234] vim-smartinput --- editors/vim/bundles.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/editors/vim/bundles.vim b/editors/vim/bundles.vim index 437148aa..9ba4925e 100644 --- a/editors/vim/bundles.vim +++ b/editors/vim/bundles.vim @@ -19,6 +19,7 @@ augroup bundles \ } NeoBundleLazy 'tpope/vim-endwise' " Auto-add 'end' etc appropriately in various languages + NeoBundle 'kana/vim-smartinput' " Languages/Syntaxes/Frameworks {{{ " Ruby {{{ From c2ada65c159fab2c7c5571f3b4b6ac559cb14c03 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Mon, 20 Jan 2014 23:52:09 -0800 Subject: [PATCH 057/234] Actually load vim-endwise --- editors/vim/bundles.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/editors/vim/bundles.vim b/editors/vim/bundles.vim index 9ba4925e..81f02543 100644 --- a/editors/vim/bundles.vim +++ b/editors/vim/bundles.vim @@ -18,7 +18,7 @@ augroup bundles \ }, \ } - NeoBundleLazy 'tpope/vim-endwise' " Auto-add 'end' etc appropriately in various languages + NeoBundle 'tpope/vim-endwise' " Auto-add 'end' etc appropriately in various languages NeoBundle 'kana/vim-smartinput' " Languages/Syntaxes/Frameworks {{{ From 314dc785aad6ad2d7ee85d79e4a6f222ee6257a1 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Mon, 20 Jan 2014 23:52:23 -0800 Subject: [PATCH 058/234] Note to self --- vcs/git/gitconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/vcs/git/gitconfig b/vcs/git/gitconfig index aa02df61..86d32e3b 100644 --- a/vcs/git/gitconfig +++ b/vcs/git/gitconfig @@ -11,6 +11,8 @@ lg = log --decorate --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative me = !sh -c 'echo `git config user.name` \\<`git config user.email`\\>' mine = !sh -c 'git lg --author=\"`git me`\"' + + # TODO make this use selecta, when installed f = "!git ls-files | grep -i" # Add file excluding whitespace changes (http://stackoverflow.com/a/7149602/56690) From 1409235d345a5b698da2f8693f2f02c0614bd5ea Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Mon, 20 Jan 2014 23:53:25 -0800 Subject: [PATCH 059/234] Remove vim-easymotion due to lack of use --- editors/vim/bundles.vim | 3 --- 1 file changed, 3 deletions(-) diff --git a/editors/vim/bundles.vim b/editors/vim/bundles.vim index 81f02543..9ec039e8 100644 --- a/editors/vim/bundles.vim +++ b/editors/vim/bundles.vim @@ -103,9 +103,6 @@ augroup bundles \ 'case', 'done', 'do' \ ] - NeoBundle 'Lokaltog/vim-easymotion' - let g:EasyMotion_keys = "arstdhneio" " Colemak home row - NeoBundle 'Gundo' nnoremap u :GundoToggle From fdb3a7f70ac9c839b44ea4e6f79306afb6969550 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Mon, 20 Jan 2014 23:57:39 -0800 Subject: [PATCH 060/234] tasty vim-vinegar --- editors/vim/bundles.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/editors/vim/bundles.vim b/editors/vim/bundles.vim index 9ec039e8..e2b7137c 100644 --- a/editors/vim/bundles.vim +++ b/editors/vim/bundles.vim @@ -20,6 +20,7 @@ augroup bundles NeoBundle 'tpope/vim-endwise' " Auto-add 'end' etc appropriately in various languages NeoBundle 'kana/vim-smartinput' + NeoBundleLazy 'tpope/vim-vinegar', { 'autoload' : { 'filetypes' : ['netrw'] } } " Languages/Syntaxes/Frameworks {{{ " Ruby {{{ From b55a36544e44b1e08e58ebe666620290b34e12f5 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Wed, 12 Feb 2014 21:06:07 -0800 Subject: [PATCH 061/234] Don't really use Gundo ever so bye. --- editors/vim/bundles.vim | 3 --- 1 file changed, 3 deletions(-) diff --git a/editors/vim/bundles.vim b/editors/vim/bundles.vim index e2b7137c..95b7b3d9 100644 --- a/editors/vim/bundles.vim +++ b/editors/vim/bundles.vim @@ -104,9 +104,6 @@ augroup bundles \ 'case', 'done', 'do' \ ] - NeoBundle 'Gundo' - nnoremap u :GundoToggle - NeoBundle 'kien/rainbow_parentheses.vim' autocmd VimEnter *.{rb,coffee} RainbowParenthesesToggle autocmd Syntax *.{rb,coffee} RainbowParenthesesLoadRound From 904b1f275d7c9da80a3c4623a29367c38c02f589 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Wed, 12 Feb 2014 21:06:58 -0800 Subject: [PATCH 062/234] Remove ZoomWin.vim Never used in practice. --- editors/vim/bundles.vim | 4 ---- 1 file changed, 4 deletions(-) diff --git a/editors/vim/bundles.vim b/editors/vim/bundles.vim index 95b7b3d9..c23d02d1 100644 --- a/editors/vim/bundles.vim +++ b/editors/vim/bundles.vim @@ -143,10 +143,6 @@ augroup bundles nmap // CommentaryLine vmap // Commentary - NeoBundle 'ZoomWin' - map z :ZoomWin - imap z :ZoomWina - NeoBundle 'kien/ctrlp.vim' NeoBundle 'Shougo/unite.vim' From 9c7e5418043c734c54f569dc22c7e8c53c11363a Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Wed, 12 Feb 2014 21:11:42 -0800 Subject: [PATCH 063/234] Rainbow parens are cute but meh --- editors/vim/bundles.vim | 6 ------ 1 file changed, 6 deletions(-) diff --git a/editors/vim/bundles.vim b/editors/vim/bundles.vim index c23d02d1..66d8ce2b 100644 --- a/editors/vim/bundles.vim +++ b/editors/vim/bundles.vim @@ -104,12 +104,6 @@ augroup bundles \ 'case', 'done', 'do' \ ] - NeoBundle 'kien/rainbow_parentheses.vim' - autocmd VimEnter *.{rb,coffee} RainbowParenthesesToggle - autocmd Syntax *.{rb,coffee} RainbowParenthesesLoadRound - autocmd Syntax *.{rb,coffee} RainbowParenthesesLoadSquare - autocmd Syntax *.{rb,coffee} RainbowParenthesesLoadBraces - NeoBundle 'Tabular' autocmd VimEnter * AddTabularPattern! first_eq /\%(=.*\)\@=]\@!/l1c1l0 autocmd VimEnter * AddTabularPattern! first_rocket /\%(=>.*\)\@/l1c1l0 From 4d3a1f0b9b54e9ed3e62829ec59240b8cded9809 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Wed, 12 Feb 2014 21:12:09 -0800 Subject: [PATCH 064/234] Unite.vim is wicked cool but ctrlp meets my needs --- editors/vim/bundles.vim | 1 - 1 file changed, 1 deletion(-) diff --git a/editors/vim/bundles.vim b/editors/vim/bundles.vim index 66d8ce2b..fac93e9b 100644 --- a/editors/vim/bundles.vim +++ b/editors/vim/bundles.vim @@ -138,7 +138,6 @@ augroup bundles vmap // Commentary NeoBundle 'kien/ctrlp.vim' - NeoBundle 'Shougo/unite.vim' NeoBundle 'Syntastic' let g:syntastic_enable_signs = 1 From 13084534311c6a5d0a7ddf014fb57ec6fdbe5a34 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Wed, 12 Feb 2014 21:12:54 -0800 Subject: [PATCH 065/234] Don't really use cucumber any more --- editors/vim/bundles.vim | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/editors/vim/bundles.vim b/editors/vim/bundles.vim index fac93e9b..915ce813 100644 --- a/editors/vim/bundles.vim +++ b/editors/vim/bundles.vim @@ -118,20 +118,6 @@ augroup bundles vmap a> :Tabularize first_rocketgv vmap a: :Tabularize first_keygv - " Auto-align - "" Cucumber - inoremap :call align()a - function! s:align() - let p = '^\s*|\s.*\s|\s*$' - if exists(':Tabularize') && getline('.') =~# '^\s*|' && (getline(line('.')-1) =~# p || getline(line('.')+1) =~# p) - let column = strlen(substitute(getline('.')[0:col('.')],'[^|]','','g')) - let position = strlen(matchstr(getline('.')[0:col('.')],'.*|\s*\zs.*')) - Tabularize/|/l1 - normal! 0 - call search(repeat('[^|]*|',column).'\s\{-\}'.repeat('.',position),'ce',line('.')) - endif - endfunction - NeoBundle 'tpope/vim-commentary' autocmd FileType clojure,clojurescript set commentstring=;\ %s nmap // CommentaryLine @@ -142,7 +128,6 @@ augroup bundles NeoBundle 'Syntastic' let g:syntastic_enable_signs = 1 let g:syntastic_auto_loc_list = 0 - let g:syntastic_disabled_filetypes = ['cucumber'] " }}} filetype plugin indent on From a628865fd788020b1005eb6103e2e6eef3914999 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Wed, 12 Feb 2014 21:16:45 -0800 Subject: [PATCH 066/234] Never use Hammer.vim And even if I did, there are plenty of ways to render markdown other than Vim. --- editors/vim/bundles.vim | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/editors/vim/bundles.vim b/editors/vim/bundles.vim index 915ce813..65c555e4 100644 --- a/editors/vim/bundles.vim +++ b/editors/vim/bundles.vim @@ -61,13 +61,10 @@ augroup bundles " Separate because useful for Java and Clojure NeoBundleLazy 'tpope/vim-classpath', { 'autoload' : { 'filetypes' : ['clojure', 'java'] } } - - " Markdown/Textile/etc {{{ - NeoBundleLazy 'tpope/vim-markdown' - NeoBundleLazy 'matthias-guenther/hammer.vim' - autocmd FileType markdown NeoBundleSource vim-markdown hammer.vim " }}} + NeoBundleLazy 'tpope/vim-markdown', { 'autoload' : { 'filetypes' : ['markdown'] } } + " HTML/CSS/Javascript {{{ NeoBundleLazy 'tpope/vim-haml', { 'autoload' : { 'filetypes' : 'haml' } } NeoBundleLazy 'kchmck/vim-coffee-script', { 'autoload' : { 'filetypes' : 'coffee' } } From 184e4659a3c586520f2d0188cacec338c9565158 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Wed, 12 Feb 2014 21:20:02 -0800 Subject: [PATCH 067/234] Clojure(script) in vim --- editors/vim/bundles.vim | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/editors/vim/bundles.vim b/editors/vim/bundles.vim index 65c555e4..d0ce1ef2 100644 --- a/editors/vim/bundles.vim +++ b/editors/vim/bundles.vim @@ -40,7 +40,7 @@ augroup bundles \ vim-textobj-rubyblock " }}} - " Clojure {{{ + " Clojure(script) {{{ NeoBundleLazy 'guns/vim-clojure-static' NeoBundleLazy 'guns/vim-sexp', { 'depends' : ['tpope/vim-repeat'] } NeoBundleLazy 'tpope/vim-sexp-mappings-for-regular-people', { 'depends' : ['guns/vim-sexp'] } @@ -49,13 +49,8 @@ augroup bundles autocmd FileType clojure,clojurescript NeoBundleSource \ vim-clojure-static \ vim-sexp-mappings-for-regular-people - - autocmd FileType clojure NeoBundleSource - \ vim-classpath \ vim-fireplace - autocmd FileType clojurescript NeoBundleSource vim-fireplace - autocmd FileType clojure,clojurescript set lispwords-='->' autocmd FileType clojure,clojurescript set lispwords-='->>' From f39028f73acfa4ad142f402086660b347e8560b7 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Tue, 1 Apr 2014 18:18:46 -0700 Subject: [PATCH 068/234] New git alias --- vcs/git/gitconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/vcs/git/gitconfig b/vcs/git/gitconfig index 86d32e3b..3686bc92 100644 --- a/vcs/git/gitconfig +++ b/vcs/git/gitconfig @@ -9,6 +9,7 @@ dc = diff --cached lp = log --patch lg = log --decorate --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative + shas = log --reverse --pretty=format:'%h' --abbrev-commit me = !sh -c 'echo `git config user.name` \\<`git config user.email`\\>' mine = !sh -c 'git lg --author=\"`git me`\"' From 76df2f4f7d2ccac349a64efec2c4e086d1bf9c23 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Tue, 1 Apr 2014 18:22:28 -0700 Subject: [PATCH 069/234] Tmux config for latest tmux --- misc/tmux/tmux.conf | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/misc/tmux/tmux.conf b/misc/tmux/tmux.conf index 85739519..3064d1b2 100644 --- a/misc/tmux/tmux.conf +++ b/misc/tmux/tmux.conf @@ -66,11 +66,13 @@ bind z run ". ~/.config/misc/tmux/zoom.sh" set -g status-keys vi set -g display-time 4000 # How long messages are displayed for +setw -g aggressive-resize on + # https://github.com/sjl/vitality.vim/issues/8#issuecomment-7664649 set-option -g terminal-overrides '*88col*:colors=88,*256col*:colors=256,xterm*:XT:Ms=\E]52;%p1%s;%p2%s\007:Cc=\E]12;%p1%s\007:Cr=\E]112\007:Cs=\E]50;CursorShape=%?%p1%{3}%<%t%{0}%e%p1%{2}%-%;%d\007' set -sg escape-time 0 # needed to distinguish between ESC and Meta in emacs -source ~/.config/vendor/powerline/powerline/bindings/tmux/powerline.conf +source-file ~/.config/vendor/powerline/powerline/bindings/tmux/powerline.conf bind C-c run "tmux save-buffer - | pbcopy" bind C-v run "pbpaste | tmux load-buffer - && tmux paste-buffer" From 794700308d874e5c971fd71d12ee0c7834ef5ecc Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Thu, 3 Apr 2014 00:23:16 -0700 Subject: [PATCH 070/234] Tweak colorscheme a bit --- editors/vim/colors/tubster_bo.vim | 5 +++++ editors/vim/ui.vim | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 editors/vim/colors/tubster_bo.vim diff --git a/editors/vim/colors/tubster_bo.vim b/editors/vim/colors/tubster_bo.vim new file mode 100644 index 00000000..169daad0 --- /dev/null +++ b/editors/vim/colors/tubster_bo.vim @@ -0,0 +1,5 @@ +source ~/.vim/colors/tubster.vim + +hi NonText ctermbg=NONE +hi SpecialKey ctermbg=NONE ctermfg=0 +hi LineNr ctermbg=NONE ctermfg=237 diff --git a/editors/vim/ui.vim b/editors/vim/ui.vim index ded2c0ca..809d1acd 100644 --- a/editors/vim/ui.vim +++ b/editors/vim/ui.vim @@ -7,7 +7,7 @@ syntax on set linespace=2 set background=dark set laststatus=2 - colorscheme tubster + colorscheme tubster_bo set rtp+=~/.config/vendor/powerline/powerline/bindings/vim From d1e930ea284ab20f5e956211c831ef6a3c7948d4 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Thu, 3 Apr 2014 00:23:39 -0700 Subject: [PATCH 071/234] Change listchars characters --- editors/vim/ui.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/editors/vim/ui.vim b/editors/vim/ui.vim index 809d1acd..185dee88 100644 --- a/editors/vim/ui.vim +++ b/editors/vim/ui.vim @@ -23,7 +23,7 @@ syntax on " Toggle show tabs and trailing spaces (,c) set list - set listchars=tab:▸\ ,trail:·,eol:¬,nbsp:_ + set listchars=tab:⤑\ ,trail:·,eol:↵,nbsp:_ set fillchars=vert:\ ,fold:- nnoremap c :set list! From 34b7dee456a9ff4b848d938d52fa8731fb2c04f9 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Thu, 3 Apr 2014 00:29:10 -0700 Subject: [PATCH 072/234] Add bundle for Rust development --- editors/vim/bundles.vim | 3 +++ 1 file changed, 3 insertions(+) diff --git a/editors/vim/bundles.vim b/editors/vim/bundles.vim index d0ce1ef2..07db685a 100644 --- a/editors/vim/bundles.vim +++ b/editors/vim/bundles.vim @@ -23,6 +23,9 @@ augroup bundles NeoBundleLazy 'tpope/vim-vinegar', { 'autoload' : { 'filetypes' : ['netrw'] } } " Languages/Syntaxes/Frameworks {{{ + NeoBundleLazy 'wting/rust.vim', { 'autoload' : { 'filetypes' : ['rust'] } } + au BufNewFile,BufRead *.rs set filetype=rust + " Ruby {{{ NeoBundleLazy 'vim-ruby/vim-ruby' NeoBundleLazy 'tpope/vim-rails' From 42e197613c3ccc45f47ca0531dc9680e87464173 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Thu, 3 Apr 2014 00:29:28 -0700 Subject: [PATCH 073/234] Add vim bundle for Go development --- editors/vim/bundles.vim | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/editors/vim/bundles.vim b/editors/vim/bundles.vim index 07db685a..2d9b5d19 100644 --- a/editors/vim/bundles.vim +++ b/editors/vim/bundles.vim @@ -26,6 +26,11 @@ augroup bundles NeoBundleLazy 'wting/rust.vim', { 'autoload' : { 'filetypes' : ['rust'] } } au BufNewFile,BufRead *.rs set filetype=rust + NeoBundleLazy 'jnwhiteh/vim-golang', { 'autoload' : { 'filetypes' : ['go'] } } + au BufNewFile,BufRead *.go set filetype=go + au FileType go autocmd BufWritePre Fmt + au FileType go set noexpandtab + " Ruby {{{ NeoBundleLazy 'vim-ruby/vim-ruby' NeoBundleLazy 'tpope/vim-rails' From 41aa3babd89e48c258e41ea05f900b860888c3fb Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Thu, 3 Apr 2014 00:29:53 -0700 Subject: [PATCH 074/234] Add some more git aliases --- vcs/git/gitconfig | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/vcs/git/gitconfig b/vcs/git/gitconfig index 3686bc92..c6cc1c77 100644 --- a/vcs/git/gitconfig +++ b/vcs/git/gitconfig @@ -27,6 +27,10 @@ assumed = "!git ls-files -v | grep ^h | cut -c 3-" unassumeall = "!git assumed | xargs git update-index --no-assume-unchanged" assumeall = "!git st -s | awk {'print $2'} | xargs git assume" + + # From https://github.com/garybernhardt/dotfiles/blob/master/bin/git-churn + churn = "!git log --all -M -C --name-only --format='format:' \"$@\" | sort | grep -v '^$' | uniq -c | sort | awk 'BEGIN {print \"count\tfile\"} {print $1 \"\t\" $2}' | sort -g" + br = branch [apply] whitespace = fix [color] From dca7ff9af7ddd56a646af41d4fe8d1faad330dd2 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Thu, 3 Apr 2014 00:31:47 -0700 Subject: [PATCH 075/234] Vim script to test color codes in current terminal --- editors/vim/test_colors.vim | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 editors/vim/test_colors.vim diff --git a/editors/vim/test_colors.vim b/editors/vim/test_colors.vim new file mode 100644 index 00000000..b84b0f89 --- /dev/null +++ b/editors/vim/test_colors.vim @@ -0,0 +1,7 @@ +let num = 255 +while num >= 0 + exec 'hi col_'.num.' ctermbg='.num.' ctermfg=white' + exec 'syn match col_'.num.' "ctermbg='.num.':...." containedIn=ALL' + call append(0, 'ctermbg='.num.':....') + let num = num - 1 +endwhile From e1ae402a7cd4af3a3636378428dee423988a5458 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Thu, 3 Apr 2014 00:32:05 -0700 Subject: [PATCH 076/234] gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 21e2b8f1..770ccb78 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ Transmission Remote GUI vim/bundle/* Fritzing hub +camlistore From 679db6fbaec20fab3e87cb29272792a109d5ab4c Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Fri, 18 Apr 2014 11:57:53 -0700 Subject: [PATCH 077/234] Remove ctags comments to get rid of syntax warning --- misc/ctags | 3 --- 1 file changed, 3 deletions(-) diff --git a/misc/ctags b/misc/ctags index af314034..16f73ca8 100644 --- a/misc/ctags +++ b/misc/ctags @@ -1,4 +1,3 @@ -# Ruby --regex-ruby=/(^|[:;])[ \t]*([A-Z][[:alnum:]_]+) *=/\2/c,class,constant/ --regex-ruby=/(^|;)[ \t]*(has_many|belongs_to|has_one|has_and_belongs_to_many)\(? *:([[:alnum:]_]+)/\3/f,function,association/ --regex-ruby=/(^|;)[ \t]*(named_)?scope\(? *:([[:alnum:]_]+)/\3/f,function,named_scope/ @@ -6,10 +5,8 @@ --regex-ruby=/(^|;)[ \t]*event\(? *:([[:alnum:]_]+)/\2!/f,function,aasm_event/ --regex-ruby=/(^|;)[ \t]*event\(? *:([[:alnum:]_]+)/\2?/f,function,aasm_event/ -# Clojure --langmap=Lisp:+.clj -# CofeeScript --langdef=coffee --langmap=coffee:.coffee --regex-coffee=/^class ([A-Za-z.]+)( extends [A-Za-z.]+)?$/\1/c,class/ From 613abb3086d14da6f71bbc70f40a6d36a168efd1 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Fri, 18 Apr 2014 11:58:10 -0700 Subject: [PATCH 078/234] Nicer git status alias --- vcs/git/gitconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vcs/git/gitconfig b/vcs/git/gitconfig index c6cc1c77..79dc9ad5 100644 --- a/vcs/git/gitconfig +++ b/vcs/git/gitconfig @@ -1,5 +1,5 @@ [alias] - st = status -s + st = status -s -b pl = pull --rebase p = push co = checkout From 7296f84b7042c8fec13f2173c96e669b1c055544 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Fri, 18 Apr 2014 11:58:28 -0700 Subject: [PATCH 079/234] Kaleidoscope is a mess and I could never get it working with git --- vcs/git/gitconfig | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/vcs/git/gitconfig b/vcs/git/gitconfig index 79dc9ad5..62034c61 100644 --- a/vcs/git/gitconfig +++ b/vcs/git/gitconfig @@ -63,20 +63,10 @@ [credential] username = bjeanes helper = osxkeychain -[difftool "Kaleidoscope"] - cmd = ksdiff --partial-changeset --relative-path \"$MERGED\" -- \"$LOCAL\" \"$REMOTE\" [diff] algorithm = minimal mnemonicprefix = true - tool = Kaleidoscope renames = copies -[difftool] - prompt = false -[mergetool "Kaleidoscope"] - cmd = ksdiff --merge --output \"$MERGED\" --base \"$BASE\" -- \"$LOCAL\" --snapshot \"$REMOTE\" --snapshot - trustExitCode = true -[mergetool] - prompt = false [merge] conflictstyle = diff3 tool = Kaleidoscope From d53bb6dbf14f0593c57df659c0a0813a3c832394 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Fri, 18 Apr 2014 11:58:59 -0700 Subject: [PATCH 080/234] Git rerere was more pain than help --- vcs/git/gitconfig | 2 -- 1 file changed, 2 deletions(-) diff --git a/vcs/git/gitconfig b/vcs/git/gitconfig index 62034c61..8fe9594d 100644 --- a/vcs/git/gitconfig +++ b/vcs/git/gitconfig @@ -53,8 +53,6 @@ user = bjeanes [init] templatedir = ~/.git_template -[rerere] - enabled = 1 [include] path = .gitconfig.github path = .gitconfig.pushurls From a476955dfb955428f9f7a08b4fddabdc697248b8 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Fri, 23 May 2014 09:02:04 -0700 Subject: [PATCH 081/234] Update Clojure setup in Vim --- editors/vim/bundles.vim | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/editors/vim/bundles.vim b/editors/vim/bundles.vim index 2d9b5d19..2ff7472e 100644 --- a/editors/vim/bundles.vim +++ b/editors/vim/bundles.vim @@ -52,7 +52,9 @@ augroup bundles NeoBundleLazy 'guns/vim-clojure-static' NeoBundleLazy 'guns/vim-sexp', { 'depends' : ['tpope/vim-repeat'] } NeoBundleLazy 'tpope/vim-sexp-mappings-for-regular-people', { 'depends' : ['guns/vim-sexp'] } - NeoBundleLazy 'tpope/vim-fireplace' + NeoBundleLazy 'tpope/vim-dispatch' + NeoBundleLazy 'tpope/vim-leiningen', { 'depends' : ['tpope/vim-dispatch'] } + NeoBundleLazy 'tpope/vim-fireplace', { 'depends' : ['tpope/vim-leiningen']} autocmd FileType clojure,clojurescript NeoBundleSource \ vim-clojure-static @@ -61,9 +63,6 @@ augroup bundles autocmd FileType clojure,clojurescript set lispwords-='->' autocmd FileType clojure,clojurescript set lispwords-='->>' - - " Separate because useful for Java and Clojure - NeoBundleLazy 'tpope/vim-classpath', { 'autoload' : { 'filetypes' : ['clojure', 'java'] } } " }}} NeoBundleLazy 'tpope/vim-markdown', { 'autoload' : { 'filetypes' : ['markdown'] } } From 91e4fc2bf527450498983760f310e80939b72acb Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Fri, 23 May 2014 09:02:17 -0700 Subject: [PATCH 082/234] Update NeoBundle --- editors/vim/bundle/neobundle.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/editors/vim/bundle/neobundle.vim b/editors/vim/bundle/neobundle.vim index 2fda048c..538ca07a 160000 --- a/editors/vim/bundle/neobundle.vim +++ b/editors/vim/bundle/neobundle.vim @@ -1 +1 @@ -Subproject commit 2fda048ce43d0540e88f2763629713c6f9151473 +Subproject commit 538ca07acd4217e79d130809c8c7e2df15449adc From 5e116ad1ea720268dd80207d19e933a6ad40c92e Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Fri, 23 May 2014 09:02:39 -0700 Subject: [PATCH 083/234] Tmux now has Zoom built-in --- misc/tmux/tmux.conf | 3 --- 1 file changed, 3 deletions(-) diff --git a/misc/tmux/tmux.conf b/misc/tmux/tmux.conf index 3064d1b2..dea79c62 100644 --- a/misc/tmux/tmux.conf +++ b/misc/tmux/tmux.conf @@ -12,9 +12,6 @@ set -g default-terminal "screen-256color" bind R source-file ~/.tmux.conf bind \ confirm-before kill-server -unbind z -bind z run ". ~/.config/misc/tmux/zoom.sh" - # Mouse setw -g mode-mouse on set -g mouse-resize-pane From 3e7c76e04469a04d73a93ba6ef8f33cfa1467307 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Fri, 23 May 2014 09:03:07 -0700 Subject: [PATCH 084/234] Dash vim plugin when on mac --- editors/vim/bundles.vim | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/editors/vim/bundles.vim b/editors/vim/bundles.vim index 2ff7472e..b59de855 100644 --- a/editors/vim/bundles.vim +++ b/editors/vim/bundles.vim @@ -18,6 +18,13 @@ augroup bundles \ }, \ } + if has("mac") || has("macunix") + NeoBundle 'rizzatti/funcoo.vim' + NeoBundle 'rizzatti/dash.vim' + + nmap K DashSearch + endif + NeoBundle 'tpope/vim-endwise' " Auto-add 'end' etc appropriately in various languages NeoBundle 'kana/vim-smartinput' NeoBundleLazy 'tpope/vim-vinegar', { 'autoload' : { 'filetypes' : ['netrw'] } } From d80e16e348f6c6d5a2a92ec153db4698f633948a Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Fri, 23 May 2014 09:05:41 -0700 Subject: [PATCH 085/234] Update lein profiles --- languages/clojure/lein/profiles.clj | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/languages/clojure/lein/profiles.clj b/languages/clojure/lein/profiles.clj index ba44a9b4..73fc3154 100644 --- a/languages/clojure/lein/profiles.clj +++ b/languages/clojure/lein/profiles.clj @@ -1,15 +1,17 @@ {:user {:plugins [[lein-beanstalk "0.2.7"] - [lein-light "0.0.27"] + [lein-light "0.0.44"] [lein-marginalia "0.7.1"] + [cider/cider-nrepl "0.7.0-SNAPSHOT"] [lein-clojars "0.9.1"] - [lein-outdated "1.0.1"] + [lein-ancient "0.5.5"] [lein-depgraph "0.1.0"] [lein-pprint "1.1.1"] - [lein-ring "0.8.7"]] - :dependencies [[clj-stacktrace "0.2.5"]] - :injections [(let [orig (ns-resolve (doto 'clojure.stacktrace require) - 'print-cause-trace) - new (ns-resolve (doto 'clj-stacktrace.repl require) - 'pst)] - (alter-var-root orig (constantly @new)))] - :vimclojure-opts {:repl true}}} + [lein-ring "0.8.10"]] + :dependencies [[io.aviso/pretty "0.1.11"] + [alembic "0.2.1"]] + :repl-options {:nrepl-middleware [io.aviso.nrepl/pretty-middleware]} + :injections [#_(let [orig (ns-resolve (doto 'clojure.stacktrace require) + 'print-cause-trace) + new (ns-resolve (doto 'clj-stacktrace.repl require) + 'pst)] + (alter-var-root orig (constantly @new)))]}} From 7a5004316dd177c086d497873c7a58dd7df1829f Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Fri, 23 May 2014 09:06:06 -0700 Subject: [PATCH 086/234] Git config updates --- vcs/git/gitconfig | 2 ++ vcs/git/gitignore | 3 +++ 2 files changed, 5 insertions(+) diff --git a/vcs/git/gitconfig b/vcs/git/gitconfig index 8fe9594d..6b9b1e03 100644 --- a/vcs/git/gitconfig +++ b/vcs/git/gitconfig @@ -74,3 +74,5 @@ account = heroku [push] default = simple +[advice] + statusHints = false diff --git a/vcs/git/gitignore b/vcs/git/gitignore index 5ec3a243..47581387 100755 --- a/vcs/git/gitignore +++ b/vcs/git/gitignore @@ -54,3 +54,6 @@ doc/tags .#* \#*# *.pyc +.node_modules +./node_modules +node_modules From 3f10b9a9fb388755ab488e1d7bfd8e1daa5a7096 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Fri, 23 May 2014 09:07:33 -0700 Subject: [PATCH 087/234] Add vim-sleuth --- editors/vim/bundles.vim | 2 ++ 1 file changed, 2 insertions(+) diff --git a/editors/vim/bundles.vim b/editors/vim/bundles.vim index b59de855..f8c953e4 100644 --- a/editors/vim/bundles.vim +++ b/editors/vim/bundles.vim @@ -25,6 +25,8 @@ augroup bundles nmap K DashSearch endif + NeoBundle 'tpope/vim-sleuth' " auto-config indent and tabs etc based on other files + NeoBundle 'tpope/vim-endwise' " Auto-add 'end' etc appropriately in various languages NeoBundle 'kana/vim-smartinput' NeoBundleLazy 'tpope/vim-vinegar', { 'autoload' : { 'filetypes' : ['netrw'] } } From cfda3f3e982ef51463b4aaf3625849a62478d8a6 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sun, 5 Jul 2015 11:51:11 +1000 Subject: [PATCH 088/234] Use easy-align instead of Tabular --- editors/vim/bundles.vim | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/editors/vim/bundles.vim b/editors/vim/bundles.vim index f8c953e4..2d5c5a2d 100644 --- a/editors/vim/bundles.vim +++ b/editors/vim/bundles.vim @@ -112,19 +112,9 @@ augroup bundles \ 'case', 'done', 'do' \ ] - NeoBundle 'Tabular' - autocmd VimEnter * AddTabularPattern! first_eq /\%(=.*\)\@=]\@!/l1c1l0 - autocmd VimEnter * AddTabularPattern! first_rocket /\%(=>.*\)\@/l1c1l0 - autocmd VimEnter * AddTabularPattern! first_key /\v%(%(\h\w*|"[^"]+"):.*)@ a= mT:Tabularize first_eq`T - nmap a> mT:Tabularize first_rocket`T - nmap a: mT:Tabularize first_key`T - - vmap a= :Tabularize first_eqgv - vmap a> :Tabularize first_rocketgv - vmap a: :Tabularize first_keygv + NeoBundle 'junegunn/vim-easy-align' + vmap (EasyAlign) + nmap a (EasyAlign) NeoBundle 'tpope/vim-commentary' autocmd FileType clojure,clojurescript set commentstring=;\ %s From 4eef124ddca6f18f73aa3ed0ec1f162b2f8a77e7 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sun, 5 Jul 2015 11:52:06 +1000 Subject: [PATCH 089/234] Default leader --- editors/vim/ui.vim | 3 --- 1 file changed, 3 deletions(-) diff --git a/editors/vim/ui.vim b/editors/vim/ui.vim index 185dee88..af968ecf 100644 --- a/editors/vim/ui.vim +++ b/editors/vim/ui.vim @@ -32,9 +32,6 @@ syntax on set nostartofline " Avoid moving cursor to BOL when jumping around set virtualedit=all " Let cursor move past the last char set whichwrap=b,s,h,l,<,>,[,] - let mapleader = ',' " comma as leader key - " but be nice to people who are used to backslash: - nmap \ set autoread " watch for file changes set mouse=a " mouse can be handy sometimes set ttymouse=xterm2 " Needed to get mouse working when in Tmux/screen From 975939c77ebce2fa095f4f5d0d584b002fe4e0e9 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sun, 5 Jul 2015 11:55:05 +1000 Subject: [PATCH 090/234] Don't care about these things --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 770ccb78..1d635aef 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,6 @@ vim/bundle/* Fritzing hub camlistore +git/ +inkscape/ +transmission-daemon/ From 8320f2e1c93e7b581f2b588099e30b1c17ab2d1f Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sun, 5 Jul 2015 11:55:57 +1000 Subject: [PATCH 091/234] Update neobundle --- editors/vim/bundle/neobundle.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/editors/vim/bundle/neobundle.vim b/editors/vim/bundle/neobundle.vim index 538ca07a..2fda048c 160000 --- a/editors/vim/bundle/neobundle.vim +++ b/editors/vim/bundle/neobundle.vim @@ -1 +1 @@ -Subproject commit 538ca07acd4217e79d130809c8c7e2df15449adc +Subproject commit 2fda048ce43d0540e88f2763629713c6f9151473 From 3009d6dc23d51895b1055e846306a3f9ea00bbf5 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Wed, 5 Aug 2015 16:46:53 +1000 Subject: [PATCH 092/234] Spacemacs --- editors/emacs/spacemacs | 215 ++++++++++++++++++++++++++++++++++++++++ install.yml | 3 +- shells/tmux.sh | 4 +- vcs/git/gitignore | 1 + 4 files changed, 219 insertions(+), 4 deletions(-) create mode 100644 editors/emacs/spacemacs diff --git a/editors/emacs/spacemacs b/editors/emacs/spacemacs new file mode 100644 index 00000000..74ebf397 --- /dev/null +++ b/editors/emacs/spacemacs @@ -0,0 +1,215 @@ +;; -*- mode: dotspacemacs -*- +;; This file is loaded by Spacemacs at startup. +;; It must be stored in your home directory. + +(defun dotspacemacs/layers () + "Configuration Layers declaration." + (setq-default + ;; List of additional paths where to look for configuration layers. + ;; Paths must have a trailing slash (i.e. `~/.mycontribs/') + dotspacemacs-configuration-layer-path '() + ;; List of configuration layers to load. If it is the symbol `all' instead + ;; of a list then all discovered layers will be installed. + dotspacemacs-configuration-layers + '( + ;; ---------------------------------------------------------------- + ;; Example of useful layers you may want to use right away. + ;; Uncomment some layer names and press (Vim style) or + ;; (Emacs style) to install them. + ;; ---------------------------------------------------------------- + auto-completion + better-defaults + clojure + colors + dash + emacs-lisp + evil-commentary + git + github + go + markdown + osx + ruby + shell-scripts + rust + smex + sql + ;; org + (shell :variables + shell-default-height 30 + shell-default-position 'bottom + shell-default-term-shell "/usr/local/bin/zsh") + syntax-checking + version-control + ) + ;; List of additional packages that will be installed without being + ;; wrapped in a layer. If you need some configuration for these + ;; packages then consider to create a layer, you can also put the + ;; configuration in `dotspacemacs/config'. + dotspacemacs-additional-packages + '( + yaml-mode + ansi-color + ) + ;; A list of packages and/or extensions that will not be install and loaded. + dotspacemacs-excluded-packages '() + ;; If non-nil spacemacs will delete any orphan packages, i.e. packages that + ;; are declared in a layer which is not a member of + ;; the list `dotspacemacs-configuration-layers' + dotspacemacs-delete-orphan-packages t)) + +(defun dotspacemacs/init () + "Initialization function. +This function is called at the very startup of Spacemacs initialization +before layers configuration." + ;; This setq-default sexp is an exhaustive list of all the supported + ;; spacemacs settings. + (setq-default + ;; Either `vim' or `emacs'. Evil is always enabled but if the variable + ;; is `emacs' then the `holy-mode' is enabled at startup. + dotspacemacs-editing-style 'nil + ;; If non nil output loading progress in `*Messages*' buffer. + dotspacemacs-verbose-loading nil + ;; Specify the startup banner. Default value is `official', it displays + ;; the official spacemacs logo. An integer value is the index of text + ;; banner, `random' chooses a random text banner in `core/banners' + ;; directory. A string value must be a path to an image format supported + ;; by your Emacs build. + ;; If the value is nil then no banner is displayed. + dotspacemacs-startup-banner 'official + ;; List of items to show in the startup buffer. If nil it is disabled. + ;; Possible values are: `recents' `bookmarks' `projects'." + dotspacemacs-startup-lists '(recents projects) + ;; List of themes, the first of the list is loaded when spacemacs starts. + ;; Press T n to cycle to the next theme in the list (works great + ;; with 2 themes variants, one dark and one light) + dotspacemacs-themes '(monokai) + + ;; If non nil the cursor color matches the state color. + dotspacemacs-colorize-cursor-according-to-state t + ;; Default font. `powerline-scale' allows to quickly tweak the mode-line + ;; size to make separators look not too crappy. + dotspacemacs-default-font '("Source Code Pro" + :size 13 + :weight normal + :width normal + :powerline-scale 1.1) + ;; The leader key + dotspacemacs-leader-key "SPC" + ;; The leader key accessible in `emacs state' and `insert state' + dotspacemacs-emacs-leader-key "M-m" + ;; Major mode leader key is a shortcut key which is the equivalent of + ;; pressing ` m`. Set it to `nil` to disable it. + dotspacemacs-major-mode-leader-key "," + ;; Major mode leader key accessible in `emacs state' and `insert state' + dotspacemacs-major-mode-emacs-leader-key "C-M-m" + ;; The command key used for Evil commands (ex-commands) and + ;; Emacs commands (M-x). + ;; By default the command key is `:' so ex-commands are executed like in Vim + ;; with `:' and Emacs commands are executed with ` :'. + dotspacemacs-command-key ":" + ;; Location where to auto-save files. Possible values are `original' to + ;; auto-save the file in-place, `cache' to auto-save the file to another + ;; file stored in the cache directory and `nil' to disable auto-saving. + ;; Default value is `cache'. + dotspacemacs-auto-save-file-location 'cache + ;; If non nil then `ido' replaces `helm' for some commands. For now only + ;; `find-files' (SPC f f) is replaced. + dotspacemacs-use-ido nil + ;; If non nil the paste micro-state is enabled. When enabled pressing `p` + ;; several times cycle between the kill ring content. + dotspacemacs-enable-paste-micro-state nil + ;; Guide-key delay in seconds. The Guide-key is the popup buffer listing + ;; the commands bound to the current keystrokes. + dotspacemacs-guide-key-delay 0.4 + ;; If non nil a progress bar is displayed when spacemacs is loading. This + ;; may increase the boot time on some systems and emacs builds, set it to + ;; nil ;; to boost the loading time. + dotspacemacs-loading-progress-bar t + ;; If non nil the frame is fullscreen when Emacs starts up. + ;; (Emacs 24.4+ only) + dotspacemacs-fullscreen-at-startup nil + ;; If non nil `spacemacs/toggle-fullscreen' will not use native fullscreen. + ;; Use to disable fullscreen animations in OSX." + dotspacemacs-fullscreen-use-non-native nil + ;; If non nil the frame is maximized when Emacs starts up. + ;; Takes effect only if `dotspacemacs-fullscreen-at-startup' is nil. + ;; (Emacs 24.4+ only) + dotspacemacs-maximized-at-startup nil + ;; A value from the range (0..100), in increasing opacity, which describes + ;; the transparency level of a frame when it's active or selected. + ;; Transparency can be toggled through `toggle-transparency'. + dotspacemacs-active-transparency 90 + ;; A value from the range (0..100), in increasing opacity, which describes + ;; the transparency level of a frame when it's inactive or deselected. + ;; Transparency can be toggled through `toggle-transparency'. + dotspacemacs-inactive-transparency 90 + ;; If non nil unicode symbols are displayed in the mode line. + dotspacemacs-mode-line-unicode-symbols t + ;; If non nil smooth scrolling (native-scrolling) is enabled. Smooth + ;; scrolling overrides the default behavior of Emacs which recenters the + ;; point when it reaches the top or bottom of the screen. + dotspacemacs-smooth-scrolling t + ;; If non-nil smartparens-strict-mode will be enabled in programming modes. + dotspacemacs-smartparens-strict-mode nil + ;; Select a scope to highlight delimiters. Possible value is `all', + ;; `current' or `nil'. Default is `all' + dotspacemacs-highlight-delimiters 'all + ;; If non nil advises quit functions to keep server open when quitting. + dotspacemacs-persistent-server nil + ;; List of search tool executable names. Spacemacs uses the first installed + ;; tool of the list. Supported tools are `ag', `pt', `ack' and `grep'. + dotspacemacs-search-tools '("ag" "pt" "ack" "grep") + ;; The default package repository used if no explicit repository has been + ;; specified with an installed package. + ;; Not used for now. + dotspacemacs-default-package-repository nil + + ruby-version-manager 'chruby + ) + ;; User initialization goes here + ) + +(defun dotspacemacs/config () + "Configuration function. + This function is called at the very end of Spacemacs initialization after +layers configuration." + (setq magit-repository-directories '("~/Code/")) + (setq clojure-enable-fancify-symbols t) + + (add-hook 'prog-mode-hook 'linum-mode) + + ;; Load shell for commands (e.g. *compilation* buffers) so that correct + ;; environment (chruby, etc) is sourced + (setq shell-file-name "bash") + (setq shell-command-switch "-ic") + + ;; colourize compilation buffer + (ignore-errors + (require 'ansi-color) + (defun my-colorize-compilation-buffer () + (when (eq major-mode 'compilation-mode) + (ansi-color-apply-on-region compilation-filter-start (point-max)))) + (add-hook 'compilation-filter-hook 'my-colorize-compilation-buffer))) + +;; Do not write anything past this comment. This is where Emacs will +;; auto-generate custom variable definitions. +(custom-set-variables + ;; custom-set-variables was added by Custom. + ;; If you edit it by hand, you could mess it up, so be careful. + ;; Your init file should contain only one such instance. + ;; If there is more than one, they won't work right. + '(ahs-case-fold-search nil) + '(ahs-default-range (quote ahs-range-whole-buffer)) + '(ahs-idle-interval 0.25) + '(ahs-idle-timer 0 t) + '(ahs-inhibit-face-list nil) + '(paradox-github-token t) + '(ring-bell-function (quote ignore) t)) +(custom-set-faces + ;; custom-set-faces was added by Custom. + ;; If you edit it by hand, you could mess it up, so be careful. + ;; Your init file should contain only one such instance. + ;; If there is more than one, they won't work right. + '(company-tooltip-common ((t (:inherit company-tooltip :weight bold :underline nil)))) + '(company-tooltip-common-selection ((t (:inherit company-tooltip-selection :weight bold :underline nil))))) diff --git a/install.yml b/install.yml index 0a9c2604..ba5e147d 100644 --- a/install.yml +++ b/install.yml @@ -1,6 +1,5 @@ :link: - editors/emacs/init.el: ~/.emacs.d/init.el - editors/emacs/bjeanes: ~/.emacs.d/bjeanes + editors/emacs/spacemacs: ~/.spacemacs editors/vim: ~/.vim editors/vim/gvimrc: ~/.gvimrc editors/vim/vimrc: ~/.vimrc diff --git a/shells/tmux.sh b/shells/tmux.sh index 53efc42f..29e0422b 100644 --- a/shells/tmux.sh +++ b/shells/tmux.sh @@ -5,8 +5,8 @@ # This lets me have a different terminals tabs/windows have the same tmux # windows but be looking at different ones individually -# If we aren't in Tmux, set it up -if [ -z "$TMUX" ]; then +# If we aren't in Tmux or emacs, set it up +if [ -z "$TMUX" -a -z "$INSIDE_EMACS" ]; then if tty >/dev/null; then if which tmux 2>&1 >/dev/null; then if [ -z "$(tmux ls | grep 'login:')" ]; then diff --git a/vcs/git/gitignore b/vcs/git/gitignore index 47581387..669b70e1 100755 --- a/vcs/git/gitignore +++ b/vcs/git/gitignore @@ -57,3 +57,4 @@ doc/tags .node_modules ./node_modules node_modules +TAGS From 964f98920c232c76de57f227e8153fe3278a88d7 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Wed, 5 Aug 2015 16:47:23 +1000 Subject: [PATCH 093/234] ctag all the things --- misc/ctags | 39 ++++++++++++++++++++++++++++++++------- 1 file changed, 32 insertions(+), 7 deletions(-) diff --git a/misc/ctags b/misc/ctags index 16f73ca8..249f0a48 100644 --- a/misc/ctags +++ b/misc/ctags @@ -5,12 +5,37 @@ --regex-ruby=/(^|;)[ \t]*event\(? *:([[:alnum:]_]+)/\2!/f,function,aasm_event/ --regex-ruby=/(^|;)[ \t]*event\(? *:([[:alnum:]_]+)/\2?/f,function,aasm_event/ ---langmap=Lisp:+.clj +--langdef=Clojure +--langmap=Clojure:.clj +--langmap=Clojure:+.cljx +--langmap=Clojure:+.cljs +--regex-clojure=/\([ \t]*create-ns[ \t]+([-[:alnum:]*+!_:\/.?]+)/\1/n,namespace/ +--regex-clojure=/\([ \t]*def[ \t]+([-[:alnum:]*+!_:\/.?]+)/\1/d,definition/ +--regex-clojure=/\([ \t]*defn[ \t]+([-[:alnum:]*+!_:\/.?]+)/\1/f,function/ +--regex-clojure=/\([ \t]*defn-[ \t]+([-[:alnum:]*+!_:\/.?]+)/\1/p,private function/ +--regex-clojure=/\([ \t]*defmacro[ \t]+([-[:alnum:]*+!_:\/.?]+)/\1/m,macro/ +--regex-clojure=/\([ \t]*definline[ \t]+([-[:alnum:]*+!_:\/.?]+)/\1/i,inline/ +--regex-clojure=/\([ \t]*defmulti[ \t]+([-[:alnum:]*+!_:\/.?]+)/\1/a,multimethod definition/ +--regex-clojure=/\([ \t]*defmethod[ \t]+([-[:alnum:]*+!_:\/.?]+)/\1/b,multimethod instance/ +--regex-clojure=/\([ \t]*defonce[ \t]+([-[:alnum:]*+!_:\/.?]+)/\1/c,definition (once)/ +--regex-clojure=/\([ \t]*defstruct[ \t]+([-[:alnum:]*+!_:\/.?]+)/\1/s,struct/ +--regex-clojure=/\([ \t]*intern[ \t]+([-[:alnum:]*+!_:\/.?]+)/\1/v,intern/ +--regex-clojure=/\([ \t]*ns[ \t]+([-[:alnum:]*+!_:\/.?]+)/\1/n,namespace/ ---langdef=coffee ---langmap=coffee:.coffee ---regex-coffee=/^class ([A-Za-z.]+)( extends [A-Za-z.]+)?$/\1/c,class/ ---regex-coffee=/^[ \t]*@?([A-Za-z.]+):.*[-=]>.*$/\1/f,function/ ---regex-coffee=/^[ \t]*([A-Za-z.]+)[ \t]+=.*[-=]>.*$/\1/f,function/ ---regex-coffee=/^[ \t]*([A-Za-z.]+)[ \t]+=[^->\n]*$/\1/v,variable/ +--langdef=CoffeeScript +--langmap=CoffeeScript:.coffee +--regex-coffeescript=/^class ([A-Za-z.]+)( extends [A-Za-z.]+)?$/\1/c,class/ +--regex-coffeescript=/^[ \t]*@?([A-Za-z.]+):.*[-=]>.*$/\1/f,function/ +--regex-coffeescript=/^[ \t]*([A-Za-z.]+)[ \t]+=.*[-=]>.*$/\1/f,function/ +--regex-coffeescript=/^[ \t]*([A-Za-z.]+)[ \t]+=[^->\n]*$/\1/v,variable/ + +--regex-javascript=/([A-Za-z0-9._$]+)[ \t]*[:=][ \t]*\{/\1/,object/ +--regex-javascript=/([A-Za-z0-9._$()]+)[ \t]*[:=][ \t]*function[ \t]*\(/\1/,function/ +--regex-javascript=/function[ \t]+([A-Za-z0-9._$]+)[ \t]*\(([^)])\)/\1/,function/ +--regex-javascript=/([A-Za-z0-9._$]+)[ \t]*[:=][ \t]*\[/\1/,array/ +--regex-javascript=/([^= ]+)[ \t]*=[ \t]*[^"]'[^']*/\1/,string/ +--regex-javascript=/([^= ]+)[ \t]*=[ \t]*[^']"[^"]*/\1/,string/ + +--exclude=*.min.js +--exclude=.git From b688e8945be98552a21a98707b0665c740c1de1d Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Fri, 7 Aug 2015 15:18:26 +1000 Subject: [PATCH 094/234] Extract out prompt function so the prompt can be overridden and extended --- shells/zsh/lib/prompt.zsh | 51 +++++++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 21 deletions(-) diff --git a/shells/zsh/lib/prompt.zsh b/shells/zsh/lib/prompt.zsh index 22c643b2..e2df8033 100644 --- a/shells/zsh/lib/prompt.zsh +++ b/shells/zsh/lib/prompt.zsh @@ -91,26 +91,35 @@ function prompt_pwd_new() { echo "$path" } -function precmd { - vcs_info - - local cwd="$pr_blue`prompt_pwd`$pr_reset" - local char="%0(?.$pr_green.$pr_red)♪$pr_reset" - # local time="$pr_grey⌚ %*$pr_reset" - - local ruby - ruby="$(current_ruby)" - [ "x$ruby" != "x" ] && ruby="❖ $ruby" - - local rev="$pr_grey$vcs_info_msg_0_$pr_reset" - rev="${rev/\(git\)/±}" - rev="${rev/\(hg\)/☿}" - rev="${rev/\(svn\)/↯}" - - local left right - left=($(user_at_host) $cwd $char) - right=($rev $ruby $time) +function default_precmd { + if [ -z $INSIDE_EMACS ]; then + vcs_info + + local cwd="$pr_blue`prompt_pwd`$pr_reset" + local char="%0(?.$pr_green.$pr_red)♪$pr_reset" + # local time="$pr_grey⌚ %*$pr_reset" + + local ruby + ruby="$(current_ruby)" + [ "x$ruby" != "x" ] && ruby="❖ $ruby" + + local rev="$pr_grey$vcs_info_msg_0_$pr_reset" + rev="${rev/\(git\)/±}" + rev="${rev/\(hg\)/☿}" + rev="${rev/\(svn\)/↯}" + + local left right + left=($(user_at_host) $cwd $char) + right=($rev $ruby $time) + + PS1="$left " + RPS1=" $right" + else + PS1="$ " + RPS1="" + fi +} - PS1="$left " - RPS1=" $right" +function precmd { + default_precmd } From 19a0564b00a7c6af4761c7ee1191de3ff955d344 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Fri, 7 Aug 2015 15:19:00 +1000 Subject: [PATCH 095/234] latest --- editors/emacs/spacemacs | 3 +++ editors/vim/bundle/neobundle.vim | 2 +- install.yml | 1 + languages/ruby/rspec | 2 ++ vcs/git/gitconfig | 16 ++++++++++++++-- 5 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 languages/ruby/rspec diff --git a/editors/emacs/spacemacs b/editors/emacs/spacemacs index 74ebf397..bf756618 100644 --- a/editors/emacs/spacemacs +++ b/editors/emacs/spacemacs @@ -49,6 +49,8 @@ dotspacemacs-additional-packages '( yaml-mode + haml-mode + gitconfig ansi-color ) ;; A list of packages and/or extensions that will not be install and loaded. @@ -205,6 +207,7 @@ layers configuration." '(ahs-idle-timer 0 t) '(ahs-inhibit-face-list nil) '(paradox-github-token t) + '(projectile-use-git-grep t) '(ring-bell-function (quote ignore) t)) (custom-set-faces ;; custom-set-faces was added by Custom. diff --git a/editors/vim/bundle/neobundle.vim b/editors/vim/bundle/neobundle.vim index 2fda048c..538ca07a 160000 --- a/editors/vim/bundle/neobundle.vim +++ b/editors/vim/bundle/neobundle.vim @@ -1 +1 @@ -Subproject commit 2fda048ce43d0540e88f2763629713c6f9151473 +Subproject commit 538ca07acd4217e79d130809c8c7e2df15449adc diff --git a/install.yml b/install.yml index ba5e147d..b94ab1be 100644 --- a/install.yml +++ b/install.yml @@ -9,6 +9,7 @@ languages/ruby/irbrc: ~/.irbrc languages/ruby/rdebugrc: ~/.rdebugrc languages/ruby/railsrc: ~/.railsrc + languages/ruby/rspec: ~/.rspec misc/ackrc: ~/.ackrc misc/ctags: ~/.ctags misc/inputrc: ~/.inputrc diff --git a/languages/ruby/rspec b/languages/ruby/rspec new file mode 100644 index 00000000..fdd4d9d8 --- /dev/null +++ b/languages/ruby/rspec @@ -0,0 +1,2 @@ +--color +--order rand diff --git a/vcs/git/gitconfig b/vcs/git/gitconfig index 6b9b1e03..6526edaf 100644 --- a/vcs/git/gitconfig +++ b/vcs/git/gitconfig @@ -1,5 +1,5 @@ [alias] - st = status -s -b + st = status pl = pull --rebase p = push co = checkout @@ -73,6 +73,18 @@ [heroku] account = heroku [push] - default = simple + default = current [advice] statusHints = false +[remote] + pushdefault = origin +[status] + short = true + branch = true + showUntrackedFiles = all + submoduleSummary = 1 +[versionsort] + prereleaseSuffix = -rc + prereleaseSuffix = -pre + prereleaseSuffix = -alpha + prereleaseSuffix = -beta From 78403a268fdaf1d8f882c8d555ad7e750b448a81 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Fri, 7 Aug 2015 15:22:42 +1000 Subject: [PATCH 096/234] lein stuff --- languages/clojure/lein/profiles.clj | 31 +++++++++++++++-------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/languages/clojure/lein/profiles.clj b/languages/clojure/lein/profiles.clj index 73fc3154..c7e71da4 100644 --- a/languages/clojure/lein/profiles.clj +++ b/languages/clojure/lein/profiles.clj @@ -1,17 +1,18 @@ -{:user {:plugins [[lein-beanstalk "0.2.7"] - [lein-light "0.0.44"] - [lein-marginalia "0.7.1"] - [cider/cider-nrepl "0.7.0-SNAPSHOT"] +{:user {:plugins [;[lein-beanstalk "0.2.7"] + ;[lein-marginalia "0.7.1"] + [cider/cider-nrepl "0.10.0-SNAPSHOT"] + [refactor-nrepl "0.3.0-SNAPSHOT"] [lein-clojars "0.9.1"] - [lein-ancient "0.5.5"] + [lein-ancient "0.6.7"] [lein-depgraph "0.1.0"] - [lein-pprint "1.1.1"] - [lein-ring "0.8.10"]] - :dependencies [[io.aviso/pretty "0.1.11"] - [alembic "0.2.1"]] - :repl-options {:nrepl-middleware [io.aviso.nrepl/pretty-middleware]} - :injections [#_(let [orig (ns-resolve (doto 'clojure.stacktrace require) - 'print-cause-trace) - new (ns-resolve (doto 'clj-stacktrace.repl require) - 'pst)] - (alter-var-root orig (constantly @new)))]}} + [lein-pprint "1.1.2"] + [lein-ring "0.9.6"]] + :dependencies [[io.aviso/pretty "0.1.18"] + [alembic "0.3.2"] + [org.clojure/tools.nrepl "0.2.10"] + [clj-stacktrace "0.2.8"]] + :repl-options {:skip-default-intro true} + :global-vars {*print-length* 103 + *print-level* 15} + :injections [(require 'io.aviso.repl) + (io.aviso.repl/install-pretty-exceptions)]}} From cb10d2e72324af6fc5729c8e9912b9255f8f65a5 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Tue, 11 Aug 2015 17:54:41 +1000 Subject: [PATCH 097/234] Add Karabiner config --- Rakefile | 2 +- install.yml | 1 + karabiner-ref.xml | 4 ++ karabiner.xml | 112 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 118 insertions(+), 1 deletion(-) create mode 100644 karabiner-ref.xml create mode 100644 karabiner.xml diff --git a/Rakefile b/Rakefile index b67fbb98..a20f1b05 100644 --- a/Rakefile +++ b/Rakefile @@ -16,5 +16,5 @@ task :install do plan = YAML.load_file(File.expand_path("install.yml", dot_files)) install.call plan[:link], %w[ln -sinF] - install.call plan[:copy], %w[cp -n] + install.call plan[:copy], %w[cp -i] end diff --git a/install.yml b/install.yml index b94ab1be..979dd4b6 100644 --- a/install.yml +++ b/install.yml @@ -31,3 +31,4 @@ vcs/hg/hgrc: ~/.hgrc :copy: vcs/git/gitconfig.local: ~/.gitconfig.local + karabiner-ref.xml: ~/Library/Application Support/Karabiner/private.xml diff --git a/karabiner-ref.xml b/karabiner-ref.xml new file mode 100644 index 00000000..7ef15aec --- /dev/null +++ b/karabiner-ref.xml @@ -0,0 +1,4 @@ + + + + diff --git a/karabiner.xml b/karabiner.xml new file mode 100644 index 00000000..8c2560ee --- /dev/null +++ b/karabiner.xml @@ -0,0 +1,112 @@ + + + YUBI_ENABLE + + + Ignore Yubikey key presses + Ideal for scenarios where you may accidentally touch the + Yubikey and output an unwanted code. This rule requires + double-pressing SHIFT_R, which enables the Yubikey for a + singe token output. + + In addition, it always allows the Yubikey to work if a text + field is in focus or if the current application is a terminal. + + private.yubikey_ignore + + + + __DoublePressModifier__ KeyCode::SHIFT_R, + + + KeyCode::SHIFT_R, + + + KeyCode::VK_LOCK_YUBI_ENABLE_FORCE_ON + + + + DeviceVendor::YUBICO + ModifierFlag::YUBI_ENABLE + + + TERMINAL + AXTextField + + __KeyToKey__ KeyCode::A, KeyCode::VK_NONE + __KeyToKey__ KeyCode::B, KeyCode::VK_NONE + __KeyToKey__ KeyCode::C, KeyCode::VK_NONE + __KeyToKey__ KeyCode::D, KeyCode::VK_NONE + __KeyToKey__ KeyCode::E, KeyCode::VK_NONE + __KeyToKey__ KeyCode::F, KeyCode::VK_NONE + __KeyToKey__ KeyCode::G, KeyCode::VK_NONE + __KeyToKey__ KeyCode::H, KeyCode::VK_NONE + __KeyToKey__ KeyCode::I, KeyCode::VK_NONE + __KeyToKey__ KeyCode::J, KeyCode::VK_NONE + __KeyToKey__ KeyCode::K, KeyCode::VK_NONE + __KeyToKey__ KeyCode::L, KeyCode::VK_NONE + __KeyToKey__ KeyCode::M, KeyCode::VK_NONE + __KeyToKey__ KeyCode::N, KeyCode::VK_NONE + __KeyToKey__ KeyCode::O, KeyCode::VK_NONE + __KeyToKey__ KeyCode::P, KeyCode::VK_NONE + __KeyToKey__ KeyCode::Q, KeyCode::VK_NONE + __KeyToKey__ KeyCode::R, KeyCode::VK_NONE + __KeyToKey__ KeyCode::S, KeyCode::VK_NONE + __KeyToKey__ KeyCode::T, KeyCode::VK_NONE + __KeyToKey__ KeyCode::U, KeyCode::VK_NONE + __KeyToKey__ KeyCode::V, KeyCode::VK_NONE + __KeyToKey__ KeyCode::W, KeyCode::VK_NONE + __KeyToKey__ KeyCode::X, KeyCode::VK_NONE + __KeyToKey__ KeyCode::Y, KeyCode::VK_NONE + __KeyToKey__ KeyCode::Z, KeyCode::VK_NONE + __KeyToKey__ KeyCode::SEMICOLON, KeyCode::VK_NONE + __KeyToKey__ KeyCode::QUOTE, KeyCode::VK_NONE + __KeyToKey__ KeyCode::TAB, KeyCode::VK_NONE + __KeyToKey__ KeyCode::RETURN, KeyCode::VK_NONE + __KeyToKey__ KeyCode::SPACE, KeyCode::VK_NONE + + + + DeviceVendor::YUBICO + ModifierFlag::YUBI_ENABLE + + + + __KeyToKey__ KeyCode::RETURN, KeyCode::RETURN, + + Option::KEYTOKEY_AFTER_KEYUP, KeyCode::VK_LOCK_YUBI_ENABLE_FORCE_OFF + + + + + + COLEMAK + com.apple.keylayout.Colemak + + + + Yubikey from Colemak to QWERTY + If the system layout is set to Colemak, remap the Yubikey + back to QWERTY so that the tokens are correct. + private.yubikey_colemak_qwerty + DeviceVendor::YUBICO + COLEMAK + __KeyToKey__ KeyCode::F, KeyCode::E + __KeyToKey__ KeyCode::P, KeyCode::R + __KeyToKey__ KeyCode::G, KeyCode::T + __KeyToKey__ KeyCode::J, KeyCode::Y + __KeyToKey__ KeyCode::L, KeyCode::U + __KeyToKey__ KeyCode::U, KeyCode::I + __KeyToKey__ KeyCode::Y, KeyCode::O + __KeyToKey__ KeyCode::SEMICOLON, KeyCode::P + __KeyToKey__ KeyCode::R, KeyCode::S + __KeyToKey__ KeyCode::S, KeyCode::D + __KeyToKey__ KeyCode::T, KeyCode::F + __KeyToKey__ KeyCode::D, KeyCode::G + __KeyToKey__ KeyCode::N, KeyCode::J + __KeyToKey__ KeyCode::E, KeyCode::K + __KeyToKey__ KeyCode::I, KeyCode::L + __KeyToKey__ KeyCode::O, KeyCode::SEMICOLON + __KeyToKey__ KeyCode::K, KeyCode::N + + From 36bd51179f0f04e4537d9914f348359b38830974 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Tue, 11 Aug 2015 18:03:52 +1000 Subject: [PATCH 098/234] Fix typo --- karabiner.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/karabiner.xml b/karabiner.xml index 8c2560ee..cfc6f38d 100644 --- a/karabiner.xml +++ b/karabiner.xml @@ -7,7 +7,7 @@ Ideal for scenarios where you may accidentally touch the Yubikey and output an unwanted code. This rule requires double-pressing SHIFT_R, which enables the Yubikey for a - singe token output. + single token output. In addition, it always allows the Yubikey to work if a text field is in focus or if the current application is a terminal. From c33f6616f710c1b4e674e0e32d0f6f9c71153fba Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Wed, 2 Sep 2015 12:33:39 +1000 Subject: [PATCH 099/234] emacs aliases for shell --- shells/common/functions.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/shells/common/functions.sh b/shells/common/functions.sh index 49c6ff2c..656a11f3 100644 --- a/shells/common/functions.sh +++ b/shells/common/functions.sh @@ -1,3 +1,18 @@ +function e() { + if [ "$#" -eq 0 ]; then + emacsclient -a '' -n -c . + else + emacsclient -a '' -n -c $@ + fi +} + +function ep() { + ( + cdr # attempt to cd to root directory; fail silently + e # open current directory using editor + ) 2>/dev/null +} + function GET() { curl -i -X GET -H "X-Requested-With: XMLHttpRequest" $* } From 0f689cdd4174de7b7ef60a8f0ad74aab54977677 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Wed, 2 Sep 2015 12:37:59 +1000 Subject: [PATCH 100/234] nvm --- shells/common/exports.sh | 2 +- shells/common/node.sh | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 shells/common/node.sh diff --git a/shells/common/exports.sh b/shells/common/exports.sh index a2d718c5..619aa71a 100644 --- a/shells/common/exports.sh +++ b/shells/common/exports.sh @@ -12,4 +12,4 @@ export HISTSIZE=1000000 export HISTIGNORE="clear:bg:fg:cd:cd -:exit:date:w:* --help" export GOPATH="$HOME/Code/Go" -PATH="./node_modules/.bin:$PATH:$GOPATH/bin" +PATH="$PATH:$GOPATH/bin" diff --git a/shells/common/node.sh b/shells/common/node.sh new file mode 100644 index 00000000..48eaae1d --- /dev/null +++ b/shells/common/node.sh @@ -0,0 +1,3 @@ +PATH="./node_modules/.bin:$PATH" +export NVM_DIR=~/.nvm +source $(brew --prefix nvm)/nvm.sh From 1ef0ecc57efabcc2fc73882dc874eff3bca75841 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sat, 5 Sep 2015 22:36:45 +1000 Subject: [PATCH 101/234] Latest spacemacs config --- editors/emacs/spacemacs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/editors/emacs/spacemacs b/editors/emacs/spacemacs index bf756618..01eb16f2 100644 --- a/editors/emacs/spacemacs +++ b/editors/emacs/spacemacs @@ -20,6 +20,7 @@ auto-completion better-defaults clojure + javascript colors dash emacs-lisp @@ -34,25 +35,24 @@ rust smex sql + html ;; org (shell :variables shell-default-height 30 shell-default-position 'bottom shell-default-term-shell "/usr/local/bin/zsh") syntax-checking - version-control - ) + version-control) ;; List of additional packages that will be installed without being ;; wrapped in a layer. If you need some configuration for these ;; packages then consider to create a layer, you can also put the ;; configuration in `dotspacemacs/config'. dotspacemacs-additional-packages - '( - yaml-mode + '(yaml-mode haml-mode gitconfig ansi-color - ) + aggressive-indent) ;; A list of packages and/or extensions that will not be install and loaded. dotspacemacs-excluded-packages '() ;; If non-nil spacemacs will delete any orphan packages, i.e. packages that @@ -91,7 +91,8 @@ before layers configuration." dotspacemacs-colorize-cursor-according-to-state t ;; Default font. `powerline-scale' allows to quickly tweak the mode-line ;; size to make separators look not too crappy. - dotspacemacs-default-font '("Source Code Pro" + dotspacemacs-default-font '(;"Source Code Pro" + "Inconsolata" :size 13 :weight normal :width normal @@ -147,13 +148,13 @@ before layers configuration." ;; Transparency can be toggled through `toggle-transparency'. dotspacemacs-inactive-transparency 90 ;; If non nil unicode symbols are displayed in the mode line. - dotspacemacs-mode-line-unicode-symbols t + dotspacemacs-mode-line-unicode-symbols nil ;; If non nil smooth scrolling (native-scrolling) is enabled. Smooth ;; scrolling overrides the default behavior of Emacs which recenters the ;; point when it reaches the top or bottom of the screen. dotspacemacs-smooth-scrolling t ;; If non-nil smartparens-strict-mode will be enabled in programming modes. - dotspacemacs-smartparens-strict-mode nil + dotspacemacs-smartparens-strict-mode t ;; Select a scope to highlight delimiters. Possible value is `all', ;; `current' or `nil'. Default is `all' dotspacemacs-highlight-delimiters 'all @@ -180,6 +181,7 @@ layers configuration." (setq clojure-enable-fancify-symbols t) (add-hook 'prog-mode-hook 'linum-mode) + (add-hook 'prog-mode-hook 'aggressive-indent-mode) ;; Load shell for commands (e.g. *compilation* buffers) so that correct ;; environment (chruby, etc) is sourced From bab84a1fa0883cdd84e0268dde0c04ea187a6a35 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sat, 5 Sep 2015 23:47:12 +1000 Subject: [PATCH 102/234] Use stable CIDER and clj refactor --- editors/emacs/spacemacs | 8 ++++++++ languages/clojure/lein/profiles.clj | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/editors/emacs/spacemacs b/editors/emacs/spacemacs index 01eb16f2..b34eebf7 100644 --- a/editors/emacs/spacemacs +++ b/editors/emacs/spacemacs @@ -171,6 +171,14 @@ before layers configuration." ruby-version-manager 'chruby ) ;; User initialization goes here + + (add-to-list 'package-archives '("melpa-stable" . "http://stable.melpa.org/packages/")) + + (add-to-list 'package-pinned-packages '(cider . "melpa-stable") t) + (add-to-list 'package-pinned-packages '(clj-refactor . "melpa-stable") t) + (add-to-list 'package-pinned-packages '(cljr-helm . "melpa-stable") t) + (add-to-list 'package-pinned-packages '(ac-cider . "melpa-stable") t) + (add-to-list 'package-pinned-packages '(projectile . "melpa-stable") t) ) (defun dotspacemacs/config () diff --git a/languages/clojure/lein/profiles.clj b/languages/clojure/lein/profiles.clj index c7e71da4..2cde826e 100644 --- a/languages/clojure/lein/profiles.clj +++ b/languages/clojure/lein/profiles.clj @@ -1,7 +1,7 @@ {:user {:plugins [;[lein-beanstalk "0.2.7"] ;[lein-marginalia "0.7.1"] - [cider/cider-nrepl "0.10.0-SNAPSHOT"] - [refactor-nrepl "0.3.0-SNAPSHOT"] + [cider/cider-nrepl "0.9.1"] + [refactor-nrepl "1.1.0"] [lein-clojars "0.9.1"] [lein-ancient "0.6.7"] [lein-depgraph "0.1.0"] From 3f7b3046830ad274e632d99640d79abf2da24e50 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sat, 10 Oct 2015 15:06:55 +1100 Subject: [PATCH 103/234] emacs stuff --- editors/emacs/spacemacs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/editors/emacs/spacemacs b/editors/emacs/spacemacs index b34eebf7..63dc39bc 100644 --- a/editors/emacs/spacemacs +++ b/editors/emacs/spacemacs @@ -36,7 +36,7 @@ smex sql html - ;; org + org (shell :variables shell-default-height 30 shell-default-position 'bottom @@ -134,7 +134,7 @@ before layers configuration." dotspacemacs-fullscreen-at-startup nil ;; If non nil `spacemacs/toggle-fullscreen' will not use native fullscreen. ;; Use to disable fullscreen animations in OSX." - dotspacemacs-fullscreen-use-non-native nil + dotspacemacs-fullscreen-use-non-native t ;; If non nil the frame is maximized when Emacs starts up. ;; Takes effect only if `dotspacemacs-fullscreen-at-startup' is nil. ;; (Emacs 24.4+ only) @@ -216,9 +216,19 @@ layers configuration." '(ahs-idle-interval 0.25) '(ahs-idle-timer 0 t) '(ahs-inhibit-face-list nil) + '(org-babel-process-comment-text (quote org-babel-trim)) + '(org-export-babel-evaluate (quote inline-only)) '(paradox-github-token t) '(projectile-use-git-grep t) - '(ring-bell-function (quote ignore) t)) + '(ring-bell-function (quote ignore) t) + '(safe-local-variable-values + (quote + ((org-babel-clojure-backend + (quote cider)) + (org-export-htmlize-output-type + (quote css)) + (org-export-html-style-include-default) + (org-export-html-style-include-scripts))))) (custom-set-faces ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. From 5f7aad984d6b1febef6bb0e83dfe4ef4fc8e3360 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sat, 10 Oct 2015 15:07:27 +1100 Subject: [PATCH 104/234] Make yubikey shortcut toggle instead of turn on --- karabiner.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/karabiner.xml b/karabiner.xml index cfc6f38d..f2f9c7a4 100644 --- a/karabiner.xml +++ b/karabiner.xml @@ -22,7 +22,7 @@ KeyCode::SHIFT_R, - KeyCode::VK_LOCK_YUBI_ENABLE_FORCE_ON + KeyCode::VK_LOCK_YUBI_ENABLE From 5fa187a072f20d4d8eacb85aa6bde79ae2e8a0c2 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sat, 10 Oct 2015 15:07:44 +1100 Subject: [PATCH 105/234] Add rule to force an external apple keyboard to QWERTY Useful for pairing... --- karabiner.xml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/karabiner.xml b/karabiner.xml index f2f9c7a4..0475b473 100644 --- a/karabiner.xml +++ b/karabiner.xml @@ -109,4 +109,31 @@ __KeyToKey__ KeyCode::O, KeyCode::SEMICOLON __KeyToKey__ KeyCode::K, KeyCode::N + + + Apple keyboard from Colemak to QWERTY + If the system layout is set to Colemak, remap the Yubikey + back to QWERTY so that the tokens are correct. + private.apple_colemak_qwerty + DeviceVendor::APPLE_INC, DeviceProduct::APPLE_EXTERNAL_KEYBOARD_0x021d + COLEMAK + __KeyToKey__ KeyCode::F, KeyCode::E + __KeyToKey__ KeyCode::P, KeyCode::R + __KeyToKey__ KeyCode::G, KeyCode::T + __KeyToKey__ KeyCode::J, KeyCode::Y + __KeyToKey__ KeyCode::L, KeyCode::U + __KeyToKey__ KeyCode::U, KeyCode::I + __KeyToKey__ KeyCode::Y, KeyCode::O + __KeyToKey__ KeyCode::SEMICOLON, KeyCode::P + __KeyToKey__ KeyCode::R, KeyCode::S + __KeyToKey__ KeyCode::S, KeyCode::D + __KeyToKey__ KeyCode::T, KeyCode::F + __KeyToKey__ KeyCode::D, KeyCode::G + __KeyToKey__ KeyCode::N, KeyCode::J + __KeyToKey__ KeyCode::E, KeyCode::K + __KeyToKey__ KeyCode::I, KeyCode::L + __KeyToKey__ KeyCode::O, KeyCode::SEMICOLON + __KeyToKey__ KeyCode::K, KeyCode::N + + From 1be158e9e55f2ade2724dbe630b13d64c11fffb5 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sat, 10 Oct 2015 15:08:46 +1100 Subject: [PATCH 106/234] gitignores --- vcs/git/gitignore | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/vcs/git/gitignore b/vcs/git/gitignore index 669b70e1..1a93759d 100755 --- a/vcs/git/gitignore +++ b/vcs/git/gitignore @@ -58,3 +58,13 @@ doc/tags ./node_modules node_modules TAGS +.nrepl-port +pom.xml +pom.xml.asc +*jar +/lib/ +/classes/ +/target/ +/checkouts/ +.lein-* +vendor/gems From bd2981a4aabf42f28919423779c12d8e5ec51f71 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sat, 10 Oct 2015 15:09:00 +1100 Subject: [PATCH 107/234] Just disable auto-tmux stuff for now --- shells/tmux.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shells/tmux.sh b/shells/tmux.sh index 29e0422b..db9cd7ec 100644 --- a/shells/tmux.sh +++ b/shells/tmux.sh @@ -6,7 +6,7 @@ # windows but be looking at different ones individually # If we aren't in Tmux or emacs, set it up -if [ -z "$TMUX" -a -z "$INSIDE_EMACS" ]; then +if false && [ -z "$TMUX" -a -z "$INSIDE_EMACS" -a -z "$EMACS" ]; then if tty >/dev/null; then if which tmux 2>&1 >/dev/null; then if [ -z "$(tmux ls | grep 'login:')" ]; then From 7082d2d91024c8615b62e6dffe343bca5bb2c69e Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Mon, 4 Jul 2016 17:36:25 +1000 Subject: [PATCH 108/234] Get rid of powerline submodule --- .gitmodules | 6 - editors/vim/bundle/neobundle.vim | 1 - powerline/colors.json | 110 --------------- powerline/colorschemes/ipython/default.json | 8 -- powerline/colorschemes/shell/default.json | 18 --- powerline/colorschemes/shell/solarized.json | 18 --- powerline/colorschemes/tmux/default.json | 27 ---- powerline/colorschemes/vim/default.json | 100 -------------- powerline/colorschemes/vim/solarized.json | 97 -------------- powerline/colorschemes/wm/default.json | 26 ---- powerline/config.json | 53 -------- powerline/themes/ipython/in.json | 26 ---- powerline/themes/ipython/in2.json | 13 -- powerline/themes/ipython/out.json | 25 ---- powerline/themes/ipython/rewrite.json | 23 ---- powerline/themes/shell/default.json | 45 ------- powerline/themes/shell/default_leftonly.json | 43 ------ powerline/themes/tmux/default.json | 46 ------- powerline/themes/vim/cmdwin.json | 18 --- powerline/themes/vim/default.json | 126 ------------------ powerline/themes/vim/help.json | 36 ----- powerline/themes/vim/plugin/ctrlp.json | 28 ---- .../themes/vim/plugin/gundo-preview.json | 19 --- powerline/themes/vim/plugin/gundo.json | 19 --- powerline/themes/vim/plugin/nerdtree.json | 17 --- powerline/themes/vim/quickfix.json | 37 ----- powerline/themes/wm/default.json | 31 ----- vendor/powerline | 1 - 28 files changed, 1017 deletions(-) delete mode 160000 editors/vim/bundle/neobundle.vim delete mode 100644 powerline/colors.json delete mode 100644 powerline/colorschemes/ipython/default.json delete mode 100644 powerline/colorschemes/shell/default.json delete mode 100644 powerline/colorschemes/shell/solarized.json delete mode 100644 powerline/colorschemes/tmux/default.json delete mode 100644 powerline/colorschemes/vim/default.json delete mode 100644 powerline/colorschemes/vim/solarized.json delete mode 100644 powerline/colorschemes/wm/default.json delete mode 100644 powerline/config.json delete mode 100644 powerline/themes/ipython/in.json delete mode 100644 powerline/themes/ipython/in2.json delete mode 100644 powerline/themes/ipython/out.json delete mode 100644 powerline/themes/ipython/rewrite.json delete mode 100644 powerline/themes/shell/default.json delete mode 100644 powerline/themes/shell/default_leftonly.json delete mode 100644 powerline/themes/tmux/default.json delete mode 100644 powerline/themes/vim/cmdwin.json delete mode 100644 powerline/themes/vim/default.json delete mode 100644 powerline/themes/vim/help.json delete mode 100644 powerline/themes/vim/plugin/ctrlp.json delete mode 100644 powerline/themes/vim/plugin/gundo-preview.json delete mode 100644 powerline/themes/vim/plugin/gundo.json delete mode 100644 powerline/themes/vim/plugin/nerdtree.json delete mode 100644 powerline/themes/vim/quickfix.json delete mode 100644 powerline/themes/wm/default.json delete mode 160000 vendor/powerline diff --git a/.gitmodules b/.gitmodules index ea911ebe..6fea3454 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,9 +1,3 @@ -[submodule "editors/vim/bundle/neobundle.vim"] - path = editors/vim/bundle/neobundle.vim - url = git://github.com/Shougo/neobundle.vim -[submodule "vendor/powerline"] - path = vendor/powerline - url = git://github.com/Lokaltog/powerline.git [submodule "shells/zsh/lib/syntax-highlighting"] path = shells/zsh/lib/syntax-highlighting url = git://github.com/zsh-users/zsh-syntax-highlighting.git diff --git a/editors/vim/bundle/neobundle.vim b/editors/vim/bundle/neobundle.vim deleted file mode 160000 index 538ca07a..00000000 --- a/editors/vim/bundle/neobundle.vim +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 538ca07acd4217e79d130809c8c7e2df15449adc diff --git a/powerline/colors.json b/powerline/colors.json deleted file mode 100644 index 5b8a7645..00000000 --- a/powerline/colors.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "colors": { - "black": 16, - "white": 231, - - "darkestgreen": 22, - "darkgreen": 28, - "mediumgreen": 70, - "brightgreen": 148, - - "darkestcyan": 23, - "darkcyan": 74, - "mediumcyan": 117, - "brightcyan": 159, - - "darkestblue": 24, - "darkblue": 31, - - "darkestred": 52, - "darkred": 88, - "mediumred": 124, - "brightred": 160, - "brightestred": 196, - - "darkestpurple": 55, - "mediumpurple": 98, - "brightpurple": 189, - - "darkorange": 94, - "mediumorange": 166, - "brightorange": 208, - "brightestorange": 214, - - "brightyellow": 220, - - "gray0": 233, - "gray1": 235, - "gray2": 236, - "gray3": 239, - "gray4": 240, - "gray5": 241, - "gray6": 244, - "gray7": 245, - "gray8": 247, - "gray9": 250, - "gray10": 252, - - "gray61": [14, "93a1a1"], - "gray13": [8, "002b36"], - - "royalblue5": [0, "073642"], - "darkgreencopper": [10, "586e75"], - "lightskyblue4": [11, "657b83"], - "azure4": [12, "839496"], - "lightyellow": [7, "eee8d5"], - "oldlace": [15, "fdf6e3"], - - "green": [2, "719e07"], - "cyan": [6, "2aa198"], - "blue": [4, "268bd2"], - "red": [1, "dc322f"], - "magenta": [5, "d33682"], - "violet": [13, "6c71c4"], - "orange": [9, "cb4b16"], - "yellow": [3, "b58900"], - - "lightyellowgreen": 106, - "gold3": 178, - "orangered": 202, - - "steelblue": 67, - "darkorange3": 166, - "skyblue1": 117, - "khaki1": 228 - }, - "gradients": { - "dark_GREEN_Orange_red": [ - [22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 94, 94, 94, 94, 94, 94, 94, 52], - ["005f00", "015f00", "025f00", "035f00", "045f00", "055f00", "065f00", "075f00", "085f00", "095f00", "0b5f00", "0c5f00", "0d5f00", "0e5f00", "0f5f00", "105f00", "115f00", "125f00", "135f00", "145f00", "165f00", "175f00", "185f00", "195f00", "1a5f00", "1b5f00", "1c5f00", "1d5f00", "1e5f00", "1f5f00", "215f00", "225f00", "235f00", "245f00", "255f00", "265f00", "275f00", "285f00", "295f00", "2a5f00", "2c5f00", "2d5f00", "2e5f00", "2f5f00", "305f00", "315f00", "325f00", "335f00", "345f00", "355f00", "375f00", "385f00", "395f00", "3a5f00", "3b5f00", "3c5f00", "3d5f00", "3e5f00", "3f5f00", "415f00", "425f00", "435f00", "445f00", "455f00", "465f00", "475f00", "485f00", "495f00", "4a5f00", "4c5f00", "4d5f00", "4e5f00", "4f5f00", "505f00", "515f00", "525f00", "535f00", "545f00", "555f00", "575f00", "585f00", "595f00", "5a5f00", "5b5f00", "5c5f00", "5d5f00", "5e5f00", "615f00", "655f00", "685f00", "6c5f00", "6f5f00", "735f00", "765f00", "7a5f00", "7d5f00", "815f00", "845f00", "815200", "702900"] - ], - "GREEN_Orange_red": [ - [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1], - ["005f00", "015f00", "025f00", "035f00", "045f00", "055f00", "065f00", "075f00", "085f00", "095f00", "0b5f00", "0c5f00", "0d5f00", "0e5f00", "0f5f00", "105f00", "115f00", "125f00", "135f00", "145f00", "165f00", "175f00", "185f00", "195f00", "1a5f00", "1b5f00", "1c5f00", "1d5f00", "1e5f00", "1f5f00", "215f00", "225f00", "235f00", "245f00", "255f00", "265f00", "275f00", "285f00", "295f00", "2a5f00", "2c5f00", "2d5f00", "2e5f00", "2f5f00", "305f00", "315f00", "325f00", "335f00", "345f00", "355f00", "375f00", "385f00", "395f00", "3a5f00", "3b5f00", "3c5f00", "3d5f00", "3e5f00", "3f5f00", "415f00", "425f00", "435f00", "445f00", "455f00", "465f00", "475f00", "485f00", "495f00", "4a5f00", "4c5f00", "4d5f00", "4e5f00", "4f5f00", "505f00", "515f00", "525f00", "535f00", "545f00", "555f00", "575f00", "585f00", "595f00", "5a5f00", "5b5f00", "5c5f00", "5d5f00", "5e5f00", "615f00", "655f00", "685f00", "6c5f00", "6f5f00", "735f00", "765f00", "7a5f00", "7d5f00", "815f00", "845f00", "815200", "702900"] - ], - "green_yellow_red": [ - [190, 184, 178, 172, 166, 160], - ["8ae71c", "8ce71c", "8fe71c", "92e71c", "95e71d", "98e71d", "9ae71d", "9de71d", "a0e71e", "a3e71e", "a6e71e", "a8e71e", "abe71f", "aee71f", "b1e71f", "b4e71f", "b6e720", "b9e720", "bce720", "bfe720", "c2e821", "c3e721", "c5e621", "c7e521", "c9e522", "cbe422", "cde322", "cfe222", "d1e223", "d3e123", "d5e023", "d7df23", "d9df24", "dbde24", "dddd24", "dfdc24", "e1dc25", "e3db25", "e5da25", "e7d925", "e9d926", "e9d626", "e9d426", "e9d126", "e9cf27", "e9cc27", "e9ca27", "e9c727", "e9c528", "e9c228", "e9c028", "e9bd28", "e9bb29", "e9b829", "e9b629", "e9b329", "e9b12a", "e9ae2a", "e9ac2a", "e9a92a", "eaa72b", "eaa42b", "eaa22b", "ea9f2b", "ea9d2c", "ea9b2c", "ea982c", "ea962c", "ea942d", "ea912d", "ea8f2d", "ea8d2d", "ea8a2e", "ea882e", "ea862e", "ea832e", "ea812f", "ea7f2f", "ea7c2f", "ea7a2f", "eb7830", "eb7530", "eb7330", "eb7130", "eb6f31", "eb6c31", "eb6a31", "eb6831", "eb6632", "eb6332", "eb6132", "eb5f32", "eb5d33", "eb5a33", "eb5833", "eb5633", "eb5434", "eb5134", "eb4f34", "eb4d34", "ec4b35"] - ], - "green_yellow_orange_red": [ - [2, 3, 9, 1], - ["719e07", "739d06", "759c06", "779c06", "799b06", "7b9a05", "7d9a05", "7f9905", "819805", "839805", "859704", "879704", "899604", "8b9504", "8d9504", "8f9403", "919303", "949303", "969203", "989102", "9a9102", "9c9002", "9e9002", "a08f02", "a28e01", "a48e01", "a68d01", "a88c01", "aa8c01", "ac8b00", "ae8a00", "b08a00", "b28900", "b58900", "b58700", "b68501", "b78302", "b78102", "b87f03", "b97d04", "b97b04", "ba7905", "bb7806", "bb7606", "bc7407", "bd7208", "bd7008", "be6e09", "bf6c0a", "bf6a0a", "c0690b", "c1670c", "c1650c", "c2630d", "c3610e", "c35f0e", "c45d0f", "c55b10", "c55a10", "c65811", "c75612", "c75412", "c85213", "c95014", "c94e14", "ca4c15", "cb4b16", "cb4a16", "cc4917", "cc4818", "cd4719", "cd4719", "ce461a", "ce451b", "cf441c", "cf441c", "d0431d", "d0421e", "d1411f", "d1411f", "d24020", "d23f21", "d33e22", "d33e22", "d43d23", "d43c24", "d53b25", "d53b25", "d63a26", "d63927", "d73828", "d73828", "d83729", "d8362a", "d9352b", "d9352b", "da342c", "da332d", "db322e", "dc322f"] - ], - "yellow_red": [ - [220, 178, 172, 166, 160], - ["ffd700", "fdd500", "fbd300", "fad200", "f8d000", "f7cf00", "f5cd00", "f3cb00", "f2ca00", "f0c800", "efc700", "edc500", "ebc300", "eac200", "e8c000", "e7bf00", "e5bd00", "e3bb00", "e2ba00", "e0b800", "dfb700", "ddb500", "dbb300", "dab200", "d8b000", "d7af00", "d7ad00", "d7ab00", "d7aa00", "d7a800", "d7a700", "d7a500", "d7a300", "d7a200", "d7a000", "d79f00", "d79d00", "d79b00", "d79a00", "d79800", "d79700", "d79500", "d79300", "d79200", "d79000", "d78f00", "d78d00", "d78b00", "d78a00", "d78800", "d78700", "d78500", "d78300", "d78200", "d78000", "d77f00", "d77d00", "d77b00", "d77a00", "d77800", "d77700", "d77500", "d77300", "d77200", "d77000", "d76f00", "d76d00", "d76b00", "d76a00", "d76800", "d76700", "d76500", "d76300", "d76200", "d76000", "d75f00", "d75b00", "d75700", "d75300", "d74f00", "d74c00", "d74800", "d74400", "d74000", "d73c00", "d73900", "d73500", "d73100", "d72d00", "d72900", "d72600", "d72200", "d71e00", "d71a00", "d71600", "d71300", "d70f00", "d70b00", "d70700"] - ], - "yellow_orange_red": [ - [3, 9, 1], - ["b58900", "b58700", "b58600", "b68501", "b68401", "b78202", "b78102", "b88003", "b87f03", "b87d03", "b97c04", "b97b04", "ba7a05", "ba7805", "bb7706", "bb7606", "bc7507", "bc7307", "bc7207", "bd7108", "bd7008", "be6e09", "be6d09", "bf6c0a", "bf6b0a", "c06a0b", "c0680b", "c0670b", "c1660c", "c1650c", "c2630d", "c2620d", "c3610e", "c3600e", "c35e0e", "c45d0f", "c45c0f", "c55b10", "c55910", "c65811", "c65711", "c75612", "c75412", "c75312", "c85213", "c85113", "c94f14", "c94e14", "ca4d15", "ca4c15", "cb4b16", "cb4a16", "cb4a17", "cc4917", "cc4918", "cc4818", "cd4819", "cd4719", "cd471a", "ce461a", "ce461b", "ce451b", "cf451c", "cf441c", "cf441d", "d0431d", "d0431e", "d0421e", "d1421f", "d1411f", "d14120", "d24020", "d24021", "d23f21", "d33f22", "d33e22", "d33e23", "d43d23", "d43d24", "d43c24", "d53c25", "d53b25", "d53b26", "d63a26", "d63a27", "d63927", "d73928", "d73828", "d73829", "d83729", "d8372a", "d8362a", "d9362b", "d9352b", "d9352c", "da342c", "da342d", "da332d", "db332e"] - ], - "blue_red": [ - [39, 74, 68, 67, 103, 97, 96, 132, 131, 167, 203, 197], - ["19b4fe", "1bb2fc", "1db1fa", "1faff8", "22aef6", "24adf4", "26abf2", "29aaf0", "2ba9ee", "2da7ec", "30a6ea", "32a5e8", "34a3e6", "36a2e4", "39a0e2", "3b9fe1", "3d9edf", "409cdd", "429bdb", "449ad9", "4798d7", "4997d5", "4b96d3", "4d94d1", "5093cf", "5292cd", "5490cb", "578fc9", "598dc7", "5b8cc6", "5e8bc4", "6089c2", "6288c0", "6487be", "6785bc", "6984ba", "6b83b8", "6e81b6", "7080b4", "727eb2", "757db0", "777cae", "797aac", "7b79ab", "7e78a9", "8076a7", "8275a5", "8574a3", "8772a1", "89719f", "8c709d", "8e6e9b", "906d99", "926b97", "956a95", "976993", "996791", "9c668f", "9e658e", "a0638c", "a3628a", "a56188", "a75f86", "a95e84", "ac5c82", "ae5b80", "b05a7e", "b3587c", "b5577a", "b75678", "ba5476", "bc5374", "be5273", "c05071", "c34f6f", "c54e6d", "c74c6b", "ca4b69", "cc4967", "ce4865", "d14763", "d34561", "d5445f", "d7435d", "da415b", "dc4059", "de3f58", "e13d56", "e33c54", "e53a52", "e83950", "ea384e", "ec364c", "ee354a", "f13448", "f33246", "f53144", "f83042", "fa2e40"] - ], - "white_red": [ - [231, 223, 216, 209, 196], - ["ffffff", "fffe61", "fffcc4", "fffb28", "fff98b", "fff7ef", "fff651", "fff4b4", "fff318", "fff17b", "ffefdf", "ffee41", "ffeca4", "ffeb08", "ffe96b", "ffe7cf", "ffe631", "ffe494", "ffe2f8", "ffe15b", "ffdfbf", "ffde21", "ffdc84", "ffdae8", "ffd94b", "ffd7af", "ffd602", "ffd455", "ffd2aa", "ffd0fd", "ffcf50", "ffcda5", "ffcbf8", "ffca4b", "ffc8a0", "ffc6f3", "ffc546", "ffc39b", "ffc1ee", "ffc041", "ffbe96", "ffbce9", "ffbb3c", "ffb991", "ffb7e4", "ffb637", "ffb48c", "ffb2df", "ffb132", "ffaf87", "ffadda", "ffac2d", "ffaa82", "ffa8d5", "ffa728", "ffa57d", "ffa3d0", "ffa223", "ffa078", "ff9ecb", "ff9d1e", "ff9b73", "ff99c6", "ff9819", "ff966e", "ff94c1", "ff9314", "ff9169", "ff8fbc", "ff8e0f", "ff8c64", "ff8ab7", "ff890a", "ff875f", "ff81f4", "ff7c8a", "ff771f", "ff71b5", "ff6c4c", "ff66e1", "ff6177", "ff5c0c", "ff56a2", "ff5139", "ff4bce", "ff4664", "ff40f9", "ff3b8f", "ff3626", "ff30bb", "ff2b51", "ff25e6", "ff207c", "ff1b13", "ff15a8", "ff103e", "ff0ad3", "ff0569", "ff0000"] - ] - } -} diff --git a/powerline/colorschemes/ipython/default.json b/powerline/colorschemes/ipython/default.json deleted file mode 100644 index d7875916..00000000 --- a/powerline/colorschemes/ipython/default.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": "Default color scheme for IPython prompt", - "groups": { - "virtualenv": { "fg": "white", "bg": "darkcyan" }, - "prompt": { "fg": "gray9", "bg": "gray4" }, - "prompt_count": { "fg": "white", "bg": "gray4" } - } -} diff --git a/powerline/colorschemes/shell/default.json b/powerline/colorschemes/shell/default.json deleted file mode 100644 index 9a5c5883..00000000 --- a/powerline/colorschemes/shell/default.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name": "Default color scheme for shell prompts", - "groups": { - "user": { "fg": "white", "bg": "darkblue", "attr": ["bold"] }, - "superuser": { "fg": "white", "bg": "brightred", "attr": ["bold"] }, - "virtualenv": { "fg": "white", "bg": "darkcyan" }, - "branch": { "fg": "gray9", "bg": "gray2" }, - "branch_dirty": { "fg": "brightyellow", "bg": "gray2" }, - "branch_clean": { "fg": "gray9", "bg": "gray2" }, - "cwd": { "fg": "gray9", "bg": "gray4" }, - "cwd:current_folder": { "fg": "gray10", "bg": "gray4", "attr": ["bold"] }, - "cwd:divider": { "fg": "gray7", "bg": "gray4" }, - "hostname": { "fg": "brightyellow", "bg": "mediumorange" }, - "exit_fail": { "fg": "white", "bg": "darkestred" }, - "exit_success": { "fg": "white", "bg": "darkestgreen" }, - "environment": { "fg": "white", "bg": "darkestgreen" } - } -} diff --git a/powerline/colorschemes/shell/solarized.json b/powerline/colorschemes/shell/solarized.json deleted file mode 100644 index 70093ba7..00000000 --- a/powerline/colorschemes/shell/solarized.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name": "Solarized Dark", - "groups": { - "user": { "fg": "oldlace", "bg": "blue", "attr": ["bold"] }, - "superuser": { "fg": "oldlace", "bg": "red", "attr": ["bold"] }, - "virtualenv": { "fg": "oldlace", "bg": "green" }, - "branch": { "fg": "gray61", "bg": "royalblue5" }, - "branch_dirty": { "fg": "yellow", "bg": "royalblue5" }, - "branch_clean": { "fg": "gray61", "bg": "royalblue5" }, - "cwd": { "fg": "lightyellow", "bg": "darkgreencopper" }, - "cwd:current_folder": { "fg": "oldlace", "bg": "darkgreencopper", "attr": ["bold"] }, - "cwd:divider": { "fg": "gray61", "bg": "darkgreencopper" }, - "hostname": { "fg": "oldlace", "bg": "darkgreencopper" }, - "exit_fail": { "fg": "oldlace", "bg": "red" }, - "exit_success": { "fg": "oldlace", "bg": "green" }, - "environment": { "fg": "oldlace", "bg": "green" } - } -} diff --git a/powerline/colorschemes/tmux/default.json b/powerline/colorschemes/tmux/default.json deleted file mode 100644 index c7c76a47..00000000 --- a/powerline/colorschemes/tmux/default.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "name": "Default color scheme for terminal prompts", - "groups": { - "background:divider": { "fg": "gray5", "bg": "gray0" }, - "session": { "fg": "black", "bg": "gray10", "attr": ["bold"] }, - "date": { "fg": "gray8", "bg": "gray2" }, - "time": { "fg": "gray10", "bg": "gray2", "attr": ["bold"] }, - "time:divider": { "fg": "gray5", "bg": "gray2" }, - "email_alert": { "fg": "white", "bg": "brightred", "attr": ["bold"] }, - "email_alert_gradient": { "fg": "white", "bg": "yellow_orange_red", "attr": ["bold"] }, - "hostname": { "fg": "black", "bg": "gray10", "attr": ["bold"] }, - "weather": { "fg": "gray8", "bg": "gray0" }, - "weather_temp_gradient": { "fg": "blue_red", "bg": "gray0" }, - "weather_condition_hot": { "fg": "khaki1", "bg": "gray0" }, - "weather_condition_snowy": { "fg": "skyblue1", "bg": "gray0" }, - "weather_condition_rainy": { "fg": "skyblue1", "bg": "gray0" }, - "uptime": { "fg": "gray8", "bg": "gray0" }, - "external_ip": { "fg": "gray8", "bg": "gray0" }, - "network_load": { "fg": "gray8", "bg": "gray0" }, - "network_load_gradient": { "fg": "green_yellow_orange_red", "bg": "gray0" }, - "system_load": { "fg": "gray8", "bg": "gray0" }, - "system_load_gradient": { "fg": "green_yellow_orange_red", "bg": "gray0" }, - "environment": { "fg": "gray8", "bg": "gray0" }, - "battery": { "fg": "gray8", "bg": "gray0" }, - "battery_gradient": { "fg": "white_red", "bg": "gray0" } - } -} diff --git a/powerline/colorschemes/vim/default.json b/powerline/colorschemes/vim/default.json deleted file mode 100644 index 254383a1..00000000 --- a/powerline/colorschemes/vim/default.json +++ /dev/null @@ -1,100 +0,0 @@ -{ - "name": "Default color scheme", - "groups": { - "background": { "fg": "white", "bg": "gray2" }, - "background:divider": { "fg": "gray6", "bg": "gray2" }, - "mode": { "fg": "darkestgreen", "bg": "brightgreen", "attr": ["bold"] }, - "visual_range": { "fg": "brightestorange", "bg": "darkorange", "attr": ["bold"] }, - "modified_indicator": { "fg": "brightyellow", "bg": "gray4", "attr": ["bold"] }, - "paste_indicator": { "fg": "white", "bg": "mediumorange", "attr": ["bold"] }, - "readonly_indicator": { "fg": "brightestred", "bg": "gray4" }, - "branch": { "fg": "gray9", "bg": "gray4" }, - "branch_dirty": { "fg": "brightyellow", "bg": "gray4" }, - "branch_clean": { "fg": "gray9", "bg": "gray4" }, - "branch:divider": { "fg": "gray7", "bg": "gray4" }, - "file_directory": { "fg": "gray9", "bg": "gray4" }, - "file_name": { "fg": "white", "bg": "gray4", "attr": ["bold"] }, - "file_size": { "fg": "gray8", "bg": "gray2" }, - "file_name_no_file": { "fg": "gray9", "bg": "gray4", "attr": ["bold"] }, - "file_name_empty": { "fg": "gray9", "bg": "gray4" }, - "file_format": { "fg": "gray8", "bg": "gray2" }, - "file_encoding": { "fg": "gray8", "bg": "gray2" }, - "file_type": { "fg": "gray8", "bg": "gray2" }, - "file_vcs_status": { "fg": "brightestred", "bg": "gray4" }, - "file_vcs_status_M": { "fg": "brightyellow", "bg": "gray4" }, - "file_vcs_status_A": { "fg": "brightgreen", "bg": "gray4" }, - "line_percent": { "fg": "gray9", "bg": "gray4" }, - "line_percent_gradient": { "fg": "green_yellow_red", "bg": "gray4" }, - "line_current": { "fg": "gray1", "bg": "gray10", "attr": ["bold"] }, - "line_current_symbol": { "fg": "gray1", "bg": "gray10" }, - "virtcol_current_gradient": { "fg": "dark_GREEN_Orange_red", "bg": "gray10" }, - "col_current": { "fg": "gray6", "bg": "gray10" }, - "modified_buffers": { "fg": "brightyellow", "bg": "gray2" }, - "environment": { "fg": "gray8", "bg": "gray2" }, - "error": { "fg": "brightestred", "bg": "darkred", "attr": ["bold"] }, - "warning": { "fg": "brightyellow", "bg": "darkorange", "attr": ["bold"] }, - "current_tag": { "fg": "gray9", "bg": "gray2" } - }, - "mode_translations": { - "nc": { - "colors": { - "brightyellow": "darkorange", - "brightestred": "darkred", - "gray0": "gray0", - "gray1": "gray0", - "gray2": "gray0", - "gray3": "gray1", - "gray4": "gray1", - "gray5": "gray1", - "gray6": "gray1", - "gray7": "gray4", - "gray8": "gray4", - "gray9": "gray4", - "gray10": "gray5", - "white": "gray6", - "green_yellow_red": "gray5" - } - }, - "i": { - "colors": { - "gray0": "darkestblue", - "gray1": "darkestblue", - "gray2": "darkestblue", - "gray3": "darkblue", - "gray4": "darkblue", - "gray5": "darkestcyan", - "gray6": "darkestcyan", - "gray7": "darkestcyan", - "gray8": "mediumcyan", - "gray9": "mediumcyan", - "gray10": "mediumcyan", - "green_yellow_red": "gray5" - }, - "groups": { - "mode": { "fg": "darkestcyan", "bg": "white", "attr": ["bold"] }, - "background:divider": { "fg": "darkcyan", "bg": "darkestblue" }, - "branch:divider": { "fg": "darkcyan", "bg": "darkblue" } - } - }, - "v": { - "groups": { - "mode": { "fg": "darkorange", "bg": "brightestorange", "attr": ["bold"] } - } - }, - "V": { - "groups": { - "mode": { "fg": "darkorange", "bg": "brightestorange", "attr": ["bold"] } - } - }, - "^V": { - "groups": { - "mode": { "fg": "darkorange", "bg": "brightestorange", "attr": ["bold"] } - } - }, - "R": { - "groups": { - "mode": { "fg": "white", "bg": "brightred", "attr": ["bold"] } - } - } - } -} diff --git a/powerline/colorschemes/vim/solarized.json b/powerline/colorschemes/vim/solarized.json deleted file mode 100644 index 869ebf1d..00000000 --- a/powerline/colorschemes/vim/solarized.json +++ /dev/null @@ -1,97 +0,0 @@ -{ - "name": "Solarized Dark", - "groups": { - "background": { "fg": "oldlace", "bg": "royalblue5" }, - "background:divider": { "fg": "lightskyblue4", "bg": "royalblue5" }, - "mode": { "fg": "oldlace", "bg": "green", "attr": ["bold"] }, - "visual_range": { "fg": "green", "bg": "oldlace", "attr": ["bold"] }, - "modified_indicator": { "fg": "yellow", "bg": "darkgreencopper", "attr": ["bold"] }, - "paste_indicator": { "fg": "oldlace", "bg": "orange", "attr": ["bold"] }, - "readonly_indicator": { "fg": "red", "bg": "darkgreencopper" }, - "branch": { "fg": "lightyellow", "bg": "darkgreencopper" }, - "branch_dirty": { "fg": "yellow", "bg": "darkgreencopper" }, - "branch_clean": { "fg": "lightyellow", "bg": "darkgreencopper" }, - "branch:divider": { "fg": "gray61", "bg": "darkgreencopper" }, - "file_directory": { "fg": "lightyellow", "bg": "darkgreencopper" }, - "file_name": { "fg": "oldlace", "bg": "darkgreencopper", "attr": ["bold"] }, - "file_size": { "fg": "oldlace", "bg": "darkgreencopper" }, - "file_name_no_file": { "fg": "oldlace", "bg": "darkgreencopper", "attr": ["bold"] }, - "file_name_empty": { "fg": "oldlace", "bg": "darkgreencopper" }, - "file_format": { "fg": "gray61", "bg": "royalblue5" }, - "file_encoding": { "fg": "gray61", "bg": "royalblue5" }, - "file_type": { "fg": "gray61", "bg": "royalblue5" }, - "file_vcs_status": { "fg": "red", "bg": "darkgreencopper" }, - "file_vcs_status_M": { "fg": "yellow", "bg": "darkgreencopper" }, - "file_vcs_status_A": { "fg": "green", "bg": "darkgreencopper" }, - "line_percent": { "fg": "oldlace", "bg": "lightskyblue4" }, - "line_percent_gradient": { "fg": "green_yellow_orange_red", "bg": "lightskyblue4" }, - "line_current": { "fg": "gray13", "bg": "lightyellow", "attr": ["bold"] }, - "line_current_symbol": { "fg": "gray13", "bg": "lightyellow" }, - "virtcol_current_gradient": { "fg": "GREEN_Orange_red", "bg": "gray10" }, - "col_current": { "fg": "azure4", "bg": "lightyellow" }, - "environment": { "fg": "gray61", "bg": "royalblue5" }, - "error": { "fg": "oldlace", "bg": "red", "attr": ["bold"] }, - "warning": { "fg": "oldlace", "bg": "orange", "attr": ["bold"] }, - "current_tag": { "fg": "oldlace", "bg": "royalblue5", "attr": ["bold"] } - }, - "mode_translations": { - "nc": { - "colors": { - "darkgreencopper": "royalblue5", - "lightskyblue4": "royalblue5", - "azure4": "darkgreencopper", - "gray61": "lightskyblue4", - "lightyellow": "azure4", - "oldlace": "gray61" - } - }, - "i": { - "groups": { - "background": { "fg": "oldlace", "bg": "darkgreencopper" }, - "background:divider": { "fg": "lightyellow", "bg": "darkgreencopper" }, - "mode": { "fg": "oldlace", "bg": "blue", "attr": ["bold"] }, - "modified_indicator": { "fg": "yellow", "bg": "lightyellow", "attr": ["bold"] }, - "paste_indicator": { "fg": "oldlace", "bg": "orange", "attr": ["bold"] }, - "readonly_indicator": { "fg": "red", "bg": "lightyellow" }, - "branch": { "fg": "darkgreencopper", "bg": "lightyellow" }, - "branch:divider": { "fg": "lightskyblue4", "bg": "lightyellow" }, - "file_directory": { "fg": "darkgreencopper", "bg": "lightyellow" }, - "file_name": { "fg": "royalblue5", "bg": "lightyellow", "attr": ["bold"] }, - "file_size": { "fg": "royalblue5", "bg": "lightyellow" }, - "file_name_no_file": { "fg": "royalblue5", "bg": "lightyellow", "attr": ["bold"] }, - "file_name_empty": { "fg": "royalblue5", "bg": "lightyellow" }, - "file_format": { "fg": "lightyellow", "bg": "darkgreencopper" }, - "file_encoding": { "fg": "lightyellow", "bg": "darkgreencopper" }, - "file_type": { "fg": "lightyellow", "bg": "darkgreencopper" }, - "file_vcs_status": { "fg": "red", "bg": "lightyellow" }, - "file_vcs_status_M": { "fg": "yellow", "bg": "lightyellow" }, - "file_vcs_status_A": { "fg": "green", "bg": "lightyellow" }, - "line_percent": { "fg": "oldlace", "bg": "gray61" }, - "line_percent_gradient": { "fg": "oldlace", "bg": "gray61" }, - "line_current": { "fg": "gray13", "bg": "oldlace", "attr": ["bold"] }, - "line_current_symbol": { "fg": "gray13", "bg": "oldlace" }, - "col_current": { "fg": "azure4", "bg": "oldlace" } - } - }, - "v": { - "groups": { - "mode": { "fg": "oldlace", "bg": "orange", "attr": ["bold"] } - } - }, - "V": { - "groups": { - "mode": { "fg": "oldlace", "bg": "orange", "attr": ["bold"] } - } - }, - "^V": { - "groups": { - "mode": { "fg": "oldlace", "bg": "orange", "attr": ["bold"] } - } - }, - "R": { - "groups": { - "mode": { "fg": "oldlace", "bg": "red", "attr": ["bold"] } - } - } - } -} diff --git a/powerline/colorschemes/wm/default.json b/powerline/colorschemes/wm/default.json deleted file mode 100644 index 445da4f6..00000000 --- a/powerline/colorschemes/wm/default.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "Default color scheme for window managers", - "groups": { - "background:divider": { "fg": "gray5", "bg": "gray0" }, - "session": { "fg": "black", "bg": "gray10", "attr": ["bold"] }, - "date": { "fg": "gray8", "bg": "gray2" }, - "time": { "fg": "gray10", "bg": "gray2", "attr": ["bold"] }, - "time:divider": { "fg": "gray5", "bg": "gray2" }, - "email_alert": { "fg": "white", "bg": "brightred", "attr": ["bold"] }, - "email_alert_gradient": { "fg": "white", "bg": "yellow_orange_red", "attr": ["bold"] }, - "hostname": { "fg": "black", "bg": "gray10", "attr": ["bold"] }, - "weather": { "fg": "gray8", "bg": "gray0" }, - "weather_temp_gradient": { "fg": "blue_red", "bg": "gray0" }, - "weather_condition_hot": { "fg": "khaki1", "bg": "gray0" }, - "weather_condition_snowy": { "fg": "skyblue1", "bg": "gray0" }, - "weather_condition_rainy": { "fg": "skyblue1", "bg": "gray0" }, - "uptime": { "fg": "gray8", "bg": "gray0" }, - "external_ip": { "fg": "gray8", "bg": "gray0" }, - "network_load": { "fg": "gray8", "bg": "gray0" }, - "system_load": { "fg": "gray8", "bg": "gray0" }, - "system_load_good": { "fg": "lightyellowgreen", "bg": "gray0" }, - "system_load_bad": { "fg": "gold3", "bg": "gray0" }, - "system_load_ugly": { "fg": "orangered", "bg": "gray0" }, - "environment": { "fg": "gray8", "bg": "gray0" } - } -} diff --git a/powerline/config.json b/powerline/config.json deleted file mode 100644 index e9a627e7..00000000 --- a/powerline/config.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "common": { - "term_truecolor": false, - "dividers": { - "left": { - "hard": " ", - "soft": " " - }, - "right": { - "hard": " ", - "soft": " " - } - }, - "spaces": 1 - }, - "ext": { - "ipython": { - "colorscheme": "default", - "theme": "in", - "local_themes": { - "rewrite": "rewrite", - "out": "out", - "in2": "in2" - } - }, - "shell": { - "colorscheme": "default", - "theme": "default" - }, - "tmux": { - "colorscheme": "default", - "theme": "default" - }, - "vim": { - "colorscheme": "default", - "theme": "default", - "local_themes": { - "cmdwin": "cmdwin", - "help": "help", - "quickfix": "quickfix", - - "powerline.matchers.plugin.nerdtree.nerdtree": "plugin/nerdtree", - "powerline.matchers.plugin.ctrlp.ctrlp": "plugin/ctrlp", - "powerline.matchers.plugin.gundo.gundo": "plugin/gundo", - "powerline.matchers.plugin.gundo.gundo_preview": "plugin/gundo-preview" - } - }, - "wm": { - "colorscheme": "default", - "theme": "default" - } - } -} diff --git a/powerline/themes/ipython/in.json b/powerline/themes/ipython/in.json deleted file mode 100644 index ac979c5f..00000000 --- a/powerline/themes/ipython/in.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "default_module": "powerline.segments.common", - "segments": { - "left": [ - { - "name": "virtualenv" - }, - { - "type": "string", - "contents": "In[", - "draw_soft_divider": false, - "highlight_group": ["prompt"] - }, - { - "name": "prompt_count", - "module": "powerline.segments.ipython", - "draw_soft_divider": false - }, - { - "type": "string", - "contents": "]", - "highlight_group": ["prompt"] - } - ] - } -} diff --git a/powerline/themes/ipython/in2.json b/powerline/themes/ipython/in2.json deleted file mode 100644 index 601fc9e5..00000000 --- a/powerline/themes/ipython/in2.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "default_module": "powerline.segments.common", - "segments": { - "left": [ - { - "type": "string", - "contents": "", - "width": "auto", - "highlight_group": ["prompt"] - } - ] - } -} diff --git a/powerline/themes/ipython/out.json b/powerline/themes/ipython/out.json deleted file mode 100644 index 11a63234..00000000 --- a/powerline/themes/ipython/out.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "default_module": "powerline.segments.common", - "segments": { - "left": [ - { - "type": "string", - "contents": "Out[", - "draw_soft_divider": false, - "width": "auto", - "align": "r", - "highlight_group": ["prompt"] - }, - { - "name": "prompt_count", - "module": "powerline.segments.ipython", - "draw_soft_divider": false - }, - { - "type": "string", - "contents": "]", - "highlight_group": ["prompt"] - } - ] - } -} diff --git a/powerline/themes/ipython/rewrite.json b/powerline/themes/ipython/rewrite.json deleted file mode 100644 index 47d8de0d..00000000 --- a/powerline/themes/ipython/rewrite.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "segments": { - "left": [ - { - "type": "string", - "contents": "", - "draw_soft_divider": false, - "width": "auto", - "highlight_group": ["prompt"] - }, - { - "name": "prompt_count", - "module": "powerline.segments.ipython", - "draw_soft_divider": false - }, - { - "type": "string", - "contents": ">", - "highlight_group": ["prompt"] - } - ] - } -} diff --git a/powerline/themes/shell/default.json b/powerline/themes/shell/default.json deleted file mode 100644 index 6246a964..00000000 --- a/powerline/themes/shell/default.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "default_module": "powerline.segments.common", - "segment_data": { - "hostname": { - "before": " ", - "args": { - "only_if_ssh": true - } - }, - "virtualenv": { - "before": "ⓔ " - }, - "branch": { - "before": " " - } - }, - "segments": { - "left": [ - { - "name": "hostname" - }, - { - "name": "user" - }, - { - "name": "virtualenv" - }, - { - "name": "cwd", - "args": { - "dir_limit_depth": 3 - } - } - ], - "right": [ - { - "module": "powerline.segments.shell", - "name": "last_pipe_status" - }, - { - "name": "branch" - } - ] - } -} diff --git a/powerline/themes/shell/default_leftonly.json b/powerline/themes/shell/default_leftonly.json deleted file mode 100644 index 16af9755..00000000 --- a/powerline/themes/shell/default_leftonly.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "default_module": "powerline.segments.common", - "segment_data": { - "hostname": { - "before": " ", - "args": { - "only_if_ssh": true - } - }, - "virtualenv": { - "before": "ⓔ " - }, - "branch": { - "before": " " - } - }, - "segments": { - "left": [ - { - "name": "hostname" - }, - { - "name": "user" - }, - { - "name": "virtualenv" - }, - { - "name": "branch" - }, - { - "name": "cwd", - "args": { - "dir_limit_depth": 3 - } - }, - { - "name": "last_status", - "module": "powerline.segments.shell" - } - ] - } -} diff --git a/powerline/themes/tmux/default.json b/powerline/themes/tmux/default.json deleted file mode 100644 index 7d475c96..00000000 --- a/powerline/themes/tmux/default.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "default_module": "powerline.segments.common", - "segment_data": { - "uptime": { - "before": "⇑ " - }, - "external_ip": { - "before": "ⓦ " - }, - "date": { - "before": "⌚ " - }, - "email_imap_alert": { - "before": "✉ ", - "args": { - "username": "", - "password": "" - } - } - }, - "segments": { - "right": [ - { - "name": "uptime", - "priority": 50 - }, - { - "name": "system_load", - "priority": 50 - }, - { - "name": "date" - }, - { - "name": "date", - "args": { - "format": "%H:%M", - "istime": true - } - }, - { - "name": "hostname" - } - ] - } -} diff --git a/powerline/themes/vim/cmdwin.json b/powerline/themes/vim/cmdwin.json deleted file mode 100644 index c300d948..00000000 --- a/powerline/themes/vim/cmdwin.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "segments": { - "left": [ - { - "type": "string", - "contents": "Command Line", - "highlight_group": ["file_name"] - }, - { - "type": "string", - "highlight_group": ["background"], - "draw_soft_divider": false, - "draw_hard_divider": false, - "width": "auto" - } - ] - } -} diff --git a/powerline/themes/vim/default.json b/powerline/themes/vim/default.json deleted file mode 100644 index 5f10912d..00000000 --- a/powerline/themes/vim/default.json +++ /dev/null @@ -1,126 +0,0 @@ -{ - "segment_data": { - "branch": { - "before": " " - }, - "modified_indicator": { - "args": { "text": "+" } - }, - "line_percent": { - "args": { "gradient": true }, - "after": "%" - }, - "line_current_symbol": { - "contents": " " - } - }, - "segments": { - "left": [ - { - "name": "mode", - "exclude_modes": ["nc"] - }, - { - "name": "visual_range", - "exclude_modes": ["nc"], - "priority": 10 - }, - { - "name": "paste_indicator", - "exclude_modes": ["nc"], - "priority": 10 - }, - { - "name": "branch", - "exclude_modes": ["nc"], - "priority": 30 - }, - { - "name": "readonly_indicator", - "draw_soft_divider": false, - "after": " " - }, - { - "name": "file_directory", - "priority": 40, - "draw_soft_divider": false - }, - { - "name": "file_name", - "draw_soft_divider": false - }, - { - "name": "file_vcs_status", - "before": " ", - "draw_soft_divider": false - }, - { - "name": "modified_indicator", - "before": " " - }, - { - "exclude_modes": ["nc"], - "module": "powerline.segments.plugin.syntastic", - "name": "syntastic", - "priority": 50 - }, - { - "exclude_modes": ["nc"], - "module": "powerline.segments.plugin.tagbar", - "name": "current_tag", - "draw_soft_divider": false, - "priority": 50 - }, - { - "type": "string", - "highlight_group": ["background"], - "draw_soft_divider": false, - "draw_hard_divider": false, - "width": "auto" - } - ], - "right": [ - { - "name": "file_format", - "draw_soft_divider": false, - "exclude_modes": ["nc"], - "priority": 60 - }, - { - "name": "file_encoding", - "exclude_modes": ["nc"], - "priority": 60 - }, - { - "name": "file_type", - "exclude_modes": ["nc"], - "priority": 60 - }, - { - "name": "line_percent", - "priority": 50, - "width": 4, - "align": "r" - }, - { - "type": "string", - "name": "line_current_symbol", - "highlight_group": ["line_current_symbol", "line_current"] - }, - { - "name": "line_current", - "draw_soft_divider": false, - "width": 3, - "align": "r" - }, - { - "name": "virtcol_current", - "draw_soft_divider": false, - "priority": 20, - "before": ":", - "width": 3, - "align": "l" - } - ] - } -} diff --git a/powerline/themes/vim/help.json b/powerline/themes/vim/help.json deleted file mode 100644 index 74071057..00000000 --- a/powerline/themes/vim/help.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "segments": { - "left": [ - { - "name": "file_name", - "draw_soft_divider": false - }, - { - "type": "string", - "highlight_group": ["background"], - "draw_soft_divider": false, - "draw_hard_divider": false, - "width": "auto" - } - ], - "right": [ - { - "name": "line_percent", - "priority": 30, - "width": 4, - "align": "r" - }, - { - "type": "string", - "name": "line_current_symbol", - "highlight_group": ["line_current_symbol", "line_current"] - }, - { - "name": "line_current", - "draw_soft_divider": false, - "width": 3, - "align": "r" - } - ] - } -} diff --git a/powerline/themes/vim/plugin/ctrlp.json b/powerline/themes/vim/plugin/ctrlp.json deleted file mode 100644 index 02015b78..00000000 --- a/powerline/themes/vim/plugin/ctrlp.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "default_module": "powerline.segments.plugin.ctrlp", - "segments": { - "left": [ - { - "name": "ctrlp", - "args": { - "side": "left" - } - }, - { - "type": "string", - "highlight_group": ["ctrlp.background", "background"], - "draw_soft_divider": false, - "draw_hard_divider": false, - "width": "auto" - } - ], - "right": [ - { - "name": "ctrlp", - "args": { - "side": "right" - } - } - ] - } -} diff --git a/powerline/themes/vim/plugin/gundo-preview.json b/powerline/themes/vim/plugin/gundo-preview.json deleted file mode 100644 index 3ce202ea..00000000 --- a/powerline/themes/vim/plugin/gundo-preview.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "default_module": "powerline.segments.plugin.gundo", - "segments": { - "left": [ - { - "type": "string", - "highlight_group": ["gundo.name", "file_name"], - "contents": "Undo diff" - }, - { - "type": "string", - "highlight_group": ["gundo.background", "background"], - "draw_soft_divider": false, - "draw_hard_divider": false, - "width": "auto" - } - ] - } -} diff --git a/powerline/themes/vim/plugin/gundo.json b/powerline/themes/vim/plugin/gundo.json deleted file mode 100644 index 0c1a336a..00000000 --- a/powerline/themes/vim/plugin/gundo.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "default_module": "powerline.segments.plugin.gundo", - "segments": { - "left": [ - { - "type": "string", - "highlight_group": ["gundo.name", "file_name"], - "contents": "Undo tree" - }, - { - "type": "string", - "highlight_group": ["gundo.background", "background"], - "draw_soft_divider": false, - "draw_hard_divider": false, - "width": "auto" - } - ] - } -} diff --git a/powerline/themes/vim/plugin/nerdtree.json b/powerline/themes/vim/plugin/nerdtree.json deleted file mode 100644 index 95495db1..00000000 --- a/powerline/themes/vim/plugin/nerdtree.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "default_module": "powerline.segments.plugin.nerdtree", - "segments": { - "left": [ - { - "name": "nerdtree" - }, - { - "type": "string", - "highlight_group": ["background"], - "draw_soft_divider": false, - "draw_hard_divider": false, - "width": "auto" - } - ] - } -} diff --git a/powerline/themes/vim/quickfix.json b/powerline/themes/vim/quickfix.json deleted file mode 100644 index da77d631..00000000 --- a/powerline/themes/vim/quickfix.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "segment_data": { - "buffer_name": { - "contents": "Location List" - } - }, - "segments": { - "left": [ - { - "type": "string", - "name": "buffer_name", - "highlight_group": ["file_name"], - "draw_soft_divider": false - }, - { - "type": "string", - "highlight_group": ["background"], - "draw_soft_divider": false, - "draw_hard_divider": false, - "width": "auto" - } - ], - "right": [ - { - "type": "string", - "name": "line_current_symbol", - "highlight_group": ["line_current_symbol", "line_current"] - }, - { - "name": "line_current", - "draw_soft_divider": false, - "width": 3, - "align": "r" - } - ] - } -} diff --git a/powerline/themes/wm/default.json b/powerline/themes/wm/default.json deleted file mode 100644 index c1cee4b7..00000000 --- a/powerline/themes/wm/default.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "default_module": "powerline.segments.common", - "segments": { - "right": [ - { - "name": "weather", - "priority": 50 - }, - { - "name": "date" - }, - { - "name": "date", - "args": { - "format": "%H:%M", - "istime": true - }, - "before": "⌚ " - }, - { - "name": "email_imap_alert", - "before": "✉ ", - "priority": 10, - "args": { - "username": "", - "password": "" - } - } - ] - } -} diff --git a/vendor/powerline b/vendor/powerline deleted file mode 160000 index db80fc95..00000000 --- a/vendor/powerline +++ /dev/null @@ -1 +0,0 @@ -Subproject commit db80fc95ed01d2c559c4bdc7da8514ed3cc7fcd9 From 56a454fdda3eb5127ba80585ec4ea600cdc3b257 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Mon, 4 Jul 2016 17:37:15 +1000 Subject: [PATCH 109/234] Updated (n)vim config --- editors/vim/autocommands.vim | 8 +- editors/vim/autoload/plug.vim | 2256 +++++++++++++++++++++++++++++++++ editors/vim/bundle/.gitignore | 1 - editors/vim/bundles.vim | 228 ++-- editors/vim/gvimrc | 2 +- editors/vim/init.vim | 1 + editors/vim/ui.vim | 9 +- editors/vim/vimrc | 6 +- nvim | 1 + 9 files changed, 2367 insertions(+), 145 deletions(-) create mode 100644 editors/vim/autoload/plug.vim delete mode 100644 editors/vim/bundle/.gitignore create mode 120000 editors/vim/init.vim create mode 120000 nvim diff --git a/editors/vim/autocommands.vim b/editors/vim/autocommands.vim index 3a06850c..76c50f69 100644 --- a/editors/vim/autocommands.vim +++ b/editors/vim/autocommands.vim @@ -17,15 +17,17 @@ nmap sw :call StripTrailingWhitespaces() augroup the_rest au! - " Attempted fix for Vim losing mouse support when inside Tmux - autocmd TermResponse,CursorHold,CursorHoldI * set ttymouse=xterm2 + if !has('nvim') + " Attempted fix for Vim losing mouse support when inside Tmux + autocmd TermResponse,CursorHold,CursorHoldI * set ttymouse=xterm2 + endif " Create parent directory if it doesn't exist before writing file " (http://stackoverflow.com/questions/4292733/vim-creating-parent-directories-on-save) autocmd BufWritePre * if expand("")!~#'^\w\+:/' && !isdirectory(expand("%:h")) | execute "silent! !mkdir -p ".shellescape(expand('%:h'), 1) | redraw! | endif " Source vimrc after saving it - autocmd BufWritePost .vimrc,vimrc source $MYVIMRC | NERDTreeToggle | NERDTreeToggle + autocmd BufWritePost .vimrc,vimrc source $MYVIMRC " Auto save files on window blur autocmd FocusLost * :silent! up diff --git a/editors/vim/autoload/plug.vim b/editors/vim/autoload/plug.vim new file mode 100644 index 00000000..d916ff07 --- /dev/null +++ b/editors/vim/autoload/plug.vim @@ -0,0 +1,2256 @@ +" 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' +" +" " Group dependencies, vim-snippets depends on ultisnips +" Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets' +" +" " On-demand loading +" Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } +" Plug 'tpope/vim-fireplace', { 'for': 'clojure' } +" +" " Using a non-master branch +" Plug 'rdnetto/YCM-Generator', { 'branch': 'stable' } +" +" " Using a tagged release; wildcard allowed (requires git 1.9.2 or above) +" Plug 'fatih/vim-go', { 'tag': '*' } +" +" " Plugin options +" Plug 'nsf/gocode', { 'tag': 'v.20150303', 'rtp': 'vim' } +" +" " Plugin outside ~/.vim/plugged with post-update hook +" Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } +" +" " Unmanaged plugin (manually installed and updated) +" Plug '~/my-prototype-plugin' +" +" " Add plugins to &runtimepath +" 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) 2016 Junegunn Choi +" +" MIT License +" +" Permission is hereby granted, free of charge, to any person obtaining +" a copy of this software and associated documentation files (the +" "Software"), to deal in the Software without restriction, including +" without limitation the rights to use, copy, modify, merge, publish, +" distribute, sublicense, and/or sell copies of the Software, and to +" permit persons to whom the Software is furnished to do so, subject to +" the following conditions: +" +" The above copyright notice and this permission notice shall be +" included in all copies or substantial portions of the Software. +" +" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +" NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +" LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +" OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +" WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +if exists('g:loaded_plug') + finish +endif +let g:loaded_plug = 1 + +let s:cpo_save = &cpo +set cpo&vim + +let s:plug_src = 'https://github.com/junegunn/vim-plug.git' +let s:plug_tab = get(s:, 'plug_tab', -1) +let s:plug_buf = get(s:, 'plug_buf', -1) +let s:mac_gui = has('gui_macvim') && has('gui_running') +let s:is_win = has('win32') || has('win64') +let s:nvim = has('nvim') && exists('*jobwait') && !s:is_win +let s:me = resolve(expand(':p')) +let s:base_spec = { 'branch': 'master', 'frozen': 0 } +let s:TYPE = { +\ 'string': type(''), +\ 'list': type([]), +\ 'dict': type({}), +\ 'funcref': type(function('call')) +\ } +let s:loaded = get(s:, 'loaded', {}) +let s:triggers = get(s:, 'triggers', {}) + +function! plug#begin(...) + if a:0 > 0 + let s:plug_home_org = a:1 + let home = s:path(fnamemodify(expand(a:1), ':p')) + elseif exists('g:plug_home') + let home = s:path(g:plug_home) + elseif !empty(&rtp) + let home = s:path(split(&rtp, ',')[0]) . '/plugged' + else + return s:err('Unable to determine plug home. Try calling plug#begin() with a path argument.') + endif + + let g:plug_home = home + let g:plugs = {} + let g:plugs_order = [] + let s:triggers = {} + + call s:define_commands() + return 1 +endfunction + +function! s:define_commands() + command! -nargs=+ -bar Plug call plug#() + if !executable('git') + return s:err('`git` executable not found. Most commands will not be available. To suppress this message, prepend `silent!` to `call plug#begin(...)`.') + endif + command! -nargs=* -bar -bang -complete=customlist,s:names PlugInstall call s:install(0, []) + command! -nargs=* -bar -bang -complete=customlist,s:names PlugUpdate call s:update(0, []) + command! -nargs=0 -bar -bang PlugClean call s:clean(0) + command! -nargs=0 -bar PlugUpgrade if s:upgrade() | execute 'source' s:esc(s:me) | endif + command! -nargs=0 -bar PlugStatus call s:status() + command! -nargs=0 -bar PlugDiff call s:diff() + command! -nargs=? -bar -bang -complete=file PlugSnapshot call s:snapshot(0, ) +endfunction + +function! s:to_a(v) + return type(a:v) == s:TYPE.list ? a:v : [a:v] +endfunction + +function! s:to_s(v) + return type(a:v) == s:TYPE.string ? a:v : join(a:v, "\n") . "\n" +endfunction + +function! s:glob(from, pattern) + return s:lines(globpath(a:from, a:pattern)) +endfunction + +function! s:source(from, ...) + let found = 0 + for pattern in a:000 + for vim in s:glob(a:from, pattern) + execute 'source' s:esc(vim) + let found = 1 + endfor + endfor + return found +endfunction + +function! s:assoc(dict, key, val) + let a:dict[a:key] = add(get(a:dict, a:key, []), a:val) +endfunction + +function! s:ask(message) + call inputsave() + echohl WarningMsg + let proceed = input(a:message.' (y/N) ') =~? '^y' + echohl None + call inputrestore() + echo "\r" + return proceed +endfunction + +function! plug#end() + if !exists('g:plugs') + return s:err('Call plug#begin() first') + endif + + if exists('#PlugLOD') + augroup PlugLOD + autocmd! + augroup END + augroup! PlugLOD + endif + let lod = { 'ft': {}, 'map': {}, 'cmd': {} } + + filetype off + for name in g:plugs_order + let plug = g:plugs[name] + if get(s:loaded, name, 0) || !has_key(plug, 'on') && !has_key(plug, 'for') + let s:loaded[name] = 1 + continue + endif + + if has_key(plug, 'on') + let s:triggers[name] = { 'map': [], 'cmd': [] } + for cmd in s:to_a(plug.on) + if cmd =~? '^.\+' + if empty(mapcheck(cmd)) && empty(mapcheck(cmd, 'i')) + call s:assoc(lod.map, cmd, name) + endif + call add(s:triggers[name].map, cmd) + elseif cmd =~# '^[A-Z]' + 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 %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")', + \ mode, map, map_prefix, string(map), string(names), 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() + endif +endfunction + +function! s:loaded_names() + return filter(copy(g:plugs_order), 'get(s:loaded, v:val, 0)') +endfunction + +function! s:reload() + for name in s:loaded_names() + call s:source(s:rtp(g:plugs[name]), 'plugin/**/*.vim', 'after/plugin/**/*.vim') + 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'))[-1], '\.'), 'str2nr(v:val)') + endif + return s:version_requirement(s:git_version, a:000) +endfunction + +function! s:progress_opt(base) + return a:base && !s:is_win && + \ s:git_version_requirement(1, 7, 1) ? '--progress' : '' +endfunction + +if s:is_win + function! s:rtp(spec) + return s:path(a:spec.dir . get(a:spec, 'rtp', '')) + endfunction + + function! s:path(path) + return s:trim(substitute(a:path, '/', '\', 'g')) + endfunction + + function! s:dirpath(path) + return s:path(a:path) . '\' + endfunction + + function! s:is_local_plug(repo) + return a:repo =~? '^[a-z]:\|^[%~]' + endfunction +else + function! s:rtp(spec) + return s:dirpath(a:spec.dir . get(a:spec, 'rtp', '')) + endfunction + + function! s:path(path) + return s:trim(a:path) + endfunction + + function! s:dirpath(path) + return substitute(a:path, '[/\\]*$', '/', '') + endfunction + + function! s:is_local_plug(repo) + return a:repo[0] =~ '[/$~]' + endfunction +endif + +function! s:err(msg) + echohl ErrorMsg + echom '[vim-plug] '.a:msg + echohl None +endfunction + +function! s:warn(cmd, msg) + echohl WarningMsg + execute a:cmd 'a:msg' + echohl None +endfunction + +function! s:esc(path) + return escape(a:path, ' ') +endfunction + +function! s:escrtp(path) + return escape(a:path, ' ,') +endfunction + +function! s:remove_rtp() + for name in s:loaded_names() + let rtp = s:rtp(g:plugs[name]) + execute 'set rtp-='.s:escrtp(rtp) + let after = globpath(rtp, 'after') + if isdirectory(after) + execute 'set rtp-='.s:escrtp(after) + endif + endfor +endfunction + +function! s:reorg_rtp() + if !empty(s:first_rtp) + execute 'set rtp-='.s:first_rtp + execute 'set rtp-='.s:last_rtp + endif + + " &rtp is modified from outside + if exists('s:prtp') && s:prtp !=# &rtp + call s:remove_rtp() + unlet! s:middle + endif + + let s:middle = get(s:, 'middle', &rtp) + let rtps = map(s:loaded_names(), 's:rtp(g:plugs[v:val])') + let afters = filter(map(copy(rtps), 'globpath(v:val, "after")'), 'isdirectory(v:val)') + let rtp = join(map(rtps, 'escape(v:val, ",")'), ',') + \ . ','.s:middle.',' + \ . join(map(afters, 'escape(v:val, ",")'), ',') + let &rtp = substitute(substitute(rtp, ',,*', ',', 'g'), '^,\|,$', '', 'g') + let s:prtp = &rtp + + if !empty(s:first_rtp) + execute 'set rtp^='.s:first_rtp + execute 'set rtp+='.s:last_rtp + endif +endfunction + +function! s:doautocmd(...) + if exists('#'.join(a:000, '#')) + execute 'doautocmd' ((v:version > 703 || has('patch442')) ? '' : '') join(a:000) + endif +endfunction + +function! s:dobufread(names) + for name in a:names + let path = s:rtp(g:plugs[name]).'/**' + for dir in ['ftdetect', 'ftplugin'] + if len(finddir(dir, path)) + return s:doautocmd('BufRead') + 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 unknowns = filter(copy(a:000), '!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 + for name in a:000 + call s:lod([name], ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin']) + endfor + call s:dobufread(a:000) + return 1 +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, 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 + call feedkeys(a:prefix . substitute(a:map, '^', "\", '') . extra) +endfunction + +function! plug#(repo, ...) + if a:0 > 1 + return s:err('Invalid number of arguments (1..2)') + endif + + try + let repo = s:trim(a:repo) + let opts = a:0 == 1 ? s:parse_options(a:1) : s:base_spec + let name = get(opts, 'as', fnamemodify(repo, ':t:s?\.git$??')) + let spec = extend(s:infer_properties(name, repo), opts) + if !has_key(g:plugs, name) + call add(g:plugs_order, name) + endif + let g:plugs[name] = spec + let s:loaded[name] = get(s:loaded, name, 0) + catch + return s:err(v:exception) + endtry +endfunction + +function! s:parse_options(arg) + let opts = copy(s:base_spec) + let type = type(a:arg) + if type == s:TYPE.string + let opts.tag = a:arg + elseif type == s:TYPE.dict + call extend(opts, a:arg) + if has_key(opts, 'dir') + let opts.dir = s:dirpath(expand(opts.dir)) + endif + else + throw 'Invalid argument type (expected: string or dictionary)' + endif + return opts +endfunction + +function! s:infer_properties(name, repo) + let repo = a:repo + if s:is_local_plug(repo) + return { 'dir': s:dirpath(expand(repo)) } + else + if repo =~ ':' + let uri = repo + else + if repo !~ '/' + let repo = 'vim-scripts/'. repo + endif + let fmt = get(g:, 'plug_url_format', 'https://git::@github.com/%s.git') + let uri = printf(fmt, repo) + endif + let dir = s:dirpath( fnamemodify(join([g:plug_home, a:name], '/'), ':p') ) + return { 'dir': dir, '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([spec.dir, 'doc'], '/') + if isdirectory(docd) + silent! execute 'helptags' s:esc(docd) + endif + endfor + return 1 +endfunction + +function! s:syntax() + syntax clear + syntax region plug1 start=/\%1l/ end=/\%2l/ contains=plugNumber + syntax region plug2 start=/\%2l/ end=/\%3l/ contains=plugBracket,plugX + syn match plugNumber /[0-9]\+[0-9.]*/ contained + syn match plugBracket /[[\]]/ contained + syn match plugX /x/ contained + syn match plugDash /^-/ + syn match plugPlus /^+/ + syn match plugStar /^*/ + syn match plugMessage /\(^- \)\@<=.*/ + syn match plugName /\(^- \)\@<=[^ ]*:/ + syn match plugSha /\%(: \)\@<=[0-9a-f]\{4,}$/ + syn match plugTag /(tag: [^)]\+)/ + syn match plugInstall /\(^+ \)\@<=[^:]*/ + syn match plugUpdate /\(^* \)\@<=[^:]*/ + syn match plugCommit /^ \X*[0-9a-f]\{7} .*/ contains=plugRelDate,plugEdge,plugTag + syn match plugEdge /^ \X\+$/ + syn match plugEdge /^ \X*/ contained nextgroup=plugSha + syn match plugSha /[0-9a-f]\{7}/ contained + syn match plugRelDate /([^)]*)$/ contained + syn match plugNotLoaded /(not loaded)$/ + syn match plugError /^x.*/ + syn match plugH2 /^.*:\n-\+$/ + syn keyword Function PlugInstall PlugStatus PlugUpdate PlugClean + hi def link plug1 Title + hi def link plug2 Repeat + hi def link plugH2 Type + hi def link plugX Exception + hi def link plugBracket Structure + hi def link plugNumber Number + + hi def link plugDash Special + hi def link plugPlus Constant + hi def link plugStar Boolean + + hi def link plugMessage Function + hi def link plugName Label + hi def link plugInstall Function + hi def link plugUpdate Type + + hi def link plugError Error + hi def link plugRelDate Comment + hi def link plugEdge PreProc + hi def link plugSha Identifier + hi def link plugTag Constant + + hi def link plugNotLoaded Comment +endfunction + +function! s:lpad(str, len) + return a:str . repeat(' ', a:len - len(a:str)) +endfunction + +function! s:lines(msg) + return split(a:msg, "[\r\n]") +endfunction + +function! s:lastline(msg) + return get(s:lines(a:msg), -1, '') +endfunction + +function! s:new_window() + execute get(g:, 'plug_window', 'vertical topleft new') +endfunction + +function! s:plug_window_exists() + let buflist = tabpagebuflist(s:plug_tab) + return !empty(buflist) && index(buflist, s:plug_buf) >= 0 +endfunction + +function! s:switch_in() + if !s:plug_window_exists() + return 0 + endif + + if winbufnr(0) != s:plug_buf + let s:pos = [tabpagenr(), winnr(), winsaveview()] + execute 'normal!' s:plug_tab.'gt' + let winnr = bufwinnr(s:plug_buf) + execute winnr.'wincmd w' + call add(s:pos, winsaveview()) + else + let s:pos = [winsaveview()] + endif + + setlocal modifiable + return 1 +endfunction + +function! s:switch_out(...) + call winrestview(s:pos[-1]) + setlocal nomodifiable + if a:0 > 0 + execute a:1 + endif + + if len(s:pos) > 1 + execute 'normal!' s:pos[0].'gt' + execute s:pos[1] 'wincmd w' + call winrestview(s:pos[2]) + endif +endfunction + +function! s:finish_bindings() + nnoremap R :call retry() + nnoremap D :PlugDiff + nnoremap S :PlugStatus + nnoremap U :call status_update() + xnoremap U :call status_update() + nnoremap ]] :silent! call section('') + nnoremap [[ :silent! call section('b') +endfunction + +function! s:prepare(...) + if empty(getcwd()) + throw 'Invalid current working directory. Cannot proceed.' + endif + + call s:job_abort() + if s:switch_in() + normal q + endif + + call s:new_window() + 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() + + silent! unmap + silent! unmap L + silent! unmap o + silent! unmap X + setlocal buftype=nofile bufhidden=wipe nobuflisted noswapfile nowrap cursorline modifiable + 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, &shellredir] + if !s:is_win && a:swap + set shell=sh shellredir=>%s\ 2>&1 + endif + return prev +endfunction + +function! s:bang(cmd, ...) + try + let [sh, 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 + let g:_plug_bang = '!'.escape(cmd, '#!%') + execute "normal! :execute g:_plug_bang\\" + finally + unlet g:_plug_bang + let [&shell, &shellredir] = [sh, shrd] + 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 + let error = s:bang(spec.do) + elseif type == s:TYPE.funcref + try + let status = installed ? 'installed' : (updated ? 'updated' : 'unchanged') + call spec.do({ 'name': name, 'status': status, 'force': a:force }) + catch + let error = v:exception + endtry + else + let error = 'Invalid hook type' + endif + call setline(4, empty(error) ? (getline(4) . 'OK') + \ : ('x' . getline(4)[1:] . error)) + if !empty(error) + call add(s:update.errors, name) + call s:regress_bar() + endif + cd - + endif + endfor +endfunction + +function! s:hash_match(a, b) + return stridx(a:a, a:b) == 0 || stridx(a:b, a:a) == 0 +endfunction + +function! s:checkout(spec) + let sha = a:spec.commit + let output = s:system('git rev-parse HEAD', a:spec.dir) + if !v:shell_error && !s:hash_match(sha, s:lines(output)[0]) + let output = s:system( + \ 'git fetch --depth 999999 && git checkout '.s:esc(sha), a:spec.dir) + endif + return output +endfunction + +function! s:finish(pull) + let new_frozen = len(filter(keys(s:update.new), 'g:plugs[v:val].frozen')) + if new_frozen + let s = new_frozen > 1 ? 's' : '' + call append(3, printf('- Installed %d frozen plugin%s', new_frozen, s)) + endif + call append(3, '- Finishing ... ') | 4 + redraw + call plug#helptags() + call plug#end() + call setline(4, getline(4) . 'Done!') + redraw + let msgs = [] + if !empty(s:update.errors) + call add(msgs, "Press 'R' to retry.") + endif + if a:pull && len(s:update.new) < len(filter(getline(5, '$'), + \ "v:val =~ '^- ' && stridx(v:val, 'Already up-to-date') < 0")) + 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 args = copy(a:args) + 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 python = (has('python') || has('python3')) && (!s:nvim || has('vim_starting')) + let ruby = has('ruby') && !s:nvim && (v:version >= 703 || v:version == 702 && has('patch374')) && !(s:is_win && has('gui_running')) && s:check_ruby() + + let s:update = { + \ 'start': reltime(), + \ 'all': todo, + \ 'todo': copy(todo), + \ 'errors': [], + \ 'pull': a:pull, + \ 'force': a:force, + \ 'new': {}, + \ 'threads': (python || ruby || s:nvim) ? min([len(todo), threads]) : 1, + \ 'bar': '', + \ 'fin': 0 + \ } + + call s:prepare(1) + call append(0, ['', '']) + normal! 2G + silent! redraw + + let s:clone_opt = get(g:, 'plug_shallow', 1) ? + \ '--depth 1' . (s:git_version_requirement(1, 7, 10) ? ' --no-single-branch' : '') : '' + + " Python version requirement (>= 2.7) + if python && !has('python3') && !ruby && !s:nvim && 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() + 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 '.string(tag).' --sort -version:refname 2>&1', spec.dir)) + if !v:shell_error && !empty(tags) + let tag = tags[0] + call s:log4(name, printf('Latest tag for %s -> %s', spec.tag, tag)) + call append(3, '') + endif + endif + call s:log4(name, 'Checking out '.tag) + let out = s:system('git checkout -q '.s:esc(tag).' 2>&1', spec.dir) + else + let branch = s:esc(get(spec, 'branch', 'master')) + call s:log4(name, 'Merging origin/'.branch) + let out = s:system('git checkout -q '.branch.' 2>&1' + \. (has_key(s:update.new, name) ? '' : ('&& git merge --ff-only origin/'.branch.' 2>&1')), spec.dir) + endif + if !v:shell_error && filereadable(spec.dir.'/.gitmodules') && + \ (s:update.force || has_key(s:update.new, name) || s:is_updated(spec.dir)) + call s:log4(name, 'Updating submodules. This may take a while.') + let out .= s:bang('git submodule update --init --recursive 2>&1', spec.dir) + endif + let msg = printf('%s %s: %s', v:shell_error ? 'x': '-', name, s:lastline(out)) + if v:shell_error + call add(s:update.errors, name) + call s:regress_bar() + execute pos 'd _' + call append(4, msg) | 4 + elseif !empty(out) + call setline(pos, msg) + endif + redraw + endfor + 4 d _ + 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")')) + 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 || !exists('s:jobs') + return + endif + + for [name, j] in items(s:jobs) + silent! call jobstop(j.jobid) + if j.new + call s:system('rm -rf ' . s:shellesc(g:plugs[name].dir)) + endif + endfor + let s:jobs = {} +endfunction + +" When a:event == 'stdout', data = list of strings +" When a:event == 'exit', data = returncode +function! s:job_handler(job_id, data, event) abort + if !s:plug_window_exists() " plug window closed + return s:job_abort() + endif + + if a:event == 'stdout' + let complete = empty(a:data[-1]) + let lines = map(filter(a:data, 'len(v:val) > 0'), 'split(v:val, "[\r\n]")[-1]') + call extend(self.lines, lines) + let self.result = join(self.lines, "\n") + if !complete + call remove(self.lines, -1) + endif + " To reduce the number of buffer updates + let self.tick = get(self, 'tick', -1) + 1 + if self.tick % len(s:jobs) == 0 + call s:log(self.new ? '+' : '*', self.name, self.result) + endif + elseif a:event == 'exit' + let self.running = 0 + if a:data != 0 + let self.error = 1 + endif + call s:reap(self.name) + call s:tick() + endif +endfunction + +function! s:spawn(name, cmd, opts) + let job = { 'name': a:name, 'running': 1, 'error': 0, 'lines': [], 'result': '', + \ 'new': get(a:opts, 'new', 0), + \ 'on_stdout': function('s:job_handler'), + \ 'on_exit' : function('s:job_handler'), + \ } + let s:jobs[a:name] = job + + if s:nvim + let argv = [ 'sh', '-c', + \ (has_key(a:opts, 'dir') ? s:with_cd(a:cmd, a:opts.dir) : a:cmd) ] + let jid = jobstart(argv, job) + if jid > 0 + let job.jobid = jid + else + let job.running = 0 + let job.error = 1 + let job.result = jid < 0 ? 'sh is not executable' : + \ 'Invalid arguments (or job table is full)' + endif + else + let params = has_key(a:opts, 'dir') ? [a:cmd, a:opts.dir] : [a:cmd] + let job.result = call('s:system', params) + 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' : '=' + + call s:log(job.error ? 'x' : '-', a:name, empty(job.result) ? 'OK' : job.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) + for i in range(4, line('$')) + if getline(i) =~# '^[-+x*] '.a:name.':' + return i + endif + endfor +endfunction + +function! s:log(bullet, name, lines) + if s:switch_in() + let pos = s:logpos(a:name) + if pos > 0 + execute pos 'd _' + if pos > winheight('.') + let pos = 4 + endif + else + let pos = 4 + endif + call append(pos - 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) +while 1 " Without TCO, Vim stack is bound to explode + if empty(s:update.todo) + if empty(s:jobs) && !s:update.fin + let s:update.fin = 1 + call s:update_finish() + endif + return + endif + + let name = keys(s:update.todo)[0] + let spec = remove(s:update.todo, name) + let new = !isdirectory(spec.dir) + + call s:log(new ? '+' : '*', name, pull ? 'Updating ...' : 'Installing ...') + redraw + + let has_tag = has_key(spec, 'tag') + if !new + let [error, _] = s:git_validate(spec, 0) + if empty(error) + if pull + let fetch_opt = (has_tag && !empty(globpath(spec.dir, '.git/shallow'))) ? '--depth 99999999' : '' + call s:spawn(name, printf('git fetch %s %s 2>&1', fetch_opt, prog), { 'dir': spec.dir }) + else + let s:jobs[name] = { 'running': 0, 'result': 'Already installed', 'error': 0 } + endif + else + let s:jobs[name] = { 'running': 0, 'result': error, 'error': 1 } + endif + else + call s:spawn(name, + \ printf('git clone %s %s %s %s 2>&1', + \ has_tag ? '' : s:clone_opt, + \ prog, + \ s:shellesc(spec.uri), + \ s:shellesc(s:trim(spec.dir))), { 'new': 1 }) + endif + + if !s:jobs[name].running + call s:reap(name) + endif + if len(s:jobs) >= s:update.threads + break + endif +endwhile +endfunction + +function! s:update_python() +let py_exe = has('python') ? 'python' : 'python3' +execute py_exe "<< EOF" +import datetime +import functools +import os +try: + import queue +except ImportError: + import Queue as queue +import random +import re +import shutil +import signal +import subprocess +import tempfile +import threading as thr +import time +import traceback +import vim + +G_NVIM = vim.eval("has('nvim')") == '1' +G_PULL = vim.eval('s:update.pull') == '1' +G_RETRIES = int(vim.eval('get(g:, "plug_retries", 2)')) + 1 +G_TIMEOUT = int(vim.eval('get(g:, "plug_timeout", 60)')) +G_CLONE_OPT = vim.eval('s:clone_opt') +G_PROGRESS = vim.eval('s:progress_opt(1)') +G_LOG_PROB = 1.0 / int(vim.eval('s:update.threads')) +G_STOP = thr.Event() +G_IS_WIN = vim.eval('s:is_win') == '1' + +class PlugError(Exception): + def __init__(self, msg): + self.msg = msg +class CmdTimedOut(PlugError): + pass +class CmdFailed(PlugError): + pass +class InvalidURI(PlugError): + pass +class Action(object): + INSTALL, UPDATE, ERROR, DONE = ['+', '*', 'x', '-'] + +class Buffer(object): + def __init__(self, lock, num_plugs, is_pull): + self.bar = '' + self.event = 'Updating' if is_pull else 'Installing' + self.lock = lock + self.maxy = int(vim.eval('winheight(".")')) + self.num_plugs = num_plugs + + def __where(self, name): + """ Find first line with name in current buffer. Return line num. """ + found, lnum = False, 0 + matcher = re.compile('^[-+x*] {0}:'.format(name)) + for line in vim.current.buffer: + if matcher.search(line) is not None: + found = True + break + lnum += 1 + + if not found: + lnum = -1 + return lnum + + def header(self): + curbuf = vim.current.buffer + curbuf[0] = self.event + ' plugins ({0}/{1})'.format(len(self.bar), self.num_plugs) + + num_spaces = self.num_plugs - len(self.bar) + curbuf[1] = '[{0}{1}]'.format(self.bar, num_spaces * ' ') + + with self.lock: + vim.command('normal! 2G') + vim.command('redraw') + + def write(self, action, name, lines): + first, rest = lines[0], lines[1:] + msg = ['{0} {1}{2}{3}'.format(action, name, ': ' if first else '', first)] + msg.extend([' ' + line for line in rest]) + + try: + if action == Action.ERROR: + self.bar += 'x' + vim.command("call add(s:update.errors, '{0}')".format(name)) + elif action == Action.DONE: + self.bar += '=' + + curbuf = vim.current.buffer + lnum = self.__where(name) + if lnum != -1: # Found matching line num + del curbuf[lnum] + if lnum > self.maxy and action in set([Action.INSTALL, Action.UPDATE]): + lnum = 3 + else: + lnum = 3 + curbuf.append(msg, lnum) + + self.header() + except vim.error: + pass + +class Command(object): + CD = 'cd /d' if G_IS_WIN else 'cd' + + def __init__(self, cmd, cmd_dir=None, timeout=60, cb=None, clean=None): + self.cmd = cmd + if cmd_dir: + self.cmd = '{0} {1} && {2}'.format(Command.CD, cmd_dir, self.cmd) + self.timeout = timeout + self.callback = cb if cb else (lambda msg: None) + self.clean = clean if clean else (lambda: None) + self.proc = None + + @property + def alive(self): + """ Returns true only if command still running. """ + return self.proc and self.proc.poll() is None + + def execute(self, ntries=3): + """ Execute the command with ntries if CmdTimedOut. + Returns the output of the command if no Exception. + """ + attempt, finished, limit = 0, False, self.timeout + + while not finished: + try: + attempt += 1 + result = self.try_command() + finished = True + return result + except CmdTimedOut: + if attempt != ntries: + self.notify_retry() + self.timeout += limit + else: + raise + + def notify_retry(self): + """ Retry required for command, notify user. """ + for count in range(3, 0, -1): + if G_STOP.is_set(): + raise KeyboardInterrupt + msg = 'Timeout. Will retry in {0} second{1} ...'.format( + count, 's' if count != 1 else '') + self.callback([msg]) + time.sleep(1) + self.callback(['Retrying ...']) + + def try_command(self): + """ Execute a cmd & poll for callback. Returns list of output. + Raises CmdFailed -> return code for Popen isn't 0 + Raises CmdTimedOut -> command exceeded timeout without new output + """ + first_line = True + + try: + tfile = tempfile.NamedTemporaryFile(mode='w+b') + preexec_fn = not G_IS_WIN and os.setsid or None + self.proc = subprocess.Popen(self.cmd, stdout=tfile, + stderr=subprocess.STDOUT, + stdin=subprocess.PIPE, shell=True, + preexec_fn=preexec_fn) + thrd = thr.Thread(target=(lambda proc: proc.wait()), args=(self.proc,)) + thrd.start() + + thread_not_started = True + while thread_not_started: + try: + thrd.join(0.1) + thread_not_started = False + except RuntimeError: + pass + + while self.alive: + if G_STOP.is_set(): + raise KeyboardInterrupt + + if first_line or random.random() < G_LOG_PROB: + first_line = False + line = '' if G_IS_WIN else nonblock_read(tfile.name) + if line: + self.callback([line]) + + time_diff = time.time() - os.path.getmtime(tfile.name) + if time_diff > self.timeout: + raise CmdTimedOut(['Timeout!']) + + thrd.join(0.5) + + tfile.seek(0) + result = [line.decode('utf-8', 'replace').rstrip() for line in tfile] + + if self.proc.returncode != 0: + raise CmdFailed([''] + result) + + return result + except: + self.terminate() + raise + + def terminate(self): + """ Terminate process and cleanup. """ + if self.alive: + if G_IS_WIN: + os.kill(self.proc.pid, signal.SIGINT) + else: + os.killpg(self.proc.pid, signal.SIGTERM) + self.clean() + +class Plugin(object): + def __init__(self, name, args, buf_q, lock): + self.name = name + self.args = args + self.buf_q = buf_q + self.lock = lock + self.tag = args.get('tag', 0) + + def manage(self): + try: + if os.path.exists(self.args['dir']): + self.update() + else: + self.install() + with self.lock: + thread_vim_command("let s:update.new['{0}'] = 1".format(self.name)) + except PlugError as exc: + self.write(Action.ERROR, self.name, exc.msg) + except KeyboardInterrupt: + G_STOP.set() + self.write(Action.ERROR, self.name, ['Interrupted!']) + except: + # Any exception except those above print stack trace + msg = 'Trace:\n{0}'.format(traceback.format_exc().rstrip()) + self.write(Action.ERROR, self.name, msg.split('\n')) + raise + + def install(self): + target = self.args['dir'] + if target[-1] == '\\': + target = target[0:-1] + + def clean(target): + def _clean(): + try: + shutil.rmtree(target) + except OSError: + pass + return _clean + + self.write(Action.INSTALL, self.name, ['Installing ...']) + callback = functools.partial(self.write, Action.INSTALL, self.name) + cmd = 'git clone {0} {1} {2} {3} 2>&1'.format( + '' if self.tag else G_CLONE_OPT, G_PROGRESS, self.args['uri'], + esc(target)) + com = Command(cmd, None, G_TIMEOUT, callback, clean(target)) + result = com.execute(G_RETRIES) + self.write(Action.DONE, self.name, result[-1:]) + + def repo_uri(self): + cmd = 'git rev-parse --abbrev-ref HEAD 2>&1 && git config -f .git/config remote.origin.url' + command = Command(cmd, self.args['dir'], G_TIMEOUT,) + result = command.execute(G_RETRIES) + return result[-1] + + def update(self): + match = re.compile(r'git::?@') + actual_uri = re.sub(match, '', self.repo_uri()) + expect_uri = re.sub(match, '', self.args['uri']) + if actual_uri != expect_uri: + 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 + + 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 + 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 { + while VIM::evaluate('getchar(1)') + sleep 0.1 + end + mtx.synchronize do + running = false + threads.each { |t| t.raise Interrupt } + end + threads.each { |t| t.join rescue nil } + main.kill + } + refresh = Thread.new { + while true + mtx.synchronize do + break unless running + VIM::command('noautocmd normal! a') + end + sleep 0.2 + end + } if VIM::evaluate('s:mac_gui') == 1 + + clone_opt = VIM::evaluate('s:clone_opt') + progress = VIM::evaluate('s:progress_opt(1)') + nthr.times do + mtx.synchronize do + threads << Thread.new { + while pair = take1.call + name = pair.first + dir, uri, tag = pair.last.values_at *%w[dir uri tag] + exists = File.directory? dir + ok, result = + if exists + chdir = "#{cd} #{iswin ? dir : esc(dir)}" + ret, data = bt.call "#{chdir} && git rev-parse --abbrev-ref HEAD 2>&1 && git config -f .git/config remote.origin.url", nil, nil, nil + current_uri = data.lines.to_a.last + if !ret + if data =~ /^Interrupted|^Timeout/ + [false, data] + else + [false, [data.chomp, "PlugClean required."].join($/)] + end + elsif current_uri.sub(/git::?@/, '') != uri.sub(/git::?@/, '') + [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(arg) + return '"'.escape(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) + let a = substitute(a:a, 'git:\{1,2}@', '', '') + let b = substitute(a:b, 'git:\{1,2}@', '', '') + return a ==# b +endfunction + +function! s:format_message(bullet, name, message) + if a:bullet != 'x' + return [printf('%s %s: %s', a:bullet, a:name, s:lastline(a:message))] + else + let lines = map(s:lines(a:message), '" ".v:val') + return extend([printf('x %s:', a:name)], lines) + endif +endfunction + +function! s:with_cd(cmd, dir) + return printf('cd%s %s && %s', s:is_win ? ' /d' : '', s:shellesc(a:dir), a:cmd) +endfunction + +function! s:system(cmd, ...) + try + let [sh, shrd] = s:chsh(1) + let cmd = a:0 > 0 ? s:with_cd(a:cmd, a:1) : a:cmd + return system(s:is_win ? '('.cmd.')' : cmd) + finally + let [&shell, &shellredir] = [sh, shrd] + endtry +endfunction + +function! s:system_chomp(...) + let ret = call('s:system', a:000) + return v:shell_error ? '' : substitute(ret, '\n$', '', '') +endfunction + +function! s:git_validate(spec, check_branch) + let err = '' + if isdirectory(a:spec.dir) + let result = s:lines(s:system('git rev-parse --abbrev-ref HEAD 2>&1 && git config -f .git/config remote.origin.url', a:spec.dir)) + let remote = result[-1] + if v:shell_error + let err = join([remote, 'PlugClean required.'], "\n") + elseif !s:compare_git_uri(remote, a:spec.uri) + let err = join(['Invalid URI: '.remote, + \ 'Expected: '.a:spec.uri, + \ 'PlugClean required.'], "\n") + elseif a:check_branch && has_key(a:spec, 'commit') + let result = s:lines(s:system('git rev-parse HEAD 2>&1', a:spec.dir)) + let sha = result[-1] + if v:shell_error + let err = join(add(result, 'PlugClean required.'), "\n") + elseif !s:hash_match(sha, a:spec.commit) + let err = join([printf('Invalid HEAD (expected: %s, actual: %s)', + \ a:spec.commit[:6], sha[:6]), + \ 'PlugUpdate required.'], "\n") + endif + elseif a:check_branch + let branch = result[0] + " Check tag + if has_key(a:spec, 'tag') + let tag = s:system_chomp('git describe --exact-match --tags HEAD 2>&1', a:spec.dir) + if a:spec.tag !=# tag + let err = printf('Invalid tag: %s (expected: %s). Try PlugUpdate.', + \ (empty(tag) ? 'N/A' : tag), a:spec.tag) + endif + " Check branch + elseif a:spec.branch !=# branch + let err = printf('Invalid branch: %s (expected: %s). Try PlugUpdate.', + \ branch, a:spec.branch) + endif + if empty(err) + let commits = len(s:lines(s:system(printf('git rev-list origin/%s..HEAD', a:spec.branch), a:spec.dir))) + if !v:shell_error && commits + let err = join([printf('Diverged from origin/%s by %d commit(s).', a:spec.branch, commits), + \ 'Reinstall after PlugClean.'], "\n") + endif + endif + endif + else + let err = 'Not found' + endif + return [err, err =~# 'PlugClean'] +endfunction + +function! s:rm_rf(dir) + if isdirectory(a:dir) + call s:system((s:is_win ? 'rmdir /S /Q ' : 'rm -rf ') . s:shellesc(a:dir)) + endif +endfunction + +function! s:clean(force) + call s:prepare() + call append(0, 'Searching for invalid plugins in '.g:plug_home) + call append(1, '') + + " List of valid directories + let dirs = [] + let errs = {} + let [cnt, total] = [0, len(g:plugs)] + for [name, spec] in items(g:plugs) + if !s:is_managed(name) + call add(dirs, spec.dir) + else + let [err, clean] = s:git_validate(spec, 1) + if clean + let errs[spec.dir] = s:lines(err)[0] + else + call add(dirs, spec.dir) + endif + endif + let cnt += 1 + call s:progress_bar(2, repeat('=', cnt), total) + normal! 2G + redraw + endfor + + let allowed = {} + for dir in dirs + let allowed[s:dirpath(fnamemodify(dir, ':h:h'))] = 1 + let allowed[dir] = 1 + for child in s:glob_dir(dir) + let allowed[child] = 1 + endfor + endfor + + let todo = [] + let found = sort(s:glob_dir(g:plug_home)) + while !empty(found) + let f = remove(found, 0) + if !has_key(allowed, f) && isdirectory(f) + call add(todo, f) + call append(line('$'), '- ' . f) + if has_key(errs, f) + call append(line('$'), ' ' . errs[f]) + endif + let found = filter(found, 'stridx(v:val, f) != 0') + end + endwhile + + 4 + redraw + if empty(todo) + call append(line('$'), 'Already clean.') + else + if a:force || s:ask('Proceed?') + for dir in todo + call s:rm_rf(dir) + endfor + call append(3, ['Removed.', '']) + else + call append(3, ['Cancelled.', '']) + endif + endif + 4 +endfunction + +function! s:upgrade() + echo 'Downloading the latest version of vim-plug' + redraw + let tmp = tempname() + let new = tmp . '/plug.vim' + + try + let out = s:system(printf('git clone --depth 1 %s %s', s:plug_src, tmp)) + if v:shell_error + return s:err('Error upgrading vim-plug: '. out) + endif + + if readfile(s:me) ==# readfile(new) + echo 'vim-plug is already up-to-date' + return 0 + else + call rename(s:me, s:me . '.old') + call rename(new, s:me) + unlet g:loaded_plug + echo 'vim-plug has been upgraded' + return 1 + endif + finally + silent! call s:rm_rf(tmp) + endtry +endfunction + +function! s:upgrade_specs() + for spec in values(g:plugs) + let spec.frozen = get(spec, 'frozen', 0) + endfor +endfunction + +function! s:status() + call s:prepare() + call append(0, 'Checking plugins') + call append(1, '') + + let ecnt = 0 + let unloaded = 0 + let [cnt, total] = [0, len(g:plugs)] + for [name, spec] in items(g:plugs) + if has_key(spec, 'uri') + if isdirectory(spec.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 isdirectory(spec.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 valid && 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}') + 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 + + execute 'pedit' sha + wincmd P + setlocal filetype=git buftype=nofile nobuflisted modifiable + execute 'silent read !cd' s:shellesc(g:plugs[name].dir) '&& git show --no-color --pretty=medium' sha + normal! gg"_dd + setlocal nomodifiable + nnoremap q :q + wincmd p +endfunction + +function! s:section(flags) + call search('\(^[x-] \)\@<=[^:]\+:', a:flags) +endfunction + +function! s:format_git_log(line) + let indent = ' ' + let tokens = split(a:line, nr2char(1)) + if len(tokens) != 5 + return indent.substitute(a:line, '\s*$', '', '') + endif + let [graph, sha, refs, subject, date] = tokens + let tag = matchstr(refs, 'tag: [^,)]\+') + let tag = empty(tag) ? ' ' : ' ('.tag.') ' + return printf('%s%s%s%s%s (%s)', indent, graph, sha, tag, subject, date) +endfunction + +function! s:append_ul(lnum, text) + call append(a:lnum, ['', a:text, repeat('-', len(a:text))]) +endfunction + +function! s:diff() + call s:prepare() + call append(0, ['Collecting changes ...', '']) + let cnts = [0, 0] + let bar = '' + let total = filter(copy(g:plugs), 's:is_managed(v:key) && isdirectory(v:val.dir)') + call s:progress_bar(2, bar, len(total)) + for origin in [1, 0] + let plugs = reverse(sort(items(filter(copy(total), (origin ? '' : '!').'(has_key(v:val, "commit") || has_key(v:val, "tag"))')))) + if empty(plugs) + continue + endif + call s:append_ul(2, origin ? 'Pending updates:' : 'Last update:') + for [k, v] in plugs + let range = origin ? '..origin/'.v.branch : 'HEAD@{1}..' + let diff = s:system_chomp('git log --graph --color=never --pretty=format:"%x01%h%x01%d%x01%s%x01%cr" '.s:shellesc(range), v.dir) + if !empty(diff) + let ref = has_key(v, 'tag') ? (' (tag: '.v.tag.')') : has_key(v, 'commit') ? (' '.v.commit) : '' + call append(5, extend(['', '- '.k.':'.ref], map(s:lines(diff), 's:format_git_log(v:val)'))) + let cnts[origin] += 1 + endif + let bar .= '=' + call s:progress_bar(2, bar, len(total)) + normal! 2G + redraw + endfor + if !cnts[origin] + call append(5, ['', 'N/A']) + endif + endfor + call setline(1, printf('%d plugin(s) updated.', cnts[0]) + \ . (cnts[1] ? printf(' %d plugin(s) have pending updates.', cnts[1]) : '')) + + if cnts[0] || cnts[1] + nnoremap :silent! call preview_commit() + nnoremap o :silent! call preview_commit() + endif + if cnts[0] + nnoremap X :call revert() + echo "Press 'X' on each block to revert the update" + endif + normal! gg + setlocal nomodifiable +endfunction + +function! s:revert() + if search('^Pending updates', 'bnW') + return + endif + + let name = s:find_name(line('.')) + if empty(name) || !has_key(g:plugs, name) || + \ input(printf('Revert the update of %s? (y/N) ', name)) !~? '^y' + return + endif + + call s:system('git reset --hard HEAD@{1} && git checkout '.s:esc(g:plugs[name].branch), g:plugs[name].dir) + setlocal modifiable + normal! "_dap + setlocal nomodifiable + echo 'Reverted.' +endfunction + +function! s:snapshot(force, ...) abort + call s:prepare() + setf vim + call append(0, ['" Generated by vim-plug', + \ '" '.strftime("%c"), + \ '" :source this file in vim to restore the snapshot', + \ '" or execute: vim -S snapshot.vim', + \ '', '', 'PlugUpdate!']) + 1 + let anchor = line('$') - 3 + let names = sort(keys(filter(copy(g:plugs), + \'has_key(v:val, "uri") && !has_key(v:val, "commit") && isdirectory(v:val.dir)'))) + for name in reverse(names) + let sha = s:system_chomp('git rev-parse --short HEAD', g:plugs[name].dir) + if !empty(sha) + call append(anchor, printf("silent! let g:plugs['%s'].commit = '%s'", name, sha)) + redraw + endif + endfor + + if a:0 > 0 + let fn = expand(a:1) + if filereadable(fn) && !(a:force || s:ask(a:1.' already exists. Overwrite?')) + return + endif + call writefile(getline(1, '$'), fn) + echo 'Saved as '.a:1 + silent execute 'e' s:esc(fn) + setf vim + endif +endfunction + +function! s:split_rtp() + return split(&rtp, '\\\@ K DashSearch - endif - - NeoBundle 'tpope/vim-sleuth' " auto-config indent and tabs etc based on other files - - NeoBundle 'tpope/vim-endwise' " Auto-add 'end' etc appropriately in various languages - NeoBundle 'kana/vim-smartinput' - NeoBundleLazy 'tpope/vim-vinegar', { 'autoload' : { 'filetypes' : ['netrw'] } } - - " Languages/Syntaxes/Frameworks {{{ - NeoBundleLazy 'wting/rust.vim', { 'autoload' : { 'filetypes' : ['rust'] } } - au BufNewFile,BufRead *.rs set filetype=rust - - NeoBundleLazy 'jnwhiteh/vim-golang', { 'autoload' : { 'filetypes' : ['go'] } } - au BufNewFile,BufRead *.go set filetype=go - au FileType go autocmd BufWritePre Fmt - au FileType go set noexpandtab - - " Ruby {{{ - NeoBundleLazy 'vim-ruby/vim-ruby' - NeoBundleLazy 'tpope/vim-rails' - NeoBundleLazy 'tpope/vim-rake' - NeoBundleLazy 'tpope/vim-bundler' - NeoBundleLazy 'thisivan/vim-ruby-matchit' - NeoBundleLazy 'nelstrom/vim-textobj-rubyblock', { 'depends' : ['kana/vim-textobj-user', 'thisivan/vim-matchit'] } - autocmd FileType ruby NeoBundleSource - \ vim-ruby - \ vim-rails " <- how to maket his only load in rails projects? - \ vim-bundler - \ vim-rake - \ vim-haml - \ vim-ruby-matchit - \ vim-textobj-rubyblock - " }}} - - " Clojure(script) {{{ - NeoBundleLazy 'guns/vim-clojure-static' - NeoBundleLazy 'guns/vim-sexp', { 'depends' : ['tpope/vim-repeat'] } - NeoBundleLazy 'tpope/vim-sexp-mappings-for-regular-people', { 'depends' : ['guns/vim-sexp'] } - NeoBundleLazy 'tpope/vim-dispatch' - NeoBundleLazy 'tpope/vim-leiningen', { 'depends' : ['tpope/vim-dispatch'] } - NeoBundleLazy 'tpope/vim-fireplace', { 'depends' : ['tpope/vim-leiningen']} - - autocmd FileType clojure,clojurescript NeoBundleSource - \ vim-clojure-static - \ vim-sexp-mappings-for-regular-people - \ vim-fireplace - - autocmd FileType clojure,clojurescript set lispwords-='->' - autocmd FileType clojure,clojurescript set lispwords-='->>' - " }}} - - NeoBundleLazy 'tpope/vim-markdown', { 'autoload' : { 'filetypes' : ['markdown'] } } - - " HTML/CSS/Javascript {{{ - NeoBundleLazy 'tpope/vim-haml', { 'autoload' : { 'filetypes' : 'haml' } } - NeoBundleLazy 'kchmck/vim-coffee-script', { 'autoload' : { 'filetypes' : 'coffee' } } - NeoBundleLazy 'pangloss/vim-javascript', { 'autoload' : { 'filetypes' : 'javascript' } } - NeoBundleLazy 'css3', { 'autoload' : { 'filetypes' : 'css' } } - NeoBundleLazy 'othree/html5-syntax.vim', { 'autoload' : { 'filetypes' : 'html' } } - NeoBundleLazy 'slim-template/vim-slim', { 'autoload' : { 'filetypes' : 'slim' } } - " }}} - - " }}} - - " Git {{{ - NeoBundle 'tpope/vim-fugitive', { 'augroup': 'fugitive' } - NeoBundle 'tpope/vim-git' - NeoBundle 'tjennings/git-grep-vim' - " }}} - - " Text objects {{{ - NeoBundle 'michaeljsmith/vim-indent-object' - NeoBundle 'argtextobj.vim' - " }}} - - " Utility {{{ - - NeoBundle 'tpope/vim-surround', { 'depends' : 'tpope/vim-repeat' } - - NeoBundleLazy 'AutoComplPop', { 'autoload' : { 'insert' : 1 } } - let g:acp_enableAtStartup = 0 - let g:acp_completeoptPreview = 1 - let g:acp_behaviorKeywordLength = 3 - let g:acp_behaviorKeywordIgnores = [ - \ 'the', 'def', 'end', - \ 'else', 'elsif', 'elif', 'endif', 'then', - \ 'case', 'done', 'do' - \ ] - - NeoBundle 'junegunn/vim-easy-align' - vmap (EasyAlign) - nmap a (EasyAlign) - - NeoBundle 'tpope/vim-commentary' - autocmd FileType clojure,clojurescript set commentstring=;\ %s - nmap // CommentaryLine - vmap // Commentary - - NeoBundle 'kien/ctrlp.vim' - - NeoBundle 'Syntastic' - let g:syntastic_enable_signs = 1 - let g:syntastic_auto_loc_list = 0 - " }}} - - filetype plugin indent on - - NeoBundleCheck -augroup END +if empty(glob('~/.vim/autoload/plug.vim')) + silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs + \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim + autocmd VimEnter * PlugInstall | source $MYVIMRC +endif + +call plug#begin('~/.vim/plugged') + +Plug 'w0ng/vim-hybrid' + +Plug 'tpope/vim-sensible' " Sensible defaults, duh + +Plug 'tpope/vim-commentary' +Plug 'tpope/vim-dispatch' +Plug 'tpope/vim-endwise' " Auto-add 'end' etc appropriately in various languages +Plug 'tpope/vim-fugitive' +Plug 'tpope/vim-git' +Plug 'tpope/vim-repeat' +"Plug 'tpope/vim-sleuth' " auto-config indent and tabs etc based on other files +Plug 'tpope/vim-surround' " quoting/parenthesizing made simple +Plug 'tpope/vim-vinegar' " Nicer netrw +Plug 'terryma/vim-expand-region' +if has('signs') + Plug 'airblade/vim-gitgutter' +endif +Plug 'kana/vim-smartinput' " smart pairwise characters +Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } +Plug 'junegunn/fzf.vim' +Plug 'junegunn/vim-peekaboo' +Plug 'junegunn/vim-easy-align', { 'on': ['(EasyAlign)', 'EasyAlign'] } +vmap (EasyAlign) +nmap a (EasyAlign) + +Plug 'thisivan/vim-matchit' " Extended % matching for HTML, LaTeX, and many other languages +Plug 'kana/vim-textobj-user' " Create new text objects +Plug 'michaeljsmith/vim-indent-object' +Plug 'argtextobj.vim' + + +"let g:crystal_auto_format = 1 +Plug 'rhysd/vim-crystal' " polyglot doesn't include plugin dir, where much of plugin is set +let g:polyglot_disabled = ['crystal'] +Plug 'sheerun/vim-polyglot' + +" I pretty much only work with Postgres SQL, so assume *.sql files belong to +" that syntax: +let g:sql_type_default = 'pgsql' + +Plug 'tpope/vim-bundler' +Plug 'tpope/vim-rails' +Plug 'tpope/vim-rake' +Plug 'thisivan/vim-ruby-matchit' +Plug 'nelstrom/vim-textobj-rubyblock', { 'for': 'ruby' } + +Plug 'Chiel92/vim-autoformat' + +Plug 'janko-m/vim-test' +let test#strategy = "dispatch" " Run test using vim-dispatch + +Plug 'scrooloose/syntastic' +let g:syntastic_enable_signs = 1 +let g:syntastic_auto_loc_list = 0 + +Plug 'vim-airline/vim-airline' +let g:airline_powerline_fonts = 1 + +call plug#end() + +" " Clojure(script) {{{ +" NeoBundleLazy 'guns/vim-sexp', { 'depends' : ['tpope/vim-repeat'] } +" NeoBundleLazy 'tpope/vim-sexp-mappings-for-regular-people', { 'depends' : ['guns/vim-sexp'] } +" NeoBundleLazy 'tpope/vim-dispatch' +" NeoBundleLazy 'tpope/vim-leiningen', { 'depends' : ['tpope/vim-dispatch'] } +" NeoBundleLazy 'tpope/vim-fireplace', { 'depends' : ['tpope/vim-leiningen']} +" +" autocmd FileType clojure,clojurescript NeoBundleSource +" \ vim-clojure-static +" \ vim-sexp-mappings-for-regular-people +" \ vim-fireplace +" +" autocmd FileType clojure,clojurescript set lispwords-='->' +" autocmd FileType clojure,clojurescript set lispwords-='->>' +" " }}} +" +" " }}} +" +" " Git {{{ +" NeoBundle 'tpope/vim-fugitive', { 'augroup': 'fugitive' } +" NeoBundle 'tpope/vim-git' +" " }}} +" +" +" +" " }}} diff --git a/editors/vim/gvimrc b/editors/vim/gvimrc index 8b08f980..ee9a5dc1 100644 --- a/editors/vim/gvimrc +++ b/editors/vim/gvimrc @@ -18,5 +18,5 @@ end " Source vimrc after saving it autocmd! BufWritePost .gvimrc,gvimrc source $MYGVIMRC -autocmd! BufWritePost .vimrc,vimrc source $MYVIMRC | source $MYGVIMRC | NERDTreeToggle | NERDTreeToggle +autocmd! BufWritePost .vimrc,vimrc source $MYVIMRC | source $MYGVIMRC diff --git a/editors/vim/init.vim b/editors/vim/init.vim new file mode 120000 index 00000000..f16220cc --- /dev/null +++ b/editors/vim/init.vim @@ -0,0 +1 @@ +/Users/bjeanes/.vimrc \ No newline at end of file diff --git a/editors/vim/ui.vim b/editors/vim/ui.vim index af968ecf..0e350357 100644 --- a/editors/vim/ui.vim +++ b/editors/vim/ui.vim @@ -7,10 +7,7 @@ syntax on set linespace=2 set background=dark set laststatus=2 - colorscheme tubster_bo - - set rtp+=~/.config/vendor/powerline/powerline/bindings/vim - + colorscheme hybrid " Tabs/Whitespace set tabstop=2 " a Tab take up 2 spaces @@ -34,7 +31,9 @@ syntax on set whichwrap=b,s,h,l,<,>,[,] set autoread " watch for file changes set mouse=a " mouse can be handy sometimes - set ttymouse=xterm2 " Needed to get mouse working when in Tmux/screen + if !has('nvim') + set ttymouse=xterm2 " Needed to get mouse working when in Tmux/screen + endif set fileformats=unix set history=1000 set nohidden " unload a buffer when abandoned, please diff --git a/editors/vim/vimrc b/editors/vim/vimrc index a3c462e4..2a9d228f 100644 --- a/editors/vim/vimrc +++ b/editors/vim/vimrc @@ -1,8 +1,10 @@ set nocompatible +let mapleader = "\" + +source ~/.vim/bundles.vim source ~/.vim/ui.vim source ~/.vim/autocommands.vim -source ~/.vim/bundles.vim source ~/.vim/ruby.vim set backupdir=~/.vim/dirs/backups " store file backups here @@ -30,3 +32,5 @@ if filereadable(expand('~/.vimrc.local')) source ~/.vimrc.local endif +map :Files + diff --git a/nvim b/nvim new file mode 120000 index 00000000..39817380 --- /dev/null +++ b/nvim @@ -0,0 +1 @@ +/Users/bjeanes/.vim \ No newline at end of file From 0a87a67cee6eec6db436dc6acd7ea986ce121861 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Tue, 21 Feb 2017 12:30:46 +1100 Subject: [PATCH 110/234] Update vim-plug --- editors/vim/autoload/plug.vim | 426 ++++++++++++++++++++++++---------- 1 file changed, 308 insertions(+), 118 deletions(-) diff --git a/editors/vim/autoload/plug.vim b/editors/vim/autoload/plug.vim index d916ff07..7819a5a7 100644 --- a/editors/vim/autoload/plug.vim +++ b/editors/vim/autoload/plug.vim @@ -18,7 +18,7 @@ " " Any valid git URL is allowed " Plug 'https://github.com/junegunn/vim-github-dashboard.git' " -" " Group dependencies, vim-snippets depends on ultisnips +" " Multiple Plug commands can be written in a single line using | separators " Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets' " " " On-demand loading @@ -40,7 +40,7 @@ " " Unmanaged plugin (manually installed and updated) " Plug '~/my-prototype-plugin' " -" " Add plugins to &runtimepath +" " Initialize plugin system " call plug#end() " " Then reload .vimrc and :PlugInstall to install plugins. @@ -61,7 +61,7 @@ " More information: https://github.com/junegunn/vim-plug " " -" Copyright (c) 2016 Junegunn Choi +" Copyright (c) 2017 Junegunn Choi " " MIT License " @@ -98,6 +98,7 @@ let s:plug_buf = get(s:, 'plug_buf', -1) let s:mac_gui = has('gui_macvim') && has('gui_running') let s:is_win = has('win32') || has('win64') let s:nvim = has('nvim') && exists('*jobwait') && !s:is_win +let s:vim8 = has('patch-8.0.0039') && exists('*job_start') let s:me = resolve(expand(':p')) let s:base_spec = { 'branch': 'master', 'frozen': 0 } let s:TYPE = { @@ -171,14 +172,22 @@ function! s:assoc(dict, key, val) let a:dict[a:key] = add(get(a:dict, a:key, []), a:val) endfunction -function! s:ask(message) +function! s:ask(message, ...) call inputsave() echohl WarningMsg - let proceed = input(a:message.' (y/N) ') =~? '^y' + let answer = input(a:message.(a:0 ? ' (y/N/a) ' : ' (y/N) ')) echohl None call inputrestore() echo "\r" - return proceed + return (a:0 && answer =~? '^a') ? 2 : (answer =~? '^y') ? 1 : 0 +endfunction + +function! s:ask_no_interrupt(...) + try + return call('s:ask', a:000) + catch + return 0 + endtry endfunction function! plug#end() @@ -194,8 +203,13 @@ function! plug#end() endif let lod = { 'ft': {}, 'map': {}, 'cmd': {} } - filetype off + if exists('g:did_load_filetypes') + filetype off + endif for name in g:plugs_order + if !has_key(g:plugs, name) + continue + endif let plug = g:plugs[name] if get(s:loaded, name, 0) || !has_key(plug, 'on') && !has_key(plug, 'for') let s:loaded[name] = 1 @@ -211,6 +225,7 @@ function! plug#end() 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 @@ -237,7 +252,7 @@ function! plug#end() for [cmd, names] in items(lod.cmd) execute printf( - \ 'command! -nargs=* -range -bang %s call s:lod_cmd(%s, "", , , , %s)', + \ 'command! -nargs=* -range -bang -complete=file %s call s:lod_cmd(%s, "", , , , %s)', \ cmd, string(cmd), string(names)) endfor @@ -245,8 +260,8 @@ function! plug#end() for [mode, map_prefix, key_prefix] in \ [['i', '', ''], ['n', '', ''], ['v', '', 'gv'], ['o', '', '']] execute printf( - \ '%snoremap %s %s:call lod_map(%s, %s, "%s")', - \ mode, map, map_prefix, string(map), string(names), key_prefix) + \ '%snoremap %s %s:call lod_map(%s, %s, %s, "%s")', + \ mode, map, map_prefix, string(map), string(names), mode != 'i', key_prefix) endfor endfor @@ -264,7 +279,7 @@ function! plug#end() syntax enable end else - call s:reload() + call s:reload_plugins() endif endfunction @@ -272,9 +287,13 @@ function! s:loaded_names() return filter(copy(g:plugs_order), 'get(s:loaded, v:val, 0)') endfunction -function! s:reload() +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:source(s:rtp(g:plugs[name]), 'plugin/**/*.vim', 'after/plugin/**/*.vim') + call s:load_plugin(g:plugs[name]) endfor endfunction @@ -294,7 +313,7 @@ endfunction function! s:git_version_requirement(...) if !exists('s:git_version') - let s:git_version = map(split(split(s:system('git --version'))[-1], '\.'), 'str2nr(v:val)') + 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 @@ -383,7 +402,7 @@ function! s:reorg_rtp() 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")'), 'isdirectory(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, ",")'), ',') @@ -407,7 +426,10 @@ function! s:dobufread(names) let path = s:rtp(g:plugs[name]).'/**' for dir in ['ftdetect', 'ftplugin'] if len(finddir(dir, path)) - return s:doautocmd('BufRead') + if exists('#BufRead') + doautocmd BufRead + endif + return endif endfor endfor @@ -482,7 +504,7 @@ function! s:lod_cmd(cmd, bang, l1, l2, args, 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, prefix) +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 = '' @@ -493,7 +515,19 @@ function! s:lod_map(map, names, prefix) endif let extra .= nr2char(c) endwhile - call feedkeys(a:prefix . substitute(a:map, '^', "\", '') . extra) + + 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, ...) @@ -546,8 +580,7 @@ function! s:infer_properties(name, repo) let fmt = get(g:, 'plug_url_format', 'https://git::@github.com/%s.git') let uri = printf(fmt, repo) endif - let dir = s:dirpath( fnamemodify(join([g:plug_home, a:name], '/'), ':p') ) - return { 'dir': dir, 'uri': uri } + return { 'dir': s:dirpath(g:plug_home.'/'.a:name), 'uri': uri } endif endfunction @@ -588,13 +621,14 @@ function! s:syntax() syn match plugTag /(tag: [^)]\+)/ syn match plugInstall /\(^+ \)\@<=[^:]*/ syn match plugUpdate /\(^* \)\@<=[^:]*/ - syn match plugCommit /^ \X*[0-9a-f]\{7} .*/ contains=plugRelDate,plugEdge,plugTag + 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}/ contained + syn match plugSha /[0-9a-f]\{7,9}/ contained syn match plugRelDate /([^)]*)$/ contained syn match plugNotLoaded /(not loaded)$/ syn match plugError /^x.*/ + syn region plugDeleted start=/^\~ .*/ end=/^\ze\S/ syn match plugH2 /^.*:\n-\+$/ syn keyword Function PlugInstall PlugStatus PlugUpdate PlugClean hi def link plug1 Title @@ -614,6 +648,7 @@ function! s:syntax() 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 @@ -691,12 +726,22 @@ function! s:prepare(...) 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() - normal q + if b:plug_preview == 1 + pc + endif + enew + else + call s:new_window() endif - call s:new_window() nnoremap q :if b:plug_preview==1pcendifbd if a:0 == 0 call s:finish_bindings() @@ -706,11 +751,10 @@ function! s:prepare(...) let s:plug_buf = winbufnr(0) call s:assign_name() - silent! unmap - silent! unmap L - silent! unmap o - silent! unmap X - setlocal buftype=nofile bufhidden=wipe nobuflisted noswapfile nowrap cursorline modifiable + for k in ['', 'L', 'o', 'X', 'd', 'dd'] + execute 'silent! unmap ' k + endfor + setlocal buftype=nofile bufhidden=wipe nobuflisted nolist noswapfile nowrap cursorline modifiable nospell setf vim-plug if exists('g:syntax_on') call s:syntax() @@ -775,7 +819,24 @@ function! s:do(pull, force, todo) let error = '' let type = type(spec.do) if type == s:TYPE.string - let error = s:bang(spec.do) + if spec.do[0] == ':' + if !get(s:loaded, name, 0) + let s:loaded[name] = 1 + call s:reorg_rtp() + endif + call s:load_plugin(spec) + try + execute spec.do[1:] + catch + let error = v:exception + endtry + if !s:plug_window_exists() + cd - + throw 'Warning: vim-plug was terminated by the post-update hook of '.name + endif + else + let error = s:bang(spec.do) + endif elseif type == s:TYPE.funcref try let status = installed ? 'installed' : (updated ? 'updated' : 'unchanged') @@ -786,6 +847,7 @@ function! s:do(pull, force, todo) 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) @@ -864,7 +926,8 @@ function! s:check_ruby() endfunction function! s:update_impl(pull, force, args) abort - let args = copy(a:args) + 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) @@ -898,8 +961,9 @@ function! s:update_impl(pull, force, args) abort call s:warn('echom', '[vim-plug] Update Neovim for parallel installer') endif - let python = (has('python') || has('python3')) && (!s:nvim || has('vim_starting')) - let ruby = has('ruby') && !s:nvim && (v:version >= 703 || v:version == 702 && has('patch374')) && !(s:is_win && has('gui_running')) && s:check_ruby() + 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(), @@ -909,7 +973,7 @@ function! s:update_impl(pull, force, args) abort \ 'pull': a:pull, \ 'force': a:force, \ 'new': {}, - \ 'threads': (python || ruby || s:nvim) ? min([len(todo), threads]) : 1, + \ 'threads': (python || ruby || use_job) ? min([len(todo), threads]) : 1, \ 'bar': '', \ 'fin': 0 \ } @@ -923,7 +987,7 @@ function! s:update_impl(pull, force, args) abort \ '--depth 1' . (s:git_version_requirement(1, 7, 10) ? ' --no-single-branch' : '') : '' " Python version requirement (>= 2.7) - if python && !has('python3') && !ruby && !s:nvim && s:update.threads > 1 + if python && !has('python3') && !ruby && !use_job && s:update.threads > 1 redir => pyv silent python import platform; print platform.python_version() redir END @@ -964,6 +1028,12 @@ function! s:update_impl(pull, force, args) abort endtry else call s:update_vim() + while use_job && sync + sleep 100m + if s:update.fin + break + endif + endwhile endif endfunction @@ -979,7 +1049,7 @@ function! s:update_finish() 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) + let [pos, _] = s:logpos(name) if !pos continue endif @@ -1009,19 +1079,25 @@ function! s:update_finish() call s:log4(name, 'Updating submodules. This may take a while.') let out .= s:bang('git submodule update --init --recursive 2>&1', spec.dir) endif - let msg = printf('%s %s: %s', v:shell_error ? 'x': '-', name, s:lastline(out)) + 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() - execute pos 'd _' + silent execute pos 'd _' call append(4, msg) | 4 elseif !empty(out) - call setline(pos, msg) + call setline(pos, msg[0]) endif redraw endfor - 4 d _ - 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")')) + 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') @@ -1029,12 +1105,16 @@ function! s:update_finish() endfunction function! s:job_abort() - if !s:nvim || !exists('s:jobs') + if (!s:nvim && !s:vim8) || !exists('s:jobs') return endif for [name, j] in items(s:jobs) - silent! call jobstop(j.jobid) + if s:nvim + silent! call jobstop(j.jobid) + elseif s:vim8 + silent! call job_stop(j.jobid) + endif if j.new call s:system('rm -rf ' . s:shellesc(g:plugs[name].dir)) endif @@ -1042,59 +1122,88 @@ function! s:job_abort() let s:jobs = {} endfunction -" When a:event == 'stdout', data = list of strings -" When a:event == 'exit', data = returncode -function! s:job_handler(job_id, data, event) abort +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 - if a:event == 'stdout' - let complete = empty(a:data[-1]) - let lines = map(filter(a:data, 'len(v:val) > 0'), 'split(v:val, "[\r\n]")[-1]') - call extend(self.lines, lines) - let self.result = join(self.lines, "\n") - if !complete - call remove(self.lines, -1) - endif - " To reduce the number of buffer updates - let self.tick = get(self, 'tick', -1) + 1 - if self.tick % len(s:jobs) == 0 - call s:log(self.new ? '+' : '*', self.name, self.result) - endif - elseif a:event == 'exit' - let self.running = 0 - if a:data != 0 - let self.error = 1 - endif - call s:reap(self.name) - call s:tick() - endif +function! s:nvim_cb(job_id, data, event) dict abort + return a:event == 'stdout' ? + \ s:job_cb('s:job_out_cb', self, 0, join(a:data, "\n")) : + \ s:job_cb('s:job_exit_cb', self, 0, a:data) endfunction function! s:spawn(name, cmd, opts) - let job = { 'name': a:name, 'running': 1, 'error': 0, 'lines': [], 'result': '', - \ 'new': get(a:opts, 'new', 0), - \ 'on_stdout': function('s:job_handler'), - \ 'on_exit' : function('s:job_handler'), - \ } + let job = { 'name': a:name, 'running': 1, 'error': 0, 'lines': [''], + \ 'new': get(a:opts, 'new', 0) } let s:jobs[a:name] = job + let argv = add(s:is_win ? ['cmd', '/c'] : ['sh', '-c'], + \ has_key(a:opts, 'dir') ? s:with_cd(a:cmd, a:opts.dir) : a:cmd) if s:nvim - let argv = [ 'sh', '-c', - \ (has_key(a:opts, 'dir') ? s:with_cd(a:cmd, a:opts.dir) : a:cmd) ] + call extend(job, { + \ 'on_stdout': function('s:nvim_cb'), + \ 'on_exit': function('s:nvim_cb'), + \ }) let jid = jobstart(argv, job) if jid > 0 let job.jobid = jid else let job.running = 0 let job.error = 1 - let job.result = jid < 0 ? 'sh is not executable' : - \ 'Invalid arguments (or job table is full)' + let job.lines = [jid < 0 ? argv[0].' is not executable' : + \ 'Invalid arguments (or job table is full)'] + endif + elseif s:vim8 + let jid = job_start(s:is_win ? join(argv, ' ') : argv, { + \ 'out_cb': function('s:job_cb', ['s:job_out_cb', job]), + \ 'exit_cb': function('s:job_cb', ['s:job_exit_cb', job]), + \ 'out_mode': 'raw' + \}) + if job_status(jid) == 'run' + let job.jobid = jid + else + let job.running = 0 + let job.error = 1 + let job.lines = ['Failed to start job'] endif else let params = has_key(a:opts, 'dir') ? [a:cmd, a:opts.dir] : [a:cmd] - let job.result = call('s:system', params) + let job.lines = s:lines(call('s:system', params)) let job.error = v:shell_error != 0 let job.running = 0 endif @@ -1109,7 +1218,9 @@ function! s:reap(name) endif let s:update.bar .= job.error ? 'x' : '=' - call s:log(job.error ? 'x' : '-', a:name, empty(job.result) ? 'OK' : job.result) + 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) @@ -1128,23 +1239,31 @@ endfunction function! s:logpos(name) for i in range(4, line('$')) if getline(i) =~# '^[-+x*] '.a:name.':' - return i + for j in range(i + 1, line('$')) + if getline(j) !~ '^ ' + return [i, j - 1] + endif + endfor + return [i, i] endif endfor + return [0, 0] endfunction function! s:log(bullet, name, lines) if s:switch_in() - let pos = s:logpos(a:name) - if pos > 0 - execute pos 'd _' - if pos > winheight('.') - let pos = 4 + 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 pos = 4 + let b = 4 endif - call append(pos - 1, s:format_message(a:bullet, a:name, a:lines)) + " 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 @@ -1158,12 +1277,12 @@ endfunction function! s:tick() let pull = s:update.pull - let prog = s:progress_opt(s:nvim) + 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 - let s:update.fin = 1 call s:update_finish() + let s:update.fin = 1 endif return endif @@ -1183,10 +1302,10 @@ while 1 " Without TCO, Vim stack is bound to explode let fetch_opt = (has_tag && !empty(globpath(spec.dir, '.git/shallow'))) ? '--depth 99999999' : '' call s:spawn(name, printf('git fetch %s %s 2>&1', fetch_opt, prog), { 'dir': spec.dir }) else - let s:jobs[name] = { 'running': 0, 'result': 'Already installed', 'error': 0 } + let s:jobs[name] = { 'running': 0, 'lines': ['Already installed'], 'error': 0 } endif else - let s:jobs[name] = { 'running': 0, 'result': error, 'error': 1 } + let s:jobs[name] = { 'running': 0, 'lines': s:lines(error), 'error': 1 } endif else call s:spawn(name, @@ -1472,10 +1591,12 @@ class Plugin(object): return result[-1] def update(self): - match = re.compile(r'git::?@') - actual_uri = re.sub(match, '', self.repo_uri()) - expect_uri = re.sub(match, '', self.args['uri']) - if actual_uri != expect_uri: + 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), @@ -1634,6 +1755,11 @@ function! s:update_ruby() 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' @@ -1646,6 +1772,7 @@ function! s:update_ruby() 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 = '' @@ -1735,12 +1862,17 @@ function! s:update_ruby() main = Thread.current threads = [] watcher = Thread.new { - while VIM::evaluate('getchar(1)') - sleep 0.1 + 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 } + threads.each { |t| t.raise Interrupt } unless vim7 end threads.each { |t| t.join rescue nil } main.kill @@ -1775,7 +1907,7 @@ function! s:update_ruby() else [false, [data.chomp, "PlugClean required."].join($/)] end - elsif current_uri.sub(/git::?@/, '') != uri.sub(/git::?@/, '') + elsif !compare_git_uri(current_uri, uri) [false, ["Invalid URI: #{current_uri}", "Expected: #{uri}", "PlugClean required."].join($/)] @@ -1821,9 +1953,15 @@ function! s:progress_bar(line, bar, total) endfunction function! s:compare_git_uri(a, b) - let a = substitute(a:a, 'git:\{1,2}@', '', '') - let b = substitute(a:b, 'git:\{1,2}@', '', '') - return 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) @@ -1890,10 +2028,21 @@ function! s:git_validate(spec, check_branch) \ branch, a:spec.branch) endif if empty(err) - let commits = len(s:lines(s:system(printf('git rev-list origin/%s..HEAD', a:spec.branch), a:spec.dir))) - if !v:shell_error && commits - let err = join([printf('Diverged from origin/%s by %d commit(s).', a:spec.branch, commits), - \ 'Reinstall after PlugClean.'], "\n") + let [ahead, behind] = split(s:lastline(s:system(printf( + \ 'git rev-list --count --left-right HEAD...origin/%s', + \ a:spec.branch), a:spec.dir)), '\t') + if !v:shell_error && ahead + if behind + " Only mention PlugClean if diverged, otherwise it's likely to be + " pushable (and probably not that messed up). + let err = printf( + \ "Diverged from origin/%s (%d commit(s) ahead and %d commit(s) behind!\n" + \ .'Backup local changes and run PlugClean and PlugUpdate to reinstall it.', a:spec.branch, ahead, behind) + else + let err = printf("Ahead of origin/%s by %d commit(s).\n" + \ .'Cannot update until local changes are pushed.', + \ a:spec.branch, ahead) + endif endif endif endif @@ -1963,16 +2112,48 @@ function! s:clean(force) if empty(todo) call append(line('$'), 'Already clean.') else - if a:force || s:ask('Proceed?') - for dir in todo - call s:rm_rf(dir) - endfor - call append(3, ['Removed.', '']) + 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 append(3, ['Cancelled.', '']) + call setline(4, 'Cancelled.') + nnoremap d :set opfunc=delete_opg@ + nmap dd d_ + xnoremap d :call delete_op(visualmode(), 1) + echo 'Delete the lines (d{motion}) to delete the corresponding directories' endif endif 4 + setlocal nomodifiable +endfunction + +function! s:delete_op(type, ...) + call s:delete(a:0 ? [line("'<"), line("'>")] : [line("'["), line("']")], 0) +endfunction + +function! s:delete(range, force) + let [l1, l2] = a:range + let force = a:force + while l1 <= l2 + let line = getline(l1) + if line =~ '^- ' && isdirectory(line[2:]) + execute l1 + redraw! + let answer = force ? 1 : s:ask('Delete '.line[2:].'?', 1) + let force = force || answer > 1 + if answer + call s:rm_rf(line[2:]) + setlocal modifiable + call setline(l1, '~'.line[1:]) + let s:clean_count += 1 + call setline(4, printf('Removed %d directories.', s:clean_count)) + setlocal nomodifiable + endif + endif + let l1 += 1 + endwhile endfunction function! s:upgrade() @@ -2104,7 +2285,7 @@ function! s:preview_commit() let b:plug_preview = !s:is_preview_window_open() endif - let sha = matchstr(getline('.'), '^ \X*\zs[0-9a-f]\{7}') + let sha = matchstr(getline('.'), '^ \X*\zs[0-9a-f]\{7,9}') if empty(sha) return endif @@ -2114,11 +2295,20 @@ function! s:preview_commit() return endif - execute 'pedit' sha - wincmd P - setlocal filetype=git buftype=nofile nobuflisted modifiable - execute 'silent read !cd' s:shellesc(g:plugs[name].dir) '&& git show --no-color --pretty=medium' sha - normal! gg"_dd + if exists('g:plug_pwindow') && !s:is_preview_window_open() + execute g:plug_pwindow + execute 'e' sha + else + execute 'pedit' sha + wincmd P + endif + setlocal previewwindow filetype=git buftype=nofile nobuflisted modifiable + try + let [sh, shrd] = s:chsh(1) + execute 'silent %!cd' s:shellesc(g:plugs[name].dir) '&& git show --no-color --pretty=medium' sha + finally + let [&shell, &shellredir] = [sh, shrd] + endtry setlocal nomodifiable nnoremap q :q wincmd p @@ -2204,7 +2394,7 @@ function! s:revert() setlocal modifiable normal! "_dap setlocal nomodifiable - echo 'Reverted.' + echo 'Reverted' endfunction function! s:snapshot(force, ...) abort From 43d3403c799203d22a9dacd2008d1c158294cd36 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sun, 2 Apr 2017 10:14:41 +1000 Subject: [PATCH 111/234] vim stuff --- editors/vim/.gitignore | 2 +- editors/vim/after/ftplugin/sh.vim | 3 +++ editors/vim/bundles.vim | 17 +++-------------- editors/vim/init.vim | 2 +- editors/vim/vimrc | 5 ++++- 5 files changed, 12 insertions(+), 17 deletions(-) create mode 100644 editors/vim/after/ftplugin/sh.vim diff --git a/editors/vim/.gitignore b/editors/vim/.gitignore index 8178c623..a31c1ec3 100644 --- a/editors/vim/.gitignore +++ b/editors/vim/.gitignore @@ -1,2 +1,2 @@ -bundle/vim-peepopen +plugged/* dirs/* diff --git a/editors/vim/after/ftplugin/sh.vim b/editors/vim/after/ftplugin/sh.vim new file mode 100644 index 00000000..df7eb071 --- /dev/null +++ b/editors/vim/after/ftplugin/sh.vim @@ -0,0 +1,3 @@ +setlocal shiftwidth=2 +setlocal tabstop=2 +setlocal noexpandtab diff --git a/editors/vim/bundles.vim b/editors/vim/bundles.vim index 696c7478..e56d43e4 100644 --- a/editors/vim/bundles.vim +++ b/editors/vim/bundles.vim @@ -6,7 +6,7 @@ endif call plug#begin('~/.vim/plugged') -Plug 'w0ng/vim-hybrid' +Plug 'w0ng/vim-hybrid' " color scheme Plug 'tpope/vim-sensible' " Sensible defaults, duh @@ -52,10 +52,10 @@ Plug 'tpope/vim-rake' Plug 'thisivan/vim-ruby-matchit' Plug 'nelstrom/vim-textobj-rubyblock', { 'for': 'ruby' } -Plug 'Chiel92/vim-autoformat' +" Plug 'Chiel92/vim-autoformat' Plug 'janko-m/vim-test' -let test#strategy = "dispatch" " Run test using vim-dispatch +let test#strategy = "neovim" " Run test using vim-dispatch Plug 'scrooloose/syntastic' let g:syntastic_enable_signs = 1 @@ -80,15 +80,4 @@ call plug#end() " " autocmd FileType clojure,clojurescript set lispwords-='->' " autocmd FileType clojure,clojurescript set lispwords-='->>' -" " }}} " -" " }}} -" -" " Git {{{ -" NeoBundle 'tpope/vim-fugitive', { 'augroup': 'fugitive' } -" NeoBundle 'tpope/vim-git' -" " }}} -" -" -" -" " }}} diff --git a/editors/vim/init.vim b/editors/vim/init.vim index f16220cc..c9a3c9c4 120000 --- a/editors/vim/init.vim +++ b/editors/vim/init.vim @@ -1 +1 @@ -/Users/bjeanes/.vimrc \ No newline at end of file +vimrc \ No newline at end of file diff --git a/editors/vim/vimrc b/editors/vim/vimrc index 2a9d228f..57825974 100644 --- a/editors/vim/vimrc +++ b/editors/vim/vimrc @@ -32,5 +32,8 @@ if filereadable(expand('~/.vimrc.local')) source ~/.vimrc.local endif -map :Files +map :GFiles +map t :Files + +hi Normal ctermbg=none From 730a1559ad1665ed7ad9878227c9e9ef2b1890ef Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sun, 2 Apr 2017 10:15:31 +1000 Subject: [PATCH 112/234] add agignore --- install.yml | 1 + misc/agignore | 2 ++ 2 files changed, 3 insertions(+) create mode 100644 misc/agignore diff --git a/install.yml b/install.yml index 979dd4b6..8691e128 100644 --- a/install.yml +++ b/install.yml @@ -11,6 +11,7 @@ languages/ruby/railsrc: ~/.railsrc languages/ruby/rspec: ~/.rspec misc/ackrc: ~/.ackrc + misc/agignore: ~/.agignore misc/ctags: ~/.ctags misc/inputrc: ~/.inputrc misc/nanorc: ~/.nanorc diff --git a/misc/agignore b/misc/agignore new file mode 100644 index 00000000..ca236889 --- /dev/null +++ b/misc/agignore @@ -0,0 +1,2 @@ +tags +TAGS From 0a19ac57fff6e2085428d46717cb005311fc6674 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sun, 2 Apr 2017 10:15:47 +1000 Subject: [PATCH 113/234] remove accidentally committed nvim link --- nvim | 1 - 1 file changed, 1 deletion(-) delete mode 120000 nvim diff --git a/nvim b/nvim deleted file mode 120000 index 39817380..00000000 --- a/nvim +++ /dev/null @@ -1 +0,0 @@ -/Users/bjeanes/.vim \ No newline at end of file From 054d41d8a908e2dc0ea1dcdfee835fa2c605cfcd Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sun, 2 Apr 2017 10:16:59 +1000 Subject: [PATCH 114/234] Remove unused autotest stuff --- languages/ruby/autotest/autotest | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 languages/ruby/autotest/autotest diff --git a/languages/ruby/autotest/autotest b/languages/ruby/autotest/autotest deleted file mode 100644 index 8e06e4d6..00000000 --- a/languages/ruby/autotest/autotest +++ /dev/null @@ -1,19 +0,0 @@ -# require 'autotest/redgreen' -require 'autotest/timestamp' - -module Autotest::Growl - def self.growl title, msg, img, pri=0, sticky="" - system "growlnotify -n autotest -d #{title} --image #{img} -p #{pri} -m #{msg.inspect} #{title} #{sticky}" - end - - Autotest.add_hook :ran_command do |at| - unless at.results.empty? - output = at.results.last.slice(/(\d+)\s.*(?:examples|assertions)?,\s(\d+)\s.*failures?/) - if output =~ /[1-9]\sfailures?/ - growl "Tests", "#{output}", "~/.config/ruby/autotest/ruby_fail.png", 2, "-s" - else - growl "Tests", "#{output}", "~/.config/ruby/autotest/ruby_ok.png" - end - end - end -end From 7a11aa827a5f8d426240b2ee220529c91e60682d Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sun, 2 Apr 2017 10:17:14 +1000 Subject: [PATCH 115/234] Try to work around buggy `zeus` behaviour w/ alias If zeus process crashes, it leaves the terminal in shambles :| --- shells/common/functions.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/shells/common/functions.sh b/shells/common/functions.sh index 656a11f3..84f0316b 100644 --- a/shells/common/functions.sh +++ b/shells/common/functions.sh @@ -1,3 +1,10 @@ +function zeus() { + command zeus $* + st=$? + stty sane # zeus keeps screwing up the terminal sometimes + return $st +} + function e() { if [ "$#" -eq 0 ]; then emacsclient -a '' -n -c . From b7089b50bfccb278c0dad917869e0c756615151d Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sun, 2 Apr 2017 10:18:01 +1000 Subject: [PATCH 116/234] I never really started using nvm, so remove config for now --- shells/common/node.sh | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 shells/common/node.sh diff --git a/shells/common/node.sh b/shells/common/node.sh deleted file mode 100644 index 48eaae1d..00000000 --- a/shells/common/node.sh +++ /dev/null @@ -1,3 +0,0 @@ -PATH="./node_modules/.bin:$PATH" -export NVM_DIR=~/.nvm -source $(brew --prefix nvm)/nvm.sh From 3eb8b8be6a949e934428050e76c7c8501a32c639 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sun, 2 Apr 2017 10:18:23 +1000 Subject: [PATCH 117/234] Tweak blue colour in prompt --- shells/zsh/lib/prompt.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shells/zsh/lib/prompt.zsh b/shells/zsh/lib/prompt.zsh index e2df8033..40fec7bc 100644 --- a/shells/zsh/lib/prompt.zsh +++ b/shells/zsh/lib/prompt.zsh @@ -7,7 +7,7 @@ pr_grey="%B%F{black}" if [ "$(tput colors 2>/dev/null)" -eq 256 ]; then pr_red="%F{52}" - pr_blue="%F{25}" + pr_blue="%F{33}" pr_green="%F{28}" pr_grey="%F{59}" fi From 5f99942c10b2f7b20836891a6ed1da495d812a93 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sun, 2 Apr 2017 10:18:39 +1000 Subject: [PATCH 118/234] Experiment with 2-line ZSH prompt --- shells/zsh/lib/prompt.zsh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/shells/zsh/lib/prompt.zsh b/shells/zsh/lib/prompt.zsh index 40fec7bc..1693ca64 100644 --- a/shells/zsh/lib/prompt.zsh +++ b/shells/zsh/lib/prompt.zsh @@ -109,11 +109,11 @@ function default_precmd { rev="${rev/\(svn\)/↯}" local left right - left=($(user_at_host) $cwd $char) + left=($(user_at_host) $cwd) right=($rev $ruby $time) - PS1="$left " - RPS1=" $right" + PS1=$left$'\n'$char' ' + RPS1="%{$(echotc UP 1)%}$right%{$(echotc DO 1)%}" else PS1="$ " RPS1="" From fd85d405d40c75bff6557587e4fc1edaab5e1b3c Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sun, 2 Apr 2017 10:19:47 +1000 Subject: [PATCH 119/234] Fix Kaleidoscope tool for git merging --- vcs/git/gitconfig | 8 +++++--- vcs/git/gitconfig.merge | 9 ++++++++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/vcs/git/gitconfig b/vcs/git/gitconfig index 6526edaf..20c8a0bd 100644 --- a/vcs/git/gitconfig +++ b/vcs/git/gitconfig @@ -65,9 +65,11 @@ algorithm = minimal mnemonicprefix = true renames = copies -[merge] - conflictstyle = diff3 - tool = Kaleidoscope + tool = ksdiff +[difftool] + prompt = false +[difftool "ksdiff"] + cmd = "ksdiff $LOCAL $REMOTE" [pull] rebase = true [heroku] diff --git a/vcs/git/gitconfig.merge b/vcs/git/gitconfig.merge index 51c153aa..4ed14f8e 100644 --- a/vcs/git/gitconfig.merge +++ b/vcs/git/gitconfig.merge @@ -2,7 +2,14 @@ [merge] summary = true - tool = opendiff + conflictstyle = diff3 + tool = Kaleidoscope + +[mergetool "Kaleidoscope"] + cmd = ksdiff --merge --output \"$MERGED\" --base \"$BASE\" -- \"$LOCAL\" --snapshot \"$REMOTE\" --snapshot + trustExitCode = true +[mergetool] + prompt = false # http://bitfission.com/blog/2010/07/auto-merge-gemfile-lock.html [merge "bundlelock"] From a315495765f714fd8e1983606666879688bdf173 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sun, 2 Apr 2017 10:20:10 +1000 Subject: [PATCH 120/234] Re-organise git alias --- vcs/git/gitconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vcs/git/gitconfig b/vcs/git/gitconfig index 20c8a0bd..7b8547fc 100644 --- a/vcs/git/gitconfig +++ b/vcs/git/gitconfig @@ -12,6 +12,7 @@ shas = log --reverse --pretty=format:'%h' --abbrev-commit me = !sh -c 'echo `git config user.name` \\<`git config user.email`\\>' mine = !sh -c 'git lg --author=\"`git me`\"' + br = branch # TODO make this use selecta, when installed f = "!git ls-files | grep -i" @@ -30,7 +31,6 @@ # From https://github.com/garybernhardt/dotfiles/blob/master/bin/git-churn churn = "!git log --all -M -C --name-only --format='format:' \"$@\" | sort | grep -v '^$' | uniq -c | sort | awk 'BEGIN {print \"count\tfile\"} {print $1 \"\t\" $2}' | sort -g" - br = branch [apply] whitespace = fix [color] From 3c535e46273c100e0588e014608cc2f1f28f68b6 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sun, 2 Apr 2017 10:20:48 +1000 Subject: [PATCH 121/234] Make commit message prompt verbose (i.e. include the diff in the window that pops up) --- vcs/git/gitconfig | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/vcs/git/gitconfig b/vcs/git/gitconfig index 7b8547fc..85319454 100644 --- a/vcs/git/gitconfig +++ b/vcs/git/gitconfig @@ -3,8 +3,9 @@ pl = pull --rebase p = push co = checkout - c = commit - ca = commit -a + commit = commit -v + c = commit -v + ca = commit -v -a diff = diff --word-diff dc = diff --cached lp = log --patch From 4bce31d684c7144036d896257c009f3916fc7eca Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sun, 2 Apr 2017 10:21:38 +1000 Subject: [PATCH 122/234] Revise `git addnw` alias from StackOverflow post --- vcs/git/gitconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vcs/git/gitconfig b/vcs/git/gitconfig index 85319454..89172b48 100644 --- a/vcs/git/gitconfig +++ b/vcs/git/gitconfig @@ -19,7 +19,8 @@ f = "!git ls-files | grep -i" # Add file excluding whitespace changes (http://stackoverflow.com/a/7149602/56690) - addnw = !sh -c 'git diff -w --no-color "$@" | git apply --cached --ignore-whitespace' - + addnw = !sh -c 'git diff -U0 -w --no-color "$@" | git apply --cached --ignore-whitespace --unidiff-zero -' + unadd = reset HEAD ctags = "!$(git rev-parse --show-toplevel)/.git/hooks/ctags" latest = for-each-ref --sort=-committerdate --format='%(committerdate:relative) -> %(refname:short)' From f9bda5e60d140d2a9bf274ad385a508b8fc8c947 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sun, 2 Apr 2017 10:22:48 +1000 Subject: [PATCH 123/234] Remove no-longer-needed multi-heroku config --- vcs/git/gitconfig | 2 -- 1 file changed, 2 deletions(-) diff --git a/vcs/git/gitconfig b/vcs/git/gitconfig index 89172b48..6aa70d58 100644 --- a/vcs/git/gitconfig +++ b/vcs/git/gitconfig @@ -74,8 +74,6 @@ cmd = "ksdiff $LOCAL $REMOTE" [pull] rebase = true -[heroku] - account = heroku [push] default = current [advice] From 84fa55cd9269228d3f10eddbd1aefa1ca17e664c Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sun, 2 Apr 2017 10:23:18 +1000 Subject: [PATCH 124/234] Experiment w/ gitconfig loc in versioned path That way if I switch to Fresh shell, config changes will be applied to the writable version. --- vcs/git/gitconfig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/vcs/git/gitconfig b/vcs/git/gitconfig index 6aa70d58..fee69030 100644 --- a/vcs/git/gitconfig +++ b/vcs/git/gitconfig @@ -33,6 +33,9 @@ # From https://github.com/garybernhardt/dotfiles/blob/master/bin/git-churn churn = "!git log --all -M -C --name-only --format='format:' \"$@\" | sort | grep -v '^$' | uniq -c | sort | awk 'BEGIN {print \"count\tfile\"} {print $1 \"\t\" $2}' | sort -g" + + # Write directly to versioned file (as `fresh`-managed one will be read-only) + config = config --file ~/.dotfiles/vcs/git/gitconfig [apply] whitespace = fix [color] From a3af33fc8f1377c7ad1970ad246562ed2aab0ffc Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sun, 2 Apr 2017 10:32:35 +1000 Subject: [PATCH 125/234] Add Brewfile for my common deps --- Brewfile | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 Brewfile diff --git a/Brewfile b/Brewfile new file mode 100644 index 00000000..d87eff32 --- /dev/null +++ b/Brewfile @@ -0,0 +1,49 @@ +brew 'mas' +mas 'Annotate - Capture and Share', id: 918207447 + +cask 'google-chrome' +cask 'firefox' +cask 'virtualbox' +cask 'keepingyouawake' +cask 'yakyak' + +# dev +mas 'Kaleidoscope', id: 587512244 +cask 'ksdiff' +tap 'neovim/neovim' +brew 'neovim' +tap 'universal-ctags/universal-ctags' +brew 'universal-ctags', args: %w[HEAD] # currently HEAD only +brew 'chruby' +brew 'ruby-install' +brew 'phantomjs' +brew 'chromedriver' +brew 'yarn' +brew 'node' +brew 'npm' +brew 'multirust' +brew 'rust' +brew 'crystal-lang' +brew 'elixir' +brew 'leiningen' +cask 'aws-vault' + +# data +brew 'postgres' +brew 'memcached' +brew 'redis' + +# util +brew 'ag' +brew 'wget' +brew 'tree' +brew 'coreutils' +brew 'pv' + +# shells +brew 'zsh' +brew 'fish' + +# misc +tap 'caskroom/fonts' +cask 'font-hack-nerd-font' From b1d33965e3aca755893520594721c786f02bc943 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sun, 2 Apr 2017 10:32:51 +1000 Subject: [PATCH 126/234] Experiment with Fresh --- freshrc | 43 ++++++ setup.sh | 438 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 481 insertions(+) create mode 100644 freshrc create mode 100755 setup.sh diff --git a/freshrc b/freshrc new file mode 100644 index 00000000..9eda1c78 --- /dev/null +++ b/freshrc @@ -0,0 +1,43 @@ +# vim: set ft=sh + +fresh freshshell/fresh bin/fresh --bin + +fresh languages/clojure/lein/profiles.clj --file=~/.lein/profiles.clj +fresh-options --file # each file as is + fresh Brewfile + + fresh languages/ruby/gemrc + fresh languages/ruby/irbrc + + fresh misc/ackrc + fresh misc/agignore + fresh misc/ctags + fresh misc/inputrc + fresh misc/nanorc + fresh misc/psqlrc + fresh misc/tmux/tmux.conf + + fresh vcs/git/gitattributes + fresh vcs/git/gitconfig + fresh vcs/git/gitconfig.merge + fresh vcs/git/gitconfig.pushurls + fresh vcs/git/gitignore +fresh-options + +[ -f ~/.gitconfig.local ] || cp ~/.dotfiles/vcs/git/gitconfig.local ~/.gitconfig.local + +mkdir -p ~/.config +ln -sfh ~/.dotfiles/editors/vim ~/.vim +ln -sfh ~/.dotfiles/editors/vim ~/.config/nvim +ln -sfh ~/.vim/vimrc ~/.vimrc +ln -sfh ~/.vim/gvimrc ~/.gvimrc + +fresh-options --file=~/.zshrc --marker + fresh mathiasbynens/dotfiles .functions + fresh twe4ked/dotfiles shell/zsh/completion.zsh + + fresh junegunn/fzf shell/completion.zsh + fresh junegunn/fzf shell/key-bindings.zsh +fresh-options + +fresh garybernhardt/dotfiles bin/run-command-on-git-revisions --bin diff --git a/setup.sh b/setup.sh new file mode 100755 index 00000000..9016ad72 --- /dev/null +++ b/setup.sh @@ -0,0 +1,438 @@ +#!/usr/bin/env bash + +# TODO: create SSH key if none exists + +function main { + setup_dot_files + if is_mac; then + install_homebrew + #configure_mac + brew tap Homebrew/bundle + brew bundle --no-upgrade --global + ruby-install --no-reinstall ruby 2.1 + ruby-install --no-reinstall ruby 2.2 + ruby-install --no-reinstall ruby 2.3 + ruby-install --no-reinstall ruby 2.4 + fi +} + +function setup_dot_files { + FRESH_LOCAL_SOURCE=bjeanes/dotfiles bash -c "`curl -sL https://get.freshshell.com`" + vim +PlugUpdate +qall + ( + cd ~/.dotfiles + git submodule update --init + ) +} + +# Thanks @mathiasbynens (https://github.com/mathiasbynens/dotfiles/blob/master/.macos) +function sudo { + sudo -v + while true; do + sudo -n true + sleep 60 + kill -0 "$$" || exit + done 2>/dev/null & + + function sudo { + command sudo + } + + sudo $* +} + +function configure_mac { + # Menu bar: hide the Time Machine, Volume, and User icons + for domain in ~/Library/Preferences/ByHost/com.apple.systemuiserver.*; do + defaults write "${domain}" dontAutoLoad -array \ + "/System/Library/CoreServices/Menu Extras/TimeMachine.menu" \ + "/System/Library/CoreServices/Menu Extras/Volume.menu" \ + "/System/Library/CoreServices/Menu Extras/User.menu" + done + + # Stop iTunes from responding to media keys + launchctl unload -w /System/Library/LaunchAgents/com.apple.rcd.plist 2>/dev/null + + # TextEdit plain text by default + defaults write com.apple.TextEdit RichText -int 0 + # Open and save files as UTF-8 in TextEdit + defaults write com.apple.TextEdit PlainTextEncoding -int 4 + defaults write com.apple.TextEdit PlainTextEncodingForWrite -int 4 + + configure_keyboard + + # Turn off keyboard backlight when unused for 5 minutes + defaults write com.apple.BezelServices kDimTime -int 300 + + # Disable start up boot sound + sudo nvram SystemAudioVolume=" " + + # Disable Gatekeeper + sudo spctl --master-disable + + # Require password to leave screensaver + defaults write com.apple.screensaver askForPassword -int 1 + defaults write com.apple.screensaver askForPasswordDelay -int 0 + + # Speeding up wake from sleep to 24 hours from an hour + # http://www.cultofmac.com/221392/quick-hack-speeds-up-retina-macbooks-wake-from-sleep-os-x-tips/ + sudo pmset -a standbydelay 86400 + + # Enable AirDrop over Ethernet and on Unsupported Macs + defaults write com.apple.NetworkBrowser BrowseAllInterfaces -bool true + + # Disable Notification Center + launchctl unload -w /System/Library/LaunchAgents/com.apple.notificationcenterui.plist 2>/dev/null + killall -9 NotificationCenter 2>/dev/null + + # Install latest shells and set ZSH to default + if ! brew ls -1 bash 2>/dev/null; then + brew install bash + echo $(brew --prefix)/bin/bash | sudo tee -a /etc/shells + fi + + if ! brew ls -1 fish 2>/dev/null; then + brew install fish + echo $(brew --prefix)/bin/fish | sudo tee -a /etc/shells + fi + + if ! brew ls -1 zsh 2>/dev/null; then + brew install zsh + echo $(brew --prefix)/bin/zsh | sudo tee -a /etc/shells + sudo chsh -s $(brew --prefix)/bin/zsh $USER + fi + + # Always show scrollbars + defaults write NSGlobalDomain AppleShowScrollBars -string "Always" + + # Expand save panel by default + defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true + defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode2 -bool true + + # Expand print panel by default + defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true + defaults write NSGlobalDomain PMPrintingExpandedStateForPrint2 -bool true + + # Save to disk (not to iCloud) by default + defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false + + # Automatically quit printer app once the print jobs complete + defaults write com.apple.print.PrintingPrefs "Quit When Finished" -bool true + + # Disable the “Are you sure you want to open this application?” dialog + defaults write com.apple.LaunchServices LSQuarantine -bool false + + # Disable Resume system-wide + defaults write com.apple.systempreferences NSQuitAlwaysKeepsWindows -bool false + + # Set Help Viewer windows to non-floating mode + defaults write com.apple.helpviewer DevMode -bool true + + # Reveal IP address, hostname, OS version, etc. when clicking the clock + # in the login window + sudo defaults write /Library/Preferences/com.apple.loginwindow AdminHostInfo HostName + + # Increase sound quality for Bluetooth headphones/headsets + defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" -int 40 + + # Restart automatically if the computer freezes + sudo systemsetup -setrestartfreeze on + + # Disable the sudden motion sensor as it’s not useful for SSDs + sudo pmset -a sms 0 + + # Enable subpixel font rendering on non-Apple LCDs + defaults write NSGlobalDomain AppleFontSmoothing -int 2 + + # Enable HiDPI display modes (requires restart) + sudo defaults write /Library/Preferences/com.apple.windowserver DisplayResolutionEnabled -bool true + + # Finder: disable window animations and Get Info animations + defaults write com.apple.finder DisableAllAnimations -bool true + + # Set Desktop as the default location for new Finder windows + # For other paths, use `PfLo` and `file:///full/path/here/` + defaults write com.apple.finder NewWindowTarget -string "PfDe" + defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}/Desktop/" + + # Show icons for hard drives, servers, and removable media on the desktop + defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool true + defaults write com.apple.finder ShowHardDrivesOnDesktop -bool true + defaults write com.apple.finder ShowMountedServersOnDesktop -bool true + defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool true + + # Finder: show hidden files by default + defaults write com.apple.finder AppleShowAllFiles -bool true + + # Finder: show all filename extensions + defaults write NSGlobalDomain AppleShowAllExtensions -bool true + + # Finder: show status bar + defaults write com.apple.finder ShowStatusBar -bool true + + # Finder: show path bar + defaults write com.apple.finder ShowPathbar -bool true + + # Display full POSIX path as Finder window title + defaults write com.apple.finder _FXShowPosixPathInTitle -bool true + + # Keep folders on top when sorting by name + defaults write com.apple.finder _FXSortFoldersFirst -bool true + + # When performing a search, search the current folder by default + defaults write com.apple.finder FXDefaultSearchScope -string "SCcf" + + # Disable the warning when changing a file extension + defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false + + # Enable spring loading for directories + defaults write NSGlobalDomain com.apple.springing.enabled -bool true + + # Remove the spring loading delay for directories + defaults write NSGlobalDomain com.apple.springing.delay -float 0 + + # Avoid creating .DS_Store files on network or USB volumes + defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true + defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true + + # Automatically open a new Finder window when a volume is mounted + defaults write com.apple.frameworks.diskimages auto-open-ro-root -bool true + defaults write com.apple.frameworks.diskimages auto-open-rw-root -bool true + defaults write com.apple.finder OpenWindowForNewRemovableDisk -bool true + + # Show item info near icons on the desktop and in other icon views + /usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist + /usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist + /usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist + + # Show item info to the right of the icons on the desktop + /usr/libexec/PlistBuddy -c "Set DesktopViewSettings:IconViewSettings:labelOnBottom false" ~/Library/Preferences/com.apple.finder.plist + + # Enable snap-to-grid for icons on the desktop and in other icon views + /usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist + /usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist + /usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist + + # Increase grid spacing for icons on the desktop and in other icon views + /usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:gridSpacing 100" ~/Library/Preferences/com.apple.finder.plist + /usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:gridSpacing 100" ~/Library/Preferences/com.apple.finder.plist + /usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:gridSpacing 100" ~/Library/Preferences/com.apple.finder.plist + + # Increase the size of icons on the desktop and in other icon views + /usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:iconSize 80" ~/Library/Preferences/com.apple.finder.plist + /usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:iconSize 80" ~/Library/Preferences/com.apple.finder.plist + /usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:iconSize 80" ~/Library/Preferences/com.apple.finder.plist + + # Use list view in all Finder windows by default + # Four-letter codes for the other view modes: `icnv`, `clmv`, `Flwv` + defaults write com.apple.finder FXPreferredViewStyle -string "Nlsv" + + # Show the ~/Library folder + chflags nohidden ~/Library + + # Show the /Volumes folder + sudo chflags nohidden /Volumes + + # Expand the following File Info panes: + # “General”, “Open with”, and “Sharing & Permissions” + defaults write com.apple.finder FXInfoPanesExpanded -dict \ + General -bool true \ + OpenWith -bool true \ + Privileges -bool true + + # Set the icon size of Dock items to 36 pixels + defaults write com.apple.dock tilesize -int 36 + + # Minimize windows into their application’s icon + defaults write com.apple.dock minimize-to-application -bool true + + # Enable spring loading for all Dock items + defaults write com.apple.dock enable-spring-load-actions-on-all-items -bool true + + # Show indicator lights for open applications in the Dock + defaults write com.apple.dock show-process-indicators -bool true + + # Wipe all (default) app icons from the Dock + defaults write com.apple.dock persistent-apps -array + + # Show only open applications in the Dock + defaults write com.apple.dock static-only -bool true + + # Speed up Mission Control animations + defaults write com.apple.dock expose-animation-duration -float 0.1 + + # Disable Dashboard + defaults write com.apple.dashboard mcx-disabled -bool true + + # Don’t show Dashboard as a Space + defaults write com.apple.dock dashboard-in-overlay -bool true + + # Don’t automatically rearrange Spaces based on most recent use + defaults write com.apple.dock mru-spaces -bool false + + # Remove the auto-hiding Dock delay + defaults write com.apple.dock autohide-delay -float 0 + # Remove the animation when hiding/showing the Dock + defaults write com.apple.dock autohide-time-modifier -float 0 + + # Automatically hide and show the Dock + defaults write com.apple.dock autohide -bool true + + # Make Dock icons of hidden applications translucent + defaults write com.apple.dock showhidden -bool true + + # Disable the Launchpad gesture (pinch with thumb and three fingers) + defaults write com.apple.dock showLaunchpadGestureEnabled -int 0 + + # Privacy: don’t send search queries to Apple + defaults write com.apple.Safari UniversalSearchEnabled -bool false + defaults write com.apple.Safari SuppressSearchSuggestions -bool true + + # Press Tab to highlight each item on a web page + defaults write com.apple.Safari WebKitTabToLinksPreferenceKey -bool true + defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2TabsToLinks -bool true + + # Prevent Safari from opening ‘safe’ files automatically after downloading + defaults write com.apple.Safari AutoOpenSafeDownloads -bool false + + # Show the full URL in the address bar (note: this still hides the scheme) + defaults write com.apple.Safari ShowFullURLInSmartSearchField -bool true + + # Set Safari’s home page to `about:blank` for faster loading + defaults write com.apple.Safari HomePage -string "about:blank" + + # Hide Safari’s bookmarks bar by default + defaults write com.apple.Safari ShowFavoritesBar -bool false + + # Hide Safari’s sidebar in Top Sites + defaults write com.apple.Safari ShowSidebarInTopSites -bool false + + # Enable Safari’s debug menu + defaults write com.apple.Safari IncludeInternalDebugMenu -bool true + + # Make Safari’s search banners default to Contains instead of Starts With + defaults write com.apple.Safari FindOnPageMatchesWordStartsOnly -bool false + + # Enable the Develop menu and the Web Inspector in Safari + defaults write com.apple.Safari IncludeDevelopMenu -bool true + defaults write com.apple.Safari WebKitDeveloperExtrasEnabledPreferenceKey -bool true + defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled -bool true + + # Add a context menu item for showing the Web Inspector in web views + defaults write NSGlobalDomain WebKitDeveloperExtras -bool true + + # Enable continuous spellchecking + defaults write com.apple.Safari WebContinuousSpellCheckingEnabled -bool true + + # Disable auto-correct + defaults write com.apple.Safari WebAutomaticSpellingCorrectionEnabled -bool false + + # Disable AutoFill + defaults write com.apple.Safari AutoFillFromAddressBook -bool false + defaults write com.apple.Safari AutoFillPasswords -bool false + defaults write com.apple.Safari AutoFillCreditCardData -bool false + defaults write com.apple.Safari AutoFillMiscellaneousForms -bool false + + # Warn about fraudulent websites + defaults write com.apple.Safari WarnAboutFraudulentWebsites -bool true + + # Update extensions automatically + defaults write com.apple.Safari InstallExtensionUpdatesAutomatically -bool true + + # Only use UTF-8 in Terminal.app + defaults write com.apple.terminal StringEncodings -array 4 + + # Enable Secure Keyboard Entry in Terminal.app + # See: https://security.stackexchange.com/a/47786/8918 + defaults write com.apple.terminal SecureKeyboardEntry -bool true + + # Prevent Time Machine from prompting to use new hard drives as backup volume + defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true + + # Disable local Time Machine backups + hash tmutil &> /dev/null && sudo tmutil disablelocal + + # Enable the automatic update check + defaults write com.apple.SoftwareUpdate AutomaticCheckEnabled -bool true + + # Check for software updates daily, not just once per week + defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 1 + + # Download newly available updates in background + defaults write com.apple.SoftwareUpdate AutomaticDownload -int 1 + + # Install System data files & security updates + defaults write com.apple.SoftwareUpdate CriticalUpdateInstall -int 1 + + # Turn on app auto-update + defaults write com.apple.commerce AutoUpdate -bool true + + # Prevent Photos from opening automatically when devices are plugged in + defaults -currentHost write com.apple.ImageCapture disableHotPlug -bool true + + # Disable smart quotes as it’s annoying for messages that contain code + defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "automaticQuoteSubstitutionEnabled" -bool false + + # Disable continuous spell checking + defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "continuousSpellCheckingEnabled" -bool false + + for app in "Activity Monitor" "cfprefsd" "Dock" "Finder" "Messages" \ + "Safari" "SystemUIServer" "Terminal"; do + killall "${app}" &> /dev/null + done +} + +function configure_trackpad { + # Trackpad: enable tap to click for this user and for the login screen + defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true + defaults -currentHost write NSGlobalDomain com.apple.mouse.tapBehavior -int 1 + defaults write NSGlobalDomain com.apple.mouse.tapBehavior -int 1 + + defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadRightClick -bool true + defaults -currentHost write NSGlobalDomain com.apple.trackpad.enableSecondaryClick -bool true +} + +function configure_keyboard { + # Don't press-and-hold for auto-correct + defaults write -g ApplePressAndHoldEnabled -bool false + + # Make all UI tabbable + defaults write NSGlobalDomain AppleKeyboardUIMode -int 3 + + # Disable auto-correct + defaults write -g NSAutomaticSpellingCorrectionEnabled -bool false + + # Disable smart quotes as they’re annoying when typing code + defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false + + # Disable smart dashes as they’re annoying when typing code + defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false + + # Set language and text formats + defaults write NSGlobalDomain AppleLanguages -array "en-AU" + defaults write NSGlobalDomain AppleLocale -string "en-AU" + defaults write NSGlobalDomain AppleMeasurementUnits -string "Centimeters" + defaults write NSGlobalDomain AppleMetricUnits -bool true + +} + +function configure_developer_mode_in_safari { + defaults write com.apple.Safari IncludeInternalDebugMenu -bool true && \ + defaults write com.apple.Safari IncludeDevelopMenu -bool true && \ + defaults write com.apple.Safari WebKitDeveloperExtrasEnabledPreferenceKey -bool true && \ + defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled -bool true && \ + defaults write -g WebKitDeveloperExtras -bool true +} + +function is_mac { + [[ "$OSTYPE" == "darwin"* ]] +} + +function install_homebrew { + which -s brew && return + is_mac || return + + /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" +} + +main From 49ba55207fbca5f929ae6e8d03d367083a1ace20 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Mon, 22 Jul 2019 16:21:32 +1000 Subject: [PATCH 127/234] /shrug --- Brewfile | 12 +- editors/vim/after/syntax/ruby.vim | 20 +-- editors/vim/bundles.vim | 15 ++- editors/vim/coc.vim | 82 ++++++++++++ editors/vim/ui.vim | 4 +- editors/vim/vimrc | 9 +- freshrc | 33 ++++- languages/ruby/irbrc | 32 ++++- languages/ruby/pryrc | 41 ++++++ languages/ruby/rubyrc.rb | 17 +++ misc/psqlrc | 1 + misc/tmux/tmux.conf | 2 + setup.sh | 2 +- shells/bash/bash_profile | 7 +- shells/common/exports.sh | 3 +- shells/common/functions.sh | 4 +- shells/common/git.sh | 8 -- shells/common/osx.sh | 214 +++++++++++++++--------------- shells/common/ruby.sh | 9 +- shells/path.sh | 24 ++-- shells/zsh/lib/fish.zsh | 8 +- shells/zsh/lib/history.zsh | 21 +-- shells/zsh/zprofile | 2 + shells/zsh/zshrc | 10 ++ vcs/git/gitconfig | 2 + vcs/git/gitignore | 7 + 26 files changed, 420 insertions(+), 169 deletions(-) create mode 100644 editors/vim/coc.vim create mode 100644 languages/ruby/pryrc create mode 100644 languages/ruby/rubyrc.rb delete mode 100644 shells/common/git.sh diff --git a/Brewfile b/Brewfile index d87eff32..bd5931bb 100644 --- a/Brewfile +++ b/Brewfile @@ -1,11 +1,16 @@ brew 'mas' mas 'Annotate - Capture and Share', id: 918207447 +mas 'Slack', id: 803453959 +mas 'MindNode 5', id: 1289197285 cask 'google-chrome' cask 'firefox' cask 'virtualbox' cask 'keepingyouawake' cask 'yakyak' +cask 'iterm2' +cask 'sonos' +cask 'insomnia' # dev mas 'Kaleidoscope', id: 587512244 @@ -18,10 +23,9 @@ brew 'chruby' brew 'ruby-install' brew 'phantomjs' brew 'chromedriver' -brew 'yarn' brew 'node' -brew 'npm' -brew 'multirust' +brew 'yarn' +#brew 'multirust' brew 'rust' brew 'crystal-lang' brew 'elixir' @@ -39,6 +43,8 @@ brew 'wget' brew 'tree' brew 'coreutils' brew 'pv' +brew 'tmux' +brew 'htop' # shells brew 'zsh' diff --git a/editors/vim/after/syntax/ruby.vim b/editors/vim/after/syntax/ruby.vim index 84953204..72bb4cda 100644 --- a/editors/vim/after/syntax/ruby.vim +++ b/editors/vim/after/syntax/ruby.vim @@ -1,11 +1,15 @@ -" RSpec +if expand('%') =~# '_spec\.rb$' + syn keyword rubyRspec describe context it specify it_should_behave_like before after setup subject let shared_context shared_examples_for shared_examples +endif - " Syntax highlighting - if expand('%') =~# '_spec\.rb$' - syn keyword rubyRspec describe context it specify it_should_behave_like before after setup subject let shared_context shared_examples_for - endif +hi def link rubyRspec Function - hi def link rubyRspec Function +nmap rf mr:set foldmethod=syntaxzMzv?\v^\s*(it\|example)zz:noh`r:delmarks r + +let s:bcs = b:current_syntax +unlet b:current_syntax +syntax include @SQL syntax/sql.vim +let b:current_syntax = s:bcs + +syntax region hereDocDashSQL matchgroup=Statement start=+<<[-~.]\?\z(SQL\%(DOC\)\?\)+ end=+^\s*\z1+ contains=@SQL - " Focus folding on spec" - nmap rf mr:set foldmethod=syntaxzMzv?\v^\s*(it\|example)zz:noh`r:delmarks r diff --git a/editors/vim/bundles.vim b/editors/vim/bundles.vim index e56d43e4..2c449751 100644 --- a/editors/vim/bundles.vim +++ b/editors/vim/bundles.vim @@ -36,6 +36,8 @@ Plug 'kana/vim-textobj-user' " Create new text objects Plug 'michaeljsmith/vim-indent-object' Plug 'argtextobj.vim' +Plug 'neoclide/coc.nvim', {'tag': '*', 'do': { -> coc#util#install()}} + "let g:crystal_auto_format = 1 Plug 'rhysd/vim-crystal' " polyglot doesn't include plugin dir, where much of plugin is set @@ -52,14 +54,21 @@ Plug 'tpope/vim-rake' Plug 'thisivan/vim-ruby-matchit' Plug 'nelstrom/vim-textobj-rubyblock', { 'for': 'ruby' } +Plug 'ap/vim-css-color' + " Plug 'Chiel92/vim-autoformat' Plug 'janko-m/vim-test' let test#strategy = "neovim" " Run test using vim-dispatch -Plug 'scrooloose/syntastic' -let g:syntastic_enable_signs = 1 -let g:syntastic_auto_loc_list = 0 +Plug 'w0rp/ale' +let g:ale_fix_on_save = 1 +let g:ale_completion_enabled = 1 +let g:ale_fixers = { +\ '*': ['remove_trailing_lines', 'trim_whitespace'], +\ 'javascript': ['eslint'], +\ 'ruby': ['rubocop'], +\} Plug 'vim-airline/vim-airline' let g:airline_powerline_fonts = 1 diff --git a/editors/vim/coc.vim b/editors/vim/coc.vim new file mode 100644 index 00000000..795de9ee --- /dev/null +++ b/editors/vim/coc.vim @@ -0,0 +1,82 @@ +" if hidden not set, TextEdit might fail. +set hidden + +" Better display for messages +set cmdheight=2 + +" Smaller updatetime for CursorHold & CursorHoldI +set updatetime=300 + +" always show signcolumns +set signcolumn=yes + + + + + + +" Use tab for trigger completion with characters ahead and navigate. +" Use command ':verbose imap ' to make sure tab is not mapped by other plugin. +inoremap + \ pumvisible() ? "\" : + \ check_back_space() ? "\" : + \ coc#refresh() +inoremap pumvisible() ? "\" : "\" + +function! s:check_back_space() abort + let col = col('.') - 1 + return !col || getline('.')[col - 1] =~# '\s' +endfunction + +" Use for trigger completion. +inoremap coc#refresh() + +" Use for confirm completion, `u` means break undo chain at current position. +" Coc only does snippet and additional edit on confirm. +"inoremap pumvisible() ? "\" : "\u\" +" NOTE: above mapping disabled due to https://github.com/tpope/vim-endwise/issues/22#issuecomment-446042476 + +" Use `[c` and `]c` for navigate diagnostics +nmap [c (coc-diagnostic-prev) +nmap ]c (coc-diagnostic-next) + +" Remap keys for gotos +nmap gd (coc-definition) +nmap gy (coc-type-definition) +nmap gi (coc-implementation) +nmap gr (coc-references) + +" Use K for show documentation in preview window +nnoremap K :call show_documentation() + +function! s:show_documentation() + if &filetype == 'vim' + execute 'h '.expand('') + else + call CocAction('doHover') + endif +endfunction + +" Highlight symbol under cursor on CursorHold +autocmd CursorHold * silent call CocActionAsync('highlight') + +" Remap for rename current word +nmap rn (coc-rename) + +" Remap for format selected region +vmap f (coc-format-selected) +nmap f (coc-format-selected) + +" Setup formatexpr specified filetype(s). +augroup mygroup + autocmd! + autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected') +augroup end + +" Remap for do codeAction of selected region, ex: `aap` for current paragraph +vmap a (coc-codeaction-selected) +nmap a (coc-codeaction-selected) + +" Remap for do codeAction of current line +nmap ac (coc-codeaction) + diff --git a/editors/vim/ui.vim b/editors/vim/ui.vim index 0e350357..2f897d2f 100644 --- a/editors/vim/ui.vim +++ b/editors/vim/ui.vim @@ -104,7 +104,9 @@ if exists('$TMUX') let &t_SI = "\[3 q" let &t_EI = "\[0 q" - set term=screen-256color + if !has('nvim') + set term=screen-256color + endif else let &t_SI = "\]50;CursorShape=1\x7" let &t_EI = "\]50;CursorShape=0\x7" diff --git a/editors/vim/vimrc b/editors/vim/vimrc index 57825974..f23c4b63 100644 --- a/editors/vim/vimrc +++ b/editors/vim/vimrc @@ -3,6 +3,7 @@ set nocompatible let mapleader = "\" source ~/.vim/bundles.vim +source ~/.vim/coc.vim source ~/.vim/ui.vim source ~/.vim/autocommands.vim source ~/.vim/ruby.vim @@ -12,6 +13,7 @@ set backupskip=/tmp/*,/private/tmp/*" " don't use backups for tmp files set directory=~/.vim/dirs/swaps " store swap files here set undofile " persistent undos set undodir=~/.vim/dirs/undos " where to store undo histories +set autoread " For when you forget to sudo.. Really Write the file. cmap w!! w !sudo tee % >/dev/null @@ -20,8 +22,8 @@ cmap w!! w !sudo tee % >/dev/null map rt :!ctags --extra=+f -R * set tags=tmp/tags;/,./tmp/tags;/,tags;/,./tags;/ -set pastetoggle=p -map p :set invpaste paste? +"set pastetoggle=pp +nmap pp :set invpaste paste? " Quick editing of common dot-files map vv :edit $MYVIMRC @@ -35,5 +37,8 @@ endif map :GFiles map t :Files +" For working on highlight/syntax rules +map :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<' . synIDattr(synID(line("."),col("."),0),"name") . "> lo<" . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">" + hi Normal ctermbg=none diff --git a/freshrc b/freshrc index 9eda1c78..a91f2e1e 100644 --- a/freshrc +++ b/freshrc @@ -27,17 +27,42 @@ fresh-options [ -f ~/.gitconfig.local ] || cp ~/.dotfiles/vcs/git/gitconfig.local ~/.gitconfig.local mkdir -p ~/.config -ln -sfh ~/.dotfiles/editors/vim ~/.vim -ln -sfh ~/.dotfiles/editors/vim ~/.config/nvim -ln -sfh ~/.vim/vimrc ~/.vimrc -ln -sfh ~/.vim/gvimrc ~/.gvimrc +rm -rf ~/.vim ~/.config/nvim +ln -sfn ~/.dotfiles/editors/vim ~/.vim +ln -sfn ~/.dotfiles/editors/vim ~/.config/nvim +ln -sfn ~/.vim/vimrc ~/.vimrc +ln -sfn ~/.vim/gvimrc ~/.gvimrc fresh-options --file=~/.zshrc --marker + fresh shells/path.sh + + fresh freshshell/fresh contrib/source-build.sh + fresh zsh-users/zsh-history-substring-search zsh-history-substring-search.zsh + fresh mathiasbynens/dotfiles .functions fresh twe4ked/dotfiles shell/zsh/completion.zsh fresh junegunn/fzf shell/completion.zsh fresh junegunn/fzf shell/key-bindings.zsh + + fresh shells/common/\*.sh + fresh shells/zsh/\*.zsh + fresh shells/zsh/lib/\*.zsh fresh-options +fresh zsh-users/zsh-completions src --file=completion/ +fresh freshshell/fresh contrib/completion/fresh-completion.zsh --file=completion/_fresh + +fresh zsh-users/zsh-syntax-highlighting . --file=vendor/zsh-syntax-highlighting/ + fresh garybernhardt/dotfiles bin/run-command-on-git-revisions --bin + +fresh junegunn/fzf . --file=~/.fzf/ +~/.fresh/source/junegunn/fzf/install --bin +fresh junegunn/fzf bin/fzf --bin +fresh junegunn/fzf bin/fzf-tmux --bin + +fresh_after_build() { +# vim +PlugUpdate +PlugClean +qall + true +} diff --git a/languages/ruby/irbrc b/languages/ruby/irbrc index ee0f8ca8..3a24b866 100755 --- a/languages/ruby/irbrc +++ b/languages/ruby/irbrc @@ -1,7 +1,7 @@ require 'irb/ext/save-history' require 'irb/completion' -ARGV.concat [ "--readline", "--prompt-mode", "simple" ] +ARGV.concat %w[--readline --prompt-mode simple] IRB.conf[:SAVE_HISTORY] = 1000 IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb-save-history" @@ -14,3 +14,33 @@ class Object (obj.methods - obj.class.superclass.instance_methods).sort end end + +require 'rubygems' +begin + require 'pry' + Pry.start + exit +rescue LoadError + if defined?(::Bundler) + pry_specs = ENV['GEM_PATH'].split(':'). + flat_map { |path| Dir.glob("#{path}/specifications/pry-*.gemspec") }. + flat_map { |path| Gem::Specification.load(path) } + + pry_specs = pry_specs. + reverse_sort_by(&:version). + uniq_by(&:name) + + pry_specs.each do |spec| + $LOAD_PATH << spec.lib_dirs_glob + end + + begin + require 'pry' + Pry.start + exit + rescue LoadError => e + puts e + end + end + +end diff --git a/languages/ruby/pryrc b/languages/ruby/pryrc new file mode 100644 index 00000000..0d459bd8 --- /dev/null +++ b/languages/ruby/pryrc @@ -0,0 +1,41 @@ +if defined?(::Bundler) + pry_specs = ENV['GEM_PATH'].split(':'). + flat_map { |path| Dir.glob("#{path}/specifications/{method_source,pry,coderay}-*.gemspec") }. + flat_map { |path| Gem::Specification.load(path) } + + pry_specs = pry_specs. + sort_by(&:version). + reverse. + uniq(&:name) + + pry_specs.each do |spec| + $LOAD_PATH << spec.lib_dirs_glob + end +end + +begin + require('pry-inline') +rescue LoadError +end + +begin + require('pry-state') +rescue LoadError +end + +begin + #require('pry-syntax-hacks') +rescue LoadError +end + +if defined?(PryByebug) + Pry.commands.alias_command 'c', 'continue' + Pry.commands.alias_command 's', 'step' + Pry.commands.alias_command 'n', 'next' + Pry.commands.alias_command 'f', 'finish' + Pry.commands.alias_command 'u', 'up' +end + +if defined?(Rails) && Rails.env + include Rails::ConsoleMethods +end diff --git a/languages/ruby/rubyrc.rb b/languages/ruby/rubyrc.rb new file mode 100644 index 00000000..19050e2f --- /dev/null +++ b/languages/ruby/rubyrc.rb @@ -0,0 +1,17 @@ +# try_require = ->(code) do +# begin +# require(code) +# rescue LoadError +# puts "#{code} not installed" +# end +# end +# try_require.('pry') +# try_require.('pry-doc') +# try_require.('pry-byebug') +puts "hi" +require 'bundler/inline' +gemfile(true) do + gem 'pry' + gem 'pry-doc' + gem 'pry-byebug' +end diff --git a/misc/psqlrc b/misc/psqlrc index 5ff55465..257c6c49 100644 --- a/misc/psqlrc +++ b/misc/psqlrc @@ -15,3 +15,4 @@ -- Autocomplete keywords (like SELECT) in upper-case, even if you started -- typing them in lower case. \set COMP_KEYWORD_CASE upper +\timing diff --git a/misc/tmux/tmux.conf b/misc/tmux/tmux.conf index dea79c62..0c40f49d 100644 --- a/misc/tmux/tmux.conf +++ b/misc/tmux/tmux.conf @@ -9,6 +9,8 @@ setw -g mode-keys vi set -g default-terminal "screen-256color" +set-option -g default-command "reattach-to-user-namespace -l zsh" + bind R source-file ~/.tmux.conf bind \ confirm-before kill-server diff --git a/setup.sh b/setup.sh index 9016ad72..aa941220 100755 --- a/setup.sh +++ b/setup.sh @@ -429,7 +429,7 @@ function is_mac { } function install_homebrew { - which -s brew && return + command -v brew && return is_mac || return /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" diff --git a/shells/bash/bash_profile b/shells/bash/bash_profile index ea05214a..3b9ef7ae 100644 --- a/shells/bash/bash_profile +++ b/shells/bash/bash_profile @@ -1 +1,6 @@ -source ~/.bashrc \ No newline at end of file +source ~/.bashrc +# added by oblique-fortunes +if command fortune >/dev/null; then fortune oblique; fi + + +export PATH="$HOME/.cargo/bin:$PATH" diff --git a/shells/common/exports.sh b/shells/common/exports.sh index 619aa71a..81a2309a 100644 --- a/shells/common/exports.sh +++ b/shells/common/exports.sh @@ -1,11 +1,10 @@ which vim &>/dev/null && editor="$(which vim)" +which nvim &>/dev/null && editor="$(which nvim)" export EDITOR="$editor -f" export VISUAL="$editor" export TERM=xterm-256color -export GREP_OPTIONS='--color=auto' -export GREP_COLOR='1;32' export CLICOLOR=1 export HISTSIZE=1000000 diff --git a/shells/common/functions.sh b/shells/common/functions.sh index 84f0316b..693c6c98 100644 --- a/shells/common/functions.sh +++ b/shells/common/functions.sh @@ -79,12 +79,12 @@ function extract() { # Custom "command not found" handling (ala method_missing): # Zsh -function command_not_found_handler() { +function __disabled__command_not_found_handler() { /usr/bin/env ruby $DOT_FILES/misc/method_missing.rb $* } # Bash (call Zsh version) -function command_not_found_handle() { +function __disabled__command_not_found_handle() { command_not_found_handler $* return $? } diff --git a/shells/common/git.sh b/shells/common/git.sh deleted file mode 100644 index d111a0af..00000000 --- a/shells/common/git.sh +++ /dev/null @@ -1,8 +0,0 @@ -alias gi='git init' -alias gst='git status -s' -alias gl='git pull --rebase' -alias gp='git push' -alias ga='git add' -alias gc='git commit -v' -alias gca='git commit -v -a' -alias gd='git diff' diff --git a/shells/common/osx.sh b/shells/common/osx.sh index 78831f30..f4ab71e0 100644 --- a/shells/common/osx.sh +++ b/shells/common/osx.sh @@ -1,109 +1,109 @@ -osx || return # Only for OS X - -alias serial="ioreg -l | grep IOPlatformSerialNumber | cut -f 10 -d' ' | cut -d'\"' -f 2 | pbcopy && echo 'Copied to clipboard'" - -function __setup_tmux_wrappers() { - local wrap="reattach-to-user-namespace" - local editors="VISUAL $(env | grep EDITOR | cut -d= -f1)" - - alias vim="$wrap vim" - alias mvim="$wrap mvim" - - for editor in $editors; do - eval "$editor='$wrap $(eval "echo \$$editor")'" - done -} - -if which reattach-to-user-namespace >/dev/null 2>&1; then - # and http://writeheavy.com/2011/10/23/reintroducing-tmux-to-the-osx-clipboard.html - [ -n "$TMUX" ] && __setup_tmux_wrappers -else - if [ -n "$TMUX" ]; then - echo "Installing pbpaste/pbcopy wrappers to get them working in Tmux..." - formula="--HEAD --wrap-pbcopy-and-pbpaste --wrap-launchctl reattach-to-user-namespace" - brew install $formula >/dev/null 2>&1 && echo "Done." || echo "Failed." - __setup_tmux_wrappers +if osx; then + alias serial="ioreg -l | grep IOPlatformSerialNumber | cut -f 10 -d' ' | cut -d'\"' -f 2 | pbcopy && echo 'Copied to clipboard'" + + function __setup_tmux_wrappers() { + local wrap="reattach-to-user-namespace" + local editors="VISUAL $(env | grep EDITOR | cut -d= -f1)" + + alias vim="$wrap vim" + alias mvim="$wrap mvim" + + for editor in $editors; do + eval "$editor='$wrap $(eval "echo \$$editor")'" + done + } + + if which reattach-to-user-namespace >/dev/null 2>&1; then + # and http://writeheavy.com/2011/10/23/reintroducing-tmux-to-the-osx-clipboard.html + [ -n "$TMUX" ] && __setup_tmux_wrappers + else + if [ -n "$TMUX" ]; then + echo "Installing pbpaste/pbcopy wrappers to get them working in Tmux..." + formula="--HEAD --wrap-pbcopy-and-pbpaste --wrap-launchctl reattach-to-user-namespace" + brew install $formula >/dev/null 2>&1 && echo "Done." || echo "Failed." + __setup_tmux_wrappers + fi fi -fi - -if [ -z "$JAVA_HOME" -a -d /System/Library/Frameworks/JavaVM.framework/Home ]; then - export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home -fi - -alias o='open .' - -# replacement netstat cmd to find ports used by apps on OS X -alias netstat="sudo lsof -i -P" -alias pubkey="cat $HOME/.ssh/*.pub | pbcopy && echo 'Keys copied to clipboard'" - -alias hidefile='/usr/bin/SetFile -a "V"' -alias showfile='/usr/bin/SetFile -a "v"' - -function manpdf() { man -t $@ | open -f -a Preview; } -function osinfo() { - x1="$(/usr/bin/sw_vers -productName)" - x2="$(/usr/bin/sw_vers -productVersion)" - x3="$(/usr/bin/sw_vers -buildVersion)" - x4="$(/usr/bin/arch)" - echo "${x1} - ${x2} - ${x3} - ${x4}" -} - -function tab() { - osascript 2>/dev/null </dev/null < /dev/null 2>&1 && test "$@" -ge 0 > /dev/null 2>&1); } - -# move the Terminal window -function mvtw() { - if [[ $# -eq 2 ]] && $(positive_int "$1") && $(positive_int "$2"); then - printf "\e[3;${1};${2};t" - return 0 - fi - return 1 -} - -# resize the Terminal window -function sizetw() { - if [[ $# -eq 2 ]] && $(positive_int "$1") && $(positive_int "$2"); then - printf "\e[8;${1};${2};t" - /usr/bin/clear - return 0 - fi - return 1 -} - -# full screen -function fullscreen() { printf "\e[3;0;0;t\e[8;0;0t"; /usr/bin/clear; return 0; } - -# default screen -function defaultscreen() { printf "\e[8;35;150;t"; printf "\e[3;300;240;t"; /usr/bin/clear; return 0; } - -# max columns -function maxc() { printf "\e[3;0;0;t\e[8;50;0t"; /usr/bin/clear; return 0; } - -# max rows -function maxr() { printf "\e[3;0;0;t\e[8;0;100t"; /usr/bin/clear; return 0; } - -# show number of lines & columns -function lc() { printf "lines: $(/usr/bin/tput lines)\ncolums: $(/usr/bin/tput cols)\n"; return 0; } + } + + # Minimise terminal window to Dock + function mintw() { printf "\e[2t"; return 0; } + + # Send Terminal window to background + function bgtw() { printf "\e[6t"; return 0; } + + function hidetw() { + /usr/bin/osascript -e 'tell application "System Events" to set visible of some item of ( get processes whose name = "Terminal" ) to false' + return 0 + } + + # positive integer test (including zero) + function positive_int() { return $(test "$@" -eq "$@" > /dev/null 2>&1 && test "$@" -ge 0 > /dev/null 2>&1); } + + # move the Terminal window + function mvtw() { + if [[ $# -eq 2 ]] && $(positive_int "$1") && $(positive_int "$2"); then + printf "\e[3;${1};${2};t" + return 0 + fi + return 1 + } + + # resize the Terminal window + function sizetw() { + if [[ $# -eq 2 ]] && $(positive_int "$1") && $(positive_int "$2"); then + printf "\e[8;${1};${2};t" + /usr/bin/clear + return 0 + fi + return 1 + } + + # full screen + function fullscreen() { printf "\e[3;0;0;t\e[8;0;0t"; /usr/bin/clear; return 0; } + + # default screen + function defaultscreen() { printf "\e[8;35;150;t"; printf "\e[3;300;240;t"; /usr/bin/clear; return 0; } + + # max columns + function maxc() { printf "\e[3;0;0;t\e[8;50;0t"; /usr/bin/clear; return 0; } + + # max rows + function maxr() { printf "\e[3;0;0;t\e[8;0;100t"; /usr/bin/clear; return 0; } + + # show number of lines & columns + function lc() { printf "lines: $(/usr/bin/tput lines)\ncolums: $(/usr/bin/tput cols)\n"; return 0; } +fi \ No newline at end of file diff --git a/shells/common/ruby.sh b/shells/common/ruby.sh index 637577e0..e7484511 100644 --- a/shells/common/ruby.sh +++ b/shells/common/ruby.sh @@ -3,7 +3,10 @@ export IRBRC="$HOME/.irbrc" export RBXOPT="-Xrbc.db=/tmp/rbx -X19" export JRUBY_OPTS="--1.9" -which=`which -a which | tail -n1` # avoid builtin +# if [ -f $SHELL_FILES/../../languages/ruby/rubyrc.rb ]; then +# echo setting RUBYOPT +# export RUBYOPT="-r$SHELL_FILES/../../languages/ruby/rubyrc" +# fi if [ -f "/usr/local/share/chruby/chruby.sh" ]; then source /usr/local/share/chruby/chruby.sh @@ -16,13 +19,13 @@ if [ -f "/usr/local/share/chruby/chruby.sh" ]; then return 1 fi } -elif $which -s rbenv; then +elif command -v rbenv; then eval "$(rbenv init - $CURRENT_SHELL)" function current_ruby() { rbenv version-name } -elif $which -s rvm; then +elif command -v rvm; then source $HOME/.rvm/scripts/rvm function current_ruby() { diff --git a/shells/path.sh b/shells/path.sh index c0a125ea..7eafae42 100644 --- a/shells/path.sh +++ b/shells/path.sh @@ -6,15 +6,17 @@ function __append_path { fi } -[ -d "$HOME/bin" ] && __append_path "new_path" "$HOME/bin" -[ -d "$DOT_FILES/bin" ] && __append_path "new_path" "$DOT_FILES/bin" -[ -d '/usr/local/bin' ] && __append_path "new_path" "/usr/local/bin" -[ -d '/usr/local/sbin' ] && __append_path "new_path" "/usr/local/sbin" -[ -d '/opt/local/bin' ] && __append_path "new_path" "/opt/local/bin" -[ -d '/opt/local/sbin' ] && __append_path "new_path" "/opt/local/sbin" -[ -d '/usr/X11/bin' ] && __append_path "new_path" "/usr/X11/bin" -[ -d '/usr/bin' ] && __append_path "new_path" "/usr/bin" -[ -d '/usr/sbin' ] && __append_path "new_path" "/usr/sbin" -[ -d '/bin' ] && __append_path "new_path" "/bin" -[ -d '/sbin' ] && __append_path "new_path" "/sbin" +[ -d "$HOME/bin" ] && __append_path "new_path" "$HOME/bin" +[ -d "$HOME/.cargo/bin" ] && __append_path "new_path" "$HOME/.cargo/bin" +[ -d "$HOME/.emacs.d/bin" ] && __append_path "new_path" "$HOME/.emacs.d/bin" +[ -d "$DOT_FILES/bin" ] && __append_path "new_path" "$DOT_FILES/bin" +[ -d '/usr/local/bin' ] && __append_path "new_path" "/usr/local/bin" +[ -d '/usr/local/sbin' ] && __append_path "new_path" "/usr/local/sbin" +[ -d '/opt/local/bin' ] && __append_path "new_path" "/opt/local/bin" +[ -d '/opt/local/sbin' ] && __append_path "new_path" "/opt/local/sbin" +[ -d '/usr/X11/bin' ] && __append_path "new_path" "/usr/X11/bin" +[ -d '/usr/bin' ] && __append_path "new_path" "/usr/bin" +[ -d '/usr/sbin' ] && __append_path "new_path" "/usr/sbin" +[ -d '/bin' ] && __append_path "new_path" "/bin" +[ -d '/sbin' ] && __append_path "new_path" "/sbin" PATH="$new_path" diff --git a/shells/zsh/lib/fish.zsh b/shells/zsh/lib/fish.zsh index 8ff737ee..1a7df8b6 100644 --- a/shells/zsh/lib/fish.zsh +++ b/shells/zsh/lib/fish.zsh @@ -1,10 +1,14 @@ -source $SHELL_FILES/lib/syntax-highlighting/zsh-syntax-highlighting.zsh -source $SHELL_FILES/lib/history-substring-search/zsh-history-substring-search.zsh +source $FRESH_PATH/build/vendor/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh +# source $FRESH_PATH/build/vendor/history-substring-search/zsh-history-substring-search.zsh # bind UP and DOWN arrow keys bindkey '^[[A' history-substring-search-up bindkey '^[[B' history-substring-search-down +# Bind control + LEFT and RIGHT arrow keys to jump by word +bindkey "^[[1;5C" forward-word +bindkey "^[[1;5D" backward-word + # bind P and N for EMACS mode bindkey -M emacs '^P' history-substring-search-up bindkey -M emacs '^N' history-substring-search-down diff --git a/shells/zsh/lib/history.zsh b/shells/zsh/lib/history.zsh index 876936b8..191d7f3c 100644 --- a/shells/zsh/lib/history.zsh +++ b/shells/zsh/lib/history.zsh @@ -1,13 +1,14 @@ ## Command history configuration HISTFILE=$HOME/.zsh_history -HISTSIZE=10000 -SAVEHIST=10000 +HISTSIZE=1000000 +SAVEHIST=1000000 -setopt append_history -setopt extended_history -setopt hist_expire_dups_first -setopt hist_ignore_dups # ignore duplication command history list -setopt hist_ignore_space -setopt hist_verify -setopt inc_append_history -setopt share_history # share command history data +setopt EXTENDED_HISTORY +setopt HIST_EXPIRE_DUPS_FIRST +setopt HIST_IGNORE_ALL_DUPS +setopt HIST_IGNORE_DUPS +setopt HIST_IGNORE_SPACE +setopt HIST_NO_STORE +setopt HIST_REDUCE_BLANKS +setopt HIST_VERIFY +setopt SHARE_HISTORY diff --git a/shells/zsh/zprofile b/shells/zsh/zprofile index e69de29b..71ad6d4a 100644 --- a/shells/zsh/zprofile +++ b/shells/zsh/zprofile @@ -0,0 +1,2 @@ + +export PATH="$HOME/.cargo/bin:$PATH" diff --git a/shells/zsh/zshrc b/shells/zsh/zshrc index 1436a1ab..371d6629 100644 --- a/shells/zsh/zshrc +++ b/shells/zsh/zshrc @@ -1,5 +1,15 @@ +bindkey -e CURRENT_SHELL="zsh" SHELL_FILES="${$(readlink $HOME/.zshrc):h}" DOT_FILES="${SHELL_FILES:h:h}" source $DOT_FILES/shells/bootstrap.sh + +[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh + +if type brew &>/dev/null; then + FPATH=$(brew --prefix)/share/zsh/site-functions:$FPATH +fi + +if command fortune >/dev/null; then fortune oblique; fi + diff --git a/vcs/git/gitconfig b/vcs/git/gitconfig index fee69030..b2b6caa6 100644 --- a/vcs/git/gitconfig +++ b/vcs/git/gitconfig @@ -15,6 +15,8 @@ mine = !sh -c 'git lg --author=\"`git me`\"' br = branch + fixup = "!f() { TARGET=$(git rev-parse "$1"); git commit --fixup=$TARGET ${@:2} && EDITOR=true git rebase -i --autostash --autosquash $TARGET^; }; f" + # TODO make this use selecta, when installed f = "!git ls-files | grep -i" diff --git a/vcs/git/gitignore b/vcs/git/gitignore index 1a93759d..22a235c6 100755 --- a/vcs/git/gitignore +++ b/vcs/git/gitignore @@ -68,3 +68,10 @@ pom.xml.asc /checkouts/ .lein-* vendor/gems +.gem +.gem/ +.yardoc/ +.terraform/ +.local/ +*.log +.bash_history From 8daf907e0cda6cc857a5c0a837711a3eaab48ebf Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Thu, 29 Aug 2019 10:01:19 +1000 Subject: [PATCH 128/234] Add asdf --- shells/common/asdf.sh | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 shells/common/asdf.sh diff --git a/shells/common/asdf.sh b/shells/common/asdf.sh new file mode 100644 index 00000000..0e657cd2 --- /dev/null +++ b/shells/common/asdf.sh @@ -0,0 +1,4 @@ +if [ -d "$HOME/.asdf" ]; then + . $HOME/.asdf/asdf.sh + . $HOME/.asdf/completions/asdf.bash +fi From c1daddfcdbb4b9a817483fecf7b0d3d4de9f7ff6 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Thu, 29 Aug 2019 10:01:56 +1000 Subject: [PATCH 129/234] Remove Brewfile --- Brewfile | 55 ------------------------------------------------------- freshrc | 2 -- 2 files changed, 57 deletions(-) delete mode 100644 Brewfile diff --git a/Brewfile b/Brewfile deleted file mode 100644 index bd5931bb..00000000 --- a/Brewfile +++ /dev/null @@ -1,55 +0,0 @@ -brew 'mas' -mas 'Annotate - Capture and Share', id: 918207447 -mas 'Slack', id: 803453959 -mas 'MindNode 5', id: 1289197285 - -cask 'google-chrome' -cask 'firefox' -cask 'virtualbox' -cask 'keepingyouawake' -cask 'yakyak' -cask 'iterm2' -cask 'sonos' -cask 'insomnia' - -# dev -mas 'Kaleidoscope', id: 587512244 -cask 'ksdiff' -tap 'neovim/neovim' -brew 'neovim' -tap 'universal-ctags/universal-ctags' -brew 'universal-ctags', args: %w[HEAD] # currently HEAD only -brew 'chruby' -brew 'ruby-install' -brew 'phantomjs' -brew 'chromedriver' -brew 'node' -brew 'yarn' -#brew 'multirust' -brew 'rust' -brew 'crystal-lang' -brew 'elixir' -brew 'leiningen' -cask 'aws-vault' - -# data -brew 'postgres' -brew 'memcached' -brew 'redis' - -# util -brew 'ag' -brew 'wget' -brew 'tree' -brew 'coreutils' -brew 'pv' -brew 'tmux' -brew 'htop' - -# shells -brew 'zsh' -brew 'fish' - -# misc -tap 'caskroom/fonts' -cask 'font-hack-nerd-font' diff --git a/freshrc b/freshrc index a91f2e1e..b06c8245 100644 --- a/freshrc +++ b/freshrc @@ -4,8 +4,6 @@ fresh freshshell/fresh bin/fresh --bin fresh languages/clojure/lein/profiles.clj --file=~/.lein/profiles.clj fresh-options --file # each file as is - fresh Brewfile - fresh languages/ruby/gemrc fresh languages/ruby/irbrc From 390cd79187e5b73ca01ee5d422ac27b641999214 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Thu, 29 Aug 2019 10:02:43 +1000 Subject: [PATCH 130/234] Set MIX_ENV for editor --- shells/common/exports.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/shells/common/exports.sh b/shells/common/exports.sh index 81a2309a..ed0e83d2 100644 --- a/shells/common/exports.sh +++ b/shells/common/exports.sh @@ -1,6 +1,15 @@ which vim &>/dev/null && editor="$(which vim)" which nvim &>/dev/null && editor="$(which nvim)" +# Many editor integrations (linters, language server, etc) mess up Phoenix auto +# reloading by compiling changed files themselves (causing Phoenix to think +# that the live version is up-to-date). +# +# Each tool has various work-arounds to make this work, but the simplest thing +# (for editors started from the terminal) is to simply change the environment +# everything runs under by default. +editor="env MIX_ENV=editor $editor" + export EDITOR="$editor -f" export VISUAL="$editor" From 0f1a9785c42aea29d4ceae2ddfb79acffb062017 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Thu, 29 Aug 2019 10:03:32 +1000 Subject: [PATCH 131/234] Better cross-platform compat for testing for bins --- shells/common/exports.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shells/common/exports.sh b/shells/common/exports.sh index ed0e83d2..6bed5344 100644 --- a/shells/common/exports.sh +++ b/shells/common/exports.sh @@ -1,5 +1,5 @@ -which vim &>/dev/null && editor="$(which vim)" -which nvim &>/dev/null && editor="$(which nvim)" +command -v vim &>/dev/null && editor="$(which vim)" +command -v nvim &>/dev/null && editor="$(which nvim)" # Many editor integrations (linters, language server, etc) mess up Phoenix auto # reloading by compiling changed files themselves (causing Phoenix to think From 5e08afe4d09d0451ec1e1fd80160929436cb62b8 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Thu, 29 Aug 2019 10:04:05 +1000 Subject: [PATCH 132/234] Set better default FZF command (when ag installed) --- shells/common/exports.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/shells/common/exports.sh b/shells/common/exports.sh index 6bed5344..cf9d9522 100644 --- a/shells/common/exports.sh +++ b/shells/common/exports.sh @@ -1,6 +1,11 @@ command -v vim &>/dev/null && editor="$(which vim)" command -v nvim &>/dev/null && editor="$(which nvim)" +if command -v ag &>/dev/null; then + # Ignore anything in .gitignore but still list other hidden files (e.g. .env) + export FZF_DEFAULT_COMMAND="ag -l --hidden --ignore .git/" +fi + # Many editor integrations (linters, language server, etc) mess up Phoenix auto # reloading by compiling changed files themselves (causing Phoenix to think # that the live version is up-to-date). From a77db5a4816cf31d3af7ac14ac3a647725228871 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Thu, 29 Aug 2019 10:05:01 +1000 Subject: [PATCH 133/234] Switch fully to fresh --- Rakefile | 20 --- install.yml | 35 ----- setup.sh | 438 ---------------------------------------------------- 3 files changed, 493 deletions(-) delete mode 100644 Rakefile delete mode 100644 install.yml delete mode 100755 setup.sh diff --git a/Rakefile b/Rakefile deleted file mode 100644 index a20f1b05..00000000 --- a/Rakefile +++ /dev/null @@ -1,20 +0,0 @@ -require 'yaml' - -desc "install the dot files into user's home directory" -task :install do - dot_files = File.dirname(__FILE__) - install = proc do |files, cmd| - files.each do |source, destination| - source = File.expand_path(source, dot_files) - destination = File.expand_path(destination, ENV['HOME']) - system 'mkdir', '-p', File.dirname(destination) - # puts [*cmd, source, destination].join(" ") - system *cmd, source, destination - end - end - - plan = YAML.load_file(File.expand_path("install.yml", dot_files)) - - install.call plan[:link], %w[ln -sinF] - install.call plan[:copy], %w[cp -i] -end diff --git a/install.yml b/install.yml deleted file mode 100644 index 8691e128..00000000 --- a/install.yml +++ /dev/null @@ -1,35 +0,0 @@ -:link: - editors/emacs/spacemacs: ~/.spacemacs - editors/vim: ~/.vim - editors/vim/gvimrc: ~/.gvimrc - editors/vim/vimrc: ~/.vimrc - languages/clojure/lein/profiles.clj: ~/.lein/profiles.clj - languages/ruby/autotest/autotest: ~/.autotest - languages/ruby/gemrc: ~/.gemrc - languages/ruby/irbrc: ~/.irbrc - languages/ruby/rdebugrc: ~/.rdebugrc - languages/ruby/railsrc: ~/.railsrc - languages/ruby/rspec: ~/.rspec - misc/ackrc: ~/.ackrc - misc/agignore: ~/.agignore - misc/ctags: ~/.ctags - misc/inputrc: ~/.inputrc - misc/nanorc: ~/.nanorc - misc/psqlrc: ~/.psqlrc - misc/tmux/tmux.conf: ~/.tmux.conf - shells/bash/bash_profile: ~/.bash_profile - shells/bash/bashrc: ~/.bashrc - shells/zsh/zshenv: ~/.zshenv - shells/zsh/zshrc: ~/.zshrc - shells/zsh/zprofile: ~/.zprofile - vcs/git/gitattributes: ~/.gitattributes - vcs/git/gitconfig: ~/.gitconfig - vcs/git/gitconfig.merge: ~/.gitconfig.merge - vcs/git/gitconfig.pushurls: ~/.gitconfig.pushurls - vcs/git/gitignore: ~/.gitignore - vcs/git/gitk: ~/.gitk - vcs/git/git_template: ~/.git_template - vcs/hg/hgrc: ~/.hgrc -:copy: - vcs/git/gitconfig.local: ~/.gitconfig.local - karabiner-ref.xml: ~/Library/Application Support/Karabiner/private.xml diff --git a/setup.sh b/setup.sh deleted file mode 100755 index aa941220..00000000 --- a/setup.sh +++ /dev/null @@ -1,438 +0,0 @@ -#!/usr/bin/env bash - -# TODO: create SSH key if none exists - -function main { - setup_dot_files - if is_mac; then - install_homebrew - #configure_mac - brew tap Homebrew/bundle - brew bundle --no-upgrade --global - ruby-install --no-reinstall ruby 2.1 - ruby-install --no-reinstall ruby 2.2 - ruby-install --no-reinstall ruby 2.3 - ruby-install --no-reinstall ruby 2.4 - fi -} - -function setup_dot_files { - FRESH_LOCAL_SOURCE=bjeanes/dotfiles bash -c "`curl -sL https://get.freshshell.com`" - vim +PlugUpdate +qall - ( - cd ~/.dotfiles - git submodule update --init - ) -} - -# Thanks @mathiasbynens (https://github.com/mathiasbynens/dotfiles/blob/master/.macos) -function sudo { - sudo -v - while true; do - sudo -n true - sleep 60 - kill -0 "$$" || exit - done 2>/dev/null & - - function sudo { - command sudo - } - - sudo $* -} - -function configure_mac { - # Menu bar: hide the Time Machine, Volume, and User icons - for domain in ~/Library/Preferences/ByHost/com.apple.systemuiserver.*; do - defaults write "${domain}" dontAutoLoad -array \ - "/System/Library/CoreServices/Menu Extras/TimeMachine.menu" \ - "/System/Library/CoreServices/Menu Extras/Volume.menu" \ - "/System/Library/CoreServices/Menu Extras/User.menu" - done - - # Stop iTunes from responding to media keys - launchctl unload -w /System/Library/LaunchAgents/com.apple.rcd.plist 2>/dev/null - - # TextEdit plain text by default - defaults write com.apple.TextEdit RichText -int 0 - # Open and save files as UTF-8 in TextEdit - defaults write com.apple.TextEdit PlainTextEncoding -int 4 - defaults write com.apple.TextEdit PlainTextEncodingForWrite -int 4 - - configure_keyboard - - # Turn off keyboard backlight when unused for 5 minutes - defaults write com.apple.BezelServices kDimTime -int 300 - - # Disable start up boot sound - sudo nvram SystemAudioVolume=" " - - # Disable Gatekeeper - sudo spctl --master-disable - - # Require password to leave screensaver - defaults write com.apple.screensaver askForPassword -int 1 - defaults write com.apple.screensaver askForPasswordDelay -int 0 - - # Speeding up wake from sleep to 24 hours from an hour - # http://www.cultofmac.com/221392/quick-hack-speeds-up-retina-macbooks-wake-from-sleep-os-x-tips/ - sudo pmset -a standbydelay 86400 - - # Enable AirDrop over Ethernet and on Unsupported Macs - defaults write com.apple.NetworkBrowser BrowseAllInterfaces -bool true - - # Disable Notification Center - launchctl unload -w /System/Library/LaunchAgents/com.apple.notificationcenterui.plist 2>/dev/null - killall -9 NotificationCenter 2>/dev/null - - # Install latest shells and set ZSH to default - if ! brew ls -1 bash 2>/dev/null; then - brew install bash - echo $(brew --prefix)/bin/bash | sudo tee -a /etc/shells - fi - - if ! brew ls -1 fish 2>/dev/null; then - brew install fish - echo $(brew --prefix)/bin/fish | sudo tee -a /etc/shells - fi - - if ! brew ls -1 zsh 2>/dev/null; then - brew install zsh - echo $(brew --prefix)/bin/zsh | sudo tee -a /etc/shells - sudo chsh -s $(brew --prefix)/bin/zsh $USER - fi - - # Always show scrollbars - defaults write NSGlobalDomain AppleShowScrollBars -string "Always" - - # Expand save panel by default - defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true - defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode2 -bool true - - # Expand print panel by default - defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true - defaults write NSGlobalDomain PMPrintingExpandedStateForPrint2 -bool true - - # Save to disk (not to iCloud) by default - defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false - - # Automatically quit printer app once the print jobs complete - defaults write com.apple.print.PrintingPrefs "Quit When Finished" -bool true - - # Disable the “Are you sure you want to open this application?” dialog - defaults write com.apple.LaunchServices LSQuarantine -bool false - - # Disable Resume system-wide - defaults write com.apple.systempreferences NSQuitAlwaysKeepsWindows -bool false - - # Set Help Viewer windows to non-floating mode - defaults write com.apple.helpviewer DevMode -bool true - - # Reveal IP address, hostname, OS version, etc. when clicking the clock - # in the login window - sudo defaults write /Library/Preferences/com.apple.loginwindow AdminHostInfo HostName - - # Increase sound quality for Bluetooth headphones/headsets - defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" -int 40 - - # Restart automatically if the computer freezes - sudo systemsetup -setrestartfreeze on - - # Disable the sudden motion sensor as it’s not useful for SSDs - sudo pmset -a sms 0 - - # Enable subpixel font rendering on non-Apple LCDs - defaults write NSGlobalDomain AppleFontSmoothing -int 2 - - # Enable HiDPI display modes (requires restart) - sudo defaults write /Library/Preferences/com.apple.windowserver DisplayResolutionEnabled -bool true - - # Finder: disable window animations and Get Info animations - defaults write com.apple.finder DisableAllAnimations -bool true - - # Set Desktop as the default location for new Finder windows - # For other paths, use `PfLo` and `file:///full/path/here/` - defaults write com.apple.finder NewWindowTarget -string "PfDe" - defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}/Desktop/" - - # Show icons for hard drives, servers, and removable media on the desktop - defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool true - defaults write com.apple.finder ShowHardDrivesOnDesktop -bool true - defaults write com.apple.finder ShowMountedServersOnDesktop -bool true - defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool true - - # Finder: show hidden files by default - defaults write com.apple.finder AppleShowAllFiles -bool true - - # Finder: show all filename extensions - defaults write NSGlobalDomain AppleShowAllExtensions -bool true - - # Finder: show status bar - defaults write com.apple.finder ShowStatusBar -bool true - - # Finder: show path bar - defaults write com.apple.finder ShowPathbar -bool true - - # Display full POSIX path as Finder window title - defaults write com.apple.finder _FXShowPosixPathInTitle -bool true - - # Keep folders on top when sorting by name - defaults write com.apple.finder _FXSortFoldersFirst -bool true - - # When performing a search, search the current folder by default - defaults write com.apple.finder FXDefaultSearchScope -string "SCcf" - - # Disable the warning when changing a file extension - defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false - - # Enable spring loading for directories - defaults write NSGlobalDomain com.apple.springing.enabled -bool true - - # Remove the spring loading delay for directories - defaults write NSGlobalDomain com.apple.springing.delay -float 0 - - # Avoid creating .DS_Store files on network or USB volumes - defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true - defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true - - # Automatically open a new Finder window when a volume is mounted - defaults write com.apple.frameworks.diskimages auto-open-ro-root -bool true - defaults write com.apple.frameworks.diskimages auto-open-rw-root -bool true - defaults write com.apple.finder OpenWindowForNewRemovableDisk -bool true - - # Show item info near icons on the desktop and in other icon views - /usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist - /usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist - /usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist - - # Show item info to the right of the icons on the desktop - /usr/libexec/PlistBuddy -c "Set DesktopViewSettings:IconViewSettings:labelOnBottom false" ~/Library/Preferences/com.apple.finder.plist - - # Enable snap-to-grid for icons on the desktop and in other icon views - /usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist - /usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist - /usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist - - # Increase grid spacing for icons on the desktop and in other icon views - /usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:gridSpacing 100" ~/Library/Preferences/com.apple.finder.plist - /usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:gridSpacing 100" ~/Library/Preferences/com.apple.finder.plist - /usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:gridSpacing 100" ~/Library/Preferences/com.apple.finder.plist - - # Increase the size of icons on the desktop and in other icon views - /usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:iconSize 80" ~/Library/Preferences/com.apple.finder.plist - /usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:iconSize 80" ~/Library/Preferences/com.apple.finder.plist - /usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:iconSize 80" ~/Library/Preferences/com.apple.finder.plist - - # Use list view in all Finder windows by default - # Four-letter codes for the other view modes: `icnv`, `clmv`, `Flwv` - defaults write com.apple.finder FXPreferredViewStyle -string "Nlsv" - - # Show the ~/Library folder - chflags nohidden ~/Library - - # Show the /Volumes folder - sudo chflags nohidden /Volumes - - # Expand the following File Info panes: - # “General”, “Open with”, and “Sharing & Permissions” - defaults write com.apple.finder FXInfoPanesExpanded -dict \ - General -bool true \ - OpenWith -bool true \ - Privileges -bool true - - # Set the icon size of Dock items to 36 pixels - defaults write com.apple.dock tilesize -int 36 - - # Minimize windows into their application’s icon - defaults write com.apple.dock minimize-to-application -bool true - - # Enable spring loading for all Dock items - defaults write com.apple.dock enable-spring-load-actions-on-all-items -bool true - - # Show indicator lights for open applications in the Dock - defaults write com.apple.dock show-process-indicators -bool true - - # Wipe all (default) app icons from the Dock - defaults write com.apple.dock persistent-apps -array - - # Show only open applications in the Dock - defaults write com.apple.dock static-only -bool true - - # Speed up Mission Control animations - defaults write com.apple.dock expose-animation-duration -float 0.1 - - # Disable Dashboard - defaults write com.apple.dashboard mcx-disabled -bool true - - # Don’t show Dashboard as a Space - defaults write com.apple.dock dashboard-in-overlay -bool true - - # Don’t automatically rearrange Spaces based on most recent use - defaults write com.apple.dock mru-spaces -bool false - - # Remove the auto-hiding Dock delay - defaults write com.apple.dock autohide-delay -float 0 - # Remove the animation when hiding/showing the Dock - defaults write com.apple.dock autohide-time-modifier -float 0 - - # Automatically hide and show the Dock - defaults write com.apple.dock autohide -bool true - - # Make Dock icons of hidden applications translucent - defaults write com.apple.dock showhidden -bool true - - # Disable the Launchpad gesture (pinch with thumb and three fingers) - defaults write com.apple.dock showLaunchpadGestureEnabled -int 0 - - # Privacy: don’t send search queries to Apple - defaults write com.apple.Safari UniversalSearchEnabled -bool false - defaults write com.apple.Safari SuppressSearchSuggestions -bool true - - # Press Tab to highlight each item on a web page - defaults write com.apple.Safari WebKitTabToLinksPreferenceKey -bool true - defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2TabsToLinks -bool true - - # Prevent Safari from opening ‘safe’ files automatically after downloading - defaults write com.apple.Safari AutoOpenSafeDownloads -bool false - - # Show the full URL in the address bar (note: this still hides the scheme) - defaults write com.apple.Safari ShowFullURLInSmartSearchField -bool true - - # Set Safari’s home page to `about:blank` for faster loading - defaults write com.apple.Safari HomePage -string "about:blank" - - # Hide Safari’s bookmarks bar by default - defaults write com.apple.Safari ShowFavoritesBar -bool false - - # Hide Safari’s sidebar in Top Sites - defaults write com.apple.Safari ShowSidebarInTopSites -bool false - - # Enable Safari’s debug menu - defaults write com.apple.Safari IncludeInternalDebugMenu -bool true - - # Make Safari’s search banners default to Contains instead of Starts With - defaults write com.apple.Safari FindOnPageMatchesWordStartsOnly -bool false - - # Enable the Develop menu and the Web Inspector in Safari - defaults write com.apple.Safari IncludeDevelopMenu -bool true - defaults write com.apple.Safari WebKitDeveloperExtrasEnabledPreferenceKey -bool true - defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled -bool true - - # Add a context menu item for showing the Web Inspector in web views - defaults write NSGlobalDomain WebKitDeveloperExtras -bool true - - # Enable continuous spellchecking - defaults write com.apple.Safari WebContinuousSpellCheckingEnabled -bool true - - # Disable auto-correct - defaults write com.apple.Safari WebAutomaticSpellingCorrectionEnabled -bool false - - # Disable AutoFill - defaults write com.apple.Safari AutoFillFromAddressBook -bool false - defaults write com.apple.Safari AutoFillPasswords -bool false - defaults write com.apple.Safari AutoFillCreditCardData -bool false - defaults write com.apple.Safari AutoFillMiscellaneousForms -bool false - - # Warn about fraudulent websites - defaults write com.apple.Safari WarnAboutFraudulentWebsites -bool true - - # Update extensions automatically - defaults write com.apple.Safari InstallExtensionUpdatesAutomatically -bool true - - # Only use UTF-8 in Terminal.app - defaults write com.apple.terminal StringEncodings -array 4 - - # Enable Secure Keyboard Entry in Terminal.app - # See: https://security.stackexchange.com/a/47786/8918 - defaults write com.apple.terminal SecureKeyboardEntry -bool true - - # Prevent Time Machine from prompting to use new hard drives as backup volume - defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true - - # Disable local Time Machine backups - hash tmutil &> /dev/null && sudo tmutil disablelocal - - # Enable the automatic update check - defaults write com.apple.SoftwareUpdate AutomaticCheckEnabled -bool true - - # Check for software updates daily, not just once per week - defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 1 - - # Download newly available updates in background - defaults write com.apple.SoftwareUpdate AutomaticDownload -int 1 - - # Install System data files & security updates - defaults write com.apple.SoftwareUpdate CriticalUpdateInstall -int 1 - - # Turn on app auto-update - defaults write com.apple.commerce AutoUpdate -bool true - - # Prevent Photos from opening automatically when devices are plugged in - defaults -currentHost write com.apple.ImageCapture disableHotPlug -bool true - - # Disable smart quotes as it’s annoying for messages that contain code - defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "automaticQuoteSubstitutionEnabled" -bool false - - # Disable continuous spell checking - defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "continuousSpellCheckingEnabled" -bool false - - for app in "Activity Monitor" "cfprefsd" "Dock" "Finder" "Messages" \ - "Safari" "SystemUIServer" "Terminal"; do - killall "${app}" &> /dev/null - done -} - -function configure_trackpad { - # Trackpad: enable tap to click for this user and for the login screen - defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true - defaults -currentHost write NSGlobalDomain com.apple.mouse.tapBehavior -int 1 - defaults write NSGlobalDomain com.apple.mouse.tapBehavior -int 1 - - defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadRightClick -bool true - defaults -currentHost write NSGlobalDomain com.apple.trackpad.enableSecondaryClick -bool true -} - -function configure_keyboard { - # Don't press-and-hold for auto-correct - defaults write -g ApplePressAndHoldEnabled -bool false - - # Make all UI tabbable - defaults write NSGlobalDomain AppleKeyboardUIMode -int 3 - - # Disable auto-correct - defaults write -g NSAutomaticSpellingCorrectionEnabled -bool false - - # Disable smart quotes as they’re annoying when typing code - defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false - - # Disable smart dashes as they’re annoying when typing code - defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false - - # Set language and text formats - defaults write NSGlobalDomain AppleLanguages -array "en-AU" - defaults write NSGlobalDomain AppleLocale -string "en-AU" - defaults write NSGlobalDomain AppleMeasurementUnits -string "Centimeters" - defaults write NSGlobalDomain AppleMetricUnits -bool true - -} - -function configure_developer_mode_in_safari { - defaults write com.apple.Safari IncludeInternalDebugMenu -bool true && \ - defaults write com.apple.Safari IncludeDevelopMenu -bool true && \ - defaults write com.apple.Safari WebKitDeveloperExtrasEnabledPreferenceKey -bool true && \ - defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled -bool true && \ - defaults write -g WebKitDeveloperExtras -bool true -} - -function is_mac { - [[ "$OSTYPE" == "darwin"* ]] -} - -function install_homebrew { - command -v brew && return - is_mac || return - - /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" -} - -main From 6bbfeffcd2c58fef9a664debf06152efbab02803 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Thu, 29 Aug 2019 10:06:17 +1000 Subject: [PATCH 134/234] Config will auto-create plug.vim so don't commit it --- editors/vim/autoload/.gitignore | 1 + editors/vim/autoload/plug.vim | 2446 ------------------------------- 2 files changed, 1 insertion(+), 2446 deletions(-) create mode 100644 editors/vim/autoload/.gitignore delete mode 100644 editors/vim/autoload/plug.vim diff --git a/editors/vim/autoload/.gitignore b/editors/vim/autoload/.gitignore new file mode 100644 index 00000000..43c9cabb --- /dev/null +++ b/editors/vim/autoload/.gitignore @@ -0,0 +1 @@ +plug.vim diff --git a/editors/vim/autoload/plug.vim b/editors/vim/autoload/plug.vim deleted file mode 100644 index 7819a5a7..00000000 --- a/editors/vim/autoload/plug.vim +++ /dev/null @@ -1,2446 +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-master branch -" Plug 'rdnetto/YCM-Generator', { 'branch': 'stable' } -" -" " Using a tagged release; wildcard allowed (requires git 1.9.2 or above) -" Plug 'fatih/vim-go', { 'tag': '*' } -" -" " Plugin options -" Plug 'nsf/gocode', { 'tag': 'v.20150303', 'rtp': 'vim' } -" -" " Plugin outside ~/.vim/plugged with post-update hook -" Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } -" -" " Unmanaged plugin (manually installed and updated) -" Plug '~/my-prototype-plugin' -" -" " Initialize plugin system -" call plug#end() -" -" Then reload .vimrc and :PlugInstall to install plugins. -" -" Plug options: -" -"| Option | Description | -"| ----------------------- | ------------------------------------------------ | -"| `branch`/`tag`/`commit` | Branch/tag/commit of the repository to use | -"| `rtp` | Subdirectory that contains Vim plugin | -"| `dir` | Custom directory for the plugin | -"| `as` | Use different name for the plugin | -"| `do` | Post-update hook (string or funcref) | -"| `on` | On-demand loading: Commands or ``-mappings | -"| `for` | On-demand loading: File types | -"| `frozen` | Do not update unless explicitly specified | -" -" More information: https://github.com/junegunn/vim-plug -" -" -" Copyright (c) 2017 Junegunn Choi -" -" MIT License -" -" Permission is hereby granted, free of charge, to any person obtaining -" a copy of this software and associated documentation files (the -" "Software"), to deal in the Software without restriction, including -" without limitation the rights to use, copy, modify, merge, publish, -" distribute, sublicense, and/or sell copies of the Software, and to -" permit persons to whom the Software is furnished to do so, subject to -" the following conditions: -" -" The above copyright notice and this permission notice shall be -" included in all copies or substantial portions of the Software. -" -" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -" NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -" LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -" OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -" WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -if exists('g:loaded_plug') - finish -endif -let g:loaded_plug = 1 - -let s:cpo_save = &cpo -set cpo&vim - -let s:plug_src = 'https://github.com/junegunn/vim-plug.git' -let s:plug_tab = get(s:, 'plug_tab', -1) -let s:plug_buf = get(s:, 'plug_buf', -1) -let s:mac_gui = has('gui_macvim') && has('gui_running') -let s:is_win = has('win32') || has('win64') -let s:nvim = has('nvim') && exists('*jobwait') && !s:is_win -let s:vim8 = has('patch-8.0.0039') && exists('*job_start') -let s:me = resolve(expand(':p')) -let s:base_spec = { 'branch': 'master', 'frozen': 0 } -let s:TYPE = { -\ 'string': type(''), -\ 'list': type([]), -\ 'dict': type({}), -\ 'funcref': type(function('call')) -\ } -let s:loaded = get(s:, 'loaded', {}) -let s:triggers = get(s:, 'triggers', {}) - -function! plug#begin(...) - if a:0 > 0 - let s:plug_home_org = a:1 - let home = s:path(fnamemodify(expand(a:1), ':p')) - elseif exists('g:plug_home') - let home = s:path(g:plug_home) - elseif !empty(&rtp) - let home = s:path(split(&rtp, ',')[0]) . '/plugged' - else - return s:err('Unable to determine plug home. Try calling plug#begin() with a path argument.') - endif - - let g:plug_home = home - let g:plugs = {} - let g:plugs_order = [] - let s:triggers = {} - - call s:define_commands() - return 1 -endfunction - -function! s:define_commands() - command! -nargs=+ -bar Plug call plug#() - if !executable('git') - return s:err('`git` executable not found. Most commands will not be available. To suppress this message, prepend `silent!` to `call plug#begin(...)`.') - endif - command! -nargs=* -bar -bang -complete=customlist,s:names PlugInstall call s:install(0, []) - command! -nargs=* -bar -bang -complete=customlist,s:names PlugUpdate call s:update(0, []) - command! -nargs=0 -bar -bang PlugClean call s:clean(0) - command! -nargs=0 -bar PlugUpgrade if s:upgrade() | execute 'source' s:esc(s:me) | endif - command! -nargs=0 -bar PlugStatus call s:status() - command! -nargs=0 -bar PlugDiff call s:diff() - command! -nargs=? -bar -bang -complete=file PlugSnapshot call s:snapshot(0, ) -endfunction - -function! s:to_a(v) - return type(a:v) == s:TYPE.list ? a:v : [a:v] -endfunction - -function! s:to_s(v) - return type(a:v) == s:TYPE.string ? a:v : join(a:v, "\n") . "\n" -endfunction - -function! s:glob(from, pattern) - return s:lines(globpath(a:from, a:pattern)) -endfunction - -function! s:source(from, ...) - let found = 0 - for pattern in a:000 - for vim in s:glob(a:from, pattern) - execute 'source' s:esc(vim) - let found = 1 - endfor - endfor - return found -endfunction - -function! s:assoc(dict, key, val) - let a:dict[a:key] = add(get(a:dict, a:key, []), a:val) -endfunction - -function! s:ask(message, ...) - call inputsave() - echohl WarningMsg - let answer = input(a:message.(a:0 ? ' (y/N/a) ' : ' (y/N) ')) - echohl None - call inputrestore() - echo "\r" - return (a:0 && answer =~? '^a') ? 2 : (answer =~? '^y') ? 1 : 0 -endfunction - -function! s:ask_no_interrupt(...) - try - return call('s:ask', a:000) - catch - return 0 - endtry -endfunction - -function! plug#end() - if !exists('g:plugs') - return s:err('Call plug#begin() first') - endif - - if exists('#PlugLOD') - augroup PlugLOD - autocmd! - augroup END - augroup! PlugLOD - endif - let lod = { 'ft': {}, 'map': {}, 'cmd': {} } - - if exists('g:did_load_filetypes') - filetype off - endif - for name in g:plugs_order - if !has_key(g:plugs, name) - continue - endif - let plug = g:plugs[name] - if get(s:loaded, name, 0) || !has_key(plug, 'on') && !has_key(plug, 'for') - let s:loaded[name] = 1 - continue - endif - - if has_key(plug, 'on') - let s:triggers[name] = { 'map': [], 'cmd': [] } - for cmd in s:to_a(plug.on) - if cmd =~? '^.\+' - if empty(mapcheck(cmd)) && empty(mapcheck(cmd, 'i')) - call s:assoc(lod.map, cmd, name) - endif - call add(s:triggers[name].map, cmd) - elseif cmd =~# '^[A-Z]' - let cmd = substitute(cmd, '!*$', '', '') - if exists(':'.cmd) != 2 - call s:assoc(lod.cmd, cmd, name) - endif - call add(s:triggers[name].cmd, cmd) - else - call s:err('Invalid `on` option: '.cmd. - \ '. Should start with an uppercase letter or ``.') - endif - endfor - endif - - if has_key(plug, 'for') - let types = s:to_a(plug.for) - if !empty(types) - augroup filetypedetect - call s:source(s:rtp(plug), 'ftdetect/**/*.vim', 'after/ftdetect/**/*.vim') - augroup END - endif - for type in types - call s:assoc(lod.ft, type, name) - endfor - endif - endfor - - for [cmd, names] in items(lod.cmd) - execute printf( - \ 'command! -nargs=* -range -bang -complete=file %s call s:lod_cmd(%s, "", , , , %s)', - \ cmd, string(cmd), string(names)) - endfor - - for [map, names] in items(lod.map) - for [mode, map_prefix, key_prefix] in - \ [['i', '', ''], ['n', '', ''], ['v', '', 'gv'], ['o', '', '']] - execute printf( - \ '%snoremap %s %s:call lod_map(%s, %s, %s, "%s")', - \ mode, map, map_prefix, string(map), string(names), mode != 'i', key_prefix) - endfor - endfor - - for [ft, names] in items(lod.ft) - augroup PlugLOD - execute printf('autocmd FileType %s call lod_ft(%s, %s)', - \ ft, string(ft), string(names)) - augroup END - endfor - - call s:reorg_rtp() - filetype plugin indent on - if has('vim_starting') - if has('syntax') && !exists('g:syntax_on') - syntax enable - end - else - call s:reload_plugins() - endif -endfunction - -function! s:loaded_names() - return filter(copy(g:plugs_order), 'get(s:loaded, v:val, 0)') -endfunction - -function! s:load_plugin(spec) - call s:source(s:rtp(a:spec), 'plugin/**/*.vim', 'after/plugin/**/*.vim') -endfunction - -function! s:reload_plugins() - for name in s:loaded_names() - call s:load_plugin(g:plugs[name]) - endfor -endfunction - -function! s:trim(str) - return substitute(a:str, '[\/]\+$', '', '') -endfunction - -function! s:version_requirement(val, min) - for idx in range(0, len(a:min) - 1) - let v = get(a:val, idx, 0) - if v < a:min[idx] | return 0 - elseif v > a:min[idx] | return 1 - endif - endfor - return 1 -endfunction - -function! s:git_version_requirement(...) - if !exists('s:git_version') - let s:git_version = map(split(split(s:system('git --version'))[2], '\.'), 'str2nr(v:val)') - endif - return s:version_requirement(s:git_version, a:000) -endfunction - -function! s:progress_opt(base) - return a:base && !s:is_win && - \ s:git_version_requirement(1, 7, 1) ? '--progress' : '' -endfunction - -if s:is_win - function! s:rtp(spec) - return s:path(a:spec.dir . get(a:spec, 'rtp', '')) - endfunction - - function! s:path(path) - return s:trim(substitute(a:path, '/', '\', 'g')) - endfunction - - function! s:dirpath(path) - return s:path(a:path) . '\' - endfunction - - function! s:is_local_plug(repo) - return a:repo =~? '^[a-z]:\|^[%~]' - endfunction -else - function! s:rtp(spec) - return s:dirpath(a:spec.dir . get(a:spec, 'rtp', '')) - endfunction - - function! s:path(path) - return s:trim(a:path) - endfunction - - function! s:dirpath(path) - return substitute(a:path, '[/\\]*$', '/', '') - endfunction - - function! s:is_local_plug(repo) - return a:repo[0] =~ '[/$~]' - endfunction -endif - -function! s:err(msg) - echohl ErrorMsg - echom '[vim-plug] '.a:msg - echohl None -endfunction - -function! s:warn(cmd, msg) - echohl WarningMsg - execute a:cmd 'a:msg' - echohl None -endfunction - -function! s:esc(path) - return escape(a:path, ' ') -endfunction - -function! s:escrtp(path) - return escape(a:path, ' ,') -endfunction - -function! s:remove_rtp() - for name in s:loaded_names() - let rtp = s:rtp(g:plugs[name]) - execute 'set rtp-='.s:escrtp(rtp) - let after = globpath(rtp, 'after') - if isdirectory(after) - execute 'set rtp-='.s:escrtp(after) - endif - endfor -endfunction - -function! s:reorg_rtp() - if !empty(s:first_rtp) - execute 'set rtp-='.s:first_rtp - execute 'set rtp-='.s:last_rtp - endif - - " &rtp is modified from outside - if exists('s:prtp') && s:prtp !=# &rtp - call s:remove_rtp() - unlet! s:middle - endif - - let s:middle = get(s:, 'middle', &rtp) - let rtps = map(s:loaded_names(), 's:rtp(g:plugs[v:val])') - let afters = filter(map(copy(rtps), 'globpath(v:val, "after")'), '!empty(v:val)') - let rtp = join(map(rtps, 'escape(v:val, ",")'), ',') - \ . ','.s:middle.',' - \ . join(map(afters, 'escape(v:val, ",")'), ',') - let &rtp = substitute(substitute(rtp, ',,*', ',', 'g'), '^,\|,$', '', 'g') - let s:prtp = &rtp - - if !empty(s:first_rtp) - execute 'set rtp^='.s:first_rtp - execute 'set rtp+='.s:last_rtp - endif -endfunction - -function! s:doautocmd(...) - if exists('#'.join(a:000, '#')) - execute 'doautocmd' ((v:version > 703 || has('patch442')) ? '' : '') join(a:000) - endif -endfunction - -function! s:dobufread(names) - for name in a:names - let path = s:rtp(g:plugs[name]).'/**' - for dir in ['ftdetect', 'ftplugin'] - if len(finddir(dir, path)) - if exists('#BufRead') - doautocmd BufRead - endif - return - endif - endfor - endfor -endfunction - -function! plug#load(...) - if a:0 == 0 - return s:err('Argument missing: plugin name(s) required') - endif - if !exists('g:plugs') - return s:err('plug#begin was not called') - endif - let unknowns = filter(copy(a:000), '!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 - for name in a:000 - call s:lod([name], ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin']) - endfor - call s:dobufread(a:000) - return 1 -endfunction - -function! s:remove_triggers(name) - if !has_key(s:triggers, a:name) - return - endif - for cmd in s:triggers[a:name].cmd - execute 'silent! delc' cmd - endfor - for map in s:triggers[a:name].map - execute 'silent! unmap' map - execute 'silent! iunmap' map - endfor - call remove(s:triggers, a:name) -endfunction - -function! s:lod(names, types, ...) - for name in a:names - call s:remove_triggers(name) - let s:loaded[name] = 1 - endfor - call s:reorg_rtp() - - for name in a:names - let rtp = s:rtp(g:plugs[name]) - for dir in a:types - call s:source(rtp, dir.'/**/*.vim') - endfor - if a:0 - if !s:source(rtp, a:1) && !empty(s:glob(rtp, a:2)) - execute 'runtime' a:1 - endif - call s:source(rtp, a:2) - endif - call s:doautocmd('User', name) - endfor -endfunction - -function! s:lod_ft(pat, names) - let syn = 'syntax/'.a:pat.'.vim' - call s:lod(a:names, ['plugin', 'after/plugin'], syn, 'after/'.syn) - execute 'autocmd! PlugLOD FileType' a:pat - call s:doautocmd('filetypeplugin', 'FileType') - call s:doautocmd('filetypeindent', 'FileType') -endfunction - -function! s:lod_cmd(cmd, bang, l1, l2, args, names) - call s:lod(a:names, ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin']) - call s:dobufread(a:names) - execute printf('%s%s%s %s', (a:l1 == a:l2 ? '' : (a:l1.','.a:l2)), a:cmd, a:bang, a:args) -endfunction - -function! s:lod_map(map, names, with_prefix, prefix) - call s:lod(a:names, ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin']) - call s:dobufread(a:names) - let extra = '' - while 1 - let c = getchar(0) - if c == 0 - break - endif - let extra .= nr2char(c) - endwhile - - if a:with_prefix - let prefix = v:count ? v:count : '' - let prefix .= '"'.v:register.a:prefix - if mode(1) == 'no' - if v:operator == 'c' - let prefix = "\" . prefix - endif - let prefix .= v:operator - endif - call feedkeys(prefix, 'n') - endif - call feedkeys(substitute(a:map, '^', "\", '') . extra) -endfunction - -function! plug#(repo, ...) - if a:0 > 1 - return s:err('Invalid number of arguments (1..2)') - endif - - try - let repo = s:trim(a:repo) - let opts = a:0 == 1 ? s:parse_options(a:1) : s:base_spec - let name = get(opts, 'as', fnamemodify(repo, ':t:s?\.git$??')) - let spec = extend(s:infer_properties(name, repo), opts) - if !has_key(g:plugs, name) - call add(g:plugs_order, name) - endif - let g:plugs[name] = spec - let s:loaded[name] = get(s:loaded, name, 0) - catch - return s:err(v:exception) - endtry -endfunction - -function! s:parse_options(arg) - let opts = copy(s:base_spec) - let type = type(a:arg) - if type == s:TYPE.string - let opts.tag = a:arg - elseif type == s:TYPE.dict - call extend(opts, a:arg) - if has_key(opts, 'dir') - let opts.dir = s:dirpath(expand(opts.dir)) - endif - else - throw 'Invalid argument type (expected: string or dictionary)' - endif - return opts -endfunction - -function! s:infer_properties(name, repo) - let repo = a:repo - if s:is_local_plug(repo) - return { 'dir': s:dirpath(expand(repo)) } - else - if repo =~ ':' - let uri = repo - else - if repo !~ '/' - let repo = 'vim-scripts/'. 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([spec.dir, 'doc'], '/') - if isdirectory(docd) - silent! execute 'helptags' s:esc(docd) - endif - endfor - return 1 -endfunction - -function! s:syntax() - syntax clear - syntax region plug1 start=/\%1l/ end=/\%2l/ contains=plugNumber - syntax region plug2 start=/\%2l/ end=/\%3l/ contains=plugBracket,plugX - syn match plugNumber /[0-9]\+[0-9.]*/ contained - syn match plugBracket /[[\]]/ contained - syn match plugX /x/ contained - syn match plugDash /^-/ - syn match plugPlus /^+/ - syn match plugStar /^*/ - syn match plugMessage /\(^- \)\@<=.*/ - syn match plugName /\(^- \)\@<=[^ ]*:/ - syn match plugSha /\%(: \)\@<=[0-9a-f]\{4,}$/ - syn match plugTag /(tag: [^)]\+)/ - syn match plugInstall /\(^+ \)\@<=[^:]*/ - syn match plugUpdate /\(^* \)\@<=[^:]*/ - syn match plugCommit /^ \X*[0-9a-f]\{7,9} .*/ contains=plugRelDate,plugEdge,plugTag - syn match plugEdge /^ \X\+$/ - syn match plugEdge /^ \X*/ contained nextgroup=plugSha - syn match plugSha /[0-9a-f]\{7,9}/ contained - syn match plugRelDate /([^)]*)$/ contained - syn match plugNotLoaded /(not loaded)$/ - syn match plugError /^x.*/ - syn region plugDeleted start=/^\~ .*/ end=/^\ze\S/ - syn match plugH2 /^.*:\n-\+$/ - syn keyword Function PlugInstall PlugStatus PlugUpdate PlugClean - hi def link plug1 Title - hi def link plug2 Repeat - hi def link plugH2 Type - hi def link plugX Exception - hi def link plugBracket Structure - hi def link plugNumber Number - - hi def link plugDash Special - hi def link plugPlus Constant - hi def link plugStar Boolean - - hi def link plugMessage Function - hi def link plugName Label - hi def link plugInstall Function - hi def link plugUpdate Type - - hi def link plugError Error - hi def link plugDeleted Ignore - hi def link plugRelDate Comment - hi def link plugEdge PreProc - hi def link plugSha Identifier - hi def link plugTag Constant - - hi def link plugNotLoaded Comment -endfunction - -function! s:lpad(str, len) - return a:str . repeat(' ', a:len - len(a:str)) -endfunction - -function! s:lines(msg) - return split(a:msg, "[\r\n]") -endfunction - -function! s:lastline(msg) - return get(s:lines(a:msg), -1, '') -endfunction - -function! s:new_window() - execute get(g:, 'plug_window', 'vertical topleft new') -endfunction - -function! s:plug_window_exists() - let buflist = tabpagebuflist(s:plug_tab) - return !empty(buflist) && index(buflist, s:plug_buf) >= 0 -endfunction - -function! s:switch_in() - if !s:plug_window_exists() - return 0 - endif - - if winbufnr(0) != s:plug_buf - let s:pos = [tabpagenr(), winnr(), winsaveview()] - execute 'normal!' s:plug_tab.'gt' - let winnr = bufwinnr(s:plug_buf) - execute winnr.'wincmd w' - call add(s:pos, winsaveview()) - else - let s:pos = [winsaveview()] - endif - - setlocal modifiable - return 1 -endfunction - -function! s:switch_out(...) - call winrestview(s:pos[-1]) - setlocal nomodifiable - if a:0 > 0 - execute a:1 - endif - - if len(s:pos) > 1 - execute 'normal!' s:pos[0].'gt' - execute s:pos[1] 'wincmd w' - call winrestview(s:pos[2]) - endif -endfunction - -function! s:finish_bindings() - nnoremap R :call retry() - nnoremap D :PlugDiff - nnoremap S :PlugStatus - nnoremap U :call status_update() - xnoremap U :call status_update() - nnoremap ]] :silent! call section('') - nnoremap [[ :silent! call section('b') -endfunction - -function! s:prepare(...) - if empty(getcwd()) - throw 'Invalid current working directory. Cannot proceed.' - endif - - for evar in ['$GIT_DIR', '$GIT_WORK_TREE'] - if exists(evar) - throw evar.' detected. Cannot proceed.' - endif - endfor - - call s:job_abort() - if s:switch_in() - if b:plug_preview == 1 - pc - endif - enew - else - call s:new_window() - endif - - nnoremap q :if b:plug_preview==1pcendifbd - if a:0 == 0 - call s:finish_bindings() - endif - let b:plug_preview = -1 - let s:plug_tab = tabpagenr() - let s:plug_buf = winbufnr(0) - call s:assign_name() - - for k in ['', 'L', 'o', 'X', 'd', 'dd'] - execute 'silent! unmap ' k - endfor - setlocal buftype=nofile bufhidden=wipe nobuflisted nolist noswapfile nowrap cursorline modifiable nospell - setf vim-plug - if exists('g:syntax_on') - call s:syntax() - endif -endfunction - -function! s:assign_name() - " Assign buffer name - let prefix = '[Plugins]' - let name = prefix - let idx = 2 - while bufexists(name) - let name = printf('%s (%s)', prefix, idx) - let idx = idx + 1 - endwhile - silent! execute 'f' fnameescape(name) -endfunction - -function! s:chsh(swap) - let prev = [&shell, &shellredir] - if !s:is_win && a:swap - set shell=sh shellredir=>%s\ 2>&1 - endif - return prev -endfunction - -function! s:bang(cmd, ...) - try - let [sh, 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 - let g:_plug_bang = '!'.escape(cmd, '#!%') - execute "normal! :execute g:_plug_bang\\" - finally - unlet g:_plug_bang - let [&shell, &shellredir] = [sh, shrd] - endtry - return v:shell_error ? 'Exit status: ' . v:shell_error : '' -endfunction - -function! s:regress_bar() - let bar = substitute(getline(2)[1:-2], '.*\zs=', 'x', '') - call s:progress_bar(2, bar, len(bar)) -endfunction - -function! s:is_updated(dir) - return !empty(s:system_chomp('git log --pretty=format:"%h" "HEAD...HEAD@{1}"', a:dir)) -endfunction - -function! s:do(pull, force, todo) - for [name, spec] in items(a:todo) - if !isdirectory(spec.dir) - continue - endif - let installed = has_key(s:update.new, name) - let updated = installed ? 0 : - \ (a:pull && index(s:update.errors, name) < 0 && s:is_updated(spec.dir)) - if a:force || installed || updated - execute 'cd' s:esc(spec.dir) - call append(3, '- Post-update hook for '. name .' ... ') - let error = '' - let type = type(spec.do) - if type == s:TYPE.string - if spec.do[0] == ':' - if !get(s:loaded, name, 0) - let s:loaded[name] = 1 - call s:reorg_rtp() - endif - call s:load_plugin(spec) - try - execute spec.do[1:] - catch - let error = v:exception - endtry - if !s:plug_window_exists() - cd - - throw 'Warning: vim-plug was terminated by the post-update hook of '.name - endif - else - let error = s:bang(spec.do) - endif - elseif type == s:TYPE.funcref - try - let status = installed ? 'installed' : (updated ? 'updated' : 'unchanged') - call spec.do({ 'name': name, 'status': status, 'force': a:force }) - catch - let error = v:exception - endtry - else - let error = 'Invalid hook type' - endif - call s:switch_in() - call setline(4, empty(error) ? (getline(4) . 'OK') - \ : ('x' . getline(4)[1:] . error)) - if !empty(error) - call add(s:update.errors, name) - call s:regress_bar() - endif - cd - - endif - endfor -endfunction - -function! s:hash_match(a, b) - return stridx(a:a, a:b) == 0 || stridx(a:b, a:a) == 0 -endfunction - -function! s:checkout(spec) - let sha = a:spec.commit - let output = s:system('git rev-parse HEAD', a:spec.dir) - if !v:shell_error && !s:hash_match(sha, s:lines(output)[0]) - let output = s:system( - \ 'git fetch --depth 999999 && git checkout '.s:esc(sha), a:spec.dir) - endif - return output -endfunction - -function! s:finish(pull) - let new_frozen = len(filter(keys(s:update.new), 'g:plugs[v:val].frozen')) - if new_frozen - let s = new_frozen > 1 ? 's' : '' - call append(3, printf('- Installed %d frozen plugin%s', new_frozen, s)) - endif - call append(3, '- Finishing ... ') | 4 - redraw - call plug#helptags() - call plug#end() - call setline(4, getline(4) . 'Done!') - redraw - let msgs = [] - if !empty(s:update.errors) - call add(msgs, "Press 'R' to retry.") - endif - if a:pull && len(s:update.new) < len(filter(getline(5, '$'), - \ "v:val =~ '^- ' && stridx(v:val, 'Already up-to-date') < 0")) - call add(msgs, "Press 'D' to see the updated changes.") - endif - echo join(msgs, ' ') - call s:finish_bindings() -endfunction - -function! s:retry() - if empty(s:update.errors) - return - endif - echo - call s:update_impl(s:update.pull, s:update.force, - \ extend(copy(s:update.errors), [s:update.threads])) -endfunction - -function! s:is_managed(name) - return has_key(g:plugs[a:name], 'uri') -endfunction - -function! s:names(...) - return sort(filter(keys(g:plugs), 'stridx(v:val, a:1) == 0 && s:is_managed(v:val)')) -endfunction - -function! s:check_ruby() - silent! ruby require 'thread'; VIM::command("let g:plug_ruby = '#{RUBY_VERSION}'") - if !exists('g:plug_ruby') - redraw! - return s:warn('echom', 'Warning: Ruby interface is broken') - endif - let ruby_version = split(g:plug_ruby, '\.') - unlet g:plug_ruby - return s:version_requirement(ruby_version, [1, 8, 7]) -endfunction - -function! s:update_impl(pull, force, args) abort - let sync = index(a:args, '--sync') >= 0 || has('vim_starting') - let args = filter(copy(a:args), 'v:val != "--sync"') - let threads = (len(args) > 0 && args[-1] =~ '^[1-9][0-9]*$') ? - \ remove(args, -1) : get(g:, 'plug_threads', 16) - - let managed = filter(copy(g:plugs), 's:is_managed(v:key)') - let todo = empty(args) ? filter(managed, '!v:val.frozen || !isdirectory(v:val.dir)') : - \ filter(managed, 'index(args, v:key) >= 0') - - if empty(todo) - return s:warn('echo', 'No plugin to '. (a:pull ? 'update' : 'install')) - endif - - if !s:is_win && s:git_version_requirement(2, 3) - let s:git_terminal_prompt = exists('$GIT_TERMINAL_PROMPT') ? $GIT_TERMINAL_PROMPT : '' - let $GIT_TERMINAL_PROMPT = 0 - for plug in values(todo) - let plug.uri = substitute(plug.uri, - \ '^https://git::@github\.com', 'https://github.com', '') - endfor - endif - - if !isdirectory(g:plug_home) - try - call mkdir(g:plug_home, 'p') - catch - return s:err(printf('Invalid plug directory: %s. '. - \ 'Try to call plug#begin with a valid directory', g:plug_home)) - endtry - endif - - if has('nvim') && !exists('*jobwait') && threads > 1 - call s:warn('echom', '[vim-plug] Update Neovim for parallel installer') - endif - - let use_job = s:nvim || s:vim8 - let python = (has('python') || has('python3')) && !use_job - let ruby = has('ruby') && !use_job && (v:version >= 703 || v:version == 702 && has('patch374')) && !(s:is_win && has('gui_running')) && threads > 1 && s:check_ruby() - - let s:update = { - \ 'start': reltime(), - \ 'all': todo, - \ 'todo': copy(todo), - \ 'errors': [], - \ 'pull': a:pull, - \ 'force': a:force, - \ 'new': {}, - \ 'threads': (python || ruby || use_job) ? min([len(todo), threads]) : 1, - \ 'bar': '', - \ 'fin': 0 - \ } - - call s:prepare(1) - call append(0, ['', '']) - normal! 2G - silent! redraw - - let s:clone_opt = get(g:, 'plug_shallow', 1) ? - \ '--depth 1' . (s:git_version_requirement(1, 7, 10) ? ' --no-single-branch' : '') : '' - - " 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 '.string(tag).' --sort -version:refname 2>&1', spec.dir)) - if !v:shell_error && !empty(tags) - let tag = tags[0] - call s:log4(name, printf('Latest tag for %s -> %s', spec.tag, tag)) - call append(3, '') - endif - endif - call s:log4(name, 'Checking out '.tag) - let out = s:system('git checkout -q '.s:esc(tag).' 2>&1', spec.dir) - else - let branch = s:esc(get(spec, 'branch', 'master')) - call s:log4(name, 'Merging origin/'.branch) - let out = s:system('git checkout -q '.branch.' 2>&1' - \. (has_key(s:update.new, name) ? '' : ('&& git merge --ff-only origin/'.branch.' 2>&1')), spec.dir) - endif - if !v:shell_error && filereadable(spec.dir.'/.gitmodules') && - \ (s:update.force || has_key(s:update.new, name) || s:is_updated(spec.dir)) - call s:log4(name, 'Updating submodules. This may take a while.') - let out .= s:bang('git submodule update --init --recursive 2>&1', spec.dir) - endif - let msg = s:format_message(v:shell_error ? 'x': '-', name, out) - if v:shell_error - call add(s:update.errors, name) - call s:regress_bar() - silent execute pos 'd _' - call append(4, msg) | 4 - elseif !empty(out) - call setline(pos, msg[0]) - endif - redraw - endfor - silent 4 d _ - try - call s:do(s:update.pull, s:update.force, filter(copy(s:update.all), 'index(s:update.errors, v:key) < 0 && has_key(v:val, "do")')) - catch - call s:warn('echom', v:exception) - call s:warn('echo', '') - return - endtry - call s:finish(s:update.pull) - call setline(1, 'Updated. Elapsed time: ' . split(reltimestr(reltime(s:update.start)))[0] . ' sec.') - call s:switch_out('normal! gg') - endif -endfunction - -function! s:job_abort() - if (!s:nvim && !s:vim8) || !exists('s:jobs') - return - endif - - for [name, j] in items(s:jobs) - if s:nvim - silent! call jobstop(j.jobid) - elseif s:vim8 - silent! call job_stop(j.jobid) - endif - if j.new - call s:system('rm -rf ' . s:shellesc(g:plugs[name].dir)) - endif - endfor - let s:jobs = {} -endfunction - -function! s:last_non_empty_line(lines) - let len = len(a:lines) - for idx in range(len) - let line = a:lines[len-idx-1] - if !empty(line) - return line - endif - endfor - return '' -endfunction - -function! s:job_out_cb(self, data) abort - let self = a:self - let data = remove(self.lines, -1) . a:data - let lines = map(split(data, "\n", 1), 'split(v:val, "\r", 1)[-1]') - call extend(self.lines, lines) - " To reduce the number of buffer updates - let self.tick = get(self, 'tick', -1) + 1 - if !self.running || self.tick % len(s:jobs) == 0 - let bullet = self.running ? (self.new ? '+' : '*') : (self.error ? 'x' : '-') - let result = self.error ? join(self.lines, "\n") : s:last_non_empty_line(self.lines) - call s:log(bullet, self.name, result) - endif -endfunction - -function! s:job_exit_cb(self, data) abort - let a:self.running = 0 - let a:self.error = a:data != 0 - call s:reap(a:self.name) - call s:tick() -endfunction - -function! s:job_cb(fn, job, ch, data) - if !s:plug_window_exists() " plug window closed - return s:job_abort() - endif - call call(a:fn, [a:job, a:data]) -endfunction - -function! s:nvim_cb(job_id, data, event) dict abort - return a:event == 'stdout' ? - \ s:job_cb('s:job_out_cb', self, 0, join(a:data, "\n")) : - \ s:job_cb('s:job_exit_cb', self, 0, a:data) -endfunction - -function! s:spawn(name, cmd, opts) - let job = { 'name': a:name, 'running': 1, 'error': 0, 'lines': [''], - \ 'new': get(a:opts, 'new', 0) } - let s:jobs[a:name] = job - let argv = add(s:is_win ? ['cmd', '/c'] : ['sh', '-c'], - \ has_key(a:opts, 'dir') ? s:with_cd(a:cmd, a:opts.dir) : a:cmd) - - if s:nvim - call extend(job, { - \ 'on_stdout': function('s:nvim_cb'), - \ 'on_exit': function('s:nvim_cb'), - \ }) - let jid = jobstart(argv, job) - if jid > 0 - let job.jobid = jid - else - let job.running = 0 - let job.error = 1 - let job.lines = [jid < 0 ? argv[0].' is not executable' : - \ 'Invalid arguments (or job table is full)'] - endif - elseif s:vim8 - let jid = job_start(s:is_win ? join(argv, ' ') : argv, { - \ 'out_cb': function('s:job_cb', ['s:job_out_cb', job]), - \ 'exit_cb': function('s:job_cb', ['s:job_exit_cb', job]), - \ 'out_mode': 'raw' - \}) - if job_status(jid) == 'run' - let job.jobid = jid - else - let job.running = 0 - let job.error = 1 - let job.lines = ['Failed to start job'] - endif - else - let params = has_key(a:opts, 'dir') ? [a:cmd, a:opts.dir] : [a:cmd] - let job.lines = s:lines(call('s:system', params)) - 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) - for i in range(4, line('$')) - if getline(i) =~# '^[-+x*] '.a:name.':' - for j in range(i + 1, line('$')) - if getline(j) !~ '^ ' - return [i, j - 1] - endif - endfor - return [i, i] - endif - endfor - return [0, 0] -endfunction - -function! s:log(bullet, name, lines) - if s:switch_in() - let [b, e] = s:logpos(a:name) - if b > 0 - silent execute printf('%d,%d d _', b, e) - if b > winheight('.') - let b = 4 - endif - else - let b = 4 - endif - " FIXME For some reason, nomodifiable is set after :d in vim8 - setlocal modifiable - call append(b - 1, s:format_message(a:bullet, a:name, a:lines)) - call s:switch_out() - endif -endfunction - -function! s:update_vim() - let s:jobs = {} - - call s:bar() - call s:tick() -endfunction - -function! s:tick() - let pull = s:update.pull - let prog = s:progress_opt(s:nvim || s:vim8) -while 1 " Without TCO, Vim stack is bound to explode - if empty(s:update.todo) - if empty(s:jobs) && !s:update.fin - call s:update_finish() - let s:update.fin = 1 - endif - return - endif - - let name = keys(s:update.todo)[0] - let spec = remove(s:update.todo, name) - let new = !isdirectory(spec.dir) - - call s:log(new ? '+' : '*', name, pull ? 'Updating ...' : 'Installing ...') - redraw - - let has_tag = has_key(spec, 'tag') - if !new - let [error, _] = s:git_validate(spec, 0) - if empty(error) - if pull - let fetch_opt = (has_tag && !empty(globpath(spec.dir, '.git/shallow'))) ? '--depth 99999999' : '' - call s:spawn(name, printf('git fetch %s %s 2>&1', fetch_opt, prog), { 'dir': spec.dir }) - else - let s:jobs[name] = { 'running': 0, 'lines': ['Already installed'], 'error': 0 } - endif - else - let s:jobs[name] = { 'running': 0, 'lines': s:lines(error), 'error': 1 } - endif - else - call s:spawn(name, - \ printf('git clone %s %s %s %s 2>&1', - \ has_tag ? '' : s:clone_opt, - \ prog, - \ s:shellesc(spec.uri), - \ s:shellesc(s:trim(spec.dir))), { 'new': 1 }) - endif - - if !s:jobs[name].running - call s:reap(name) - endif - if len(s:jobs) >= s:update.threads - break - endif -endwhile -endfunction - -function! s:update_python() -let py_exe = has('python') ? 'python' : 'python3' -execute py_exe "<< EOF" -import datetime -import functools -import os -try: - import queue -except ImportError: - import Queue as queue -import random -import re -import shutil -import signal -import subprocess -import tempfile -import threading as thr -import time -import traceback -import vim - -G_NVIM = vim.eval("has('nvim')") == '1' -G_PULL = vim.eval('s:update.pull') == '1' -G_RETRIES = int(vim.eval('get(g:, "plug_retries", 2)')) + 1 -G_TIMEOUT = int(vim.eval('get(g:, "plug_timeout", 60)')) -G_CLONE_OPT = vim.eval('s:clone_opt') -G_PROGRESS = vim.eval('s:progress_opt(1)') -G_LOG_PROB = 1.0 / int(vim.eval('s:update.threads')) -G_STOP = thr.Event() -G_IS_WIN = vim.eval('s:is_win') == '1' - -class PlugError(Exception): - def __init__(self, msg): - self.msg = msg -class CmdTimedOut(PlugError): - pass -class CmdFailed(PlugError): - pass -class InvalidURI(PlugError): - pass -class Action(object): - INSTALL, UPDATE, ERROR, DONE = ['+', '*', 'x', '-'] - -class Buffer(object): - def __init__(self, lock, num_plugs, is_pull): - self.bar = '' - self.event = 'Updating' if is_pull else 'Installing' - self.lock = lock - self.maxy = int(vim.eval('winheight(".")')) - self.num_plugs = num_plugs - - def __where(self, name): - """ Find first line with name in current buffer. Return line num. """ - found, lnum = False, 0 - matcher = re.compile('^[-+x*] {0}:'.format(name)) - for line in vim.current.buffer: - if matcher.search(line) is not None: - found = True - break - lnum += 1 - - if not found: - lnum = -1 - return lnum - - def header(self): - curbuf = vim.current.buffer - curbuf[0] = self.event + ' plugins ({0}/{1})'.format(len(self.bar), self.num_plugs) - - num_spaces = self.num_plugs - len(self.bar) - curbuf[1] = '[{0}{1}]'.format(self.bar, num_spaces * ' ') - - with self.lock: - vim.command('normal! 2G') - vim.command('redraw') - - def write(self, action, name, lines): - first, rest = lines[0], lines[1:] - msg = ['{0} {1}{2}{3}'.format(action, name, ': ' if first else '', first)] - msg.extend([' ' + line for line in rest]) - - try: - if action == Action.ERROR: - self.bar += 'x' - vim.command("call add(s:update.errors, '{0}')".format(name)) - elif action == Action.DONE: - self.bar += '=' - - curbuf = vim.current.buffer - lnum = self.__where(name) - if lnum != -1: # Found matching line num - del curbuf[lnum] - if lnum > self.maxy and action in set([Action.INSTALL, Action.UPDATE]): - lnum = 3 - else: - lnum = 3 - curbuf.append(msg, lnum) - - self.header() - except vim.error: - pass - -class Command(object): - CD = 'cd /d' if G_IS_WIN else 'cd' - - def __init__(self, cmd, cmd_dir=None, timeout=60, cb=None, clean=None): - self.cmd = cmd - if cmd_dir: - self.cmd = '{0} {1} && {2}'.format(Command.CD, cmd_dir, self.cmd) - self.timeout = timeout - self.callback = cb if cb else (lambda msg: None) - self.clean = clean if clean else (lambda: None) - self.proc = None - - @property - def alive(self): - """ Returns true only if command still running. """ - return self.proc and self.proc.poll() is None - - def execute(self, ntries=3): - """ Execute the command with ntries if CmdTimedOut. - Returns the output of the command if no Exception. - """ - attempt, finished, limit = 0, False, self.timeout - - while not finished: - try: - attempt += 1 - result = self.try_command() - finished = True - return result - except CmdTimedOut: - if attempt != ntries: - self.notify_retry() - self.timeout += limit - else: - raise - - def notify_retry(self): - """ Retry required for command, notify user. """ - for count in range(3, 0, -1): - if G_STOP.is_set(): - raise KeyboardInterrupt - msg = 'Timeout. Will retry in {0} second{1} ...'.format( - count, 's' if count != 1 else '') - self.callback([msg]) - time.sleep(1) - self.callback(['Retrying ...']) - - def try_command(self): - """ Execute a cmd & poll for callback. Returns list of output. - Raises CmdFailed -> return code for Popen isn't 0 - Raises CmdTimedOut -> command exceeded timeout without new output - """ - first_line = True - - try: - tfile = tempfile.NamedTemporaryFile(mode='w+b') - preexec_fn = not G_IS_WIN and os.setsid or None - self.proc = subprocess.Popen(self.cmd, stdout=tfile, - stderr=subprocess.STDOUT, - stdin=subprocess.PIPE, shell=True, - preexec_fn=preexec_fn) - thrd = thr.Thread(target=(lambda proc: proc.wait()), args=(self.proc,)) - thrd.start() - - thread_not_started = True - while thread_not_started: - try: - thrd.join(0.1) - thread_not_started = False - except RuntimeError: - pass - - while self.alive: - if G_STOP.is_set(): - raise KeyboardInterrupt - - if first_line or random.random() < G_LOG_PROB: - first_line = False - line = '' if G_IS_WIN else nonblock_read(tfile.name) - if line: - self.callback([line]) - - time_diff = time.time() - os.path.getmtime(tfile.name) - if time_diff > self.timeout: - raise CmdTimedOut(['Timeout!']) - - thrd.join(0.5) - - tfile.seek(0) - result = [line.decode('utf-8', 'replace').rstrip() for line in tfile] - - if self.proc.returncode != 0: - raise CmdFailed([''] + result) - - return result - except: - self.terminate() - raise - - def terminate(self): - """ Terminate process and cleanup. """ - if self.alive: - if G_IS_WIN: - os.kill(self.proc.pid, signal.SIGINT) - else: - os.killpg(self.proc.pid, signal.SIGTERM) - self.clean() - -class Plugin(object): - def __init__(self, name, args, buf_q, lock): - self.name = name - self.args = args - self.buf_q = buf_q - self.lock = lock - self.tag = args.get('tag', 0) - - def manage(self): - try: - if os.path.exists(self.args['dir']): - self.update() - else: - self.install() - with self.lock: - thread_vim_command("let s:update.new['{0}'] = 1".format(self.name)) - except PlugError as exc: - self.write(Action.ERROR, self.name, exc.msg) - except KeyboardInterrupt: - G_STOP.set() - self.write(Action.ERROR, self.name, ['Interrupted!']) - except: - # Any exception except those above print stack trace - msg = 'Trace:\n{0}'.format(traceback.format_exc().rstrip()) - self.write(Action.ERROR, self.name, msg.split('\n')) - raise - - def install(self): - target = self.args['dir'] - if target[-1] == '\\': - target = target[0:-1] - - def clean(target): - def _clean(): - try: - shutil.rmtree(target) - except OSError: - pass - return _clean - - self.write(Action.INSTALL, self.name, ['Installing ...']) - callback = functools.partial(self.write, Action.INSTALL, self.name) - cmd = 'git clone {0} {1} {2} {3} 2>&1'.format( - '' if self.tag else G_CLONE_OPT, G_PROGRESS, self.args['uri'], - esc(target)) - com = Command(cmd, None, G_TIMEOUT, callback, clean(target)) - result = com.execute(G_RETRIES) - self.write(Action.DONE, self.name, result[-1:]) - - def repo_uri(self): - cmd = 'git rev-parse --abbrev-ref HEAD 2>&1 && git config -f .git/config remote.origin.url' - command = Command(cmd, self.args['dir'], G_TIMEOUT,) - result = command.execute(G_RETRIES) - return result[-1] - - def update(self): - actual_uri = self.repo_uri() - expect_uri = self.args['uri'] - regex = re.compile(r'^(?:\w+://)?(?:[^@/]*@)?([^:/]*(?::[0-9]*)?)[:/](.*?)(?:\.git)?/?$') - ma = regex.match(actual_uri) - mb = regex.match(expect_uri) - if ma is None or mb is None or ma.groups() != mb.groups(): - msg = ['', - 'Invalid URI: {0}'.format(actual_uri), - 'Expected {0}'.format(expect_uri), - 'PlugClean required.'] - raise InvalidURI(msg) - - if G_PULL: - self.write(Action.UPDATE, self.name, ['Updating ...']) - callback = functools.partial(self.write, Action.UPDATE, self.name) - fetch_opt = '--depth 99999999' if self.tag and os.path.isfile(os.path.join(self.args['dir'], '.git/shallow')) else '' - cmd = 'git fetch {0} {1} 2>&1'.format(fetch_opt, G_PROGRESS) - com = Command(cmd, self.args['dir'], G_TIMEOUT, callback) - result = com.execute(G_RETRIES) - self.write(Action.DONE, self.name, result[-1:]) - else: - self.write(Action.DONE, self.name, ['Already installed']) - - def write(self, action, name, msg): - self.buf_q.put((action, name, msg)) - -class PlugThread(thr.Thread): - def __init__(self, tname, args): - super(PlugThread, self).__init__() - self.tname = tname - self.args = args - - def run(self): - thr.current_thread().name = self.tname - buf_q, work_q, lock = self.args - - try: - while not G_STOP.is_set(): - name, args = work_q.get_nowait() - plug = Plugin(name, args, buf_q, lock) - plug.manage() - work_q.task_done() - except queue.Empty: - pass - -class RefreshThread(thr.Thread): - def __init__(self, lock): - super(RefreshThread, self).__init__() - self.lock = lock - self.running = True - - def run(self): - while self.running: - with self.lock: - thread_vim_command('noautocmd normal! a') - time.sleep(0.33) - - def stop(self): - self.running = False - -if G_NVIM: - def thread_vim_command(cmd): - vim.session.threadsafe_call(lambda: vim.command(cmd)) -else: - def thread_vim_command(cmd): - vim.command(cmd) - -def esc(name): - return '"' + name.replace('"', '\"') + '"' - -def nonblock_read(fname): - """ Read a file with nonblock flag. Return the last line. """ - fread = os.open(fname, os.O_RDONLY | os.O_NONBLOCK) - buf = os.read(fread, 100000).decode('utf-8', 'replace') - os.close(fread) - - line = buf.rstrip('\r\n') - left = max(line.rfind('\r'), line.rfind('\n')) - if left != -1: - left += 1 - line = line[left:] - - return line - -def main(): - thr.current_thread().name = 'main' - nthreads = int(vim.eval('s:update.threads')) - plugs = vim.eval('s:update.todo') - mac_gui = vim.eval('s:mac_gui') == '1' - - lock = thr.Lock() - buf = Buffer(lock, len(plugs), G_PULL) - buf_q, work_q = queue.Queue(), queue.Queue() - for work in plugs.items(): - work_q.put(work) - - start_cnt = thr.active_count() - for num in range(nthreads): - tname = 'PlugT-{0:02}'.format(num) - thread = PlugThread(tname, (buf_q, work_q, lock)) - thread.start() - if mac_gui: - rthread = RefreshThread(lock) - rthread.start() - - while not buf_q.empty() or thr.active_count() != start_cnt: - try: - action, name, msg = buf_q.get(True, 0.25) - buf.write(action, name, ['OK'] if not msg else msg) - buf_q.task_done() - except queue.Empty: - pass - except KeyboardInterrupt: - G_STOP.set() - - if mac_gui: - rthread.stop() - rthread.join() - -main() -EOF -endfunction - -function! s:update_ruby() - ruby << EOF - module PlugStream - SEP = ["\r", "\n", nil] - def get_line - buffer = '' - loop do - char = readchar rescue return - if SEP.include? char.chr - buffer << $/ - break - else - buffer << char - end - end - buffer - end - end unless defined?(PlugStream) - - def esc arg - %["#{arg.gsub('"', '\"')}"] - end - - def killall pid - pids = [pid] - if /mswin|mingw|bccwin/ =~ RUBY_PLATFORM - pids.each { |pid| Process.kill 'INT', pid.to_i rescue nil } - else - unless `which pgrep 2> /dev/null`.empty? - children = pids - until children.empty? - children = children.map { |pid| - `pgrep -P #{pid}`.lines.map { |l| l.chomp } - }.flatten - pids += children - end - end - pids.each { |pid| Process.kill 'TERM', pid.to_i rescue nil } - end - end - - def compare_git_uri a, b - regex = %r{^(?:\w+://)?(?:[^@/]*@)?([^:/]*(?::[0-9]*)?)[:/](.*?)(?:\.git)?/?$} - regex.match(a).to_a.drop(1) == regex.match(b).to_a.drop(1) - end - - require 'thread' - require 'fileutils' - require 'timeout' - running = true - iswin = VIM::evaluate('s:is_win').to_i == 1 - pull = VIM::evaluate('s:update.pull').to_i == 1 - base = VIM::evaluate('g:plug_home') - all = VIM::evaluate('s:update.todo') - limit = VIM::evaluate('get(g:, "plug_timeout", 60)') - tries = VIM::evaluate('get(g:, "plug_retries", 2)') + 1 - nthr = VIM::evaluate('s:update.threads').to_i - maxy = VIM::evaluate('winheight(".")').to_i - vim7 = VIM::evaluate('v:version').to_i <= 703 && RUBY_PLATFORM =~ /darwin/ - cd = iswin ? 'cd /d' : 'cd' - tot = VIM::evaluate('len(s:update.todo)') || 0 - bar = '' - skip = 'Already installed' - mtx = Mutex.new - take1 = proc { mtx.synchronize { running && all.shift } } - logh = proc { - cnt = bar.length - $curbuf[1] = "#{pull ? 'Updating' : 'Installing'} plugins (#{cnt}/#{tot})" - $curbuf[2] = '[' + bar.ljust(tot) + ']' - VIM::command('normal! 2G') - VIM::command('redraw') - } - where = proc { |name| (1..($curbuf.length)).find { |l| $curbuf[l] =~ /^[-+x*] #{name}:/ } } - log = proc { |name, result, type| - mtx.synchronize do - ing = ![true, false].include?(type) - bar += type ? '=' : 'x' unless ing - b = case type - when :install then '+' when :update then '*' - when true, nil then '-' else - VIM::command("call add(s:update.errors, '#{name}')") - 'x' - end - result = - if type || type.nil? - ["#{b} #{name}: #{result.lines.to_a.last || 'OK'}"] - elsif result =~ /^Interrupted|^Timeout/ - ["#{b} #{name}: #{result}"] - else - ["#{b} #{name}"] + result.lines.map { |l| " " << l } - end - if lnum = where.call(name) - $curbuf.delete lnum - lnum = 4 if ing && lnum > maxy - end - result.each_with_index do |line, offset| - $curbuf.append((lnum || 4) - 1 + offset, line.gsub(/\e\[./, '').chomp) - end - logh.call - end - } - bt = proc { |cmd, name, type, cleanup| - tried = timeout = 0 - begin - tried += 1 - timeout += limit - fd = nil - data = '' - if iswin - Timeout::timeout(timeout) do - tmp = VIM::evaluate('tempname()') - system("(#{cmd}) > #{tmp}") - data = File.read(tmp).chomp - File.unlink tmp rescue nil - end - else - fd = IO.popen(cmd).extend(PlugStream) - first_line = true - log_prob = 1.0 / nthr - while line = Timeout::timeout(timeout) { fd.get_line } - data << line - log.call name, line.chomp, type if name && (first_line || rand < log_prob) - first_line = false - end - fd.close - end - [$? == 0, data.chomp] - rescue Timeout::Error, Interrupt => e - if fd && !fd.closed? - killall fd.pid - fd.close - end - cleanup.call if cleanup - if e.is_a?(Timeout::Error) && tried < tries - 3.downto(1) do |countdown| - s = countdown > 1 ? 's' : '' - log.call name, "Timeout. Will retry in #{countdown} second#{s} ...", type - sleep 1 - end - log.call name, 'Retrying ...', type - retry - end - [false, e.is_a?(Interrupt) ? "Interrupted!" : "Timeout!"] - end - } - main = Thread.current - threads = [] - watcher = Thread.new { - if vim7 - while VIM::evaluate('getchar(1)') - sleep 0.1 - end - else - require 'io/console' # >= Ruby 1.9 - nil until IO.console.getch == 3.chr - end - mtx.synchronize do - running = false - threads.each { |t| t.raise Interrupt } unless vim7 - end - threads.each { |t| t.join rescue nil } - main.kill - } - refresh = Thread.new { - while true - mtx.synchronize do - break unless running - VIM::command('noautocmd normal! a') - end - sleep 0.2 - end - } if VIM::evaluate('s:mac_gui') == 1 - - clone_opt = VIM::evaluate('s:clone_opt') - progress = VIM::evaluate('s:progress_opt(1)') - nthr.times do - mtx.synchronize do - threads << Thread.new { - while pair = take1.call - name = pair.first - dir, uri, tag = pair.last.values_at *%w[dir uri tag] - exists = File.directory? dir - ok, result = - if exists - chdir = "#{cd} #{iswin ? dir : esc(dir)}" - ret, data = bt.call "#{chdir} && git rev-parse --abbrev-ref HEAD 2>&1 && git config -f .git/config remote.origin.url", nil, nil, nil - current_uri = data.lines.to_a.last - if !ret - if data =~ /^Interrupted|^Timeout/ - [false, data] - else - [false, [data.chomp, "PlugClean required."].join($/)] - end - elsif !compare_git_uri(current_uri, uri) - [false, ["Invalid URI: #{current_uri}", - "Expected: #{uri}", - "PlugClean required."].join($/)] - else - if pull - log.call name, 'Updating ...', :update - fetch_opt = (tag && File.exist?(File.join(dir, '.git/shallow'))) ? '--depth 99999999' : '' - bt.call "#{chdir} && git fetch #{fetch_opt} #{progress} 2>&1", name, :update, nil - else - [true, skip] - end - end - else - d = esc dir.sub(%r{[\\/]+$}, '') - log.call name, 'Installing ...', :install - bt.call "git clone #{clone_opt unless tag} #{progress} #{uri} #{d} 2>&1", name, :install, proc { - FileUtils.rm_rf dir - } - end - mtx.synchronize { VIM::command("let s:update.new['#{name}'] = 1") } if !exists && ok - log.call name, result, ok - end - } if running - end - end - threads.each { |t| t.join rescue nil } - logh.call - refresh.kill if refresh - watcher.kill -EOF -endfunction - -function! s:shellesc(arg) - return '"'.escape(a:arg, '"').'"' -endfunction - -function! s:glob_dir(path) - return map(filter(s:glob(a:path, '**'), 'isdirectory(v:val)'), 's:dirpath(v:val)') -endfunction - -function! s:progress_bar(line, bar, total) - call setline(a:line, '[' . s:lpad(a:bar, a:total) . ']') -endfunction - -function! s:compare_git_uri(a, b) - " See `git help clone' - " https:// [user@] github.com[:port] / junegunn/vim-plug [.git] - " [git@] github.com[:port] : junegunn/vim-plug [.git] - " file:// / junegunn/vim-plug [/] - " / junegunn/vim-plug [/] - let pat = '^\%(\w\+://\)\='.'\%([^@/]*@\)\='.'\([^:/]*\%(:[0-9]*\)\=\)'.'[:/]'.'\(.\{-}\)'.'\%(\.git\)\=/\?$' - let ma = matchlist(a:a, pat) - let mb = matchlist(a:b, pat) - return ma[1:2] ==# mb[1:2] -endfunction - -function! s:format_message(bullet, name, message) - if a:bullet != 'x' - return [printf('%s %s: %s', a:bullet, a:name, s:lastline(a:message))] - else - let lines = map(s:lines(a:message), '" ".v:val') - return extend([printf('x %s:', a:name)], lines) - endif -endfunction - -function! s:with_cd(cmd, dir) - return printf('cd%s %s && %s', s:is_win ? ' /d' : '', s:shellesc(a:dir), a:cmd) -endfunction - -function! s:system(cmd, ...) - try - let [sh, shrd] = s:chsh(1) - let cmd = a:0 > 0 ? s:with_cd(a:cmd, a:1) : a:cmd - return system(s:is_win ? '('.cmd.')' : cmd) - finally - let [&shell, &shellredir] = [sh, shrd] - endtry -endfunction - -function! s:system_chomp(...) - let ret = call('s:system', a:000) - return v:shell_error ? '' : substitute(ret, '\n$', '', '') -endfunction - -function! s:git_validate(spec, check_branch) - let err = '' - if isdirectory(a:spec.dir) - let result = s:lines(s:system('git rev-parse --abbrev-ref HEAD 2>&1 && git config -f .git/config remote.origin.url', a:spec.dir)) - let remote = result[-1] - if v:shell_error - let err = join([remote, 'PlugClean required.'], "\n") - elseif !s:compare_git_uri(remote, a:spec.uri) - let err = join(['Invalid URI: '.remote, - \ 'Expected: '.a:spec.uri, - \ 'PlugClean required.'], "\n") - elseif a:check_branch && has_key(a:spec, 'commit') - let result = s:lines(s:system('git rev-parse HEAD 2>&1', a:spec.dir)) - let sha = result[-1] - if v:shell_error - let err = join(add(result, 'PlugClean required.'), "\n") - elseif !s:hash_match(sha, a:spec.commit) - let err = join([printf('Invalid HEAD (expected: %s, actual: %s)', - \ a:spec.commit[:6], sha[:6]), - \ 'PlugUpdate required.'], "\n") - endif - elseif a:check_branch - let branch = result[0] - " Check tag - if has_key(a:spec, 'tag') - let tag = s:system_chomp('git describe --exact-match --tags HEAD 2>&1', a:spec.dir) - if a:spec.tag !=# tag - let err = printf('Invalid tag: %s (expected: %s). Try PlugUpdate.', - \ (empty(tag) ? 'N/A' : tag), a:spec.tag) - endif - " Check branch - elseif a:spec.branch !=# branch - let err = printf('Invalid branch: %s (expected: %s). Try PlugUpdate.', - \ branch, a:spec.branch) - endif - if empty(err) - let [ahead, behind] = split(s:lastline(s:system(printf( - \ 'git rev-list --count --left-right HEAD...origin/%s', - \ a:spec.branch), a:spec.dir)), '\t') - if !v:shell_error && ahead - if behind - " Only mention PlugClean if diverged, otherwise it's likely to be - " pushable (and probably not that messed up). - let err = printf( - \ "Diverged from origin/%s (%d commit(s) ahead and %d commit(s) behind!\n" - \ .'Backup local changes and run PlugClean and PlugUpdate to reinstall it.', a:spec.branch, ahead, behind) - else - let err = printf("Ahead of origin/%s by %d commit(s).\n" - \ .'Cannot update until local changes are pushed.', - \ a:spec.branch, ahead) - endif - endif - endif - endif - else - let err = 'Not found' - endif - return [err, err =~# 'PlugClean'] -endfunction - -function! s:rm_rf(dir) - if isdirectory(a:dir) - call s:system((s:is_win ? 'rmdir /S /Q ' : 'rm -rf ') . s:shellesc(a:dir)) - endif -endfunction - -function! s:clean(force) - call s:prepare() - call append(0, 'Searching for invalid plugins in '.g:plug_home) - call append(1, '') - - " List of valid directories - let dirs = [] - let errs = {} - let [cnt, total] = [0, len(g:plugs)] - for [name, spec] in items(g:plugs) - if !s:is_managed(name) - call add(dirs, spec.dir) - else - let [err, clean] = s:git_validate(spec, 1) - if clean - let errs[spec.dir] = s:lines(err)[0] - else - call add(dirs, spec.dir) - endif - endif - let cnt += 1 - call s:progress_bar(2, repeat('=', cnt), total) - normal! 2G - redraw - endfor - - let allowed = {} - for dir in dirs - let allowed[s:dirpath(fnamemodify(dir, ':h:h'))] = 1 - let allowed[dir] = 1 - for child in s:glob_dir(dir) - let allowed[child] = 1 - endfor - endfor - - let todo = [] - let found = sort(s:glob_dir(g:plug_home)) - while !empty(found) - let f = remove(found, 0) - if !has_key(allowed, f) && isdirectory(f) - call add(todo, f) - call append(line('$'), '- ' . f) - if has_key(errs, f) - call append(line('$'), ' ' . errs[f]) - endif - let found = filter(found, 'stridx(v:val, f) != 0') - end - endwhile - - 4 - redraw - if empty(todo) - call append(line('$'), 'Already clean.') - else - let s:clean_count = 0 - call append(3, ['Directories to delete:', '']) - redraw! - if a:force || s:ask_no_interrupt('Delete all directories?') - call s:delete([6, line('$')], 1) - else - call setline(4, 'Cancelled.') - nnoremap d :set opfunc=delete_opg@ - nmap dd d_ - xnoremap d :call delete_op(visualmode(), 1) - echo 'Delete the lines (d{motion}) to delete the corresponding directories' - endif - endif - 4 - setlocal nomodifiable -endfunction - -function! s:delete_op(type, ...) - call s:delete(a:0 ? [line("'<"), line("'>")] : [line("'["), line("']")], 0) -endfunction - -function! s:delete(range, force) - let [l1, l2] = a:range - let force = a:force - while l1 <= l2 - let line = getline(l1) - if line =~ '^- ' && isdirectory(line[2:]) - execute l1 - redraw! - let answer = force ? 1 : s:ask('Delete '.line[2:].'?', 1) - let force = force || answer > 1 - if answer - call s:rm_rf(line[2:]) - setlocal modifiable - call setline(l1, '~'.line[1:]) - let s:clean_count += 1 - call setline(4, printf('Removed %d directories.', s:clean_count)) - setlocal nomodifiable - endif - endif - let l1 += 1 - endwhile -endfunction - -function! s:upgrade() - echo 'Downloading the latest version of vim-plug' - redraw - let tmp = tempname() - let new = tmp . '/plug.vim' - - try - let out = s:system(printf('git clone --depth 1 %s %s', s:plug_src, tmp)) - if v:shell_error - return s:err('Error upgrading vim-plug: '. out) - endif - - if readfile(s:me) ==# readfile(new) - echo 'vim-plug is already up-to-date' - return 0 - else - call rename(s:me, s:me . '.old') - call rename(new, s:me) - unlet g:loaded_plug - echo 'vim-plug has been upgraded' - return 1 - endif - finally - silent! call s:rm_rf(tmp) - endtry -endfunction - -function! s:upgrade_specs() - for spec in values(g:plugs) - let spec.frozen = get(spec, 'frozen', 0) - endfor -endfunction - -function! s:status() - call s:prepare() - call append(0, 'Checking plugins') - call append(1, '') - - let ecnt = 0 - let unloaded = 0 - let [cnt, total] = [0, len(g:plugs)] - for [name, spec] in items(g:plugs) - if has_key(spec, 'uri') - if isdirectory(spec.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 isdirectory(spec.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 valid && get(s:loaded, name, -1) == 0 - let unloaded = 1 - let msg .= ' (not loaded)' - endif - call s:progress_bar(2, repeat('=', cnt), total) - call append(3, s:format_message(valid ? '-' : 'x', name, msg)) - normal! 2G - redraw - endfor - call setline(1, 'Finished. '.ecnt.' error(s).') - normal! gg - setlocal nomodifiable - if unloaded - echo "Press 'L' on each line to load plugin, or 'U' to update" - nnoremap L :call status_load(line('.')) - xnoremap L :call status_load(line('.')) - end -endfunction - -function! s:extract_name(str, prefix, suffix) - return matchstr(a:str, '^'.a:prefix.' \zs[^:]\+\ze:.*'.a:suffix.'$') -endfunction - -function! s:status_load(lnum) - let line = getline(a:lnum) - let name = s:extract_name(line, '-', '(not loaded)') - if !empty(name) - call plug#load(name) - setlocal modifiable - call setline(a:lnum, substitute(line, ' (not loaded)$', '', '')) - setlocal nomodifiable - endif -endfunction - -function! s:status_update() range - let lines = getline(a:firstline, a:lastline) - let names = filter(map(lines, 's:extract_name(v:val, "[x-]", "")'), '!empty(v:val)') - if !empty(names) - echo - execute 'PlugUpdate' join(names) - endif -endfunction - -function! s:is_preview_window_open() - silent! wincmd P - if &previewwindow - wincmd p - return 1 - endif -endfunction - -function! s:find_name(lnum) - for lnum in reverse(range(1, a:lnum)) - let line = getline(lnum) - if empty(line) - return '' - endif - let name = s:extract_name(line, '-', '') - if !empty(name) - return name - endif - endfor - return '' -endfunction - -function! s:preview_commit() - if b:plug_preview < 0 - let b:plug_preview = !s:is_preview_window_open() - endif - - let sha = matchstr(getline('.'), '^ \X*\zs[0-9a-f]\{7,9}') - if empty(sha) - return - endif - - let name = s:find_name(line('.')) - if empty(name) || !has_key(g:plugs, name) || !isdirectory(g:plugs[name].dir) - return - endif - - if exists('g:plug_pwindow') && !s:is_preview_window_open() - execute g:plug_pwindow - execute 'e' sha - else - execute 'pedit' sha - wincmd P - endif - setlocal previewwindow filetype=git buftype=nofile nobuflisted modifiable - try - let [sh, shrd] = s:chsh(1) - execute 'silent %!cd' s:shellesc(g:plugs[name].dir) '&& git show --no-color --pretty=medium' sha - finally - let [&shell, &shellredir] = [sh, shrd] - endtry - setlocal nomodifiable - nnoremap q :q - wincmd p -endfunction - -function! s:section(flags) - call search('\(^[x-] \)\@<=[^:]\+:', a:flags) -endfunction - -function! s:format_git_log(line) - let indent = ' ' - let tokens = split(a:line, nr2char(1)) - if len(tokens) != 5 - return indent.substitute(a:line, '\s*$', '', '') - endif - let [graph, sha, refs, subject, date] = tokens - let tag = matchstr(refs, 'tag: [^,)]\+') - let tag = empty(tag) ? ' ' : ' ('.tag.') ' - return printf('%s%s%s%s%s (%s)', indent, graph, sha, tag, subject, date) -endfunction - -function! s:append_ul(lnum, text) - call append(a:lnum, ['', a:text, repeat('-', len(a:text))]) -endfunction - -function! s:diff() - call s:prepare() - call append(0, ['Collecting changes ...', '']) - let cnts = [0, 0] - let bar = '' - let total = filter(copy(g:plugs), 's:is_managed(v:key) && isdirectory(v:val.dir)') - call s:progress_bar(2, bar, len(total)) - for origin in [1, 0] - let plugs = reverse(sort(items(filter(copy(total), (origin ? '' : '!').'(has_key(v:val, "commit") || has_key(v:val, "tag"))')))) - if empty(plugs) - continue - endif - call s:append_ul(2, origin ? 'Pending updates:' : 'Last update:') - for [k, v] in plugs - let range = origin ? '..origin/'.v.branch : 'HEAD@{1}..' - let diff = s:system_chomp('git log --graph --color=never --pretty=format:"%x01%h%x01%d%x01%s%x01%cr" '.s:shellesc(range), v.dir) - if !empty(diff) - let ref = has_key(v, 'tag') ? (' (tag: '.v.tag.')') : has_key(v, 'commit') ? (' '.v.commit) : '' - call append(5, extend(['', '- '.k.':'.ref], map(s:lines(diff), 's:format_git_log(v:val)'))) - let cnts[origin] += 1 - endif - let bar .= '=' - call s:progress_bar(2, bar, len(total)) - normal! 2G - redraw - endfor - if !cnts[origin] - call append(5, ['', 'N/A']) - endif - endfor - call setline(1, printf('%d plugin(s) updated.', cnts[0]) - \ . (cnts[1] ? printf(' %d plugin(s) have pending updates.', cnts[1]) : '')) - - if cnts[0] || cnts[1] - nnoremap :silent! call preview_commit() - nnoremap o :silent! call preview_commit() - endif - if cnts[0] - nnoremap X :call revert() - echo "Press 'X' on each block to revert the update" - endif - normal! gg - setlocal nomodifiable -endfunction - -function! s:revert() - if search('^Pending updates', 'bnW') - return - endif - - let name = s:find_name(line('.')) - if empty(name) || !has_key(g:plugs, name) || - \ input(printf('Revert the update of %s? (y/N) ', name)) !~? '^y' - return - endif - - call s:system('git reset --hard HEAD@{1} && git checkout '.s:esc(g:plugs[name].branch), g:plugs[name].dir) - setlocal modifiable - normal! "_dap - setlocal nomodifiable - echo 'Reverted' -endfunction - -function! s:snapshot(force, ...) abort - call s:prepare() - setf vim - call append(0, ['" Generated by vim-plug', - \ '" '.strftime("%c"), - \ '" :source this file in vim to restore the snapshot', - \ '" or execute: vim -S snapshot.vim', - \ '', '', 'PlugUpdate!']) - 1 - let anchor = line('$') - 3 - let names = sort(keys(filter(copy(g:plugs), - \'has_key(v:val, "uri") && !has_key(v:val, "commit") && isdirectory(v:val.dir)'))) - for name in reverse(names) - let sha = s:system_chomp('git rev-parse --short HEAD', g:plugs[name].dir) - if !empty(sha) - call append(anchor, printf("silent! let g:plugs['%s'].commit = '%s'", name, sha)) - redraw - endif - endfor - - if a:0 > 0 - let fn = expand(a:1) - if filereadable(fn) && !(a:force || s:ask(a:1.' already exists. Overwrite?')) - return - endif - call writefile(getline(1, '$'), fn) - echo 'Saved as '.a:1 - silent execute 'e' s:esc(fn) - setf vim - endif -endfunction - -function! s:split_rtp() - return split(&rtp, '\\\@ Date: Thu, 29 Aug 2019 10:07:39 +1000 Subject: [PATCH 135/234] Re-jig vim setup. --- editors/vim/autocommands.vim | 48 --- editors/vim/bundles.vim | 92 ------ editors/vim/coc.vim | 82 ----- editors/vim/colors/Tomorrow-Night.vim | 334 ------------------- editors/vim/colors/molokai_mac.vim | 218 ------------- editors/vim/colors/railscasts.vim | 100 ------ editors/vim/colors/tubster.vim | 103 ------ editors/vim/colors/tubster_bo.vim | 5 - editors/vim/dirs/backups/.gitkeep | 0 editors/vim/dirs/swaps/.gitkeep | 0 editors/vim/dirs/undos/.gitkeep | 0 editors/vim/ftdetect/ruby.vim | 6 +- editors/vim/ftdetect/sh.vim | 2 + editors/vim/gvimrc | 22 -- editors/vim/init.nvim | 3 + editors/vim/init.vim | 1 - editors/vim/ruby.vim | 11 - editors/vim/test_colors.vim | 7 - editors/vim/ui.vim | 115 ------- editors/vim/vimrc | 452 ++++++++++++++++++++++++-- freshrc | 11 +- vcs/git/gitignore | 2 + 22 files changed, 444 insertions(+), 1170 deletions(-) delete mode 100644 editors/vim/autocommands.vim delete mode 100644 editors/vim/bundles.vim delete mode 100644 editors/vim/coc.vim delete mode 100644 editors/vim/colors/Tomorrow-Night.vim delete mode 100644 editors/vim/colors/molokai_mac.vim delete mode 100644 editors/vim/colors/railscasts.vim delete mode 100644 editors/vim/colors/tubster.vim delete mode 100644 editors/vim/colors/tubster_bo.vim delete mode 100644 editors/vim/dirs/backups/.gitkeep delete mode 100644 editors/vim/dirs/swaps/.gitkeep delete mode 100644 editors/vim/dirs/undos/.gitkeep create mode 100644 editors/vim/ftdetect/sh.vim delete mode 100644 editors/vim/gvimrc create mode 100644 editors/vim/init.nvim delete mode 120000 editors/vim/init.vim delete mode 100644 editors/vim/ruby.vim delete mode 100644 editors/vim/test_colors.vim delete mode 100644 editors/vim/ui.vim diff --git a/editors/vim/autocommands.vim b/editors/vim/autocommands.vim deleted file mode 100644 index 76c50f69..00000000 --- a/editors/vim/autocommands.vim +++ /dev/null @@ -1,48 +0,0 @@ - -function! StripTrailingWhitespaces() - " Preparation: save last search, and cursor position. - let _s=@/ - let l = line(".") - let c = col(".") - " Do the business: - %s/\s\+$//e - " Clean up: restore previous search history, and cursor position - let @/=_s - call cursor(l, c) -endfunction - -" Strip trailing whitespace on command -nmap sw :call StripTrailingWhitespaces() - -augroup the_rest - au! - - if !has('nvim') - " Attempted fix for Vim losing mouse support when inside Tmux - autocmd TermResponse,CursorHold,CursorHoldI * set ttymouse=xterm2 - endif - - " Create parent directory if it doesn't exist before writing file - " (http://stackoverflow.com/questions/4292733/vim-creating-parent-directories-on-save) - autocmd BufWritePre * if expand("")!~#'^\w\+:/' && !isdirectory(expand("%:h")) | execute "silent! !mkdir -p ".shellescape(expand('%:h'), 1) | redraw! | endif - - " Source vimrc after saving it - autocmd BufWritePost .vimrc,vimrc source $MYVIMRC - - " Auto save files on window blur - autocmd FocusLost * :silent! up - - " make and python use real tabs - autocmd FileType make set noexpandtab - autocmd FileType python set noexpandtab - - " Thorfile, Rakefile and Gemfile are Ruby - autocmd BufRead,BufNewFile {Gemfile,Rakefile,Thorfile,config.ru} set ft=ruby - - autocmd BufRead,BufNewFile gitconfig set ft=gitconfig - - " Strip trailing whitespace on save - autocmd BufWritePre * :call StripTrailingWhitespaces() -augroup end - - diff --git a/editors/vim/bundles.vim b/editors/vim/bundles.vim deleted file mode 100644 index 2c449751..00000000 --- a/editors/vim/bundles.vim +++ /dev/null @@ -1,92 +0,0 @@ -if empty(glob('~/.vim/autoload/plug.vim')) - silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs - \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim - autocmd VimEnter * PlugInstall | source $MYVIMRC -endif - -call plug#begin('~/.vim/plugged') - -Plug 'w0ng/vim-hybrid' " color scheme - -Plug 'tpope/vim-sensible' " Sensible defaults, duh - -Plug 'tpope/vim-commentary' -Plug 'tpope/vim-dispatch' -Plug 'tpope/vim-endwise' " Auto-add 'end' etc appropriately in various languages -Plug 'tpope/vim-fugitive' -Plug 'tpope/vim-git' -Plug 'tpope/vim-repeat' -"Plug 'tpope/vim-sleuth' " auto-config indent and tabs etc based on other files -Plug 'tpope/vim-surround' " quoting/parenthesizing made simple -Plug 'tpope/vim-vinegar' " Nicer netrw -Plug 'terryma/vim-expand-region' -if has('signs') - Plug 'airblade/vim-gitgutter' -endif -Plug 'kana/vim-smartinput' " smart pairwise characters -Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } -Plug 'junegunn/fzf.vim' -Plug 'junegunn/vim-peekaboo' -Plug 'junegunn/vim-easy-align', { 'on': ['(EasyAlign)', 'EasyAlign'] } -vmap (EasyAlign) -nmap a (EasyAlign) - -Plug 'thisivan/vim-matchit' " Extended % matching for HTML, LaTeX, and many other languages -Plug 'kana/vim-textobj-user' " Create new text objects -Plug 'michaeljsmith/vim-indent-object' -Plug 'argtextobj.vim' - -Plug 'neoclide/coc.nvim', {'tag': '*', 'do': { -> coc#util#install()}} - - -"let g:crystal_auto_format = 1 -Plug 'rhysd/vim-crystal' " polyglot doesn't include plugin dir, where much of plugin is set -let g:polyglot_disabled = ['crystal'] -Plug 'sheerun/vim-polyglot' - -" I pretty much only work with Postgres SQL, so assume *.sql files belong to -" that syntax: -let g:sql_type_default = 'pgsql' - -Plug 'tpope/vim-bundler' -Plug 'tpope/vim-rails' -Plug 'tpope/vim-rake' -Plug 'thisivan/vim-ruby-matchit' -Plug 'nelstrom/vim-textobj-rubyblock', { 'for': 'ruby' } - -Plug 'ap/vim-css-color' - -" Plug 'Chiel92/vim-autoformat' - -Plug 'janko-m/vim-test' -let test#strategy = "neovim" " Run test using vim-dispatch - -Plug 'w0rp/ale' -let g:ale_fix_on_save = 1 -let g:ale_completion_enabled = 1 -let g:ale_fixers = { -\ '*': ['remove_trailing_lines', 'trim_whitespace'], -\ 'javascript': ['eslint'], -\ 'ruby': ['rubocop'], -\} - -Plug 'vim-airline/vim-airline' -let g:airline_powerline_fonts = 1 - -call plug#end() - -" " Clojure(script) {{{ -" NeoBundleLazy 'guns/vim-sexp', { 'depends' : ['tpope/vim-repeat'] } -" NeoBundleLazy 'tpope/vim-sexp-mappings-for-regular-people', { 'depends' : ['guns/vim-sexp'] } -" NeoBundleLazy 'tpope/vim-dispatch' -" NeoBundleLazy 'tpope/vim-leiningen', { 'depends' : ['tpope/vim-dispatch'] } -" NeoBundleLazy 'tpope/vim-fireplace', { 'depends' : ['tpope/vim-leiningen']} -" -" autocmd FileType clojure,clojurescript NeoBundleSource -" \ vim-clojure-static -" \ vim-sexp-mappings-for-regular-people -" \ vim-fireplace -" -" autocmd FileType clojure,clojurescript set lispwords-='->' -" autocmd FileType clojure,clojurescript set lispwords-='->>' -" diff --git a/editors/vim/coc.vim b/editors/vim/coc.vim deleted file mode 100644 index 795de9ee..00000000 --- a/editors/vim/coc.vim +++ /dev/null @@ -1,82 +0,0 @@ -" if hidden not set, TextEdit might fail. -set hidden - -" Better display for messages -set cmdheight=2 - -" Smaller updatetime for CursorHold & CursorHoldI -set updatetime=300 - -" always show signcolumns -set signcolumn=yes - - - - - - -" Use tab for trigger completion with characters ahead and navigate. -" Use command ':verbose imap ' to make sure tab is not mapped by other plugin. -inoremap - \ pumvisible() ? "\" : - \ check_back_space() ? "\" : - \ coc#refresh() -inoremap pumvisible() ? "\" : "\" - -function! s:check_back_space() abort - let col = col('.') - 1 - return !col || getline('.')[col - 1] =~# '\s' -endfunction - -" Use for trigger completion. -inoremap coc#refresh() - -" Use for confirm completion, `u` means break undo chain at current position. -" Coc only does snippet and additional edit on confirm. -"inoremap pumvisible() ? "\" : "\u\" -" NOTE: above mapping disabled due to https://github.com/tpope/vim-endwise/issues/22#issuecomment-446042476 - -" Use `[c` and `]c` for navigate diagnostics -nmap [c (coc-diagnostic-prev) -nmap ]c (coc-diagnostic-next) - -" Remap keys for gotos -nmap gd (coc-definition) -nmap gy (coc-type-definition) -nmap gi (coc-implementation) -nmap gr (coc-references) - -" Use K for show documentation in preview window -nnoremap K :call show_documentation() - -function! s:show_documentation() - if &filetype == 'vim' - execute 'h '.expand('') - else - call CocAction('doHover') - endif -endfunction - -" Highlight symbol under cursor on CursorHold -autocmd CursorHold * silent call CocActionAsync('highlight') - -" Remap for rename current word -nmap rn (coc-rename) - -" Remap for format selected region -vmap f (coc-format-selected) -nmap f (coc-format-selected) - -" Setup formatexpr specified filetype(s). -augroup mygroup - autocmd! - autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected') -augroup end - -" Remap for do codeAction of selected region, ex: `aap` for current paragraph -vmap a (coc-codeaction-selected) -nmap a (coc-codeaction-selected) - -" Remap for do codeAction of current line -nmap ac (coc-codeaction) - diff --git a/editors/vim/colors/Tomorrow-Night.vim b/editors/vim/colors/Tomorrow-Night.vim deleted file mode 100644 index 203239b6..00000000 --- a/editors/vim/colors/Tomorrow-Night.vim +++ /dev/null @@ -1,334 +0,0 @@ -" Tomorrow Night - Full Colour and 256 Colour -" http://chriskempson.com -" -" Hex colour conversion functions borrowed from the theme "Desert256"" - -" Default GUI Colours -let s:foreground = "c5c8c6" -let s:background = "1d1f21" -let s:selection = "373b41" -let s:line = "282a2e" -let s:comment = "969896" -let s:red = "cc6666" -let s:orange = "de935f" -let s:yellow = "f0c674" -let s:green = "b5bd68" -let s:aqua = "8abeb7" -let s:blue = "81a2be" -let s:purple = "b294bb" - -" Console 256 Colours -if !has("gui_running") - let s:background = "303030" - let s:line = "3a3a3a" - let s:selection = "585858" -end - -set background=dark -hi clear -syntax reset - -let g:colors_name = "Tomorrow-Night" - -if has("gui_running") || &t_Co == 88 || &t_Co == 256 - " Returns an approximate grey index for the given grey level - fun grey_number(x) - if &t_Co == 88 - if a:x < 23 - return 0 - elseif a:x < 69 - return 1 - elseif a:x < 103 - return 2 - elseif a:x < 127 - return 3 - elseif a:x < 150 - return 4 - elseif a:x < 173 - return 5 - elseif a:x < 196 - return 6 - elseif a:x < 219 - return 7 - elseif a:x < 243 - return 8 - else - return 9 - endif - else - if a:x < 14 - return 0 - else - let l:n = (a:x - 8) / 10 - let l:m = (a:x - 8) % 10 - if l:m < 5 - return l:n - else - return l:n + 1 - endif - endif - endif - endfun - - " Returns the actual grey level represented by the grey index - fun grey_level(n) - if &t_Co == 88 - if a:n == 0 - return 0 - elseif a:n == 1 - return 46 - elseif a:n == 2 - return 92 - elseif a:n == 3 - return 115 - elseif a:n == 4 - return 139 - elseif a:n == 5 - return 162 - elseif a:n == 6 - return 185 - elseif a:n == 7 - return 208 - elseif a:n == 8 - return 231 - else - return 255 - endif - else - if a:n == 0 - return 0 - else - return 8 + (a:n * 10) - endif - endif - endfun - - " Returns the palette index for the given grey index - fun grey_colour(n) - if &t_Co == 88 - if a:n == 0 - return 16 - elseif a:n == 9 - return 79 - else - return 79 + a:n - endif - else - if a:n == 0 - return 16 - elseif a:n == 25 - return 231 - else - return 231 + a:n - endif - endif - endfun - - " Returns an approximate colour index for the given colour level - fun rgb_number(x) - if &t_Co == 88 - if a:x < 69 - return 0 - elseif a:x < 172 - return 1 - elseif a:x < 230 - return 2 - else - return 3 - endif - else - if a:x < 75 - return 0 - else - let l:n = (a:x - 55) / 40 - let l:m = (a:x - 55) % 40 - if l:m < 20 - return l:n - else - return l:n + 1 - endif - endif - endif - endfun - - " Returns the actual colour level for the given colour index - fun rgb_level(n) - if &t_Co == 88 - if a:n == 0 - return 0 - elseif a:n == 1 - return 139 - elseif a:n == 2 - return 205 - else - return 255 - endif - else - if a:n == 0 - return 0 - else - return 55 + (a:n * 40) - endif - endif - endfun - - " Returns the palette index for the given R/G/B colour indices - fun rgb_colour(x, y, z) - if &t_Co == 88 - return 16 + (a:x * 16) + (a:y * 4) + a:z - else - return 16 + (a:x * 36) + (a:y * 6) + a:z - endif - endfun - - " Returns the palette index to approximate the given R/G/B colour levels - fun colour(r, g, b) - " Get the closest grey - let l:gx = grey_number(a:r) - let l:gy = grey_number(a:g) - let l:gz = grey_number(a:b) - - " Get the closest colour - let l:x = rgb_number(a:r) - let l:y = rgb_number(a:g) - let l:z = rgb_number(a:b) - - if l:gx == l:gy && l:gy == l:gz - " There are two possibilities - let l:dgr = grey_level(l:gx) - a:r - let l:dgg = grey_level(l:gy) - a:g - let l:dgb = grey_level(l:gz) - a:b - let l:dgrey = (l:dgr * l:dgr) + (l:dgg * l:dgg) + (l:dgb * l:dgb) - let l:dr = rgb_level(l:gx) - a:r - let l:dg = rgb_level(l:gy) - a:g - let l:db = rgb_level(l:gz) - a:b - let l:drgb = (l:dr * l:dr) + (l:dg * l:dg) + (l:db * l:db) - if l:dgrey < l:drgb - " Use the grey - return grey_colour(l:gx) - else - " Use the colour - return rgb_colour(l:x, l:y, l:z) - endif - else - " Only one possibility - return rgb_colour(l:x, l:y, l:z) - endif - endfun - - " Returns the palette index to approximate the 'rrggbb' hex string - fun rgb(rgb) - let l:r = ("0x" . strpart(a:rgb, 0, 2)) + 0 - let l:g = ("0x" . strpart(a:rgb, 2, 2)) + 0 - let l:b = ("0x" . strpart(a:rgb, 4, 2)) + 0 - - return colour(l:r, l:g, l:b) - endfun - - " Sets the highlighting for the given group - fun X(group, fg, bg, attr) - if a:fg != "" - exec "hi " . a:group . " guifg=#" . a:fg . " ctermfg=" . rgb(a:fg) - endif - if a:bg != "" - exec "hi " . a:group . " guibg=#" . a:bg . " ctermbg=" . rgb(a:bg) - endif - if a:attr != "" - exec "hi " . a:group . " gui=" . a:attr . " cterm=" . a:attr - endif - endfun - - " Vim Highlighting - call X("Normal", s:foreground, s:background, "") - call X("LineNr", s:foreground, "", "") - call X("NonText", s:selection, "", "") - call X("SpecialKey", s:selection, "", "") - call X("Search", s:background, s:yellow, "") - call X("TabLine", s:foreground, s:background, "reverse") - call X("StatusLine", s:foreground, s:background, "reverse") - call X("StatusLineNC", s:foreground, s:background, "reverse") - call X("Visual", "", s:selection, "") - call X("Directory", s:blue, "", "") - call X("ModeMsg", s:green, "", "") - call X("MoreMsg", s:green, "", "") - call X("Question", s:green, "", "") - call X("WarningMsg", s:red, "", "") - if version >= 700 - call X("CursorLine", "", s:line, "none") - call X("CursorColumn", "", s:line, "none") - call X("PMenu", s:foreground, s:selection, "none") - call X("PMenuSel", s:foreground, s:selection, "reverse") - end - - " Standard Highlighting - call X("Comment", s:comment, "", "") - call X("Todo", s:comment, "", "") - call X("Title", s:comment, "", "") - call X("Identifier", s:red, "", "none") - call X("Statement", s:foreground, "", "") - call X("Conditional", s:foreground, "", "") - call X("Repeat", s:foreground, "", "") - call X("Structure", s:purple, "", "") - call X("Function", s:blue, "", "") - call X("Constant", s:orange, "", "") - call X("String", s:green, "", "") - call X("Special", s:foreground, "", "") - call X("PreProc", s:purple, "", "") - call X("Operator", s:aqua, "", "none") - call X("Type", s:blue, "", "none") - call X("Define", s:purple, "", "none") - call X("Include", s:blue, "", "") - "call X("Ignore", "666666", "", "") - - " Vim Highlighting - call X("vimCommand", s:red, "", "none") - - " C Highlighting - call X("cType", s:yellow, "", "") - call X("cStorageClass", s:purple, "", "") - - " PHP Highlighting - call X("phpVarSelector", s:red, "", "") - call X("phpKeyword", s:purple, "", "") - call X("phpRepeat", s:purple, "", "") - call X("phpConditional", s:purple, "", "") - call X("phpStatement", s:purple, "", "") - call X("phpMemberSelector", s:foreground, "", "") - - " Ruby Highlighting - call X("rubySymbol", s:green, "", "") - call X("rubyConstant", s:yellow, "", "") - call X("rubyAttribute", s:blue, "", "") - call X("rubyInclude", s:blue, "", "") - call X("rubyLocalVariableOrMethod", s:orange, "", "") - call X("rubyCurlyBlock", s:orange, "", "") - - " Python Highlighting - call X("pythonInclude", s:purple, "", "") - call X("pythonStatement", s:purple, "", "") - call X("pythonConditional", s:purple, "", "") - call X("pythonFunction", s:blue, "", "") - - " JavaScript Highlighting - call X("javaScriptBraces", s:foreground, "", "") - call X("javaScriptFunction", s:purple, "", "") - call X("javaScriptConditional", s:purple, "", "") - call X("javaScriptRepeat", s:purple, "", "") - call X("javaScriptNumber", s:orange, "", "") - call X("javaScriptMember", s:orange, "", "") - - " Ident Guides - " call X("IndentGuidesOdd", "", s:background, "") - call X("IndentGuidesEven", "", s:line, "") - - " Delete Functions - delf X - delf rgb - delf colour - delf rgb_colour - delf rgb_level - delf rgb_number - delf grey_colour - delf grey_level - delf grey_number -endif diff --git a/editors/vim/colors/molokai_mac.vim b/editors/vim/colors/molokai_mac.vim deleted file mode 100644 index 7f9ef208..00000000 --- a/editors/vim/colors/molokai_mac.vim +++ /dev/null @@ -1,218 +0,0 @@ -" Vim color file -" -" Author: Tomas Restrepo -" -" Note: Based on the monokai theme for textmate -" by Wimer Hazenberg and its darker variant -" by Hamish Stuart Macpherson -" -" A few additional edits by Mac (http://veryhappythings.github.com) - -hi clear - -set background=dark -if version > 580 - " no guarantees for version 5.8 and below, but this makes it stop - " complaining - hi clear - if exists("syntax_on") - syntax reset - endif -endif -let g:colors_name="molokai_mac" - -if exists("g:molokai_original") - let s:molokai_original = g:molokai_original -else - let s:molokai_original = 0 -endif - - -hi Boolean guifg=#AE81FF -hi Character guifg=#E6DB74 -hi Number guifg=#AE81FF -hi String guifg=#E6DB74 -hi Conditional guifg=#D06189 gui=bold -hi Constant guifg=#AE81FF gui=bold -hi Cursor guifg=#000000 guibg=#F8F8F0 -hi Debug guifg=#BCA3A3 gui=bold -hi Define guifg=#66D9EF -hi Delimiter guifg=#8F8F8F -hi DiffAdd guibg=#13354A -hi DiffChange guifg=#89807D guibg=#4C4745 -hi DiffDelete guifg=#960050 guibg=#1E0010 -hi DiffText guibg=#4C4745 gui=italic,bold - -hi Directory guifg=#A6E22E gui=bold -hi Error guifg=#960050 guibg=#1E0010 -hi ErrorMsg guifg=#F92672 guibg=#232526 gui=bold -hi Exception guifg=#A6E22E gui=bold -hi Float guifg=#AE81FF -hi FoldColumn guifg=#465457 guibg=#000000 -hi Folded guifg=#465457 guibg=#000000 -hi Function guifg=#A6E22E -hi Identifier guifg=#FD971F -hi Ignore guifg=#808080 guibg=bg -hi IncSearch guifg=#C4BE89 guibg=#000000 - -hi Keyword guifg=#F977B3 gui=bold -hi Label guifg=#E6DB74 gui=none -hi Macro guifg=#C4BE89 gui=italic -hi SpecialKey guifg=#66D9EF gui=bold - -hi MatchParen guifg=#000000 guibg=#DD770D gui=bold -hi ModeMsg guifg=#E6DB74 -hi MoreMsg guifg=#E6DB74 -hi Operator guifg=#F92672 - -" complete menu -hi Pmenu guifg=#66D9EF guibg=#000000 -hi PmenuSel guibg=#808080 -hi PmenuSbar guibg=#080808 -hi PmenuThumb guifg=#66D9EF - -hi PreCondit guifg=#A6E22E gui=bold -hi PreProc guifg=#A6E22E -hi Question guifg=#66D9EF -hi Repeat guifg=#F92672 gui=bold -hi Search guifg=#FFFFFF guibg=#455354 -" marks column -hi SignColumn guifg=#A6E22E guibg=#232526 -hi SpecialChar guifg=#F92672 gui=bold -hi SpecialComment guifg=#465457 gui=bold -hi Special guifg=#66D9EF guibg=bg gui=italic -hi SpecialKey guifg=#888A85 gui=italic -if has("spell") - hi SpellBad guisp=#FF0000 gui=undercurl - hi SpellCap guisp=#7070F0 gui=undercurl - hi SpellLocal guisp=#70F0F0 gui=undercurl - hi SpellRare guisp=#FFFFFF gui=undercurl -endif -hi Statement guifg=#E27B9D -hi StatusLine guifg=#455354 guibg=fg -hi StatusLineNC guifg=#808080 guibg=#080808 -hi StorageClass guifg=#FD971F gui=italic -hi Structure guifg=#66D9EF -hi Tag guifg=#F92672 gui=italic -hi Title guifg=#ef5939 -hi Todo guifg=#FFFFFF guibg=bg gui=bold - -hi Typedef guifg=#66D9EF -hi Type guifg=#66D9EF gui=none -hi Underlined guifg=#808080 gui=underline - -hi VertSplit guifg=#808080 guibg=#080808 gui=bold -hi VisualNOS guibg=#403D3D -hi Visual guibg=#403D3D -hi WarningMsg guifg=#FFFFFF guibg=#333333 gui=bold -hi WildMenu guifg=#66D9EF guibg=#000000 - -if s:molokai_original == 1 - hi Normal guifg=#F8F8F2 guibg=#272822 - hi Comment guifg=#938E77 - hi CursorLine guibg=#3E3D32 - hi CursorColumn guibg=#3E3D32 - hi LineNr guifg=#BCBCBC guibg=#3B3A32 - hi NonText guifg=#BCBCBC guibg=#3B3A32 -else - hi Normal guifg=#F8F8F2 guibg=#1B1D1E - hi Comment guifg=#465457 - hi CursorLine guibg=#293739 - hi CursorColumn guibg=#293739 - hi LineNr guifg=#BCBCBC guibg=#232526 - hi NonText guifg=#BCBCBC guibg=#232526 -end - -" -" Support for 256-color terminal -" -if &t_Co > 255 - hi Boolean ctermfg=135 - hi Character ctermfg=144 - hi Number ctermfg=135 - hi String ctermfg=144 - hi Conditional ctermfg=161 cterm=bold - hi Constant ctermfg=135 cterm=bold - hi Cursor ctermfg=16 ctermbg=253 - hi Debug ctermfg=225 cterm=bold - hi Define ctermfg=81 - hi Delimiter ctermfg=241 - - hi DiffAdd ctermbg=24 - hi DiffChange ctermfg=181 ctermbg=239 - hi DiffDelete ctermfg=162 ctermbg=53 - hi DiffText ctermbg=102 cterm=bold - - hi Directory ctermfg=118 cterm=bold - hi Error ctermfg=219 ctermbg=89 - hi ErrorMsg ctermfg=199 ctermbg=16 cterm=bold - hi Exception ctermfg=118 cterm=bold - hi Float ctermfg=135 - hi FoldColumn ctermfg=67 ctermbg=16 - hi Folded ctermfg=67 ctermbg=16 - hi Function ctermfg=118 - hi Identifier ctermfg=208 - hi Ignore ctermfg=244 ctermbg=232 - hi IncSearch ctermfg=193 ctermbg=16 - - hi Keyword ctermfg=161 cterm=bold - hi Label ctermfg=229 cterm=none - hi Macro ctermfg=193 - hi SpecialKey ctermfg=81 - - hi MatchParen ctermfg=16 ctermbg=208 cterm=bold - hi ModeMsg ctermfg=229 - hi MoreMsg ctermfg=229 - hi Operator ctermfg=161 - - " complete menu - hi Pmenu ctermfg=81 ctermbg=16 - hi PmenuSel ctermbg=244 - hi PmenuSbar ctermbg=232 - hi PmenuThumb ctermfg=81 - - hi PreCondit ctermfg=118 cterm=bold - hi PreProc ctermfg=118 - hi Question ctermfg=81 - hi Repeat ctermfg=161 cterm=bold - hi Search ctermfg=253 ctermbg=66 - - " marks column - hi SignColumn ctermfg=118 ctermbg=234 - hi SpecialChar ctermfg=161 cterm=bold - hi SpecialComment ctermfg=245 cterm=bold - hi Special ctermfg=81 ctermbg=232 - hi SpecialKey ctermfg=245 - - hi Statement ctermfg=161 cterm=bold - hi StatusLine ctermfg=238 ctermbg=253 - hi StatusLineNC ctermfg=244 ctermbg=232 - hi StorageClass ctermfg=208 - hi Structure ctermfg=81 - hi Tag ctermfg=161 - hi Title ctermfg=166 - hi Todo ctermfg=231 ctermbg=232 cterm=bold - - hi Typedef ctermfg=81 - hi Type ctermfg=81 cterm=none - hi Underlined ctermfg=244 cterm=underline - - hi VertSplit ctermfg=244 ctermbg=232 cterm=bold - hi VisualNOS ctermbg=238 - hi Visual ctermbg=235 - hi WarningMsg ctermfg=231 ctermbg=238 cterm=bold - hi WildMenu ctermfg=81 ctermbg=16 - - hi Normal ctermfg=252 ctermbg=233 - hi Comment ctermfg=59 - hi CursorLine ctermbg=234 cterm=none - hi CursorColumn ctermbg=234 - hi LineNr ctermfg=237 ctermbg=234 - hi NonText ctermfg=238 - - hi IndentGuidesEven ctermbg=234 - hi ShowMarksHLo ctermfg=208 ctermbg=234 - hi ShowMarksHLl ctermfg=208 ctermbg=234 - hi ShowMarksHLu ctermfg=208 ctermbg=234 - hi ShowMarksHLm ctermfg=208 ctermbg=234 -end diff --git a/editors/vim/colors/railscasts.vim b/editors/vim/colors/railscasts.vim deleted file mode 100644 index 22aa0a43..00000000 --- a/editors/vim/colors/railscasts.vim +++ /dev/null @@ -1,100 +0,0 @@ -" Vim color scheme -" -" Name: railscasts.vim -" Maintainer: Nick Moffitt -" Last Change: 01 Mar 2008 -" License: WTFPL -" Version: 2.1 -" -" This theme is based on Josh O'Rourke's Vim clone of the railscast -" textmate theme. The key thing I have done here is supply 256-color -" terminal equivalents for as many of the colors as possible, and fixed -" up some of the funny behaviors for editing e-mails and such. -" -" To use for gvim: -" 1: install this file as ~/.vim/colors/railscasts.vim -" 2: put "colorscheme railscasts" in your .gvimrc -" -" If you are using Ubuntu, you can get the benefit of this in your -" terminals using ordinary vim by taking the following steps: -" -" 1: sudo apt-get install ncurses-term -" 2: put the following in your .vimrc -" if $COLORTERM == 'gnome-terminal' -" set term=gnome-256color -" colorscheme railscasts -" else -" colorscheme default -" endif -" 3: if you wish to use this with screen, add the following to your .screenrc: -" attrcolor b ".I" -" termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm' -" defbce "on" -" term screen-256color-bce - -set background=dark -hi clear -if exists("syntax_on") - syntax reset -endif - -let g:colors_name = "railscasts" - -hi link htmlTag xmlTag -hi link htmlTagName xmlTagName -hi link htmlEndTag xmlEndTag - -hi Directory guifg=#CC7833 ctermfg=173 cterm=NONE -hi NonText guifg=#565656 ctermfg=240 cterm=NONE -hi SpecialKey guifg=#565656 ctermfg=240 cterm=NONE - -highlight Normal guifg=#E6E1DC guibg=#111111 -highlight Cursor guifg=#000000 ctermfg=0 guibg=#FFFFFF ctermbg=15 -highlight CursorLine guibg=#000000 ctermbg=233 cterm=NONE - -highlight Comment guifg=#BC9458 ctermfg=180 gui=italic -highlight Constant guifg=#6D9CBE ctermfg=73 -highlight Define guifg=#CC7833 ctermfg=173 -highlight Error guifg=#FFC66D ctermfg=221 guibg=#990000 ctermbg=88 -highlight Function guifg=#FFC66D ctermfg=221 gui=NONE cterm=NONE -highlight Identifier guifg=#6D9CBE ctermfg=73 gui=NONE cterm=NONE -highlight Include guifg=#CC7833 ctermfg=173 gui=NONE cterm=NONE -highlight PreCondit guifg=#CC7833 ctermfg=173 gui=NONE cterm=NONE -highlight Keyword guifg=#CC7833 ctermfg=173 cterm=NONE -highlight LineNr term=bold cterm=NONE ctermfg=DarkGrey ctermbg=NONE gui=NONE guifg=DarkGrey guibg=NONE -highlight Number guifg=#A5C261 ctermfg=107 -highlight PreProc guifg=#E6E1DC ctermfg=103 -highlight Search guifg=NONE ctermfg=NONE guibg=#2b2b2b ctermbg=235 gui=italic cterm=underline -highlight Statement guifg=#CC7833 ctermfg=173 gui=NONE cterm=NONE -highlight String guifg=#A5C261 ctermfg=107 -highlight Title guifg=#FFFFFF ctermfg=15 -highlight Type guifg=#DA4939 ctermfg=167 gui=NONE cterm=NONE -highlight Visual guibg=#5A647E ctermbg=60 - -highlight DiffAdd guifg=#E6E1DC ctermfg=7 guibg=#519F50 ctermbg=71 -highlight DiffDelete guifg=#E6E1DC ctermfg=7 guibg=#660000 ctermbg=52 -highlight Special guifg=#DA4939 ctermfg=167 - -highlight pythonBuiltin guifg=#6D9CBE ctermfg=73 gui=NONE cterm=NONE -highlight rubyBlockParameter guifg=#FFFFFF ctermfg=15 -highlight rubyClass guifg=#CC7833 ctermfg=173 cterm=NONE -highlight rubyConstant guifg=#DA4939 ctermfg=167 -highlight rubyInstanceVariable guifg=#D0D0FF ctermfg=189 -highlight rubyInterpolation guifg=#519F50 ctermfg=107 -highlight rubyLocalVariableOrMethod guifg=#D0D0FF ctermfg=189 -highlight rubyPredefinedConstant guifg=#DA4939 ctermfg=167 -highlight rubyPseudoVariable guifg=#FFC66D ctermfg=221 -highlight rubyStringDelimiter guifg=#A5C261 ctermfg=143 - -highlight xmlTag guifg=#E8BF6A ctermfg=179 -highlight xmlTagName guifg=#E8BF6A ctermfg=179 -highlight xmlEndTag guifg=#E8BF6A ctermfg=179 - -highlight mailSubject guifg=#A5C261 ctermfg=107 -highlight mailHeaderKey guifg=#FFC66D ctermfg=221 -highlight mailEmail guifg=#A5C261 ctermfg=107 gui=italic cterm=underline - -highlight SpellBad guifg=#D70000 ctermfg=160 ctermbg=NONE cterm=underline -highlight SpellRare guifg=#D75F87 ctermfg=168 guibg=NONE ctermbg=NONE gui=underline cterm=underline -highlight SpellCap guifg=#D0D0FF ctermfg=189 guibg=NONE ctermbg=NONE gui=underline cterm=underline -highlight MatchParen guifg=#FFFFFF ctermfg=15 guibg=#005f5f ctermbg=23 diff --git a/editors/vim/colors/tubster.vim b/editors/vim/colors/tubster.vim deleted file mode 100644 index c792c6fa..00000000 --- a/editors/vim/colors/tubster.vim +++ /dev/null @@ -1,103 +0,0 @@ -" Vim color file -" Converted from Textmate theme Tubster using Coloration v0.3.2 (http://github.com/sickill/coloration) - -set background=dark -highlight clear - -if exists("syntax_on") - syntax reset -endif - -let g:colors_name = "Tubster" - -hi Cursor ctermfg=NONE ctermbg=15 cterm=NONE guifg=NONE guibg=#ffffff gui=NONE -hi Visual ctermfg=NONE ctermbg=59 cterm=NONE guifg=NONE guibg=#535c72 gui=NONE -hi CursorLine ctermfg=NONE ctermbg=59 cterm=NONE guifg=NONE guibg=#373636 gui=NONE -hi CursorColumn ctermfg=NONE ctermbg=59 cterm=NONE guifg=NONE guibg=#373636 gui=NONE -hi ColorColumn ctermfg=NONE ctermbg=59 cterm=NONE guifg=NONE guibg=#373636 gui=NONE -hi LineNr ctermfg=244 ctermbg=59 cterm=NONE guifg=#858280 guibg=#373636 gui=NONE -hi VertSplit ctermfg=240 ctermbg=240 cterm=NONE guifg=#5c5a59 guibg=#5c5a59 gui=NONE -hi MatchParen ctermfg=167 ctermbg=NONE cterm=NONE guifg=#cc6633 guibg=NONE gui=NONE -hi StatusLine ctermfg=188 ctermbg=240 cterm=bold guifg=#e6e1dc guibg=#5c5a59 gui=bold -hi StatusLineNC ctermfg=188 ctermbg=240 cterm=NONE guifg=#e6e1dc guibg=#5c5a59 gui=NONE -hi Pmenu ctermfg=15 ctermbg=NONE cterm=NONE guifg=#ffffff guibg=NONE gui=NONE -hi PmenuSel ctermfg=NONE ctermbg=59 cterm=NONE guifg=NONE guibg=#535c72 gui=NONE -hi IncSearch ctermfg=NONE ctermbg=58 cterm=NONE guifg=NONE guibg=#5b3928 gui=NONE -hi Search ctermfg=NONE ctermbg=58 cterm=NONE guifg=NONE guibg=#5b3928 gui=NONE -hi Directory ctermfg=74 ctermbg=NONE cterm=NONE guifg=#34a2d9 guibg=NONE gui=NONE -hi Folded ctermfg=241 ctermbg=235 cterm=NONE guifg=#666666 guibg=#232323 gui=NONE - -hi Normal ctermfg=188 ctermbg=235 cterm=NONE guifg=#e6e1dc guibg=#232323 gui=NONE -hi Boolean ctermfg=68 ctermbg=NONE cterm=NONE guifg=#3399cc guibg=NONE gui=NONE -hi Character ctermfg=74 ctermbg=NONE cterm=NONE guifg=#34a2d9 guibg=NONE gui=NONE -hi Comment ctermfg=241 ctermbg=NONE cterm=NONE guifg=#666666 guibg=NONE gui=italic -hi Conditional ctermfg=167 ctermbg=NONE cterm=NONE guifg=#cc6633 guibg=NONE gui=NONE -hi Constant ctermfg=74 ctermbg=NONE cterm=NONE guifg=#34a2d9 guibg=NONE gui=NONE -hi Define ctermfg=167 ctermbg=NONE cterm=NONE guifg=#cc6633 guibg=NONE gui=NONE -hi ErrorMsg ctermfg=15 ctermbg=160 cterm=NONE guifg=#ffffff guibg=#cc0000 gui=NONE -hi WarningMsg ctermfg=15 ctermbg=160 cterm=NONE guifg=#ffffff guibg=#cc0000 gui=NONE -hi Float ctermfg=113 ctermbg=NONE cterm=NONE guifg=#99cc66 guibg=NONE gui=NONE -hi Function ctermfg=221 ctermbg=NONE cterm=NONE guifg=#ffcc33 guibg=NONE gui=NONE -hi Identifier ctermfg=167 ctermbg=NONE cterm=NONE guifg=#cc6633 guibg=NONE gui=NONE -hi Keyword ctermfg=167 ctermbg=NONE cterm=NONE guifg=#cc6633 guibg=NONE gui=NONE -hi Label ctermfg=113 ctermbg=NONE cterm=NONE guifg=#99cc33 guibg=NONE gui=NONE -hi NonText ctermfg=238 ctermbg=236 cterm=NONE guifg=#404040 guibg=#2d2d2c gui=NONE -hi Number ctermfg=113 ctermbg=NONE cterm=NONE guifg=#99cc66 guibg=NONE gui=NONE -hi Operator ctermfg=167 ctermbg=NONE cterm=NONE guifg=#cc6633 guibg=NONE gui=NONE -hi PreProc ctermfg=167 ctermbg=NONE cterm=NONE guifg=#cc6633 guibg=NONE gui=NONE -hi Special ctermfg=188 ctermbg=NONE cterm=NONE guifg=#e6e1dc guibg=NONE gui=NONE -hi SpecialKey ctermfg=238 ctermbg=59 cterm=NONE guifg=#404040 guibg=#373636 gui=NONE -hi Statement ctermfg=167 ctermbg=NONE cterm=NONE guifg=#cc6633 guibg=NONE gui=NONE -hi StorageClass ctermfg=167 ctermbg=NONE cterm=NONE guifg=#cc6633 guibg=NONE gui=NONE -hi String ctermfg=113 ctermbg=NONE cterm=NONE guifg=#99cc33 guibg=NONE gui=NONE -hi Tag ctermfg=221 ctermbg=NONE cterm=NONE guifg=#ffcc33 guibg=NONE gui=NONE -hi Title ctermfg=188 ctermbg=NONE cterm=bold guifg=#e6e1dc guibg=NONE gui=bold -hi Todo ctermfg=241 ctermbg=NONE cterm=inverse,bold guifg=#666666 guibg=NONE gui=inverse,bold,italic -hi Type ctermfg=15 ctermbg=NONE cterm=NONE guifg=#ffffff guibg=NONE gui=NONE -hi Underlined ctermfg=NONE ctermbg=NONE cterm=underline guifg=NONE guibg=NONE gui=underline -hi rubyClass ctermfg=167 ctermbg=NONE cterm=NONE guifg=#cc6633 guibg=NONE gui=NONE -hi rubyFunction ctermfg=221 ctermbg=NONE cterm=NONE guifg=#ffcc33 guibg=NONE gui=NONE -hi rubyInterpolationDelimiter ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE -hi rubySymbol ctermfg=74 ctermbg=NONE cterm=NONE guifg=#34a2d9 guibg=NONE gui=NONE -hi rubyConstant ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE -hi rubyStringDelimiter ctermfg=113 ctermbg=NONE cterm=NONE guifg=#99cc33 guibg=NONE gui=NONE -hi rubyBlockParameter ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE -hi rubyInstanceVariable ctermfg=68 ctermbg=NONE cterm=NONE guifg=#3399cc guibg=NONE gui=NONE -hi rubyInclude ctermfg=167 ctermbg=NONE cterm=NONE guifg=#cc6633 guibg=NONE gui=NONE -hi rubyGlobalVariable ctermfg=68 ctermbg=NONE cterm=NONE guifg=#3399cc guibg=NONE gui=NONE -hi rubyRegexp ctermfg=113 ctermbg=NONE cterm=NONE guifg=#99cc33 guibg=NONE gui=NONE -hi rubyRegexpDelimiter ctermfg=113 ctermbg=NONE cterm=NONE guifg=#99cc33 guibg=NONE gui=NONE -hi rubyEscape ctermfg=71 ctermbg=NONE cterm=NONE guifg=#519f50 guibg=NONE gui=NONE -hi rubyControl ctermfg=167 ctermbg=NONE cterm=NONE guifg=#cc6633 guibg=NONE gui=NONE -hi rubyClassVariable ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE -hi rubyOperator ctermfg=167 ctermbg=NONE cterm=NONE guifg=#cc6633 guibg=NONE gui=NONE -hi rubyException ctermfg=167 ctermbg=NONE cterm=NONE guifg=#cc6633 guibg=NONE gui=NONE -hi rubyPseudoVariable ctermfg=68 ctermbg=NONE cterm=NONE guifg=#3399cc guibg=NONE gui=NONE -hi rubyRailsUserClass ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE -hi rubyRailsARAssociationMethod ctermfg=167 ctermbg=NONE cterm=NONE guifg=#da4939 guibg=NONE gui=NONE -hi rubyRailsARMethod ctermfg=167 ctermbg=NONE cterm=NONE guifg=#da4939 guibg=NONE gui=NONE -hi rubyRailsRenderMethod ctermfg=167 ctermbg=NONE cterm=NONE guifg=#da4939 guibg=NONE gui=NONE -hi rubyRailsMethod ctermfg=167 ctermbg=NONE cterm=NONE guifg=#da4939 guibg=NONE gui=NONE -hi erubyDelimiter ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE -hi erubyComment ctermfg=241 ctermbg=NONE cterm=NONE guifg=#666666 guibg=NONE gui=italic -hi erubyRailsMethod ctermfg=167 ctermbg=NONE cterm=NONE guifg=#da4939 guibg=NONE gui=NONE -hi htmlTag ctermfg=221 ctermbg=NONE cterm=NONE guifg=#ffcc33 guibg=NONE gui=NONE -hi htmlEndTag ctermfg=221 ctermbg=NONE cterm=NONE guifg=#ffcc33 guibg=NONE gui=NONE -hi htmlTagName ctermfg=221 ctermbg=NONE cterm=NONE guifg=#ffcc33 guibg=NONE gui=NONE -hi htmlArg ctermfg=221 ctermbg=NONE cterm=NONE guifg=#ffcc33 guibg=NONE gui=NONE -hi htmlSpecialChar ctermfg=74 ctermbg=NONE cterm=NONE guifg=#34a2d9 guibg=NONE gui=NONE -hi javaScriptFunction ctermfg=167 ctermbg=NONE cterm=NONE guifg=#cc6633 guibg=NONE gui=NONE -hi javaScriptRailsFunction ctermfg=167 ctermbg=NONE cterm=NONE guifg=#da4939 guibg=NONE gui=NONE -hi javaScriptBraces ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE -hi yamlKey ctermfg=221 ctermbg=NONE cterm=NONE guifg=#ffcc33 guibg=NONE gui=NONE -hi yamlAnchor ctermfg=68 ctermbg=NONE cterm=NONE guifg=#3399cc guibg=NONE gui=NONE -hi yamlAlias ctermfg=68 ctermbg=NONE cterm=NONE guifg=#3399cc guibg=NONE gui=NONE -hi yamlDocumentHeader ctermfg=113 ctermbg=NONE cterm=NONE guifg=#99cc33 guibg=NONE gui=NONE -hi cssURL ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE -hi cssFunctionName ctermfg=167 ctermbg=NONE cterm=NONE guifg=#da4939 guibg=NONE gui=NONE -hi cssColor ctermfg=74 ctermbg=NONE cterm=NONE guifg=#34a2d9 guibg=NONE gui=NONE -hi cssPseudoClassId ctermfg=221 ctermbg=NONE cterm=NONE guifg=#ffcc33 guibg=NONE gui=NONE -hi cssClassName ctermfg=221 ctermbg=NONE cterm=NONE guifg=#ffcc33 guibg=NONE gui=NONE -hi cssValueLength ctermfg=113 ctermbg=NONE cterm=NONE guifg=#99cc66 guibg=NONE gui=NONE -hi cssCommonAttr ctermfg=113 ctermbg=NONE cterm=NONE guifg=#99cc33 guibg=NONE gui=NONE -hi cssBraces ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE diff --git a/editors/vim/colors/tubster_bo.vim b/editors/vim/colors/tubster_bo.vim deleted file mode 100644 index 169daad0..00000000 --- a/editors/vim/colors/tubster_bo.vim +++ /dev/null @@ -1,5 +0,0 @@ -source ~/.vim/colors/tubster.vim - -hi NonText ctermbg=NONE -hi SpecialKey ctermbg=NONE ctermfg=0 -hi LineNr ctermbg=NONE ctermfg=237 diff --git a/editors/vim/dirs/backups/.gitkeep b/editors/vim/dirs/backups/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/editors/vim/dirs/swaps/.gitkeep b/editors/vim/dirs/swaps/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/editors/vim/dirs/undos/.gitkeep b/editors/vim/dirs/undos/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/editors/vim/ftdetect/ruby.vim b/editors/vim/ftdetect/ruby.vim index ed7838f9..4927b499 100644 --- a/editors/vim/ftdetect/ruby.vim +++ b/editors/vim/ftdetect/ruby.vim @@ -7,9 +7,6 @@ au BufNewFile,BufRead *.builder,*.rxml,*.rjs set filetype=ruby " Rakefile au BufNewFile,BufRead [rR]akefile,*.rake set filetype=ruby -" Rantfile -au BufNewFile,BufRead [rR]antfile,*.rant set filetype=ruby - " IRB config au BufNewFile,BufRead .irbrc,irbrc set filetype=ruby @@ -21,3 +18,6 @@ au BufNewFile,BufRead [tT]horfile,*.thor set filetype=ruby " Gemfile au BufNewFile,BufRead Gemfile set filetype=ruby + +" Rackup +au BufNewFile,BufRead config.ru set filetype=ruby diff --git a/editors/vim/ftdetect/sh.vim b/editors/vim/ftdetect/sh.vim new file mode 100644 index 00000000..bb76d24e --- /dev/null +++ b/editors/vim/ftdetect/sh.vim @@ -0,0 +1,2 @@ +au BufNewFile,BufRead freshrc set filetype=sh + diff --git a/editors/vim/gvimrc b/editors/vim/gvimrc deleted file mode 100644 index ee9a5dc1..00000000 --- a/editors/vim/gvimrc +++ /dev/null @@ -1,22 +0,0 @@ -set guioptions-=T " hide toolbar -set guioptions+=Rr " Turn on scroll bars - -if has("gui_macvim") - " Fullscreen takes up entire screen - set fuoptions=maxhorz,maxvert - set guifont=DejaVu\ Sans\ Mono\ for\ Powerline:h11 - - "Mac OS X style command line editing - cnoremap - cnoremap - - " Command-/ to toggle comments - map ,/ - imap ,/ - vmap ,/ -end - -" Source vimrc after saving it -autocmd! BufWritePost .gvimrc,gvimrc source $MYGVIMRC -autocmd! BufWritePost .vimrc,vimrc source $MYVIMRC | source $MYGVIMRC - diff --git a/editors/vim/init.nvim b/editors/vim/init.nvim new file mode 100644 index 00000000..f182e5b2 --- /dev/null +++ b/editors/vim/init.nvim @@ -0,0 +1,3 @@ +set runtimepath^=~/.vim runtimepath+=~/.vim/after +let &packpath = &runtimepath +source ~/.vimrc diff --git a/editors/vim/init.vim b/editors/vim/init.vim deleted file mode 120000 index c9a3c9c4..00000000 --- a/editors/vim/init.vim +++ /dev/null @@ -1 +0,0 @@ -vimrc \ No newline at end of file diff --git a/editors/vim/ruby.vim b/editors/vim/ruby.vim deleted file mode 100644 index a9745c98..00000000 --- a/editors/vim/ruby.vim +++ /dev/null @@ -1,11 +0,0 @@ -autocmd FileType cucumber compiler cucumber | setl makeprg=cucumber\ \"%:p\" -autocmd FileType ruby - \ if expand('%') =~# '_test\.rb$' | - \ compiler rubyunit | setl makeprg=testrb\ \"%:p\" | - \ elseif expand('%') =~# '_spec\.rb$' | - \ compiler rspec | setl makeprg=rspec\ \"%:p\" | - \ else | - \ compiler ruby | setl makeprg=ruby\ -wc\ \"%:p\" | - \ endif -autocmd User Bundler - \ if &makeprg !~# 'bundle' | setl makeprg^=bundle\ exec\ | endif diff --git a/editors/vim/test_colors.vim b/editors/vim/test_colors.vim deleted file mode 100644 index b84b0f89..00000000 --- a/editors/vim/test_colors.vim +++ /dev/null @@ -1,7 +0,0 @@ -let num = 255 -while num >= 0 - exec 'hi col_'.num.' ctermbg='.num.' ctermfg=white' - exec 'syn match col_'.num.' "ctermbg='.num.':...." containedIn=ALL' - call append(0, 'ctermbg='.num.':....') - let num = num - 1 -endwhile diff --git a/editors/vim/ui.vim b/editors/vim/ui.vim deleted file mode 100644 index 2f897d2f..00000000 --- a/editors/vim/ui.vim +++ /dev/null @@ -1,115 +0,0 @@ -syntax on - -" Visual - set ruler - set guioptions=ce - set showmatch " Briefly jump to a paren once it's balanced - set linespace=2 - set background=dark - set laststatus=2 - colorscheme hybrid - -" Tabs/Whitespace - set tabstop=2 " a Tab take up 2 spaces - set shiftwidth=2 " (un)indent 2 spaces at at ime - set autoindent " preserve previous indent level when inserting new line - set smarttab " insert/delete a tab's work of spaces at a time - set expandtab " insert actual spaces, not tabs - set nowrap " don't wrap long lines - set backspace=indent,eol,start " allow backspacing over everything in insert mode - - " Toggle show tabs and trailing spaces (,c) - set list - set listchars=tab:⤑\ ,trail:·,eol:↵,nbsp:_ - set fillchars=vert:\ ,fold:- - nnoremap c :set list! - -" Misc - set switchbuf=useopen " Don't re-open already opened buffers - set nostartofline " Avoid moving cursor to BOL when jumping around - set virtualedit=all " Let cursor move past the last char - set whichwrap=b,s,h,l,<,>,[,] - set autoread " watch for file changes - set mouse=a " mouse can be handy sometimes - if !has('nvim') - set ttymouse=xterm2 " Needed to get mouse working when in Tmux/screen - endif - set fileformats=unix - set history=1000 - set nohidden " unload a buffer when abandoned, please - set title " Show title in Terminal - set shortmess=atI " abbreviate messages - -" Bells - set novisualbell " No blinking - set noerrorbells " No noise. - set vb t_vb= " disable any beeps or flashes on error - -" Searching - set hlsearch " highlight search matches and keep them highlighted - set incsearch " start matching search before hitting enter - set ignorecase " case-insensitive searching by default - set smartcase " but if searching with multiple cases, treat it as case-sensitive - - " center current search result in middle of screen - nnoremap n nzz - nnoremap N Nzz - nnoremap * *zz - nnoremap # #zz - nnoremap g* g*zz - nnoremap g# g#zz - -" Work around bug that leaves cursor in middle of line - nnoremap dd ddI - -" Tab completion - set wildmode=list:longest,list:full - set wildignore+=*.o,*.obj,.git,*.rbc,*.swp - -" Directories for swp files - -" Navigate cursor up/down by lines on screen, not lines in file - nmap j gj - nmap k gk - -" Reselect visual block after adjusting indentation - vnoremap < >gv - -" Nicer splitting - set splitbelow - set splitright - -" Emacs-like keys for the command line - cnoremap - cnoremap - cnoremap - -" Always show cursorline, but only in current window. - set scrolloff=3 - set scrolljump=10 - -set number " line numbers - -" I keep deleting words when I want to switch windows -imap - -set clipboard=unnamed " OS X clipboard when yanking/pasting - -" May only work in iTerm2 and may have other bad effects, -" but this shows a block in normal mode, and vertical bar -" in insert mode. -if exists('$TMUX') - " https://github.com/sjl/vitality.vim/issues/8#issuecomment-7664649 - let &t_SI = "\[3 q" - let &t_EI = "\[0 q" - - if !has('nvim') - set term=screen-256color - endif -else - let &t_SI = "\]50;CursorShape=1\x7" - let &t_EI = "\]50;CursorShape=0\x7" -endif - -runtime macros/matchit.vim diff --git a/editors/vim/vimrc b/editors/vim/vimrc index f23c4b63..c92873d5 100644 --- a/editors/vim/vimrc +++ b/editors/vim/vimrc @@ -2,19 +2,387 @@ set nocompatible let mapleader = "\" -source ~/.vim/bundles.vim -source ~/.vim/coc.vim -source ~/.vim/ui.vim -source ~/.vim/autocommands.vim -source ~/.vim/ruby.vim +if empty(glob('~/.vim/autoload/plug.vim')) + silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs + \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim + autocmd VimEnter * PlugInstall | source $MYVIMRC +endif -set backupdir=~/.vim/dirs/backups " store file backups here -set backupskip=/tmp/*,/private/tmp/*" " don't use backups for tmp files -set directory=~/.vim/dirs/swaps " store swap files here +call plug#begin('~/.cache/vim/plugs') + +Plug 'w0ng/vim-hybrid' " color scheme +Plug 'mhinz/vim-startify' +let g:startify_session_autoload = 1 +let g:startify_fortune_use_unicode = 1 + +Plug 'tpope/vim-sensible' " Sensible defaults, duh + +" Out of the box support for many languages +Plug 'sheerun/vim-polyglot' + +Plug 'scrooloose/nerdtree' +let NERDTreeWinPos='right' + +Plug 'mbbill/undotree', { 'on': ['UndotreeToggle', 'UndotreeFocus', 'UndotreeShow', 'UndotreeHide'] } +let g:undotree_WindowLayout = 2 +let g:undotree_SetFocusWhenToggle = 1 +nmap u :UndotreeToggle +nmap tu :UndotreeToggle + +Plug 'tpope/vim-commentary' +" There is no ASCII char for Control+/ (common shortcut for commentign), but +" most terminals match that key combo to Control+_, so we will capture that +" instead. +nmap gcc +xmap gcgv +imap gcc + +Plug 'tpope/vim-dispatch' +Plug 'tpope/vim-eunuch' +Plug 'tpope/vim-endwise' " Auto-add 'end' etc appropriately in various languages +Plug 'tpope/vim-fugitive' +Plug 'tpope/vim-git' +Plug 'tpope/vim-repeat' +Plug 'tpope/vim-sleuth' " auto-config indent and tabs etc based on other files +Plug 'tpope/vim-surround' " quoting/parenthesizing made simple +Plug 'tpope/vim-vinegar' " Nicer netrw +Plug 'terryma/vim-expand-region' +if has('signs') + Plug 'airblade/vim-gitgutter' +endif +Plug 'kana/vim-smartinput' " smart pairwise characters + +Plug '~/.fzf' " Installation of bins handled by Fresh, separately +Plug 'junegunn/fzf.vim' +if executable('ag') + let $FZF_DEFAULT_COMMAND = 'ag -l --hidden .' +endif +map :GFiles +map t :Files +map :Files +" autocmd FileType fzf nmap :q + +" make t, f, T, F, etc all multi-line +Plug 'dahu/vim-fanfingtastic' + +" Preview register contents before selecting the register +Plug 'junegunn/vim-peekaboo' + +Plug 'junegunn/vim-easy-align', { 'on': ['(EasyAlign)', 'EasyAlign'] } +vmap (EasyAlign) + +" When re-opening a file, start cursor on last edit location +Plug 'farmergreg/vim-lastplace' + +Plug 'thisivan/vim-matchit' " extended matching for html, latex, and many other languages +Plug 'kana/vim-textobj-user' " Create new text objects +Plug 'michaeljsmith/vim-indent-object' + +Plug 'haya14busa/incsearch.vim', { 'on': ['(incsearch-forward)', '(incsearch-backward)', '(incsearch-stay)']} +Plug 'haya14busa/incsearch-fuzzy.vim', { 'on': ['(incsearch-fuzzy-/)', '(incsearch-fuzzy-?)', '(incsearch-fuzzy-stay)']} +nmap / (incsearch-forward) +xmap / (incsearch-forward) +nmap ? (incsearch-backward) +xmap ? (incsearch-backward) +map g/ (incsearch-stay) +map z/ (incsearch-fuzzy-/) +map z? (incsearch-fuzzy-?) +nmap zg/ (incsearch-fuzzy-stay) + +Plug 'Yggdroot/indentLine' +let g:indentLine_color_term = 239 +let g:indentLine_color_gui = '#504945' +let g:indentLine_fileTypeExclude = ['help', 'man', 'startify', 'vimfiler', 'json'] +let g:indentLine_char = '┊' + +" Run a find-and-replace using the last search term +nnoremap :%s////g + +" Make * and # work with a visual selection (in normal mode, it falls back to +" default behaviour of searching for current word) +Plug 'thinca/vim-visualstar' + +Plug 'neoclide/coc.nvim', {'tag': '*', 'do': { -> coc#util#install()}} + +Plug 'liuchengxu/vim-which-key' ", { 'on': ['WhichKey', 'WhichKey!'] } +autocmd! User vim-which-key call which_key#register('', 'g:which_key_map') +nnoremap :WhichKey '' + +Plug 'tpope/vim-bundler' +Plug 'tpope/vim-rails' +Plug 'tpope/vim-rake' +Plug 'thisivan/vim-ruby-matchit' +Plug 'nelstrom/vim-textobj-rubyblock', { 'for': 'ruby' } + +Plug 'gko/vim-coloresque' + +Plug 'w0rp/ale' +let g:ale_fix_on_save = 1 +let g:ale_completion_enabled = 1 +let g:ale_fixers = { +\ '*': ['remove_trailing_lines', 'trim_whitespace'], +\ 'javascript': ['eslint'], +\ 'ruby': ['rubocop'], +\} + +Plug 'vim-airline/vim-airline' +let g:airline_powerline_fonts = 1 +let g:airline#extensions#tabline#enabled = 1 +let g:airline#extensions#tabline#left_sep = ' ' +let g:airline#extensions#tabline#left_alt_sep = '|' + +call plug#end() +hi Normal ctermbg=none + +" if hidden not set, TextEdit might fail. +set hidden + +" Better display for messages +set cmdheight=2 + +" Smaller updatetime for CursorHold & CursorHoldI +set updatetime=300 + +" always show signcolumns +set signcolumn=yes + +" Use tab for trigger completion with characters ahead and navigate. +" Use command ':verbose imap ' to make sure tab is not mapped by other plugin. +inoremap + \ pumvisible() ? "\" : + \ check_back_space() ? "\" : + \ coc#refresh() +inoremap pumvisible() ? "\" : "\" + +function! s:check_back_space() abort + let col = col('.') - 1 + return !col || getline('.')[col - 1] =~# '\s' +endfunction + +" Use for trigger completion. +inoremap coc#refresh() + +" Use for confirm completion, `u` means break undo chain at current position. +" Coc only does snippet and additional edit on confirm. +"inoremap pumvisible() ? "\" : "\u\" +" NOTE: above mapping disabled due to https://github.com/tpope/vim-endwise/issues/22#issuecomment-446042476 + +" Use `[c` and `]c` for navigate diagnostics +nmap [c (coc-diagnostic-prev) +nmap ]c (coc-diagnostic-next) + +" Remap keys for gotos +nmap gd (coc-definition) +nmap gy (coc-type-definition) +nmap gi (coc-implementation) +nmap gr (coc-references) + +" Use K for show documentation in preview window +nnoremap K :call show_documentation() + +function! s:show_documentation() + if &filetype == 'vim' + execute 'h '.expand('') + else + call CocAction('doHover') + endif +endfunction + +" Highlight symbol under cursor on CursorHold +autocmd CursorHold * silent call CocActionAsync('highlight') + +" Remap for rename current word +nmap rn (coc-rename) + +" Remap for format selected region +vmap f (coc-format-selected) +nmap f (coc-format-selected) + +" Setup formatexpr specified filetype(s). +augroup mygroup + autocmd! + autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected') +augroup end + +" Remap for do codeAction of selected region, ex: `aap` for current paragraph +vmap a (coc-codeaction-selected) +nmap a (coc-codeaction-selected) + +" Remap for do codeAction of current line +nmap ac (coc-codeaction) + +syntax on + +" Visual + set ruler + set guioptions=ce + set showmatch " Briefly jump to a paren once it's balanced + set linespace=2 + set background=dark + set laststatus=2 + colorscheme hybrid + +" Tabs/Whitespace + set tabstop=2 " a Tab take up 2 spaces + set shiftwidth=2 " (un)indent 2 spaces at at ime + set autoindent " preserve previous indent level when inserting new line + set smarttab " insert/delete a tab's work of spaces at a time + set expandtab " insert actual spaces, not tabs + set nowrap " don't wrap long lines + set backspace=indent,eol,start " allow backspacing over everything in insert mode + + " Toggle show tabs and trailing spaces (,c) + set list + set listchars=tab:⤑\ ,trail:·,eol:↵,nbsp:_ + set fillchars=vert:\ ,fold:- + nnoremap c :set list! + +" Misc + set switchbuf=useopen " Don't re-open already opened buffers + set nostartofline " Avoid moving cursor to BOL when jumping around + set virtualedit=all " Let cursor move past the last char + set whichwrap=b,s,h,l,<,>,[,] + set autoread " watch for file changes + set mouse=a " mouse can be handy sometimes + if !has('nvim') + set ttymouse=xterm2 " Needed to get mouse working when in Tmux/screen + endif + set fileformats=unix + set history=1000 + set title " Show title in Terminal + +" Bells + set visualbell " No blinking + set noerrorbells " No noise. + set vb t_vb= " disable any beeps or flashes on error + +" Searching + set hlsearch " highlight search matches and keep them highlighted + set incsearch " start matching search before hitting enter + set ignorecase " case-insensitive searching by default + set smartcase " but if searching with multiple cases, treat it as case-sensitive + + " center current search result in middle of screen + nnoremap n nzz + nnoremap N Nzz + nnoremap * *zz + nnoremap # #zz + nnoremap g* g*zz + nnoremap g# g#zz + +" Work around bug that leaves cursor in middle of line + nnoremap dd ddI + +" Tab completion + set wildmode=list:longest,list:full + set wildignore+=*.o,*.obj,.git,*.rbc,*.swp + +" Directories for swp files + +" Navigate cursor up/down by lines on screen, not lines in file + nmap j gj + nmap k gk + +" Reselect visual block after adjusting indentation + vnoremap < >gv + +" Adjust indentation with single keypress + nnoremap < << + nnoremap > >> + +" Nicer splitting + set splitbelow + set splitright + +" Emacs-like keys for the command line and insert mode + noremap! + noremap! + +" Always show cursorline, but only in current window. + set scrolloff=3 + set scrolljump=10 + +set number " line numbers +set relativenumber + +" I keep deleting words when I want to switch windows +imap + +" Map control-S to save ( makes sure no range is inserted into command +" execution) +nmap :w +vmap :wgv + +" Share clipboard with OS +set clipboard=unnamed,unnamedplus + +" May only work in iTerm2 and may have other bad effects, +" but this shows a block in normal mode, and vertical bar +" in insert mode. +if exists('$TMUX') + " https://github.com/sjl/vitality.vim/issues/8#issuecomment-7664649 + let &t_SI = "\[3 q" + let &t_EI = "\[0 q" + + if !has('nvim') + set term=screen-256color + endif +else + let &t_SI = "\]50;CursorShape=1\x7" + let &t_EI = "\]50;CursorShape=0\x7" +endif + +runtime macros/matchit.vim + +function! StripTrailingWhitespaces() + " Preparation: save last search, and cursor position. + let _s=@/ + let l = line(".") + let c = col(".") + " Do the business: + %s/\s\+$//e + " Clean up: restore previous search history, and cursor position + let @/=_s + call cursor(l, c) +endfunction + +" Strip trailing whitespace on command +nmap sw :call StripTrailingWhitespaces() + +augroup the_rest + au! + + if !has('nvim') + " Attempted fix for Vim losing mouse support when inside Tmux + autocmd TermResponse,CursorHold,CursorHoldI * set ttymouse=xterm2 + endif + + " Create parent directory if it doesn't exist before writing file + " (http://stackoverflow.com/questions/4292733/vim-creating-parent-directories-on-save) + autocmd BufWritePre * if expand("")!~#'^\w\+:/' && !isdirectory(expand("%:h")) | execute "silent! !mkdir -p ".shellescape(expand('%:h'), 1) | redraw! | endif + + " make and python use real tabs + autocmd FileType make set noexpandtab + autocmd FileType python set noexpandtab + + autocmd BufRead,BufNewFile gitconfig set ft=gitconfig + + " Strip trailing whitespace on save + autocmd BufWritePre * :call StripTrailingWhitespaces() +augroup end + +silent! !bash -c "mkdir -p ~/.cache/vim/{backups,swaps,undos} &>/dev/null" set undofile " persistent undos -set undodir=~/.vim/dirs/undos " where to store undo histories +set undodir=~/.cache/vim/undos// " where to store undo histories (trailing // is important) +set directory=~/.cache/vim/swaps// " store swap files here (trailing // is important) +set backupdir=~/.cache/vim/backups// " store file backups here (trailing // is important) +set backupskip=/tmp/*,/private/tmp/*" " don't use backups for tmp files + set autoread +set modelines=5 + " For when you forget to sudo.. Really Write the file. cmap w!! w !sudo tee % >/dev/null @@ -22,23 +390,61 @@ cmap w!! w !sudo tee % >/dev/null map rt :!ctags --extra=+f -R * set tags=tmp/tags;/,./tmp/tags;/,tags;/,./tags;/ -"set pastetoggle=pp -nmap pp :set invpaste paste? +nmap tp :set invpaste paste? +nmap tn :set invnumber number? +nmap tr :set invrelativenumber relativenumber? -" Quick editing of common dot-files -map vv :edit $MYVIMRC -map gg :edit $MYGVIMRC -map .. :cd ~/.config:enew - -if filereadable(expand('~/.vimrc.local')) - source ~/.vimrc.local +if executable('ag') + let g:ackprg = 'ag --vimgrep --hidden' endif - -map :GFiles -map t :Files - + " comment line " For working on highlight/syntax rules map :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<' . synIDattr(synID(line("."),col("."),0),"name") . "> lo<" . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">" -hi Normal ctermbg=none +" I pretty much only work with Postgres SQL, so assume *.sql files belong to +" that syntax: +let g:sql_type_default = 'pgsql' + +" Make copy/paste work kinda normally +" +" https://stackoverflow.com/a/14786750/1155048 +set pastetoggle= +inoremap + +vnoremap "+y + +" Copy current file path to clipboard +nnoremap :let @+ = expand("%:p") \| echo '"' . expand("%:p") . '" copied to clipboard.' + +" Search for current visual selection +vnoremap y/" + +" Bubble lines up/down +nmap :m-2 +nmap :m+1 +nmap :m-2 +nmap :m+1 +vmap :m-2gv +vmap :m'>+1gv +vmap :m-2gv +vmap :m'>+1gv + +" highlight last inserted text +nnoremap gV `[v`] +nmap [b :bprevious +nmap ]b :bnext +nmap ]t :tprevious +nmap [t :tnext + +" Show incremental previews of commands (such as :s[ubstitute]) +set inccommand=nosplit + +" Start elixir tooling with a custom MIX_ENV so that compilation by that +" tooling doesn't negatively affect Phoenix auto-reloading +" +" https://github.com/phoenixframework/phoenix/issues/1165#issuecomment-437130681 +let $MIX_ENV='editor' + +if filereadable(expand('~/.vimrc.local')) + source ~/.vimrc.local +endif diff --git a/freshrc b/freshrc index b06c8245..b3fccc44 100644 --- a/freshrc +++ b/freshrc @@ -24,13 +24,12 @@ fresh-options [ -f ~/.gitconfig.local ] || cp ~/.dotfiles/vcs/git/gitconfig.local ~/.gitconfig.local -mkdir -p ~/.config -rm -rf ~/.vim ~/.config/nvim -ln -sfn ~/.dotfiles/editors/vim ~/.vim -ln -sfn ~/.dotfiles/editors/vim ~/.config/nvim -ln -sfn ~/.vim/vimrc ~/.vimrc -ln -sfn ~/.vim/gvimrc ~/.gvimrc +fresh editors/vim/init.nvim --file ~/.config/nvim/init.vim +fresh-options --file=~/.vimrc --marker='"' + fresh editors/vim/vimrc +fresh-options + fresh-options --file=~/.zshrc --marker fresh shells/path.sh diff --git a/vcs/git/gitignore b/vcs/git/gitignore index 22a235c6..4a97d41a 100755 --- a/vcs/git/gitignore +++ b/vcs/git/gitignore @@ -75,3 +75,5 @@ vendor/gems .local/ *.log .bash_history + +Session.vim From 27c865aba90f11305d3cc706405985675c97aeea Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Thu, 29 Aug 2019 12:35:26 +1000 Subject: [PATCH 136/234] Update ctags hook with latest version in blog post --- vcs/git/git_template/hooks/ctags | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/vcs/git/git_template/hooks/ctags b/vcs/git/git_template/hooks/ctags index a6aefef0..4dd6a62c 100755 --- a/vcs/git/git_template/hooks/ctags +++ b/vcs/git/git_template/hooks/ctags @@ -1,8 +1,14 @@ #!/bin/sh - # See http://tbaggery.com/2011/08/08/effortless-ctags-with-git.html -new_tags_file="`mktemp -t ctags`" -ctags --tag-relative -Rf "${new_tags_file}" --exclude=.git --languages=-javascript,sql -mv "$new_tags_file" ".git/tags" - +set -e +PATH="/usr/local/bin:$PATH" +dir="`git rev-parse --git-dir`" +trap 'rm -f "$dir/$$.tags"' EXIT +git ls-files | \ + ctags --tag-relative -L - \ + -f"$dir/$$.tags" \ + --exclude=.git \ + # customize options per repo here: + --languages=-sql +mv "$dir/$$.tags" "$dir/tags" From 19afd94375c78334a11dddb972d36d83ca4d2f35 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Thu, 29 Aug 2019 12:36:31 +1000 Subject: [PATCH 137/234] Restore .git_template linking after move to Fresh --- freshrc | 1 + 1 file changed, 1 insertion(+) diff --git a/freshrc b/freshrc index b3fccc44..b143b561 100644 --- a/freshrc +++ b/freshrc @@ -20,6 +20,7 @@ fresh-options --file # each file as is fresh vcs/git/gitconfig.merge fresh vcs/git/gitconfig.pushurls fresh vcs/git/gitignore + fresh --file=~/.git_template/ vcs/git/git_template fresh-options [ -f ~/.gitconfig.local ] || cp ~/.dotfiles/vcs/git/gitconfig.local ~/.gitconfig.local From 293bf49a89efc1118d60582ae0d5fbc970c0c960 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Thu, 29 Aug 2019 12:37:05 +1000 Subject: [PATCH 138/234] Ignore .git repo in ag searches, by default --- misc/agignore | 1 + 1 file changed, 1 insertion(+) diff --git a/misc/agignore b/misc/agignore index ca236889..70e5fb63 100644 --- a/misc/agignore +++ b/misc/agignore @@ -1,2 +1,3 @@ tags TAGS +.git From f447f7ee36813ca1702dc59e30c4e3e34a36ad48 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Thu, 29 Aug 2019 12:43:27 +1000 Subject: [PATCH 139/234] Fix vim modeline on freshrc --- editors/vim/vimrc | 1 + freshrc | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/editors/vim/vimrc b/editors/vim/vimrc index c92873d5..14feca7c 100644 --- a/editors/vim/vimrc +++ b/editors/vim/vimrc @@ -381,6 +381,7 @@ set backupskip=/tmp/*,/private/tmp/*" " don't use backups for tmp files set autoread +set modeline set modelines=5 " For when you forget to sudo.. Really Write the file. diff --git a/freshrc b/freshrc index b143b561..2974a983 100644 --- a/freshrc +++ b/freshrc @@ -1,4 +1,4 @@ -# vim: set ft=sh +# vim: ft=sh fresh freshshell/fresh bin/fresh --bin From 43b4edd9f557ab2f096d78d044b739b0395902f2 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Thu, 29 Aug 2019 12:44:11 +1000 Subject: [PATCH 140/234] Update (Neo)Vim plugins after running Fresh --- freshrc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/freshrc b/freshrc index 2974a983..22b4aa6b 100644 --- a/freshrc +++ b/freshrc @@ -61,6 +61,7 @@ fresh junegunn/fzf bin/fzf --bin fresh junegunn/fzf bin/fzf-tmux --bin fresh_after_build() { -# vim +PlugUpdate +PlugClean +qall - true + vim='vim' + command -v nvim &>/dev/null && vim='nvim' + $vim +PlugUpdate +PlugClean +qall } From 0132966dc365e58f562c133a5ee55d56e2b23f46 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Thu, 29 Aug 2019 12:48:30 +1000 Subject: [PATCH 141/234] Map vim toggles with t prefix --- editors/vim/vimrc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/editors/vim/vimrc b/editors/vim/vimrc index 14feca7c..2f8937fe 100644 --- a/editors/vim/vimrc +++ b/editors/vim/vimrc @@ -22,6 +22,8 @@ Plug 'sheerun/vim-polyglot' Plug 'scrooloose/nerdtree' let NERDTreeWinPos='right' +nmap tt :NERDTreeToggle +nmap fo :NERDTreeFind Plug 'mbbill/undotree', { 'on': ['UndotreeToggle', 'UndotreeFocus', 'UndotreeShow', 'UndotreeHide'] } let g:undotree_WindowLayout = 2 @@ -58,7 +60,6 @@ if executable('ag') let $FZF_DEFAULT_COMMAND = 'ag -l --hidden .' endif map :GFiles -map t :Files map :Files " autocmd FileType fzf nmap :q @@ -235,7 +236,7 @@ syntax on set list set listchars=tab:⤑\ ,trail:·,eol:↵,nbsp:_ set fillchars=vert:\ ,fold:- - nnoremap c :set list! + nnoremap tc :set list! list? " Misc set switchbuf=useopen " Don't re-open already opened buffers From 2db5054bb89430248943a0c3eff2e79ebba31ed1 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Thu, 29 Aug 2019 12:49:37 +1000 Subject: [PATCH 142/234] fixup! Update (Neo)Vim plugins after running Fresh --- editors/vim/vimrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/editors/vim/vimrc b/editors/vim/vimrc index 2f8937fe..d67f7e94 100644 --- a/editors/vim/vimrc +++ b/editors/vim/vimrc @@ -103,7 +103,7 @@ nnoremap :%s////g " default behaviour of searching for current word) Plug 'thinca/vim-visualstar' -Plug 'neoclide/coc.nvim', {'tag': '*', 'do': { -> coc#util#install()}} +Plug 'neoclide/coc.nvim', {'tag': '*', 'branch': 'release', 'do': { -> coc#util#install()}} Plug 'liuchengxu/vim-which-key' ", { 'on': ['WhichKey', 'WhichKey!'] } autocmd! User vim-which-key call which_key#register('', 'g:which_key_map') From 48756ec649890cef7dbd5258f18ead34ac33ed37 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Thu, 29 Aug 2019 12:50:13 +1000 Subject: [PATCH 143/234] Make vim-which-key snappier --- editors/vim/vimrc | 1 + 1 file changed, 1 insertion(+) diff --git a/editors/vim/vimrc b/editors/vim/vimrc index d67f7e94..439c1326 100644 --- a/editors/vim/vimrc +++ b/editors/vim/vimrc @@ -106,6 +106,7 @@ Plug 'thinca/vim-visualstar' Plug 'neoclide/coc.nvim', {'tag': '*', 'branch': 'release', 'do': { -> coc#util#install()}} Plug 'liuchengxu/vim-which-key' ", { 'on': ['WhichKey', 'WhichKey!'] } +set timeoutlen=300 autocmd! User vim-which-key call which_key#register('', 'g:which_key_map') nnoremap :WhichKey '' From 15f098fc023006114b456b41c891842e0f844ca5 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Thu, 29 Aug 2019 12:51:05 +1000 Subject: [PATCH 144/234] Remove unused Git aliases --- vcs/git/gitconfig | 5 ----- 1 file changed, 5 deletions(-) diff --git a/vcs/git/gitconfig b/vcs/git/gitconfig index b2b6caa6..3617a8db 100644 --- a/vcs/git/gitconfig +++ b/vcs/git/gitconfig @@ -1,7 +1,5 @@ [alias] st = status - pl = pull --rebase - p = push co = checkout commit = commit -v c = commit -v @@ -17,9 +15,6 @@ fixup = "!f() { TARGET=$(git rev-parse "$1"); git commit --fixup=$TARGET ${@:2} && EDITOR=true git rebase -i --autostash --autosquash $TARGET^; }; f" - # TODO make this use selecta, when installed - f = "!git ls-files | grep -i" - # Add file excluding whitespace changes (http://stackoverflow.com/a/7149602/56690) addnw = !sh -c 'git diff -U0 -w --no-color "$@" | git apply --cached --ignore-whitespace --unidiff-zero -' From 6ac8cad1067ba4963b132d671d0837ce5688a236 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Thu, 29 Aug 2019 12:51:18 +1000 Subject: [PATCH 145/234] Fix git config indentation --- vcs/git/gitconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vcs/git/gitconfig b/vcs/git/gitconfig index 3617a8db..2d82570a 100644 --- a/vcs/git/gitconfig +++ b/vcs/git/gitconfig @@ -13,7 +13,7 @@ mine = !sh -c 'git lg --author=\"`git me`\"' br = branch - fixup = "!f() { TARGET=$(git rev-parse "$1"); git commit --fixup=$TARGET ${@:2} && EDITOR=true git rebase -i --autostash --autosquash $TARGET^; }; f" + fixup = "!f() { TARGET=$(git rev-parse "$1"); git commit --fixup=$TARGET ${@:2} && EDITOR=true git rebase -i --autostash --autosquash $TARGET^; }; f" # Add file excluding whitespace changes (http://stackoverflow.com/a/7149602/56690) addnw = !sh -c 'git diff -U0 -w --no-color "$@" | git apply --cached --ignore-whitespace --unidiff-zero -' @@ -71,7 +71,7 @@ [difftool] prompt = false [difftool "ksdiff"] - cmd = "ksdiff $LOCAL $REMOTE" + cmd = "ksdiff $LOCAL $REMOTE" [pull] rebase = true [push] From 2eab795225ffe2dbaa22d36021fbb88a3083da88 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Thu, 29 Aug 2019 12:53:31 +1000 Subject: [PATCH 146/234] Add Elixir definitions to ctags config --- misc/ctags | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/misc/ctags b/misc/ctags index 249f0a48..afb543df 100644 --- a/misc/ctags +++ b/misc/ctags @@ -39,3 +39,16 @@ --exclude=*.min.js --exclude=.git +--langdef=Elixir +--langmap=Elixir:.ex.exs +--regex-Elixir=/^[ \t]*def(p?)[ \t]+([a-z_][a-zA-Z0-9_?!]*)/\2/f,functions,functions (def ...)/ +--regex-Elixir=/^[ \t]*defcallback[ \t]+([a-z_][a-zA-Z0-9_?!]*)/\1/c,callbacks,callbacks (defcallback ...)/ +--regex-Elixir=/^[ \t]*defdelegate[ \t]+([a-z_][a-zA-Z0-9_?!]*)/\1/d,delegates,delegates (defdelegate ...)/ +--regex-Elixir=/^[ \t]*defexception[ \t]+([A-Z][a-zA-Z0-9_]*\.)*([A-Z][a-zA-Z0-9_?!]*)/\2/e,exceptions,exceptions (defexception ...)/ +--regex-Elixir=/^[ \t]*defimpl[ \t]+([A-Z][a-zA-Z0-9_]*\.)*([A-Z][a-zA-Z0-9_?!]*)/\2/i,implementations,implementations (defimpl ...)/ +--regex-Elixir=/^[ \t]*defmacro(p?)[ \t]+([a-z_][a-zA-Z0-9_?!]*)\(/\2/a,macros,macros (defmacro ...)/ +--regex-Elixir=/^[ \t]*defmacro(p?)[ \t]+([a-zA-Z0-9_?!]+)?[ \t]+([^ \tA-Za-z0-9_]+)[ \t]*[a-zA-Z0-9_!?!]/\3/o,operators,operators (e.g. "defmacro a <<< b")/ +--regex-Elixir=/^[ \t]*defmodule[ \t]+([A-Z][a-zA-Z0-9_]*\.)*([A-Z][a-zA-Z0-9_?!]*)/\2/m,modules,modules (defmodule ...)/ +--regex-Elixir=/^[ \t]*defprotocol[ \t]+([A-Z][a-zA-Z0-9_]*\.)*([A-Z][a-zA-Z0-9_?!]*)/\2/p,protocols,protocols (defprotocol...)/ +--regex-Elixir=/^[ \t]*Record\.defrecord[ \t]+:([a-zA-Z0-9_]+)/\1/r,records,records (defrecord...)/ +--regex-Elixir=/^[ \t]*test[ \t]+\"([a-z_][a-zA-Z0-9_?! ]*)\"*/\1/t,tests,tests (test ...)/ From a5469b2a397521011c2b3c8c5f5bc493d09b0356 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Thu, 29 Aug 2019 13:23:49 +1000 Subject: [PATCH 147/234] Work around freshrc bug / missing feat --- freshrc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/freshrc b/freshrc index 22b4aa6b..0506fd94 100644 --- a/freshrc +++ b/freshrc @@ -61,6 +61,11 @@ fresh junegunn/fzf bin/fzf --bin fresh junegunn/fzf bin/fzf-tmux --bin fresh_after_build() { + # Fix executable bit + # https://github.com/freshshell/fresh/issues/159 + chmod +x ~/.git_template/hooks/* + + # Install Vim plugins vim='vim' command -v nvim &>/dev/null && vim='nvim' $vim +PlugUpdate +PlugClean +qall From 428621c2745e438db2ce4940e134ba5b188fb99e Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Thu, 29 Aug 2019 13:23:57 +1000 Subject: [PATCH 148/234] Collect ctags definitions from all over --- freshrc | 13 +++++++++-- misc/ctags | 66 ++++++++++++++++++++++-------------------------------- 2 files changed, 38 insertions(+), 41 deletions(-) diff --git a/freshrc b/freshrc index 0506fd94..a9486d8d 100644 --- a/freshrc +++ b/freshrc @@ -2,6 +2,16 @@ fresh freshshell/fresh bin/fresh --bin +fresh-options --file=~/.ctags + fresh misc/ctags + + fresh romainl/ctags-patterns-for-javascript ctagsrc + fresh jb55/typescript-ctags .ctags + fresh rust-lang/rust.vim ctags/rust.ctags + fresh mmorearty/elixir-ctags .ctags + fresh https://gist.github.com/noisesmith/ebe8b3f185e34a7de04b1189b21ba59b.git .ctags # Clojure +fresh-options + fresh languages/clojure/lein/profiles.clj --file=~/.lein/profiles.clj fresh-options --file # each file as is fresh languages/ruby/gemrc @@ -9,7 +19,6 @@ fresh-options --file # each file as is fresh misc/ackrc fresh misc/agignore - fresh misc/ctags fresh misc/inputrc fresh misc/nanorc fresh misc/psqlrc @@ -30,7 +39,7 @@ fresh editors/vim/init.nvim --file ~/.config/nvim/init.vim fresh-options --file=~/.vimrc --marker='"' fresh editors/vim/vimrc fresh-options - + fresh-options --file=~/.zshrc --marker fresh shells/path.sh diff --git a/misc/ctags b/misc/ctags index afb543df..e83e573b 100644 --- a/misc/ctags +++ b/misc/ctags @@ -4,23 +4,7 @@ --regex-ruby=/(^|;)[ \t]*event\(? *:([[:alnum:]_]+)/\2/f,function,aasm_event/ --regex-ruby=/(^|;)[ \t]*event\(? *:([[:alnum:]_]+)/\2!/f,function,aasm_event/ --regex-ruby=/(^|;)[ \t]*event\(? *:([[:alnum:]_]+)/\2?/f,function,aasm_event/ - ---langdef=Clojure ---langmap=Clojure:.clj ---langmap=Clojure:+.cljx ---langmap=Clojure:+.cljs ---regex-clojure=/\([ \t]*create-ns[ \t]+([-[:alnum:]*+!_:\/.?]+)/\1/n,namespace/ ---regex-clojure=/\([ \t]*def[ \t]+([-[:alnum:]*+!_:\/.?]+)/\1/d,definition/ ---regex-clojure=/\([ \t]*defn[ \t]+([-[:alnum:]*+!_:\/.?]+)/\1/f,function/ ---regex-clojure=/\([ \t]*defn-[ \t]+([-[:alnum:]*+!_:\/.?]+)/\1/p,private function/ ---regex-clojure=/\([ \t]*defmacro[ \t]+([-[:alnum:]*+!_:\/.?]+)/\1/m,macro/ ---regex-clojure=/\([ \t]*definline[ \t]+([-[:alnum:]*+!_:\/.?]+)/\1/i,inline/ ---regex-clojure=/\([ \t]*defmulti[ \t]+([-[:alnum:]*+!_:\/.?]+)/\1/a,multimethod definition/ ---regex-clojure=/\([ \t]*defmethod[ \t]+([-[:alnum:]*+!_:\/.?]+)/\1/b,multimethod instance/ ---regex-clojure=/\([ \t]*defonce[ \t]+([-[:alnum:]*+!_:\/.?]+)/\1/c,definition (once)/ ---regex-clojure=/\([ \t]*defstruct[ \t]+([-[:alnum:]*+!_:\/.?]+)/\1/s,struct/ ---regex-clojure=/\([ \t]*intern[ \t]+([-[:alnum:]*+!_:\/.?]+)/\1/v,intern/ ---regex-clojure=/\([ \t]*ns[ \t]+([-[:alnum:]*+!_:\/.?]+)/\1/n,namespace/ +--regex-ruby=/#[ \t]*(FIXME|TODO)[ \t]*\:*(.*)/\1/T,Tag,Tags/ --langdef=CoffeeScript --langmap=CoffeeScript:.coffee @@ -28,27 +12,31 @@ --regex-coffeescript=/^[ \t]*@?([A-Za-z.]+):.*[-=]>.*$/\1/f,function/ --regex-coffeescript=/^[ \t]*([A-Za-z.]+)[ \t]+=.*[-=]>.*$/\1/f,function/ --regex-coffeescript=/^[ \t]*([A-Za-z.]+)[ \t]+=[^->\n]*$/\1/v,variable/ +--regex-coffeescript=/#[ \t]*(FIXME|TODO)[ \t]*\:*(.*)/\1/T,Tag,Tags/ ---regex-javascript=/([A-Za-z0-9._$]+)[ \t]*[:=][ \t]*\{/\1/,object/ ---regex-javascript=/([A-Za-z0-9._$()]+)[ \t]*[:=][ \t]*function[ \t]*\(/\1/,function/ ---regex-javascript=/function[ \t]+([A-Za-z0-9._$]+)[ \t]*\(([^)])\)/\1/,function/ ---regex-javascript=/([A-Za-z0-9._$]+)[ \t]*[:=][ \t]*\[/\1/,array/ ---regex-javascript=/([^= ]+)[ \t]*=[ \t]*[^"]'[^']*/\1/,string/ ---regex-javascript=/([^= ]+)[ \t]*=[ \t]*[^']"[^"]*/\1/,string/ - ---exclude=*.min.js --exclude=.git - ---langdef=Elixir ---langmap=Elixir:.ex.exs ---regex-Elixir=/^[ \t]*def(p?)[ \t]+([a-z_][a-zA-Z0-9_?!]*)/\2/f,functions,functions (def ...)/ ---regex-Elixir=/^[ \t]*defcallback[ \t]+([a-z_][a-zA-Z0-9_?!]*)/\1/c,callbacks,callbacks (defcallback ...)/ ---regex-Elixir=/^[ \t]*defdelegate[ \t]+([a-z_][a-zA-Z0-9_?!]*)/\1/d,delegates,delegates (defdelegate ...)/ ---regex-Elixir=/^[ \t]*defexception[ \t]+([A-Z][a-zA-Z0-9_]*\.)*([A-Z][a-zA-Z0-9_?!]*)/\2/e,exceptions,exceptions (defexception ...)/ ---regex-Elixir=/^[ \t]*defimpl[ \t]+([A-Z][a-zA-Z0-9_]*\.)*([A-Z][a-zA-Z0-9_?!]*)/\2/i,implementations,implementations (defimpl ...)/ ---regex-Elixir=/^[ \t]*defmacro(p?)[ \t]+([a-z_][a-zA-Z0-9_?!]*)\(/\2/a,macros,macros (defmacro ...)/ ---regex-Elixir=/^[ \t]*defmacro(p?)[ \t]+([a-zA-Z0-9_?!]+)?[ \t]+([^ \tA-Za-z0-9_]+)[ \t]*[a-zA-Z0-9_!?!]/\3/o,operators,operators (e.g. "defmacro a <<< b")/ ---regex-Elixir=/^[ \t]*defmodule[ \t]+([A-Z][a-zA-Z0-9_]*\.)*([A-Z][a-zA-Z0-9_?!]*)/\2/m,modules,modules (defmodule ...)/ ---regex-Elixir=/^[ \t]*defprotocol[ \t]+([A-Z][a-zA-Z0-9_]*\.)*([A-Z][a-zA-Z0-9_?!]*)/\2/p,protocols,protocols (defprotocol...)/ ---regex-Elixir=/^[ \t]*Record\.defrecord[ \t]+:([a-zA-Z0-9_]+)/\1/r,records,records (defrecord...)/ ---regex-Elixir=/^[ \t]*test[ \t]+\"([a-z_][a-zA-Z0-9_?! ]*)\"*/\1/t,tests,tests (test ...)/ +--exclude=.svn +--exclude=.hg +--exclude=min +--exclude=vendor +--exclude=\*.min.\* +--exclude=\*.map +--exclude=\*.swp +--exclude=\*.bak +--exclude=\*.pyc +--exclude=\*.class +--exclude=\*.sln +--exclude=\*.Master +--exclude=\*.csproj +--exclude=\*.csproj.user +--exclude=\*.cache +--exclude=\*.dll +--exclude=\*.pdb +--exclude=tags +--exclude=cscope.\* +--exclude=\*.tar.\* +--exclude=dist +--exclude=test +--exclude=tests +--exclude=.tmp +--exclude=*bundle.* From 6f9907c88cd9474da92c03ed4534cb9d02dd3088 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Thu, 29 Aug 2019 13:29:54 +1000 Subject: [PATCH 149/234] Remove stale comment --- editors/vim/vimrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/editors/vim/vimrc b/editors/vim/vimrc index 439c1326..d69b0eef 100644 --- a/editors/vim/vimrc +++ b/editors/vim/vimrc @@ -254,7 +254,7 @@ syntax on set title " Show title in Terminal " Bells - set visualbell " No blinking + set visualbell set noerrorbells " No noise. set vb t_vb= " disable any beeps or flashes on error From 973d7250c27206534007af262e231ba924a06ecb Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sun, 8 Sep 2019 11:50:24 +1000 Subject: [PATCH 150/234] [git] Don't ignore `lib/` as Elixir keeps source here --- vcs/git/gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/vcs/git/gitignore b/vcs/git/gitignore index 4a97d41a..3cc96fee 100755 --- a/vcs/git/gitignore +++ b/vcs/git/gitignore @@ -62,7 +62,6 @@ TAGS pom.xml pom.xml.asc *jar -/lib/ /classes/ /target/ /checkouts/ From 91604629faae436049f5a8dd1c90bcb43a264a31 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sun, 8 Sep 2019 11:51:28 +1000 Subject: [PATCH 151/234] Fix indent --- freshrc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/freshrc b/freshrc index a9486d8d..68343aad 100644 --- a/freshrc +++ b/freshrc @@ -70,12 +70,12 @@ fresh junegunn/fzf bin/fzf --bin fresh junegunn/fzf bin/fzf-tmux --bin fresh_after_build() { - # Fix executable bit - # https://github.com/freshshell/fresh/issues/159 - chmod +x ~/.git_template/hooks/* - - # Install Vim plugins - vim='vim' - command -v nvim &>/dev/null && vim='nvim' - $vim +PlugUpdate +PlugClean +qall + # Fix executable bit + # https://github.com/freshshell/fresh/issues/159 + chmod +x ~/.git_template/hooks/* + + # Install Vim plugins + vim='vim' + command -v nvim &>/dev/null && vim='nvim' + $vim +PlugUpdate +PlugClean +qall } From e9573599a13870e3dd805de266946e3b713903e0 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sun, 8 Sep 2019 11:51:52 +1000 Subject: [PATCH 152/234] [fresh] Allow skipping vim plugin updates in fresh --- freshrc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/freshrc b/freshrc index 68343aad..c8601b2d 100644 --- a/freshrc +++ b/freshrc @@ -75,7 +75,9 @@ fresh_after_build() { chmod +x ~/.git_template/hooks/* # Install Vim plugins - vim='vim' - command -v nvim &>/dev/null && vim='nvim' - $vim +PlugUpdate +PlugClean +qall + if [ -z "$SKIP_VIM_PLUGINS" ]; then + vim='vim' + command -v nvim &>/dev/null && vim='nvim' + $vim +PlugUpdate +PlugClean +qall + fi } From 2bc31497ba869f86806efe95de3a7612a51f116d Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sun, 8 Sep 2019 11:53:24 +1000 Subject: [PATCH 153/234] [git] Use `diffr` to display diff --- vcs/git/gitconfig | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/vcs/git/gitconfig b/vcs/git/gitconfig index 2d82570a..9e13a8e2 100644 --- a/vcs/git/gitconfig +++ b/vcs/git/gitconfig @@ -90,3 +90,7 @@ prereleaseSuffix = -pre prereleaseSuffix = -alpha prereleaseSuffix = -beta +[pager] + log = diffr | less -R + show = diffr | less -R + diff = diffr | less -R From eddd4fad21e8f2b1a5a288baf61b4fe0adcca248 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sun, 8 Sep 2019 11:53:51 +1000 Subject: [PATCH 154/234] [vim] Nice Startify config --- editors/vim/vimrc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/editors/vim/vimrc b/editors/vim/vimrc index d69b0eef..eef799a6 100644 --- a/editors/vim/vimrc +++ b/editors/vim/vimrc @@ -12,8 +12,19 @@ call plug#begin('~/.cache/vim/plugs') Plug 'w0ng/vim-hybrid' " color scheme Plug 'mhinz/vim-startify' +let g:startify_session_persistence = 1 let g:startify_session_autoload = 1 let g:startify_fortune_use_unicode = 1 +let g:startify_update_oldfiles = 1 +let g:startify_change_to_vcs_root = 1 +let g:startify_change_to_dir = 0 +let g:startify_lists = [ + \ { 'type': 'dir', 'header': [' Recent '. getcwd()] }, + \ { 'type': 'files', 'header': [' Recent'] }, + \ { 'type': 'bookmarks', 'header': [' Bookmarks'] }, + \ { 'type': 'sessions', 'header': [' Sessions'] }, + \ { 'type': 'commands', 'header': [' Commands'] }, + \ ] Plug 'tpope/vim-sensible' " Sensible defaults, duh From e5a010824a01facbbd5d2f61d1f3651fd5d459c5 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sun, 8 Sep 2019 11:54:07 +1000 Subject: [PATCH 155/234] Separate section --- editors/vim/vimrc | 1 + 1 file changed, 1 insertion(+) diff --git a/editors/vim/vimrc b/editors/vim/vimrc index eef799a6..daf31938 100644 --- a/editors/vim/vimrc +++ b/editors/vim/vimrc @@ -11,6 +11,7 @@ endif call plug#begin('~/.cache/vim/plugs') Plug 'w0ng/vim-hybrid' " color scheme + Plug 'mhinz/vim-startify' let g:startify_session_persistence = 1 let g:startify_session_autoload = 1 From d309ffdb92dd83ececd46f9546e57f2dcc1944a1 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sun, 8 Sep 2019 11:56:04 +1000 Subject: [PATCH 156/234] [vim] Tighten NERDTree config --- editors/vim/vimrc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/editors/vim/vimrc b/editors/vim/vimrc index daf31938..93bc2f25 100644 --- a/editors/vim/vimrc +++ b/editors/vim/vimrc @@ -32,10 +32,17 @@ Plug 'tpope/vim-sensible' " Sensible defaults, duh " Out of the box support for many languages Plug 'sheerun/vim-polyglot' +Plug 'octref/RootIgnore' " Populate wildignore option from local gitignores + Plug 'scrooloose/nerdtree' -let NERDTreeWinPos='right' +let g:NERDTreeWinPos='right' +let g:NERDTreeRespectWildIgnore=1 " Hide things from wildignore +let g:NERDTreeMouseMode = 3 " Nerd tree: single clicks open file/dir +let g:NERDTreeNaturalSort = 1 nmap tt :NERDTreeToggle nmap fo :NERDTreeFind +"Plug 'tpope/vim-vinegar' " Nicer netrw +let loaded_netrwPlugin=1 " Disable netrw completely http://stackoverflow.com/a/21687112 Plug 'mbbill/undotree', { 'on': ['UndotreeToggle', 'UndotreeFocus', 'UndotreeShow', 'UndotreeHide'] } let g:undotree_WindowLayout = 2 @@ -59,7 +66,6 @@ Plug 'tpope/vim-git' Plug 'tpope/vim-repeat' Plug 'tpope/vim-sleuth' " auto-config indent and tabs etc based on other files Plug 'tpope/vim-surround' " quoting/parenthesizing made simple -Plug 'tpope/vim-vinegar' " Nicer netrw Plug 'terryma/vim-expand-region' if has('signs') Plug 'airblade/vim-gitgutter' From 7c3a70f099afd8d5ca25711eaedb6d355a58b43a Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sun, 8 Sep 2019 11:59:17 +1000 Subject: [PATCH 157/234] [vim] Nicer commit interface with Vim as editor --- editors/vim/vimrc | 2 ++ vcs/git/gitconfig | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/editors/vim/vimrc b/editors/vim/vimrc index 93bc2f25..7bab1256 100644 --- a/editors/vim/vimrc +++ b/editors/vim/vimrc @@ -62,6 +62,8 @@ Plug 'tpope/vim-dispatch' Plug 'tpope/vim-eunuch' Plug 'tpope/vim-endwise' " Auto-add 'end' etc appropriately in various languages Plug 'tpope/vim-fugitive' +Plug 'rhysd/committia.vim' " More convenient UI when using Vim as EDITOR for `git commit` +Plug 'hotwatermorning/auto-git-diff' " Show diffs in split when doing a `git rebase -i` Plug 'tpope/vim-git' Plug 'tpope/vim-repeat' Plug 'tpope/vim-sleuth' " auto-config indent and tabs etc based on other files diff --git a/vcs/git/gitconfig b/vcs/git/gitconfig index 9e13a8e2..8b395983 100644 --- a/vcs/git/gitconfig +++ b/vcs/git/gitconfig @@ -45,7 +45,8 @@ excludesfile = ~/.gitignore whitespace = trailing-space,space-before-tab precomposeunicode = true - editor = vim -u NONE +0 -c 'syntax on' + #editor = vim -u NONE +0 -c 'syntax on' + editor = vim +0 -c 'syntax on' [branch] autosetupmerge = always autosetuprebase = local From b050e38c50c6d9a73160c597eb76121e91be927f Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sun, 8 Sep 2019 12:00:10 +1000 Subject: [PATCH 158/234] [vim] Use release tags for plugs with release tags --- editors/vim/vimrc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/editors/vim/vimrc b/editors/vim/vimrc index 7bab1256..7b80e7ed 100644 --- a/editors/vim/vimrc +++ b/editors/vim/vimrc @@ -30,11 +30,11 @@ let g:startify_lists = [ Plug 'tpope/vim-sensible' " Sensible defaults, duh " Out of the box support for many languages -Plug 'sheerun/vim-polyglot' +Plug 'sheerun/vim-polyglot', { 'tag': '*' } Plug 'octref/RootIgnore' " Populate wildignore option from local gitignores -Plug 'scrooloose/nerdtree' +Plug 'scrooloose/nerdtree', { 'tag': '*' } let g:NERDTreeWinPos='right' let g:NERDTreeRespectWildIgnore=1 " Hide things from wildignore let g:NERDTreeMouseMode = 3 " Nerd tree: single clicks open file/dir @@ -61,7 +61,7 @@ imap gcc Plug 'tpope/vim-dispatch' Plug 'tpope/vim-eunuch' Plug 'tpope/vim-endwise' " Auto-add 'end' etc appropriately in various languages -Plug 'tpope/vim-fugitive' +Plug 'tpope/vim-fugitive', {'tag': '*', 'branch': 'master'} Plug 'rhysd/committia.vim' " More convenient UI when using Vim as EDITOR for `git commit` Plug 'hotwatermorning/auto-git-diff' " Show diffs in split when doing a `git rebase -i` Plug 'tpope/vim-git' From c84ea76a6f2cdf4c791374d0bcbd9482c2e88cba Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sun, 8 Sep 2019 12:00:39 +1000 Subject: [PATCH 159/234] [vim] Hide indent lines on markdown (show for JSON) --- editors/vim/vimrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/editors/vim/vimrc b/editors/vim/vimrc index 7b80e7ed..94ae0d3f 100644 --- a/editors/vim/vimrc +++ b/editors/vim/vimrc @@ -113,7 +113,7 @@ nmap zg/ (incsearch-fuzzy-stay) Plug 'Yggdroot/indentLine' let g:indentLine_color_term = 239 let g:indentLine_color_gui = '#504945' -let g:indentLine_fileTypeExclude = ['help', 'man', 'startify', 'vimfiler', 'json'] +let g:indentLine_fileTypeExclude = ['help', 'man', 'startify', 'vimfiler', 'markdown'] let g:indentLine_char = '┊' " Run a find-and-replace using the last search term From 90ad7e8d4d83c5437ae2f4bb289bbdb0b620ee20 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sun, 8 Sep 2019 12:01:15 +1000 Subject: [PATCH 160/234] [vim] Turn on Elixir auto-formatting but disable Ruby's Rubocop is just too damn slow. --- editors/vim/vimrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/editors/vim/vimrc b/editors/vim/vimrc index 94ae0d3f..2a69ba7a 100644 --- a/editors/vim/vimrc +++ b/editors/vim/vimrc @@ -144,7 +144,7 @@ let g:ale_completion_enabled = 1 let g:ale_fixers = { \ '*': ['remove_trailing_lines', 'trim_whitespace'], \ 'javascript': ['eslint'], -\ 'ruby': ['rubocop'], +\ 'elixir': ['mix_format'], \} Plug 'vim-airline/vim-airline' From b342bb81fe53424652d4363d743a0f10218bd0d8 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sun, 8 Sep 2019 12:01:46 +1000 Subject: [PATCH 161/234] [vim] Change working directory to Git root --- editors/vim/vimrc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/editors/vim/vimrc b/editors/vim/vimrc index 2a69ba7a..48a2ac5e 100644 --- a/editors/vim/vimrc +++ b/editors/vim/vimrc @@ -147,6 +147,10 @@ let g:ale_fixers = { \ 'elixir': ['mix_format'], \} +" Change working directory to .git root +Plug 'airblade/vim-rooter' +let g:rooter_use_lcd = 1 + Plug 'vim-airline/vim-airline' let g:airline_powerline_fonts = 1 let g:airline#extensions#tabline#enabled = 1 From 9118189c7614b16a7f70c62e27957c44903dd7cd Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sun, 8 Sep 2019 12:02:31 +1000 Subject: [PATCH 162/234] [vim] More "targeted" text objects around pairs --- editors/vim/vimrc | 1 + 1 file changed, 1 insertion(+) diff --git a/editors/vim/vimrc b/editors/vim/vimrc index 48a2ac5e..5efaf494 100644 --- a/editors/vim/vimrc +++ b/editors/vim/vimrc @@ -68,6 +68,7 @@ Plug 'tpope/vim-git' Plug 'tpope/vim-repeat' Plug 'tpope/vim-sleuth' " auto-config indent and tabs etc based on other files Plug 'tpope/vim-surround' " quoting/parenthesizing made simple +Plug 'wellle/targets.vim' Plug 'terryma/vim-expand-region' if has('signs') Plug 'airblade/vim-gitgutter' From 660f86d59a76f0af6db8e4b9f249f61a12dbeab9 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sun, 8 Sep 2019 12:04:11 +1000 Subject: [PATCH 163/234] [vim] Fix cursor highlighting w/ matching pairs https://github.com/tomasr/molokai/issues/74#issuecomment-529159596 --- editors/vim/vimrc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/editors/vim/vimrc b/editors/vim/vimrc index 5efaf494..f5730ca0 100644 --- a/editors/vim/vimrc +++ b/editors/vim/vimrc @@ -243,12 +243,19 @@ syntax on " Visual set ruler set guioptions=ce - set showmatch " Briefly jump to a paren once it's balanced set linespace=2 set background=dark set laststatus=2 colorscheme hybrid + set showmatch " Briefly jump to a paren once it's balanced + set matchpairs+=\<:\> + " With `Cursor guibg=fg guifg=bg` + default MatchParen styling, it makes the + " cursor seem like it has actually jumped to the patching pair. This instead + " makes the MatchParen style preserve the background color, so that the + " Cursor can flip it appropriately. + hi! MatchParen cterm=NONE,bold gui=NONE,bold guibg=bg guifg=lightblue ctermbg=bg ctermfg=lightblue + " Tabs/Whitespace set tabstop=2 " a Tab take up 2 spaces set shiftwidth=2 " (un)indent 2 spaces at at ime From ce7cb683d776da3ddefb4661013c0bd9119e4840 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sun, 8 Sep 2019 12:05:16 +1000 Subject: [PATCH 164/234] [vim] Set tags manually in prep for next fugitive https://github.com/tpope/vim-fugitive/commit/63a05a6935ec4a45551bf141089c13d5671202a1 --- editors/vim/vimrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/editors/vim/vimrc b/editors/vim/vimrc index f5730ca0..284d3b98 100644 --- a/editors/vim/vimrc +++ b/editors/vim/vimrc @@ -423,7 +423,7 @@ cmap w!! w !sudo tee % >/dev/null " CTags map rt :!ctags --extra=+f -R * -set tags=tmp/tags;/,./tmp/tags;/,tags;/,./tags;/ +set tags=./.git/tags;./tmp/tags;/,./tags;/ nmap tp :set invpaste paste? nmap tn :set invnumber number? From c16182e9fed2df739ed43efba7ca399f7a09b62f Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sun, 8 Sep 2019 12:05:55 +1000 Subject: [PATCH 165/234] [vim] Misc --- editors/vim/vimrc | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/editors/vim/vimrc b/editors/vim/vimrc index 284d3b98..6a2c21a9 100644 --- a/editors/vim/vimrc +++ b/editors/vim/vimrc @@ -471,9 +471,36 @@ nmap ]b :bnext nmap ]t :tprevious nmap [t :tnext +set formatoptions= " Clear so I can add with comments (see `:help fo-table`) +set formatoptions+=c " Auto-wrap comments, inserting current comment leader +set formatoptions+=r " Insert comment leader when hitting within a comment +set formatoptions+=j " Remove comment leader when joining comment lines +set formatoptions+=o " Ditto except for when using o or O +set formatoptions+=q " Allow formatting text with `gq` +set formatoptions+=n " Recognise numbered lists for sake of indenting wrapped content + +set nojoinspaces " Don't insert 2 spaces after punctuation when joining jines + +hi ColorColumn guibg=#222222 ctermbg=235 +set colorcolumn=79,120 +set textwidth=79 + " Show incremental previews of commands (such as :s[ubstitute]) set inccommand=nosplit +" If there's no EOL at the end of the file, don't mess up the diff by adding +" one +set nofixeol + +set noautochdir + +" https://dougblack.io/words/a-good-vimrc.html +set lazyredraw + +" Show current syntax item for position under cursor +" https://vi.stackexchange.com/a/11877/11631 +nnoremap zS :echo join(reverse(map(synstack(line('.'), col('.')), 'synIDattr(v:val,"name")')), ' ') + " Start elixir tooling with a custom MIX_ENV so that compilation by that " tooling doesn't negatively affect Phoenix auto-reloading " From 88b337362245ab62275f812ca365a130b8af2e75 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sun, 8 Sep 2019 12:14:13 +1000 Subject: [PATCH 166/234] [vim] Remove RootIgnore plugin, as it errors --- editors/vim/vimrc | 2 -- 1 file changed, 2 deletions(-) diff --git a/editors/vim/vimrc b/editors/vim/vimrc index 6a2c21a9..1af6f806 100644 --- a/editors/vim/vimrc +++ b/editors/vim/vimrc @@ -32,8 +32,6 @@ Plug 'tpope/vim-sensible' " Sensible defaults, duh " Out of the box support for many languages Plug 'sheerun/vim-polyglot', { 'tag': '*' } -Plug 'octref/RootIgnore' " Populate wildignore option from local gitignores - Plug 'scrooloose/nerdtree', { 'tag': '*' } let g:NERDTreeWinPos='right' let g:NERDTreeRespectWildIgnore=1 " Hide things from wildignore From 2214a99044291667692b2496b50d208d4b446c3a Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Thu, 16 Jan 2020 09:28:03 +1100 Subject: [PATCH 167/234] Associate elixir lang with .ex{s,} for git diff https://www.reddit.com/r/elixir/comments/eozrqd/using_functioncontext_with_elixir_and_git_225/ --- vcs/git/gitattributes | 2 ++ 1 file changed, 2 insertions(+) diff --git a/vcs/git/gitattributes b/vcs/git/gitattributes index 172c4cd7..6d6c81d2 100644 --- a/vcs/git/gitattributes +++ b/vcs/git/gitattributes @@ -1,3 +1,5 @@ *.rb diff=ruby +*.ex diff=elixir +*.exs diff=elixir db/schema.rb merge=railsschema Gemfile.lock merge=gemfilelock From c628d7e8858a80a8af6471d6e0526590dff3c723 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Thu, 2 Apr 2020 14:17:05 +1100 Subject: [PATCH 168/234] Fix issue with unbound variable --- freshrc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/freshrc b/freshrc index c8601b2d..5ae23d2c 100644 --- a/freshrc +++ b/freshrc @@ -65,17 +65,16 @@ fresh zsh-users/zsh-syntax-highlighting . --file=vendor/zsh-syntax-highlighting/ fresh garybernhardt/dotfiles bin/run-command-on-git-revisions --bin fresh junegunn/fzf . --file=~/.fzf/ -~/.fresh/source/junegunn/fzf/install --bin -fresh junegunn/fzf bin/fzf --bin -fresh junegunn/fzf bin/fzf-tmux --bin fresh_after_build() { # Fix executable bit # https://github.com/freshshell/fresh/issues/159 chmod +x ~/.git_template/hooks/* + ~/.fresh/source/junegunn/fzf/install --bin + # Install Vim plugins - if [ -z "$SKIP_VIM_PLUGINS" ]; then + if [ -z "${SKIP_VIM_PLUGINS:-}" ]; then vim='vim' command -v nvim &>/dev/null && vim='nvim' $vim +PlugUpdate +PlugClean +qall From 36c193629247868054f1044404dc88354864f9ac Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Thu, 2 Apr 2020 14:44:29 +1100 Subject: [PATCH 169/234] Preserve existing PATH In WSL2, the PATH is pre-filled with Windows' PATH contents (which are still executable within WSL Linux distros). For instance, `code .` to open VS Code works by finding `code` in the Windows filesystem, which is conveniently already specified in the PATH. --- shells/path.sh | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/shells/path.sh b/shells/path.sh index 7eafae42..05e29de3 100644 --- a/shells/path.sh +++ b/shells/path.sh @@ -1,3 +1,11 @@ +function __prepend_path { + if [ -z "$(eval echo \$$1)" ]; then + eval "$1=\"$2\"" + else + eval "$1=\"$2:\$$1\"" + fi +} + function __append_path { if [ -z "$(eval echo \$$1)" ]; then eval "$1=\"$2\"" @@ -6,17 +14,16 @@ function __append_path { fi } -[ -d "$HOME/bin" ] && __append_path "new_path" "$HOME/bin" -[ -d "$HOME/.cargo/bin" ] && __append_path "new_path" "$HOME/.cargo/bin" -[ -d "$HOME/.emacs.d/bin" ] && __append_path "new_path" "$HOME/.emacs.d/bin" -[ -d "$DOT_FILES/bin" ] && __append_path "new_path" "$DOT_FILES/bin" -[ -d '/usr/local/bin' ] && __append_path "new_path" "/usr/local/bin" -[ -d '/usr/local/sbin' ] && __append_path "new_path" "/usr/local/sbin" -[ -d '/opt/local/bin' ] && __append_path "new_path" "/opt/local/bin" -[ -d '/opt/local/sbin' ] && __append_path "new_path" "/opt/local/sbin" -[ -d '/usr/X11/bin' ] && __append_path "new_path" "/usr/X11/bin" -[ -d '/usr/bin' ] && __append_path "new_path" "/usr/bin" -[ -d '/usr/sbin' ] && __append_path "new_path" "/usr/sbin" -[ -d '/bin' ] && __append_path "new_path" "/bin" -[ -d '/sbin' ] && __append_path "new_path" "/sbin" -PATH="$new_path" +[ -d "$HOME/bin" ] && __prepend_path "PATH" "$HOME/bin" +[ -d "$HOME/.cargo/bin" ] && __prepend_path "PATH" "$HOME/.cargo/bin" +[ -d "$HOME/.emacs.d/bin" ] && __prepend_path "PATH" "$HOME/.emacs.d/bin" +[ -d "$DOT_FILES/bin" ] && __prepend_path "PATH" "$DOT_FILES/bin" +[ -d '/usr/local/bin' ] && __append_path "PATH" "/usr/local/bin" +[ -d '/usr/local/sbin' ] && __append_path "PATH" "/usr/local/sbin" +[ -d '/opt/local/bin' ] && __append_path "PATH" "/opt/local/bin" +[ -d '/opt/local/sbin' ] && __append_path "PATH" "/opt/local/sbin" +[ -d '/usr/X11/bin' ] && __append_path "PATH" "/usr/X11/bin" +[ -d '/usr/bin' ] && __append_path "PATH" "/usr/bin" +[ -d '/usr/sbin' ] && __append_path "PATH" "/usr/sbin" +[ -d '/bin' ] && __append_path "PATH" "/bin" +[ -d '/sbin' ] && __append_path "PATH" "/sbin" From 1aa3612dd813b2c52401d69a542df6d77d4358cb Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Fri, 3 Apr 2020 10:23:55 +1100 Subject: [PATCH 170/234] Fix arrow keys in ZSH insides WSL/Windows Terminal --- shells/zsh/lib/fish.zsh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/shells/zsh/lib/fish.zsh b/shells/zsh/lib/fish.zsh index 1a7df8b6..5559ca8b 100644 --- a/shells/zsh/lib/fish.zsh +++ b/shells/zsh/lib/fish.zsh @@ -5,6 +5,10 @@ source $FRESH_PATH/build/vendor/zsh-syntax-highlighting/zsh-syntax-highlighting. bindkey '^[[A' history-substring-search-up bindkey '^[[B' history-substring-search-down +# bind UP and DOWN arrow keys in other terms (was needed in Windows Terminal) +bindkey '^[OA' history-substring-search-up +bindkey '^[OB' history-substring-search-down + # Bind control + LEFT and RIGHT arrow keys to jump by word bindkey "^[[1;5C" forward-word bindkey "^[[1;5D" backward-word From 4d613c1d225c046ee90aa869060304719b65d672 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Fri, 3 Apr 2020 10:40:26 +1100 Subject: [PATCH 171/234] More nuanced zsh history searching up/down - search history using command as prefix shift+up/down - search history using command as filter (non-prefix) page up/page down - same as shift+up/shift+down --- shells/zsh/lib/fish.zsh | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/shells/zsh/lib/fish.zsh b/shells/zsh/lib/fish.zsh index 5559ca8b..097d87bc 100644 --- a/shells/zsh/lib/fish.zsh +++ b/shells/zsh/lib/fish.zsh @@ -1,13 +1,23 @@ source $FRESH_PATH/build/vendor/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh # source $FRESH_PATH/build/vendor/history-substring-search/zsh-history-substring-search.zsh -# bind UP and DOWN arrow keys -bindkey '^[[A' history-substring-search-up -bindkey '^[[B' history-substring-search-down +autoload -U up-line-or-beginning-search +zle -N up-line-or-beginning-search -# bind UP and DOWN arrow keys in other terms (was needed in Windows Terminal) -bindkey '^[OA' history-substring-search-up -bindkey '^[OB' history-substring-search-down +autoload -U down-line-or-beginning-search +zle -N down-line-or-beginning-search + +# bind UP and DOWN arrow keys to prefix search history (diff keys for diff terms) +bindkey '^[[A' up-line-or-beginning-search +bindkey '^[OA' up-line-or-beginning-search +bindkey '^[[B' down-line-or-beginning-search +bindkey '^[OB' down-line-or-beginning-search + +# bind SHIFT-UP / SHIFT-DOWN & PAGE UP / PAGE DOWN to search history matching current contents (non-prefix) +bindkey '^[[5~' history-substring-search-up +bindkey '^[[1;2A' history-substring-search-up +bindkey '^[[6~' history-substring-search-down +bindkey '^[[1;2B' history-substring-search-down # Bind control + LEFT and RIGHT arrow keys to jump by word bindkey "^[[1;5C" forward-word From f454a797982583efd393ee1460e06af274cb0f8a Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Fri, 3 Apr 2020 10:42:22 +1100 Subject: [PATCH 172/234] Add `arst` alias for `asdf` and fix error in zsh We were loading the Bash completions in ZSH which caused an error. I broke out Bash completion loading separately. --- shells/bash/lib/asdf.bash | 3 +++ shells/common/asdf.sh | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 shells/bash/lib/asdf.bash diff --git a/shells/bash/lib/asdf.bash b/shells/bash/lib/asdf.bash new file mode 100644 index 00000000..2d32e710 --- /dev/null +++ b/shells/bash/lib/asdf.bash @@ -0,0 +1,3 @@ +if [ -d "$HOME/.asdf" ]; then + . $HOME/.asdf/completions/asdf.bash +fi \ No newline at end of file diff --git a/shells/common/asdf.sh b/shells/common/asdf.sh index 0e657cd2..0051dd51 100644 --- a/shells/common/asdf.sh +++ b/shells/common/asdf.sh @@ -1,4 +1,5 @@ if [ -d "$HOME/.asdf" ]; then . $HOME/.asdf/asdf.sh - . $HOME/.asdf/completions/asdf.bash + + alias arst=asdf # For Colemak fi From 2c0385ee109dcf9b9550ddd7fbee4d57d547d778 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Fri, 3 Apr 2020 10:43:47 +1100 Subject: [PATCH 173/234] Make ZSH plugin loading a bit more consistent --- freshrc | 3 ++- shells/zsh/lib/fish.zsh | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/freshrc b/freshrc index 5ae23d2c..c99c8d45 100644 --- a/freshrc +++ b/freshrc @@ -44,7 +44,6 @@ fresh-options --file=~/.zshrc --marker fresh shells/path.sh fresh freshshell/fresh contrib/source-build.sh - fresh zsh-users/zsh-history-substring-search zsh-history-substring-search.zsh fresh mathiasbynens/dotfiles .functions fresh twe4ked/dotfiles shell/zsh/completion.zsh @@ -61,6 +60,8 @@ fresh zsh-users/zsh-completions src --file=completion/ fresh freshshell/fresh contrib/completion/fresh-completion.zsh --file=completion/_fresh fresh zsh-users/zsh-syntax-highlighting . --file=vendor/zsh-syntax-highlighting/ +fresh zsh-users/zsh-history-substring-search . --file=vendor/zsh-history-substring-search/ +fresh zsh-users/zsh-autosuggestions . --file=vendor/zsh-autosuggestions/ fresh garybernhardt/dotfiles bin/run-command-on-git-revisions --bin diff --git a/shells/zsh/lib/fish.zsh b/shells/zsh/lib/fish.zsh index 097d87bc..8276c257 100644 --- a/shells/zsh/lib/fish.zsh +++ b/shells/zsh/lib/fish.zsh @@ -1,5 +1,6 @@ +source $FRESH_PATH/build/vendor/zsh-autosuggestions/zsh-autosuggestions.zsh +source $FRESH_PATH/build/vendor/zsh-history-substring-search/zsh-history-substring-search.zsh source $FRESH_PATH/build/vendor/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh -# source $FRESH_PATH/build/vendor/history-substring-search/zsh-history-substring-search.zsh autoload -U up-line-or-beginning-search zle -N up-line-or-beginning-search From cb51dd7e755ce8e26358a55c1a5692bdaf6faa62 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Fri, 3 Apr 2020 10:46:12 +1100 Subject: [PATCH 174/234] Improve ZSH completions loading --- freshrc | 2 ++ shells/zsh/config.zsh | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/freshrc b/freshrc index c99c8d45..37376765 100644 --- a/freshrc +++ b/freshrc @@ -58,6 +58,8 @@ fresh-options fresh zsh-users/zsh-completions src --file=completion/ fresh freshshell/fresh contrib/completion/fresh-completion.zsh --file=completion/_fresh +fresh thoughtbot/dotfiles zsh/completion/_ag --file=completion/_ag +fresh shells/zsh/completions --file=completion/ fresh zsh-users/zsh-syntax-highlighting . --file=vendor/zsh-syntax-highlighting/ fresh zsh-users/zsh-history-substring-search . --file=vendor/zsh-history-substring-search/ diff --git a/shells/zsh/config.zsh b/shells/zsh/config.zsh index 5ed3a444..a83a73e4 100644 --- a/shells/zsh/config.zsh +++ b/shells/zsh/config.zsh @@ -2,8 +2,6 @@ alias reload="source ~/.zshrc" [[ $EMACS = t ]] && unsetopt zle -fpath=($SHELL_FILES/completions $fpath) - # Option-Left + Option-Right for moving word-by-word in OS X bindkey "\e\e[C" vi-forward-word bindkey "\e\e[D" vi-backward-word From ef5dc4fc3312b5d38eeacc25b4510bedcbc6c4b4 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Fri, 3 Apr 2020 10:46:36 +1100 Subject: [PATCH 175/234] Add some more bins to dotfiles --- freshrc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/freshrc b/freshrc index 37376765..c5bbeeb7 100644 --- a/freshrc +++ b/freshrc @@ -1,6 +1,7 @@ # vim: ft=sh fresh freshshell/fresh bin/fresh --bin +fresh freshshell/fresh-open bin/fresh-open --bin fresh-options --file=~/.ctags fresh misc/ctags @@ -66,6 +67,7 @@ fresh zsh-users/zsh-history-substring-search . --file=vendor/zsh-history-substri fresh zsh-users/zsh-autosuggestions . --file=vendor/zsh-autosuggestions/ fresh garybernhardt/dotfiles bin/run-command-on-git-revisions --bin +fresh sivel/speedtest-cli speedtest.py --bin=~/bin/speedtest fresh junegunn/fzf . --file=~/.fzf/ From ef83444e5638d67d879355e94af1c03f0622855d Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Fri, 3 Apr 2020 10:46:41 +1100 Subject: [PATCH 176/234] Start porting Bash configs to Fresh management --- freshrc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/freshrc b/freshrc index c5bbeeb7..701e2ce0 100644 --- a/freshrc +++ b/freshrc @@ -57,6 +57,13 @@ fresh-options --file=~/.zshrc --marker fresh shells/zsh/lib/\*.zsh fresh-options +fresh-options --file=~/.bashrc --marker + fresh shells/path.sh + fresh shells/common/\*.sh + fresh shells/bash/\*.bash + fresh shells/bash/lib/\*.bash +fresh-options + fresh zsh-users/zsh-completions src --file=completion/ fresh freshshell/fresh contrib/completion/fresh-completion.zsh --file=completion/_fresh fresh thoughtbot/dotfiles zsh/completion/_ag --file=completion/_ag From 6d54f020c7da9376e32798e34660d0df1a1870db Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Fri, 3 Apr 2020 15:36:53 +1100 Subject: [PATCH 177/234] Configure `asdf` versions --- freshrc | 5 +++++ languages/asdfrc | 1 + languages/ruby/default-gems | 6 ++++++ languages/ruby/global.gems | 7 ------- languages/tool-versions | 26 ++++++++++++++++++++++++++ 5 files changed, 38 insertions(+), 7 deletions(-) create mode 100644 languages/asdfrc create mode 100644 languages/ruby/default-gems delete mode 100644 languages/ruby/global.gems create mode 100644 languages/tool-versions diff --git a/freshrc b/freshrc index 701e2ce0..cb13ea46 100644 --- a/freshrc +++ b/freshrc @@ -18,6 +18,11 @@ fresh-options --file # each file as is fresh languages/ruby/gemrc fresh languages/ruby/irbrc + # asdf conf + fresh languages/asdfrc + fresh languages/tool-versions + fresh languages/ruby/default-gems # asdf-ruby only + fresh misc/ackrc fresh misc/agignore fresh misc/inputrc diff --git a/languages/asdfrc b/languages/asdfrc new file mode 100644 index 00000000..8544bb6b --- /dev/null +++ b/languages/asdfrc @@ -0,0 +1 @@ +legacy_version_file = yes \ No newline at end of file diff --git a/languages/ruby/default-gems b/languages/ruby/default-gems new file mode 100644 index 00000000..516d007a --- /dev/null +++ b/languages/ruby/default-gems @@ -0,0 +1,6 @@ +bundler +pry +gem-ctags +rails +rake +pg \ No newline at end of file diff --git a/languages/ruby/global.gems b/languages/ruby/global.gems deleted file mode 100644 index 1b9bfdc4..00000000 --- a/languages/ruby/global.gems +++ /dev/null @@ -1,7 +0,0 @@ -launchy -ghost -flog -bundler -heroku -rake -gem-ctags diff --git a/languages/tool-versions b/languages/tool-versions new file mode 100644 index 00000000..f89125f1 --- /dev/null +++ b/languages/tool-versions @@ -0,0 +1,26 @@ +# asdf list all rust | grep -E '[0-9]' | sort -rV | xargs echo rust +rust beta stable 1.42.0 1.41.1 1.41.0 1.40.0 1.39.0 1.38.0 1.37.0 1.36.0 1.35.0 1.34.2 1.34.1 1.34.0 1.33.0 1.32.0 1.31.1 1.31.0 1.30.1 1.30.0 1.29.2 1.29.1 1.29.0 1.28.0 + +# asdf list all erlang | grep -vE '^R|beta|preview|-rc[0-9]|-dev' | sort -rV | xargs echo erlang +erlang 22.3 22.2.8 22.2.7 22.2.6 22.2.5 22.2.4 22.2.3 22.2.2 22.2.1 22.2 22.1.8.1 22.1.8 22.1.7 22.1.6 22.1.5 22.1.4 22.1.3 22.1.2 22.1.1 22.1 22.0.7 22.0.6 22.0.5 22.0.4 22.0.3 22.0.2 22.0.1 22.0 21.3.8.14 21.3.8.13 21.3.8.12 21.3.8.11 21.3.8.10 21.3.8.9 21.3.8.8 21.3.8.7 21.3.8.6 21.3.8.5 21.3.8.4 21.3.8.3 21.3.8.2 21.3.8.1 21.3.8 21.3.7.1 21.3.7 21.3.6 21.3.5 21.3.4 21.3.3 21.3.2 21.3.1 21.3 21.2.7 21.2.6 21.2.5 21.2.4 21.2.3 21.2.2 21.2.1 21.2 21.1.4 21.1.3 21.1.2 21.1.1 21.1 21.0.9 21.0.8 21.0.7 21.0.6 21.0.5 21.0.4 21.0.3 21.0.2 21.0.1 21.0 20.3.8.26 20.3.8.25 20.3.8.24 20.3.8.23 20.3.8.22 20.3.8.21 20.3.8.20 20.3.8.19 20.3.8.18 20.3.8.17 20.3.8.16 20.3.8.15 20.3.8.14 20.3.8.13 20.3.8.12 20.3.8.11 20.3.8.10 20.3.8.9 20.3.8.8 20.3.8.7 20.3.8.6 20.3.8.5 20.3.8.4 20.3.8.3 20.3.8.2 20.3.8.1 20.3.8 20.3.7 20.3.6 20.3.5 20.3.4 20.3.3 20.3.2.1 20.3.2 20.3.1 20.3 20.2.4 20.2.3 20.2.2 20.2.1 20.2.0.1 20.2 20.1.7.1 20.1.7 20.1.6 20.1.5 20.1.4 20.1.3 20.1.2 20.1.1 20.1 20.0.5 20.0.4 20.0.3 20.0.2 20.0.1 20.0 19.3.6.13 19.3.6.12 19.3.6.11 19.3.6.10 19.3.6.9 19.3.6.8 19.3.6.7 19.3.6.6 19.3.6.5 19.3.6.4 19.3.6.3 19.3.6.2 19.3.6.1 19.3.6 19.3.5 19.3.4 19.3.3 19.3.2 19.3.1 19.3 19.2.3.1 19.2.3 19.2.2 19.2.1 19.2 19.1.6.1 19.1.6 19.1.5 19.1.4 19.1.3 19.1.2 19.1.1 19.1 19.0.7 19.0.6 19.0.5 19.0.4 19.0.3 19.0.2 19.0.1 19.0 18.3.4.11 18.3.4.10 18.3.4.9 18.3.4.8 18.3.4.7 18.3.4.6 18.3.4.5 18.3.4.4 18.3.4.3 18.3.4.2 18.3.4.1.1 18.3.4.1 18.3.4 18.3.3 18.3.2 18.3.1 18.3 18.2.4.1 18.2.4.0.1 18.2.4 18.2.3 18.2.2 18.2.1 18.2 18.1.5 18.1.4 18.1.3 18.1.2 18.1.1 18.1 18.0.3 18.0.2 18.0.1 18.0 17.5.6.10 17.5.6.9 17.5.6.8 17.5.6.7 17.5.6.6 17.5.6.5 17.5.6.4 17.5.6.3 17.5.6.2 17.5.6.1 17.5.6 17.5.5 17.5.4 17.5.3 17.5.2 17.5.1 17.5 17.4.1 17.4 17.3.4 17.3.3 17.3.2 17.3.1 17.3 17.2.2 17.2.1 17.2 17.1.2 17.1.1 17.1 17.0.2 17.0.1 17.0 + +# asdf list all elixir | grep -vE 'beta|preview|-rc[0-9]|-dev|master' | sort -Vr | xargs echo elixir +elixir 1.10.2-otp-22 1.10.2-otp-21 1.10.2 1.10.1-otp-22 1.10.1-otp-21 1.10.1 1.10.0-rc.0-otp-22 1.10.0-rc.0-otp-21 1.10.0-rc.0 1.10.0-otp-22 1.10.0-otp-21 1.10.0 1.9.4-otp-22 1.9.4-otp-21 1.9.4-otp-20 1.9.4 1.9.3-otp-22 1.9.3-otp-21 1.9.3-otp-20 1.9.3 1.9.2-otp-22 1.9.2-otp-21 1.9.2-otp-20 1.9.2 1.9.1-otp-22 1.9.1-otp-21 1.9.1-otp-20 1.9.1 1.9.0-rc.0-otp-22 1.9.0-rc.0-otp-21 1.9.0-rc.0-otp-20 1.9.0-rc.0 1.9.0-otp-22 1.9.0-otp-21 1.9.0-otp-20 1.9.0 1.8.2-otp-22 1.8.2-otp-21 1.8.2-otp-20 1.8.2 1.8.1-otp-22 1.8.1-otp-21 1.8.1-otp-20 1.8.1 1.8.0-rc.1-otp-22 1.8.0-rc.1-otp-21 1.8.0-rc.1-otp-20 1.8.0-rc.1 1.8.0-rc.0-otp-22 1.8.0-rc.0-otp-21 1.8.0-rc.0-otp-20 1.8.0-rc.0 1.8.0-otp-22 1.8.0-otp-21 1.8.0-otp-20 1.8.0 1.7.4-otp-22 1.7.4-otp-21 1.7.4-otp-20 1.7.4-otp-19 1.7.4 1.7.3-otp-22 1.7.3-otp-21 1.7.3-otp-20 1.7.3-otp-19 1.7.3 1.7.2-otp-22 1.7.2-otp-21 1.7.2-otp-20 1.7.2-otp-19 1.7.2 1.7.1-otp-22 1.7.1-otp-21 1.7.1-otp-20 1.7.1-otp-19 1.7.1 1.7.0-rc.1-otp-22 1.7.0-rc.1-otp-21 1.7.0-rc.1-otp-20 1.7.0-rc.1-otp-19 1.7.0-rc.1 1.7.0-rc.0-otp-22 1.7.0-rc.0-otp-21 1.7.0-rc.0-otp-20 1.7.0-rc.0-otp-19 1.7.0-rc.0 1.7.0-otp-22 1.7.0-otp-21 1.7.0-otp-20 1.7.0-otp-19 1.7.0 1.6.6-otp-21 1.6.6-otp-20 1.6.6-otp-19 1.6.6 1.6.5-otp-21 1.6.5-otp-20 1.6.5-otp-19 1.6.5 1.6.4-otp-20 1.6.4-otp-19 1.6.4 1.6.3-otp-20 1.6.3-otp-19 1.6.3 1.6.2-otp-20 1.6.2-otp-19 1.6.2 1.6.1-otp-20 1.6.1-otp-19 1.6.1 1.6.0-rc.1-otp-20 1.6.0-rc.1-otp-19 1.6.0-rc.1 1.6.0-rc.0-otp-20 1.6.0-rc.0-otp-19 1.6.0-rc.0 1.6.0-otp-20 1.6.0-otp-19 1.6.0 1.5.3-otp-20 1.5.3-otp-19 1.5.3-otp-18 1.5.3 1.5.2-otp-20 1.5.2-otp-19 1.5.2-otp-18 1.5.2 1.5.1-otp-20 1.5.1-otp-19 1.5.1-otp-18 1.5.1 1.5.0-rc.2-otp-20 1.5.0-rc.2-otp-19 1.5.0-rc.2-otp-18 1.5.0-rc.2 1.5.0-rc.1-otp-20 1.5.0-rc.1-otp-19 1.5.0-rc.1-otp-18 1.5.0-rc.1 1.5.0-rc.0-otp-20 1.5.0-rc.0-otp-19 1.5.0-rc.0-otp-18 1.5.0-rc.0 1.5.0-otp-20 1.5.0-otp-19 1.5.0-otp-18 1.5.0 1.4.5-otp-20 1.4.5-otp-19 1.4.5-otp-18 1.4.5 1.4.4-otp-19 1.4.4-otp-18 1.4.4 1.4.3-otp-19 1.4.3-otp-18 1.4.3 1.4.2-otp-19 1.4.2-otp-18 1.4.2 1.4.1-otp-19 1.4.1-otp-18 1.4.1 1.4.0-rc.1-otp-20 1.4.0-rc.1-otp-19 1.4.0-rc.1-otp-18 1.4.0-rc.1 1.4.0-rc.0-otp-20 1.4.0-rc.0-otp-19 1.4.0-rc.0-otp-18 1.4.0-rc.0 1.4.0-otp-19 1.4.0-otp-18 1.4.0 1.3.4-otp-19 1.3.4-otp-18 1.3.4 1.3.3-otp-19 1.3.3-otp-18 1.3.3 1.3.2-otp-19 1.3.2-otp-18 1.3.2 1.3.1-otp-19 1.3.1-otp-18 1.3.1 1.3.0-rc.1-otp-19 1.3.0-rc.1-otp-18 1.3.0-rc.1 1.3.0-rc.0-otp-19 1.3.0-rc.0-otp-18 1.3.0-rc.0 1.3.0-otp-19 1.3.0-otp-18 1.3.0 1.2.6-otp-18 1.2.6 1.2.5-otp-18 1.2.5 1.2.4-otp-18 1.2.4 1.2.3-otp-18 1.2.3 1.2.2-otp-18 1.2.2 1.2.1-otp-18 1.2.1 1.2.0-rc.1-otp-18 1.2.0-rc.1 1.2.0-rc.0-otp-18 1.2.0-rc.0 1.2.0-otp-18 1.2.0 1.1.1-otp-18 1.1.1-otp-17 1.1.1 1.1.0-rc.0-otp-18 1.1.0-rc.0-otp-17 1.1.0-rc.0 1.1.0-otp-18 1.1.0-otp-17 1.1.0 1.0.5-otp-18 1.0.5-otp-17 1.0.5 1.0.4-otp-17 1.0.4 1.0.3-otp-17 1.0.3 1.0.2-otp-17 1.0.2 1.0.1-otp-17 1.0.1 1.0.0-otp-17 1.0.0 0.15.1 0.15.0 0.14.3 0.14.2 0.14.1 0.14.0 0.13.3 0.13.2 0.13.1 0.13.0 0.12.5 0.12.4 + +# asdf list all ruby | grep -vE 'truffle|rbx|ree|jruby|preview|-rc[0-9]|mruby|maglev|-dev' | sort -rV | xargs echo ruby +ruby 3 2 2.8.0 2.7.1 2.7.0 2.6.5 2.6.4 2.6.3 2.6.2 2.6.1 2.6.0 2.5.7 2.5.6 2.5.5 2.5.4 2.5.3 2.5.2 2.5.1 2.5.0 2.4.9 2.4.8 2.4.7 2.4.6 2.4.5 2.4.4 2.4.3 2.4.2 2.4.1 2.4.0 2.3.8 2.3.7 2.3.6 2.3.5 2.3.4 2.3.3 2.3.2 2.3.1 2.3.0 2.2.10 2.2.9 2.2.8 2.2.7 2.2.6 2.2.5 2.2.4 2.2.3 2.2.2 2.2.1 2.2.0 2.1.10 2.1.9 2.1.8 2.1.7 2.1.6 2.1.5 2.1.4 2.1.3 2.1.2 2.1.1 2.1.0 2.0.0-p648 2.0.0-p647 2.0.0-p645 2.0.0-p643 2.0.0-p598 2.0.0-p594 2.0.0-p576 2.0.0-p481 2.0.0-p451 2.0.0-p353 2.0.0-p247 2.0.0-p195 2.0.0-p0 1.9.3-p551 1.9.3-p550 1.9.3-p547 1.9.3-p545 1.9.3-p484 1.9.3-p448 1.9.3-p429 1.9.3-p426 1.9.3-p392 1.9.3-p385 1.9.3-p374 1.9.3-p362 1.9.3-p327 1.9.3-p286 1.9.3-p194 1.9.3-p125 1.9.3-p105 1.9.3-p0 1.9.2-p330 1.9.2-p326 1.9.2-p320 1.9.2-p318 1.9.2-p290 1.9.2-p180 1.9.2-p136 1.9.2-p0 1.9.1-p431 1.9.1-p430 1.9.1-p429 1.9.1-p378 1.9.1-p376 1.9.1-p243 1.9.1-p129 1.9.1-p0 1.9.0-5 1.9.0-4 1.9.0-3 1.9.0-2 1.9.0-1 1.9.0-0 1.8.7-p375 1.8.7-p374 1.8.7-p373 1.8.7-p371 1.8.7-p370 1.8.7-p358 1.8.7-p357 1.8.7-p352 1.8.7-p334 1.8.7-p330 1.8.7-p302 1.8.7-p301 1.8.7-p299 1.8.7-p249 1.8.7-p248 1.8.7-p174 1.8.7-p173 1.8.7-p160 1.8.7-p72 1.8.7-p71 1.8.7-p22 1.8.7-p17 1.8.7 1.8.6-p420 1.8.6-p399 1.8.6-p398 1.8.6-p388 1.8.6-p383 1.8.6-p369 1.8.6-p368 1.8.6-p287 1.8.6-p286 1.8.6-p230 1.8.6-p114 1.8.6-p111 1.8.6-p110 1.8.6-p36 1.8.6 1.8.5-p231 1.8.5-p115 1.8.5-p114 1.8.5-p113 1.8.5-p52 + +# asdf list all crystal | sort -rV | xargs echo crystal +crystal 0.33.0 0.32.1 0.32.0 0.31.1 0.31.0 0.30.1 0.30.0 0.29.0 0.28.0 0.27.2 0.27.1 0.27.0 0.26.1 0.26.0 0.25.1 0.25.0 0.24.2 0.24.1 0.24.0 0.23.1 0.23.0 0.22.0 0.21.1 0.21.0 0.20.5 0.20.4 0.20.3 0.20.1 0.20.0 0.19.4 + +# asdf list all golang | grep -vE '(rc|beta)[0-9]' |sort -rV | xargs echo golang +golang 1.14.1 1.14 1.13.9 1.13.8 1.13.7 1.13.6 1.13.5 1.13.4 1.13.3 1.13.2 1.13.1 1.13 1.12.17 1.12.16 1.12.15 1.12.14 1.12.13 1.12.12 1.12.11 1.12.10 1.12.9 1.12.8 1.12.7 1.12.6 1.12.5 1.12.4 1.12.3 1.12.2 1.12.1 1.12 1.11.13 1.11.12 1.11.11 1.11.10 1.11.9 1.11.8 1.11.7 1.11.6 1.11.5 1.11.4 1.11.3 1.11.2 1.11.1 1.11 1.10.8 1.10.7 1.10.6 1.10.5 1.10.4 1.10.3 1.10.2 1.10.1 1.10 1.9.7 1.9.6 1.9.5 1.9.4 1.9.3 1.9.2 1.9.1 1.9 1.8.7 1.8.6 1.8.5 1.8.4 1.8.3 1.8.2 1.8.1 1.8 1.7.6 1.7.5 1.7.4 1.7.3 1.7.2 1.7.1 1.7 1.6.4 1.6.3 1.6.2 1.6.1 1.6 1.5.4 1.5.3 1.5.2 1.5.1 1.5 1.4.3 1.4.2 1.4.1 1.4 1.3.3 1.3.2 1.3.1 1.3 1.2.2 + +# asdf list all java | grep adopt-openjdk | grep -vE 'large-heap|openj9' | sort -Vr | xargs echo java +java adopt-openjdk-13.0.2+8 adopt-openjdk-13.0.1+9 adopt-openjdk-13+33 adopt-openjdk-12.0.2+10 adopt-openjdk-12.0.1+12 adopt-openjdk-12+33 adopt-openjdk-11.0.6+10 adopt-openjdk-11.0.5+10 adopt-openjdk-11.0.4+11 adopt-openjdk-11.0.3+7 adopt-openjdk-11.0.2+9 adopt-openjdk-11.0.2+7 adopt-openjdk-11.0.1+13 adopt-openjdk-11+28 adopt-openjdk-10.0.2+13.1 adopt-openjdk-9.0.4+11 adopt-openjdk-9+181 adopt-openjdk-8u242-b08 adopt-openjdk-8u232-b09 adopt-openjdk-8u222-b10 adopt-openjdk-8u212-b04 adopt-openjdk-8u212-b03 adopt-openjdk-8u202-b08 adopt-openjdk-8u192-b12 adopt-openjdk-8u181-b13 + +# asdf list all nodejs | sort -Vr | head -n100 | xargs echo nodejs +nodejs 13.12.0 13.11.0 13.10.1 13.10.0 13.9.0 13.8.0 13.7.0 13.6.0 13.5.0 13.4.0 13.3.0 13.2.0 13.1.0 13.0.1 13.0.0 12.16.1 12.16.0 12.15.0 12.14.1 12.14.0 12.13.1 12.13.0 12.12.0 12.11.1 12.11.0 12.10.0 12.9.1 12.9.0 12.8.1 12.8.0 12.7.0 12.6.0 12.5.0 12.4.0 12.3.1 12.3.0 12.2.0 12.1.0 12.0.0 11.15.0 11.14.0 11.13.0 11.12.0 11.11.0 11.10.1 11.10.0 11.9.0 11.8.0 11.7.0 11.6.0 11.5.0 11.4.0 11.3.0 11.2.0 11.1.0 11.0.0 10.19.0 10.18.1 10.18.0 10.17.0 10.16.3 10.16.2 10.16.1 10.16.0 10.15.3 10.15.2 10.15.1 10.15.0 10.14.2 10.14.1 10.14.0 10.13.0 10.12.0 10.11.0 10.10.0 10.9.0 10.8.0 10.7.0 10.6.0 10.5.0 10.4.1 10.4.0 10.3.0 10.2.1 10.2.0 10.1.0 10.0.0 9.11.2 9.11.1 9.11.0 9.10.1 9.10.0 9.9.0 9.8.0 9.7.1 9.7.0 9.6.1 9.6.0 9.5.0 9.4.0 + +# asdf list all yarn | sort -Vr | grep -v -- - | xargs echo yarn +yarn 1.22.4 1.22.3 1.22.2 1.22.1 1.22.0 1.21.1 1.21.0 1.20.0 1.19.2 1.19.1 1.19.0 1.18.0 1.17.3 1.17.2 1.17.1 1.17.0 1.16.0 1.15.2 1.15.1 1.15.0 1.14.0 1.13.0 1.12.3 1.12.2 1.12.1 1.12.0 1.11.1 1.11.0 1.10.1 1.10.0 1.9.4 1.9.3 1.9.2 1.9.1 1.9.0 1.8.0 1.7.0 1.6.0 1.5.1 1.5.0 1.4.1 1.4.0 1.3.2 1.3.1 1.3.0 1.2.1 1.2.0 1.1.0 1.0.2 1.0.1 1.0.0 From 0444b73bd5052e07c3a8ac243d7166dd7a85d864 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Fri, 3 Apr 2020 20:31:46 +1100 Subject: [PATCH 178/234] Remove shell aliases I no longer use (esp `ss`, which conflicts with an actual command) --- shells/common/aliases.sh | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/shells/common/aliases.sh b/shells/common/aliases.sh index 1e513db7..ecfb1ad4 100644 --- a/shells/common/aliases.sh +++ b/shells/common/aliases.sh @@ -1,20 +1,13 @@ which hub &>/dev/null && alias git='hub' -alias ll='ls -lah' -alias l='ls' -alias b='cd -' alias cdr='cd ./$(git rev-parse --show-cdup)' # useful command to find what you should be aliasing: alias profileme="history | awk '{print \$2}' | awk 'BEGIN{FS=\"|\"}{print \$1}' | sort | uniq -c | sort -n | tail -n 20 | sort -nr" -# rails stuff -alias sc="if [ -f script/console ]; then script/console; else script/rails console; fi" -alias ss="if [ -f script/server ]; then script/server; else script/rails server; fi" -alias gen='if [ -f script/generate ]; then script/generate; else script/rails generate; fi' alias webshare='python -c "import SimpleHTTPServer;SimpleHTTPServer.test()"' -alias pubkey="cat $HOME/.ssh/*.pub" +alias pubkeys="cat $HOME/.ssh/*.pub" alias colorslist="set | egrep 'COLOR_\w*'" # lists all the colors alias jsonify='python -mjson.tool' From c77820e8567720aafe9aa9b0a08029e03c403619 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Fri, 3 Apr 2020 20:32:11 +1100 Subject: [PATCH 179/234] Hook into Windows' SSH Agent under WSL This will securely store SSH key in the host system, tied to your user account, will be locked when Windows is locked, and will avoid having to type SSH passphrase in every new window you open. --- shells/common/wsl.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 shells/common/wsl.sh diff --git a/shells/common/wsl.sh b/shells/common/wsl.sh new file mode 100644 index 00000000..8a1d378e --- /dev/null +++ b/shells/common/wsl.sh @@ -0,0 +1,28 @@ +if [ -n ${WSL_DISTRO_NAME:-} ] || grep -sqi microsoft /proc/sys/kernel/osrelease; then + # # Talk to Windows' SSH-Agent when under WSL, using https://github.com/rupor-github/wsl-ssh-agent + # # wsl-ssh-agent started with: + # # + # # wsl-ssh-agent-gui.exe -setenv -envname=WSL_AUTH_SOCK -lemonade=2489;127.0.0.1/24 + # # + # [ -n ${WSL_AUTH_SOCK} ] && export SSH_AUTH_SOCK=${WSL_AUTH_SOCK} + + # Above does not work currently due to WSL1 -> WSL2 turbulence. Workaround below. + # Based on: https://github.com/rupor-github/wsl-ssh-agent/tree/4e08e3fa84380f4d62bfdf607ae6b2c680e1ff3e#wsl-2-compatibility + + # where I installed it (must be on Windows' filesystem) + NPIPERELAY_DIR="/mnt/c/Program Files/WSL-SSH-Agent" + + export SSH_AUTH_SOCK=$HOME/.ssh/agent.sock + + ss -a | grep -q $SSH_AUTH_SOCK + + if [ $? -ne 0 ]; then + rm -f $SSH_AUTH_SOCK + ( + PATH="$NPIPERELAY_DIR:$PATH" + setsid socat \ + UNIX-LISTEN:$SSH_AUTH_SOCK,fork \ + EXEC:"npiperelay.exe -ei -s //./pipe/openssh-ssh-agent",nofork & + ) >/dev/null 2>&1 + fi +fi \ No newline at end of file From 11a193fafa82ec832742ad78656c77d3a5e9ac86 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Mon, 4 May 2020 14:26:54 +1000 Subject: [PATCH 180/234] Load local config --- freshrc | 2 ++ shells/local.bash | 1 + shells/local.zsh | 1 + 3 files changed, 4 insertions(+) create mode 100644 shells/local.bash create mode 100644 shells/local.zsh diff --git a/freshrc b/freshrc index cb13ea46..babbc529 100644 --- a/freshrc +++ b/freshrc @@ -60,6 +60,7 @@ fresh-options --file=~/.zshrc --marker fresh shells/common/\*.sh fresh shells/zsh/\*.zsh fresh shells/zsh/lib/\*.zsh + fresh shells/local.zsh fresh-options fresh-options --file=~/.bashrc --marker @@ -67,6 +68,7 @@ fresh-options --file=~/.bashrc --marker fresh shells/common/\*.sh fresh shells/bash/\*.bash fresh shells/bash/lib/\*.bash + fresh shells/local.bash fresh-options fresh zsh-users/zsh-completions src --file=completion/ diff --git a/shells/local.bash b/shells/local.bash new file mode 100644 index 00000000..b24448f6 --- /dev/null +++ b/shells/local.bash @@ -0,0 +1 @@ +[ -f "$HOME/.local.bash" ] && source "$HOME/.local.bash" \ No newline at end of file diff --git a/shells/local.zsh b/shells/local.zsh new file mode 100644 index 00000000..cb419191 --- /dev/null +++ b/shells/local.zsh @@ -0,0 +1 @@ +[ -f "$HOME/.local.zshrc" ] && source "$HOME/.local.zshrc" From 1fdbb88e66006407e32c7684b14acc05e6215a78 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Mon, 4 May 2020 14:27:37 +1000 Subject: [PATCH 181/234] Re-arrange configuration of local gitconfig --- freshrc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/freshrc b/freshrc index babbc529..85b7528d 100644 --- a/freshrc +++ b/freshrc @@ -38,8 +38,6 @@ fresh-options --file # each file as is fresh --file=~/.git_template/ vcs/git/git_template fresh-options -[ -f ~/.gitconfig.local ] || cp ~/.dotfiles/vcs/git/gitconfig.local ~/.gitconfig.local - fresh editors/vim/init.nvim --file ~/.config/nvim/init.vim fresh-options --file=~/.vimrc --marker='"' @@ -85,6 +83,9 @@ fresh sivel/speedtest-cli speedtest.py --bin=~/bin/speedtest fresh junegunn/fzf . --file=~/.fzf/ +[ -f ~/.gitconfig.local ] || cp ~/.dotfiles/vcs/git/gitconfig.local ~/.gitconfig.local + + fresh_after_build() { # Fix executable bit # https://github.com/freshshell/fresh/issues/159 From bf32c1357dccc21bf563227c88ade877f77771e1 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Mon, 4 May 2020 14:28:15 +1000 Subject: [PATCH 182/234] Configure git credential helper under WSL TODO make this a `git config` command so it is naturally idempodent. --- freshrc | 11 +++++++++++ vcs/git/gitconfig | 1 - 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/freshrc b/freshrc index 85b7528d..4d58bd0f 100644 --- a/freshrc +++ b/freshrc @@ -93,6 +93,17 @@ fresh_after_build() { ~/.fresh/source/junegunn/fzf/install --bin + # If WSL (Windows Subsystem for Linux) + if [ -n ${WSL_DISTRO_NAME:-} ] || grep -sqi microsoft /proc/sys/kernel/osrelease; then + if ! grep -qs '\[credential\]' ~/.gitconfig.local; then + cat >> ~/.gitconfig.local <<-EOF +# https://liamederzeel.com/store-git-credentials-in-wsl/ +[credential] + helper = /mnt/c/Program\\\\ Files/Git/mingw64/libexec/git-core/git-credential-wincred.exe +EOF + fi + fi + # Install Vim plugins if [ -z "${SKIP_VIM_PLUGINS:-}" ]; then vim='vim' diff --git a/vcs/git/gitconfig b/vcs/git/gitconfig index 8b395983..dc362bc7 100644 --- a/vcs/git/gitconfig +++ b/vcs/git/gitconfig @@ -63,7 +63,6 @@ path = .gitconfig.local [credential] username = bjeanes - helper = osxkeychain [diff] algorithm = minimal mnemonicprefix = true From 82e25eb09a2c2a6bd020307975f402dc80ff598d Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Mon, 4 May 2020 14:29:28 +1000 Subject: [PATCH 183/234] Update default tool versions --- languages/tool-versions | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/languages/tool-versions b/languages/tool-versions index f89125f1..cefaf171 100644 --- a/languages/tool-versions +++ b/languages/tool-versions @@ -5,7 +5,7 @@ rust beta stable 1.42.0 1.41.1 1.41.0 1.40.0 1.39.0 1.38.0 1.37.0 1.36.0 1.35.0 erlang 22.3 22.2.8 22.2.7 22.2.6 22.2.5 22.2.4 22.2.3 22.2.2 22.2.1 22.2 22.1.8.1 22.1.8 22.1.7 22.1.6 22.1.5 22.1.4 22.1.3 22.1.2 22.1.1 22.1 22.0.7 22.0.6 22.0.5 22.0.4 22.0.3 22.0.2 22.0.1 22.0 21.3.8.14 21.3.8.13 21.3.8.12 21.3.8.11 21.3.8.10 21.3.8.9 21.3.8.8 21.3.8.7 21.3.8.6 21.3.8.5 21.3.8.4 21.3.8.3 21.3.8.2 21.3.8.1 21.3.8 21.3.7.1 21.3.7 21.3.6 21.3.5 21.3.4 21.3.3 21.3.2 21.3.1 21.3 21.2.7 21.2.6 21.2.5 21.2.4 21.2.3 21.2.2 21.2.1 21.2 21.1.4 21.1.3 21.1.2 21.1.1 21.1 21.0.9 21.0.8 21.0.7 21.0.6 21.0.5 21.0.4 21.0.3 21.0.2 21.0.1 21.0 20.3.8.26 20.3.8.25 20.3.8.24 20.3.8.23 20.3.8.22 20.3.8.21 20.3.8.20 20.3.8.19 20.3.8.18 20.3.8.17 20.3.8.16 20.3.8.15 20.3.8.14 20.3.8.13 20.3.8.12 20.3.8.11 20.3.8.10 20.3.8.9 20.3.8.8 20.3.8.7 20.3.8.6 20.3.8.5 20.3.8.4 20.3.8.3 20.3.8.2 20.3.8.1 20.3.8 20.3.7 20.3.6 20.3.5 20.3.4 20.3.3 20.3.2.1 20.3.2 20.3.1 20.3 20.2.4 20.2.3 20.2.2 20.2.1 20.2.0.1 20.2 20.1.7.1 20.1.7 20.1.6 20.1.5 20.1.4 20.1.3 20.1.2 20.1.1 20.1 20.0.5 20.0.4 20.0.3 20.0.2 20.0.1 20.0 19.3.6.13 19.3.6.12 19.3.6.11 19.3.6.10 19.3.6.9 19.3.6.8 19.3.6.7 19.3.6.6 19.3.6.5 19.3.6.4 19.3.6.3 19.3.6.2 19.3.6.1 19.3.6 19.3.5 19.3.4 19.3.3 19.3.2 19.3.1 19.3 19.2.3.1 19.2.3 19.2.2 19.2.1 19.2 19.1.6.1 19.1.6 19.1.5 19.1.4 19.1.3 19.1.2 19.1.1 19.1 19.0.7 19.0.6 19.0.5 19.0.4 19.0.3 19.0.2 19.0.1 19.0 18.3.4.11 18.3.4.10 18.3.4.9 18.3.4.8 18.3.4.7 18.3.4.6 18.3.4.5 18.3.4.4 18.3.4.3 18.3.4.2 18.3.4.1.1 18.3.4.1 18.3.4 18.3.3 18.3.2 18.3.1 18.3 18.2.4.1 18.2.4.0.1 18.2.4 18.2.3 18.2.2 18.2.1 18.2 18.1.5 18.1.4 18.1.3 18.1.2 18.1.1 18.1 18.0.3 18.0.2 18.0.1 18.0 17.5.6.10 17.5.6.9 17.5.6.8 17.5.6.7 17.5.6.6 17.5.6.5 17.5.6.4 17.5.6.3 17.5.6.2 17.5.6.1 17.5.6 17.5.5 17.5.4 17.5.3 17.5.2 17.5.1 17.5 17.4.1 17.4 17.3.4 17.3.3 17.3.2 17.3.1 17.3 17.2.2 17.2.1 17.2 17.1.2 17.1.1 17.1 17.0.2 17.0.1 17.0 # asdf list all elixir | grep -vE 'beta|preview|-rc[0-9]|-dev|master' | sort -Vr | xargs echo elixir -elixir 1.10.2-otp-22 1.10.2-otp-21 1.10.2 1.10.1-otp-22 1.10.1-otp-21 1.10.1 1.10.0-rc.0-otp-22 1.10.0-rc.0-otp-21 1.10.0-rc.0 1.10.0-otp-22 1.10.0-otp-21 1.10.0 1.9.4-otp-22 1.9.4-otp-21 1.9.4-otp-20 1.9.4 1.9.3-otp-22 1.9.3-otp-21 1.9.3-otp-20 1.9.3 1.9.2-otp-22 1.9.2-otp-21 1.9.2-otp-20 1.9.2 1.9.1-otp-22 1.9.1-otp-21 1.9.1-otp-20 1.9.1 1.9.0-rc.0-otp-22 1.9.0-rc.0-otp-21 1.9.0-rc.0-otp-20 1.9.0-rc.0 1.9.0-otp-22 1.9.0-otp-21 1.9.0-otp-20 1.9.0 1.8.2-otp-22 1.8.2-otp-21 1.8.2-otp-20 1.8.2 1.8.1-otp-22 1.8.1-otp-21 1.8.1-otp-20 1.8.1 1.8.0-rc.1-otp-22 1.8.0-rc.1-otp-21 1.8.0-rc.1-otp-20 1.8.0-rc.1 1.8.0-rc.0-otp-22 1.8.0-rc.0-otp-21 1.8.0-rc.0-otp-20 1.8.0-rc.0 1.8.0-otp-22 1.8.0-otp-21 1.8.0-otp-20 1.8.0 1.7.4-otp-22 1.7.4-otp-21 1.7.4-otp-20 1.7.4-otp-19 1.7.4 1.7.3-otp-22 1.7.3-otp-21 1.7.3-otp-20 1.7.3-otp-19 1.7.3 1.7.2-otp-22 1.7.2-otp-21 1.7.2-otp-20 1.7.2-otp-19 1.7.2 1.7.1-otp-22 1.7.1-otp-21 1.7.1-otp-20 1.7.1-otp-19 1.7.1 1.7.0-rc.1-otp-22 1.7.0-rc.1-otp-21 1.7.0-rc.1-otp-20 1.7.0-rc.1-otp-19 1.7.0-rc.1 1.7.0-rc.0-otp-22 1.7.0-rc.0-otp-21 1.7.0-rc.0-otp-20 1.7.0-rc.0-otp-19 1.7.0-rc.0 1.7.0-otp-22 1.7.0-otp-21 1.7.0-otp-20 1.7.0-otp-19 1.7.0 1.6.6-otp-21 1.6.6-otp-20 1.6.6-otp-19 1.6.6 1.6.5-otp-21 1.6.5-otp-20 1.6.5-otp-19 1.6.5 1.6.4-otp-20 1.6.4-otp-19 1.6.4 1.6.3-otp-20 1.6.3-otp-19 1.6.3 1.6.2-otp-20 1.6.2-otp-19 1.6.2 1.6.1-otp-20 1.6.1-otp-19 1.6.1 1.6.0-rc.1-otp-20 1.6.0-rc.1-otp-19 1.6.0-rc.1 1.6.0-rc.0-otp-20 1.6.0-rc.0-otp-19 1.6.0-rc.0 1.6.0-otp-20 1.6.0-otp-19 1.6.0 1.5.3-otp-20 1.5.3-otp-19 1.5.3-otp-18 1.5.3 1.5.2-otp-20 1.5.2-otp-19 1.5.2-otp-18 1.5.2 1.5.1-otp-20 1.5.1-otp-19 1.5.1-otp-18 1.5.1 1.5.0-rc.2-otp-20 1.5.0-rc.2-otp-19 1.5.0-rc.2-otp-18 1.5.0-rc.2 1.5.0-rc.1-otp-20 1.5.0-rc.1-otp-19 1.5.0-rc.1-otp-18 1.5.0-rc.1 1.5.0-rc.0-otp-20 1.5.0-rc.0-otp-19 1.5.0-rc.0-otp-18 1.5.0-rc.0 1.5.0-otp-20 1.5.0-otp-19 1.5.0-otp-18 1.5.0 1.4.5-otp-20 1.4.5-otp-19 1.4.5-otp-18 1.4.5 1.4.4-otp-19 1.4.4-otp-18 1.4.4 1.4.3-otp-19 1.4.3-otp-18 1.4.3 1.4.2-otp-19 1.4.2-otp-18 1.4.2 1.4.1-otp-19 1.4.1-otp-18 1.4.1 1.4.0-rc.1-otp-20 1.4.0-rc.1-otp-19 1.4.0-rc.1-otp-18 1.4.0-rc.1 1.4.0-rc.0-otp-20 1.4.0-rc.0-otp-19 1.4.0-rc.0-otp-18 1.4.0-rc.0 1.4.0-otp-19 1.4.0-otp-18 1.4.0 1.3.4-otp-19 1.3.4-otp-18 1.3.4 1.3.3-otp-19 1.3.3-otp-18 1.3.3 1.3.2-otp-19 1.3.2-otp-18 1.3.2 1.3.1-otp-19 1.3.1-otp-18 1.3.1 1.3.0-rc.1-otp-19 1.3.0-rc.1-otp-18 1.3.0-rc.1 1.3.0-rc.0-otp-19 1.3.0-rc.0-otp-18 1.3.0-rc.0 1.3.0-otp-19 1.3.0-otp-18 1.3.0 1.2.6-otp-18 1.2.6 1.2.5-otp-18 1.2.5 1.2.4-otp-18 1.2.4 1.2.3-otp-18 1.2.3 1.2.2-otp-18 1.2.2 1.2.1-otp-18 1.2.1 1.2.0-rc.1-otp-18 1.2.0-rc.1 1.2.0-rc.0-otp-18 1.2.0-rc.0 1.2.0-otp-18 1.2.0 1.1.1-otp-18 1.1.1-otp-17 1.1.1 1.1.0-rc.0-otp-18 1.1.0-rc.0-otp-17 1.1.0-rc.0 1.1.0-otp-18 1.1.0-otp-17 1.1.0 1.0.5-otp-18 1.0.5-otp-17 1.0.5 1.0.4-otp-17 1.0.4 1.0.3-otp-17 1.0.3 1.0.2-otp-17 1.0.2 1.0.1-otp-17 1.0.1 1.0.0-otp-17 1.0.0 0.15.1 0.15.0 0.14.3 0.14.2 0.14.1 0.14.0 0.13.3 0.13.2 0.13.1 0.13.0 0.12.5 0.12.4 +elixir 1.10.3-otp-22 1.10.2-otp-22 1.10.2-otp-21 1.10.2 1.10.1-otp-22 1.10.1-otp-21 1.10.1 1.10.0-rc.0-otp-22 1.10.0-rc.0-otp-21 1.10.0-rc.0 1.10.0-otp-22 1.10.0-otp-21 1.10.0 1.9.4-otp-22 1.9.4-otp-21 1.9.4-otp-20 1.9.4 1.9.3-otp-22 1.9.3-otp-21 1.9.3-otp-20 1.9.3 1.9.2-otp-22 1.9.2-otp-21 1.9.2-otp-20 1.9.2 1.9.1-otp-22 1.9.1-otp-21 1.9.1-otp-20 1.9.1 1.9.0-rc.0-otp-22 1.9.0-rc.0-otp-21 1.9.0-rc.0-otp-20 1.9.0-rc.0 1.9.0-otp-22 1.9.0-otp-21 1.9.0-otp-20 1.9.0 1.8.2-otp-22 1.8.2-otp-21 1.8.2-otp-20 1.8.2 1.8.1-otp-22 1.8.1-otp-21 1.8.1-otp-20 1.8.1 1.8.0-rc.1-otp-22 1.8.0-rc.1-otp-21 1.8.0-rc.1-otp-20 1.8.0-rc.1 1.8.0-rc.0-otp-22 1.8.0-rc.0-otp-21 1.8.0-rc.0-otp-20 1.8.0-rc.0 1.8.0-otp-22 1.8.0-otp-21 1.8.0-otp-20 1.8.0 1.7.4-otp-22 1.7.4-otp-21 1.7.4-otp-20 1.7.4-otp-19 1.7.4 1.7.3-otp-22 1.7.3-otp-21 1.7.3-otp-20 1.7.3-otp-19 1.7.3 1.7.2-otp-22 1.7.2-otp-21 1.7.2-otp-20 1.7.2-otp-19 1.7.2 1.7.1-otp-22 1.7.1-otp-21 1.7.1-otp-20 1.7.1-otp-19 1.7.1 1.7.0-rc.1-otp-22 1.7.0-rc.1-otp-21 1.7.0-rc.1-otp-20 1.7.0-rc.1-otp-19 1.7.0-rc.1 1.7.0-rc.0-otp-22 1.7.0-rc.0-otp-21 1.7.0-rc.0-otp-20 1.7.0-rc.0-otp-19 1.7.0-rc.0 1.7.0-otp-22 1.7.0-otp-21 1.7.0-otp-20 1.7.0-otp-19 1.7.0 1.6.6-otp-21 1.6.6-otp-20 1.6.6-otp-19 1.6.6 1.6.5-otp-21 1.6.5-otp-20 1.6.5-otp-19 1.6.5 1.6.4-otp-20 1.6.4-otp-19 1.6.4 1.6.3-otp-20 1.6.3-otp-19 1.6.3 1.6.2-otp-20 1.6.2-otp-19 1.6.2 1.6.1-otp-20 1.6.1-otp-19 1.6.1 1.6.0-rc.1-otp-20 1.6.0-rc.1-otp-19 1.6.0-rc.1 1.6.0-rc.0-otp-20 1.6.0-rc.0-otp-19 1.6.0-rc.0 1.6.0-otp-20 1.6.0-otp-19 1.6.0 1.5.3-otp-20 1.5.3-otp-19 1.5.3-otp-18 1.5.3 1.5.2-otp-20 1.5.2-otp-19 1.5.2-otp-18 1.5.2 1.5.1-otp-20 1.5.1-otp-19 1.5.1-otp-18 1.5.1 1.5.0-rc.2-otp-20 1.5.0-rc.2-otp-19 1.5.0-rc.2-otp-18 1.5.0-rc.2 1.5.0-rc.1-otp-20 1.5.0-rc.1-otp-19 1.5.0-rc.1-otp-18 1.5.0-rc.1 1.5.0-rc.0-otp-20 1.5.0-rc.0-otp-19 1.5.0-rc.0-otp-18 1.5.0-rc.0 1.5.0-otp-20 1.5.0-otp-19 1.5.0-otp-18 1.5.0 1.4.5-otp-20 1.4.5-otp-19 1.4.5-otp-18 1.4.5 1.4.4-otp-19 1.4.4-otp-18 1.4.4 1.4.3-otp-19 1.4.3-otp-18 1.4.3 1.4.2-otp-19 1.4.2-otp-18 1.4.2 1.4.1-otp-19 1.4.1-otp-18 1.4.1 1.4.0-rc.1-otp-20 1.4.0-rc.1-otp-19 1.4.0-rc.1-otp-18 1.4.0-rc.1 1.4.0-rc.0-otp-20 1.4.0-rc.0-otp-19 1.4.0-rc.0-otp-18 1.4.0-rc.0 1.4.0-otp-19 1.4.0-otp-18 1.4.0 1.3.4-otp-19 1.3.4-otp-18 1.3.4 1.3.3-otp-19 1.3.3-otp-18 1.3.3 1.3.2-otp-19 1.3.2-otp-18 1.3.2 1.3.1-otp-19 1.3.1-otp-18 1.3.1 1.3.0-rc.1-otp-19 1.3.0-rc.1-otp-18 1.3.0-rc.1 1.3.0-rc.0-otp-19 1.3.0-rc.0-otp-18 1.3.0-rc.0 1.3.0-otp-19 1.3.0-otp-18 1.3.0 1.2.6-otp-18 1.2.6 1.2.5-otp-18 1.2.5 1.2.4-otp-18 1.2.4 1.2.3-otp-18 1.2.3 1.2.2-otp-18 1.2.2 1.2.1-otp-18 1.2.1 1.2.0-rc.1-otp-18 1.2.0-rc.1 1.2.0-rc.0-otp-18 1.2.0-rc.0 1.2.0-otp-18 1.2.0 1.1.1-otp-18 1.1.1-otp-17 1.1.1 1.1.0-rc.0-otp-18 1.1.0-rc.0-otp-17 1.1.0-rc.0 1.1.0-otp-18 1.1.0-otp-17 1.1.0 1.0.5-otp-18 1.0.5-otp-17 1.0.5 1.0.4-otp-17 1.0.4 1.0.3-otp-17 1.0.3 1.0.2-otp-17 1.0.2 1.0.1-otp-17 1.0.1 1.0.0-otp-17 1.0.0 0.15.1 0.15.0 0.14.3 0.14.2 0.14.1 0.14.0 0.13.3 0.13.2 0.13.1 0.13.0 0.12.5 0.12.4 # asdf list all ruby | grep -vE 'truffle|rbx|ree|jruby|preview|-rc[0-9]|mruby|maglev|-dev' | sort -rV | xargs echo ruby ruby 3 2 2.8.0 2.7.1 2.7.0 2.6.5 2.6.4 2.6.3 2.6.2 2.6.1 2.6.0 2.5.7 2.5.6 2.5.5 2.5.4 2.5.3 2.5.2 2.5.1 2.5.0 2.4.9 2.4.8 2.4.7 2.4.6 2.4.5 2.4.4 2.4.3 2.4.2 2.4.1 2.4.0 2.3.8 2.3.7 2.3.6 2.3.5 2.3.4 2.3.3 2.3.2 2.3.1 2.3.0 2.2.10 2.2.9 2.2.8 2.2.7 2.2.6 2.2.5 2.2.4 2.2.3 2.2.2 2.2.1 2.2.0 2.1.10 2.1.9 2.1.8 2.1.7 2.1.6 2.1.5 2.1.4 2.1.3 2.1.2 2.1.1 2.1.0 2.0.0-p648 2.0.0-p647 2.0.0-p645 2.0.0-p643 2.0.0-p598 2.0.0-p594 2.0.0-p576 2.0.0-p481 2.0.0-p451 2.0.0-p353 2.0.0-p247 2.0.0-p195 2.0.0-p0 1.9.3-p551 1.9.3-p550 1.9.3-p547 1.9.3-p545 1.9.3-p484 1.9.3-p448 1.9.3-p429 1.9.3-p426 1.9.3-p392 1.9.3-p385 1.9.3-p374 1.9.3-p362 1.9.3-p327 1.9.3-p286 1.9.3-p194 1.9.3-p125 1.9.3-p105 1.9.3-p0 1.9.2-p330 1.9.2-p326 1.9.2-p320 1.9.2-p318 1.9.2-p290 1.9.2-p180 1.9.2-p136 1.9.2-p0 1.9.1-p431 1.9.1-p430 1.9.1-p429 1.9.1-p378 1.9.1-p376 1.9.1-p243 1.9.1-p129 1.9.1-p0 1.9.0-5 1.9.0-4 1.9.0-3 1.9.0-2 1.9.0-1 1.9.0-0 1.8.7-p375 1.8.7-p374 1.8.7-p373 1.8.7-p371 1.8.7-p370 1.8.7-p358 1.8.7-p357 1.8.7-p352 1.8.7-p334 1.8.7-p330 1.8.7-p302 1.8.7-p301 1.8.7-p299 1.8.7-p249 1.8.7-p248 1.8.7-p174 1.8.7-p173 1.8.7-p160 1.8.7-p72 1.8.7-p71 1.8.7-p22 1.8.7-p17 1.8.7 1.8.6-p420 1.8.6-p399 1.8.6-p398 1.8.6-p388 1.8.6-p383 1.8.6-p369 1.8.6-p368 1.8.6-p287 1.8.6-p286 1.8.6-p230 1.8.6-p114 1.8.6-p111 1.8.6-p110 1.8.6-p36 1.8.6 1.8.5-p231 1.8.5-p115 1.8.5-p114 1.8.5-p113 1.8.5-p52 @@ -14,7 +14,7 @@ ruby 3 2 2.8.0 2.7.1 2.7.0 2.6.5 2.6.4 2.6.3 2.6.2 2.6.1 2.6.0 2.5.7 2.5.6 2.5.5 crystal 0.33.0 0.32.1 0.32.0 0.31.1 0.31.0 0.30.1 0.30.0 0.29.0 0.28.0 0.27.2 0.27.1 0.27.0 0.26.1 0.26.0 0.25.1 0.25.0 0.24.2 0.24.1 0.24.0 0.23.1 0.23.0 0.22.0 0.21.1 0.21.0 0.20.5 0.20.4 0.20.3 0.20.1 0.20.0 0.19.4 # asdf list all golang | grep -vE '(rc|beta)[0-9]' |sort -rV | xargs echo golang -golang 1.14.1 1.14 1.13.9 1.13.8 1.13.7 1.13.6 1.13.5 1.13.4 1.13.3 1.13.2 1.13.1 1.13 1.12.17 1.12.16 1.12.15 1.12.14 1.12.13 1.12.12 1.12.11 1.12.10 1.12.9 1.12.8 1.12.7 1.12.6 1.12.5 1.12.4 1.12.3 1.12.2 1.12.1 1.12 1.11.13 1.11.12 1.11.11 1.11.10 1.11.9 1.11.8 1.11.7 1.11.6 1.11.5 1.11.4 1.11.3 1.11.2 1.11.1 1.11 1.10.8 1.10.7 1.10.6 1.10.5 1.10.4 1.10.3 1.10.2 1.10.1 1.10 1.9.7 1.9.6 1.9.5 1.9.4 1.9.3 1.9.2 1.9.1 1.9 1.8.7 1.8.6 1.8.5 1.8.4 1.8.3 1.8.2 1.8.1 1.8 1.7.6 1.7.5 1.7.4 1.7.3 1.7.2 1.7.1 1.7 1.6.4 1.6.3 1.6.2 1.6.1 1.6 1.5.4 1.5.3 1.5.2 1.5.1 1.5 1.4.3 1.4.2 1.4.1 1.4 1.3.3 1.3.2 1.3.1 1.3 1.2.2 +golang 1.14.2 1.14.1 1.14 1.13.9 1.13.8 1.13.7 1.13.6 1.13.5 1.13.4 1.13.3 1.13.2 1.13.1 1.13 1.12.17 1.12.16 1.12.15 1.12.14 1.12.13 1.12.12 1.12.11 1.12.10 1.12.9 1.12.8 1.12.7 1.12.6 1.12.5 1.12.4 1.12.3 1.12.2 1.12.1 1.12 1.11.13 1.11.12 1.11.11 1.11.10 1.11.9 1.11.8 1.11.7 1.11.6 1.11.5 1.11.4 1.11.3 1.11.2 1.11.1 1.11 1.10.8 1.10.7 1.10.6 1.10.5 1.10.4 1.10.3 1.10.2 1.10.1 1.10 1.9.7 1.9.6 1.9.5 1.9.4 1.9.3 1.9.2 1.9.1 1.9 1.8.7 1.8.6 1.8.5 1.8.4 1.8.3 1.8.2 1.8.1 1.8 1.7.6 1.7.5 1.7.4 1.7.3 1.7.2 1.7.1 1.7 1.6.4 1.6.3 1.6.2 1.6.1 1.6 1.5.4 1.5.3 1.5.2 1.5.1 1.5 1.4.3 1.4.2 1.4.1 1.4 1.3.3 1.3.2 1.3.1 1.3 1.2.2 # asdf list all java | grep adopt-openjdk | grep -vE 'large-heap|openj9' | sort -Vr | xargs echo java java adopt-openjdk-13.0.2+8 adopt-openjdk-13.0.1+9 adopt-openjdk-13+33 adopt-openjdk-12.0.2+10 adopt-openjdk-12.0.1+12 adopt-openjdk-12+33 adopt-openjdk-11.0.6+10 adopt-openjdk-11.0.5+10 adopt-openjdk-11.0.4+11 adopt-openjdk-11.0.3+7 adopt-openjdk-11.0.2+9 adopt-openjdk-11.0.2+7 adopt-openjdk-11.0.1+13 adopt-openjdk-11+28 adopt-openjdk-10.0.2+13.1 adopt-openjdk-9.0.4+11 adopt-openjdk-9+181 adopt-openjdk-8u242-b08 adopt-openjdk-8u232-b09 adopt-openjdk-8u222-b10 adopt-openjdk-8u212-b04 adopt-openjdk-8u212-b03 adopt-openjdk-8u202-b08 adopt-openjdk-8u192-b12 adopt-openjdk-8u181-b13 From c605d74642ee246cba42687daf29953ded0911d2 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Mon, 4 May 2020 14:29:38 +1000 Subject: [PATCH 184/234] Ignore .vscode directory by default --- vcs/git/gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/vcs/git/gitignore b/vcs/git/gitignore index 3cc96fee..11c683e5 100755 --- a/vcs/git/gitignore +++ b/vcs/git/gitignore @@ -76,3 +76,4 @@ vendor/gems .bash_history Session.vim +.vscode/ From e52ad462c273b0bf82b3709006ac1c2a9b5196fd Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Mon, 4 May 2020 14:34:21 +1000 Subject: [PATCH 185/234] Start root's cron under WSL WSL2 has some uncontrolled memory growth, so a cronjob to clear caches is a prudent way to help until it is resolved. https://github.com/microsoft/WSL/issues/4166#issuecomment-604707989 --- shells/common/wsl.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/shells/common/wsl.sh b/shells/common/wsl.sh index 8a1d378e..a09c8fb9 100644 --- a/shells/common/wsl.sh +++ b/shells/common/wsl.sh @@ -25,4 +25,7 @@ if [ -n ${WSL_DISTRO_NAME:-} ] || grep -sqi microsoft /proc/sys/kernel/osrelease EXEC:"npiperelay.exe -ei -s //./pipe/openssh-ssh-agent",nofork & ) >/dev/null 2>&1 fi + + # https://github.com/microsoft/WSL/issues/4166#issuecomment-604707989 + sudo /etc/init.d/cron start &>/dev/null fi \ No newline at end of file From 12c29a2106fcd55181a5c893d29d9d9cdc089eba Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Mon, 4 May 2020 14:39:19 +1000 Subject: [PATCH 186/234] Only start cron if not already running --- shells/common/wsl.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shells/common/wsl.sh b/shells/common/wsl.sh index a09c8fb9..293876ab 100644 --- a/shells/common/wsl.sh +++ b/shells/common/wsl.sh @@ -26,6 +26,6 @@ if [ -n ${WSL_DISTRO_NAME:-} ] || grep -sqi microsoft /proc/sys/kernel/osrelease ) >/dev/null 2>&1 fi - # https://github.com/microsoft/WSL/issues/4166#issuecomment-604707989 - sudo /etc/init.d/cron start &>/dev/null + # https://github.com/microsoft/WSL/issues/4166#issuecomment-618159162 + [ -z "$(ps -ef | grep cron | grep -v grep)" ] && sudo /etc/init.d/cron start &>/dev/null fi \ No newline at end of file From 6ecd8cf27362eb16556c9c6f28180817e3053df8 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Mon, 4 May 2020 14:39:47 +1000 Subject: [PATCH 187/234] Only check for `WSL` in osrelease https://github.com/microsoft/WSL/issues/423#issuecomment-611086412 --- shells/common/wsl.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/shells/common/wsl.sh b/shells/common/wsl.sh index 293876ab..bdb2d955 100644 --- a/shells/common/wsl.sh +++ b/shells/common/wsl.sh @@ -1,4 +1,4 @@ -if [ -n ${WSL_DISTRO_NAME:-} ] || grep -sqi microsoft /proc/sys/kernel/osrelease; then +if [ -n ${WSL_DISTRO_NAME:-} ] || grep -sqiE 'WSL' /proc/sys/kernel/osrelease; then # # Talk to Windows' SSH-Agent when under WSL, using https://github.com/rupor-github/wsl-ssh-agent # # wsl-ssh-agent started with: # # @@ -18,11 +18,11 @@ if [ -n ${WSL_DISTRO_NAME:-} ] || grep -sqi microsoft /proc/sys/kernel/osrelease if [ $? -ne 0 ]; then rm -f $SSH_AUTH_SOCK - ( + ( PATH="$NPIPERELAY_DIR:$PATH" setsid socat \ UNIX-LISTEN:$SSH_AUTH_SOCK,fork \ - EXEC:"npiperelay.exe -ei -s //./pipe/openssh-ssh-agent",nofork & + EXEC:"npiperelay.exe -ei -s //./pipe/openssh-ssh-agent",nofork & ) >/dev/null 2>&1 fi From f1a146d9b4a92558db9afd39cdc14eb4ca5f7494 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Tue, 26 May 2020 13:33:59 +1000 Subject: [PATCH 188/234] Switch {zsh,fast}-syntax-highlighting --- freshrc | 2 +- shells/zsh/lib/fish.zsh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/freshrc b/freshrc index 4d58bd0f..bb2119c1 100644 --- a/freshrc +++ b/freshrc @@ -74,7 +74,7 @@ fresh freshshell/fresh contrib/completion/fresh-completion.zsh --file=completion fresh thoughtbot/dotfiles zsh/completion/_ag --file=completion/_ag fresh shells/zsh/completions --file=completion/ -fresh zsh-users/zsh-syntax-highlighting . --file=vendor/zsh-syntax-highlighting/ +fresh zdharma/fast-syntax-highlighting . --file=vendor/zsh-fast-syntax-highlighting/ fresh zsh-users/zsh-history-substring-search . --file=vendor/zsh-history-substring-search/ fresh zsh-users/zsh-autosuggestions . --file=vendor/zsh-autosuggestions/ diff --git a/shells/zsh/lib/fish.zsh b/shells/zsh/lib/fish.zsh index 8276c257..7a41fd19 100644 --- a/shells/zsh/lib/fish.zsh +++ b/shells/zsh/lib/fish.zsh @@ -1,6 +1,6 @@ source $FRESH_PATH/build/vendor/zsh-autosuggestions/zsh-autosuggestions.zsh source $FRESH_PATH/build/vendor/zsh-history-substring-search/zsh-history-substring-search.zsh -source $FRESH_PATH/build/vendor/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh +source $FRESH_PATH/build/vendor/zsh-fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh autoload -U up-line-or-beginning-search zle -N up-line-or-beginning-search From f2bc9fe158f6a625bf3fe0207f5378fe0fc42fc1 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Tue, 26 May 2020 13:35:21 +1000 Subject: [PATCH 189/234] Switch ZSH prompt to P10K --- freshrc | 8 +- shells/zsh/lib/prompt.zsh | 126 +-- shells/zsh/p10k-instant-prompt.zsh | 6 + shells/zsh/p10k.zsh | 1532 ++++++++++++++++++++++++++++ 4 files changed, 1546 insertions(+), 126 deletions(-) create mode 100644 shells/zsh/p10k-instant-prompt.zsh create mode 100644 shells/zsh/p10k.zsh diff --git a/freshrc b/freshrc index bb2119c1..a8527c36 100644 --- a/freshrc +++ b/freshrc @@ -45,6 +45,8 @@ fresh-options --file=~/.vimrc --marker='"' fresh-options fresh-options --file=~/.zshrc --marker + fresh shells/zsh/p10k-instant-prompt.zsh + fresh shells/path.sh fresh freshshell/fresh contrib/source-build.sh @@ -56,8 +58,10 @@ fresh-options --file=~/.zshrc --marker fresh junegunn/fzf shell/key-bindings.zsh fresh shells/common/\*.sh - fresh shells/zsh/\*.zsh fresh shells/zsh/lib/\*.zsh + + fresh shells/zsh/p10k.zsh + fresh shells/local.zsh fresh-options @@ -74,6 +78,8 @@ fresh freshshell/fresh contrib/completion/fresh-completion.zsh --file=completion fresh thoughtbot/dotfiles zsh/completion/_ag --file=completion/_ag fresh shells/zsh/completions --file=completion/ +fresh romkatv/powerlevel10k . --file=vendor/powerlevel10k/ + fresh zdharma/fast-syntax-highlighting . --file=vendor/zsh-fast-syntax-highlighting/ fresh zsh-users/zsh-history-substring-search . --file=vendor/zsh-history-substring-search/ fresh zsh-users/zsh-autosuggestions . --file=vendor/zsh-autosuggestions/ diff --git a/shells/zsh/lib/prompt.zsh b/shells/zsh/lib/prompt.zsh index 1693ca64..d9cfeb5f 100644 --- a/shells/zsh/lib/prompt.zsh +++ b/shells/zsh/lib/prompt.zsh @@ -1,125 +1 @@ -pr_reset="%f%u%k%s%b" # reset all codes - -pr_red="%F{red}" -pr_blue="%F{blue}" -pr_green="%F{green}" -pr_grey="%B%F{black}" - -if [ "$(tput colors 2>/dev/null)" -eq 256 ]; then - pr_red="%F{52}" - pr_blue="%F{33}" - pr_green="%F{28}" - pr_grey="%F{59}" -fi - -# VCS configuration -autoload vcs_info -zstyle ':vcs_info:*' enable git hg svn -zstyle ':vcs_info:*' get-revision true -zstyle ':vcs_info:*' formats "(%s) %b@%6>>%i%<<…" "%r" "%R" "%S" -zstyle ':vcs_info:*' actionformats "(%s) %b@%6>>%i%<<…|%U%a%%u" -zstyle ':vcs_info:*' branchformat "%b:%r" -zstyle ':vcs_info:hg*:*' use-simple true -zstyle ':vcs_info:svn:*' formats "(%s) %b:r%i" "%r" -zstyle ':vcs_info:svn:*' branchformat "%b" - -# TODO: -# - Discover root of repo based on full path, not basename (to avoid underlining multiple path components) ($vcs_info_msg_2_) -function prompt_pwd() { - local repo="$vcs_info_msg_1_" - - parts=(${(s:/:)${${PWD}/#${HOME}/\~}}) - - i=0 - while (( i++ < ${#parts} )); do - part="$parts[i]" - if [[ "$part" == "$repo" ]]; then - # if this part of the path represents the repo, - # underline it, and skip truncating the component - parts[i]="%U$part%u" - else - # Shorten the path as long as it isn't the last piece - if [[ "$parts[${#parts}]" != "$part" ]]; then - parts[i]="$part[1,1]" - fi - fi - done - - local prompt_path="${(j:/:)parts}" - if [ "$parts[1]" != "~" ]; then - prompt_path="/$prompt_path" - fi - echo "$prompt_path" -} - - -function prompt_pwd_new() { - local parts path part cwd i=0 - typeset -L path - - - parts=(${(s:/:)${${PWD}/#${HOME}/\~}}) - - while (( i++ < ${#parts} )); do - part="$parts[i]" - - if [[ "$part" == "~" ]]; then - path="$part" - else - # This check is broken because LHS is collapsed, RHS is expanded - if [[ "$path/$part" == "${vcs_info_msg_2_/#${HOME}/~}" ]]; then - part="%U$part%u" - elif [[ "$parts[${#parts}]" != "$part" ]]; then - part="$part[1,1]" - fi - - path="$path/$part" - fi - - # if [[ "$part" == "$repo" ]]; then - # # if this part of the path represents the repo, - # # underline it, and skip truncating the component - # parts[i]="%U$part%u" - # else - # # Shorten the path as long as it isn't the last piece - # if [[ "$parts[${#parts}]" != "$part" ]]; then - # parts[i]="$part[1,1]" - # fi - # fi - done - - echo "$path" -} - -function default_precmd { - if [ -z $INSIDE_EMACS ]; then - vcs_info - - local cwd="$pr_blue`prompt_pwd`$pr_reset" - local char="%0(?.$pr_green.$pr_red)♪$pr_reset" - # local time="$pr_grey⌚ %*$pr_reset" - - local ruby - ruby="$(current_ruby)" - [ "x$ruby" != "x" ] && ruby="❖ $ruby" - - local rev="$pr_grey$vcs_info_msg_0_$pr_reset" - rev="${rev/\(git\)/±}" - rev="${rev/\(hg\)/☿}" - rev="${rev/\(svn\)/↯}" - - local left right - left=($(user_at_host) $cwd) - right=($rev $ruby $time) - - PS1=$left$'\n'$char' ' - RPS1="%{$(echotc UP 1)%}$right%{$(echotc DO 1)%}" - else - PS1="$ " - RPS1="" - fi -} - -function precmd { - default_precmd -} +source $FRESH_PATH/build/vendor/powerlevel10k/powerlevel10k.zsh-theme \ No newline at end of file diff --git a/shells/zsh/p10k-instant-prompt.zsh b/shells/zsh/p10k-instant-prompt.zsh new file mode 100644 index 00000000..a4db0498 --- /dev/null +++ b/shells/zsh/p10k-instant-prompt.zsh @@ -0,0 +1,6 @@ +# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc. +# Initialization code that may require console input (password prompts, [y/n] +# confirmations, etc.) must go above this block; everything else may go below. +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 \ No newline at end of file diff --git a/shells/zsh/p10k.zsh b/shells/zsh/p10k.zsh new file mode 100644 index 00000000..ef2dabba --- /dev/null +++ b/shells/zsh/p10k.zsh @@ -0,0 +1,1532 @@ +# Generated by Powerlevel10k configuration wizard on 2020-05-25 at 13:46 AEST. +# Based on romkatv/powerlevel10k/config/p10k-lean.zsh, checksum 49145. +# Wizard options: nerdfont-complete + powerline, small icons, unicode, lean, 24h time, +# 2 lines, dotted, no frame, darkest-ornaments, sparse, many icons, fluent, +# transient_prompt, instant_prompt=verbose. +# Type `p10k configure` to generate another config. +# +# Config for Powerlevel10k with 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' + + # 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/) + 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) + asdf # asdf version manager (https://github.com/asdf-vm/asdf) + # 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) + #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 + # 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=nerdfont-complete + # 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= + typeset -g POWERLEVEL9K_MULTILINE_NEWLINE_PROMPT_PREFIX= + typeset -g POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX= + # 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=238 + + # 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=238 + # 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= + # Make the icon bold. + typeset -g POWERLEVEL9K_OS_ICON_CONTENT_EXPANSION='${P9K_CONTENT}' + + ################################[ prompt_char: prompt symbol ]################################ + # Green prompt symbol if the last command succeeded. + typeset -g POWERLEVEL9K_PROMPT_CHAR_OK_{VIINS,VICMD,VIVIS,VIOWR}_FOREGROUND=76 + # Red prompt symbol if the last command failed. + typeset -g POWERLEVEL9K_PROMPT_CHAR_ERROR_{VIINS,VICMD,VIVIS,VIOWR}_FOREGROUND=196 + # 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=31 + # 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=103 + # Color of the anchor directory segments. Anchor segments are never shortened. The first + # segment is always an anchor. + typeset -g POWERLEVEL9K_DIR_ANCHOR_FOREGROUND=39 + # Display anchor directory segments in bold. + typeset -g POWERLEVEL9K_DIR_ANCHOR_BOLD=true + # 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-versions + .shorten_folder_marker + .svn + .terraform + CVS + Gemfile.lock + Cargo.toml + composer.json + go.mod + package.json + stack.yaml + shard.yml + ) + 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. + 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 + + # The default icon shown next to non-writable directories when POWERLEVEL9K_DIR_SHOW_WRITABLE is + # set to v2. + # 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 v2 and the current directory is not writable, + # its class gets suffix _NOT_WRITABLE. + # + # 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 class + # WORK or WORK_NOT_WRITABLE. + # + # Simply assigning classes to directories don'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=31 + # typeset -g POWERLEVEL9K_DIR_WORK_SHORTENED_FOREGROUND=103 + # typeset -g POWERLEVEL9K_DIR_WORK_ANCHOR_FOREGROUND=39 + # + # # Styling for WORK_NOT_WRITABLE. + # typeset -g POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_VISUAL_IDENTIFIER_EXPANSION='⭐' + # typeset -g POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_FOREGROUND=31 + # typeset -g POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_SHORTENED_FOREGROUND=103 + # typeset -g POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_ANCHOR_FOREGROUND=39 + # + # 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='\uF126 ' + + # 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='%76F' # green foreground + local modified='%178F' # yellow foreground + local untracked='%39F' # blue foreground + local conflicted='%196F' # red foreground + else + # Styling for incomplete and stale Git status. + local meta='%244F' # grey foreground + local clean='%244F' # grey foreground + local modified='%244F' # grey foreground + local untracked='%244F' # grey foreground + local conflicted='%244F' # grey foreground + fi + + local res + local where # branch or tag + if [[ -n $VCS_STATUS_LOCAL_BRANCH ]]; then + res+="${clean}${(g::)POWERLEVEL9K_VCS_BRANCH_ICON}" + where=${(V)VCS_STATUS_LOCAL_BRANCH} + elif [[ -n $VCS_STATUS_TAG ]]; then + res+="${meta}#" + where=${(V)VCS_STATUS_TAG} + fi + + # If local branch name or tag 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. + (( $#where > 32 )) && where[13,-13]="…" + res+="${clean}${where//\%/%%}" # escape % + + # Display the current Git commit if there is no branch or tag. + # Tip: To always display the current Git commit, remove `[[ -z $where ]] &&` from the next line. + [[ -z $where ]] && 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//\%/%%}" # escape % + 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=76 + typeset -g POWERLEVEL9K_VCS_LOADING_VISUAL_IDENTIFIER_COLOR=244 + # 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 respositories other than Git or when gitstatusd fails and + # Powerlevel10k has to fall back to using vcs_info. + typeset -g POWERLEVEL9K_VCS_CLEAN_FOREGROUND=76 + typeset -g POWERLEVEL9K_VCS_UNTRACKED_FOREGROUND=76 + typeset -g POWERLEVEL9K_VCS_MODIFIED_FOREGROUND=178 + + ##########################[ 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=70 + 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=70 + 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=160 + 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=160 + # 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=160 + 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 longer than 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=101 + # 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=70 + # Custom icon. + # typeset -g POWERLEVEL9K_BACKGROUND_JOBS_VISUAL_IDENTIFIER_EXPANSION='⭐' + + #######################[ direnv: direnv status (https://direnv.net/) ]######################## + # Direnv color. + typeset -g POWERLEVEL9K_DIRENV_FOREGROUND=178 + # 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). + typeset -g POWERLEVEL9K_ASDF_FOREGROUND=66 + + # 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=true + + # 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 diretory, 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=168 + # typeset -g POWERLEVEL9K_ASDF_RUBY_VISUAL_IDENTIFIER_EXPANSION='⭐' + typeset -g POWERLEVEL9K_ASDF_RUBY_SHOW_ON_UPGLOB='*.rb|Gemfile*|*.rake|.ruby-version|*.erb' + + typeset -g POWERLEVEL9K_ASDF_CRYSTAL_FOREGROUND=37 + typeset -g POWERLEVEL9K_ASDF_CRYSTAL_SHOW_ON_UPGLOB='*.cr|shard.yml|shard.lock' + + # Python version from asdf. + typeset -g POWERLEVEL9K_ASDF_PYTHON_FOREGROUND=76 + # typeset -g POWERLEVEL9K_ASDF_PYTHON_VISUAL_IDENTIFIER_EXPANSION='⭐' + typeset -g POWERLEVEL9K_ASDF_PYTHON_SHOW_ON_UPGLOB='*.py|*.pyc|requirements.txt' + + # Go version from asdf. + typeset -g POWERLEVEL9K_ASDF_GOLANG_FOREGROUND=37 + # typeset -g POWERLEVEL9K_ASDF_GOLANG_VISUAL_IDENTIFIER_EXPANSION='⭐' +# typeset -g POWERLEVEL9K_ASDF_GOLANG_SHOW_ON_UPGLOB='*.go' + # use explicit go_version component in p10k + typeset -g POWERLEVEL9K_ASDF_GOLANG_SHOW_ON_UPGLOB=--disabled-- + + # Node.js version from asdf. + typeset -g POWERLEVEL9K_ASDF_NODEJS_FOREGROUND=70 + # typeset -g POWERLEVEL9K_ASDF_NODEJS_VISUAL_IDENTIFIER_EXPANSION='⭐' + typeset -g POWERLEVEL9K_ASDF_NODEJS_SHOW_ON_UPGLOB='package.json|yarn.lock|*.js|*.es6|*.jsx|*.ts|*.tsx' + + typeset -g POWERLEVEL9K_ASDF_YARN_FOREGROUND=70 + typeset -g POWERLEVEL9K_ASDF_YARN_SHOW_ON_UPGLOB='yarn.lock' + + # Rust version from asdf. + typeset -g POWERLEVEL9K_ASDF_RUST_FOREGROUND=37 + # typeset -g POWERLEVEL9K_ASDF_RUST_VISUAL_IDENTIFIER_EXPANSION='⭐' +# typeset -g POWERLEVEL9K_ASDF_RUST_SHOW_ON_UPGLOB='*.rs|Cargo.toml|Cargo.lock' + # use explixit rust_version component in p10k + typeset -g POWERLEVEL9K_ASDF_RUST_SHOW_ON_UPGLOB=--disabled-- + + # .NET Core version from asdf. + typeset -g POWERLEVEL9K_ASDF_DOTNET_CORE_FOREGROUND=134 + # typeset -g POWERLEVEL9K_ASDF_DOTNET_CORE_VISUAL_IDENTIFIER_EXPANSION='⭐' + # typeset -g POWERLEVEL9K_ASDF_DOTNET_SHOW_ON_UPGLOB='*.foo|*.bar' + + # Flutter version from asdf. + typeset -g POWERLEVEL9K_ASDF_FLUTTER_FOREGROUND=38 + # 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=32 + # typeset -g POWERLEVEL9K_ASDF_LUA_VISUAL_IDENTIFIER_EXPANSION='⭐' + # typeset -g POWERLEVEL9K_ASDF_LUA_SHOW_ON_UPGLOB='*.foo|*.bar' + + typeset -g POWERLEVEL9K_ASDF_CLOJURE_FOREGROUND=32 + typeset -g POWERLEVEL9K_ASDF_CLOJURE_SHOW_ON_UPGLOB='*.clj|*.cljs|*.cljx' + + # Java version from asdf. + typeset -g POWERLEVEL9K_ASDF_JAVA_FOREGROUND=32 + # typeset -g POWERLEVEL9K_ASDF_JAVA_VISUAL_IDENTIFIER_EXPANSION='⭐' + typeset -g POWERLEVEL9K_ASDF_JAVA_SHOW_ON_UPGLOB='pom.xml|*.java|*.class|*.jar|'$POWERLEVEL9K_ASDF_CLOJURE_SHOW_ON_UPGLOB + + # Perl version from asdf. + typeset -g POWERLEVEL9K_ASDF_PERL_FOREGROUND=67 + # typeset -g POWERLEVEL9K_ASDF_PERL_VISUAL_IDENTIFIER_EXPANSION='⭐' + # typeset -g POWERLEVEL9K_ASDF_PERL_SHOW_ON_UPGLOB='*.foo|*.bar' + + # Elixir version from asdf. + typeset -g POWERLEVEL9K_ASDF_ELIXIR_FOREGROUND=129 + # typeset -g POWERLEVEL9K_ASDF_ELIXIR_VISUAL_IDENTIFIER_EXPANSION='⭐' + typeset -g POWERLEVEL9K_ASDF_ELIXIR_SHOW_ON_UPGLOB='*.ex|*.exs|mix.lock' + + # Erlang version from asdf. + typeset -g POWERLEVEL9K_ASDF_ERLANG_FOREGROUND=125 + # typeset -g POWERLEVEL9K_ASDF_ERLANG_VISUAL_IDENTIFIER_EXPANSION='⭐' + typeset -g POWERLEVEL9K_ASDF_ERLANG_SHOW_ON_UPGLOB='*.erl|'$POWERLEVEL9K_ASDF_ELIXIR_SHOW_ON_UPGLOB + + # Postgres version from asdf. + typeset -g POWERLEVEL9K_ASDF_POSTGRES_FOREGROUND=31 + # 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=99 + # 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=172 + # typeset -g POWERLEVEL9K_ASDF_HASKELL_VISUAL_IDENTIFIER_EXPANSION='⭐' + # typeset -g POWERLEVEL9K_ASDF_HASKELL_SHOW_ON_UPGLOB='*.foo|*.bar' + + ##########[ nordvpn: nordvpn connection status, linux only (https://nordvpn.com/) ]########### + # NordVPN connection indicator color. + typeset -g POWERLEVEL9K_NORDVPN_FOREGROUND=39 + # 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='⭐' + + #################[ ranger: ranger shell (https://github.com/ranger/ranger) ]################## + # Ranger shell color. + typeset -g POWERLEVEL9K_RANGER_FOREGROUND=178 + # 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=72 + # 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=34 + # 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=178 + # 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=74 + + # 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=35 + typeset -g POWERLEVEL9K_DISK_USAGE_WARNING_FOREGROUND=220 + typeset -g POWERLEVEL9K_DISK_USAGE_CRITICAL_FOREGROUND=160 + # 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=66 + # Custom icon. + # typeset -g POWERLEVEL9K_RAM_VISUAL_IDENTIFIER_EXPANSION='⭐' + + #####################################[ swap: used swap ]###################################### + # Swap color. + typeset -g POWERLEVEL9K_SWAP_FOREGROUND=96 + # 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=66 + # Load color when load is between 50% and 70%. + typeset -g POWERLEVEL9K_LOAD_WARNING_FOREGROUND=178 + # Load color when load is over 70%. + typeset -g POWERLEVEL9K_LOAD_CRITICAL_FOREGROUND=166 + # 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=110 + # 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=110 + # 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=74 + + # 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=178 + # Context color in SSH without privileges. + typeset -g POWERLEVEL9K_CONTEXT_{REMOTE,REMOTE_SUDO}_FOREGROUND=180 + # Default context color (no privileges, no SSH). + typeset -g POWERLEVEL9K_CONTEXT_FOREGROUND=180 + + # 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=37 + # Don't show Python version next to the virtual environment name. + typeset -g POWERLEVEL9K_VIRTUALENV_SHOW_PYTHON_VERSION=false + # Don't show virtualenv if pyenv is already shown. + 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=37 + # Don't show Python version next to the anaconda environment name. + typeset -g POWERLEVEL9K_ANACONDA_SHOW_PYTHON_VERSION=false + # Separate environment name from Python version only with a space. + typeset -g POWERLEVEL9K_ANACONDA_{LEFT,RIGHT}_DELIMITER= + # Custom icon. + # typeset -g POWERLEVEL9K_ANACONDA_VISUAL_IDENTIFIER_EXPANSION='⭐' + + ################[ pyenv: python environment (https://github.com/pyenv/pyenv) ]################ + # Pyenv color. + typeset -g POWERLEVEL9K_PYENV_FOREGROUND=37 + # 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=37 + # 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=70 + # 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=70 + # 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=70 + # 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=70 + # Show node version only when in a directory tree containing package.json. + typeset -g POWERLEVEL9K_NODE_VERSION_PROJECT_ONLY=false + # 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=37 + # 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=37 + # 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=134 + # 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=99 + # 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=161 + # 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=32 + # 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=117 + # 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=168 + # 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=168 + # 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=38 + # 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=32 + # 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=32 + # 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=67 + # 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=99 + # 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='⭐' + + ##########[ haskell_stack: haskell version from stack (https://haskellstack.org/) ]########### + # Haskell color. + typeset -g POWERLEVEL9K_HASKELL_STACK_FOREGROUND=172 + # 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' + + # 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=28 + # 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=134 + # 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) ]################# + # 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 + # '*' DEFAULT) + # + # 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=28 + # 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. + '*' DEFAULT) + typeset -g POWERLEVEL9K_TERRAFORM_DEFAULT_FOREGROUND=38 + # typeset -g POWERLEVEL9K_TERRAFORM_DEFAULT_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' + + # 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=28 + # 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=208 + # 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=70 + # Custom icon. + # typeset -g POWERLEVEL9K_AWS_EB_ENV_VISUAL_IDENTIFIER_EXPANSION='⭐' + + ##########[ 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' + # Azure account name color. + typeset -g POWERLEVEL9K_AZURE_FOREGROUND=32 + # Custom icon. + # typeset -g POWERLEVEL9K_AZURE_VISUAL_IDENTIFIER_EXPANSION='⭐' + + ##########[ 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=32 + + # 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 occurences 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' + + # 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=28 + # 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=32 + # 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 occurences 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=94 + # 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=81 + # 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='(wg|(.*tun))[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=38 + # 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:+ %70F⇣$P9K_IP_RX_RATE}${P9K_IP_TX_RATE:+ %215F⇡$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='e.*' + # Custom icon. + # typeset -g POWERLEVEL9K_IP_VISUAL_IDENTIFIER_EXPANSION='⭐' + + #########################[ proxy: system-wide http/https/ftp proxy ]########################## + # Proxy color. + typeset -g POWERLEVEL9K_PROXY_FOREGROUND=68 + # 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=160 + # Show battery in green when it's charging or fully charged. + typeset -g POWERLEVEL9K_BATTERY_{CHARGING,CHARGED}_FOREGROUND=70 + # Show battery in yellow when it's discharging. + typeset -g POWERLEVEL9K_BATTERY_DISCONNECTED_FOREGROUND=178 + # Battery pictograms going from low to high level of charge. + typeset -g POWERLEVEL9K_BATTERY_STAGES='\uf58d\uf579\uf57a\uf57b\uf57c\uf57d\uf57e\uf57f\uf580\uf581\uf578' + # 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=68 + # 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=(68 68 68 68 68) # <-- 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" + # 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) + # + # All parameters except P9K_WIFI_BARS are extracted from the output of the following command: + # + # /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I + + ####################################[ time: current time ]#################################### + # Current time color. + typeset -g POWERLEVEL9K_TIME_FOREGROUND=66 + # 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 orange text greeting the user. + # + # Type `p10k help segment` for documentation and a more sophisticated example. + function prompt_example() { + p10k segment -f 208 -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=same-dir + + # 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=verbose + + # 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' From 7c0e2d78ae9de95a302042e55b415c67ca2dc2e0 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Tue, 26 May 2020 13:35:50 +1000 Subject: [PATCH 190/234] Remove files unused since the switch to Fresh --- shells/bootstrap.sh | 18 ------------------ shells/zsh/.gitignore | 1 - shells/zsh/zprofile | 2 -- shells/zsh/zshenv | 1 - shells/zsh/zshrc | 15 --------------- 5 files changed, 37 deletions(-) delete mode 100644 shells/bootstrap.sh delete mode 100644 shells/zsh/.gitignore delete mode 100644 shells/zsh/zprofile delete mode 100644 shells/zsh/zshenv delete mode 100644 shells/zsh/zshrc diff --git a/shells/bootstrap.sh b/shells/bootstrap.sh deleted file mode 100644 index 2b10c6a5..00000000 --- a/shells/bootstrap.sh +++ /dev/null @@ -1,18 +0,0 @@ -COMMON_SHELL_FILES="$SHELL_FILES/../common" - -source "$SHELL_FILES/../path.sh" -source "$SHELL_FILES/../tmux.sh" - -CDPATH=".:${HOME}" -if [ -d "$HOME/Code" ]; then - CDPATH="$CDPATH:$HOME/Code" -fi - -source "$SHELL_FILES"/config.*sh - -files=`ls -1 "$COMMON_SHELL_FILES"/*.sh "$SHELL_FILES"/lib/*.*sh` -for file in $files; do - source $file -done - -[ -f "$HOME/.shellrc.local" ] && source "$HOME/.shellrc.local" diff --git a/shells/zsh/.gitignore b/shells/zsh/.gitignore deleted file mode 100644 index b6d6fefa..00000000 --- a/shells/zsh/.gitignore +++ /dev/null @@ -1 +0,0 @@ -oh-my-zsh \ No newline at end of file diff --git a/shells/zsh/zprofile b/shells/zsh/zprofile deleted file mode 100644 index 71ad6d4a..00000000 --- a/shells/zsh/zprofile +++ /dev/null @@ -1,2 +0,0 @@ - -export PATH="$HOME/.cargo/bin:$PATH" diff --git a/shells/zsh/zshenv b/shells/zsh/zshenv deleted file mode 100644 index 33cf15ff..00000000 --- a/shells/zsh/zshenv +++ /dev/null @@ -1 +0,0 @@ -skip_global_compinit=1 diff --git a/shells/zsh/zshrc b/shells/zsh/zshrc deleted file mode 100644 index 371d6629..00000000 --- a/shells/zsh/zshrc +++ /dev/null @@ -1,15 +0,0 @@ -bindkey -e -CURRENT_SHELL="zsh" -SHELL_FILES="${$(readlink $HOME/.zshrc):h}" -DOT_FILES="${SHELL_FILES:h:h}" - -source $DOT_FILES/shells/bootstrap.sh - -[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh - -if type brew &>/dev/null; then - FPATH=$(brew --prefix)/share/zsh/site-functions:$FPATH -fi - -if command fortune >/dev/null; then fortune oblique; fi - From 4f1e7c0797fee12f645d1b6a22a869d93262a9d1 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Tue, 26 May 2020 13:36:12 +1000 Subject: [PATCH 191/234] Update tool versions --- languages/tool-versions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/languages/tool-versions b/languages/tool-versions index cefaf171..7930720a 100644 --- a/languages/tool-versions +++ b/languages/tool-versions @@ -20,7 +20,7 @@ golang 1.14.2 1.14.1 1.14 1.13.9 1.13.8 1.13.7 1.13.6 1.13.5 1.13.4 1.13.3 1.13. java adopt-openjdk-13.0.2+8 adopt-openjdk-13.0.1+9 adopt-openjdk-13+33 adopt-openjdk-12.0.2+10 adopt-openjdk-12.0.1+12 adopt-openjdk-12+33 adopt-openjdk-11.0.6+10 adopt-openjdk-11.0.5+10 adopt-openjdk-11.0.4+11 adopt-openjdk-11.0.3+7 adopt-openjdk-11.0.2+9 adopt-openjdk-11.0.2+7 adopt-openjdk-11.0.1+13 adopt-openjdk-11+28 adopt-openjdk-10.0.2+13.1 adopt-openjdk-9.0.4+11 adopt-openjdk-9+181 adopt-openjdk-8u242-b08 adopt-openjdk-8u232-b09 adopt-openjdk-8u222-b10 adopt-openjdk-8u212-b04 adopt-openjdk-8u212-b03 adopt-openjdk-8u202-b08 adopt-openjdk-8u192-b12 adopt-openjdk-8u181-b13 # asdf list all nodejs | sort -Vr | head -n100 | xargs echo nodejs -nodejs 13.12.0 13.11.0 13.10.1 13.10.0 13.9.0 13.8.0 13.7.0 13.6.0 13.5.0 13.4.0 13.3.0 13.2.0 13.1.0 13.0.1 13.0.0 12.16.1 12.16.0 12.15.0 12.14.1 12.14.0 12.13.1 12.13.0 12.12.0 12.11.1 12.11.0 12.10.0 12.9.1 12.9.0 12.8.1 12.8.0 12.7.0 12.6.0 12.5.0 12.4.0 12.3.1 12.3.0 12.2.0 12.1.0 12.0.0 11.15.0 11.14.0 11.13.0 11.12.0 11.11.0 11.10.1 11.10.0 11.9.0 11.8.0 11.7.0 11.6.0 11.5.0 11.4.0 11.3.0 11.2.0 11.1.0 11.0.0 10.19.0 10.18.1 10.18.0 10.17.0 10.16.3 10.16.2 10.16.1 10.16.0 10.15.3 10.15.2 10.15.1 10.15.0 10.14.2 10.14.1 10.14.0 10.13.0 10.12.0 10.11.0 10.10.0 10.9.0 10.8.0 10.7.0 10.6.0 10.5.0 10.4.1 10.4.0 10.3.0 10.2.1 10.2.0 10.1.0 10.0.0 9.11.2 9.11.1 9.11.0 9.10.1 9.10.0 9.9.0 9.8.0 9.7.1 9.7.0 9.6.1 9.6.0 9.5.0 9.4.0 +nodejs 14.3.0 14.2.0 14.1.0 14.0.0 13.14.0 13.13.0 13.12.0 13.11.0 13.10.1 13.10.0 13.9.0 13.8.0 13.7.0 13.6.0 13.5.0 13.4.0 13.3.0 13.2.0 13.1.0 13.0.1 13.0.0 12.16.1 12.16.0 12.15.0 12.14.1 12.14.0 12.13.1 12.13.0 12.12.0 12.11.1 12.11.0 12.10.0 12.9.1 12.9.0 12.8.1 12.8.0 12.7.0 12.6.0 12.5.0 12.4.0 12.3.1 12.3.0 12.2.0 12.1.0 12.0.0 11.15.0 11.14.0 11.13.0 11.12.0 11.11.0 11.10.1 11.10.0 11.9.0 11.8.0 11.7.0 11.6.0 11.5.0 11.4.0 11.3.0 11.2.0 11.1.0 11.0.0 10.19.0 10.18.1 10.18.0 10.17.0 10.16.3 10.16.2 10.16.1 10.16.0 10.15.3 10.15.2 10.15.1 10.15.0 10.14.2 10.14.1 10.14.0 10.13.0 10.12.0 10.11.0 10.10.0 10.9.0 10.8.0 10.7.0 10.6.0 10.5.0 10.4.1 10.4.0 10.3.0 10.2.1 10.2.0 10.1.0 10.0.0 9.11.2 9.11.1 9.11.0 9.10.1 9.10.0 9.9.0 9.8.0 9.7.1 9.7.0 9.6.1 9.6.0 9.5.0 9.4.0 # asdf list all yarn | sort -Vr | grep -v -- - | xargs echo yarn yarn 1.22.4 1.22.3 1.22.2 1.22.1 1.22.0 1.21.1 1.21.0 1.20.0 1.19.2 1.19.1 1.19.0 1.18.0 1.17.3 1.17.2 1.17.1 1.17.0 1.16.0 1.15.2 1.15.1 1.15.0 1.14.0 1.13.0 1.12.3 1.12.2 1.12.1 1.12.0 1.11.1 1.11.0 1.10.1 1.10.0 1.9.4 1.9.3 1.9.2 1.9.1 1.9.0 1.8.0 1.7.0 1.6.0 1.5.1 1.5.0 1.4.1 1.4.0 1.3.2 1.3.1 1.3.0 1.2.1 1.2.0 1.1.0 1.0.2 1.0.1 1.0.0 From 98e503a17ee3b922974bc969f671890e5eb64f68 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Tue, 26 May 2020 13:36:21 +1000 Subject: [PATCH 192/234] Abbreviate WSL home dir to ~win Thanks @romkatv![1] [1]: https://github.com/romkatv/powerlevel10k/issues/764#issuecomment-633499665 --- shells/common/wsl.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/shells/common/wsl.sh b/shells/common/wsl.sh index bdb2d955..52b4f141 100644 --- a/shells/common/wsl.sh +++ b/shells/common/wsl.sh @@ -28,4 +28,5 @@ if [ -n ${WSL_DISTRO_NAME:-} ] || grep -sqiE 'WSL' /proc/sys/kernel/osrelease; t # https://github.com/microsoft/WSL/issues/4166#issuecomment-618159162 [ -z "$(ps -ef | grep cron | grep -v grep)" ] && sudo /etc/init.d/cron start &>/dev/null + hash -d win=/mnt/c/Users/me fi \ No newline at end of file From 1db256438881a32ec4278c83d61bb24c4a77ab93 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Tue, 26 May 2020 13:37:48 +1000 Subject: [PATCH 193/234] Switch git pager from diffr[1] to delta[2] [1]: https://github.com/mookid/diffr [2]: https://github.com/dandavison/delta --- vcs/git/gitconfig | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/vcs/git/gitconfig b/vcs/git/gitconfig index dc362bc7..11d75fb7 100644 --- a/vcs/git/gitconfig +++ b/vcs/git/gitconfig @@ -47,6 +47,14 @@ precomposeunicode = true #editor = vim -u NONE +0 -c 'syntax on' editor = vim +0 -c 'syntax on' + + # # https://github.com/mookid/diffr + # pager = diffr | less -R + + # https://github.com/dandavison/delta + pager = delta --theme='Monokai Extended Bright' +[interactive] + diffFilter = delta --color-only [branch] autosetupmerge = always autosetuprebase = local @@ -90,7 +98,3 @@ prereleaseSuffix = -pre prereleaseSuffix = -alpha prereleaseSuffix = -beta -[pager] - log = diffr | less -R - show = diffr | less -R - diff = diffr | less -R From 8bf8753e22b08c96aedf9bf71106b2c8894091cb Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Tue, 26 May 2020 13:38:39 +1000 Subject: [PATCH 194/234] Update global .gitignore --- vcs/git/gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/vcs/git/gitignore b/vcs/git/gitignore index 11c683e5..7a2552ce 100755 --- a/vcs/git/gitignore +++ b/vcs/git/gitignore @@ -77,3 +77,5 @@ vendor/gems Session.vim .vscode/ +SCRATCH +/.env From 70c04afb1848028b6e48404d849c3a9efaf5ab18 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Tue, 26 May 2020 13:49:54 +1000 Subject: [PATCH 195/234] Disable node_version component and just use asdf Only bypassing ASDF for Rust, because `rustup` can read a toolchain file in a rust project and bypass whatever ASDF has set anyway. --- shells/zsh/p10k.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shells/zsh/p10k.zsh b/shells/zsh/p10k.zsh index ef2dabba..5aabdaf0 100644 --- a/shells/zsh/p10k.zsh +++ b/shells/zsh/p10k.zsh @@ -57,7 +57,7 @@ # 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 + # node_version # node.js version go_version # go version (https://golang.org) rust_version # rustc version (https://www.rust-lang.org) asdf # asdf version manager (https://github.com/asdf-vm/asdf) From 55d7637afb8653c4cb7cdf3055ee14a7b19637b8 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sat, 13 Jun 2020 14:30:36 +1000 Subject: [PATCH 196/234] Fix WSL check Prior to this fix, as implemented it caused a false positive. --- shells/common/wsl.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shells/common/wsl.sh b/shells/common/wsl.sh index 52b4f141..7a1e3cf3 100644 --- a/shells/common/wsl.sh +++ b/shells/common/wsl.sh @@ -1,4 +1,4 @@ -if [ -n ${WSL_DISTRO_NAME:-} ] || grep -sqiE 'WSL' /proc/sys/kernel/osrelease; then +if [ -n "${WSL_DISTRO_NAME:-}" ] || grep -sqiE 'WSL' /proc/sys/kernel/osrelease; then # # Talk to Windows' SSH-Agent when under WSL, using https://github.com/rupor-github/wsl-ssh-agent # # wsl-ssh-agent started with: # # From cce76f853fc83f4d2e6cea96736cd300a69386fe Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sat, 13 Jun 2020 14:31:33 +1000 Subject: [PATCH 197/234] Ignore .tool-versions files from Git, by default --- vcs/git/gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vcs/git/gitignore b/vcs/git/gitignore index 7a2552ce..47802d8a 100755 --- a/vcs/git/gitignore +++ b/vcs/git/gitignore @@ -74,8 +74,8 @@ vendor/gems .local/ *.log .bash_history - Session.vim .vscode/ SCRATCH /.env +.tool-versions From 8eee4d0ca5842f81413380340064cca12e6b8beb Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sat, 13 Jun 2020 14:32:12 +1000 Subject: [PATCH 198/234] Enable auto-formatting in Vim with rustfmt --- editors/vim/vimrc | 1 + 1 file changed, 1 insertion(+) diff --git a/editors/vim/vimrc b/editors/vim/vimrc index 1af6f806..827bd059 100644 --- a/editors/vim/vimrc +++ b/editors/vim/vimrc @@ -144,6 +144,7 @@ let g:ale_fixers = { \ '*': ['remove_trailing_lines', 'trim_whitespace'], \ 'javascript': ['eslint'], \ 'elixir': ['mix_format'], +\ 'rust': ['rustfmt'], \} " Change working directory to .git root From 280d908f170b1198dbe18c6d2729b05767f3cede Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sat, 13 Jun 2020 14:32:29 +1000 Subject: [PATCH 199/234] Erlang/elixir tweaks These were on my old laptop uncommitted so I don't remember why some of these changes were made, but I trust they were probably done for a good reason :) --- editors/vim/vimrc | 2 +- shells/common/exports.sh | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/editors/vim/vimrc b/editors/vim/vimrc index 827bd059..80900c14 100644 --- a/editors/vim/vimrc +++ b/editors/vim/vimrc @@ -504,7 +504,7 @@ nnoremap zS :echo join(reverse(map(synstack(line('.'), col('.')), 'synIDattr(v:v " tooling doesn't negatively affect Phoenix auto-reloading " " https://github.com/phoenixframework/phoenix/issues/1165#issuecomment-437130681 -let $MIX_ENV='editor' +let $MIX_ENV='test' if filereadable(expand('~/.vimrc.local')) source ~/.vimrc.local diff --git a/shells/common/exports.sh b/shells/common/exports.sh index cf9d9522..b6fb351c 100644 --- a/shells/common/exports.sh +++ b/shells/common/exports.sh @@ -13,11 +13,14 @@ fi # Each tool has various work-arounds to make this work, but the simplest thing # (for editors started from the terminal) is to simply change the environment # everything runs under by default. -editor="env MIX_ENV=editor $editor" +editor="env MIX_ENV=test $editor" export EDITOR="$editor -f" export VISUAL="$editor" +# Enable shell history in IEx and Erlang REPLs +export ERL_AFLAGS="-kernel shell_history enabled" + export TERM=xterm-256color export CLICOLOR=1 From 85afb5c2dffc863d3c5824add5c40715bb8aad33 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sun, 23 Aug 2020 11:20:43 +1000 Subject: [PATCH 200/234] [vim] Hide indent lines in FZF panel --- editors/vim/vimrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/editors/vim/vimrc b/editors/vim/vimrc index 80900c14..d23071b1 100644 --- a/editors/vim/vimrc +++ b/editors/vim/vimrc @@ -112,7 +112,7 @@ nmap zg/ (incsearch-fuzzy-stay) Plug 'Yggdroot/indentLine' let g:indentLine_color_term = 239 let g:indentLine_color_gui = '#504945' -let g:indentLine_fileTypeExclude = ['help', 'man', 'startify', 'vimfiler', 'markdown'] +let g:indentLine_fileTypeExclude = ['help', 'man', 'startify', 'vimfiler', 'markdown', 'fzf'] let g:indentLine_char = '┊' " Run a find-and-replace using the last search term From 22477d38a6f90b4e1e31d21577ed02f4ec9a0aec Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sun, 23 Aug 2020 11:21:26 +1000 Subject: [PATCH 201/234] [vim] Use CoC.nvim for Ruby and Rust; disable ALE --- editors/vim/coc-settings.json | 31 +++++++++++++++++++++++++++++++ editors/vim/vimrc | 30 +++++++++++++++++++++++++++--- 2 files changed, 58 insertions(+), 3 deletions(-) create mode 100644 editors/vim/coc-settings.json diff --git a/editors/vim/coc-settings.json b/editors/vim/coc-settings.json new file mode 100644 index 00000000..ce8ec0dc --- /dev/null +++ b/editors/vim/coc-settings.json @@ -0,0 +1,31 @@ +{ + "coc.preferences.formatOnSaveFiletypes": [ + "html", + "json", + "css", + "markdown", + "javascript", + "javascriptreact", + "typescript", + "typescriptreact", + "rust" + ], + "coc.preferences.colorSupport": true, + + "diagnostic.displayByAle": true, + + "suggest.echodocSupport": true, + + "codeLens.separator": "👓", + "codeLens.enable": true, + + "tsserver.enableJavascript": false, + + "solargraph.autoformat": true, + "solargraph.formatting": true, + + "html.autoClosingTags": true, + + "languageserver": { + } +} diff --git a/editors/vim/vimrc b/editors/vim/vimrc index d23071b1..d1efed4a 100644 --- a/editors/vim/vimrc +++ b/editors/vim/vimrc @@ -123,6 +123,21 @@ nnoremap :%s////g Plug 'thinca/vim-visualstar' Plug 'neoclide/coc.nvim', {'tag': '*', 'branch': 'release', 'do': { -> coc#util#install()}} +let g:coc_global_extensions = [ +\ 'coc-actions', +\ 'coc-css', +\ 'coc-highlight', +\ 'coc-html', +\ 'coc-json', +\ 'coc-lists', +\ 'coc-rust-analyzer', +\ 'coc-snippets', +\ 'coc-solargraph', +\ 'coc-tabnine', +\ 'coc-tailwindcss', +\ 'coc-tsserver', +\ 'coc-vimlsp', +\] Plug 'liuchengxu/vim-which-key' ", { 'on': ['WhichKey', 'WhichKey!'] } set timeoutlen=300 @@ -137,15 +152,24 @@ Plug 'nelstrom/vim-textobj-rubyblock', { 'for': 'ruby' } Plug 'gko/vim-coloresque' -Plug 'w0rp/ale' -let g:ale_fix_on_save = 1 +Plug 'dense-analysis/ale' let g:ale_completion_enabled = 1 +let g:ale_fix_on_save = 1 let g:ale_fixers = { \ '*': ['remove_trailing_lines', 'trim_whitespace'], \ 'javascript': ['eslint'], \ 'elixir': ['mix_format'], -\ 'rust': ['rustfmt'], +\ 'rust': [], +\ 'ruby': [], \} +let g:ale_lint_on_save = 1 +let g:ale_linters = { +\ 'rust': [], +\ 'ruby': [], +\} + +" https://github.com/dense-analysis/ale#faq-coc-nvim +let g:ale_disable_lsp = 1 " Change working directory to .git root Plug 'airblade/vim-rooter' From 60426276babd43b9691618a52e74a9f3505cfb25 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sun, 23 Aug 2020 11:21:38 +1000 Subject: [PATCH 202/234] [vim] Fix warning --- editors/vim/vimrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/editors/vim/vimrc b/editors/vim/vimrc index d1efed4a..d54619f7 100644 --- a/editors/vim/vimrc +++ b/editors/vim/vimrc @@ -173,7 +173,7 @@ let g:ale_disable_lsp = 1 " Change working directory to .git root Plug 'airblade/vim-rooter' -let g:rooter_use_lcd = 1 +let g:rooter_cd_cmd="lcd" Plug 'vim-airline/vim-airline' let g:airline_powerline_fonts = 1 From a93500bf6fdebf6724661f72b398decca0d220b4 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sun, 23 Aug 2020 11:22:05 +1000 Subject: [PATCH 203/234] [vim] Add a few plugins - CtrlSF for project-wide find and replace - vim-visual-increment allows numbering a visually-selected column incrementally - vim-visual-multi gives multiple cursors at once allowing for easy refactors of certain kinds --- editors/vim/vimrc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/editors/vim/vimrc b/editors/vim/vimrc index d54619f7..68c89735 100644 --- a/editors/vim/vimrc +++ b/editors/vim/vimrc @@ -181,6 +181,14 @@ let g:airline#extensions#tabline#enabled = 1 let g:airline#extensions#tabline#left_sep = ' ' let g:airline#extensions#tabline#left_alt_sep = '|' +" ^A / ^Z on a column of numbers will increment them in ascending order +" (i.e. a bullett list) +Plug 'triglav/vim-visual-increment' + +Plug 'dyng/ctrlsf.vim' + +Plug 'mg979/vim-visual-multi' + call plug#end() hi Normal ctermbg=none From 121dfecdedacdb8148023ae5e85423c585ea3e0e Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sun, 23 Aug 2020 11:23:33 +1000 Subject: [PATCH 204/234] [vim] Re-use buffers --- editors/vim/vimrc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/editors/vim/vimrc b/editors/vim/vimrc index 68c89735..182c9ce6 100644 --- a/editors/vim/vimrc +++ b/editors/vim/vimrc @@ -303,7 +303,7 @@ syntax on nnoremap tc :set list! list? " Misc - set switchbuf=useopen " Don't re-open already opened buffers + set switchbuf=usetab,newtab " Open new buffers in tab, switch to existing tab if already open set nostartofline " Avoid moving cursor to BOL when jumping around set virtualedit=all " Let cursor move past the last char set whichwrap=b,s,h,l,<,>,[,] @@ -342,7 +342,9 @@ syntax on set wildmode=list:longest,list:full set wildignore+=*.o,*.obj,.git,*.rbc,*.swp -" Directories for swp files + map > + map < + nmap :tabnew " Navigate cursor up/down by lines on screen, not lines in file nmap j gj From aea690dbc4e7bb75579db41f6eeb6c094ac1f6ae Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sun, 23 Aug 2020 11:23:56 +1000 Subject: [PATCH 205/234] [vim] Make default text width wider I _do_ prefer code in narrower style than long lines, but I have been persuaded that 80 characters is too narrow on today's high-DPI, wide-screen monitors. 120 is pushing it in terms of readability nonetheless (lots of research to show that humans have difficulty reading long lines, mostly because progressing to the next line can mean we lose our place). --- editors/vim/vimrc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/editors/vim/vimrc b/editors/vim/vimrc index 182c9ce6..041e9089 100644 --- a/editors/vim/vimrc +++ b/editors/vim/vimrc @@ -515,8 +515,8 @@ set formatoptions+=n " Recognise numbered lists for sake of indenting wrapped co set nojoinspaces " Don't insert 2 spaces after punctuation when joining jines hi ColorColumn guibg=#222222 ctermbg=235 -set colorcolumn=79,120 -set textwidth=79 +set colorcolumn=79,120,150 +set textwidth=119 " Show incremental previews of commands (such as :s[ubstitute]) set inccommand=nosplit From 0367b771db263ddb6439bfa3c5db2eef100c7f10 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sun, 23 Aug 2020 11:26:07 +1000 Subject: [PATCH 206/234] Add global Rubocop config It is based on the one I developed while CTO at Covidence, but with a few additions since then. --- freshrc | 7 + languages/ruby/rubocop.yml | 283 +++++++++++++++++++++++++++++++++++++ 2 files changed, 290 insertions(+) create mode 100644 languages/ruby/rubocop.yml diff --git a/freshrc b/freshrc index a8527c36..2bd259ea 100644 --- a/freshrc +++ b/freshrc @@ -14,6 +14,13 @@ fresh-options --file=~/.ctags fresh-options fresh languages/clojure/lein/profiles.clj --file=~/.lein/profiles.clj + +fresh-options --file=~/.rubocop.yml + # # disabled because it relies on custom cops and specific rubocop versions: + # fresh testdouble/standard config/base.yml + fresh languages/ruby/rubocop.yml +fresh-options + fresh-options --file # each file as is fresh languages/ruby/gemrc fresh languages/ruby/irbrc diff --git a/languages/ruby/rubocop.yml b/languages/ruby/rubocop.yml new file mode 100644 index 00000000..0bae1ad2 --- /dev/null +++ b/languages/ruby/rubocop.yml @@ -0,0 +1,283 @@ +# In general, we should care more about consistency and avoidance of +# bike-shedding than any specific aesthetic choice on code quality. +# +# However, in some cases, the default Rubocop rules merit changing where their +# defaults don't optimally live up to some additional values: +# +# 1. Correctness +# +# If a certain style will generally result in fewer errors, it should be +# preferred. E.g.: using attr_readers instead of @ivars will produce +# noticeable exceptions vs un-noticed nils; prefixed access modifiers to +# method definitions prevent accidental scope changes as methods are moved. +# +# 2. Focused diffs +# +# Trailing commas, aligning relative to indentation level (params, +# conditional assignment, etc), minimising whitespace changes, "flat" module +# namespacing, all produce less whitespace noise in diffs as they change and +# evolve. +# +# 3. Code clarity +# +# Access modifier prefixes and allowing for some flexibility in formatting +# numbers improve the ability to communicate intent and context in code. +# Likewise, choosing whether to use guard clauses or conditionals is a +# matter of readability that a developer can judge better than a linter. +# +# 4. Pragmatism +# +# Formatting code for easy paste-ability into IRB/Pry is a good example of +# this. +# +# 5. Appropriate subjectivity +# +# Certain choices are best made by a human code reviewer, not a linter. +# While consistency is important, it can sometimes be in conflict with +# clarity or other team values. + +AllCops: + TargetRubyVersion: ~ + ExtraDetails: true + +Metrics/AbcSize: + Enabled: false + +# Disable code "length" metrics other than line length, as they are somewhat +# subjective and not directly great measures of code complexity (though are +# often pretty decent trailing indicators) +Metrics/ModuleLength: + Enabled: false +Metrics/ClassLength: + Enabled: false +Metrics/BlockLength: + Enabled: false +Metrics/MethodLength: + Enabled: false + +# Discourage methods with many _unnamed_ arguments (as parameter ordering can +# be confusing), but allow many named arguments. +Metrics/ParameterLists: + CountKeywordArgs: false + +Bundler/OrderedGems: + Enabled: false + +Layout/DefEndAlignment: + AutoCorrect: true + +# An explicit return (e.g. deep within conditionals) can be both clearer and +# more resilient to bugs from refactoring, where the return is no longer in +# tail position of the method. +Style/RedundantReturn: + Enabled: false + +Style/EmptyMethod: + Enabled: false + +# Use trailing method dots, because it maximises paste-ability into REPLs +Layout/DotPosition: + EnforcedStyle: trailing + +Layout/MultilineMethodCallIndentation: + EnforcedStyle: indented + +Layout/FirstHashElementIndentation: + EnforcedStyle: consistent +Layout/FirstArrayElementIndentation: + EnforcedStyle: consistent + +# Prefer: +# +# some_method 'foo', +# 'bar', +# 'baz' +# +# over: +# +# +# some_method 'foo', +# 'bar', +# 'baz' +# +# because renaming a method reduce irrelevant indentation changes. +# +# Generally, put positional arguments on the first line, and kwargs on +# subsequent lines, but this isn't universally the best choice. +# +# Better yet, if parameters must be spread over multiple lines, prefer the +# following (for which there is not a rule): +# +# some_method( +# 'foo', +# 'bar', +# 'baz', +# ) +# +Layout/ParameterAlignment: + EnforcedStyle: with_fixed_indentation + +# Encourage trailing commas on multi-line lists to allow easy re-ordering and +# clearer diffs on changes. +Style/TrailingCommaInArrayLiteral: + EnforcedStyleForMultiline: consistent_comma +Style/TrailingCommaInHashLiteral: + EnforcedStyleForMultiline: consistent_comma + +# This cop does not work consistently and often interprets non-multi-line calls +# as multi-line adding commas where it shouldn't! Since argument lists are +# generally fixed length and rarely re-ordered, the arguments above for +# hash/array literal commas is not as strong and we will instead never have +# trailing commas in method calls. +Style/TrailingCommaInArguments: + EnforcedStyleForMultiline: no_comma + +# The "new_line" style for this is close to what we want, but it behaves poorly +# in cases where an argument is an array or hash and is spread across multiple +# lines. +Layout/MultilineMethodCallBraceLayout: + Enabled: false + +# Rewrite long lines +Layout/LineLength: + Enabled: true + AutoCorrect: true + +# In-lining access modifiers removes risk of accidentally changing access level +# when re-ordering methods and improves clarity about method access +Style/AccessModifierDeclarations: + EnforcedStyle: inline + +# It is better to have deterministic booleans in some cases, and `!!` is the +# most precise way to coerce truthy values (`!x.nil?` is NOT the same thing). +Style/DoubleNegation: + Enabled: false + +# Prefer: +# +# foo = +# if foo? +# bar +# else +# baz +# end +# +# over alternatives, as it offers the right balance between: consistent +# indentation, minimising unnecessary diff churn (e.g. when renaming the +# variable), and shorter line length. +Layout/MultilineAssignmentLayout: + Enabled: true +Layout/EndAlignment: + EnforcedStyleAlignWith: variable + +Lint/AmbiguousBlockAssociation: + Exclude: + # Describe blocks in particular can be quite large + - '**/*_spec.rb' + +# Well-named classes are more important than documentation +Style/Documentation: + Enabled: false + +Style/BlockDelimiters: + AutoCorrect: false # Best caught in code review + EnforcedStyle: semantic + BracesRequiredMethods: ['sig'] # Sorbet + IgnoredMethods: ['expect', 'let', 'let!', 'subject', 'it', 'fit', 'xit', 'before', 'after'] + Exclude: + - '**/*_spec.rb' + +# Prefer namespaced class definitions on single line to: +# +# 1. allow renaming/re-organizing namespaces without superfluous diffs full of +# whitespace changes; +# 3. have consistent consant lookup, relative to self or top-level +Style/ClassAndModuleChildren: + EnforcedStyle: compact + +# Don't autocorrect to allow alternative underscoring, +# ie 2017_12_25 +Style/NumericLiterals: + Enabled: true + AutoCorrect: false + +# Leave it to the coder to make this decision +Style/GuardClause: + Enabled: false + +# Default style prefers usage of a global function (Kernel#format). % is "ugly" +# and a named method would be preferred, but not over a global which may be +# overridden in the current class or not available (e.g. in BasicObject) +Style/FormatString: + EnforcedStyle: 'percent' + +# Disable this performance optimization - it can make the code less clear, and +# the =~ operator introduces global variables +#Performance/RedundantMatch: +# Enabled: false + +# We have several comments discussing unicode normalization. This rule doesn't +# particularly seem useful for code quality or team practices, so disabling. +Style/AsciiComments: + Enabled: false + +# An explicit self can provide clarity in some situations, even if technically +# redundant. Appropriate usage of self is better caught in code review by +# peers. +Style/RedundantSelf: + Enabled: false + +# A specialized exception class will take one or more arguments and construct +# the message from it. Both variants make sense. +Style/RaiseArgs: + Enabled: false + +# Consistency is best, so since we definitely need double quotes often, let's +# just use them everywhere. +Style/StringLiterals: + EnforcedStyle: 'double_quotes' + +# This feels subjective and best left to code review to determine what is +# suitable on a case by case basis. +Style/EmptyCaseCondition: + Enabled: false + +# Just because you _can_ fix a conditional on the same line, doesn't mean you +# should. Postfix conditionals are great for guards and other simple cases, +# but in other cases this can obscure intent. +Style/IfUnlessModifier: + Enabled: false + +# This doesn't take into account sorbet typed: comments +Layout/EmptyLineAfterMagicComment: + Enabled: false + +Layout/SpaceInsideHashLiteralBraces: + EnforcedStyle: no_space + EnforcedStyleForEmptyBraces: no_space + +Style/FrozenStringLiteralComment: + AutoCorrect: true + Enabled: false + +# Ideally we'd have a rule here with more options as this is not perfect +# either, but this is added to prevent situations such as: +# +# validate :email, +# presence: true, +# email: true +# +# Instead: +# +# validate :email, +# presence: true, +# email: true +# +# But ideally: +# +# validate :email, { +# presence: true, +# email: true +# } +Layout/ArgumentAlignment: + EnforcedStyle: with_fixed_indentation From b3b9ee4dcca7802bb23f780de7898c4dc566d9ec Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sun, 23 Aug 2020 11:27:51 +1000 Subject: [PATCH 207/234] Hard-code .dotfiles path Before I switched to Fresh, I assembled my dotfiles with my own script that ensured this was set, but it is no longer set. I don't need the dot files directory to be customisable, so I'll just hard-code the path --- shells/bash/bashrc | 2 +- shells/bash/config.bash | 2 +- shells/bash/lib/50_completions.bash | 3 +-- shells/common/functions.sh | 2 +- shells/path.sh | 2 +- 5 files changed, 5 insertions(+), 6 deletions(-) diff --git a/shells/bash/bashrc b/shells/bash/bashrc index 6e4bf657..0010795f 100644 --- a/shells/bash/bashrc +++ b/shells/bash/bashrc @@ -2,4 +2,4 @@ CURRENT_SHELL="bash" SHELL_FILES="$(dirname $(readlink $BASH_SOURCE))" DOT_FILES="$(dirname $(dirname $SHELL_FILES))" -source $DOT_FILES/shells/bootstrap.sh +source $HOME/.dotfiles/shells/bootstrap.sh diff --git a/shells/bash/config.bash b/shells/bash/config.bash index ab476c60..4158d64e 100644 --- a/shells/bash/config.bash +++ b/shells/bash/config.bash @@ -15,6 +15,6 @@ shopt -s checkwinsize histappend cdable_vars extglob nullglob cdspell cmdhist ho # Bash 4 and above only shopt -s globstar autocd checkjobs 2>/dev/null -complete -C $DOT_FILES/bash/rake-completion.rb -o default rake} +complete -C $HOME/.dotfiles/bash/rake-completion.rb -o default rake} alias reload="source ~/.bashrc" diff --git a/shells/bash/lib/50_completions.bash b/shells/bash/lib/50_completions.bash index e4271e2b..f2aeb1ab 100644 --- a/shells/bash/lib/50_completions.bash +++ b/shells/bash/lib/50_completions.bash @@ -1,3 +1,2 @@ # Git completion support in bash -source $DOT_FILES/vcs/git/git-completion - +source $HOME/.dotfiles/vcs/git/git-completion diff --git a/shells/common/functions.sh b/shells/common/functions.sh index 693c6c98..a01d649b 100644 --- a/shells/common/functions.sh +++ b/shells/common/functions.sh @@ -80,7 +80,7 @@ function extract() { # Zsh function __disabled__command_not_found_handler() { - /usr/bin/env ruby $DOT_FILES/misc/method_missing.rb $* + /usr/bin/env ruby $HOME/.dotfiles/misc/method_missing.rb $* } # Bash (call Zsh version) diff --git a/shells/path.sh b/shells/path.sh index 05e29de3..df4ff08e 100644 --- a/shells/path.sh +++ b/shells/path.sh @@ -17,7 +17,7 @@ function __append_path { [ -d "$HOME/bin" ] && __prepend_path "PATH" "$HOME/bin" [ -d "$HOME/.cargo/bin" ] && __prepend_path "PATH" "$HOME/.cargo/bin" [ -d "$HOME/.emacs.d/bin" ] && __prepend_path "PATH" "$HOME/.emacs.d/bin" -[ -d "$DOT_FILES/bin" ] && __prepend_path "PATH" "$DOT_FILES/bin" +[ -d "$HOME/.dotfiles/bin" ] && __prepend_path "PATH" "$HOME/.dotfiles/bin" [ -d '/usr/local/bin' ] && __append_path "PATH" "/usr/local/bin" [ -d '/usr/local/sbin' ] && __append_path "PATH" "/usr/local/sbin" [ -d '/opt/local/bin' ] && __append_path "PATH" "/opt/local/bin" From 3cf35a7bd69969bef87ae37e49f35b55bc2c2d7d Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sun, 23 Aug 2020 11:28:56 +1000 Subject: [PATCH 208/234] pbpaste/pbcopy aliases for Linux --- shells/common/aliases.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/shells/common/aliases.sh b/shells/common/aliases.sh index ecfb1ad4..08edd62c 100644 --- a/shells/common/aliases.sh +++ b/shells/common/aliases.sh @@ -12,6 +12,11 @@ alias colorslist="set | egrep 'COLOR_\w*'" # lists all the colors alias jsonify='python -mjson.tool' +if [ `uname` = "Linux" ]; then + alias pbcopy='xclip -selection clipboard' + alias pbpaste='xclip -selection clipboard -o' +fi + if [ -n "$SSH_CONNECTION" ]; then # Never open GUI vim when SSHd into a box alias mvim='vim' From 7fc97bfd547d468d43251583f4e24c7ead7b4cd0 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sun, 23 Aug 2020 11:29:10 +1000 Subject: [PATCH 209/234] [git] Change default branch to `main` --- vcs/git/gitconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/vcs/git/gitconfig b/vcs/git/gitconfig index 11d75fb7..d48c3640 100644 --- a/vcs/git/gitconfig +++ b/vcs/git/gitconfig @@ -64,6 +64,7 @@ user = bjeanes [init] templatedir = ~/.git_template + defaultBranch = main [include] path = .gitconfig.github path = .gitconfig.pushurls From 9fb6b417016bdc592ec8d14db63579ab305101ed Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Mon, 24 Aug 2020 14:30:26 +1000 Subject: [PATCH 210/234] [vim] Add snippets --- editors/vim/vimrc | 1 + 1 file changed, 1 insertion(+) diff --git a/editors/vim/vimrc b/editors/vim/vimrc index 041e9089..45ea35bf 100644 --- a/editors/vim/vimrc +++ b/editors/vim/vimrc @@ -122,6 +122,7 @@ nnoremap :%s////g " default behaviour of searching for current word) Plug 'thinca/vim-visualstar' +Plug 'honza/vim-snippets' " Contains snippets that coc-snippets can expand Plug 'neoclide/coc.nvim', {'tag': '*', 'branch': 'release', 'do': { -> coc#util#install()}} let g:coc_global_extensions = [ \ 'coc-actions', From 79c8718ae750969835b3f82dfbe05301445474e3 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Mon, 24 Aug 2020 14:30:39 +1000 Subject: [PATCH 211/234] [vim] Select tab completion with Enter --- editors/vim/vimrc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/editors/vim/vimrc b/editors/vim/vimrc index 45ea35bf..5f7967e0 100644 --- a/editors/vim/vimrc +++ b/editors/vim/vimrc @@ -225,6 +225,9 @@ inoremap coc#refresh() " Coc only does snippet and additional edit on confirm. "inoremap pumvisible() ? "\" : "\u\" " NOTE: above mapping disabled due to https://github.com/tpope/vim-endwise/issues/22#issuecomment-446042476 +let g:endwise_no_mappings = v:true +inoremap CustomCocCR pumvisible() ? coc#_select_confirm() : "\u\\=coc#on_enter()\" +imap CustomCocCRDiscretionaryEnd " Use `[c` and `]c` for navigate diagnostics nmap [c (coc-diagnostic-prev) @@ -343,8 +346,6 @@ syntax on set wildmode=list:longest,list:full set wildignore+=*.o,*.obj,.git,*.rbc,*.swp - map > - map < nmap :tabnew " Navigate cursor up/down by lines on screen, not lines in file From 0d6565f2e7c1943779218aba5319df7df46d76c1 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Mon, 24 Aug 2020 14:31:07 +1000 Subject: [PATCH 212/234] [vim] Add vim-test and mappings --- editors/vim/vimrc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/editors/vim/vimrc b/editors/vim/vimrc index 5f7967e0..73154ca4 100644 --- a/editors/vim/vimrc +++ b/editors/vim/vimrc @@ -172,6 +172,13 @@ let g:ale_linters = { " https://github.com/dense-analysis/ale#faq-coc-nvim let g:ale_disable_lsp = 1 +Plug 'vim-test/vim-test' +nmap tn :TestNearest +nmap tf :TestFile +nmap ts :TestSuite +nmap tl :TestLast +nmap tg :TestVisit + " Change working directory to .git root Plug 'airblade/vim-rooter' let g:rooter_cd_cmd="lcd" From 12b8e40957a9377f33524f60c9daf2f27c56c78e Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Mon, 24 Aug 2020 14:31:21 +1000 Subject: [PATCH 213/234] [vim] Convenient terminal behaviour Alt+T to toggle a 12-row high split at bottom --- editors/vim/vimrc | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/editors/vim/vimrc b/editors/vim/vimrc index 73154ca4..f11123a0 100644 --- a/editors/vim/vimrc +++ b/editors/vim/vimrc @@ -549,6 +549,34 @@ nnoremap zS :echo join(reverse(map(synstack(line('.'), col('.')), 'synIDattr(v:v " https://github.com/phoenixframework/phoenix/issues/1165#issuecomment-437130681 let $MIX_ENV='test' +" Terminal Function +" Courtesy of https://www.reddit.com/r/vim/comments/8n5bzs/using_neovim_is_there_a_way_to_display_a_terminal/dzt3fix +let g:term_buf = 0 +let g:term_win = 0 +function! TermToggle(height) + if win_gotoid(g:term_win) + hide + else + botright new + exec "resize " . a:height + try + exec "buffer " . g:term_buf + catch + call termopen($SHELL, {"detach": 0}) + let g:term_buf = bufnr("") + set nonumber + set norelativenumber + set signcolumn=no + endtry + startinsert! + let g:term_win = win_getid() + endif +endfunction +nnoremap te :call TermToggle(12) +nnoremap :call TermToggle(12) +inoremap :call TermToggle(12) +tnoremap :call TermToggle(12) + if filereadable(expand('~/.vimrc.local')) source ~/.vimrc.local endif From d95a496d9dd87755a9f6033b6f1ec5fc85be3bc2 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Tue, 25 Aug 2020 08:14:38 +1000 Subject: [PATCH 214/234] [vim] Don't choose first auto-complete on ENTER This is really annoying at the end of a line when you might actually mean _next line_. I'd rather hit TAB then ENTER to explicitly tab through the auto-complete list. --- editors/vim/vimrc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/editors/vim/vimrc b/editors/vim/vimrc index f11123a0..ad6c588a 100644 --- a/editors/vim/vimrc +++ b/editors/vim/vimrc @@ -94,7 +94,7 @@ vmap (EasyAlign) " When re-opening a file, start cursor on last edit location Plug 'farmergreg/vim-lastplace' -Plug 'thisivan/vim-matchit' " extended matching for html, latex, and many other languages +Plug 'thisivan/vim-matchit' " extended matching for html, latex, and many other languages Plug 'kana/vim-textobj-user' " Create new text objects Plug 'michaeljsmith/vim-indent-object' @@ -233,7 +233,8 @@ inoremap coc#refresh() "inoremap pumvisible() ? "\" : "\u\" " NOTE: above mapping disabled due to https://github.com/tpope/vim-endwise/issues/22#issuecomment-446042476 let g:endwise_no_mappings = v:true -inoremap CustomCocCR pumvisible() ? coc#_select_confirm() : "\u\\=coc#on_enter()\" +" inoremap CustomCocCR pumvisible() ? coc#_select_confirm() : "\u\\=coc#on_enter()\" +inoremap CustomCocCR pumvisible() ? "\" : "\u\\=coc#on_enter()\" imap CustomCocCRDiscretionaryEnd " Use `[c` and `]c` for navigate diagnostics From 22ad16a8cb1e05ff9771dc3d37875cf4f3c5728f Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sat, 24 Oct 2020 17:11:43 +1100 Subject: [PATCH 215/234] Add ~/.local/bin to PATH --- shells/path.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/shells/path.sh b/shells/path.sh index df4ff08e..b112ecd5 100644 --- a/shells/path.sh +++ b/shells/path.sh @@ -15,6 +15,7 @@ function __append_path { } [ -d "$HOME/bin" ] && __prepend_path "PATH" "$HOME/bin" +[ -d "$HOME/.local/bin" ] && __prepend_path "PATH" "$HOME/.local/bin" [ -d "$HOME/.cargo/bin" ] && __prepend_path "PATH" "$HOME/.cargo/bin" [ -d "$HOME/.emacs.d/bin" ] && __prepend_path "PATH" "$HOME/.emacs.d/bin" [ -d "$HOME/.dotfiles/bin" ] && __prepend_path "PATH" "$HOME/.dotfiles/bin" From ffe9e6eaced095fb7bb6de0574a5163516b7db88 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sat, 24 Oct 2020 17:47:00 +1100 Subject: [PATCH 216/234] Prepend /usr and /opt to ensure they come before /bin --- shells/path.sh | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/shells/path.sh b/shells/path.sh index b112ecd5..7092cda3 100644 --- a/shells/path.sh +++ b/shells/path.sh @@ -1,3 +1,8 @@ +## TODO: remove duplicates when appending/prepending +## TODO: Ideally, __prepend will add (or move existing) entry to front while __append will add (or move) +## entry to back. Anything unmentioned should stay in the middle and anything mentioned should not +## be doubled up with system-provided. + function __prepend_path { if [ -z "$(eval echo \$$1)" ]; then eval "$1=\"$2\"" @@ -14,15 +19,17 @@ function __append_path { fi } +[ -d '/usr/local/bin' ] && __prepend_path "PATH" "/usr/local/bin" +[ -d '/usr/local/sbin' ] && __prepend_path "PATH" "/usr/local/sbin" +[ -d '/opt/local/bin' ] && __prepend_path "PATH" "/opt/local/bin" +[ -d '/opt/local/sbin' ] && __prepend_path "PATH" "/opt/local/sbin" +[ -d '/opt/bin' ] && __prepend_path "PATH" "/opt/bin" +[ -d '/opt/sbin' ] && __prepend_path "PATH" "/opt/sbin" [ -d "$HOME/bin" ] && __prepend_path "PATH" "$HOME/bin" [ -d "$HOME/.local/bin" ] && __prepend_path "PATH" "$HOME/.local/bin" [ -d "$HOME/.cargo/bin" ] && __prepend_path "PATH" "$HOME/.cargo/bin" [ -d "$HOME/.emacs.d/bin" ] && __prepend_path "PATH" "$HOME/.emacs.d/bin" -[ -d "$HOME/.dotfiles/bin" ] && __prepend_path "PATH" "$HOME/.dotfiles/bin" -[ -d '/usr/local/bin' ] && __append_path "PATH" "/usr/local/bin" -[ -d '/usr/local/sbin' ] && __append_path "PATH" "/usr/local/sbin" -[ -d '/opt/local/bin' ] && __append_path "PATH" "/opt/local/bin" -[ -d '/opt/local/sbin' ] && __append_path "PATH" "/opt/local/sbin" +[ -d "$HOME/.dotfiles/bin" ] && __prepend_path "PATH" "$HOME/.dotfiles/bin" [ -d '/usr/X11/bin' ] && __append_path "PATH" "/usr/X11/bin" [ -d '/usr/bin' ] && __append_path "PATH" "/usr/bin" [ -d '/usr/sbin' ] && __append_path "PATH" "/usr/sbin" From dd7316cc7f37e132dd38bad236a753c083a81c4b Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sat, 24 Oct 2020 17:48:38 +1100 Subject: [PATCH 217/234] Add neovim conditional --- editors/vim/vimrc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/editors/vim/vimrc b/editors/vim/vimrc index ad6c588a..5df6bda3 100644 --- a/editors/vim/vimrc +++ b/editors/vim/vimrc @@ -529,7 +529,9 @@ set colorcolumn=79,120,150 set textwidth=119 " Show incremental previews of commands (such as :s[ubstitute]) -set inccommand=nosplit +if has('nvim') + set inccommand=nosplit +endif " If there's no EOL at the end of the file, don't mess up the diff by adding " one From d968f08ef22df9555c79ca96edbe56a0ce524e85 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sat, 24 Oct 2020 17:49:06 +1100 Subject: [PATCH 218/234] Generate .tool-versions with latest installed --- freshrc | 3 ++- languages/tool-versions | 26 -------------------------- 2 files changed, 2 insertions(+), 27 deletions(-) delete mode 100644 languages/tool-versions diff --git a/freshrc b/freshrc index 2bd259ea..5465d846 100644 --- a/freshrc +++ b/freshrc @@ -27,7 +27,6 @@ fresh-options --file # each file as is # asdf conf fresh languages/asdfrc - fresh languages/tool-versions fresh languages/ruby/default-gems # asdf-ruby only fresh misc/ackrc @@ -123,4 +122,6 @@ EOF command -v nvim &>/dev/null && vim='nvim' $vim +PlugUpdate +PlugClean +qall fi + + find ~/.asdf/installs -maxdepth 2 -mindepth 2 -type d -printf '%P\n' | sort -Vru -t/ -k1,1 | tr / ' ' > ~/.tool-versions } diff --git a/languages/tool-versions b/languages/tool-versions deleted file mode 100644 index 7930720a..00000000 --- a/languages/tool-versions +++ /dev/null @@ -1,26 +0,0 @@ -# asdf list all rust | grep -E '[0-9]' | sort -rV | xargs echo rust -rust beta stable 1.42.0 1.41.1 1.41.0 1.40.0 1.39.0 1.38.0 1.37.0 1.36.0 1.35.0 1.34.2 1.34.1 1.34.0 1.33.0 1.32.0 1.31.1 1.31.0 1.30.1 1.30.0 1.29.2 1.29.1 1.29.0 1.28.0 - -# asdf list all erlang | grep -vE '^R|beta|preview|-rc[0-9]|-dev' | sort -rV | xargs echo erlang -erlang 22.3 22.2.8 22.2.7 22.2.6 22.2.5 22.2.4 22.2.3 22.2.2 22.2.1 22.2 22.1.8.1 22.1.8 22.1.7 22.1.6 22.1.5 22.1.4 22.1.3 22.1.2 22.1.1 22.1 22.0.7 22.0.6 22.0.5 22.0.4 22.0.3 22.0.2 22.0.1 22.0 21.3.8.14 21.3.8.13 21.3.8.12 21.3.8.11 21.3.8.10 21.3.8.9 21.3.8.8 21.3.8.7 21.3.8.6 21.3.8.5 21.3.8.4 21.3.8.3 21.3.8.2 21.3.8.1 21.3.8 21.3.7.1 21.3.7 21.3.6 21.3.5 21.3.4 21.3.3 21.3.2 21.3.1 21.3 21.2.7 21.2.6 21.2.5 21.2.4 21.2.3 21.2.2 21.2.1 21.2 21.1.4 21.1.3 21.1.2 21.1.1 21.1 21.0.9 21.0.8 21.0.7 21.0.6 21.0.5 21.0.4 21.0.3 21.0.2 21.0.1 21.0 20.3.8.26 20.3.8.25 20.3.8.24 20.3.8.23 20.3.8.22 20.3.8.21 20.3.8.20 20.3.8.19 20.3.8.18 20.3.8.17 20.3.8.16 20.3.8.15 20.3.8.14 20.3.8.13 20.3.8.12 20.3.8.11 20.3.8.10 20.3.8.9 20.3.8.8 20.3.8.7 20.3.8.6 20.3.8.5 20.3.8.4 20.3.8.3 20.3.8.2 20.3.8.1 20.3.8 20.3.7 20.3.6 20.3.5 20.3.4 20.3.3 20.3.2.1 20.3.2 20.3.1 20.3 20.2.4 20.2.3 20.2.2 20.2.1 20.2.0.1 20.2 20.1.7.1 20.1.7 20.1.6 20.1.5 20.1.4 20.1.3 20.1.2 20.1.1 20.1 20.0.5 20.0.4 20.0.3 20.0.2 20.0.1 20.0 19.3.6.13 19.3.6.12 19.3.6.11 19.3.6.10 19.3.6.9 19.3.6.8 19.3.6.7 19.3.6.6 19.3.6.5 19.3.6.4 19.3.6.3 19.3.6.2 19.3.6.1 19.3.6 19.3.5 19.3.4 19.3.3 19.3.2 19.3.1 19.3 19.2.3.1 19.2.3 19.2.2 19.2.1 19.2 19.1.6.1 19.1.6 19.1.5 19.1.4 19.1.3 19.1.2 19.1.1 19.1 19.0.7 19.0.6 19.0.5 19.0.4 19.0.3 19.0.2 19.0.1 19.0 18.3.4.11 18.3.4.10 18.3.4.9 18.3.4.8 18.3.4.7 18.3.4.6 18.3.4.5 18.3.4.4 18.3.4.3 18.3.4.2 18.3.4.1.1 18.3.4.1 18.3.4 18.3.3 18.3.2 18.3.1 18.3 18.2.4.1 18.2.4.0.1 18.2.4 18.2.3 18.2.2 18.2.1 18.2 18.1.5 18.1.4 18.1.3 18.1.2 18.1.1 18.1 18.0.3 18.0.2 18.0.1 18.0 17.5.6.10 17.5.6.9 17.5.6.8 17.5.6.7 17.5.6.6 17.5.6.5 17.5.6.4 17.5.6.3 17.5.6.2 17.5.6.1 17.5.6 17.5.5 17.5.4 17.5.3 17.5.2 17.5.1 17.5 17.4.1 17.4 17.3.4 17.3.3 17.3.2 17.3.1 17.3 17.2.2 17.2.1 17.2 17.1.2 17.1.1 17.1 17.0.2 17.0.1 17.0 - -# asdf list all elixir | grep -vE 'beta|preview|-rc[0-9]|-dev|master' | sort -Vr | xargs echo elixir -elixir 1.10.3-otp-22 1.10.2-otp-22 1.10.2-otp-21 1.10.2 1.10.1-otp-22 1.10.1-otp-21 1.10.1 1.10.0-rc.0-otp-22 1.10.0-rc.0-otp-21 1.10.0-rc.0 1.10.0-otp-22 1.10.0-otp-21 1.10.0 1.9.4-otp-22 1.9.4-otp-21 1.9.4-otp-20 1.9.4 1.9.3-otp-22 1.9.3-otp-21 1.9.3-otp-20 1.9.3 1.9.2-otp-22 1.9.2-otp-21 1.9.2-otp-20 1.9.2 1.9.1-otp-22 1.9.1-otp-21 1.9.1-otp-20 1.9.1 1.9.0-rc.0-otp-22 1.9.0-rc.0-otp-21 1.9.0-rc.0-otp-20 1.9.0-rc.0 1.9.0-otp-22 1.9.0-otp-21 1.9.0-otp-20 1.9.0 1.8.2-otp-22 1.8.2-otp-21 1.8.2-otp-20 1.8.2 1.8.1-otp-22 1.8.1-otp-21 1.8.1-otp-20 1.8.1 1.8.0-rc.1-otp-22 1.8.0-rc.1-otp-21 1.8.0-rc.1-otp-20 1.8.0-rc.1 1.8.0-rc.0-otp-22 1.8.0-rc.0-otp-21 1.8.0-rc.0-otp-20 1.8.0-rc.0 1.8.0-otp-22 1.8.0-otp-21 1.8.0-otp-20 1.8.0 1.7.4-otp-22 1.7.4-otp-21 1.7.4-otp-20 1.7.4-otp-19 1.7.4 1.7.3-otp-22 1.7.3-otp-21 1.7.3-otp-20 1.7.3-otp-19 1.7.3 1.7.2-otp-22 1.7.2-otp-21 1.7.2-otp-20 1.7.2-otp-19 1.7.2 1.7.1-otp-22 1.7.1-otp-21 1.7.1-otp-20 1.7.1-otp-19 1.7.1 1.7.0-rc.1-otp-22 1.7.0-rc.1-otp-21 1.7.0-rc.1-otp-20 1.7.0-rc.1-otp-19 1.7.0-rc.1 1.7.0-rc.0-otp-22 1.7.0-rc.0-otp-21 1.7.0-rc.0-otp-20 1.7.0-rc.0-otp-19 1.7.0-rc.0 1.7.0-otp-22 1.7.0-otp-21 1.7.0-otp-20 1.7.0-otp-19 1.7.0 1.6.6-otp-21 1.6.6-otp-20 1.6.6-otp-19 1.6.6 1.6.5-otp-21 1.6.5-otp-20 1.6.5-otp-19 1.6.5 1.6.4-otp-20 1.6.4-otp-19 1.6.4 1.6.3-otp-20 1.6.3-otp-19 1.6.3 1.6.2-otp-20 1.6.2-otp-19 1.6.2 1.6.1-otp-20 1.6.1-otp-19 1.6.1 1.6.0-rc.1-otp-20 1.6.0-rc.1-otp-19 1.6.0-rc.1 1.6.0-rc.0-otp-20 1.6.0-rc.0-otp-19 1.6.0-rc.0 1.6.0-otp-20 1.6.0-otp-19 1.6.0 1.5.3-otp-20 1.5.3-otp-19 1.5.3-otp-18 1.5.3 1.5.2-otp-20 1.5.2-otp-19 1.5.2-otp-18 1.5.2 1.5.1-otp-20 1.5.1-otp-19 1.5.1-otp-18 1.5.1 1.5.0-rc.2-otp-20 1.5.0-rc.2-otp-19 1.5.0-rc.2-otp-18 1.5.0-rc.2 1.5.0-rc.1-otp-20 1.5.0-rc.1-otp-19 1.5.0-rc.1-otp-18 1.5.0-rc.1 1.5.0-rc.0-otp-20 1.5.0-rc.0-otp-19 1.5.0-rc.0-otp-18 1.5.0-rc.0 1.5.0-otp-20 1.5.0-otp-19 1.5.0-otp-18 1.5.0 1.4.5-otp-20 1.4.5-otp-19 1.4.5-otp-18 1.4.5 1.4.4-otp-19 1.4.4-otp-18 1.4.4 1.4.3-otp-19 1.4.3-otp-18 1.4.3 1.4.2-otp-19 1.4.2-otp-18 1.4.2 1.4.1-otp-19 1.4.1-otp-18 1.4.1 1.4.0-rc.1-otp-20 1.4.0-rc.1-otp-19 1.4.0-rc.1-otp-18 1.4.0-rc.1 1.4.0-rc.0-otp-20 1.4.0-rc.0-otp-19 1.4.0-rc.0-otp-18 1.4.0-rc.0 1.4.0-otp-19 1.4.0-otp-18 1.4.0 1.3.4-otp-19 1.3.4-otp-18 1.3.4 1.3.3-otp-19 1.3.3-otp-18 1.3.3 1.3.2-otp-19 1.3.2-otp-18 1.3.2 1.3.1-otp-19 1.3.1-otp-18 1.3.1 1.3.0-rc.1-otp-19 1.3.0-rc.1-otp-18 1.3.0-rc.1 1.3.0-rc.0-otp-19 1.3.0-rc.0-otp-18 1.3.0-rc.0 1.3.0-otp-19 1.3.0-otp-18 1.3.0 1.2.6-otp-18 1.2.6 1.2.5-otp-18 1.2.5 1.2.4-otp-18 1.2.4 1.2.3-otp-18 1.2.3 1.2.2-otp-18 1.2.2 1.2.1-otp-18 1.2.1 1.2.0-rc.1-otp-18 1.2.0-rc.1 1.2.0-rc.0-otp-18 1.2.0-rc.0 1.2.0-otp-18 1.2.0 1.1.1-otp-18 1.1.1-otp-17 1.1.1 1.1.0-rc.0-otp-18 1.1.0-rc.0-otp-17 1.1.0-rc.0 1.1.0-otp-18 1.1.0-otp-17 1.1.0 1.0.5-otp-18 1.0.5-otp-17 1.0.5 1.0.4-otp-17 1.0.4 1.0.3-otp-17 1.0.3 1.0.2-otp-17 1.0.2 1.0.1-otp-17 1.0.1 1.0.0-otp-17 1.0.0 0.15.1 0.15.0 0.14.3 0.14.2 0.14.1 0.14.0 0.13.3 0.13.2 0.13.1 0.13.0 0.12.5 0.12.4 - -# asdf list all ruby | grep -vE 'truffle|rbx|ree|jruby|preview|-rc[0-9]|mruby|maglev|-dev' | sort -rV | xargs echo ruby -ruby 3 2 2.8.0 2.7.1 2.7.0 2.6.5 2.6.4 2.6.3 2.6.2 2.6.1 2.6.0 2.5.7 2.5.6 2.5.5 2.5.4 2.5.3 2.5.2 2.5.1 2.5.0 2.4.9 2.4.8 2.4.7 2.4.6 2.4.5 2.4.4 2.4.3 2.4.2 2.4.1 2.4.0 2.3.8 2.3.7 2.3.6 2.3.5 2.3.4 2.3.3 2.3.2 2.3.1 2.3.0 2.2.10 2.2.9 2.2.8 2.2.7 2.2.6 2.2.5 2.2.4 2.2.3 2.2.2 2.2.1 2.2.0 2.1.10 2.1.9 2.1.8 2.1.7 2.1.6 2.1.5 2.1.4 2.1.3 2.1.2 2.1.1 2.1.0 2.0.0-p648 2.0.0-p647 2.0.0-p645 2.0.0-p643 2.0.0-p598 2.0.0-p594 2.0.0-p576 2.0.0-p481 2.0.0-p451 2.0.0-p353 2.0.0-p247 2.0.0-p195 2.0.0-p0 1.9.3-p551 1.9.3-p550 1.9.3-p547 1.9.3-p545 1.9.3-p484 1.9.3-p448 1.9.3-p429 1.9.3-p426 1.9.3-p392 1.9.3-p385 1.9.3-p374 1.9.3-p362 1.9.3-p327 1.9.3-p286 1.9.3-p194 1.9.3-p125 1.9.3-p105 1.9.3-p0 1.9.2-p330 1.9.2-p326 1.9.2-p320 1.9.2-p318 1.9.2-p290 1.9.2-p180 1.9.2-p136 1.9.2-p0 1.9.1-p431 1.9.1-p430 1.9.1-p429 1.9.1-p378 1.9.1-p376 1.9.1-p243 1.9.1-p129 1.9.1-p0 1.9.0-5 1.9.0-4 1.9.0-3 1.9.0-2 1.9.0-1 1.9.0-0 1.8.7-p375 1.8.7-p374 1.8.7-p373 1.8.7-p371 1.8.7-p370 1.8.7-p358 1.8.7-p357 1.8.7-p352 1.8.7-p334 1.8.7-p330 1.8.7-p302 1.8.7-p301 1.8.7-p299 1.8.7-p249 1.8.7-p248 1.8.7-p174 1.8.7-p173 1.8.7-p160 1.8.7-p72 1.8.7-p71 1.8.7-p22 1.8.7-p17 1.8.7 1.8.6-p420 1.8.6-p399 1.8.6-p398 1.8.6-p388 1.8.6-p383 1.8.6-p369 1.8.6-p368 1.8.6-p287 1.8.6-p286 1.8.6-p230 1.8.6-p114 1.8.6-p111 1.8.6-p110 1.8.6-p36 1.8.6 1.8.5-p231 1.8.5-p115 1.8.5-p114 1.8.5-p113 1.8.5-p52 - -# asdf list all crystal | sort -rV | xargs echo crystal -crystal 0.33.0 0.32.1 0.32.0 0.31.1 0.31.0 0.30.1 0.30.0 0.29.0 0.28.0 0.27.2 0.27.1 0.27.0 0.26.1 0.26.0 0.25.1 0.25.0 0.24.2 0.24.1 0.24.0 0.23.1 0.23.0 0.22.0 0.21.1 0.21.0 0.20.5 0.20.4 0.20.3 0.20.1 0.20.0 0.19.4 - -# asdf list all golang | grep -vE '(rc|beta)[0-9]' |sort -rV | xargs echo golang -golang 1.14.2 1.14.1 1.14 1.13.9 1.13.8 1.13.7 1.13.6 1.13.5 1.13.4 1.13.3 1.13.2 1.13.1 1.13 1.12.17 1.12.16 1.12.15 1.12.14 1.12.13 1.12.12 1.12.11 1.12.10 1.12.9 1.12.8 1.12.7 1.12.6 1.12.5 1.12.4 1.12.3 1.12.2 1.12.1 1.12 1.11.13 1.11.12 1.11.11 1.11.10 1.11.9 1.11.8 1.11.7 1.11.6 1.11.5 1.11.4 1.11.3 1.11.2 1.11.1 1.11 1.10.8 1.10.7 1.10.6 1.10.5 1.10.4 1.10.3 1.10.2 1.10.1 1.10 1.9.7 1.9.6 1.9.5 1.9.4 1.9.3 1.9.2 1.9.1 1.9 1.8.7 1.8.6 1.8.5 1.8.4 1.8.3 1.8.2 1.8.1 1.8 1.7.6 1.7.5 1.7.4 1.7.3 1.7.2 1.7.1 1.7 1.6.4 1.6.3 1.6.2 1.6.1 1.6 1.5.4 1.5.3 1.5.2 1.5.1 1.5 1.4.3 1.4.2 1.4.1 1.4 1.3.3 1.3.2 1.3.1 1.3 1.2.2 - -# asdf list all java | grep adopt-openjdk | grep -vE 'large-heap|openj9' | sort -Vr | xargs echo java -java adopt-openjdk-13.0.2+8 adopt-openjdk-13.0.1+9 adopt-openjdk-13+33 adopt-openjdk-12.0.2+10 adopt-openjdk-12.0.1+12 adopt-openjdk-12+33 adopt-openjdk-11.0.6+10 adopt-openjdk-11.0.5+10 adopt-openjdk-11.0.4+11 adopt-openjdk-11.0.3+7 adopt-openjdk-11.0.2+9 adopt-openjdk-11.0.2+7 adopt-openjdk-11.0.1+13 adopt-openjdk-11+28 adopt-openjdk-10.0.2+13.1 adopt-openjdk-9.0.4+11 adopt-openjdk-9+181 adopt-openjdk-8u242-b08 adopt-openjdk-8u232-b09 adopt-openjdk-8u222-b10 adopt-openjdk-8u212-b04 adopt-openjdk-8u212-b03 adopt-openjdk-8u202-b08 adopt-openjdk-8u192-b12 adopt-openjdk-8u181-b13 - -# asdf list all nodejs | sort -Vr | head -n100 | xargs echo nodejs -nodejs 14.3.0 14.2.0 14.1.0 14.0.0 13.14.0 13.13.0 13.12.0 13.11.0 13.10.1 13.10.0 13.9.0 13.8.0 13.7.0 13.6.0 13.5.0 13.4.0 13.3.0 13.2.0 13.1.0 13.0.1 13.0.0 12.16.1 12.16.0 12.15.0 12.14.1 12.14.0 12.13.1 12.13.0 12.12.0 12.11.1 12.11.0 12.10.0 12.9.1 12.9.0 12.8.1 12.8.0 12.7.0 12.6.0 12.5.0 12.4.0 12.3.1 12.3.0 12.2.0 12.1.0 12.0.0 11.15.0 11.14.0 11.13.0 11.12.0 11.11.0 11.10.1 11.10.0 11.9.0 11.8.0 11.7.0 11.6.0 11.5.0 11.4.0 11.3.0 11.2.0 11.1.0 11.0.0 10.19.0 10.18.1 10.18.0 10.17.0 10.16.3 10.16.2 10.16.1 10.16.0 10.15.3 10.15.2 10.15.1 10.15.0 10.14.2 10.14.1 10.14.0 10.13.0 10.12.0 10.11.0 10.10.0 10.9.0 10.8.0 10.7.0 10.6.0 10.5.0 10.4.1 10.4.0 10.3.0 10.2.1 10.2.0 10.1.0 10.0.0 9.11.2 9.11.1 9.11.0 9.10.1 9.10.0 9.9.0 9.8.0 9.7.1 9.7.0 9.6.1 9.6.0 9.5.0 9.4.0 - -# asdf list all yarn | sort -Vr | grep -v -- - | xargs echo yarn -yarn 1.22.4 1.22.3 1.22.2 1.22.1 1.22.0 1.21.1 1.21.0 1.20.0 1.19.2 1.19.1 1.19.0 1.18.0 1.17.3 1.17.2 1.17.1 1.17.0 1.16.0 1.15.2 1.15.1 1.15.0 1.14.0 1.13.0 1.12.3 1.12.2 1.12.1 1.12.0 1.11.1 1.11.0 1.10.1 1.10.0 1.9.4 1.9.3 1.9.2 1.9.1 1.9.0 1.8.0 1.7.0 1.6.0 1.5.1 1.5.0 1.4.1 1.4.0 1.3.2 1.3.1 1.3.0 1.2.1 1.2.0 1.1.0 1.0.2 1.0.1 1.0.0 From dd5ef2098d1fa158bbe7afa304a896dcc4ad7df0 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sat, 24 Oct 2020 17:49:52 +1100 Subject: [PATCH 219/234] Add TODO --- editors/vim/vimrc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/editors/vim/vimrc b/editors/vim/vimrc index 5df6bda3..a2c46cd6 100644 --- a/editors/vim/vimrc +++ b/editors/vim/vimrc @@ -446,6 +446,8 @@ augroup the_rest autocmd BufRead,BufNewFile gitconfig set ft=gitconfig " Strip trailing whitespace on save + " TODO: do not do this for all file types. In particular, bypass this for git patchsets (i.e. from `git add -p`) as + " it can fuck with cleanly applying patches autocmd BufWritePre * :call StripTrailingWhitespaces() augroup end From 14e108acf1f809b562e103228ad60c99e136a707 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sat, 24 Oct 2020 17:50:00 +1100 Subject: [PATCH 220/234] Add to gitignore --- vcs/git/gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/vcs/git/gitignore b/vcs/git/gitignore index 47802d8a..53c8ea15 100755 --- a/vcs/git/gitignore +++ b/vcs/git/gitignore @@ -49,6 +49,7 @@ doc/tags .bundle/* .rbx/ .netrwhist +jard_errors.txt # emacs .#* From f0f523099754b8f9acc9920be90b16cec724d605 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sat, 24 Oct 2020 17:50:20 +1100 Subject: [PATCH 221/234] Follow file renames in `git log ` --- vcs/git/gitconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/vcs/git/gitconfig b/vcs/git/gitconfig index d48c3640..cf31cc82 100644 --- a/vcs/git/gitconfig +++ b/vcs/git/gitconfig @@ -40,6 +40,8 @@ diff = auto status = auto ui = auto +[log] + follow = true [core] attributesfile = ~/.gitattributes excludesfile = ~/.gitignore From d7cbf8caf64122ad89091adc82d0e89c99753a4a Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sat, 24 Oct 2020 17:50:46 +1100 Subject: [PATCH 222/234] Fix coc.nvim according to random GH issue comment --- editors/vim/vimrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/editors/vim/vimrc b/editors/vim/vimrc index a2c46cd6..14a54e4b 100644 --- a/editors/vim/vimrc +++ b/editors/vim/vimrc @@ -123,7 +123,7 @@ nnoremap :%s////g Plug 'thinca/vim-visualstar' Plug 'honza/vim-snippets' " Contains snippets that coc-snippets can expand -Plug 'neoclide/coc.nvim', {'tag': '*', 'branch': 'release', 'do': { -> coc#util#install()}} +Plug 'neoclide/coc.nvim', {'branch': 'release'} let g:coc_global_extensions = [ \ 'coc-actions', \ 'coc-css', From b6ed73162c96b5e2d02eb6d18db6d8b6da4da195 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sat, 24 Oct 2020 17:54:25 +1100 Subject: [PATCH 223/234] Only generate .tool-versions when ASDF is installed --- freshrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/freshrc b/freshrc index 5465d846..0c9c6f78 100644 --- a/freshrc +++ b/freshrc @@ -123,5 +123,5 @@ EOF $vim +PlugUpdate +PlugClean +qall fi - find ~/.asdf/installs -maxdepth 2 -mindepth 2 -type d -printf '%P\n' | sort -Vru -t/ -k1,1 | tr / ' ' > ~/.tool-versions + [ -d ~/.asdf/installs ] && find ~/.asdf/installs -maxdepth 2 -mindepth 2 -type d -printf '%P\n' | sort -Vru -t/ -k1,1 | tr / ' ' > ~/.tool-versions } From 385ff29089a333f45942354831aa06194129085c Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sat, 24 Oct 2020 18:30:14 +1100 Subject: [PATCH 224/234] Start or join tmux session when SSHing into server --- freshrc | 2 ++ shells/tmux.sh | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/freshrc b/freshrc index 0c9c6f78..e34a7f77 100644 --- a/freshrc +++ b/freshrc @@ -54,6 +54,7 @@ fresh-options --file=~/.zshrc --marker fresh shells/zsh/p10k-instant-prompt.zsh fresh shells/path.sh + fresh shells/tmux.sh fresh freshshell/fresh contrib/source-build.sh @@ -73,6 +74,7 @@ fresh-options fresh-options --file=~/.bashrc --marker fresh shells/path.sh + fresh shells/tmux.sh fresh shells/common/\*.sh fresh shells/bash/\*.bash fresh shells/bash/lib/\*.bash diff --git a/shells/tmux.sh b/shells/tmux.sh index db9cd7ec..af9f7180 100644 --- a/shells/tmux.sh +++ b/shells/tmux.sh @@ -6,11 +6,11 @@ # windows but be looking at different ones individually # If we aren't in Tmux or emacs, set it up -if false && [ -z "$TMUX" -a -z "$INSIDE_EMACS" -a -z "$EMACS" ]; then +if command -v tmux &>/dev/null && [ "$SSH_CONNECTION" -a -z "$TMUX" -a -z "$INSIDE_EMACS" -a -z "$EMACS" -a -z "$VIM" -a -z "$VIMRUNTIME" ]; then if tty >/dev/null; then if which tmux 2>&1 >/dev/null; then if [ -z "$(tmux ls | grep 'login:')" ]; then - tmux new-session -d -s login # Create a detached session called login + tmux new-session -d -s login $SHELL # Create a detached session called login tmux new-session -t login # Create a *new* session bound to the same windows else last_session="$(tmux list-windows -t login | tail -n1 | cut -d: -f1)" From 57747b7be5bfa9c860ee660aa94f522d30867a32 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sat, 24 Oct 2020 18:41:18 +1100 Subject: [PATCH 225/234] Fix tmux conf error --- misc/tmux/tmux.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/tmux/tmux.conf b/misc/tmux/tmux.conf index 0c40f49d..eee092ce 100644 --- a/misc/tmux/tmux.conf +++ b/misc/tmux/tmux.conf @@ -12,7 +12,7 @@ set -g default-terminal "screen-256color" set-option -g default-command "reattach-to-user-namespace -l zsh" bind R source-file ~/.tmux.conf -bind \ confirm-before kill-server +bind '\' confirm-before kill-server # Mouse setw -g mode-mouse on From 04747762205f1968468fbc32d346c4cc82734c11 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sat, 24 Oct 2020 18:41:23 +1100 Subject: [PATCH 226/234] Update tmux.conf for newer version It's been a while since I used it! https://stackoverflow.com/a/33336609/56690 --- misc/tmux/tmux.conf | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/misc/tmux/tmux.conf b/misc/tmux/tmux.conf index eee092ce..12449287 100644 --- a/misc/tmux/tmux.conf +++ b/misc/tmux/tmux.conf @@ -15,10 +15,7 @@ bind R source-file ~/.tmux.conf bind '\' confirm-before kill-server # Mouse - setw -g mode-mouse on - set -g mouse-resize-pane - set -g mouse-select-pane - set -g mouse-select-window + set -g mouse # Copy/Pasting bind [ copy-mode From 1dfcae5ac3866a03a16555393fefefbddbc8372e Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sat, 24 Oct 2020 18:58:49 +1100 Subject: [PATCH 227/234] Don't assume macOS or ZSH --- misc/tmux/tmux.conf | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/misc/tmux/tmux.conf b/misc/tmux/tmux.conf index 12449287..cea44434 100644 --- a/misc/tmux/tmux.conf +++ b/misc/tmux/tmux.conf @@ -9,8 +9,6 @@ setw -g mode-keys vi set -g default-terminal "screen-256color" -set-option -g default-command "reattach-to-user-namespace -l zsh" - bind R source-file ~/.tmux.conf bind '\' confirm-before kill-server @@ -68,7 +66,20 @@ setw -g aggressive-resize on set-option -g terminal-overrides '*88col*:colors=88,*256col*:colors=256,xterm*:XT:Ms=\E]52;%p1%s;%p2%s\007:Cc=\E]12;%p1%s\007:Cr=\E]112\007:Cs=\E]50;CursorShape=%?%p1%{3}%<%t%{0}%e%p1%{2}%-%;%d\007' set -sg escape-time 0 # needed to distinguish between ESC and Meta in emacs -source-file ~/.config/vendor/powerline/powerline/bindings/tmux/powerline.conf - -bind C-c run "tmux save-buffer - | pbcopy" -bind C-v run "pbpaste | tmux load-buffer - && tmux paste-buffer" +if-shell "uname | grep -q Darwin" { + if-shell "command -v reattach-to-user-namespace &>/dev/null" { + set-option -g default-command "reattach-to-user-namespace -l zsh" + } { + set-option -g default-command "zsh" + } + bind C-c run "tmux save-buffer - | pbcopy" + bind C-v run "pbpaste | tmux load-buffer - && tmux paste-buffer" +} + +if-shell "uname | grep -q Linux" { + if-shell "command -v zsh &>/dev/null" { + set-option -g default-command "zsh" + } { + set-option -g default-command "bash" + } +} From e4c38e95d8d84e6ff48ed86fe88caf67226aa8a8 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sat, 24 Oct 2020 19:22:54 +1100 Subject: [PATCH 228/234] Drop into tmux before p10k instant prompt Otherwise tmux doesn't think it is inside a tty MOST of the time. --- freshrc | 6 +++--- shells/tmux.sh | 20 +++++++++----------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/freshrc b/freshrc index e34a7f77..d9e1d64f 100644 --- a/freshrc +++ b/freshrc @@ -51,10 +51,10 @@ fresh-options --file=~/.vimrc --marker='"' fresh-options fresh-options --file=~/.zshrc --marker - fresh shells/zsh/p10k-instant-prompt.zsh + fresh shells/path.sh # this must come first so we can check for tmux + fresh shells/tmux.sh # this must happen before p10k to guarantee it has tty - fresh shells/path.sh - fresh shells/tmux.sh + fresh shells/zsh/p10k-instant-prompt.zsh fresh freshshell/fresh contrib/source-build.sh diff --git a/shells/tmux.sh b/shells/tmux.sh index af9f7180..b38a0278 100644 --- a/shells/tmux.sh +++ b/shells/tmux.sh @@ -8,17 +8,15 @@ # If we aren't in Tmux or emacs, set it up if command -v tmux &>/dev/null && [ "$SSH_CONNECTION" -a -z "$TMUX" -a -z "$INSIDE_EMACS" -a -z "$EMACS" -a -z "$VIM" -a -z "$VIMRUNTIME" ]; then if tty >/dev/null; then - if which tmux 2>&1 >/dev/null; then - if [ -z "$(tmux ls | grep 'login:')" ]; then - tmux new-session -d -s login $SHELL # Create a detached session called login - tmux new-session -t login # Create a *new* session bound to the same windows - else - last_session="$(tmux list-windows -t login | tail -n1 | cut -d: -f1)" - tmux new-session -t login \; new-window -a -t $last_session # Create a *new* session bound to "login" and create a new window - fi - - # When Tmux exits, we exit - exit + if [ -z "$(tmux ls | grep 'login:')" ]; then + tmux new-session -d -s login # Create a detached session called login + tmux new-session -t login # Create a *new* session bound to the same windows + else + last_session="$(tmux list-windows -t login | tail -n1 | cut -d: -f1)" + tmux new-session -t login \; new-window -a -t $last_session # Create a *new* session bound to "login" and create a new window fi + + # When Tmux exits, we exit + exit fi fi From 70ddba3e453bbb95bc9800fac12659b284441bd5 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sat, 24 Oct 2020 20:28:38 +1100 Subject: [PATCH 229/234] Simplify Tmux auto-joining This seems to have changed quite a bit since I was using this regularly (~8 years ago) and in my testing today seems to create a situation where every separate session is bound to the same active window. So, while it created a new tmux window (tab) each time I connected, it unfortunately kept all my Terminal windows/sessions in sync so I couldn't view two different Tmux windows within the same session using two different terminal windows. --- shells/tmux.sh | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/shells/tmux.sh b/shells/tmux.sh index b38a0278..0c99b9e9 100644 --- a/shells/tmux.sh +++ b/shells/tmux.sh @@ -1,19 +1,12 @@ -# I always want to be in a Tmux session. Always. -# -# This creates a single always-running "login" session, and creates -# new session as needed that are bound to "login"'s window group. -# This lets me have a different terminals tabs/windows have the same tmux -# windows but be looking at different ones individually +# I always want to be in a Tmux session when SSHing into a box. -# If we aren't in Tmux or emacs, set it up +# If we aren't already in Tmux or emacs, set it up if command -v tmux &>/dev/null && [ "$SSH_CONNECTION" -a -z "$TMUX" -a -z "$INSIDE_EMACS" -a -z "$EMACS" -a -z "$VIM" -a -z "$VIMRUNTIME" ]; then if tty >/dev/null; then - if [ -z "$(tmux ls | grep 'login:')" ]; then - tmux new-session -d -s login # Create a detached session called login - tmux new-session -t login # Create a *new* session bound to the same windows + if ! tmux has-session -t login 2>/dev/null; then + tmux attach-session -t login else - last_session="$(tmux list-windows -t login | tail -n1 | cut -d: -f1)" - tmux new-session -t login \; new-window -a -t $last_session # Create a *new* session bound to "login" and create a new window + tmux new-session -s login fi # When Tmux exits, we exit From 0a357dac9bb7034b36b18c95e36079dae2de9d05 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sun, 25 Oct 2020 08:44:04 +1100 Subject: [PATCH 230/234] OK this is how I want Tmux to work I _thought_ this was how it was working before but apparently not ? --- shells/tmux.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shells/tmux.sh b/shells/tmux.sh index 0c99b9e9..a092170c 100644 --- a/shells/tmux.sh +++ b/shells/tmux.sh @@ -3,8 +3,8 @@ # If we aren't already in Tmux or emacs, set it up if command -v tmux &>/dev/null && [ "$SSH_CONNECTION" -a -z "$TMUX" -a -z "$INSIDE_EMACS" -a -z "$EMACS" -a -z "$VIM" -a -z "$VIMRUNTIME" ]; then if tty >/dev/null; then - if ! tmux has-session -t login 2>/dev/null; then - tmux attach-session -t login + if tmux has-session -t login 2>/dev/null; then + tmux new-session -t login \; new-window else tmux new-session -s login fi From b22171074f9fe20814bce079a59254aac25ab684 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Sun, 25 Oct 2020 08:45:19 +1100 Subject: [PATCH 231/234] Fix after hook in freshrc Doing `test && cmd` means that the command as a whole fails if the test fails, which causes Fresh to think the hook failed. Using a proper conditional (or suffixing `|| true`) would have done the trick. --- freshrc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/freshrc b/freshrc index d9e1d64f..5a2ab026 100644 --- a/freshrc +++ b/freshrc @@ -125,5 +125,7 @@ EOF $vim +PlugUpdate +PlugClean +qall fi - [ -d ~/.asdf/installs ] && find ~/.asdf/installs -maxdepth 2 -mindepth 2 -type d -printf '%P\n' | sort -Vru -t/ -k1,1 | tr / ' ' > ~/.tool-versions + if [ -d ~/.asdf/installs ]; then + find ~/.asdf/installs -maxdepth 2 -mindepth 2 -type d -printf '%P\n' | sort -Vru -t/ -k1,1 | tr / ' ' > ~/.tool-versions + fi } From 65e0a1b8f013e167d72d407fd83879090eb00bfd Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Thu, 18 Nov 2021 11:09:43 +1100 Subject: [PATCH 232/234] Add setup instructions --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 90d553f1..9564c3da 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,12 @@ Please explore and/or suggest! +## Initial setup + +```sh +$ FRESH_LOCAL_SOURCE=bjeanes/dot-files bash -c "`curl -sL https://get.freshshell.com`" +``` + # LICENSE Copyright (c) 2008-2013 Bodaniel Jeanes From cbdacbd7bce66c56bcdae1eed12937d754dd53a7 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Thu, 18 Nov 2021 11:10:21 +1100 Subject: [PATCH 233/234] Update freshrc --- freshrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/freshrc b/freshrc index 5a2ab026..9260b5c7 100644 --- a/freshrc +++ b/freshrc @@ -88,7 +88,7 @@ fresh shells/zsh/completions --file=completion/ fresh romkatv/powerlevel10k . --file=vendor/powerlevel10k/ -fresh zdharma/fast-syntax-highlighting . --file=vendor/zsh-fast-syntax-highlighting/ +fresh zdharma-continuum/fast-syntax-highlighting . --file=vendor/zsh-fast-syntax-highlighting/ fresh zsh-users/zsh-history-substring-search . --file=vendor/zsh-history-substring-search/ fresh zsh-users/zsh-autosuggestions . --file=vendor/zsh-autosuggestions/ From bb3c0db4b1b03e1ddc27a566cedc2af628110019 Mon Sep 17 00:00:00 2001 From: Bo Jeanes Date: Thu, 18 Nov 2021 11:45:39 +1100 Subject: [PATCH 234/234] Setup ASDF from Homebrew properly --- shells/bash/lib/asdf.bash | 3 --- shells/common/asdf.sh | 9 ++++++--- 2 files changed, 6 insertions(+), 6 deletions(-) delete mode 100644 shells/bash/lib/asdf.bash diff --git a/shells/bash/lib/asdf.bash b/shells/bash/lib/asdf.bash deleted file mode 100644 index 2d32e710..00000000 --- a/shells/bash/lib/asdf.bash +++ /dev/null @@ -1,3 +0,0 @@ -if [ -d "$HOME/.asdf" ]; then - . $HOME/.asdf/completions/asdf.bash -fi \ No newline at end of file diff --git a/shells/common/asdf.sh b/shells/common/asdf.sh index 0051dd51..56d506b9 100644 --- a/shells/common/asdf.sh +++ b/shells/common/asdf.sh @@ -1,5 +1,8 @@ -if [ -d "$HOME/.asdf" ]; then +if [ -f "$HOME/.asdf/asdf.sh" ]; then . $HOME/.asdf/asdf.sh - - alias arst=asdf # For Colemak +elif command -v brew &>/dev/null && [ -f "`brew --prefix`/opt/asdf/libexec/asdf.sh" ]; then + . `brew --prefix`/opt/asdf/libexec/asdf.sh fi + +# Colemak alias +command -v asdf &>/dev/null && alias arst=asdf