sponsor Vim development Vim logo Vim Book Ad

gvim-pdfsync : Open file in OS X Vim at a specific line. Good for PDFSync inverse searches.

 script karma  Rating 8/2, Downloaded by 663    Comments, bugs, improvements  Vim wiki

created by
Ted Pavlic
 
script type
utility
 
description
For a summary of the newest developments (e.g., PDFSync support in the new MacVim project), see

http://phaseportrait.blogspot.com/2007/12/pdfsync-inverse-searches-in-macvim.html

Below are the comments at the head of the gvim-pdfsync script.

# gvim-pdfsync: Script for opening a file in Vim in OS X and positioning
#               the cursor at a particular line. If the file is already
#               open in an existing Vim, the cursor will be repositioned
#               re-opening the file.
#
#               The script is meant to extend the inverse searching
#               (c.f. PDFSync compatible PDF viewers (e.g., Skim or
#               TeXniscope) or DVI viewers that pay attention to
#               source specials (e.g., TeXniscope)) to MacVim.
#
# Author: Ted Pavlic
#         ted@tedpavlic.com
#         http://www.tedpavlic.com/
#
# Usage: gvim-pdfsync "%file" [%line]
#
#        where %file is a file name and %line is a line number.
#
# History and acknowledgments:
#
#    The genesis of this script is this comment:
#
#    http://www.macosxhints.com/comment.php?mode=view&cid=88674
#
#    to this thread:
#
#    http://www.macosxhints.com/article.php?story=20070111095701823
#
#    Most of the important AppleScript is by Yonatan Amit, the original
#    author of that thread.
#
# For more information (and history):
#
# http://phaseportrait.blogspot.com/2007/07/pdfsync-inverse-searches-on-vim-for-os.html
#
 
install details
NOTE: THIS IS DESIGNED FOR OS X. It uses AppleScript.

Save this file in the path somewhere. For example:

/usr/local/bin/gvim-pdfsync

Then chmod it 0755. For example,

chmod 0755 /usr/local/bin/gvim-pdfsync

It then can be used like this:

gvim-pdfsync "%file" %line

where %file is the name of the file being opened and %line is the desired line number for the cursor. If you run it again with a different line number, the Vim application will reposition the cursor.
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
gvim-pdfsync 1.03 2007-07-20 6.0 Ted Pavlic More conventional usage line. Updated documentation. Trivial changes.
gvim-pdfsync 1.02 2007-07-17 6.0 Ted Pavlic Added "usage" and changed some internal handling of shell variables. Trivial changes.
gvim-pdfsync 1.01 2007-07-11 6.0 Ted Pavlic Somehow in a copy and paste while putting the script together, a couple of \'s turned into 's.

Fixed that. Now the script should work fine.
ip used for rating: 54.90.156.100

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
SourceForge.net Logo