nvim_runtime_lua

vim.uri

Methods6

function M.uri_encode(str: string, rfc: "rfc2396" | "rfc2732" | "rfc3986" | nil) -> encoded string

URI-encodes a string using percent escapes.

Parameters
strstring

string to encode

rfc"rfc2396" | "rfc2732" | "rfc3986" | nil
Returns
encodedstring

string

function M.uri_decode(str: string) -> decoded string

URI-decodes a string containing percent escapes.

Parameters
strstring

string to decode

Returns
decodedstring

string

function M.uri_from_fname(path: string) -> URI string

Gets a URI from a file path.

Parameters
pathstring

Path to file

Returns
URIstring
function M.uri_from_bufnr(buf: integer) -> URI string

Gets a URI from a bufnr.

function M.uri_to_fname(uri: string) -> filename string

Gets a filename from a URI.

Parameters
uristring
Returns
filenamestring

or unchanged URI for non-file URIs

function M.uri_to_bufnr(uri: string) -> bufnr integer

Gets the buffer for a uri. Creates a new unloaded buffer if no buffer for the uri already exists.