+7

Open file under cursor

Marco Sordi 13 years ago updated by Marco Sordi 13 years ago 4

Often a file contains the name of a second file, and you would like to open the second file.
Like "gf" command on Vim

Thanks in advance

+2

Here is a plugin that I created for this.  You will have add a key mapping for it though.


https://gist.github.com/1186126

Totally awesome, Thank you!

It would be great if it could do the following steps:
1) Select text under the cursor between single or double quotes
2) Resolve the path and open the file


Ex.
| = cursor position

<link href="css/xam|pp.css" rel="stylesheet" type="text/css">

Open the file "xampp.css" inside "css" folder


Thanks Again!

+1

I updated the plugin with the functionality requested by Marco Sordi. 


The plugin will look for a file name in the following places (and in the following order):

  1. the cursor expanded to enclosing quotes (both single and double quotes should work)
  2. the selected text
  3. the whole line
  4. the clipboard text

If no filename can be found, the plugin will try to create a new file from the selected text.

Both relative and absolute paths should work.


https://gist.github.com/1186126


I also posted something on the forum, so any enhancement requests or other discussions should maybe go there:


http://www.sublimetext.com/forum/viewtopic.php?f=5&t=2971




Wonderful plugin. Thank you!