Skip to content

Latest commit

 

History

History
128 lines (91 loc) · 3.21 KB

README.md

File metadata and controls

128 lines (91 loc) · 3.21 KB

dev-comments.nvim

List and search for dev comments using tree-sitter-comment parser

Features

  • Performant searching
  • Highly configurable
  • Sensible defaults (can be disabled)
  • Telescope integration
  • Filter dev comments by tags i.e. <TAG>: and/or users i.e. <TAG>(<user>):
  • Cycle through dev comments in a buffer
  • All core functionality has unit tests

Requirements

Core

  • Neovim >= 0.8.0

Optional

OR

Highly recommended if you use the all file mode

Installation

Install the plugin with your preferred plugin manager

Plug 'ram02z/dev-comments.nvim'
Plug 'nvim-treesitter/nvim-treesitter'
Plug 'nvim-telescope/telescope.nvim' " optional for picker

lua << EOF
require("dev_comments").setup({
  -- configuration
  -- leave empty for defaults
})
EOF
use({
  "ram02z/dev-comments.nvim",
  requires = {
    "nvim-treesitter/nvim-treesitter",
    "nvim-telescope/nvim-telescope", -- optional
  },
  config = function()
      require("dev_comments").setup({
      -- configuration
      -- leave empty for defaults
    })
  end
})

Ensure you have the tree-sitter-comment parser installed in Neovim

Run :TSInstall comment<CR>

Configuration

All features are enabled by default.

See the help doc or run :help dev-comments-configuration<CR> in Neovim

Usage

The file modes:

  • all: searches in all files based on value of cwd
  • open: searches only open files
    • Only filters based on cwd if provided
  • buffer: searches only the open buffer
    • Ignores the value of cwd

The main options are:

  • cwd: filters the search by working directory
    • Default: value of vim.loop.cwd()
    • Uses vim.fs.normalize() to expand variables i.e. ~ -> /root/home/
  • find: finds files/directories upwards of the working directory
    • Default: empty table
    • Use comma separated strings if you using the commands, i.e. find=.git
    • Sets the first found file/directory to new search directory
    • If no matching file/directory found, uses cwd
  • tags: filters the search by tags i.e. <TAG>:
    • Default: all tags
    • Use comma separated strings if you using the commands, i.e. tags=TODO
  • users : filters the search by user i.e. <TAG>(<USER>):
    • Default: all users
    • Use comma separated strings if you using the commands, i.e. users=ram02z,foo

Telescope

Either set the telescope.load to true in the configuration or load the extension manually

require("telescope").load_extension("dev_comments")

The three file modes all, current and open are available by running :Telescope dev_comments <file-mode><CR>

For more information, run :help dev-comments-telescope<CR>

Cycle

The cycle feature only works in the current open buffer

Commands

Run :help dev-comments-default-commands<CR> in Neovim

Keymaps

Run :help dev-comments-default-keymaps<CR> in Neovim

License

MIT