{"id":13683613,"url":"https://github.com/LucHermitte/lh-vim-lib","last_synced_at":"2025-04-30T13:31:42.026Z","repository":{"id":28635660,"uuid":"32154574","full_name":"LucHermitte/lh-vim-lib","owner":"LucHermitte","description":"Library of Vim functions","archived":false,"fork":false,"pushed_at":"2024-08-18T15:51:25.000Z","size":4517,"stargazers_count":195,"open_issues_count":2,"forks_count":11,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-08-18T18:07:35.856Z","etag":null,"topics":["vim","viml-functions","viml-library","vimscript-functions","vimscript-library"],"latest_commit_sha":null,"homepage":"","language":"Vim Script","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LucHermitte.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"License.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-03-13T12:27:25.000Z","updated_at":"2024-08-18T15:51:28.000Z","dependencies_parsed_at":"2023-12-27T02:23:00.348Z","dependency_job_id":"e145645a-7ad8-4f5c-a411-04da4e329eb6","html_url":"https://github.com/LucHermitte/lh-vim-lib","commit_stats":null,"previous_names":[],"tags_count":81,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LucHermitte%2Flh-vim-lib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LucHermitte%2Flh-vim-lib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LucHermitte%2Flh-vim-lib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LucHermitte%2Flh-vim-lib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LucHermitte","download_url":"https://codeload.github.com/LucHermitte/lh-vim-lib/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224212335,"owners_count":17274388,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["vim","viml-functions","viml-library","vimscript-functions","vimscript-library"],"created_at":"2024-08-02T13:02:18.776Z","updated_at":"2025-04-30T13:31:42.015Z","avatar_url":"https://github.com/LucHermitte.png","language":"Vim Script","readme":"﻿# lh-vim-lib [![Last release][Releases-badge]][Releases-url] [![Build Status][gh-action-badge]][gh-action-result] [![Project Stats][openhub-badge]][openhub-url]\n\n[Releases-badge]:   https://img.shields.io/github/tag/LucHermitte/lh-vim-lib.svg\n[Releases-url]:     https://github.com/LucHermitte/lh-vim-lib/tags\n[gh-action-badge]:  ./../../actions/workflows/tests.yml/badge.svg?branch=master \"Test\"\n[gh-action-result]: ./../../actions/workflows/tests.yml?query=branch%3Amaster\n[openhub-badge]:    https://www.openhub.net/p/21020/widgets/project_thin_badge.gif\n[openhub-url]:      https://www.openhub.net/p/21020\n\n\n## Introduction\n\n_lh-vim-lib_ is a library that defines some common vim functions I use in my various plugins and ftplugins.\n\nThis library has been conceived as a suite of [|autoload|](http://vimhelp.appspot.com/eval.txt.html#autoload) plugins. As such, it requires Vim 7+. A few commands are defined.\n\nAs I only have access to a version 7.4-052 on travis-ci, let's say this is the minimum vim version I'll try to be compatible with. Until 2017 (v3.x) I was trying to be compatible with 7.3-429.\n\nThe [complete documentation](http://github.com/LucHermitte/lh-vim-lib/blob/master/doc/lh-vim-lib.txt) can be browsed.\n\n**Important:**\n\n- Since Version 2.2.0, the naming policy of these autoload functions have been harmonized. Now, most names are in lower cases, with words separated by underscores.\n- Since version 3.2.7, it's no longer hosted on google-code but on github.\n- Version 4.0.0 breaks `lh#let#if_undef()` interface, deprecates `CONFIRM()`, requires vim 7.4-52.\n\n## Table of Content\n\n  * [Functions](#functions)\n  * [Installation](#installation)\n  * [Credits](#credits)\n  * [Some other Vim Scripting libraries](#some-other-vim-scripting-libraries)\n  * [Design Notes](doc/design_notes.md)\n\n## Functions\n\n  * [Option management](doc/Options.md) -- other web page\n  * [Object Oriented Programming in vim scripts](doc/OO.md) -- other web page\n  * [Miscellaneous functions](#miscellaneous-functions)\n  * [System related functions](#system-related-functions)\n  * [Lists and dictionaries related functions](#lists-and-dictionaries-related-functions)\n  * [Stacks related functions](#stacks-related-functions)\n  * [Graphs related functions](#graphs-related-functions)\n  * [Paths related functions](#paths-related-functions)\n  * [Commands related functions](#commands-related-functions)\n  * [Menus related functions](#menus-related-functions)\n  * [Buffers and Windows related functions](#buffers-and-windows-related-functions)\n  * [Quickfix related functions](#quickfix-related-functions)\n  * [Syntax related functions](#syntax-related-functions)\n  * [UI functions](#ui-functions)\n  * [Project feature](doc/Project.md) -- other web page\n  * [Logging framework](doc/Log.md) -- other web page\n  * [Design by Contract functions](doc/DbC.md) -- other web page\n  * [Call stack decoding](doc/Callstack.md) -- other web page\n  * [Commands](#commands)\n  * [Python related functions](#python-related-functions)\n\n### Miscellaneous functions\n\n| Function                                       | Purpose                                                                                                                                                                  |\n|------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `lh#askvim#exe()`                              | Returns what a Vim command echoes                                                                                                                                        |\n| `lh#askvim#scriptid(name)`                     | Returns the id of the script associated to {name}                                                                                                                        |\n| `lh#askvim#scriptname(id)`                     | Returns the name of the script associated to {id}                                                                                                                        |\n| `lh#askvim#scriptnames()`                      | Returns `:scriptnames` result as a list of [scriptid, name] arrays                                                                                                       |\n| `lh#async#get_queue(name,policy).push_or_start(cmd, options)` | Push a `cmd` to execute in a named queue of jobs. Requires Vim 7.4-1980                                                                                   |\n| `lh#common#check_deps()`                       | Checks a Vim symbol is loaded                                                                                                                                            |\n| `lh#common#echomsg_multilines()`               | Applies `:echomsg` on a multi-lines text                                                                                                                                 |\n| `lh#common#error_msg()`                        | Displays an error message                                                                                                                                                |\n| `lh#common#rand()`                             | Returns a random number                                                                                                                                                  |\n| `lh#common#warning_msg()`                      | Displays a warning                                                                                                                                                       |\n| `lh#encoding#at(mb_string, i)`                 | Returns the i-th character in a multibytes string                                                                                                                        |\n| `lh#encoding#previous_character()`             | Returns the character before the cursor -- works with multi-byte characters                                                                                              |\n| `lh#encoding#current_character()`              | Returns the character under the cursor -- works with multi-byte characters                                                                                               |\n| `lh#encoding#does_support()`                   | Tries to detect automatically whether a codepoint has an associated glyph in the current font used                                                                       |\n| `lh#encoding#find_best_glyph()`                | Returns the first codepoint of each list that has a glyph in the current font used                                                                                       |\n| `lh#encoding#iconv()`                          | Unlike `iconv()`, this wrapper returns {expr} when we know no conversion can be achieved                                                                                 |\n| `lh#encoding#iconv(expr, from, to)`            | Converts an expression from an encoding to another                                                                                                                       |\n| `lh#encoding#strlen(mb_string)`                | Executes `strlen()` on a multibytes string                                                                                                                               |\n| `lh#encoding#strpart(mb_string, p, l)`         | Executes `strpart()` on a multibytes string                                                                                                                              |\n| `lh#event#register_for_one_execution_at()`     | Registers a command to be executed once (and only once) when an event is triggered on the current file                                                                   |\n| `lh#file#new_cache().get()`                    | Caches and returns data associated to a file                                                                                                                             |\n| `lh#float#arg_max(list)`                       | Returns the index of the maximum element of a list of floats                                                                                                             |\n| `lh#float#arg_min(list)`                       | Returns the index of the minimum element of a list of floats                                                                                                             |\n| `lh#float#max(list)`                           | Returns the maximum of a list of floats                                                                                                                                  |\n| `lh#float#min(list)`                           | Returns the minimum of a list of floats                                                                                                                                  |\n| `lh#fmt#printf({format}, {args...})`           | `printf` overload that takes positional arguments                                                                                                                        |\n| `lh#ft#is_text()`                              | Tells whether the filetype is a text filetype                                                                                                                            |\n| `lh#has#jobs()`                                | Tells whether +job are correctly implemented                                                                                                                             |\n| `lh#has#partials()`                            | Tells whether partials are correctly implemented                                                                                                                         |\n| `lh#has#patch()`                               | Portable layer over `|has-patch|` feature                                                                                                                                |\n| `lh#has#plugin()`                              | Tells whether a file is present in `'runtimepath'`                                                                                                                       |\n| `lh#has#default_in_getbufvar()`                | Tells whether `getbufvar()` has its 3 parameters                                                                                                                         |\n| `lh#icomplete#new(startcol, matches, Hook)`    | Prepares a smart insert mode omni-completion menu that'll trigger actions instead of inserting text. _smart_ means characters may be typed to reduce choices.            |\n| `lh#icomplete#new_on(pat, matches, Hook)`      | Same as previous, but this time the startcol is automatically deduced from the word pattern.                                                                             |\n| `lh#icomplete#run(startcol, matches, Hook)`    | Prepares an insert mode completion menu that'll trigger actions instead of inserting text as `complete()` does. **deprecated** prefer `lh#icomplete#new()`               |\n| `lh#lang#set_message_temporarily()`            | Changes `$LANG` to the value passed, and returns a `lh#on#exit()` object to restore the variable value                                                                 |\n| `lh#leader#get()`                              | Returns the current value of `g:mapleader`, or `'\\\\'` if unset                                                                                                           |\n| `lh#leader#get_local()`                        | Returns the current value of `g:maplocalleader`, or `'\\\\'` if unset                                                                                                      |\n| `lh#leader#set_local_if_unset()`               | Sets a new value to `g:maplocalleader`, if and only if this variable wasn't already set                                                                                  |\n| `lh#let#if_undef()`                            | Defines an extended vim variable (with ` :let`) on the condition the variable does not exist yet                                                                         |\n| `lh#let#to()`                                  | Defines an extended vim variable (with ` :let`) -- its previous value will be overridden                                                                                 |\n| `lh#let#unlet()`                               | Undefines an extended vim variable (with ` :unlet`)                                                                                                                      |\n| `lh#mark#is_unused(markname)`                  | Tells whether a mark is already used                                                                                                                                     |\n| `lh#mark#find_first_unused()`                  | Returns the name of the first unused mark found in A..Z and a..z                                                                                                         |\n| `lh#math#abs()`                                | Portable `abs()` function                                                                                                                                                |\n| `lh#mapping#create_toggable_group()`           | Returns a object that permits to define toggable mappings                                                                                                                |\n| `lh#mapping#define()`                          | Defines a mapping from its description                                                                                                                                   |\n| `lh#mapping#plug()`                            | Defines a series of default mappings associated to a plug mapping                                                                                                        |\n| `lh#mapping#reinterpret_escaped_char()`        | Transforms sequences into interpreted sequences for mappings                                                                                                             |\n| `lh#mapping#who_map(rhs, mode)`                | Returns a list of mappings that are bound to {rhs} in the specified {mode}                                                                                               |\n| `lh#notify#once()`                             | Notifies something once                                                                                                                                                  |\n| `lh#notify#clear_notifications()`              | Clear previous notification so that could be notified again                                                                                                              |\n| `lh#notify#deprecated()`                       | Notifies something is deprecated once                                                                                                                                    |\n| `lh#notify#error()`                            | Notifies an error happened, and ask whether it should be ignored, sent to quickfix windows, or just traced                                                               |\n| `lh#on#exit()`                                 | Prepares a finalizer object to be executed in a `:finally` clause in order to restore variables and execute functions                                                    |\n| `lh#ref#bind(varname)`                         | Returns a reference to another variable. To be evaluated with [`lh#option#get()`](doc/Options.md#lhoptiongetname-default--scope)                                         |\n| `lh#ref#is_bound(var)`                         | Tells whether a variable is bound to another                                                                                                                             |\n| `lh#po#context().translate(msgId)`             | Translates message Id from Portable Object files                                                                                                                         |\n| `lh#position#char_at_mark()`                   | Obtains the character under a mark                                                                                                                                       |\n| `lh#position#char_at_pos()`                    | Obtains the character at a given position                                                                                                                                |\n| `lh#position#char_at()`                        | Obtains the character at a given pair of coordinates                                                                                                                     |\n| `lh#position#compare()`                        | Tells if a position in a buffer is before another one -- result compatible with `sort()`                                                                                                                   |\n| `lh#position#extract(pos1,pos2)`               | Obtains the text between two positions                                                                                                                                   |\n| `lh#position#getcur()`                         | Return [`getcurpos()`](http://vimhelp.appspot.com/eval.txt.html#getcurpos%28%29) when it exists, [`getpos('.')`](http://vimhelp.appspot.com/eval.txt.html#getpos%28%29)  otherwise |\n| `lh#position#is_before()`                      | Tells if a position in a buffer is before another one -- boolean result                                                                                                  |\n| `lh#position#move(dir)`                        | Returns the string to use to move the cursor in the given direction -- this can be redoable w/ vim \u003e 7.4.849                                                             |\n| `lh#position#move_n(dir, count)`               | Returns the string to use to move the cursor count times in the given direction -- this can be redoable w/ vim \u003e 7.4.849                                                 |\n| `lh#string#count_char()`                       | Counts how many times a character is present in a string                                                                                                                 |\n| `lh#string#join()`                             | Work as [`join()`](http://vimhelp.appspot.com/eval.txt.html#join%28%29) but on strings directly                                                                          |\n| `lh#string#matches()`                          | Extracts a list of all matches in a string                                                                                                                               |\n| `lh#string#matchstrpos()`                      | Backports `matchstrpos()` to old vim versions                                                                                                                            |\n| `lh#string#or()`                               | Returns the first non empty string                                                                                                                                       |\n| `lh#string#trim()`                             | Trims a string                                                                                                                                                           |\n| `lh#switch#new()`                              | Creates a new switch object that proposes the `.add_case()` and `.evaluate()` method.                                                                                    |\n| `lh#tags#stack#jump()`                         | Forges a new tag entry in the tag stack, and jump to it                                                                                                                  |\n| `lh#tags#stack#push()`                         | Forges a new tag entry in the tag stack                                                                                                                                  |\n| `lh#time#bench(F,...)`                         | Times the execution of `F(...)`                                                                                                                                          |\n| `lh#time#bench_n(n, F,...)`                    | Times n executions of `F(...)`                                                                                                                                           |\n| `lh#time#date()`                               | return the equivalent of `strftime('%D-th %b %Y)`                                                                                                                        |\n| `lh#vcs#get_type(...)`                         | Returns the type of the versioning system the file is under                                                                                                              |\n| `lh#vcs#as_http(...)`                          | Returns the url of the repository the parameter is under, or `g:url` if none is found. Enforce the result in the form http://, if possible                               |\n| `lh#vcs#decode_github_url(url)`                | Extract user name and repository name from a github url                                                                                                                  |\n| `lh#vcs#get_url(...)`                          | Returns the url of the repository the parameter is under, or `g:url` if none is found                                                                                    |\n| `lh#vcs#is_git(...)`                           | Tells whether the file is under a git repository                                                                                                                         |\n| `lh#vcs#is_svn(...)`                           | Tells whether the file is under a svn repository                                                                                                                         |\n| `lh#visual#cut()`                              | Cut and returns the visually selected text                                                                                                                               |\n| `lh#visual#selection()`                        | Returns the visually selected text                                                                                                                                       |\n\n### System related functions\n\nSee also [system-tools](http://github.com/LucHermitte/vim-system-tools)\n\n| Function                           | Purpose                                                                                     |\n|------------------------------------|---------------------------------------------------------------------------------------------|\n| `lh#env#expand_all()`              | Expands environment variables found in strings                                              |\n| `lh#os#has_unix_layer_installed()` | Tells whether the enduser has declared a unix layer installed (on a Windows box)            |\n| `lh#os#OnDOSWindows()`             | Tells whether the current vim is a native windows flavour of gvim                           |\n| `lh#os#sys_cd()`                   | Build a portable string to use to change directory when executing external commands         |\n| `lh#os#chomp(text)`                | Like Perl `chomp`, remove the trailing character produced by `system()` calls               |\n| `lh#os#make(cmd, bang)`            | Executes `export p:$ENV \u0026amp;\u0026amp; :make{bang} {cmd}`                                       |\n| `lh#os#new_script_runner(cmd,env)` | Returns a finalizable temporary script that sets `p:$ENV` variables and execute the command |\n| `lh#os#system(cmd)`                | Returns `lh#os#chomp(system(export p:$ENV \u0026amp;\u0026amp; command))`                             |\n| `lh#os#cpu_number()`               | Returns the number of processors on the machine                                             |\n| `lh#os#cpu_cores_number()`         | Returns the number of cores on the machine                                                  |\n| `lh#os#lcd()`                      | Executes `:lcd fnameescape({path})`                                                         |\n\n### Lists and dictionaries related functions\n| Function                         | Purpose                                                                                                           |\n|:---------------------------------|:------------------------------------------------------------------------------------------------------------------|\n| `lh#dict#add_new()`              | Adds elements from the second dictionary if they are not set yet in the first                                     |\n| `lh#dict#get_composed()`         | Function symmetric to `lh#let#*()` functions                                                                      |\n| `lh#dict#key()`                  | Expects the dictionary to have only one element (throw otherwise) and returns it                                  |\n| `lh#dict#let()`                  | Emulates `:let dict.key.key.key = value`                                                                          |\n| `lh#dict#print_as_tree()`        | Pretty printer for dictionaries: present them as tree                                                             |\n| `lh#dict#need_ref_on()`          | Makes sure `:let dict.key.key.key` exists and returns a reference to that element                                 |\n| `lh#dict#subset()`               | Builds a subset dictionary of a dict                                                                              |\n| `lh#list#accumulate()`           | Accumulates the elements from a list                                                                              |\n| `lh#list#accumulate()`           | Accumulates the elements from a list                                                                              |\n| `lh#list#accumulate2()`          | Accumulates the elements from a list -- version closer to C++ std::accumulate()                                   |\n| `lh#list#arg_min()` \u0026 `max`      | Returns the index of the lesser/greater elements                                                                  |\n| `lh#list#chain_transform()`      | Applies a series of transformation on each element from a list ; unlike `map()`, the input list is left unchanged |\n| `lh#list#concurrent_for()`       | Concurrently searches for symmetric differences and intersection of two sorted sets                               |\n| `lh#list#contain_entity()`       | Tells whether a Dict or List entity is present within a list                                                      |\n| `lh#list#copy_if()`              | Copies the elements from a list that match a predicate                                                            |\n| `lh#list#cross()`                | Cross elements from two lists and produce a new list                                                              |\n| `lh#list#equal_range()`          | See C++ [`std::equal_range`](http://en.cppreference.com/w/cpp/algorithm/equal_range)                              |\n| `lh#list#find_entity()`          | Return the index where an entity is within a list, -1 if not found                                                |\n| `lh#list#find_if()`              | Searches the first element in a list that verifies a predicate                                                    |\n| `lh#list#find_if_fast()`         | Searches the first element in a list that verifies a simple predicate only relying on `v:val` or `v:key`          |\n| `lh#list#flat_extend()`          | Extends a list with another, or add elements into a list depending on the _right-hand-side_ parameter               |\n| `lh#list#flatten()`              | Flattens a list                                                                                                   |\n| `lh#list#for_each_call()`        | Calls a function of all elements from a list                                                                      |\n| `lh#list#get()`                  | Returns a list with the elements of index/key in a list of lists/dictionaries (\u003c=\u003e map get(key/idx) list)         |\n| `lh#list#intersect()`            | Intersection of two lists                                                                                         |\n| `lh#list#is_contained_in()`      | Returns whether all elements from the sublist are present in the second list                                      |\n| `lh#list#lower_bound()`          | See C++ [`std::lower_bound`](http://en.cppreference.com/w/cpp/algorithm/lower_bound)                              |\n| `lh#list#map_on()`               | Transforms a list of lists/dictionaries at key/index with specified action.                                       |\n| `lh#list#mask()`                 | Builds a subset of the input list ; elements are kept according to a mask list.                                   |\n| `lh#list#match()`                | Searches the first element in a list that matches a pattern                                                       |\n| `lh#list#match_re()`             | Searches the first pattern in a list that  is matched by a text                                                   |\n| `lh#list#matches()`              | Returns the list of indices of elements that match the pattern                                                    |\n| `lh#list#not_contain_entity()`   | Tells whether a Dict or List entity is not present within a list                                                  |\n| `lh#list#not_found()`            | Returns whether the range returned from `equal_range` is empty (i.e. element not found)                           |\n| `lh#list#possible_values()`      | Returns a sorted list of the values that are stored: in a flat list, or at a given {index} in the lists from the input {list}, or at a given {key} in the dictionaries from the input {list} |\n| `lh#list#push_if_new()`          | Adds a value if not already present in the list                                                                   |\n| `lh#list#push_if_new_elements()` | Adds elements if not already present in the list                                                                  |\n| `lh#list#push_if_new_entity()`   | Adds an entity if not already present in the list                                                                 |\n| `lh#list#remove()`               | Remove elements from list according to a list of indices                                                          |\n| `lh#list#rotate()`               | Rotate elements from list                                                                                         |\n| `lh#list#separate()`             | Returns the list that matches the predicate and the list that doesn't match it                                    |\n| `lh#list#sort()`                 | Workaround `sort()` bug which has been fixed in Vim v7.4.411                                                      |\n| `lh#list#subset()`               | Builds a subset slice of a list                                                                                   |\n| `lh#list#transform()`            | Applies a transformation on each element from a list ; unlike `map()`, the input list is left unchanged           |\n| `lh#list#transform_if()`         | Applies a transformation on each element from a list that match the predicate                                     |\n| `lh#list#uniq()`                 | Emulates `uniq()` when not defined, calls it otherwise                                                            |\n| `lh#list#unique_sort()`          | Sorts the elements of a list, and makes sure they are all unique                                                  |\n| `lh#list#unique_sort2()`         | Another implementation of `unique_sort`                                                                           |\n| `lh#list#upper_bound()`          | See C++ [`std::upper_bound`](http://en.cppreference.com/w/cpp/algorithm/upper_bound)                              |\n| `lh#list#zip()`                  | Zip two lists into one list.                                                                                      |\n| `lh#list#zip_as_dict()`          | Zip two lists into a dictionary.                                                                                  |\n\n\n### Stacks related functions\n\n#### Procedural way\n\n| Function                      | Purpose                                                                                      |\n|:------------------------------|:---------------------------------------------------------------------------------------------|\n| `lh#stack#push(stack, value)` | Pushes a variable at the end of a list that will be interpreted as a _stack_                   |\n| `lh#stack#top(stack)`         | Fetches the top of the stack                                                                 |\n| `lh#stack#pop(stack)`         | Pops the top of the stack                                                                    |\n\n#### OO way\n\n| Function                      | Purpose                                                                                      |\n|:------------------------------|:---------------------------------------------------------------------------------------------|\n| `lh#stack#new(...)`           | Creates a new _stack_ object that proposes `push`, `top` and `pop` methods.                    |\n| `lh#stack#new_list(nb)`       | Builds what `repeat([lh#stack#new()], 42)` cannot build                                      |\n\n### Graphs related functions\n| Function                   | Purpose                                                                                      |\n|:---------------------------|:---------------------------------------------------------------------------------------------|\n| `lh#graph#tsort#breadth()` | Same as `depth()`, but with a non-recursive breadth-first search                             |\n| `lh#graph#tsort#depth()`   | Implements a Topological Sort on a Direct Acyclic Graph, with a recursive depth-first search |\n\n\n### Paths related functions\n| Function                                     | Purpose                                                                                                                                  |\n|:---------------------------------------------|:-----------------------------------------------------------------------------------------------------------------------------------------|\n| `lh#path#add_path_if_exists(listname, path)` | Adds a path is a list iff the path points to an existing node                                                                            |\n| `lh#path#cd_without_sideeffects()`           | Change the current directory without altering the behaviour regarding window local directories                                           |\n| `lh#path#common()`                           | Returns the biggest common part between several paths                                                                                    |\n| `lh#path#depth()`                            | Returns the depth of a path                                                                                                              |\n| `lh#path#exe()`                              | Returns the fullpath of an executable (emulate [`exepath()`](http://vimhelp.appspot.com/eval.txt.html#exepath%28%29) on old vim versions |\n| `lh#path#exists()`                           | Returns whether a pathname can be read, or if it's open in a buffer                                                                      |\n| `lh#path#find(pathlist, regex)`              | Returns the first path in a list that matches a regex                                                                                    |\n| `lh#path#find_in_parents()`                  | Support function at the root of [local_vimrc](http://github.com/LucHermitte/local_vimrc)                                                 |\n| `lh#path#find_upward()`                      | Uniform interface to `finddir()` and `filefile()`                                                                                        |\n| `lh#path#fix()`                              | Fixes a pathname in order for it to be compatible with external commands or vim options                                                  |\n| `lh#path#glob_as_list()`                     | Returns `globpath()`result as a list                                                                                                     |\n| `lh#path#is_absolute_path()`                 | Tells whether the parameter is an absolute pathname                                                                                      |\n| `lh#path#is_distant_or_scratch()`            | Tells whether the parameter is a distant path or a scratch buffer name                                                                   |\n| `lh#path#is_in(node, path)`                  | Tells whether a node is already present in a path -- `readlink()` is applied on both parameters                                          |\n| `lh#path#is_url()`                           | Tells whether the parameter is an URL                                                                                                    |\n| `lh#path#join(pathparts, ...)`               | Joins path parts into a string                                                                                                           |\n| `lh#path#munge(pathlist, path)`              | Adds a path to a list on the condition the path isn't already present, and that it points to a valid node                                |\n| `lh#path#new_permission_lists()`             | Prepares a permission lists object to be used to accept/reject pathnames based upon white/black/... lists                                |\n| `lh#path#readlink(pathname)`                 | Returns `readlink` result on the pathname -- when the command is available on the system                                                 |\n| `lh#path#relative_to()`                      | Returns the relative offset to reference files in another directory                                                                      |\n| `lh#path#remove_dir_mark()`                  | Removes the trailing `/` or `\\` in the path if any                                                                                       |\n| `lh#path#select_one()`                       | Asks the end-user to select one pathname                                                                                                 |\n| `lh#path#shellslash()`                       | Returns the shellslash character                                                                                                         |\n| `lh#path#simplify()`                         | Like `simplify()`, but also strips the leading `./`                                                                                      |\n| `lh#path#split(pathname)`                    | Splits a string into path parts                                                                                                          |\n| `lh#path#strip_common()`                     | In a set of pathnames, strips the leading part they all have in common                                                                   |\n| `lh#path#strip_start()`                      | Strips the leading part of a pathname if found in the given list of pathnames                                                            |\n| `lh#path#to_dirname()`                       | Complete the current path with '/' if missing                                                                                            |\n| `lh#path#to_regex()`                         | Builds a regex that can be used to match pathnames                                                                                       |\n| `lh#path#to_relative()`                      | Transforms a pathname to a pathname relative to the current directory                                                                    |\n| `lh#path#vimfiles()`                         | Returns where the current user vimfiles are (`$HOME/.vim` `~/vimfiles`, ...)                                                             |\n| `lh#path#writable()`                         | Returns whether we could write into the pathname, even if nothing by that name already exists                                            |\n\n\n### Commands related functions\n| Function                                | Purpose                                                                                     |\n|:----------------------------------------|:--------------------------------------------------------------------------------------------|\n| `lh#command#new()`                      | Experimental way to define commands that support auto-completion                            |\n| `lh#command#Fargs2String()`             | Merges a set strings into a set of parameters (experimental)                                |\n| `lh#command#analyse_args()`             | Parse `:command-completion-custom` function parameters                                      |\n| `lh#command#matching_variables()`       | Returns a list of Vim variable names matching the lead                                      |\n| `lh#command#matching_for_commands()`    | Returns a list of Ex command names matching the lead                                        |\n| `lh#command#matching_askvim()`          | Returns a list of what Vim what have returned for cmdline completion given a type of things |\n| `lh#command#matching_bash_completion()` | Asks Bash what it'll complete the lead following the command with                           |\n| `lh#command#matching_make_completion()` | Asks Bash what it'll complete the lead following `make` with                                |\n\n\n### Menus related functions\n| Function                      | Purpose                                                                                                                                                  |\n|:------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `lh#askvim#menu()`            | Experimental functions to ask vim which menus are defined                                                                                                |\n| `lh#mapping#define()`         | Defines a new mapping given a mapping definition                                                                                                         |\n| `lh#menu#IVN_make()`          | Like `lh#menu#make()`, but dedicated to text inserting actions and INSERT, NORMAL, and VISUAL modes.                                                     |\n| `lh#menu#def_string_item()`   | This function defines a [|`:menu`|](http://vimhelp.appspot.com/gui.txt.html#:menu) entry that will be associated to a |global-variable| string variable. |\n| `lh#menu#def_toggle_item()`   | This function defines a [|`:menu`|](http://vimhelp.appspot.com/gui.txt.html#:menu) entry that will be associated to a |global-variable| whose values can be cycled and explored from the menu. This global variable can be seen as an enumerate whose value can be cyclically updated through a menu. |\n| `lh#menu#is_in_visual_mode()` | Tells whether the action triggered by a menu/map was initiated while in visual mode.                                                                     |\n| `lh#menu#make()`              | Helper function to associate menus and mappings to actions in different modes.                                                                           |\n| `lh#menu#map_all()`           | Helper function to define several mappings at once as `:amenu` would do                                                                                  |\n| `lh#menu#emove()`             | Helper function to remove a menu from as many modes as required                                                                                          |\n| `lh#menu#text()`              | Transforms a regular text into a text that can be directly used with [|`:menu`|](http://vimhelp.appspot.com/gui.txt.html#:menu) commands.                |\n\nSee also the documentation of the old functions at http://hermitte.free.fr/vim/general.php#expl_menu_map\n\n\n### Buffers and Windows related functions\n| Function                         | Purpose                                                                                                                          |\n|:---------------------------------|:---------------------------------------------------------------------------------------------------------------------------------|\n| `lh#buffer#dialog#add_help()`    | see [lh-vim-lib/dialog](doc/Dialog.md)                                                                                           |\n| `lh#buffer#dialog#new()`         | see [lh-vim-lib/dialog](doc/Dialog.md)                                                                                           |\n| `lh#buffer#dialog#select()`      | see [lh-vim-lib/dialog](doc/Dialog.md)                                                                                           |\n| `lh#buffer#dialog#toggle_help()` | see [lh-vim-lib/dialog](doc/Dialog.md)                                                                                           |\n| `lh#buffer#find()`               | Finds and jumps to the window that matches the buffer identifier, does nothing if not found.                                     |\n| `lh#buffer#get_nr()`             | Returns the buffer number associated to a buffername/filename. If no such file is known to vim, a buffer will be locally created |\n| `lh#buffer#jump()`               | Like `lh#buffer#find()`, but opens the buffer in a new window if it no matching window was opened before.                        |\n| `lh#buffer#list()`               | Returns the list of `buflisted` buffers.                                                                                         |\n| `lh#buffer#scratch()`            | Opens a new scratch buffer.                                                                                                      |\n| `lh#window#split()`              | Forces to open a new split, ignoring E36                                                                                         |\n| `lh#window#new()`                | Forces to open a new window, ignoring E36                                                                                        |\n| `lh#window#create_window_with()` | Forces to create a new split, with any split related command, ignoring E36                                                       |\n| `lh#window#getid()`              | Emulates recent `win_getid()` function                                                                                           |\n| `lh#window#gotoid()`             | Emulates recent `win_gotoid()` function                                                                                          |\n| `lh#window#text_width()`         | Return the actual width available to display text in the current window.                                                         |\n\n\n### Quickfix related functions\n| Function                   | Purpose                                                                                                                      |\n|:---------------------------|:-----------------------------------------------------------------------------------------------------------------------------|\n| `lh#qf#get_merics()`       | Returns the numbers of errors and warnings in the quickfix list                                                              |\n| `lh#qf#get_title()`        | Returns title of the qf window                                                                                               |\n| `lh#qf#get_winnr()`        | Returns window number of the qf window -- ignore location list windows                                                       |\n| `lh#qf#is_displayed()`     | Tells whether the qf window is visible -- ignore location list windows                                                       |\n| `lh#qf#make_context_map()` | Returns a non intrusive alternative to [`quickfix-context`](http://vimhelp.appspot.com/quickfix.txt.html#quickfix%2dcontext) |\n| `lh#qf#set_title()`        | Sets the title of the qf window                                                                                              |\n\n### Syntax related functions\n| Function                                                         | Purpose                                                                                                                                |\n|:-----------------------------------------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------|\n| `lh#syntax#getline_matching()`                                   | Extracts a line with the characters matching a given syntax ID pattern                                                                 |\n| `lh#syntax#getline_not_matching()`                               | Extracts a line without the characters matching a given syntax ID pattern                                                              |\n| `lh#syntax#is_a_comment()`                                       | Tells the syntax kind of the character at the given mark is a comment                                                                  |\n| `lh#syntax#is_a_comment_at()`                                    | Tells the syntax kind of the character at the given position is a comment                                                              |\n| `lh#syntax#line_filter()`                                        | Defines an object that extracts the characters matching a given syntax ID pattern text lines                                           |\n| `lh#syntax#list()`                                               | Like `lh#syntax#list_raw()`, but reinterprets the results (experimental)                                                               |\n| `lh#syntax#list_raw()`                                           | Returns the result of \"`syn list {group-name}`\" as a string                                                                            |\n| `lh#syntax#match_at()`                                           | Tells whether the syntax kind of the character at the given position matches a pattern                                                 |\n| `lh#syntax#name_at()`                                            | Tells the syntax kind of the character at the given position                                                                           |\n| `lh#syntax#name_at_mark()`                                       | Tells the syntax kind of the character at the given mark                                                                               |\n| `lh#syntax#name_at_mark()`                                       | Tells the syntax kind of the character at the given mark                                                                               |\n| `lh#syntax#skip()` `lh#syntax#SkipAt()` `lh#syntax#SkipAtMark()` | Helper functions to be used with `searchpair()` in order to ignore comments, Doxygen comments, strings, and characters while searching |\n\n\n### Functors\n| Function                  | Purpose                                                     |\n| :------------------------ | :-----------------------------------------------------------|\n| `lh#function#bind()`      | Builds a functor object.                                    |\n| `lh#function#execute()`   | Executes a functor object.                                  |\n| `lh#function#prepare()`   | Prepares a functor object to be `eval`uated.                |\n| `lh#partial#make()`       | Prepares a partial (or an emulated partial) to be executed. |\n| `lh#partial#execute()`    | Executes a partial (or an emulated partial).                |\n\n\n### UI functions\nAll the functions defined in ui-functions.vim are wrappers around Vim\ninteractive functions. Depending on a configuration variable\n(`(bpg):ui_type`), they will delegate the interaction to a gvim UI\nfunction, or a plain text UI function (defined by vim, or emulated)\n\nPossible values for `(bpg):ui_type` are: `gui` (default) or `text`.\n\nIn `lh#ui#confirm()` case, the option `(bpg):ui_confirm_type` can be set to\n`'std'` to explicitly use\n[`confirm()`](http://vimhelp.appspot.com/eval.txt.html#confirm%28%29) instead\nof the old emulated version. The default is to use the emulated version of\n`confirm()`, which unlike the standard one permits to navigate between\npropositions with the cursor or `tab`  keys to choose one.\n\n| Function                         | Purpose                                                                                                                                                 |\n|:---------------------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `lh#ui#ask()`                    | Ask a question under the status line                                                                                                                    |\n| `lh#ui#check()`                  | Emulates a checkbox UI function                                                                                                                         |\n| `lh#ui#combo()`                  | Emulates a combobox UI function                                                                                                                         |\n| `lh#ui#confirm()`                | Similar to `confirm()`                                                                                                                                  |\n| `lh#ui#confirm_callback()`       | Calls [`:h popup_menu()`](http://vimhelp.appspot.com/popup.txt.html#popup_menu%28%29), or fallback to `confirm()` (nvim)                                |\n| `lh#ui#global_confirm_command()` | Extends `:substitute` `confirm`  flag to `:global`. Wrapped in `:ConfirnGlobal`                                                                         |\n| `lh#ui#if()`                     | Acts as the ternary operator                                                                                                                            |\n| `lh#ui#input()`                  | Calls `inputdialog()` or `input()`                                                                                                                      |\n| `lh#ui#make_confirm_command()`   | Prepare an object to use when executing a command multiple times                                                                                        |\n| `lh#ui#switch()`                 | Emulates `switch()` in vim-script language                                                                                                              |\n| `lh#ui#which()`                  | Wrapper around functions like `lh#ui#confirm()` or `lh#ui#combo()` that returns the text of the selected item instead of the index of the selected item |\n\nIn the same thematics, see also [VFT - Vim Form Toolkit](http://www.vim.org/scripts/script.php?script_id=2160)\n\n### Logging Framework\nSee separate page: [doc/Log.md](doc/Log.md).\n\n### Design by Contract functions\nSee separate page: [doc/DbC.md](doc/DbC.md).\n\n### Word Tools\nSee http://hermitte.free.fr/vim/general.php#expl_words_tools\n\n### Commands\n\n| Command                                   | Purpose                                                                                                                                                                    |\n|:------------------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [`:Toggle`](#menus-related-functions)     | Toggles the state of a cyclic option/variable                                                                                                                              |\n| `:LoadedBufDo`                            | Like [`:h :bufdo`](http://vimhelp.appspot.com/windows.txt.html#%3abufdo), on loaded buffers                                                                                |\n| `:CleanEmptyBuffers`                      | [Wipeout](http://vimhelp.appspot.com/windows.txt.html#%3abw) empty buffers                                                                                                 |\n| [`:LHLog`](doc/Log.md)                    | Helper command to choose where logs shall be dumped to                                                                                                                     |\n| `Jobs`, `:JobUnpause`, `:StopBGExecution` | Helper commands to keep track of async jobs registered with lh-vim-lib API                                                                                                 |\n| `:ConfirmGlobal`                          | Like the [`:g`](http://vimhelp.appspot.com/repeat.txt.html#%3aglobal) command, but with a _confirm_ option as in [`:s`](http://vimhelp.appspot.com/change.txt.html#%3as_c) |\n| `:LetIfUndef`                             | Sets the value of an option, only if not set already -- supports `g.foo.bar = 42`                                                                                          |\n| `:LetTo`                                  | Sets the value of an option, even if it's already set -- unlike [`:h :let`](http://vimhelp.appspot.com/eval.txt.html#%3alet), supports `g:foo.bar = 42`                    |\n| `:Unlet`                                  | [`:unlet`](http://vimhelp.appspot.com/eval.txt.html#%3aunlet) a variable if it doesn't exists -- no side effect unlike `:silent! unlet`                                    |\n| `:PushOptions`, `:PopOptions`             | Pushs/pops values into list variables                                                                                                                                      |\n| [`:Project`](doc/Project.md)              | Central command for the project feature                                                                                                                                    |\n\n## Python related functions\n\n| Command                           | Purpose                                                                                       |\n| :---------------------------------| :---------------------------------------------------------------------------------------------|\n| `lh#python#best_still_avail()`    | Returns the best python flavour we can use without imposing a version, unlike `has('python')` |\n| `lh#python#has()`                 | Returns `has('python_compiled') || has('python3_compiled')`                                   |\n| `lh#python#can_import()`          | Returns whether `:{bestpy} import {modname}` succeeds                                         |\n| `lh#python#external_can_import()` | Returns whether `system('python -c \"import {modname}\")` succeeds                              |\n\n## Installation\n  * Requirements: Vim 7.4, Vim 8 for `lh#async` feature.\n  * Clone from the git repository\n\n    ```sh\n    git clone git@github.com:LucHermitte/lh-vim-lib.git\n    ```\n\n  * [Vim Addon Manager](http://github.com/MarcWeber/vim-addon-manager): (this\n    is the preferred method as VAM handles dependencies).\n\n    ```vim\n    ActivateAddons lh-vim-lib\n    ```\n\n  * Note that [vim-flavor](https://github.com/kana/vim-flavor) also handles\n    dependencies which will permit to automatically import lh-vim-lib from\n    plugins that use it:\n\n    ```\n    flavor 'LucHermitte/lh-vim-lib'\n    ```\n\n  * Vundle/NeoBundle:\n\n    ```vim\n    Bundle 'LucHermitte/lh-vim-lib'\n    ```\n\n## Credits\n  * Luc Hermitte, maintainer\n  * Troy Curtis Jr, for portability functions, and many tests/issues he raised\n  * Many other I've forgotten :(\n\n## Some other Vim Scripting libraries\n\n### The ones that seem to be still activelly maintained\n  * [ingo-library](http://www.vim.org/scripts/script.php?script_id=4433), by\n    Ingo Karkat\n  * [maktaba](https://github.com/google/vim-maktaba), by google\n  * [tlib](http://www.vim.org/scripts/script.php?script_id=1863), by Tom Link\n  * [vim-misc](https://github.com/xolox/vim-misc), by Peter Odding\n  * [vital](https://github.com/vim-jp/vital.vim), by the Japanese Vim User\n    Group\n\n### The other ones\n  * [anwolib](http://www.vim.org/scripts/script.php?script_id=3800), by Andy Wokula\n  * [cecutil](http://www.vim.org/scripts/script.php?script_id=1066), by Charles\n    \"DrChip\" Campbell\n  * [genutils](http://www.vim.org/scripts/script.php?script_id=197), by Hari\n    Krishna Dara\n  * [l9](http://www.vim.org/scripts/script.php?script_id=3252), by Takeshi NISHIDA\n  * [theonevimlib](http://www.vim.org/scripts/script.php?script_id=1963), initiated by Marc Weber\n  * [underscore](http://www.vim.org/scripts/script.php?script_id=5149), by\n    haya14busa\n","funding_links":[],"categories":["Vim Script","Vim script"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FLucHermitte%2Flh-vim-lib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FLucHermitte%2Flh-vim-lib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FLucHermitte%2Flh-vim-lib/lists"}