From 785e1dd0c3419749dc546308bfb8b3cb4c9ab773 Mon Sep 17 00:00:00 2001 From: michener Date: Fri, 1 Apr 2011 23:49:21 +0000 Subject: [PATCH] Add PTW to vim git-svn-id: http://photonzero.com/dotfiles/trunk@91 23f722f6-122a-0410-8cef-c75bd312dd78 --- .vimrc | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/.vimrc b/.vimrc index e60aaf5..2a5c4ee 100644 --- a/.vimrc +++ b/.vimrc @@ -240,6 +240,7 @@ nnoremap aw :AckWord nnoremap ac :Ack nnoremap hh :A nnoremap j +nnoremap 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 r :call ExecuteInShell(''' . command . ''')' 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() -command! -nargs=* Make call s:ExecuteInShell('make '.) -command! -nargs=* Git call s:ExecuteInShell('git '.) +command! -complete=shellcmd -nargs=+ Shell call s:ExecuteInShellOutput() +command! -complete=shellcmd -nargs=+ Exec call s:ExecuteInShell() +command! -nargs=* Make call s:ExecuteInShellOutput('make '.) +command! -nargs=* Git call s:ExecuteInShellOutput('git '.) +command! -nargs=* PTW call s:ExecuteInShell('ptw post --client=vim "'..'"')