Skip to main content
Module

x/denops_std/function/mod.ts>line

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

The result is a Number, which is the line number of the file position given with {expr}. The {expr} argument is a string. The accepted positions are: . the cursor position $ the last line in the current buffer 'x position of mark x (if the mark is not set, 0 is returned) w0 first line visible in current window (one if the display isn't updated, e.g. in silent Ex mode) w$ last line visible in current window (this is one less than "w0" if no lines are visible) v In Visual mode: the start of the Visual area (the cursor is the end). When not in Visual mode returns the cursor position. Differs from '< in that it's updated right away. Note that a mark in another file can be used. The line number then applies to another buffer. To get the column number use col(). To get both use getpos(). With the optional {winid} argument the values are obtained for that window instead of the current window. Returns 0 for invalid values of {expr} and {winid}. Examples:

line(".")               line number of the cursor
line(".", winid)        idem, in window "winid"
line("'t")              line number of mark t
line("'" .. marker)     line number of mark marker

To jump to the last known position when opening a file see last-position-jump.

Can also be used as a method:

GetValue()->line()

Parameters

denops: Denops
expr: string
optional
winid: number | string

Returns

Promise<number>