diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e1fd9f..85e4e36 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.3.0] - 2022-10-19 +### Added +- Add option to search for word under cursor + ## [0.2.0] - 2022-10-19 ### Added - Attach `nix` highlighter to previewer diff --git a/README.md b/README.md index 8e8f2ac..3eb7a24 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,22 @@ A [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim) extension for [Manix](https://github.com/mlvzk/manix) > A fast documentation searcher for [Nix](https://nixos.wiki/wiki/Overview_of_the_Nix_Language) +## Quick links +- [Features](#features) +- [Prerequisites](#prerequisites) +- [Installation](#installation) +- [Configuration](#configuration) +- [Usage](#usage) +- [Customisation](#customisation) + +## Features + +#### Nix fuzzy search [![asciicast](https://asciinema.org/a/t1rHXoElZtqW9lIhOamNG2xgu.svg)](https://asciinema.org/a/t1rHXoElZtqW9lIhOamNG2xgu) +#### Search for the word under the cursor +[![asciicast](https://asciinema.org/a/6FyS0Bkp7bqSYLvY4OwvxzOF7.svg)](https://asciinema.org/a/6FyS0Bkp7bqSYLvY4OwvxzOF7) + ## Prerequisites * Depends on [Manix](https://github.com/mlvzk/manix). @@ -47,10 +61,6 @@ telescope.load_extension('manix') ```lua require('telescope-manix').search() - --- or - -require('telescope').extensions.manix.search() ``` ## Customisation @@ -59,6 +69,8 @@ require('telescope').extensions.manix.search() default_opts = { -- CLI arguments to pass to manix, see `manix --help` manix_args = {}, + -- Set to true to search for the word under the cursor + cword = false, } require('telescope-manix').search(default_opts) ``` diff --git a/lua/telescope-manix/init.lua b/lua/telescope-manix/init.lua index b5f5578..642cd06 100644 --- a/lua/telescope-manix/init.lua +++ b/lua/telescope-manix/init.lua @@ -17,8 +17,9 @@ end local M = {} local function mk_manix_cmd(opts) + local search_arg = opts.cword and vim.fn.expand "" or "" local args = opts.manix_args or {} - return vim.tbl_flatten { 'manix', "", args, } + return vim.tbl_flatten { 'manix', search_arg, args, } end local function merge(...)