Perforce Public Knowledge Base - Enabling External Editors in P4V
Reset Search
 

 

Article

Enabling External Editors in P4V

« Go Back

Information

 
Problem

My external editor does not come up in Unix or Linux using "Open With..." in P4V.

P4V pops up a "Launch error" dialog saying "Could not start 'script'" when invoking the external editor using a shell script.


Solution

Editors such as vi and emacs require a script to start on Linux and Unix:

  1. To enable launching an editor from P4V, first find its location by running the "which" command:
    which emacs
    /usr/bin/emacs
  2. If the editor is GUI based, you create a simple two line script.

    Note: P4V version 2007.3 and later requires a shell script header in your shell script.

    For example, this shell script with the "bangpath" header line works:
    #!/bin/sh
    /usr/bin/emacs
    But a shell script without the header line displays a "Could not start..." error when you attempt to use it from P4V:
    /usr/bin/emacs
  3. If the editor requires a terminal window, such as vi, you must run a command to bring up a terminal first.

    Create a script similar to:
    #!/bin/sh
    /usr/bin/xterm -fn 10x20 -fg green -bg black -e /bin/vi $1
    
  4. Confirm that the script works from the command line:
    chmod +x script
    ./script filename
When you have successfully tested your script, you can use it to set the editor application in P4V:
  • Right-click on the text file and choose Open With -> Choose Application.... The "Open File With" dialog is displayed.
     
  • Click the Browse button and navigate to the location of the script.
     
  • Select the script and click the Choose button.
     
  • To always open files of this type with your shell script, select "Always use the selected application to open files of this type".
     
  • Save the editor option by clicking the OK button.
You can now open files in an external editor from P4V.
Related Links

Feedback

 

Was this article helpful?


   

Feedback

Please tell us how we can make this article more useful.

Characters Remaining: 255