Pārlūkot izejas kodu

Fix tmux<2.0 complaining about alert styling

Weiyi Lou 9 gadi atpakaļ
vecāks
revīzija
fd69aef427
4 mainītis faili ar 28 papildinājumiem un 16 dzēšanām
  1. 5 4
      bin/dotfiles-upgrade
  2. 0 3
      tmux/tmuxcolors-256.conf
  3. 2 0
      tmux/tmuxcolours2.conf
  4. 21 9
      vim/autoload/plug.vim

+ 5 - 4
bin/dotfiles-upgrade

@@ -26,6 +26,11 @@ echo "Downloading files from external sources:"
 #curl -# https://gist.githubusercontent.com/octocat/9257657/raw/3f9569e65df83a7b328b39a091f0ce9c6efc6429/.gitignore \
   #-o ~/dotfiles/git/globalignore
 
+# No need to update. Here for reference.
+#echo "tmux colours - solarized 256"
+#curl -# https://raw.githubusercontent.com/seebi/tmux-colors-solarized/master/tmuxcolors-256.conf \
+  #-o ~/dotfiles/tmux/tmuxcolors-256.conf
+
 echo "Completions for bash"
 curl -# https://raw.githubusercontent.com/tmuxinator/tmuxinator/master/completion/tmuxinator.bash \
   -o ~/dotfiles/shell/bash/tmuxinator.bash
@@ -38,10 +43,6 @@ curl -# https://raw.githubusercontent.com/zsh-users/zsh-completions/master/src/_
 curl -# https://raw.githubusercontent.com/zsh-users/zsh-completions/master/src/_ag \
   -o ~/dotfiles/shell/zsh/completions/_ag
 
-echo "tmux colours - solarized 256"
-curl -# https://raw.githubusercontent.com/seebi/tmux-colors-solarized/master/tmuxcolors-256.conf \
-  -o ~/dotfiles/tmux/tmuxcolors-256.conf
-
 echo "z"
 curl -# https://raw.githubusercontent.com/rupa/z/master/z.sh \
   -o ~/dotfiles/shell/common/z.sh

+ 0 - 3
tmux/tmuxcolors-256.conf

@@ -29,6 +29,3 @@ set-option -g display-panes-colour colour166 #orange
 
 # clock
 set-window-option -g clock-mode-colour colour64 #green
-
-# bell
-set-window-option -g window-status-bell-style fg=colour235,bg=colour160 #base02, red

+ 2 - 0
tmux/tmuxcolours2.conf

@@ -1,3 +1,5 @@
 # vim: ft=tmux
 
+set-window-option -g window-status-bell-style fg=colour235,bg=colour160 #base02, red
+
 set-option -g window-status-format "#[bg=colour234] #[fg=colour244]#I#[fg=red]#{?window_last_flag,=, }#[fg=colour249]#W "

+ 21 - 9
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.
@@ -225,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
@@ -750,7 +751,7 @@ function! s:prepare(...)
   for k in ['<cr>', 'L', 'o', 'X', 'd', 'dd']
     execute 'silent! unmap <buffer>' k
   endfor
-  setlocal buftype=nofile bufhidden=wipe nobuflisted nolist noswapfile nowrap cursorline modifiable
+  setlocal buftype=nofile bufhidden=wipe nobuflisted nolist noswapfile nowrap cursorline modifiable nospell
   setf vim-plug
   if exists('g:syntax_on')
     call s:syntax()
@@ -954,7 +955,7 @@ function! s:update_impl(pull, force, args) abort
 
   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')) && s:check_ruby()
+  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(),
@@ -1152,7 +1153,7 @@ function! s:job_cb(fn, job, ch, data)
   call call(a:fn, [a:job, a:data])
 endfunction
 
-function! s:nvim_cb(job_id, data, event) abort
+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)
@@ -2012,10 +2013,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