(Change to TipImported template + severe manual clean) |
(link to plugin that provides wrappers for most Tortoise commands) Tag: sourceedit |
||
(5 intermediate revisions by 3 users not shown) | |||
Line 4: | Line 4: | ||
|previous=1490 |
|previous=1490 |
||
|next=1495 |
|next=1495 |
||
− | |created= |
+ | |created=2007 |
|complexity=basic |
|complexity=basic |
||
|author=Rex Kerr |
|author=Rex Kerr |
||
|version=5.7 |
|version=5.7 |
||
|rating=18/8 |
|rating=18/8 |
||
⚫ | |||
+ | |category2= |
||
}} |
}} |
||
Tortoise SVN is the best Subversion GUI available. That said, it would be nice if you could launch the various commands from within Vim so that you don't have to go back to Explorer to get the context menu. Here are some mappings that work on the current buffer. |
Tortoise SVN is the best Subversion GUI available. That said, it would be nice if you could launch the various commands from within Vim so that you don't have to go back to Explorer to get the context menu. Here are some mappings that work on the current buffer. |
||
Line 14: | Line 16: | ||
<pre> |
<pre> |
||
" Save the current buffer and execute the Tortoise SVN interface's diff program |
" Save the current buffer and execute the Tortoise SVN interface's diff program |
||
− | map |
+ | map <silent> ,tdiff :w<CR>:silent !"C:\Progra~1\TortoiseSVN\bin\TortoiseProc.exe /command:diff /path:"%" /notempfile /closeonend"<CR> |
" Save the current buffer and execute the Tortoise SVN interface's log |
" Save the current buffer and execute the Tortoise SVN interface's log |
||
− | map |
+ | map <silent> ,tlog :w<CR>:silent !"C:\Progra~1\TortoiseSVN\bin\TortoiseProc.exe /command:log /path:"%" /notempfile /closeonend"<CR> |
" Save the current buffer and execute the Tortoise SVN interface's revision graph |
" Save the current buffer and execute the Tortoise SVN interface's revision graph |
||
− | map |
+ | map <silent> ,trevs :w<CR>:silent !"C:\Progra~1\TortoiseSVN\bin\TortoiseProc.exe /command:revisiongraph epath:"%" /notempfile /closeonend"<CR> |
" Save the current buffer and execute the Tortoise SVN interface's blame program |
" Save the current buffer and execute the Tortoise SVN interface's blame program |
||
− | map |
+ | map <silent> ,tblame :call TortoiseBlame()<CR> |
function! TortoiseBlame() |
function! TortoiseBlame() |
||
Line 36: | Line 38: | ||
Others can be added very simply by using these as a template. The command line options are documented at http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-automation.html |
Others can be added very simply by using these as a template. The command line options are documented at http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-automation.html |
||
+ | |||
+ | ==Related Plugins== |
||
+ | * {{script|id=2760|text=Tortoise}} plugin |
||
==Comments== |
==Comments== |
||
Line 42: | Line 47: | ||
<pre> |
<pre> |
||
" Save current buffer and diff the file using Tortoise SVN |
" Save current buffer and diff the file using Tortoise SVN |
||
− | map |
+ | map <unique> <silent> <Leader>td :w<CR>:silent !'/C/Program Files/TortoiseSVN/bin/TortoiseProc.exe' /command:diff /path:'%' /notempfile /closeonend<CR> |
" Save current buffer and launch Tortoise SVN's revision graph |
" Save current buffer and launch Tortoise SVN's revision graph |
||
− | map |
+ | map <unique> <silent> <Leader>tr :w<CR>:silent!'/C/Program Files/TortoiseSVN/bin/TortoiseProc.exe' /command:revisiongraph epath:'%' /notempfile /closeonend<CR> |
" Save the current buffer and execute the Tortoise SVN interface's blame program |
" Save the current buffer and execute the Tortoise SVN interface's blame program |
||
− | map |
+ | map <unique> <Leader>tb :call TortoiseBlame()<CR> |
" Save the current buffer and execute the Tortoise SVN interface's log |
" Save the current buffer and execute the Tortoise SVN interface's log |
||
− | map |
+ | map <unique> <silent> <Leader>tl :w<CR>:silent !'/c/Program Files/TortoiseSVN/bin/TortoiseProc.exe' /command:log /path:'%' /notempfile /closeonend<CR> |
function! TortoiseBlame() |
function! TortoiseBlame() |
||
Line 68: | Line 73: | ||
Go to tortoisesvn, settings |
Go to tortoisesvn, settings |
||
− | Diff viewer : < |
+ | Diff viewer : <code>gvim -d %base %mine</code> |
− | + | Diff viewer in tab in running vim: <code>gvim --remote-tab +"vert diffsplit %base" "%mine"</code> |
|
+ | |||
+ | Merge Tool : <code>gvim -c":tabnew %merged" -d %theirs %mine</code> |
||
---- |
---- |
||
+ | Commit all currently open files (buffers) using TortoiseSVN: |
||
⚫ | |||
+ | |||
+ | <pre> |
||
+ | func! CommitSVNAll() |
||
+ | let buflist = [] |
||
+ | for b in range(1, bufnr('$')) |
||
+ | if buflisted(b) && filereadable(bufname(b)) |
||
+ | call add(buflist, fnamemodify(bufname(b), ':p')) |
||
+ | endif |
||
+ | endfor |
||
+ | let files = join(buflist, '*') |
||
+ | if files != '' |
||
+ | silent exec '!start "C:\Program Files\TortoiseSVN\bin\TortoiseProc.exe" /command:commit /path:"'.files.'" /closeonend:4' |
||
+ | else |
||
+ | call confirm('No files loaded') |
||
+ | endif |
||
+ | endfunc |
||
+ | |||
+ | call CommitSVNAll() |
||
+ | </pre> |
Latest revision as of 18:08, 7 December 2016
created 2007 · complexity basic · author Rex Kerr · version 5.7
Tortoise SVN is the best Subversion GUI available. That said, it would be nice if you could launch the various commands from within Vim so that you don't have to go back to Explorer to get the context menu. Here are some mappings that work on the current buffer.
" Save the current buffer and execute the Tortoise SVN interface's diff program map <silent> ,tdiff :w<CR>:silent !"C:\Progra~1\TortoiseSVN\bin\TortoiseProc.exe /command:diff /path:"%" /notempfile /closeonend"<CR> " Save the current buffer and execute the Tortoise SVN interface's log map <silent> ,tlog :w<CR>:silent !"C:\Progra~1\TortoiseSVN\bin\TortoiseProc.exe /command:log /path:"%" /notempfile /closeonend"<CR> " Save the current buffer and execute the Tortoise SVN interface's revision graph map <silent> ,trevs :w<CR>:silent !"C:\Progra~1\TortoiseSVN\bin\TortoiseProc.exe /command:revisiongraph epath:"%" /notempfile /closeonend"<CR> " Save the current buffer and execute the Tortoise SVN interface's blame program map <silent> ,tblame :call TortoiseBlame()<CR> function! TortoiseBlame() " Save the buffer silent execute(':w') " Now run Tortoise to get the blame dialog to display let filename = expand("%") let linenum = line(".") silent execute('!C:\Progra~1\TortoiseSVN\bin\TortoiseProc.exe /command:blame /path:"' . filename . '" /line:' . linenum . ' /notempfile /closeonend') endfunction
Others can be added very simply by using these as a template. The command line options are documented at http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-automation.html
Related Plugins[]
- Tortoise plugin
Comments[]
I use Vim from within bash on Windows XP and had to switch the path's to be more cygwin compliant. I also switched some of the double quotes to single quotes. Everything works great except that it takes forever to build my revision graph. Here's my slight changes. I also used a different mapping than above, but that just a preference of mine:
" Save current buffer and diff the file using Tortoise SVN map <unique> <silent> <Leader>td :w<CR>:silent !'/C/Program Files/TortoiseSVN/bin/TortoiseProc.exe' /command:diff /path:'%' /notempfile /closeonend<CR> " Save current buffer and launch Tortoise SVN's revision graph map <unique> <silent> <Leader>tr :w<CR>:silent!'/C/Program Files/TortoiseSVN/bin/TortoiseProc.exe' /command:revisiongraph epath:'%' /notempfile /closeonend<CR> " Save the current buffer and execute the Tortoise SVN interface's blame program map <unique> <Leader>tb :call TortoiseBlame()<CR> " Save the current buffer and execute the Tortoise SVN interface's log map <unique> <silent> <Leader>tl :w<CR>:silent !'/c/Program Files/TortoiseSVN/bin/TortoiseProc.exe' /command:log /path:'%' /notempfile /closeonend<CR> function! TortoiseBlame() " Save the buffer silent execute(':w') " Now run Tortoise to get the blame dialog to display let filename = expand("%") let linenum = line(".") execute('!/C/Progra~1/TortoiseSVN/bin/TortoiseProc.exe /command:blame /path:' . filename . ' /line:' . linenum . ' /notempfile /closeonend') endfunction
And for those who want to use Vim from Tortoise:
Go to tortoisesvn, settings
Diff viewer : gvim -d %base %mine
Diff viewer in tab in running vim: gvim --remote-tab +"vert diffsplit %base" "%mine"
Merge Tool : gvim -c":tabnew %merged" -d %theirs %mine
Commit all currently open files (buffers) using TortoiseSVN:
func! CommitSVNAll() let buflist = [] for b in range(1, bufnr('$')) if buflisted(b) && filereadable(bufname(b)) call add(buflist, fnamemodify(bufname(b), ':p')) endif endfor let files = join(buflist, '*') if files != '' silent exec '!start "C:\Program Files\TortoiseSVN\bin\TortoiseProc.exe" /command:commit /path:"'.files.'" /closeonend:4' else call confirm('No files loaded') endif endfunc call CommitSVNAll()