Wikia

Vim Tips Wiki

Script:167

Talk0
1,613pages on
this wiki
Revision as of 09:42, July 14, 2012 by JohnBot (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Use this page to discuss script 167 perforce: Perforce source control features

  • Add constructive comments, bug reports, or discuss improvements (see the guideline).
  • Do not document the script here (the author should do that on vim.org).
  • This page may be out of date: check the script's vim.org page above, and its release notes.

Unix usersEdit

Edit line 106 to change p4.exe to p4

"Basic check for p4-enablement
if executable( "p4" )
   let s:PerforceExecutable="p4"
else

And do a dos2unix to convert line endings:

$vim perforce.vim
:set ff=unix
:wq!

Handling AltRoots Edit

If you have altroots in your perforce user specification you might want to add the equivalent of 'alias p4='p4 -d `/bin/pwd`'

I did this by changing this around line 105:

"Basic check for p4-enablement
if executable( "p4" )
    let s:PerforceExecutable="p4 -d " . getcwd()
else
    augroup! perforce
endif 

Handling Symlinks Edit

Let's say you have a symlink to a file. If you want to edit the file you would normally have to do something like "p4 edit `readlink $file`". This hack does basically that.

Line 122-ish

"----------------------------------------------------------------------------
" A wrapper around a p4 command line for the current buffer
"----------------------------------------------------------------------------
function s:P4ShellCommandCurrentBuffer( sCmd )
                let filename = resolve(expand( "%:p" ))
                return s:P4ShellCommand( a:sCmd . " " . filename )
endfunction

Not Requiring a Changelist Edit

This plugin assumes you use the methodology where you have an explicit changelist created for every edit. If you want to use a default changelist, then you need to remove the "-c" options given to a couple commands:

Line 335-ish

"     let listnum = ""
"     let listnum = s:P4GetChangelist( "Current changelists:\n" . s:P4GetChangelists(0) . "\nEnter changelist number: ",
"     if listnum == ""
"         echomsg "No changelist specified. Edit cancelled."
"         return
"     endif
"     call s:P4ShellCommandCurrentBuffer( action . " -c " . listnum )
    call s:P4ShellCommandCurrentBuffer( action )

Line 366-ish

"         let listnum = ""
"         let listnum = s:P4GetChangelist( "Current changelists:\n" . s:P4GetChangelists(0) . "\nEnter changelist number
"         if listnum == ""
"             echomsg "No changelist specified. Delete cancelled."
"             return
"         endif
"         call s:P4ShellCommandCurrentBuffer( "delete -c " . listnum )
        call s:P4ShellCommandCurrentBuffer( "delete" )

CommentsEdit

Around Wikia's network

Random Wiki