aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authoraltermo <107814000+altermo@users.noreply.github.com>2024-02-06 11:52:42 +0100
committeraltermo <107814000+altermo@users.noreply.github.com>2024-02-21 16:11:50 +0100
commit1c032ad703a19cd5c8498ee95f9352df87a91139 (patch)
tree9c2c79ae6dc17feb4c63687069cb1b9805fcc1bb /runtime
parent6d8bbfe19df2175637a1e47ac1aafb0e96e35b38 (diff)
downloadrneovim-1c032ad703a19cd5c8498ee95f9352df87a91139.tar.gz
rneovim-1c032ad703a19cd5c8498ee95f9352df87a91139.tar.bz2
rneovim-1c032ad703a19cd5c8498ee95f9352df87a91139.zip
feat(extmark): window scoped extmark
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Diffstat (limited to 'runtime')
-rw-r--r--runtime/doc/api.txt31
-rw-r--r--runtime/doc/news.txt4
-rw-r--r--runtime/lua/vim/_meta/api.lua22
-rw-r--r--runtime/lua/vim/_meta/api_keysets.lua1
4 files changed, 58 insertions, 0 deletions
diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt
index c6e706d6c5..821d2eb748 100644
--- a/runtime/doc/api.txt
+++ b/runtime/doc/api.txt
@@ -2791,6 +2791,8 @@ nvim_buf_set_extmark({buffer}, {ns_id}, {line}, {col}, {*opts})
• url: A URL to associate with this extmark. In the TUI, the
OSC 8 control sequence is used to generate a clickable
hyperlink to this URL.
+ • scoped: boolean that indicates that the extmark should
+ only be displayed in the namespace scope. (experimental)
Return: ~
Id of the created/updated extmark
@@ -2865,6 +2867,35 @@ nvim_set_decoration_provider({ns_id}, {*opts})
winid, bufnr, row]
• on_end: called at the end of a redraw cycle ["end", tick]
+nvim_win_add_ns({window}, {ns_id}) *nvim_win_add_ns()*
+ Adds the namespace scope to the window.
+
+ Parameters: ~
+ • {window} Window handle, or 0 for current window
+ • {ns_id} the namespace to add
+
+ Return: ~
+ true if the namespace was added, else false
+
+nvim_win_get_ns({window}) *nvim_win_get_ns()*
+ Gets all the namespaces scopes associated with a window.
+
+ Parameters: ~
+ • {window} Window handle, or 0 for current window
+
+ Return: ~
+ a list of namespaces ids
+
+nvim_win_remove_ns({window}, {ns_id}) *nvim_win_remove_ns()*
+ Removes the namespace scope from the window.
+
+ Parameters: ~
+ • {window} Window handle, or 0 for current window
+ • {ns_id} the namespace to remove
+
+ Return: ~
+ true if the namespace was removed, else false
+
==============================================================================
Window Functions *api-window*
diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt
index 16e7d65a9f..a5a13602e2 100644
--- a/runtime/doc/news.txt
+++ b/runtime/doc/news.txt
@@ -318,6 +318,10 @@ The following new APIs and features were added.
• Clicking on a tabpage in the tabline with the middle mouse button closes it.
+• |namespace| can now have window scopes. |nvim_win_add_ns()|
+
+• |extmarks| option `scoped`: only show the extmarks in its namespace's scope.
+
==============================================================================
CHANGED FEATURES *news-changed*
diff --git a/runtime/lua/vim/_meta/api.lua b/runtime/lua/vim/_meta/api.lua
index cfdb65c2b5..998608ae16 100644
--- a/runtime/lua/vim/_meta/api.lua
+++ b/runtime/lua/vim/_meta/api.lua
@@ -613,6 +613,8 @@ function vim.api.nvim_buf_line_count(buffer) end
--- • url: A URL to associate with this extmark. In the TUI, the
--- OSC 8 control sequence is used to generate a clickable
--- hyperlink to this URL.
+--- • scoped: boolean that indicates that the extmark should
+--- only be displayed in the namespace scope. (experimental)
--- @return integer
function vim.api.nvim_buf_set_extmark(buffer, ns_id, line, col, opts) end
@@ -1982,6 +1984,13 @@ function vim.api.nvim_tabpage_set_var(tabpage, name, value) end
--- @param win integer Window handle, must already belong to {tabpage}
function vim.api.nvim_tabpage_set_win(tabpage, win) end
+--- Adds the namespace scope to the window.
+---
+--- @param window integer Window handle, or 0 for current window
+--- @param ns_id integer the namespace to add
+--- @return boolean
+function vim.api.nvim_win_add_ns(window, ns_id) end
+
--- Calls a function with window as temporary current window.
---
--- @param window integer Window handle, or 0 for current window
@@ -2032,6 +2041,12 @@ function vim.api.nvim_win_get_cursor(window) end
--- @return integer
function vim.api.nvim_win_get_height(window) end
+--- Gets all the namespaces scopes associated with a window.
+---
+--- @param window integer Window handle, or 0 for current window
+--- @return integer[]
+function vim.api.nvim_win_get_ns(window) end
+
--- Gets the window number
---
--- @param window integer Window handle, or 0 for current window
@@ -2084,6 +2099,13 @@ function vim.api.nvim_win_hide(window) end
--- @return boolean
function vim.api.nvim_win_is_valid(window) end
+--- Removes the namespace scope from the window.
+---
+--- @param window integer Window handle, or 0 for current window
+--- @param ns_id integer the namespace to remove
+--- @return boolean
+function vim.api.nvim_win_remove_ns(window, ns_id) end
+
--- Sets the current buffer in a window, without side effects
---
--- @param window integer Window handle, or 0 for current window
diff --git a/runtime/lua/vim/_meta/api_keysets.lua b/runtime/lua/vim/_meta/api_keysets.lua
index ab0d3aafe8..37e4372196 100644
--- a/runtime/lua/vim/_meta/api_keysets.lua
+++ b/runtime/lua/vim/_meta/api_keysets.lua
@@ -252,6 +252,7 @@ error('Cannot require a meta file')
--- @field ui_watched? boolean
--- @field undo_restore? boolean
--- @field url? string
+--- @field scoped? boolean
--- @field _subpriority? integer
--- @class vim.api.keyset.user_command