https://github.com/tomtom/hookcursormoved_vim
Facilitate definition of triggers on CursorMoved[I] events
https://github.com/tomtom/hookcursormoved_vim
Last synced: 13 days ago
JSON representation
Facilitate definition of triggers on CursorMoved[I] events
- Host: GitHub
- URL: https://github.com/tomtom/hookcursormoved_vim
- Owner: tomtom
- Created: 2010-08-20T16:33:45.000Z (almost 16 years ago)
- Default Branch: master
- Last Pushed: 2014-03-25T15:59:38.000Z (about 12 years ago)
- Last Synced: 2025-01-02T18:48:17.173Z (over 1 year ago)
- Language: VimL
- Homepage: http://www.vim.org/scripts/script.php?script_id=2037
- Size: 136 KB
- Stars: 6
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README
Awesome Lists containing this project
README
This experimental plugin provides some help with the definition of
functions that should be called when the cursor position changed.
When the cursor position changes, it first checks if a certain condition
is met and then calls functions registered in
b:hookcursormoved_{MODE}_{CONDITION} (an array).
In order to define new conditions, you have to set the variable
"g:hookcursormoved_{CONDITION}" to a function name (STRING). This
function takes the current mode (i .. insert mode; n ... normal mode)
as single argument.
Functions are best registered using |hookcursormoved#Register()|.
Example: >
function! WhatsGoingOn(mode) "{{{3
if mode == 'i'
DoThis
elseif mode == 'n'
DoThat
endif
endf
call hookcursormoved#Register('syntaxchange', function('WhatsGoingOn'))
-----------------------------------------------------------------------
Status: Works for me (there may be some minor quirks)
Install: See http://github.com/tomtom/vimtlib/blob/master/INSTALL.TXT
See http://github.com/tomtom for related plugins.