nvim-telescope / telescope.nvim

Find, Filter, Preview, Pick. All lua, all the time.
MIT License
15.42k stars 823 forks source link

telescope.utils.buffer_dir is not documented #2425

Open jasoncavanaugh opened 1 year ago

jasoncavanaugh commented 1 year ago

Description

:h telescope.utils doesn't provide any documentation for telescope.utils.buffer_dir despite this function being referenced in other parts of the docs.

Neovim version

NVIM v0.8.0-dev
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3

Operating system and version

Ubuntu 22.04.1 LTS

Telescope version / branch / rev

telescope 0.1.1

checkhealth telescope

telescope: require("telescope.health").check()
========================================================================
## Checking for required plugins
  - OK: plenary installed.
  - OK: nvim-treesitter installed.

## Checking external dependencies
  - OK: rg: found ripgrep 13.0.0
  - WARNING: fd: not found. Install [sharkdp/fd](https://github.com/sharkdp/fd) for extended capabilities

## ===== Installed extensions =====

## Telescope Extension: `fzf`
  - OK: lib working as expected
  - OK: file_sorter correctly configured
  - OK: generic_sorter correctly configured

Steps to reproduce

  1. Type :h telescope.builtin.find_files() or :h telescope.builtin.grep_string() or :h telescope.builtin.tags()
  2. Notice that the {cwd} option mentions using utils.buffer_dir() to change the cwd to the directory of the current buffer
  3. Type :h telescope.utils
  4. Notice that there is no entry for telescope.utils.buffer_dir

Expected behavior

There should be an entry in :h telescope.utils for telescope.utils.buffer_dir

Actual behavior

There is no entry for telescope.utils.buffer_dir

Minimal config

local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system {
    "git",
    "clone",
    "--filter=blob:none",
    "https://github.com/folke/lazy.nvim.git",
    "--branch=stable", -- latest stable release
    lazypath,
  }
end
vim.opt.rtp:prepend(lazypath)
require("lazy").setup({
  "tpope/vim-fugitive",
  "tpope/vim-rhubarb",
  "tpope/vim-sleuth",
  { "nvim-telescope/telescope.nvim", version = "*", dependencies = { "nvim-lua/plenary.nvim" } },
  {
    "nvim-telescope/telescope-fzf-native.nvim",
    -- NOTE: If you are having trouble with this installation,
    --       refer to the README for telescope-fzf-native for more instructions.
    build = "make",
    cond = function()
      return vim.fn.executable "make" == 1
    end,
  },
  {
    "nvim-treesitter/nvim-treesitter",
    dependencies = {
      "nvim-treesitter/nvim-treesitter-textobjects",
    },
    config = function()
      pcall(require("nvim-treesitter.install").update { with_sync = true })
    end,
  },
}, {})
fdschmidt93 commented 1 year ago

PR is welcome, though the question is whether that requires all too much documentation, since it's practically speaking an alias for builtin (neo)vim functionality.

utils.buffer_dir = vim.fn.expand "%:p:h"

See :h expand