{"id":44197513,"url":"https://github.com/akioweh/lsp-document-highlight.nvim","last_synced_at":"2026-02-10T22:01:11.546Z","repository":{"id":331529530,"uuid":"1126954398","full_name":"akioweh/lsp-document-highlight.nvim","owner":"akioweh","description":"Snappy \"cursor word\" highlighting using modern mechanics for neovim","archived":false,"fork":false,"pushed_at":"2026-01-10T01:00:19.000Z","size":13,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-10T22:16:44.882Z","etag":null,"topics":[],"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/akioweh.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-02T22:09:01.000Z","updated_at":"2026-01-10T01:00:23.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/akioweh/lsp-document-highlight.nvim","commit_stats":null,"previous_names":["akioweh/lsp-document-highlight.nvim"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/akioweh/lsp-document-highlight.nvim","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akioweh%2Flsp-document-highlight.nvim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akioweh%2Flsp-document-highlight.nvim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akioweh%2Flsp-document-highlight.nvim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akioweh%2Flsp-document-highlight.nvim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/akioweh","download_url":"https://codeload.github.com/akioweh/lsp-document-highlight.nvim/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akioweh%2Flsp-document-highlight.nvim/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29319237,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-10T20:44:44.282Z","status":"ssl_error","status_checked_at":"2026-02-10T20:44:43.393Z","response_time":65,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2026-02-09T20:00:24.065Z","updated_at":"2026-02-10T22:01:11.493Z","avatar_url":"https://github.com/akioweh.png","language":"Lua","readme":"# lsp-document-highlight.nvim\n\n_provides you with the power of the `textDocument.documentHighlight` LSP method in a speedy way_\n\n\u003e [!TIP]  \n\u003e [`textDocument.documentHighlight`](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_documentHighlight), aka. \"cursor word highlighting\" or \"reference highlighting\",\n\u003e is the UI feature where all references to the symbol under the cursor are shown using a highlight.\n\n## why does this exist\n\n- instantaneous\\*, live updating unlike putting `vim.lsp.buf.document_highlight()` in an autocmd on `CursorHold`\n\n- no performance issues (configurable lsp call throttling) unlike putting `vim.lsp.buf.document_highlight()` in an autocmd on `CursorMoved`\n\n- no flickering (due to slow lsp) when moving within the same symbol unlike any autocmd solution or [`vim-illuminate`](https://github.com/RRethy/vim-illuminate)\n\n- throttling instead of debouncing so updates trigger immediately when possible unlike [`snacks.nvim` words](https://github.com/folke/snacks.nvim/blob/main/docs/words.md)\n\n- also supports navigating between references (see keymapping below).\n\n\\*: assuming your lsp is not being slow (\\*cough\\* \\*cough\\* `lua_ls`... i've heard typescript lsp is also slow but :shrug: not something i use)\n\n## installation\n\nconsult your favorite plugin manager.\n\nthis plugin loads itself -- no need to call any setup function.  \nthis plugin is self-lazy-loading.\n(although `setup()` currently triggers loading... but there's so little code anyway)\n\n## configuration\n\nsee [config.lua](./lua/lsp-document-highlight/config.lua) for the defaults\nand [types.lua](./lua/lsp-document-highlight/types.lua) for annotations on what the keys mean.  \nif you have `lua_ls` set up, you can also enjoy autocompletion and\nhover documentation in your plugin config\nif you annotate the table with the `LDH.config` type.\n\nexample setup with keymaps to navigate references (using `lazy.nvim`):\n\n```lua\n---@type LazySpec\nreturn {\n  {\n    \"akioweh/lsp-document-highlight.nvim\",\n    lazy = false,\n    keys = {\n      {\n        \"[[\",\n        function()\n          require(\"lsp-document-highlight\").jump(-vim.v.count1, true)\n        end,\n        desc = \"Previous Reference\",\n      },\n      {\n        \"]]\",\n        function()\n          require(\"lsp-document-highlight\").jump(vim.v.count1, true)\n        end,\n        desc = \"Next Reference\",\n      },\n    },\n    ---@type LDH.config\n    opts = {\n      throttle = 50,\n    },\n  },\n}\n```\n\n\u003e [!TIP]  \n\u003e passing `vim.v.count1` into `jump` allows one to naturally use vim keycounts to jump multiple references at once.\n\n## lua api\n\nthe module is called `lsp-document-highlight`.\nrequire it to access all the public functions (see [the code](./lua/lsp-document-highlight.lua) ).\n\nthe only thing of interest now is the `require(\"lsp-document-highlight\").jump(count, wrap)` function:\n\n```lua\n--- jumps to the next count-th (or previous if negative) reference\n--- @param count number\n--- @param wrap? boolean definitely self-explanatory\nfunction M.jump(count, wrap)\n  -- ...\nend\n```\n\n\u003e [!NOTE]  \n\u003e if `count` is more than 1 (negative or positive), jumping will never wrap around.\n\u003e this, with a keymap setup like above, makes `[[` and `]]` only wrap when a keycount is NOT given;\n\u003e any large enough keycount will get you to the first or last reference instead of sending you somewhere random due to wrapping.\n\ncall `.enable()` or `.disable()` to do what the function names suggest.  \nyou can also do this per-buffer by passing a filtering predicate to the `enable.buffer` key in the config.\ni recommend storing a flag in `vim.b[]` and have the predicate check the flag :).\n\n---\n\nPS. star pls :)\n","funding_links":[],"categories":["LSP"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakioweh%2Flsp-document-highlight.nvim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fakioweh%2Flsp-document-highlight.nvim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakioweh%2Flsp-document-highlight.nvim/lists"}