Clap Providers

Builtin Providers

Additional requirement means the potential extra tool needed for the particular provider besides the Rust binary maple.

CommandListAdditional Requirement
Clap blinesLines in the current buffernone
Clap buffersOpen buffersnone
Clap colorsColorschemesnone
Clap commandCommandnone
Clap hist: or Clap command_historyCommand historynone
Clap hist/ or Clap search_historySearch historynone
Clap filetypesFile typesnone
Clap help_tagsHelp tagsnone
Clap jumpsJumpsnone
Clap linesLines in the loaded buffersnone
Clap marksMarksnone
Clap mapsMapsnone
Clap quickfixEntries of the quickfix listnone
Clap loclistEntries of the location listnone
Clap registersRegistersnone
Clap yanksYank stack of the current vim sessionnone
Clap historyOpen buffers and v:oldfilesnone
Clap windowsWindowsnone
Clap providersList the vim-clap providersnone
Clap bcommitsGit commits for the current buffergit
Clap commitsGit commitsgit
Clap gfiles or Clap git_filesFiles managed by gitgit
Clap git_diff_filesFiles managed by git and having uncommitted changesgit
Clap live_grep (deprecated)Grep using word-regexp matcherrg
Clap dumb_jumpDefinitions/References using regexp with grep fallbackrg with --pcre2
Clap filesFilesnone
Clap filerIvy-like file explorernone
Clap grep+Grep using fuzzy matchernone
Clap igrepA combo of filer and grepnone
Clap tagsTags in the current buffernone
Clap tagfilesSearch existing tagfilesnone
Clap proj_tagsTags in the current projectuniversal-ctags (+json)
Clap recent_filesPersistent ordered history of recent filesnone
  • The command with a superscript + means that it supports multi-selection via Tab.
  • Clap live_grep is deprecated now, Clap grep is recommended as the successor.
  • :Clap grep
    • Use :Clap grep --query=<cword> to grep the word under cursor.
    • Use :Clap grep --query=@visual to grep the visual selection.
    • cwd will be searched by default, specify the extra paths in the end to search multiple directories.
      • :Clap grep --path ~/.vim/plugged/ale with cwd is ~/.vim/plugged/vim-clap will both search vim-clap and ale.

Send a pull request if certain provider is not listed here.

Global Variables

  • g:clap_layout: Dict, { 'width': '67%', 'height': '33%', 'row': '33%', 'col': '17%' } by default. This variable controls the size and position of vim-clap window. By default, the vim-clap window is placed relative to the currently active window. To make it relative to the whole editor modify this variable as shown below:

    let g:clap_layout = { 'relative': 'editor' }
    
  • g:clap_open_action: Dict, { 'ctrl-t': 'tab split', 'ctrl-x': 'split', 'ctrl-v': 'vsplit' }, extra key bindings for opening the selected file in a different way. NOTE: do not define a key binding which is conflicted with the other default bindings of vim-clap, and only ctrl-* is supported for now.

  • g:clap_provider_alias: Dict, if you don't want to invoke some clap provider by its id(name), as it's too long or somehow, you can add an alias for that provider.

    " The provider name is `command_history`, with the following alias config,
    " now you can call it via both `:Clap command_history` and `:Clap hist:`.
    let g:clap_provider_alias = {'hist:': 'command_history'}
    
  • g:clap_selected_sign: Dict, { 'text': ' >', 'texthl': "ClapSelectedSign", "linehl": "ClapSelected"}.

  • g:clap_current_selection_sign: Dict, { 'text': '>>', 'texthl': "ClapCurrentSelectionSign", "linehl": "ClapCurrentSelection"}.

  • g:clap_no_matches_msg: String, 'NO MATCHES FOUND', message to show when there is no matches found.

  • g:clap_popup_input_delay: Number, 200ms by default, delay for actually responding to the input, vim only.

  • g:clap_disable_run_rooter: Bool, v:false, vim-clap by default will try to run from the project root by changing cwd temporarily. Set it to v:true to run from the origin cwd. The project root here means the git base directory. Create an issue if you want to see more support about the project root.

The option naming convention for provider is g:clap_provider_{provider_id}_{opt}.

  • g:clap_provider_grep_blink: [2, 100] by default, blink 2 times with 100ms timeout when jumping the result. Set it to [0, 0] to disable the blink.

  • g:clap_provider_grep_opts: An empty string by default, allows you to enable flags such as '--hidden -g "!.git/"'.

See :help clap-options for more information.

How to Create Your Own Provider

" `:Clap quick_open` to open some dotfiles quickly.
" `description` is actually optional, but if you want to show this provider
" when you call `:Clap`, the `description` is necessary.
let g:clap_provider_quick_open = {
      \ 'source': ['~/.vimrc', '~/.spacevim', '~/.bashrc', '~/.tmux.conf'],
      \ 'sink': 'e',
      \ 'description': 'Quick open some dotfiles',
      \ }

Find more examples at wiki/Examples.

For complete guide about writing a clap provider please see PROVIDER.md.

Disable Auto-Completion Plugin in Clap Input Window

Some of the auto-completion engines need to turn off to prevent bizarre behaviors(#580)

For nvim-completion, add autocmd to your init.vim:

autocmd FileType clap_input let g:completion_enable_auto_pop = 0

For nvim-compe:

autocmd FileType clap_input call compe#setup({ 'enabled': v:false }, 0)

Configuration

Project-specific ignore config

Ignore the results from the certain files/folders.

[provider.project-ignores."~/src/github.com/bitcoin/bitcoin"]
ignore-file-path-pattern = ["test"]
ignore-file-name-pattern = ["test"]