Skip to main content
Module

x/denops_std/function/mod.ts>cursor

📚 Standard module for denops.vim
Go to Latest
function cursor
import { cursor } from "https://deno.land/x/denops_std@v6.4.0/function/mod.ts";

Positions the cursor at the column (byte count) {col} in the line {lnum}. The first column is one.

When there is one argument {list} this is used as a List with two, three or four item: [{lnum}, {col}] [{lnum}, {col}, {off}] [{lnum}, {col}, {off}, {curswant}] This is like the return value of getpos() or getcurpos(), but without the first item.

To position the cursor using {col} as the character count, use setcursorcharpos().

Does not change the jumplist. {lnum} is used like with getline(), except that if {lnum} is zero, the cursor will stay in the current line. If {lnum} is greater than the number of lines in the buffer, the cursor will be positioned at the last line in the buffer. If {col} is greater than the number of bytes in the line, the cursor will be positioned at the last character in the line. If {col} is zero, the cursor will stay in the current column. If {curswant} is given it is used to set the preferred column for vertical movement. Otherwise {col} is used.

When 'virtualedit' is used {off} specifies the offset in screen columns from the start of the character. E.g., a position within a <Tab> or after the last character. Returns 0 when the position could be set, -1 otherwise.

Can also be used as a method:

GetCursorPos()->cursor()

Parameters

denops: Denops
lnum: number
col: number
optional
off: number

Returns

Promise<number>

Parameters

denops: Denops
list:
[
number,
number,
number,
number,
]

Returns

Promise<number>