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.
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!'
Silent. Adding <silent> prevents stdout in Vim when a command runs. Sometimes when you execute a command call in Vim, it gets echoed.
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.
The <CR> in vim mappings is the carriage return usually the Enter on your keyboard.
A good place to start:
:help click
:help mouse
Perhaps something like this will work:
:map <RightMouse> :tag <CR>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With