Documentation for skipping indexing of bigger files misleading

Open Beginner friendly
#65 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
72/100
Issue type
Documentation
Clarity
Clearly specified
Activity status
Stale
Tech stack
lua
Domain
documentation

Research direction

Start with README.md lines 215-223 and compare the documented snippet with the proposed buffer-filtering example in the issue. Update the documentation so it clearly describes skipping oversized buffers without implying that other buffers are excluded; the README should reflect the intended behavior.

Written by the indexing model from the issue text.

Description

Hi!

This part of the readme suggest to use the snippet to skip indexing of big buffers. Unfortunately, this also means that only the current buffer is indexed (if small enough) and no other buffer at all. This was surprising to me (although completely my fault for not carefully reading through this snippet and only testing it in a limited context).

How about we change the snippet to something like this instead?

        get_bufnrs = function()
          local is_small_buf = function(index, buf)
            local byte_size = vim.api.nvim_buf_get_offset(buf, vim.api.nvim_buf_line_count(buf))
            return byte_size <= 1024*1024 -- 1 Megabyte max
          end

          local all_bufs = vim.api.nvim_list_bufs()
          return vim.fn.filter(all_bufs, is_small_buf)
        end

Thank you for this great plugin!

Dominant language
Lua
Stars
672
Forks
47
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from hrsh7th/cmp-buffer

All issues in hrsh7th/cmp-buffer

Similar issues

More Lua issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.