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 /src/nvim/options.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 'src/nvim/options.lua')
-rw-r--r-- | src/nvim/options.lua | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/nvim/options.lua b/src/nvim/options.lua index 2f941f5d0c..5e4c73a5db 100644 --- a/src/nvim/options.lua +++ b/src/nvim/options.lua @@ -2691,6 +2691,13 @@ return { defaults={if_true=4000} }, { + full_name='usermarkfunc', abbreviation='umf', + short_desc=N_("function used to perform jumps/sets to user marks."), + type='string', scope={'buffer'}, + varname='p_umf', + defaults={if_true=""} + }, + { full_name='varsofttabstop', abbreviation='vsts', short_desc=N_("list of numbers of spaces that <Tab> uses while editing"), type='string', list='comma', scope={'buffer'}, |