Query Dash.app within Neovim with a Telescope picker!
Note: Dash is a Mac-only app, so you'll only find this plugin useful on Mac.
This plugin has two editor commands, :Dash and :DashWord, each of which accept a bang (!). By default, it will
search Dash.app with keywords based on config (see file_type_keywords in configuration). The bang (!)
will search without this keyword filtering.
:Dash [query] will open the Telescope picker, and if [query] is passed, it will pre-fill the prompt with [query].
:DashWord will open the Telescope picker and pre-fill the prompt with the word under the cursor.
The public API consists of two main functions.
-- See lua/dash/utils/config.lua for full DashConfig type definition
-- Also described in configuration section below
---@param config DashConfig
require('dash').setup(config)---@param bang boolean @bang searches without any filtering
---@param initial_text string @pre-fill text into the telescope picker
require('dash').search(bang, initial_text)Using Packer:
use({ 'mrjones2014/dash.nvim', requires = { 'nvim-telescope/telescope.nvim' } })dash.nvim can be configured in your Telescope config. Options and defaults are described below:
require('telescope').setup({
extensions = {
dash = {
-- configure path to Dash.app if installed somewhere other than /Applications/Dash.app
dash_app_path = '/Applications/Dash.app',
-- debounce while typing, in milliseconds, defaults to 750 (0.75 seconds)
debounce = 750,
-- map filetype strings to the keywords you've configured for docsets in Dash
-- setting to false will disable filtering by filetype for that filetype
-- filetypes not included in this table will not filter the query by filetype
-- check lua/dash/utils/config.lua to see all defaults
-- the values you pass for file_type_keywords are merged with the defaults
-- to disable filtering for all filetypes,
-- set file_type_keywords = false
file_type_keywords = {
dashboard = false,
NvimTree = false,
TelescopePrompt = false,
terminal = false,
packer = false,
-- a table of strings will search on multiple keywords
javascript = { 'javascript', 'nodejs' },
typescript = { 'typescript', 'javascript', 'nodejs' },
typescriptreact = { 'typescript', 'javascript', 'react' },
javascriptreact = { 'javascript', 'react' },
-- you can also do a string, for example,
-- bash = 'sh'
},
}
}
})If you notice an issue with the default file_type_keywords or would like a new filetype added, please file an issue or submit a PR!
If you'd like to use the Rust backend directly to build something else, see BACKEND.md.
If you plan on changing Rust code, you will need to install the git hooks via make install-hooks.
The git hooks require you have a Rust toolchain installed. You can install a Rust toolchain from
rustup.rs.
This uses busted, luassert (both through
plenary.nvim) and matcher_combinators to
define tests in spec/ directory. These dependencies are required only to run
tests, that's why they are installed as git submodules.
To run tests, run make test. This runs tests in Neovim with a minimal profile,
spec.vim. This runs Neovim with only this plugin, and the testing dependencies.
If you have entr(1) installed, you can run the tests in watch mode
using make watch.
Use snake_case for everything. Ensure you use EmmyLua Annotations
for any public-facing API, and optionally for non-public functions, if the function is non-trivial or the types are not obvious.
Other than that, running luacheck and stylua should cover it.
