Skip to content

Commit

Permalink
[master] minor
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Mollowitz committed Mar 22, 2016
1 parent 23e491c commit 7c103dd
Show file tree
Hide file tree
Showing 5 changed files with 251 additions and 185 deletions.
2 changes: 1 addition & 1 deletion .gvimrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
set guifont=Hack\ Regular\ 11
"set guifont=Hack\ Regular\ 11

" no GUI
set guioptions-=l " no left scrollbar
Expand Down
8 changes: 7 additions & 1 deletion .vim/UltiSnips/php.snippets
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
priority -51
priority 1


## CLASS RELATED

Expand Down Expand Up @@ -112,6 +113,11 @@ json_encode($${1:objectToDecode}, ${2:true})$0
endsnippet
## ARRAYS
snippet ake "array_key_exists" i
array_key_exists(${1:key}, ${2:array})
endsnippet
snippet a "array"
[$1]$0
endsnippet
Expand Down
24 changes: 15 additions & 9 deletions .vim/UltiSnips/php_phpunit.snippets
Original file line number Diff line number Diff line change
@@ -1,15 +1,28 @@
snippet tc "TestClass"
<?php

namespace ${1:`!p
abspath = os.path.abspath(path)
m = re.search(r'[A-Z].+(?=/)', abspath)
if m:
snip.rv = m.group().replace('/', '\\')
`};

/*
* Class ${1:`!p snip.rv=snip.fn.split('.')[0]`}
*/
class $1 extends ${3:PHPUnit_Framework_TestCase}
class $1 extends ${3:\PHPUnit_Framework_TestCase}
{
protected function setUp() {
${0:code ...}
}
}
endsnippet

snippet p "Phake::"
Phake::$0;
endsnippet

snippet setup "setup method" !b
protected function setUp() {
${0:code ...}
Expand All @@ -31,13 +44,6 @@ snippet tms "test mark skipped" b
$this->markTestSkipped('This test has not been implemented yet.');
endsnippet

#snippet tm "testMethod sceleton" b
#public function test${1:MethodToTest}Given${2:Scenario}Should${3:ExpectedOutcome}()
#{
#$0
#}
#endsnippet

snippet g "@group"
@group $0
endsnippet
Expand All @@ -50,7 +56,7 @@ snippet tm "test method annotated" b
/**
* @test
*/
public function ${1:methodToTest}Should${2:Expected}Given${3:Scenario}()
public function should$1()
{
$0
}
Expand Down
103 changes: 69 additions & 34 deletions .vim/autoload/plug.vim
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,20 @@
" call plug#begin('~/.vim/plugged')
"
" " Make sure you use single quotes
" Plug 'junegunn/seoul256.vim'
"
" " 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 git URL
" Plug 'https://github.com/junegunn/vim-github-dashboard.git'
"
" " Using a non-master branch
" Plug 'rdnetto/YCM-Generator', { 'branch': 'stable' }
"
Expand All @@ -40,7 +41,21 @@
" call plug#end()
"
" Then reload .vimrc and :PlugInstall to install plugins.
" Visit https://github.com/junegunn/vim-plug for more information.
"
" 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 `<Plug>`-mappings |
"| `for` | On-demand loading: File types |
"| `frozen` | Do not update unless explicitly specified |
"
" More information: https://github.com/junegunn/vim-plug
"
"
" Copyright (c) 2015 Junegunn Choi
Expand Down Expand Up @@ -113,9 +128,9 @@ function! plug#begin(...)
endfunction

function! s:define_commands()
command! -nargs=+ -bar Plug call s:add(<args>)
command! -nargs=+ -bar Plug call s:Plug(<args>)
if !executable('git')
return s:err('`git` executable not found. vim-plug requires 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(<bang>0, [<f-args>])
command! -nargs=* -bar -bang -complete=customlist,s:names PlugUpdate call s:update(<bang>0, [<f-args>])
Expand Down Expand Up @@ -233,7 +248,9 @@ function! plug#end()
call s:reorg_rtp()
filetype plugin indent on
if has('vim_starting')
syntax enable
if has('syntax') && !exists('g:syntax_on')
syntax enable
end
else
call s:reload()
endif
Expand Down Expand Up @@ -396,7 +413,7 @@ function! s:remove_triggers(name)
call remove(s:triggers, a:name)
endfunction

function! s:lod(names, types)
function! s:lod(names, types, ...)
for name in a:names
call s:remove_triggers(name)
let s:loaded[name] = 1
Expand All @@ -408,14 +425,18 @@ function! s:lod(names, types)
for dir in a:types
call s:source(rtp, dir.'/**/*.vim')
endfor
for file in a:000
call s:source(rtp, file)
endfor
if exists('#User#'.name)
execute 'doautocmd User' name
endif
endfor
endfunction

function! s:lod_ft(pat, names)
call s:lod(a:names, ['plugin', 'after/plugin', 'syntax', 'after/syntax'])
let syn = 'syntax/'.a:pat.'.vim'
call s:lod(a:names, ['plugin', 'after/plugin'], syn, 'after/'.syn)
execute 'autocmd! PlugLOD FileType' a:pat
if exists('#filetypeplugin#FileType')
doautocmd filetypeplugin FileType
Expand Down Expand Up @@ -443,16 +464,16 @@ function! s:lod_map(map, names, prefix)
call feedkeys(a:prefix . substitute(a:map, '^<Plug>', "\<Plug>", '') . extra)
endfunction

function! s:add(repo, ...)
function! s:Plug(repo, ...)
if a:0 > 1
return s:err('Invalid number of arguments (1..2)')
endif

try
let repo = s:trim(a:repo)
let name = fnamemodify(repo, ':t:s?\.git$??')
let spec = extend(s:infer_properties(name, repo),
\ a:0 == 1 ? s:parse_options(a:1) : s:base_spec)
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
Expand Down Expand Up @@ -620,32 +641,41 @@ function! s:switch_out(...)
endif
endfunction

function! s:prepare()
function! s:finish_bindings()
nnoremap <silent> <buffer> R :silent! call <SID>retry()<cr>
nnoremap <silent> <buffer> D :PlugDiff<cr>
nnoremap <silent> <buffer> S :PlugStatus<cr>
nnoremap <silent> <buffer> U :call <SID>status_update()<cr>
xnoremap <silent> <buffer> U :call <SID>status_update()<cr>
nnoremap <silent> <buffer> ]] :silent! call <SID>section('')<cr>
nnoremap <silent> <buffer> [[ :silent! call <SID>section('b')<cr>
endfunction

function! s:prepare(...)
call s:job_abort()
if s:switch_in()
silent %d _
else
call s:new_window()
nnoremap <silent> <buffer> q :if b:plug_preview==1<bar>pc<bar>endif<bar>bd<cr>
nnoremap <silent> <buffer> R :silent! call <SID>retry()<cr>
nnoremap <silent> <buffer> D :PlugDiff<cr>
nnoremap <silent> <buffer> S :PlugStatus<cr>
nnoremap <silent> <buffer> U :call <SID>status_update()<cr>
xnoremap <silent> <buffer> U :call <SID>status_update()<cr>
nnoremap <silent> <buffer> ]] :silent! call <SID>section('')<cr>
nnoremap <silent> <buffer> [[ :silent! call <SID>section('b')<cr>
let b:plug_preview = -1
let s:plug_tab = tabpagenr()
let s:plug_buf = winbufnr(0)
call s:assign_name()
normal q
endif

call s:new_window()
nnoremap <silent> <buffer> q :if b:plug_preview==1<bar>pc<bar>endif<bar>bd<cr>
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 <buffer> <cr>
silent! unmap <buffer> L
silent! unmap <buffer> o
silent! unmap <buffer> X
setlocal buftype=nofile bufhidden=wipe nobuflisted noswapfile nowrap cursorline modifiable
setf vim-plug
call s:syntax()
if exists('g:syntax_on')
call s:syntax()
endif
endfunction

function! s:assign_name()
Expand Down Expand Up @@ -755,6 +785,7 @@ function! s:finish(pull)
call add(msgs, "Press 'D' to see the updated changes.")
endif
echo join(msgs, ' ')
call s:finish_bindings()
endfunction

function! s:retry()
Expand Down Expand Up @@ -829,7 +860,7 @@ function! s:update_impl(pull, force, args) abort
\ 'fin': 0
\ }

call s:prepare()
call s:prepare(1)
call append(0, ['', ''])
normal! 2G
silent! redraw
Expand All @@ -840,7 +871,7 @@ function! s:update_impl(pull, force, args) abort
" 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())
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])
Expand Down Expand Up @@ -2017,8 +2048,12 @@ function! s:diff()
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 reverse(sort(items(filter(copy(total), (origin ? '' : '!').'(has_key(v:val, "commit") || has_key(v:val, "tag"))'))))
for [k, v] in plugs
let range = origin ? '..origin/'.v.branch : 'HEAD@{1}..'
let diff = s:system_chomp('git log --pretty=format:"%h%x01%d%x01%s%x01%cr" '.s:shellesc(range), v.dir)
if !empty(diff)
Expand Down
Loading

0 comments on commit 7c103dd

Please sign in to comment.