Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I map a click in Vim?

Tags:

vim

I want to be able to click (or cmd+click on my Mac) on a function name in Gvim (or vim with set mouse=a) and have it run the command :tag to follow a ctag, but I don't know how to include a mouse click in a Vim mapping.

like image 363
Drew Stephens Avatar asked Dec 02 '09 19:12

Drew Stephens


People also ask

How do I map a key in Vim?

Vim supports several editing modes - normal, insert, replace, visual, select, command-line and operator-pending. You can map a key to work in all or some of these modes. The general syntax of a map command is: {cmd} {attr} {lhs} {rhs} where {cmd} is one of ':map', ':map!'

What is the silent key in Vim?

Silent. Adding <silent> prevents stdout in Vim when a command runs. Sometimes when you execute a command call in Vim, it gets echoed.

Can you use a mouse with vim?

Mouse reporting is enabled in an app, such as Vim, that runs in a Terminal window. In general, mouse reporting is not enabled in apps by default. For example, to enable mouse reporting in Vim, you need to add a set mouse=a command to your ~/. vimrc file.

What is cr in Vim?

The <CR> in vim mappings is the carriage return usually the Enter on your keyboard.


1 Answers

A good place to start:

:help click
:help mouse

Perhaps something like this will work:

:map <RightMouse> :tag <CR>
like image 53
Marcin Avatar answered Nov 13 '22 06:11

Marcin