{"id":21071873,"url":"https://github.com/iron-e/nvim-libmodal","last_synced_at":"2025-09-20T04:31:53.378Z","repository":{"id":42375040,"uuid":"260020850","full_name":"Iron-E/nvim-libmodal","owner":"Iron-E","description":"Create new \"modes\" for Neovim!","archived":false,"fork":false,"pushed_at":"2024-07-13T13:51:28.000Z","size":414,"stargazers_count":123,"open_issues_count":1,"forks_count":7,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-05-27T00:21:06.812Z","etag":null,"topics":["callback-flow-control","callback-functions","free-software","library","lua","mapping-tools","modal","modal-editing","neovim","nvim","plugin","vim-libmodal","vim-plugin","vim-win"],"latest_commit_sha":null,"homepage":null,"language":"Lua","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/Iron-E.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":"2020-04-29T19:17:59.000Z","updated_at":"2025-05-22T15:23:18.000Z","dependencies_parsed_at":"2024-03-15T23:23:14.163Z","dependency_job_id":"5271e3f7-ba17-4dd5-8454-ccfc203109fd","html_url":"https://github.com/Iron-E/nvim-libmodal","commit_stats":{"total_commits":202,"total_committers":6,"mean_commits":"33.666666666666664","dds":0.02970297029702973,"last_synced_commit":"45577b6e19924e5c193cf0fa65fac4b985dca987"},"previous_names":[],"tags_count":75,"template":false,"template_full_name":null,"purl":"pkg:github/Iron-E/nvim-libmodal","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Iron-E%2Fnvim-libmodal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Iron-E%2Fnvim-libmodal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Iron-E%2Fnvim-libmodal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Iron-E%2Fnvim-libmodal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Iron-E","download_url":"https://codeload.github.com/Iron-E/nvim-libmodal/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Iron-E%2Fnvim-libmodal/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276046871,"owners_count":25575876,"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","status":"online","status_checked_at":"2025-09-20T02:00:10.207Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["callback-flow-control","callback-functions","free-software","library","lua","mapping-tools","modal","modal-editing","neovim","nvim","plugin","vim-libmodal","vim-plugin","vim-win"],"created_at":"2024-11-19T18:54:29.112Z","updated_at":"2025-09-20T04:31:53.127Z","avatar_url":"https://github.com/Iron-E.png","language":"Lua","readme":"# nvim-libmodal\n\nThis is a rewrite of [vim-libmodal](https://github.com/Iron-E/vim-libmodal) using Neovim's Lua API. This project aims to be cross-compatable with `vim-libmodal`— with a few notable exceptions (see the [FAQ](#FAQ)).\n\n## Installation\n\nEither use `packadd` or any package manager. I recommend using [lazy.nvim](https://github.com/folke/lazy.nvim).\n\n### Requirements\n\n* Neovim 0.7+.\n* `vim-libmodal` is _not_ installed.\n\n### Examples\n\n#### lazy.nvim\n\n```lua\n{'Iron-E/nvim-libmodal',\n  lazy = true, -- don't load until necessary\n  version = '^3.0', -- OPTIONAL: unsubscribe from breaking changes\n},\n```\n\n#### packer.nvim\n\n```lua\nreturn require('packer').startup {function(use)\n  use 'Iron-E/nvim-libmodal'\nend}\n```\n\n## Usage\n\nThe following plugins have been constructed using `nvim-libmodal`:\n\n* [`nvim-bufmode`](https://github.com/Iron-E/nvim-bufmode)\n* [`nvim-marktext`](https://github.com/Iron-E/nvim-marktext)\n* [`nvim-tabmode`](https://github.com/Iron-E/nvim-tabmode)\n\nThe following samples have been constructed using `nvim-libmodal`:\n\n* [`mode-codedoc`](https://gitlab.com/Iron_E/dotfiles/-/blob/master/.config/nvim/lua/mode-codedoc.lua)\n* [The Official Lua Examples](https://github.com/Iron-E/nvim-libmodal/tree/master/examples/lua)\n* [The Official Vimscript Examples](https://github.com/Iron-E/nvim-libmodal/tree/master/examples)\n\nSee [docs](./doc) for more information.\n\n### Statusline\n\nYou can add `libmodal` modes to your status line. Here are a few examples of how to integrate with existing plugins.\n\n#### feline.nvim\n\nSee my configuration for `feline.nvim` [here](https://gitlab.com/Iron_E/dotfiles/-/blob/78e17b41cadd1660f8d3506ffce093437eb80aae/.config/nvim/lua/plugin/feline.lua#L134-160)\n\n#### galaxyline.nvim\n\nSee my configuration for `galaxyline.nvim` [here](https://gitlab.com/Iron_E/dotfiles/-/blob/edf3e1c9779bbc81002832bb03ec875dc86cc16b/.config/nvim/lua/plugin/galaxyline.lua#L140-163).\n\n#### heirline.nvim\n\n\u003cdetails\u003e\n  \u003csummary\u003eAn example config\u003c/summary\u003e\n  \u003cpre lang = \"lua\"\u003e\n-- Defined in https://github.com/Iron-E/nvim-highlite\nlocal BLACK        = '#202020'\nlocal BLUE         = '#7766ff'\nlocal CYAN         = '#33dbc3'\nlocal GRAY_DARK    = '#353535'\nlocal GRAY_LIGHT   = '#c0c0c0'\nlocal GREEN        = '#22ff22'\nlocal GREEN_LIGHT  = '#99ff99'\nlocal ICE          = '#95c5ff'\nlocal ORANGE       = '#ff8900'\nlocal ORANGE_LIGHT = '#f0af00'\nlocal PINK         = '#ffa6ff'\nlocal PINK_LIGHT   = '#ffb7b7'\nlocal PURPLE       = '#cf55f0'\nlocal PURPLE_LIGHT = '#af60af'\nlocal RED          = '#ee4a59'\nlocal RED_DARK     = '#a80000'\nlocal RED_LIGHT    = '#ff4090'\nlocal TAN          = '#f4c069'\nlocal TEAL         = '#60afff'\nlocal TURQOISE     = '#2bff99'\nlocal YELLOW       = '#f0df33'\n \nrequire('heirline').setup({statusline =\n{\n  {\n    hl = function(self)\n      vim.api.nvim_set_hl(0, self.group, {bold = true, fg = self.color})\n      return self.group\n    end,\n    init = function(self)\n      if vim.g.libmodalActiveModeName then\n        self.name = vim.g.libmodalActiveModeName\n        self.color = self.modes[self.name]\n      else\n        local current_mode = self.modes[vim.api.nvim_get_mode().mode]\n \n        self.name = current_mode[1]\n        self.color = current_mode[2]\n      end\n \n      if not self.once then\n        vim.api.nvim_create_autocmd('ModeChanged', {command = 'redrawstatus', pattern = '*:*o'})\n        self.once = true\n      end\n    end,\n    provider = function(self) return '▊ ' .. self.name .. ' ' end,\n    static =\n    { -- {{{\n      group = 'HeirlineViMode',\n      modes =\n      {\n        ['c']  = {'COMMAND-LINE', RED},\n        ['ce'] = {'NORMAL EX', RED_DARK},\n        ['cv'] = {'EX', RED_LIGHT},\n        ['i']  = {'INSERT', GREEN},\n        ['ic'] = {'INS-COMPLETE', GREEN_LIGHT},\n        ['n']  = {'NORMAL', PURPLE_LIGHT},\n        ['no'] = {'OPERATOR-PENDING', PURPLE},\n        ['r']  = {'HIT-ENTER', CYAN},\n        ['r?'] = {':CONFIRM', CYAN},\n        ['rm'] = {'--MORE', ICE},\n        ['R']  = {'REPLACE', PINK},\n        ['Rv'] = {'VIRTUAL', PINK_LIGHT},\n        ['s']  = {'SELECT', TURQOISE},\n        ['S']  = {'SELECT', TURQOISE},\n        ['\u0013'] = {'SELECT', TURQOISE},\n        ['t']  = {'TERMINAL', ORANGE},\n        ['v']  = {'VISUAL', BLUE},\n        ['V']  = {'VISUAL LINE', BLUE},\n        ['\u0016'] = {'VISUAL BLOCK', BLUE},\n        ['!']  = {'SHELL', YELLOW},\n \n        -- libmodal\n        ['BUFFERS'] = TEAL,\n        ['TABLES'] = ORANGE_LIGHT,\n        ['TABS'] = TAN,\n      }\n    }, -- }}}\n    update = 'ModeChanged',\n  },\n}})\n  \u003c/pre\u003e\n\u003c/details\u003e\n\n#### lualine.nvim\n\n\u003cdetails\u003e\n  \u003csummary\u003eAn example config\u003c/summary\u003e\n  \u003cpre lang = \"lua\"\u003e\n-- Defined in https://github.com/Iron-E/nvim-highlite\nlocal BLUE         = '#7766ff'\nlocal CYAN         = '#33dbc3'\nlocal GREEN        = '#22ff22'\nlocal GREEN_LIGHT  = '#99ff99'\nlocal ICE          = '#95c5ff'\nlocal ORANGE       = '#ff8900'\nlocal ORANGE_LIGHT = '#f0af00'\nlocal PINK         = '#ffa6ff'\nlocal PINK_LIGHT   = '#ffb7b7'\nlocal PURPLE       = '#cf55f0'\nlocal PURPLE_LIGHT = '#af60af'\nlocal RED          = '#ee4a59'\nlocal RED_DARK     = '#a80000'\nlocal RED_LIGHT    = '#ff4090'\nlocal TAN          = '#f4c069'\nlocal TEAL         = '#60afff'\nlocal TURQOISE     = '#2bff99'\nlocal YELLOW       = '#f0df33'\n \nlocal MODES =\n{ -- {{{\n  ['c']  = {'COMMAND-LINE', RED},\n  ['ce'] = {'NORMAL EX', RED_DARK},\n  ['cv'] = {'EX', RED_LIGHT},\n  ['i']  = {'INSERT', GREEN},\n  ['ic'] = {'INS-COMPLETE', GREEN_LIGHT},\n  ['n']  = {'NORMAL', PURPLE_LIGHT},\n  ['no'] = {'OPERATOR-PENDING', PURPLE},\n  ['r']  = {'HIT-ENTER', CYAN},\n  ['r?'] = {':CONFIRM', CYAN},\n  ['rm'] = {'--MORE', ICE},\n  ['R']  = {'REPLACE', PINK},\n  ['Rv'] = {'VIRTUAL', PINK_LIGHT},\n  ['s']  = {'SELECT', TURQOISE},\n  ['S']  = {'SELECT', TURQOISE},\n  ['\u0013'] = {'SELECT', TURQOISE},\n  ['t']  = {'TERMINAL', ORANGE},\n  ['v']  = {'VISUAL', BLUE},\n  ['V']  = {'VISUAL LINE', BLUE},\n  ['\u0016'] = {'VISUAL BLOCK', BLUE},\n  ['!']  = {'SHELL', YELLOW},\n \n  -- libmodal\n  ['BUFFERS'] = TEAL,\n  ['TABLES'] = ORANGE_LIGHT,\n  ['TABS'] = TAN,\n} -- }}}\n \nlocal MODE_HL_GROUP = 'LualineViMode'\n \n--[[/* FELINE CONFIG */]]\n \nvim.api.nvim_create_autocmd('ModeChanged', {callback = function()\n  require('lualine').refresh {scope = 'window',  place = {'statusline'}}\nend})\n \nrequire('lualine').setup {sections = {lualine_a = {{\n  function() -- auto change color according the vim mode\n    local mode_color, mode_name\n \n    if vim.g.libmodalActiveModeName then\n      mode_name = vim.g.libmodalActiveModeName\n      mode_color = MODES[mode_name]\n    else\n      local current_mode = MODES[vim.api.nvim_get_mode().mode]\n \n      mode_name = current_mode[1]\n      mode_color = current_mode[2]\n    end\n \n    vim.api.nvim_set_hl(0, MODE_HL_GROUP, {fg = mode_color, bold = true})\n \n    return mode_name..' '\n  end,\n  icon = {'▊', align = 'left'},\n  color = MODE_HL_GROUP,\n  padding = 0,\n}}}}\n  \u003c/pre\u003e\n\u003c/details\u003e\n\n#### staline.nvim\n\n\u003cdetails\u003e\n  \u003csummary\u003eAn example config\u003c/summary\u003e\n  \u003cpre lang = \"lua\"\u003e\n--[[/* CONSTANTS */]]\n \n-- Defined in https://github.com/Iron-E/nvim-highlite\nlocal BLUE         = '#7766ff'\nlocal CYAN         = '#33dbc3'\nlocal GREEN        = '#22ff22'\nlocal GREEN_LIGHT  = '#99ff99'\nlocal ICE          = '#95c5ff'\nlocal ORANGE       = '#ff8900'\nlocal ORANGE_LIGHT = '#f0af00'\nlocal PINK         = '#ffa6ff'\nlocal PINK_LIGHT   = '#ffb7b7'\nlocal PURPLE       = '#cf55f0'\nlocal PURPLE_LIGHT = '#af60af'\nlocal RED          = '#ee4a59'\nlocal RED_DARK     = '#a80000'\nlocal RED_LIGHT    = '#ff4090'\nlocal TAN          = '#f4c069'\nlocal TEAL         = '#60afff'\nlocal TURQOISE     = '#2bff99'\nlocal YELLOW       = '#f0df33'\n \nlocal MODES =\n{ -- {{{\n  ['c']  = {'COMMAND-LINE', RED},\n  ['ce'] = {'NORMAL EX', RED_DARK},\n  ['cv'] = {'EX', RED_LIGHT},\n  ['i']  = {'INSERT', GREEN},\n  ['ic'] = {'INS-COMPLETE', GREEN_LIGHT},\n  ['n']  = {'NORMAL', PURPLE_LIGHT},\n  ['no'] = {'OPERATOR-PENDING', PURPLE},\n  ['r']  = {'HIT-ENTER', CYAN},\n  ['r?'] = {':CONFIRM', CYAN},\n  ['rm'] = {'--MORE', ICE},\n  ['R']  = {'REPLACE', PINK},\n  ['Rv'] = {'VIRTUAL', PINK_LIGHT},\n  ['s']  = {'SELECT', TURQOISE},\n  ['S']  = {'SELECT', TURQOISE},\n  ['\u0013'] = {'SELECT', TURQOISE},\n  ['t']  = {'TERMINAL', ORANGE},\n  ['v']  = {'VISUAL', BLUE},\n  ['V']  = {'VISUAL LINE', BLUE},\n  ['\u0016'] = {'VISUAL BLOCK', BLUE},\n  ['!']  = {'SHELL', YELLOW},\n \n  -- libmodal\n  ['BUFFERS'] = TEAL,\n  ['TABLES'] = ORANGE_LIGHT,\n  ['TABS'] = TAN,\n} -- }}}\n \nlocal MODE_HL_GROUP = 'StalineViMode'\n \n--[[/* FELINE CONFIG */]]\n \nvim.api.nvim_set_hl(0, MODE_HL_GROUP, {})\nrequire('staline').setup(\n{\n  mode_colors = {},\n  mode_icons = {},\n  sections = {left =\n  {\n    function()\n      local mode_color, mode_name\n \n      if vim.g.libmodalActiveModeName then\n        mode_name = vim.g.libmodalActiveModeName\n        mode_color = MODES[mode_name]\n      else\n        local current_mode = MODES[vim.api.nvim_get_mode().mode]\n \n        mode_name = current_mode[1]\n        mode_color = current_mode[2]\n      end\n \n      vim.api.nvim_set_hl(0, MODE_HL_GROUP, {bold = true, fg = mode_color})\n      return {MODE_HL_GROUP, mode_name}\n    end,\n  }},\n})\n  \u003c/pre\u003e\n\u003c/details\u003e\n\n## FAQ\n\n### nvim-libmodal vs. vim-libmodal\n\nThe following is a list of expressions that work in `nvim-libmodal` but not `vim-libmodal`:\n\n* `require 'libmodal'` in Lua.\n  * `vim-libmodal` does not support interacting with it through Lua, you must use the Vimscript interface.\n\nThe following is a list of expressions that work in `vim-libmodal` but not `nvim-libmodal`:\n\n* `call libmodal#Enter('FOO', funcref('bar'), baz)` in Vimscript.\n  * Lua does not support passing `funcref`s from Vimscript. Try using the Lua interface instead.\n* `call libmodal#Prompt('FOO', funcref('bar'), baz)` in Vimscript.\n  * Lua does not support passing `funcref`s from Vimscript. Try using the Lua interface instead.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Firon-e%2Fnvim-libmodal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Firon-e%2Fnvim-libmodal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Firon-e%2Fnvim-libmodal/lists"}