Vim Tips Wiki
Register
(add smylink hack)
(Change <tt> to <code>, perhaps also minor tweak.)
 
Line 2: Line 2:
   
 
==Unix users==
 
==Unix users==
Edit line 106 to change <tt>p4.exe</tt> to <tt>p4</tt>
+
Edit line 106 to change <code>p4.exe</code> to <code>p4</code>
 
<pre>
 
<pre>
 
"Basic check for p4-enablement
 
"Basic check for p4-enablement
Line 34: Line 34:
 
== Handling Symlinks ==
 
== Handling Symlinks ==
   
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.
+
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
 
Line 122-ish
Line 48: Line 48:
   
 
== Not Requiring a Changelist ==
 
== Not Requiring a Changelist ==
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:
+
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
 
Line 335-ish

Latest revision as of 09:42, 14 July 2012

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 users[]

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[]

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[]

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[]

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" )

Comments[]