Add PTW to vim

git-svn-id: http://photonzero.com/dotfiles/trunk@91 23f722f6-122a-0410-8cef-c75bd312dd78
This commit is contained in:
michener 2011-04-01 23:49:21 +00:00
parent 9358ed7abb
commit 785e1dd0c3

17
.vimrc
View file

@ -240,6 +240,7 @@ nnoremap <Leader>aw :AckWord<CR>
nnoremap <Leader>ac :Ack
nnoremap <Leader>hh :A<CR>
nnoremap <Leader>j <C-^>
nnoremap <Leader>p :PTW
" Googley things....
@ -279,7 +280,7 @@ if filereadable("/home/build/nonconf/google3/tools/tags/gtags.vim")
endif
" new shell execute that pipes output to window
function! s:ExecuteInShell(command)
function! s:ExecuteInShellOutput(command)
let command = join(map(split(a:command), 'expand(v:val)'))
let winnr = bufwinnr('^' . command . '$')
silent! execute winnr < 0 ? 'botright new ' . fnameescape(command) : winnr . 'wincmd w'
@ -293,8 +294,16 @@ function! s:ExecuteInShell(command)
silent! execute 'nnoremap <silent> <buffer> <LocalLeader>r :call <SID>ExecuteInShell(''' . command . ''')<CR>'
echo 'Execution of ' . command . ' complete.'
endfunction
function! s:ExecuteInShell(command)
let command = join(map(split(a:command), 'expand(v:val)'))
silent! execute 'silent !'. command
redraw!
echo 'Execution of ' . command . ' complete.'
endfunction
command! -complete=shellcmd -nargs=+ Shell call s:ExecuteInShell(<q-args>)
command! -nargs=* Make call s:ExecuteInShell('make '.<q-args>)
command! -nargs=* Git call s:ExecuteInShell('git '.<q-args>)
command! -complete=shellcmd -nargs=+ Shell call s:ExecuteInShellOutput(<q-args>)
command! -complete=shellcmd -nargs=+ Exec call s:ExecuteInShell(<q-args>)
command! -nargs=* Make call s:ExecuteInShellOutput('make '.<q-args>)
command! -nargs=* Git call s:ExecuteInShellOutput('git '.<q-args>)
command! -nargs=* PTW call s:ExecuteInShell('ptw post --client=vim "'.<q-args>.'"')