aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'runtime')
-rw-r--r--runtime/doc/api.txt30
-rw-r--r--runtime/doc/eval.txt32
-rw-r--r--runtime/doc/ui.txt2
3 files changed, 56 insertions, 8 deletions
diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt
index 3d95dd58f7..22ad8e0633 100644
--- a/runtime/doc/api.txt
+++ b/runtime/doc/api.txt
@@ -14,8 +14,9 @@ Applications can also embed libnvim to work with the C API directly.
Type |gO| to see the table of contents.
==============================================================================
-API Types *api-types*
+API Definitions *api-definitions*
+ *api-types*
The Nvim C API defines custom types for all function parameters. Some are just
typedefs around C99 standard types, others are Nvim-defined data structures.
@@ -34,6 +35,17 @@ discriminated as separate types in an Object:
Window -> enum value kObjectTypeWindow
Tabpage -> enum value kObjectTypeTabpage
+ *api-indexing*
+Most of the API uses 0-based indices, and ranges are end-exclusive. For the
+end of a range, -1 denotes the last line/column.
+
+Exception: the following API functions use "mark-like" indexing (1-based
+lines, 0-based columns):
+
+ |nvim_buf_get_mark()|
+ |nvim_win_get_cursor()|
+ |nvim_win_set_cursor()|
+
==============================================================================
API metadata *api-metadata*
@@ -1293,7 +1305,7 @@ nvim_buf_set_lines({buffer}, {start}, {end}, {strict_indexing},
{replacement} Array of lines to use as replacement
nvim_buf_get_offset({buffer}, {index}) *nvim_buf_get_offset()*
- Returns the byte offset for a line.
+ Returns the byte offset of a line (0-indexed). |api-indexing|
Line 1 (index=0) has offset 0. UTF-8 bytes are counted. EOL is
one byte. 'fileformat' and 'fileencoding' are ignored. The
@@ -1445,7 +1457,9 @@ nvim_buf_is_valid({buffer}) *nvim_buf_is_valid()*
nvim_buf_get_mark({buffer}, {name}) *nvim_buf_get_mark()*
Return a tuple (row,col) representing the position of the
- named mark
+ named mark.
+
+ Marks are (1,0)-indexed. |api-indexing|
Parameters: ~
{buffer} Buffer handle, or 0 for current buffer
@@ -1500,8 +1514,8 @@ nvim_buf_clear_namespace({buffer}, {ns_id}, {line_start}, {line_end})
Clears namespaced objects, highlights and virtual text, from a
line range
- To clear the namespace in the entire buffer, pass in 0 and -1
- to line_start and line_end respectively.
+ Lines are 0-indexed. |api-indexing| To clear the namespace in
+ the entire buffer, specify line_start=0 and line_end=-1.
Parameters: ~
{buffer} Buffer handle, or 0 for current buffer
@@ -1570,7 +1584,8 @@ nvim_win_set_buf({window}, {buffer}) *nvim_win_set_buf()*
{buffer} Buffer handle
nvim_win_get_cursor({window}) *nvim_win_get_cursor()*
- Gets the cursor position in the window
+ Gets the (1,0)-indexed cursor position in the window.
+ |api-indexing|
Parameters: ~
{window} Window handle
@@ -1579,7 +1594,8 @@ nvim_win_get_cursor({window}) *nvim_win_get_cursor()*
(row, col) tuple
nvim_win_set_cursor({window}, {pos}) *nvim_win_set_cursor()*
- Sets the cursor position in the window
+ Sets the (1,0)-indexed cursor position in the window.
+ |api-indexing|
Parameters: ~
{window} Window handle
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index 7682a1a584..dfffe33b1f 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -2377,6 +2377,7 @@ win_screenpos({nr}) List get screen position of window {nr}
winbufnr({nr}) Number buffer number of window {nr}
wincol() Number window column of the cursor
winheight({nr}) Number height of window {nr}
+winlayout([{tabnr}]) List layout of windows in tab {tabnr}
winline() Number window line of the cursor
winnr([{expr}]) Number number of current window
winrestcmd() String returns command to restore window sizes
@@ -6078,7 +6079,7 @@ nr2char({expr} [, {utf8}]) *nr2char()*
characters. nr2char(0) is a real NUL and terminates the
string, thus results in an empty string.
-nvim_...({...}) *nvim_...()* *eval-api*
+nvim_...({...}) *E5555* *nvim_...()* *eval-api*
Call nvim |api| functions. The type checking of arguments will
be stricter than for most other builtins. For instance,
if Integer is expected, a |Number| must be passed in, a
@@ -8538,6 +8539,35 @@ winheight({nr}) *winheight()*
Examples: >
:echo "The current window has " . winheight(0) . " lines."
<
+winlayout([{tabnr}]) *winlayout()*
+ The result is a nested List containing the layout of windows
+ in a tabpage.
+
+ Without {tabnr} use the current tabpage, otherwise the tabpage
+ with number {tabnr}. If the tabpage {tabnr} is not found,
+ returns an empty list.
+
+ For a leaf window, it returns:
+ ['leaf', {winid}]
+ For horizontally split windows, which form a column, it
+ returns:
+ ['col', [{nested list of windows}]]
+ For vertically split windows, which form a row, it returns:
+ ['row', [{nested list of windows}]]
+
+ Example: >
+ " Only one window in the tab page
+ :echo winlayout()
+ ['leaf', 1000]
+ " Two horizontally split windows
+ :echo winlayout()
+ ['col', [['leaf', 1000], ['leaf', 1001]]]
+ " Three horizontally split windows, with two
+ " vertically split windows in the middle window
+ :echo winlayout(2)
+ ['col', [['leaf', 1002], ['row', ['leaf', 1003],
+ ['leaf', 1001]]], ['leaf', 1000]]
+<
*winline()*
winline() The result is a Number, which is the screen line of the cursor
in the window. This is counting screen lines from the top of
diff --git a/runtime/doc/ui.txt b/runtime/doc/ui.txt
index 60d55bda61..ca10edccba 100644
--- a/runtime/doc/ui.txt
+++ b/runtime/doc/ui.txt
@@ -702,6 +702,8 @@ events, which the UI must handle.
"echo" |:echo| message
"echomsg" |:echomsg| message
"echoerr" |:echoerr| message
+ "lua_error" Error in |:lua| code
+ "rpc_error" Error response from |rpcrequest()|
"return_prompt" |press-enter| prompt after a multiple messages
"quickfix" Quickfix navigation message
"wmsg" Warning ("search hit BOTTOM", |W10|, …)