{"id":51027174,"url":"https://github.com/sohanemon/keymap.nvim","last_synced_at":"2026-06-21T20:30:45.069Z","repository":{"id":333625873,"uuid":"1138026185","full_name":"sohanemon/keymap.nvim","owner":"sohanemon","description":"Neovim keymaps that stay in their lane","archived":false,"fork":false,"pushed_at":"2026-01-20T08:55:24.000Z","size":28,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-20T14:53:55.607Z","etag":null,"topics":["lua","neovim","nvim","plugin"],"latest_commit_sha":null,"homepage":"","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sohanemon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-01-20T06:35:05.000Z","updated_at":"2026-01-20T08:55:28.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/sohanemon/keymap.nvim","commit_stats":null,"previous_names":["sohanemon/keymap.nvim"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/sohanemon/keymap.nvim","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sohanemon%2Fkeymap.nvim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sohanemon%2Fkeymap.nvim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sohanemon%2Fkeymap.nvim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sohanemon%2Fkeymap.nvim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sohanemon","download_url":"https://codeload.github.com/sohanemon/keymap.nvim/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sohanemon%2Fkeymap.nvim/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34625624,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-21T02:00:05.568Z","response_time":54,"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":["lua","neovim","nvim","plugin"],"created_at":"2026-06-21T20:30:44.088Z","updated_at":"2026-06-21T20:30:45.052Z","avatar_url":"https://github.com/sohanemon.png","language":"Lua","funding_links":[],"categories":[],"sub_categories":[],"readme":"# keymap.nvim\n\n![assets/cover.webp](assets/cover.webp)\n\nA lightweight Neovim plugin for creating key mappings with buffer, filetype, and buftype scoping.\n\n## Why keymap.nvim?\n\nMost keymapping plugins give you global mappings. This plugin makes it **trivial to create context-aware keymaps** that only exist where you need them — per buffer, per filetype, or per buftype.\n\nNo more cluttering your config with `autocmd` boilerplate. Just declare where a keymap should apply.\n\n## Features\n\n- **Buffer-local mappings** — Keymaps that live only in the current buffer\n- **Filetype-specific mappings** — Keymaps that activate only for specific file types\n- **Buftype-specific mappings** — Keymaps for special buffer types (quickfix, terminal, etc.)\n- Simple API with optional which-key integration\n- Zero-dependency core (which-key optional)\n- Global `Keymap` table for convenience\n\n## Installation\n\n### [lazy.nvim](https://github.com/folke/lazy.nvim)\n\n\n```lua\n{\n  \"sohanemon/keymap.nvim\",\n  dependencies = { \"folke/which-key.nvim\"  }, -- optional\n  opts = {},\n}\n```\n\n### [packer.nvim](https://github.com/wbthomason/packer.nvim)\n\n```lua\nuse(\"sohanemon/keymap.nvim\")\n```\n\n## Configuration\n\n**String (same icon for all):**\n\n```lua\nrequire(\"keymap\").setup({\n  icon = \"\",  -- Icon for which-key (keymaps and groups)\n})\n```\n\n**Table (different icons for keymaps and groups):**\n\n```lua\nrequire(\"keymap\").setup({\n  icon = {\n    default = \"\",   -- Icon for keymaps\n    group = \"\",     -- Icon for groups\n  },\n})\n```\n\nOr pass opts to lazy.nvim:\n\n```lua\n{\n  \"sohanemon/keymap.nvim\",\n  opts = {\n    icon = {\n      default = \"\",\n      group = \"\",\n    },\n  },\n}\n```\n\n## Usage\n\nUse either the module pattern or the global `Keymap` table:\n\n```lua\n-- Module pattern (recommended)\nlocal keymap = require(\"keymap\")\nkeymap.add({ ... })\n\n-- Global pattern\nKeymap.add({ ... })\n```\n\n### Global Key Mapping\n\n```lua\nkeymap.add({\n  key = \"\u003cleader\u003eff\",\n  action = \":Telescope find_files\u003cCR\u003e\",\n  desc = \"Find files\",\n})\n```\n\n### Buffer-local Mapping\n\nKeymaps that live only in the current buffer:\n\n```lua\nkeymap.add({\n  key = \"\u003cleader\u003eq\",\n  action = \":q\u003cCR\u003e\",\n  desc = \"Quit\",\n  buffer = true,\n})\n```\n\n### Filetype-specific Mapping\n\nKeymaps that activate only for specific file types:\n\n```lua\nkeymap.add({\n  key = \"\u003cleader\u003ecc\",\n  action = \":Commentary\u003cCR\u003e\",\n  desc = \"Comment\",\n  filetype = \"python\",\n})\n```\n\nMultiple filetypes:\n\n```lua\nkeymap.add({\n  key = \"\u003cleader\u003efm\",\n  action = \":Format\u003cCR\u003e\",\n  desc = \"Format\",\n  filetype = { \"python\", \"lua\", \"javascript\" },\n})\n```\n\n### Buftype-specific Mapping\n\nKeymaps for special buffer types:\n\n```lua\nkeymap.add({\n  key = \"\u003cleader\u003ex\",\n  action = \":cclose\u003cCR\u003e\",\n  desc = \"Close quickfix\",\n  buftype = \"quickfix\",\n})\n```\n\n### Multiple Modes\n\n```lua\nkeymap.add({\n  key = \"\u003cleader\u003ecd\",\n  action = \":cd %:p:h\u003cCR\u003e\",\n  desc = \"Change directory\",\n  mode = { \"n\", \"v\" },\n})\n```\n\n### With VSCode Support\n\n```lua\nkeymap.add({\n  key = \"\u003cleader\u003ern\",\n  action = \":lua vim.lsp.buf.rename()\", -- Neovim command\n  vscode = \"editor.action.rename\", -- VSCode command\n  desc = \"Rename\",\n})\n```\n\n### With Function Action\n\n```lua\nkeymap.add({\n  key = \"\u003cleader\u003epp\",\n  action = function()\n    vim.notify(\"Project panel\")\n  end,\n  desc = \"Show project panel\",\n})\n```\n\n### Create Which-key Group\n\nWhen `action` is omitted, creates a which-key group with `desc` as the group name:\n\n```lua\n-- Group leader (no action, just a label)\nkeymap.add({\n  key = \"\u003cleader\u003ef\",\n  desc = \"Telescope files\",\n})\n\n-- Actual mappings under the group\nkeymap.add({\n  key = \"\u003cleader\u003eff\",\n  action = \":Telescope find_files\",\n  desc = \"Find files\",\n})\n\nkeymap.add({\n  key = \"\u003cleader\u003efb\",\n  action = \":Telescope buffers\",\n  desc = \"Buffers\",\n})\n```\n\n### Send Key Sequence\n\n```lua\nkeymap.send_key(\"\u003cEsc\u003e\", \"i\")\n```\n\n### Delete a Keymap\n\n```lua\nkeymap.delete(\"\u003cleader\u003ex\", \"n\")\n```\n\n## API\n\n### `keymap.add(opts)`\n\nCreate a key mapping. If `action` is omitted, creates a which-key group with `desc` as the group name.\n\n| Option | Type | Description |\n|--------|------|-------------|\n| `key` | `string` | Key sequence (required) |\n| `action` | `string\\|function` | Command or function (optional - omit to create a group) |\n| `buffer` | `boolean\\|number` | Buffer-local mapping |\n| `filetype` | `string\\|string[]` | Filetype pattern(s) |\n| `buftype` | `string\\|string[]` | Buftype pattern(s) |\n| `mode` | `string\\|string[]` | Mode(s): \"n\", \"i\", \"v\", \"x\", \"s\", \"o\", \"t\" (default: \"n\") |\n| `desc` | `string` | Description for which-key, or group name if `action` is omitted |\n| `remap` | `boolean` | Allow remapping |\n| `icon` | `string` | Icon for which-key (only used if which-key is available) |\n| `vscode` | `string` | VSCode command |\n\n### `keymap.send_key(key, mode)`\n\nSend key sequence to Vim.\n\n### `keymap.delete(key, mode)`\n\nDelete an existing key mapping.\n\n### `keymap.setup(opts)`\n\nConfigure plugin defaults.\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsohanemon%2Fkeymap.nvim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsohanemon%2Fkeymap.nvim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsohanemon%2Fkeymap.nvim/lists"}