{"id":13898574,"url":"https://github.com/hrsh7th/vim-candle","last_synced_at":"2025-05-05T15:54:35.242Z","repository":{"id":40290395,"uuid":"233357009","full_name":"hrsh7th/vim-candle","owner":"hrsh7th","description":"Candidates listing engine for vim/nvim built on yaegi on golang.","archived":false,"fork":false,"pushed_at":"2023-03-15T01:20:37.000Z","size":378,"stargazers_count":12,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-19T10:27:35.715Z","etag":null,"topics":["vim","vim-plugin"],"latest_commit_sha":null,"homepage":"","language":"Vim Script","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hrsh7th.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-01-12T07:50:58.000Z","updated_at":"2024-07-01T07:36:11.000Z","dependencies_parsed_at":"2024-06-19T06:15:58.068Z","dependency_job_id":"e7eb6285-dfa8-4a69-8e39-3f4f4cafcac8","html_url":"https://github.com/hrsh7th/vim-candle","commit_stats":{"total_commits":167,"total_committers":4,"mean_commits":41.75,"dds":"0.10778443113772451","last_synced_commit":"cb3337218103daf47b59eb6f07a106469af731db"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hrsh7th%2Fvim-candle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hrsh7th%2Fvim-candle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hrsh7th%2Fvim-candle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hrsh7th%2Fvim-candle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hrsh7th","download_url":"https://codeload.github.com/hrsh7th/vim-candle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252527647,"owners_count":21762738,"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","vim-plugin"],"created_at":"2024-08-06T18:04:21.382Z","updated_at":"2025-05-05T15:54:35.201Z","avatar_url":"https://github.com/hrsh7th.png","language":"Vim Script","funding_links":[],"categories":["Vim Script"],"sub_categories":[],"readme":"vim-candle\n===\n\nAny candidates listing engine for vim/nvim built on [yaegi](https://github.com/containous/yaegi).\n\n\nStatus\n===\n\n- Works\n- Not documented\n- APIs aren't stable\n- Tested only in mac\n\n\nRequirements\n===\n\n- vim\n  - exists('*win_exeute')\n\n- nvim\n  - exists('deletebufline')\n\n\nConcept\n===\n\n### Performance\n- filtering written in golang.\n- virtual scroll.\n\n### Works on vim/neovim\n- use `job` API only.\n\n### Use function\n- because the commands can't pass complex object.\n\n\nSetting\n===\n\n```viml\naugroup vimrc\n autocmd!\naugroup END\n\n\"\n\" global mapping\n\"\nnnoremap \u003csilent\u003e \u003cLeader\u003ek :\u003cC-u\u003ecall candle#mapping#toggle()\u003cCR\u003e\nnnoremap \u003csilent\u003e \u003cLeader\u003en :\u003cC-u\u003ecall candle#mapping#action_next('default')\u003cCR\u003e\nnnoremap \u003csilent\u003e \u003cLeader\u003ep :\u003cC-u\u003ecall candle#mapping#action_prev('default')\u003cCR\u003e\n\n\"\n\" mapping for candle buffer\n\"\nautocmd vimrc User candle#start call s:on_candle_start()\nfunction! s:on_candle_start()\n  nnoremap \u003csilent\u003e\u003cbuffer\u003e k     :\u003cC-u\u003ecall candle#mapping#cursor_move(-1)\u003cCR\u003e\n  nnoremap \u003csilent\u003e\u003cbuffer\u003e j     :\u003cC-u\u003ecall candle#mapping#cursor_move(1)\u003cCR\u003e\n  nnoremap \u003csilent\u003e\u003cbuffer\u003e K     :\u003cC-u\u003ecall candle#mapping#cursor_move(-10)\u003cCR\u003e\n  nnoremap \u003csilent\u003e\u003cbuffer\u003e J     :\u003cC-u\u003ecall candle#mapping#cursor_move(10)\u003cCR\u003e\n  nnoremap \u003csilent\u003e\u003cbuffer\u003e gg    :\u003cC-u\u003ecall candle#mapping#cursor_top()\u003cCR\u003e\n  nnoremap \u003csilent\u003e\u003cbuffer\u003e G     :\u003cC-u\u003ecall candle#mapping#cursor_bottom()\u003cCR\u003e\n  nnoremap \u003csilent\u003e\u003cbuffer\u003e -     :\u003cC-u\u003ecall candle#mapping#toggle_select()\u003cCR\u003e\n  nnoremap \u003csilent\u003e\u003cbuffer\u003e *     :\u003cC-u\u003ecall candle#mapping#toggle_select_all()\u003cCR\u003e\n  nnoremap \u003csilent\u003e\u003cbuffer\u003e i     :\u003cC-u\u003ecall candle#mapping#input_open()\u003cCR\u003e\n  nnoremap \u003csilent\u003e\u003cbuffer\u003e a     :\u003cC-u\u003ecall candle#mapping#input_open()\u003cCR\u003e\n  nnoremap \u003csilent\u003e\u003cbuffer\u003e \u003cTab\u003e :\u003cC-u\u003ecall candle#mapping#choose_action()\u003cCR\u003e\n  nnoremap \u003csilent\u003e\u003cbuffer\u003e \u003cC-l\u003e :\u003cC-u\u003ecall candle#mapping#restart()\u003cCR\u003e\n\n  nnoremap \u003csilent\u003e\u003cbuffer\u003e \u003cCR\u003e  :\u003cC-u\u003ecall candle#mapping#action('default')\u003cCR\u003e\n  nnoremap \u003csilent\u003e\u003cbuffer\u003e s     :\u003cC-u\u003ecall candle#mapping#action('split')\u003cCR\u003e\n  nnoremap \u003csilent\u003e\u003cbuffer\u003e v     :\u003cC-u\u003ecall candle#mapping#action('vsplit')\u003cCR\u003e\n  nnoremap \u003csilent\u003e\u003cbuffer\u003e d     :\u003cC-u\u003ecall candle#mapping#action('delete')\u003cCR\u003e\nendfunction\n\n\"\n\" mapping for candle.input buffer\n\"\nautocmd vimrc User candle#input#start call s:on_candle_input_start()\nfunction! s:on_candle_input_start()\n  cnoremap \u003csilent\u003e\u003cbuffer\u003e \u003cTab\u003e \u003cEsc\u003e:\u003cC-u\u003ecall candle#mapping#choose_action()\u003cCR\u003e\n  cnoremap \u003csilent\u003e\u003cbuffer\u003e \u003cC-y\u003e \u003cEsc\u003e:\u003cC-u\u003ecall candle#mapping#action('default')\u003cCR\u003e\n  cnoremap \u003csilent\u003e\u003cbuffer\u003e \u003cC-p\u003e \u003cEsc\u003e:\u003cC-u\u003ecall candle#mapping#cursor_move(-1) \\| call candle#mapping#input_open()\u003cCR\u003e\n  cnoremap \u003csilent\u003e\u003cbuffer\u003e \u003cC-n\u003e \u003cEsc\u003e:\u003cC-u\u003ecall candle#mapping#cursor_move(+1) \\| call candle#mapping#input_open()\u003cCR\u003e\nendfunction\n\n```\n\n# Recipes\n\n### mru files\n\nRecently opened files (and exclude displayed files).\n\n```viml\nnnoremap \u003csilent\u003emru_file :\u003cC-u\u003ecall candle#start({\n\\   'mru_file': {\n\\     'ignore_patterns': map(range(1, tabpagewinnr(tabpagenr(), '$')), { i, winnr -\u003e\n\\       fnamemodify(bufname(winbufnr(winnr)), ':p')\n\\     })\n\\   }\n\\ })\u003cCR\u003e\n```\n\n\n### mru projects\n\nRecently projects (When choose one project, listing all files).\n\n```viml\n  nnoremap \u003csilent\u003e\u003cLeader\u003emru_project :\u003cC-u\u003ecall candle#start({\n  \\   'mru_dir': {},\n  \\ }, {\n  \\   'action': {\n  \\     'default': { candle -\u003e [\n  \\       execute('quit'),\n  \\       win_gotoid(candle.prev_winid),\n  \\       candle#start({\n  \\         'source': 'file',\n  \\         'params': {\n  \\           'root_path': candle.get_action_items()[0].path,\n  \\           'ignore_patterns': ['.git/', 'node_modules'],\n  \\         }\n  \\       })\n  \\     ] }\n  \\   }\n  \\ })\u003cCR\u003e\n```\n\n\n### files\n\nAll files under specified root.\n\n```viml\nnnoremap \u003csilent\u003efile :\u003cC-u\u003ecall candle#start({\n\\   'file': {\n\\     'root_path': 'path to root dir',\n\\     'ignore_patterns': ['.git/', 'node_modules'],\n\\   }\n\\ })\u003cCR\u003e\n```\n\n\n### grep\n\nInvoke ripgrep/ag/pt/jvgrep/grep.\n\nYou can specify your custom grep command.\n\n```viml\nnnoremap \u003csilent\u003egrep :\u003cC-u\u003ecall candle#start({\n\\   'grep': {\n\\     'root_path': 'path to root dir',\n\\     'pattern': input('PATTERN: '),\n\\     'command': [\n\\       'rg',\n\\       '-i',\n\\       '--vimgrep',\n\\       '--no-heading',\n\\       '--no-column',\n\\     ] + map([\n\\       '.git',\n\\       '.svn',\n\\       'image/',\n\\       'vendor/',\n\\       'node_modules/',\n\\     ], { _, v -\u003e printf('--glob=!%s', v) }) + [\n\\       '-e',\n\\       '%PATTERN%',\n\\       '%ROOT_PATH%',\n\\     ]\n\\   }\n\\ })\u003cCR\u003e\n```\n\n### grep + [vim-qfreplace](https://github.com/thinca/vim-qfreplace)\n\nModify grep results with qfreplace.\n\n```viml\n\nfunction! s:qfreplace_accept(candle) abort\n  return len(filter(a:candle.get_action_items()), { _, item -\u003e\n  \\   !has_key(item, 'path') || !has_key(item, 'lnum') || !has_key(item, 'text')\n  \\ }) == 0\nendfunction\n\nfunction! s:qfreplace_invoke(candle) abort\n  call setqflist(map(a:candle.get_action_items(), { _, item -\u003e {\n  \\   'filename': item.path,\n  \\   'lnum': item.lnum,\n  \\   'text': item.text\n  \\ } }))\n  call qfreplace#start('')\nendfunction\n\ncall candle#action#register({\n\\   'name': 'qfreplace',\n\\   'accept': function('s:qfreplace_accept'),\n\\   'invoke': function('s:qfreplace_invoke'),\n\\ })\n```\n\n### menus\n\nYour custom menu.\n\n```viml\nnnoremap \u003csilent\u003emenu :\u003cC-u\u003ecall candle#start({\n\\   'item': [{\n\\     'id': 1,\n\\     'title': 'PlugUpdate',\n\\     'execute': 'PlugUpdate'\n\\   }, {\n\\     'id': 2,\n\\     'title': 'Open .vimrc',\n\\     'execute': 'vsplit $MYVIMRC'\n\\   }]\n\\ }, {\n\\   'action': {\n\\     'default': { candle -\u003e execute(candle.get_cursor_item().execute) }\n\\   }\n\\ })\u003cCR\u003e\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhrsh7th%2Fvim-candle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhrsh7th%2Fvim-candle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhrsh7th%2Fvim-candle/lists"}