0

I would like to write a special plugin in Vim which open a custom app depending on the positions of the vim cursor.

Is any way to get the positions from the screen ?

Exemple case: When I call my custom plugin ColorPicker, that's open a ColorPicker App centered on the cursor. Screenshot: https://docs.google.com/file/d/0B6tc60GuFE4WbGxuaTV6OVlCSzg/edit

This is a very basic exemple but in I would like to be able to add powerfull gui feature to vim.

Goaman
  • 15
  • 1
  • 6

1 Answers1

0

If you are serious about creating a Vim plugin you should start by getting a bit closer with the help system. :help functions will give you a detailed list of all the available functions.

You are looking for getpos('.'), see :help getpos().

romainl
  • 186,200
  • 21
  • 280
  • 313
  • Also, you probably don't want to operate directly on the position, but on the word under the cursor; you can get that through `expand('')`. – Ingo Karkat Sep 09 '12 at 15:55
  • This is not exactly what I want. I just add some information to my post. – Goaman Sep 11 '12 at 17:37
  • This is exactly what you asked: all the available functions are in `:h functions` which you should read. `getpos('.')` returns the line number and column of the cursor. If you also want to take into account the position of the GUI window you should use other functions: `:getwinposx()` and `getwinposy()` and extrapolate the cursor's exact position by checking for the presence of a menubar or toolbar, the font size, etc. Seriously, the doc is the first place to look at. – romainl Sep 11 '12 at 20:19
  • Ok I got it, I would look the help deeper next time ! Tank's :) – Goaman Sep 11 '12 at 21:06