Home

Awesome

howdoi.nvim

A telescope.nvim extension for previewing howdoi results in neovim.

preview

Dependencies

Setup

Install using your favorite plugin manager:

packer.nvim:

use 'zane-/howdoi.nvim'

Load the extension in telescope:

require('telescope').load_extension('howdoi')

Default config:

-- How many answers to return in the response.
num_answers = 3,
-- The binary to execute the howdoi command with.
command_executor = { 'bash', '-c' },
-- The command to pipe the results into for paging.
pager_command = 'less -RS',

To change these, use telescope's setup function:

require('telescope').setup({
  extensions = {
    howdoi = {
      num_answers = 5,
    },
  },
})

To apply a theme to howdoi, you can pass a merged table like so:

require('telescope').setup({
  extensions = {
    howdoi = vim.tbl_deep_extend(
      'force',
      { num_answers = 1 },
      require('telescope.themes').get_dropdown())
})

Note that the option command_executor needs to be a binary that can run a command on your system. If you don't have bash installed, you will need to change this. Likewise, if you don't have less installed, you will need to specify the option pager_command.

Usage

Queries are saved until you quit nvim.

Mappings

MappingAction
Ctrl + dScroll the results down
Ctrl + uScroll the results up
Ctrl + yYank the results to the clipboard
Ctrl + pPastes the results into the current buffer
Ctrl + vPastes the results into a new vertical split
Ctrl + xPastes the results into a new horizontal split
Ctrl + rRemoves the selected query from the list