diff options
author | Josh Rahm <joshuarahm@gmail.com> | 2022-08-21 18:49:46 -0600 |
---|---|---|
committer | Josh Rahm <joshuarahm@gmail.com> | 2022-08-21 18:49:46 -0600 |
commit | 8436383af96dc7afa3596fc22c012d68e76f47f8 (patch) | |
tree | b67c79f3e01a6e48117ef9ec3e919ee1bbafbf11 /test/functional/vimscript/null_spec.lua | |
parent | 629169462a82f0fbb7a8911a4554894537d6776c (diff) | |
download | rneovim-8436383af96dc7afa3596fc22c012d68e76f47f8.tar.gz rneovim-8436383af96dc7afa3596fc22c012d68e76f47f8.tar.bz2 rneovim-8436383af96dc7afa3596fc22c012d68e76f47f8.zip |
feat(usermark); implement "user marks", i.e. marks whose behavior can be defined by the user.
(Neo)vim has many different marks defined, but sometimes this may not be
completely adequate.
This change give the user the ability to define behavior for marks which
are not built in to (Neo)vim directly. This is accomplished through a
new option called the "usermarkfunc."
The usermarkfunc points to a vimscript function that takes an "action"
paramter (either "get" or "set") and a mark name.
a basic implementation that re-implements global mark behavior for user
marks would look something like:
let s:marks = {}
function UserMarkFunc(action, mark)
if a:action == "set"
let [n, lnum, col, off, curswant] = getcurpos()
let s:marks[a:mark] =
\ { "line": lnum, "col": col, "file": expand("%:p") }
else
return s:marks[a:mark]
endif
endfunction
set usermarkfunc=UserMarkFunc
of course the user could make the behavior be whatever.
It should also be noted that any valid unicode character can now be a
mark. It is not just limited to ASCII characters.
Diffstat (limited to 'test/functional/vimscript/null_spec.lua')
0 files changed, 0 insertions, 0 deletions