{"id":13681902,"url":"https://github.com/ziontee113/neo-minimap","last_synced_at":"2025-03-16T09:33:11.667Z","repository":{"id":63281981,"uuid":"550630232","full_name":"ziontee113/neo-minimap","owner":"ziontee113","description":"Plugin for Neovim that lets you create your own \"minimap\" from Treesitter Queries or Vim Regex.","archived":true,"fork":false,"pushed_at":"2023-04-30T20:58:12.000Z","size":50,"stargazers_count":132,"open_issues_count":6,"forks_count":5,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-01-29T08:24:12.075Z","etag":null,"topics":["lua","neovim","plugin","treesitter"],"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/ziontee113.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}},"created_at":"2022-10-13T04:26:55.000Z","updated_at":"2024-11-13T18:36:01.000Z","dependencies_parsed_at":"2024-01-14T15:21:52.090Z","dependency_job_id":"b98e3286-291e-44dc-8172-045d8a6dc329","html_url":"https://github.com/ziontee113/neo-minimap","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ziontee113%2Fneo-minimap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ziontee113%2Fneo-minimap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ziontee113%2Fneo-minimap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ziontee113%2Fneo-minimap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ziontee113","download_url":"https://codeload.github.com/ziontee113/neo-minimap/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243852432,"owners_count":20358268,"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":["lua","neovim","plugin","treesitter"],"created_at":"2024-08-02T13:01:37.553Z","updated_at":"2025-03-16T09:33:11.376Z","avatar_url":"https://github.com/ziontee113.png","language":"Lua","funding_links":[],"categories":["Lua"],"sub_categories":[],"readme":"## Neo-Minimap\n\nPlugin for Neovim that lets you create your own _\"minimap\"_ from _Treesitter Queries_ or _Vim Regex_.\n\nhttps://user-images.githubusercontent.com/102876811/195559738-2508d4b0-c33e-44ad-a617-fa785e1c7a57.mp4\n\n## Overview \u0026 Setup Guide\n\n[![neominimap](https://user-images.githubusercontent.com/102876811/196762594-8eadeef9-97e9-4c8c-94fb-d4071b698264.png)](https://youtu.be/vNyQBWfSh7c)\n\nYou can watch Overview \u0026 Setup Guide on [Youtube](https://youtu.be/vNyQBWfSh7c)\n\n## New Syntax\n\n```lua\n-- for shorthand usage\nlocal nm = require(\"neo-minimap\")\n\n-- will reload your neo-minimap config file on save\n-- works only when you have only 1 neo-minimap config file\nnm.source_on_save(\"/path/to/your/neo-minimap/config-file\") -- optional\n\nnm.set({\"keymap1\", \"keymap2\"}, { \"*.your_file_extension\", \"your_autocmd_pattern\" }, {\n     events = { \"BufEnter\" },\n\n     -- lua table, values inside can be type `string` or `number`\n     -- accepts multiple treesitter queries, corresponse to each keymap,\n     -- if you press \"keymap1\", minimap will start with first query,\n     -- if you press \"keymap2\", minimap will start with second query,\n     -- you can have empty query table option if you want to use regex only\n    query = {\n            [[\n        ;; query\n        ((function_declaration) @cap)\n        ((assignment_statement(expression_list((function_definition) @cap))))\n        ]], -- first query\n            [[\n        ;; query\n        ((function_declaration) @cap)\n        ((assignment_statement(expression_list((function_definition) @cap))))\n        ((for_statement) @cap)\n        ]], -- second query\n\n        1, -- if passed in a number, a query with that index will take it's place\n           -- in this case, instead of copying the entire first query,\n           -- we use `1` to point to it.\n    },\n\n    -- optional\n\tregex = { -- lua table, values inside can be type `table` or `number`\n\t\t{ [[--.*]], [[===.*===]] }, -- first set of regexes\n\t\t{}, -- no regex\n\t\t1, -- acts as first regex set\n\t},\n    -- you can have empty regex option if you want to use Treesitter queries only\n\n    -- optional\n    search_patterns = {\n\t\t{ \"vim_regex\", \"\u003cC-j\u003e\", true }, -- jump to the next instance of \"vim_regex\"\n\t\t{ \"vim_regex\", \"\u003cC-k\u003e\", false }, -- jump to the previous instance of \"vim_regex\"\n\t},\n\n    auto_jump = true, -- optional, defaults to `true`, auto jump when move cursor\n\n    -- other options\n    width = 44, -- optional, defaults to 44, width of the minimap\n    height = 12, -- optional, defaults to 12, height of the minimap\n    hl_group = \"my_hl_group\", -- highlight group of virtual text, optional, defaults to \"DiagnosticWarn\"\n\n    open_win_opts = {}, -- optional, for setting custom `nvim_open_win` options\n    win_opts = {}, -- optional, for setting custom `nvim_win_set_option` options\n\n    -- change minimap's height with \u003cC-h\u003e\n    -- this means default minimap height is 12\n    -- minimap height will change to 36 after pressing \u003cC-h\u003e\n    height_toggle = { 12, 36 },\n\n    disable_indentation = false, -- if `true`, will remove any white space / tab at the start of the results.\n\n    -- Replace the placeholder called {cursorword} with the word the cursor is current on\n    -- if `false` the keyword {cursorword} will not be replaced in query.\n    replace_cursorword_attribute = true,\n    -- replace the default highlights by default these values are linked\n\toverride_default_hl = {\n\t\tNeoMinimapCursorLine = { link = \"CursorLine\" },\n\t\tNeoMinimapBorder = { link = \"FloatBorder\" },\n\t\tNeoMinimapBackground = { link = \"Normal\" },\n\t\tNeoMinimapLineNr = { link = \"LineNr\" },\n\t},\n})\n```\n\n[Here's the config I use myself](https://github.com/ziontee113/ziontee113-neovim-config/blob/master/lua/plugins/neo-minimap/init.lua)\n\n## Minimap Specific Mappings\n\n- `a` - Toggle `auto_jump`\n- `c` - Toggle `conceallevel`\n- `q` / `Esc` - close the Minimap\n- `h` / `t` - toggle Treesitter highlighting for Minimap\n\n- `\u003cC-h\u003e` - toggle Minimap's height, depends on `height_toggle` option\n- `i` - **switch to previous query \u0026\u0026 set of regexes**\n- `o` - **switch to next query \u0026\u0026 set of regexes**\n\n- `\u003cC-s\u003e` - open Minimap in vertical split\n- `\u003cC-v\u003e` - open the result in vertical split\n\n- `l` - jump to location, (depends on `auto_jump`), if `true` doesn't close Minimap, if `false` do.\n- `Enter` - jump to location, closes Minimap.\n\n## The setup_default() function\n\nYou can call `nm.setup_default({opts})` to set up default options.\n\n```lua\nnm.setup_defaults({\n\theight_toggle = { 12, 36 },\n})\n```\n\n\u003cdetails\u003e\n\u003csummary\u003eOld Syntax\u003c/summary\u003e\n\n## Syntax\n\n```lua\nlocal nm = require(\"neo-minimap\")\n\nnm.set(\"keymap\", \"filetype\", { -- `:set filetype?` if you don't know your desired filetype\n\tquery = [[\n;; query\n((query_goes_here) @cap)\n  ]],\n\n    regex = {\n        \"vim_regex_goes_here\",\n        [[another_vim_regex]],\n    }, -- vim regex option, for when you can't or don't want to use Treesitter Queries\n\n\tsearch_patterns = { -- optional\n\t\t{ \"/search\", \"search_mapping\", true }, -- true means search forward\n\t\t{ \"/search\", \"search_mapping\", false }, -- false means search backwards\n\t},\n\twidth = 44, -- optional, defaults to 44, width of the minimap\n\theight = 12, -- optional, defaults to 12, height of the minimap\n\thl_group = \"my_hl_group\", -- optional, defaults to \"LineNr\"\n\tauto_jump = true, -- optional, defaults to `true`, auto jump when move cursor\n\n    open_win_opts = {}, -- optional, for setting `nvim_open_win` options\n    win_opts = {}, -- optional, for setting `nvim_win_set_option` options\n})\n```\n\n## Example\n\nExample for Lua:\n\n```lua\nlocal nm = require(\"neo-minimap\") -- for shorthand use later\n\n-- Lua\nnm.set({\"zi\", \"zo\"}, \"lua\", { -- press `zi` or `zo` to open the minimap, in `lua` files\n\tquery = [[\n;; query\n((for_statement) @cap) ;; matches for loops\n((function_call (dot_index_expression) @field (#eq? @field \"vim.keymap.set\")) @cap) ;; matches vim.keymap.set\n((function_declaration) @cap) ;; matches function declarations\n  ]], [[\n;; query example to find all function calls from the object that the cursor it at.\n;; replace_cursorword_attribute need to be enabled (default) to replace the word at the cursor with the placeholder {cursorword}.\n((function_declaration name: ((identifier) @name (#eq? @name \"{cursorword}\"))) @cap)\n((function_call name: ((identifier) @name (#eq? @name \"{cursorword}\"))) @cap)\n((dot_index_expression field: ((identifier) @name (#eq? @name \"{cursorword}\"))) @cap)\n((function_call name: (dot_index_expression table: (identifier) @name (#eq? @name \"{cursorword}\"))) @cap)\n  ]],\n\tregex = { [[\\.insert]] }, -- 1 vim regex, matches lines with `.insert` pattern\n\tsearch_patterns = {\n\t\t{ \"function\", \"\u003cC-j\u003e\", true }, -- jump to the next 'function' (Vim pattern)\n\t\t{ \"function\", \"\u003cC-k\u003e\", false }, -- jump to the previous 'function' (Vim pattern)\n\t\t{ \"keymap\", \"\u003cA-j\u003e\", true }, -- jump to the next 'keymap' (Vim pattern)\n\t\t{ \"keymap\", \"\u003cA-k\u003e\", false }, -- jump to the previous 'keymap' (Vim pattern)\n\t},\n})\n```\n\nExample for Typescript:\n\n```lua\nlocal nm = require(\"neo-minimap\") -- for shorthand use later\n\n-- TSX\nnm.set(\"zi\", \"typescriptreact\", {  -- press `zi` to open the minimap, in `typescriptreact` files\n\tquery = [[\n;; query\n((function_declaration) @cap) ;; matches function declarations\n((arrow_function) @cap) ;; matches arrow functions\n((identifier) @cap (#vim-match? @cap \"^use.*\")) ;; matches hooks (useState, useEffect, use***, etc...)\n  ]],\n})\n```\n\nhttps://user-images.githubusercontent.com/102876811/195559769-0373bc88-9cba-4731-a7d2-7ec5c461b569.mp4\n\n## Minimap Specific Mappings\n\n- `a` - Toggle `auto_jump`\n- `c` - Toggle `conceallevel`\n- `q` / `Esc` - close the Minimap\n- `h` / `t` - toggle Treesitter highlighting for Minimap\n\n- `l` - jump to location (for when `auto_jump` is `false`), doesn't close Minimap.\n- `Enter` - jump to location, closes Minimap.\n\n## The `.browse()` method\n\nYou can also use `nm.browse()` method if you want more control over how you define your keymaps.\n\nSyntax:\n\n```lua\nnm.browse(opts)\n```\n\nExample:\n\n```lua\nlocal nm = require(\"neo-minimap\")\n\nvim.keymap.set(\"n\", \"your_keymap\", function()\n    nm.browse({\n        query = [[\n    ;; query\n    ((for_statement) @cap)\n    ((function_declaration) @cap)\n      ]],\n        search_patterns = {\n            { \"function\", \"\u003cC-j\u003e\", true },\n            { \"function\", \"\u003cC-k\u003e\", false },\n        },\n        width = 44,\n        height = 12,\n    })\nend)\n```\n\n## Custom Events\n\nExample:\n\n```lua\nnm.set(\"zo\", \"*/snippets/*.lua\", { -- \"mapping\", \"pattern\"\n\tregex = { [[--.*\\w]] },\n\tevents = { \"BufEnter\" }, -- events\n})\n```\n\n\u003c/details\u003e\n\n## Available Highlight Groups\n\n| Highlight Group      | Purpose                                  |\n| -------------------- | ---------------------------------------- |\n| NeoMinimapLineNr     | highlights for the Line Number           |\n| NeoMinimapCursorLine | highlights the current line background   |\n| NeoMinimapBorder     | highlights the border for the window     |\n| NeoMinimapBackground | highlights the background for the window |\n\n## Feedback\n\nIf you run into issues or come up with an awesome idea, please feel free to open an issue or PR.\n\n## Credits\n\n- [@desdic](https://github.com/desdic) for PR [#14](https://github.com/ziontee113/neo-minimap/pull/14).\n- [@TheSafdarAwan](https://github.com/TheSafdarAwan) for PR [#22](https://github.com/ziontee113/neo-minimap/pull/22).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fziontee113%2Fneo-minimap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fziontee113%2Fneo-minimap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fziontee113%2Fneo-minimap/lists"}