From 04a493f5d087b1e1bf48c05aa9d923bffec6f126 Mon Sep 17 00:00:00 2001 From: Thomas Ruoff Date: Wed, 22 Apr 2015 23:08:09 +0200 Subject: [PATCH 1/5] reoder vim plugins --- vimrc | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/vimrc b/vimrc index 8569c19..4ae4f44 100644 --- a/vimrc +++ b/vimrc @@ -4,47 +4,44 @@ Plug 'tpope/vim-sensible' Plug 'L9' Plug 'unimpaired.vim' +Plug 'surround.vim' + +Plug 'editorconfig/editorconfig-vim' Plug 'Shougo/unite.vim' - -Plug 'scrooloose/nerdtree' Plug 'kien/ctrlp.vim' +Plug 'scrooloose/nerdtree' +Plug 'Valloric/YouCompleteMe', { 'do': './install.sh' } + +Plug 'sjl/gundo.vim' +Plug 'nathanaelkane/vim-indent-guides' Plug 'scrooloose/nerdcommenter' -Plug 'surround.vim' +Plug 'sheerun/vim-polyglot' Plug 'SirVer/ultisnips' Plug 'honza/vim-snippets' -Plug 'sjl/gundo.vim' - -Plug 'editorconfig/editorconfig-vim' - -Plug 'Valloric/YouCompleteMe', { 'do': './install.sh' } - -Plug 'sheerun/vim-polyglot' - -Plug 'nathanaelkane/vim-indent-guides' +Plug 'scrooloose/syntastic' Plug 'tpope/vim-fugitive' Plug 'airblade/vim-gitgutter' +Plug 'inside/vim-search-pulse' Plug 'rking/ag.vim' Plug 'christoomey/vim-tmux-navigator' - Plug 'itchyny/lightline.vim' Plug 'chriskempson/base16-vim' -Plug 'scrooloose/syntastic' Plug 'Raimondi/delimitMate' -Plug 'marijnh/tern_for_vim', { 'do': 'npm install' } - +Plug 'marijnh/tern_for_vim', { 'do': 'npm install', 'for': 'javascript'} Plug 'mustache/vim-mustache-handlebars' -Plug 'inside/vim-search-pulse' +Plug 'shime/vim-livedown' + call plug#end() From 96b197a5db6bcf027fd7b44ebc88127b777a04b6 Mon Sep 17 00:00:00 2001 From: Thomas Ruoff Date: Wed, 22 Apr 2015 23:10:11 +0200 Subject: [PATCH 2/5] saner copy mode keybindings --- tmux.conf | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tmux.conf b/tmux.conf index da6f6d4..772db99 100644 --- a/tmux.conf +++ b/tmux.conf @@ -17,6 +17,12 @@ unbind C-b set -g prefix C-a bind C-a send-prefix +# Copy-paste integration +setw -g mode-keys vi +bind -t vi-copy 'v' begin-selection +bind -t vi-copy 'y' copy-selection +bind y run-shell "tmux show-buffer | xclip -sel clip -i" \; display-message "Copied tmux buffer to system clipboard" + # splitting panes bind v split-window -h bind s split-window -v From c232aa92400b9db6f2d462b232572fa34ca22656 Mon Sep 17 00:00:00 2001 From: Thomas Ruoff Date: Wed, 22 Apr 2015 23:11:01 +0200 Subject: [PATCH 3/5] update plug --- vim/autoload/plug.vim | 162 ++++++++++++++++++------------------------ 1 file changed, 68 insertions(+), 94 deletions(-) diff --git a/vim/autoload/plug.vim b/vim/autoload/plug.vim index 7ec5945..a2e057f 100644 --- a/vim/autoload/plug.vim +++ b/vim/autoload/plug.vim @@ -3,8 +3,7 @@ " " Download plug.vim and put it in ~/.vim/autoload " -" mkdir -p ~/.vim/autoload -" curl -fLo ~/.vim/autoload/plug.vim \ +" curl -fLo ~/.vim/autoload/plug.vim --create-dirs \ " https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim " " Edit your .vimrc @@ -37,7 +36,7 @@ " Visit https://github.com/junegunn/vim-plug for more information. " " -" Copyright (c) 2014 Junegunn Choi +" Copyright (c) 2015 Junegunn Choi " " MIT License " @@ -68,14 +67,14 @@ let g:loaded_plug = 1 let s:cpo_save = &cpo set cpo&vim -let s:plug_src = 'https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.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:py2 = has('python') && !s:is_win && !has('win32unix') -let s:ruby = has('ruby') && (v:version >= 703 || v:version == 702 && has('patch374')) -let s:nvim = has('nvim') && !s:is_win +let s:py2 = has('python') && !has('nvim') && !s:is_win && !has('win32unix') +let s:ruby = has('ruby') && !has('nvim') && (v:version >= 703 || v:version == 702 && has('patch374')) +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 = { @@ -166,7 +165,7 @@ function! plug#end() if has_key(plug, 'on') let s:triggers[name] = { 'map': [], 'cmd': [] } for cmd in s:to_a(plug.on) - if cmd =~ '^.\+' + if cmd =~? '^.\+' if empty(mapcheck(cmd)) && empty(mapcheck(cmd, 'i')) call s:assoc(lod.map, cmd, name) endif @@ -271,7 +270,7 @@ if s:is_win endfunction function! s:is_local_plug(repo) - return a:repo =~? '^[a-z]:' + return a:repo =~? '^[a-z]:\|^[%~]' endfunction else function! s:rtp(spec) @@ -741,6 +740,12 @@ function! s:update_impl(pull, force, args) abort endtry endif + if has('nvim') && !exists('*jobwait') && threads > 1 + echohl WarningMsg + echomsg 'vim-plug: update Neovim for parallel installer' + echohl None + endif + let s:update = { \ 'start': reltime(), \ 'all': todo, @@ -818,9 +823,7 @@ function! s:job_abort() if !s:nvim || !exists('s:jobs') return endif - augroup PlugJobControl - autocmd! - augroup END + for [name, j] in items(s:jobs) silent! call jobstop(j.jobid) if j.new @@ -830,52 +833,48 @@ function! s:job_abort() let s:jobs = {} endfunction -function! s:job_handler(name) abort +" 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 !has_key(s:jobs, a:name) - return - endif - let job = s:jobs[a:name] - - if v:job_data[1] == 'exit' - let job.running = 0 - if s:lastline(job.result) ==# 'Error' - let job.error = 1 - let job.result = substitute(job.result, "Error[\r\n]$", '', '') - endif - call s:reap(a:name) - call s:tick() - else - let job.result .= s:to_s(v:job_data[2]) + if a:event == 'stdout' + let self.result .= substitute(s:to_s(a:data), '[\r\n]', '', 'g') . "\n" " To reduce the number of buffer updates - let job.tick = get(job, 'tick', -1) + 1 - if job.tick % len(s:jobs) == 0 - call s:log(job.new ? '+' : '*', a:name, job.result) + 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 = { 'running': 1, 'new': get(a:opts, 'new', 0), - \ 'error': 0, 'result': '' } + let job = { 'name': a:name, 'running': 1, 'error': 0, '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 x = jobstart(a:name, 'sh', ['-c', - \ (has_key(a:opts, 'dir') ? s:with_cd(a:cmd, a:opts.dir) : a:cmd) - \ . ' || echo Error']) - if x > 0 - let job.jobid = x - augroup PlugJobControl - execute 'autocmd JobActivity' a:name printf('call s:job_handler(%s)', string(a:name)) - augroup END + 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 = x < 0 ? 'sh is not executable' : + let job.result = jid < 0 ? 'sh is not executable' : \ 'Invalid arguments (or job table is full)' endif else @@ -887,10 +886,6 @@ function! s:spawn(name, cmd, opts) endfunction function! s:reap(name) - if s:nvim - silent! execute 'autocmd! PlugJobControl JobActivity' a:name - endif - let job = s:jobs[a:name] if job.error call add(s:update.errors, a:name) @@ -1679,6 +1674,12 @@ function! s:git_valid(spec, check_branch) return [ret, msg] 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 unused plugins in '.g:plug_home) @@ -1727,9 +1728,7 @@ function! s:clean(force) call inputrestore() if yes for dir in todo - if isdirectory(dir) - call s:system((s:is_win ? 'rmdir /S /Q ' : 'rm -rf ') . s:shellesc(dir)) - endif + call s:rm_rf(dir) endfor call append(line('$'), 'Removed.') else @@ -1740,55 +1739,30 @@ function! s:clean(force) endfunction function! s:upgrade() - let new = s:me . '.new' - echo 'Downloading '. s:plug_src + echo 'Downloading the latest version of vim-plug' redraw + let tmp = tempname() + let new = tmp . '/plug.vim' + try - if executable('curl') - let output = s:system(printf('curl -fLo %s %s', s:shellesc(new), s:plug_src)) - if v:shell_error - throw get(s:lines(output), -1, v:shell_error) - endif - elseif has('ruby') - call s:upgrade_using_ruby(new) - elseif has('python') - call s:upgrade_using_python(new) - else - return s:err('Missing: curl executable, ruby support or python support') + 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 - catch - return s:err('Error upgrading vim-plug: '. v:exception) + + 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 - - if readfile(s:me) ==# readfile(new) - echo 'vim-plug is already up-to-date' - silent! call delete(new) - 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 -endfunction - -function! s:upgrade_using_ruby(new) - ruby << EOF - require 'open-uri' - File.open(VIM::evaluate('a:new'), 'w') do |f| - f << open(VIM::evaluate('s:plug_src')).read - end -EOF -endfunction - -function! s:upgrade_using_python(new) -python << EOF -import urllib -import vim -psrc, dest = vim.eval('s:plug_src'), vim.eval('a:new') -urllib.urlretrieve(psrc, dest) -EOF endfunction function! s:upgrade_specs() From 4c5b3f55d564823e4299abd26ab7962f5ade4b60 Mon Sep 17 00:00:00 2001 From: Thomas Ruoff Date: Mon, 1 Jun 2015 22:44:25 +0200 Subject: [PATCH 4/5] add line wrap for markdown --- vimrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vimrc b/vimrc index 4ae4f44..b889931 100644 --- a/vimrc +++ b/vimrc @@ -290,7 +290,7 @@ au BufNewFile,BufRead *.txt set filetype=human au FileType human,mail,tex set wrap wm=2 textwidth=78 nocindent spell "" Markdown -au FileType markdown set spell +au FileType markdown set wrap wm=2 textwidth=78 nocindent spell "" Python au FileType python set noexpandtab From cc42a8645980fbadbaa80d8a1a3730248365c520 Mon Sep 17 00:00:00 2001 From: Thomas Ruoff Date: Mon, 15 Jun 2015 20:16:18 +0200 Subject: [PATCH 5/5] use antigen --- .gitmodules | 6 ++--- antigen | 1 + oh-my-zsh | 1 - zshenv | 24 +++++++++-------- zshrc | 74 ++++++----------------------------------------------- 5 files changed, 26 insertions(+), 80 deletions(-) create mode 160000 antigen delete mode 160000 oh-my-zsh diff --git a/.gitmodules b/.gitmodules index 3da96cf..879097d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,6 @@ -[submodule "oh-my-zsh"] - path = oh-my-zsh - url = git@github.com:robbyrussell/oh-my-zsh.git [submodule "base16-shell"] path = base16-shell url = git@github.com:chriskempson/base16-shell.git +[submodule "antigen"] + path = antigen + url = https://github.com/zsh-users/antigen.git diff --git a/antigen b/antigen new file mode 160000 index 0000000..7860ce7 --- /dev/null +++ b/antigen @@ -0,0 +1 @@ +Subproject commit 7860ce7aecdbed8fd8ff75472ac59c52c2ac9a7e diff --git a/oh-my-zsh b/oh-my-zsh deleted file mode 160000 index 1b7a3ea..0000000 --- a/oh-my-zsh +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 1b7a3ea99a8b566510ab7881063148c43be6b98d diff --git a/zshenv b/zshenv index 593498d..c36716a 100644 --- a/zshenv +++ b/zshenv @@ -1,8 +1,8 @@ -################## +######################## # Source Things -################# +######################## -# solarized dircolors +# dircolors [ -s ~/.dircolors ] && . ~/.dircolors # extend path @@ -10,20 +10,24 @@ export PATH=$HOME/local/bin:$PATH # nvm export NVM_DIR="$HOME/.nvm" -[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm - -# todo.sh -alias t=todo.sh +[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" && nvm use > /dev/null # Base16 Shell BASE16_SCHEME="solarized" BASE16_SHELL="$HOME/.base16-shell/base16-$BASE16_SCHEME.dark.sh" [[ -s $BASE16_SHELL ]] && . $BASE16_SHELL +######################## +# Dist related settings +######################## DIST=$(lsb_release -si) -case $DIST in +case DIST in Arch ) - # use python 2.7 by default - export PYTHON=python2 ;; esac + +######################## +# Aliases +######################## +alias g=git +rl () { $(npm bin)/$* } diff --git a/zshrc b/zshrc index 5a25a75..506c48a 100644 --- a/zshrc +++ b/zshrc @@ -1,72 +1,14 @@ -export ZSH=$HOME/.oh-my-zsh +source ~/.dotfiles/antigen/antigen.zsh -ZSH_THEME="pygmalion" +antigen bundle zsh-users/zsh-syntax-highlighting +antigen bundle peterhurford/git-it-on.zsh +antigen bundle gerges/oh-my-zsh-jira-plus -plugins=(bower gitfast git-extras node npm pass screen vi-mode tmux) +antigen use oh-my-zsh -case $(hostname) in - t430s-arch|pi) - plugins+=(archlinux systemd) - ;; - cassiopeia.uberspace.de) - plugins+=() - ;; - everard) - plugins+=(debian jira) - ;; -esac +antigen bundle command-not-found +antigen theme robbyrussell -source $ZSH/oh-my-zsh.sh - -# You may need to manually set your language environment -# export LANG=en_US.UTF-8 - -# turn of autocorrection -unsetopt correct_all - -################# -## Keybindings -################ -bindkey "^P" vi-up-line-or-history -bindkey "^N" vi-down-line-or-history - -bindkey "^[[1~" vi-beginning-of-line # Home -bindkey "^[[4~" vi-end-of-line # End -bindkey '^[[2~' beep # Insert -bindkey '^[[3~' delete-char # Del -bindkey '^[[5~' vi-backward-blank-word # Page Up -bindkey '^[[6~' vi-forward-blank-word # Page Down - -bindkey -M viins '^r' history-incremental-search-backward -bindkey -M vicmd '^r' history-incremental-search-backward - -bindkey -a 'gg' beginning-of-buffer-or-history -bindkey -a 'g~' vi-oper-swap-case -bindkey -a G end-of-buffer-or-history - -bindkey -a u undo -bindkey -a '^R' redo -bindkey '^?' backward-delete-char -bindkey '^H' backward-delete-char +antigen apply -TRAPWINCH() { - zle && { zle reset-prompt; zle -R } -} - -################## -# Source Things -################# - -# solarized dircolors -source ~/.dircolors - -# nvm -export NVM_DIR="$HOME/.nvm" -[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm - -# rvm -if [ -s "$HOME/.rvm/scripts/rvm" ] ; then - source $HOME/.rvm/scripts/rvm - export PATH="$PATH:$HOME/.rvm/bin" -fi