sponsor Vim development Vim logo Vim Book Ad

open_file_from_clip_board : open file path that is copied in clipboard

 script karma  Rating -1/3, Downloaded by 845  Comments, bugs, improvements  Vim wiki

created by
Vinh Tran
 
script type
utility
 
description
Note this script need clipboard supported

http://vim.wikia.com/wiki/Accessing_the_system_clipboard

specifically, it use the * register to get the text in the clipboard

this little script define a function call OpenFilesFromClipboard()

If you, for example, execute some command from the terminal (maybe a grep) and get result like this:

/Users/me/myfile:23:something something
/Users/me/anotherfile: 34 I am a file
/Users/me/yetanotherone hello

what you can do with this plugin is: highlight the text and copy it into your system clipboard (Cmd-c in MacOSX and Ctrl-c in Windows)

Assuming you have a mapping in your .vimrc
map <LEADER>jc :call OpenFilesFromClipboard()<CR>

then open your vim and type <LEADER>jc will open that each file into a new tab
I hard code to tabnew for now, check back later version for more flexibility

Note:
just reallize that support different program on different environment is impossible. If it works for you, great, otherwise, please read the code, the idea and code it up for your usage
 
install details
copy the .vim file to your vim space/plugin
map a key to function OpenFilesFromClipboard() e.g:

map jcb :call OpenFilesFromClipboard()

enjoy!!
 

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
clipboard_file_open.vim 1.2 2010-10-12 7.0 Vinh Tran Included a patch by Martin Lemburg (martin.lemburg@gmx.net) for support on window.
clipboard_file_open.vim 1.1 2010-10-07 7.0 Vinh Tran Fix the bug that fail to jump to the line number
clipboard_file_open.vim 1.0 2010-10-07 7.0 Vinh Tran Initial upload
ip used for rating: 3.143.17.128

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.
   
Vim at Github