Skip to main content
Module

x/ddc_vim/deps.ts>fn.col

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

The result is a Number, which is the byte index of the column position given with {expr}. The accepted positions are: . the cursor position $ the end of the cursor line (the result is the number of bytes in the cursor line plus one) 'x position of mark x (if the mark is not set, 0 is returned) 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. Additionally {expr} can be [lnum, col]: a |List| with the line and column number. Most useful when the column is "$", to get the last column of a specific line. When "lnum" or "col" is out of range then col() returns zero. To get the line number use |line()|. To get both use |getpos()|. For the screen column position use |virtcol()|. Note that only marks in the current file can be used. Examples: col(".") column of cursor col("$") length of cursor line plus one col("'t") column of mark t col("'" . markname) column of mark markname The first column is 1. 0 is returned for an error. For an uppercase mark the column may actually be in another buffer. For the cursor position, when 'virtualedit' is active, the column is one higher if the cursor is after the end of the line. This can be used to obtain the column in Insert mode: :imap :let save_ve = &ve<CR <C-O>:set ve=all<CR <C-O>:echo col(".") . "\n" <Bar \let &ve = save_ve<CR GetPos()->col()

Parameters

denops: Denops
expr: string | [number | string, number | string]

Returns

Promise<number>