Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/ddc_vim/deps.ts>fn.getpos

Dark deno-powered completion framework for neovim/Vim8
Go to Latest
function fn.getpos
import { fn } from "https://deno.land/x/ddc_vim@v3.8.0/deps.ts";
const { getpos } = fn;

Get the position for String {expr}. For possible values of {expr} see line(). For getting the cursor position see getcurpos(). The result is a List with four numbers: [bufnum, lnum, col, off] "bufnum" is zero, unless a mark like '0 or 'A is used, then it is the buffer number of the mark. "lnum" and "col" are the position in the buffer. The first column is 1. The "off" number is zero, unless 'virtualedit' is used. Then it is the offset in screen columns from the start of the character. E.g., a position within a <Tab> or after the last character. Note that for '< and '> Visual mode matters: when it is "V" (visual line mode) the column of '< is zero and the column of '> is a large number equal to v:maxcol. The column number in the returned List is the byte position within the line. To get the character position in the line, use getcharpos(). A very large column number equal to v:maxcol can be returned, in which case it means "after the end of the line". If {expr} is invalid, returns a list with all zeros. This can be used to save and restore the position of a mark:

let save_a_mark = getpos("'a")
...
call setpos("'a", save_a_mark)

Also see getcharpos(), getcurpos() and setpos().

Can also be used as a method:

GetMark()->getpos()

Parameters

denops: Denops
expr: string