On Nov 2, 2013, at 6:01 PM, Steven Michalske <[email protected]> wrote:
> > On Nov 2, 2013, at 5:14 PM, Tony Mechelynck <[email protected]> > wrote: > >> On Saturday, November 2, 2013 3:42:14 PM UTC+1, Albert Zeyer wrote: >>> On Saturday, November 2, 2013 11:52:19 AM UTC+1, Tony Mechelynck wrote: >>>> On Friday, November 1, 2013 9:29:03 PM UTC+1, Albert Zeyer wrote: >>>>> Hi, >>>>> >>>>> I want to be able to click on URLs I see in MacVim so that it opens the >>>>> URL with the responsible application (e.g. a http link with my default >>>>> browser). How can I do that? Is that possible? >>>>> >>>>> Regards, >>>>> Albert >>>> >>>> A valid URL cannot include spaces (they must be replaced by %20), so if it >>>> is itself between spaces, "+yiW (with the cursor anywhere on it) will yank >>>> it to the clipboard. Similarly "+yi< or "+yi> if it is between <>, etc., >>>> see ":help object-motions". Then you can paste it into your favourite >>>> browser's URL bar. >>>> >>>> This question (or at least this answer) applies to vim (compiled with >>>> +clipboard, of course) on any platform, not just on the Mac, so it should >>>> have been asked on the vim_use group. >>>> >>>> Best regards, >>>> Tony. >>>> -- >>>> A "No" uttered from deepest conviction is better and greater than a >>>> "Yes" merely uttered to please, or what is worse, to avoid trouble. >>>> -- Mahatma Gandhi >>> >>> Thanks for the answer. >>> >>> But I really want to click on it with my mouse cursor. Also, it should not >>> be pasted to the clipboard; I want it to open the responsible application >>> right away automatically. As if you click a link in any other application. >>> >>> This is MacVim specific, I think. >>> >>> Best regards, >>> Albert >> >> If Sylvain's answer (below) is not good enough for you, then remember that >> Vim is keyboard-oriented: it was first released to the public 22 years ago, >> with a tradition that already then went back 15 years. At those times, a >> mouse was something rare or even unheard of in a computer room, except maybe >> as a tiny grey mammal that should never have been allowed to get in. So >> everything that Vim can do, it can do with the keyboard, and even with a >> keyboard lacking arrow keys and numeric keypad; if these are present, it can >> use them; it can also use the mouse, but not to do anything. >> >> You can set up mappings for the mouse by using the <> names laid out under >> :help mouse-overview and :help double-click, but only to do things that Vim >> can already do by other means. For instance you could set up >> >> :map <LeftMouse> yiW >> >> to click anywhere and copy that Word (anything between spaces) to the >> "nameless" register but that wouldn't invoke the OS-defined helper >> application for it, and in addition it would obscure the (IMHO more useful) >> use of a left click to position the cursor. >> >> Other than that, I cannot help you here. I just wonder why you are dead set >> on clicking to invoke any possible responsible program for whatever would >> happen to be under the mouse pointer: see among others the last item under >> :help design-not. With Vim, it often happens that best results are obtained >> by keeping an open mind, and accepting solutions that achieve the desired >> (long-term) result, or something close enough to it, by ways totally >> different from one had in mind at the outset. > > Also in the help under :help double-click > "Exception: In a Help window a double click jumps to help for the word that > is clicked on." > This is a president for a keyword URL clicking action, although with a double > click. > > In response for look and feel of a Macintosh application there are certain > features expected. Agreeably in core vim this would be a non feature, but in > the MacVim GUI we already have contextual menu, apple specific key bindings > and other integrations into the OSX Eco system. I feel that the addition of > the OSX data detector features may be advantageous. it seems the design-not > feelings would apply to gvim, not MacVim. > > For a more supported model currently; you can use a double click and extend > it. > > An idea could be to call the osx open utility with the contents of the > selection of the word if it meets the following requirements > You can start with this.... > :map <2-LeftMouse> :exe "! open ". expand("<cWORD>")<CR> > > Note anything you double click will be passed to open..... not exactly what > you wanted, but you could pass it to a vim script function that verified that > it was a proper url then open it. > > From a google search, I found this stack overflow article. > http://stackoverflow.com/questions/7686115/vim-add-clickable-label > The second entry looks like a good model to follow. bonus points for making > the double click fall through and select the <cword>, when it is not a valid > URL. > > > Happy hacking, keep us moving forward! > Steve On a side note, this would be a nice to have feature for markdown and html documents. is it already done in one of their plugins? -- -- You received this message from the "vim_mac" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_mac" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
