« »

tip: perforce + vi configuration

Friday, 18 February 2005

If you use Perforce (i.e. the 'p4' command line app) and you use Vim as your P4EDITOR then try this (on Windows):

p4 set "P4EDITOR=C:\PROGRA~1\Vim\vim63\gvim.exe +0 +/<enter\|^>>>>\|^====\|^<<<<\|^\t +nohlsearch"

(presuming that you have installed Vim 6.3 to the default location) and/or this (for Bash shell users on Linux/Un*x):

export P4EDITOR='vim +0 "+/<enter\|^>>>>\|^====\|^<<<<\|^\t" +nohlsearch'

This has Vim jump to the <enter description here> position in a p4 submit form or, if this isn't a submission form (perhaps you are editing a user or client spec) then to the first multi-line form field.

Unfortunately this still leaves the search highlighting in place. Anybody know how to dismiss that in Vim without hackily just searching for something for which there won't be a hit? Doing the latter results in a warning message. [Update Tue, Feb 22: found out how to clear the current search highlighting.]

[Update Thu, Dec 8: added search for conflict markers during a p4 resolve session.]

Tagged: perforce