Code Monkey home page Code Monkey logo

telescope-repo.nvim's Introduction

šŸ¦˜ telescope-repo.nvim: jump around the repositories in your filesystem, without any setup

Neovim version GitHub tag (latest SemVer) Endpoint Badge

telescope-repo is an extension for telescope.nvim that searches the filesystem for git (or other SCM1, like Pijul, Mercurialā€¦) repositories. It does not require any setup: the list of repositories is built on the fly over your whole $HOME, you donā€™t need to manually add projects or open some folders to populate this list, as opposed to telescope-project.nvim or project.nvim.

Finding the repositories with ā€œtelescopeā€ in their name, with the README in the panel on the top

Use cases include:

  • If you donā€™t start vim from the shell (from a GUI or as the start command of a terminal), you are most likely in your $HOME directory. You then want to jump into your code as quickly as possible and this plugin can help!
  • Sometimes, you have the definition of a function and use of it in different repositories (e.g. a library you wrote and a program using this library). This plugin helps to open the two, for instance in two splits.
  • Use of less popular SCMs: some similar extensions rely on strong conventions to find repositories, like ā€œdirectories containing a .git file that is also a directory, all inside directory Xā€. Less popular SCMs like Pijul have a different folder name, and even git worktrees donā€™t fit neatly into these constraint, with their .git files.

telescope-repo.nvim is based on telescope-ghq.nvim

Installation

You need to add these in your plugin management system2:

'nvim-lua/plenary.nvim'
'nvim-telescope/telescope.nvim'
'cljoly/telescope-repo.nvim'

And optionally, to load the extension:

require'telescope'.load_extension'repo'

A handy companion plugin is vim-rooter, as itā€™ll change the current directory according to the current fileā€™s detected project (often, the root of the git repository). To get it to change each bufferā€™s directory, instead of the whole editor by default, add the following Lua to your configuration:

g['rooter_cd_cmd'] = 'lcd'

Packer

For instance, with Packer.nvim:

use 'cljoly/telescope-repo.nvim'
use {
  'nvim-telescope/telescope.nvim',
  requires = { {'nvim-lua/plenary.nvim'} }
}

External Dependencies

Required

  • fd to find the repositories on the filesystem with list
  • plocate, lolcate-rs or locate to find the repositories on the filesystem with cached_list

Optional

  • glow to preview markdown files, will fall back to bat if not present (and uses cat if neither are present)

Usage

Global Configuration

You can change the default argument given to subcommands (like list or cached_list) using the telescope setup function with a table like this:

{
  extensions = {
    repo = {
      <subcommand> = {
        <argument> = {
          "new",
          "default",
          "value",
        },
      },
      settings = {
        auto_lcd = true,
      }
    },
  },
}

for instance, you could do:

require("telescope").setup {
  extensions = {
    repo = {
      list = {
        fd_opts = {
          "--no-ignore-vcs",
        },
        search_dirs = {
          "~/my_projects",
        },
      },
    },
  },
}

require("telescope").load_extension "repo"

Note: make sure to have require("telescope").load_extension "repo" after the call to require("telescope").setup {ā€¦}, otherwise the global configuration wonā€™t be taken into account.

list

:Telescope repo list or lua require'telescope'.extensions.repo.list{}

Running repo list and list repositories' paths.

key action
<CR> (edit) builtin.git_files for git, falls back to builtin.find_files for other SCMs
<C-v> (vertical) builtin.live_grep in the selected project
<C-t> (tab) Same as <CR> but opens a new tab. Also, does a cd into the projectā€™s directory for this tab only

Options

bin

Filepath for the binary fd.

" path can be expanded
:Telescope repo list bin=~/fd
pattern

Pattern of the SCM database folder.

Default value: [[^\.git$]]

cwd

Transform the result paths into relative ones with this value as the base dir.

Default value: vim.fn.getcwd()

fd_opts

This is a relatively advanced option that you should use with caution. There is no guarantee that a particular set of options would work the same across multiple versions

This passes additional options to the command fd that generates the repository list. It is inserted like so:

fd [set of default options] [fd_opts] --exec [some default command] [pattern] ā€¦
Example

Letā€™s say you have a git repository S inside another git repository M (for instance because of #5), but S is in a directory thatā€™s ignored in the .gitignore in M. S wouldnā€™t appear in the Telescope list of this extension by default, because it is ignored (.gitignore are taken into account by default).

To avoid taking into account the .gitignore, we need to pass --no-ignore-vcs to fd, like so (in NeoVim):

:lua require'telescope'.extensions.repo.list{fd_opts={'--no-ignore-vcs'}}

This will list M and S in the Telescope output! The downside is that listing repositories will be a little longer, as we donā€™t skip the git-ignored files anymore.

search_dirs

This limits the search to a particular directory or set of directories.

Example
:lua require'telescope'.extensions.repo.list{search_dirs = {"~/ghq/github.com", "~/ghq/git.sr.ht"}}
:lua require'telescope'.extensions.repo.list{search_dirs = {"~/.local/share/nvim/site/pack"}}
tail_path

Show only basename of the path.

Default value: false

shorten_path

Call pathshorten() for each path. This will for instance transform /home/me/code/project to /h/m/c/project.

Default value: false

Examples

Here is how you can use this plugin with various SCM:

SCM Command
git :Telescope repo list or lua require'telescope'.extensions.repo.list{}
pijul lua require'telescope'.extensions.repo.list{pattern=[[^\.pijul$]]}
hg lua require'telescope'.extensions.repo.list{pattern=[[^\.hg$]]}
fossil lua require'telescope'.extensions.repo.list{pattern=[[^\.fslckout$]]}

Is your favorite SCM missing? It should be straightforward to support it by changing the pattern parameter. If you want it to be considered for addition here, open a PR!

cached_list

:Telescope repo cached_list

This relies on a locate command to find repositories. This should be much faster than the list command, as it relies on a pre-built index but results may be stalled.

Note: at this point, the plugin does not manage index update. Updating the index often requires to run a command like updatedb as root.

Notes for MacOS

glocate command used for caching on MacOS comes with gnu findutils which can be installed with

brew install findutils

With glocate installed use, add the following to your .bashrc/.zshrc

# https://egeek.me/2020/04/18/enabling-locate-on-osx/
if which glocate > /dev/null; then
  alias locate="glocate -d $HOME/locatedb"

  # Using cache_list requires `LOCATE_PATH` environment var to exist in session.
  # trouble shoot: `echo $LOCATE_PATH` needs to return db path.
  [[ -f "$HOME/locatedb" ]] && export LOCATE_PATH="$HOME/locatedb"
fi

alias loaddb="gupdatedb --localpaths=$HOME --prunepaths=/Volumes --output=$HOME/locatedb"

After you have run loaddb the first time you need to reload the shell to make sure that it exports the LOCATE_PATH variable. Then the following command should work:

lua require'telescope'.extensions.repo.cached_list()

If nothing is shown, even after a little while, try this:

lua require'telescope'.extensions.repo.cached_list{locate_opts={"-d", vim.env.HOME .. "/locatedb"}}

Note: Installation and use of the plugin on systems other than GNU/Linux is community-maintained. Don't hesitate to open a discussion or a pull-request if something is not working!

Troubleshooting

You should try to run:

sudo updatedb

if you encounter any problems. If itā€™s not the case by default, you should automate such index update with for instance cron or systemd-timers. See https://wiki.archlinux.org/title/Locate and this discussion for various ways to automate this.

Options

Options are the similar to repo list, bearing in mind that we use locate instead of fd. Note that the following list options are not supported in cached_list:

  • fd_opts, as we donā€™t use fd with cached_list,
  • search_dirs, as locate does not accept a directory to search in.

Examples

Exclude Irrelevant Results

Chances are you will get results from folders you donā€™t care about like .cache or .cargo. In that case, you can use the file_ignore_patterns option of Telescope, like so (these are Lua regexes).

Hide all git repositories that may be in .cache or .cargo:

:lua require'telescope'.extensions.repo.cached_list{file_ignore_patterns={"/%.cache/", "/%.cargo/"}}
Notes
  • These patterns are used to filter the output of the locate command, so they donā€™t speed up the search in any way. You should use them mainly to exclude git repositories you wonā€™t want to jump into, not in the hope to enhance performance.
  • The %. in Lua regex is an escaped . as . matches any characters.
  • These patterns are applied against whole paths like /home/myuser/.cache/some/dir, so if you want to exclude only /home/myuser/.cache, you need a more complicated pattern like so:
:lua require'telescope'.extensions.repo.cached_list{file_ignore_patterns={"^".. vim.env.HOME .. "/%.cache/", "^".. vim.env.HOME .. "/%.cargo/"}}
Use With Other SCMs

Here is how you can use this plugin with various SCM (we match on the whole path with locate, so patterns differ slightly from repo list: notice the ^ that becomes a /):

SCM Command
git :Telescope repo list or lua require'telescope'.extensions.repo.list{}
pijul lua require'telescope'.extensions.repo.list{pattern=[[/\.pijul$]]}
hg lua require'telescope'.extensions.repo.list{pattern=[[/\.hg$]]}
fossil lua require'telescope'.extensions.repo.list{pattern=[[/\.fslckout$]]}

FAQ

No repositories are found

Make sure that :checkhealth telescope shows something like:

## Telescope Extension: `repo`
  - OK: Will use `glow` to preview markdown READMEs
  - OK: Will use `bat` to preview non-markdown READMEs
  - OK: locate: found `plocate`
    plocate 1.1.13
    Copyright 2020 Steinar H. Gunderson
    License GPLv2+: GNU GPL version 2 or later <https://gnu.org/licenses/gpl.html>.
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.
  - INFO: Repos found for `:Telescope repo cached_list`:
    /home/cj/.cache/yay/android-sdk/.git, /home/cj/.cache/yay/android-sdk-platform-tools/.git...
  - OK: fd: found `fd`
    fd 8.3.0
  - INFO: Repos found for `:Telescope repo list`:
    /home/cj/tmp/git_rst, /home/cj/qmk_firmware...

This may take a few seconds to run

The output of this command may point to missing dependencies.

Getting the repository list is slow

If :Telescope repo list is slow, you can use your .fdignore to exclude some folders from your filesystem. You can even use a custom ignore file with the --ignore-file option, like so:

lua require'telescope'.extensions.repo.list{fd_opts=[[--ignore-file=myignorefile]]}

Contribute

Contributions are welcome, see this document!

The telescope developers documentation is very useful to understand how plugins work and you may find these tips useful as well.

Running tests

Plenary.nvim integration tests are executed as a part of the CI checks. However, they are very basic for now and you might be better off just testing the two commands locally.

Code Formatting & Linting

StyLua is used for code formatting. It is run like so:

make fmt

To run the linter:

make lint

Acknowledgement

I would like to thank all the contributors to this plugin, as well as the developers of neovim and Telescope. Without them, none of this would be possible.

Thanks to Code Smell for demoing the plugin in 5 Terrific Neovim Telescope Extensions for 2022 šŸ”­.

Furthermore, thanks to Migadu for offering a discounted service to support this project. It is not an endorsement by Migadu though.

Stability

We understand that you need a reliable plugin that never breaks. To this end, code changes are first tested on our machines in a separate dev branch and once we are reasonably confident that changes donā€™t have unintended side-effects, they get merged to the master branch, where a wider user-base will get the changes. We also often tag releases, holding a more mature, coherent set of changes. If you are especially sensitive to changes, instruct your package manager to install the version pointed by a particular tag and watch for new releases on GitHub or via RSS. Conversely, if you wish to live on the bleeding-edge, instruct your package manager to use the dev branch.

Changelog

0.3.0

  • Add support for lolcate-rs as a cached_list provider
  • Add an option to restrict the search to some directories
  • Add fallback command so that :Telescope repo does not error
  • Fixes:
    • keep Telescope prompt in insert mode (nvim 0.7+)
    • the search_dirs argument is not mandatory
  • Dev: add tests, CI, formatting with stylua
  • Documentation: update with new features, installation instructions, code formatting reference and other fixes

0.2.0

  • Add support for checkhealth
  • Add picker that builds the list of repositories from locate, thus taking profit of a system-wide index.
  • Add mappings leading to various actions
  • Preview non-markdown Readme file

0.1.0

  • Basic feature, generate a dynamic project list with fd
  • Falls back to file listing if we are not in a git repository

Footnotes

  1. SCM: Source-Control Management ā†©

  2. See also Stability ā†©

telescope-repo.nvim's People

Contributors

cljoly avatar crivotz avatar delphinus avatar dsully avatar entropitor avatar kkharji avatar molleweide avatar ryo33 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

telescope-repo.nvim's Issues

Add option to use locate?

The locate command is indexed and could be faster than fd on some machines.

Put a šŸ‘šŸ¼ if you are interested in this feature!

Fails silently if fd not found

Hi!,

Just installed the extension and used :Telescope repo list. Telescope opened but got an empty list. No error displayed.

Issue was fd was not found. I think there should be some sort of message when that happens. Otherwise you don't know what is going on. It is quite puzzling.

On top of that, I actually had fd installed. But seems to be called fdfind on Ubuntu so it wasn't found. Ubuntu tells me if I want fd I have to install fdclone, that looks like a completely different program. Got it fixed by creating a fd soft link but I think your plugin should check if fdfind exists first so no one else has this issue.

Error "expected string, got nil"

Neovim version:

NVIM v0.9.4
Build type: Release
LuaJIT 2.1.1692716794

I'm using lazyvim and trying the plugin without any config:

return {
  {
    "nvim-telescope/telescope.nvim",
    dependencies = {
      "cljoly/telescope-repo.nvim",
      "nvim-lua/plenary.nvim",
      config = function()
          require("telescope").load_extension("repo")
      end,
    },
}

The extension get loaded since I had the autocompletion. But if I do :Telescope repo list or :Telescope repo list search_dirs=~/Documents I get:

[telescope] [WARN  20:27:28] /home/fgionghi/.local/share/nvim/lazy/telescope.nvim/lua/telescope/pickers.lua:669: Finder failed with msg:  vim/shared.lua:0: prefix: expected string, got nil

I get the telescope picket and If I keep writing in the input box (saying Git repositories (built on the fly) I got this error:

E5108: Error executing lua: ...re/nvim/lazy/telescope.nvim/lua/telescope/from_entry.lua:16: attempt to index local 'entry' (a nil value)
stack traceback:
	...re/nvim/lazy/telescope.nvim/lua/telescope/from_entry.lua:16: in function 'path'
	...escope-repo.nvim/lua/telescope/_extensions/repo/main.lua:177: in function 'run_replace_or_original'
	...re/nvim/lazy/telescope.nvim/lua/telescope/actions/mt.lua:65: in function 'run_replace_or_original'
	...re/nvim/lazy/telescope.nvim/lua/telescope/actions/mt.lua:65: in function 'key_func'
	...hare/nvim/lazy/telescope.nvim/lua/telescope/mappings.lua:290: in function <...hare/nvim/lazy/telescope.nvim/lua/telescope/mappings.lua:289>

Using instead :Telescope repo cached_list works.

checkhealt telescope:

Telescope Extension: `repo` ~
- OK Will use `batcat` to preview non-markdown READMEs
- WARNING Install `bat` for a better preview of other files
- OK Will use `batcat` to preview markdown READMEs
- WARNING Install `glow` for a better preview of markdown files
- OK locate: found `plocate`
  plocate 1.1.15
  Copyright 2020 Steinar H. Gunderson
  License GPLv2+: GNU GPL version 2 or later <https://gnu.org/licenses/gpl.html>.
  This is free software: you are free to change and redistribute it.
  There is NO WARRANTY, to the extent permitted by law.
- Repos found for `:Telescope repo cached_list`:
  /home/fgionghi/.cache/omf/https___github.com_oh-my-fish_packages-main_master/.git, /home/fgionghi/.cache/tldr-python/.git...
- OK fd: found `fd`
  fd 9.0.0
- Repos found for `:Telescope repo list`:
  /home/fgionghi/i3-easyfocus, /home/fgionghi/.nvm...

It has also found some repositories...

I know little either of neovim and lazyvim... chances are I'm doing something wrong.

Thank you.

git submodules and git project within git projects

Hi there,

I post here just to document that a git repo within a git repo is not found, and also submodules are not found.

Scenario:

I use a bash framework within which I have my own user repo which is ignored in the parent framework repo.
Also within my user repo I have subdirs such as doom-nvim. So this would kind of be three levels of git projects

bash-framework
    user-repo
        submodule doom-nvim

and ideally it'd be nice if each of these showed up in telescope-repo. I might take a look at this myself
later also.

Cannot find intended projects

I tried following the FAQ on the topic to no avail. Here is my plugin file using lazy.nvim:

return {
	{
		"nvim-telescope/telescope.nvim",
		branch = "0.1.x",
		dependencies = { "nvim-lua/plenary.nvim" },
		config = function()
			local builtin = require("telescope.builtin")
			vim.keymap.set("n", "<C-p>", builtin.find_files, {})
			vim.keymap.set("n", "<leader>fg", builtin.live_grep, {})
			vim.keymap.set("n", "<C-n>", ":Neotree filesystem reveal left<CR>")

			require("telescope").setup({
				extensions = {
					["ui-select"] = {
						require("telescope.themes").get_dropdown({}),
					},
					repo = {
						list = {
							search_dirs = {
								"~/Projects",
								"~/.config",
							},
						},
					},
				},
			})
		end,
	},
	{
		"nvim-telescope/telescope-ui-select.nvim",
		config = function()
			require("telescope").load_extension("ui-select")
		end,
	},
	{
		"cljoly/telescope-repo.nvim",
		config = function()
			require("telescope").load_extension("repo")
		end,
	},
	{
		"airblade/vim-rooter",
		config = function()
			vim.g.rooter_patterns = { "src", ".git", "package.json", "Cargo.toml" }
		end,
	},
}

It does find a few projects in the Projects directory, however the only projects it recognizes are submodules of git repos. Top level git repos are ignored regardless of whether they have submodules or not.

I'm assuming that this is due to a mistake on my part as opposed as a bug.

Windows Bug: echo not found

I came across this issue that was resolved here but now is removed.

Using the latest version of telescope-repo.nvim & telescope.
Using Windows 10 Pro, W/ Powershell 7.4.1

I implemented the fix myself, and it did not fix my issue, as no repo's are listed.

I have the extension configured to search certain directories, rather than my home folder.

image

Bad argument to 'insert' (table expected, got string)

The Issue

Hi, I've been trying to configure this extension and cannot get it to work, the preview is always an empty box.

I've included the optional loading

require("telescope").load_extension("repo")

but, when running :checkhealth telescope._extensions.repo, I get the following output:

telescope._extensions.repo: require("telescope._extensions.repo.health").check()
========================================================================
  - ERROR: Failed to run healthcheck for "telescope._extensions.repo" plugin. Exception:
    function health#check, line 20
    Vim(eval):E5108: Error executing lua ...scope-repo.nvim/lua/telescope/_extensions/repo/utils.lua:38: bad argument #1 to 'insert' (table expected, got string)
    stack traceback:
    [C]: in function 'insert'
    ...scope-repo.nvim/lua/telescope/_extensions/repo/utils.lua:38: in function 'find_markdown_previewer_for_document'
    ...cope-repo.nvim/lua/telescope/_extensions/repo/health.lua:82: in function 'check_previewer'
    ...cope-repo.nvim/lua/telescope/_extensions/repo/health.lua:97: in function 'check'
    [string "luaeval()"]:1: in main chunk

I've not provided any config so I'm unsure why it's erroring, would appreciate any help in fixing this if it's a client issue.

Diagnostic Information

nvim: 0.7
telescope: latest
telescope-repo: 0.3.0
os: Windows 11

Enters `find files` in Normal mode, would want Insert mode

For both list and cached_list repo enters repositories
find files in normal modes which means that I have to press eg. a or i
in order to be able to search files. Ie. it inccures one extra
keypress. Are you experiencing this Clement? Or is this a feature?

this issue was created with octo.nvim. This is just amazing.
If you pwd=telescope repo. then you can just run
:Octo issue list and telescope will list all issues. then just ennter
the issue you want to edit or you can create a new issue from neovim
with Octo issue create

:Telescope repo cached_list was unsccessful. Exit code: 1

when neovim checkhealth: telescope._extensions.repo: require("telescope._extensions.repo.health").check()

ERROR: Telescope repo cached_list was unsccessful. Exit code: 1
locate -r /.git$ -l 2
locate: illegal option -- rnt
usage: locate [-0Scims] [-l limit] [-d database] pattern ...

my os is mac
System Version: macOS 13.5
Kernel Version: Darwin 22.6.0

Start results cursor at the top instead of the bottom?

This is more of a question than an actual issue with the code, hope that this is okay.

Currently, when invoking :Telescope repo list from the command line, you output similar to this:

Current
image

I couldn't help but notice that the cursor/highlighted element is near the bottom. Personally, I'd like it to be just under the search bar. An example of this is the find_files picker within Telescope itself as shown below:

find_files picker
image

I had a look through the documentation but I sadly couldn't find anyway to configure this. Is this behaviour configurable in any way?

Telescope search_dirs

Is this option supported? As of right now I can't get it to work.

:lua require'telescope'.extensions.repo.cached_list{search_dirs = {"~/.dotfiles/nvim/.config/nvim/plugin"}}

`:bdelete` does not trigger `lcd`

Good day to you,

When closing a buffer via :bdelete, the lcd command does not trigger due to the autocmd being { "BufNewFile", "BufRead" }. Would it cause problems if it were BufEnter (like as in vim-rooter) instead of BufRead?

Regards.

Expand CI with some tests

To avoid encountering problems detected by health checks like #33, we should check (at least) that health checks are passing.

feat: Add function to switch between opened projects

Hi!

So I've been using a feature for a while on my side with some hacked code and would like to integrate it better in the main repo, so I am asking for how to best do it. The concept is as follow: when the function is called, a telescope picker is opened with current opened projects using opened_projects registry. When a selection is made, the most recent buffer opened in that project is opened (should also lcd if enabled). Here are some screenshots:

  1. Example of classic telescope repo.
telescope_repo
  1. When 2 projects have been opened and calling the function.
switch

Link to a hacky implementation of mine: phgz@e1236c1

In there, I add a get_project_paths() function to be used by user and call user_opts.post_action(dir) if it's defined. Other than that a (I think) bug fix calling project_live_grep with user_opts instead of list_opts and a previous fix on autocmd that I mentioned a while ago, which I saw on one of your dev branch you fixed.

On the user part, here's how I define my command: I first do the inventory of active buffers and "map" them to an opened project. Then I use that list to feed to the search_dirs and set the post action to execute.

vim.keymap.set("n", "<leader>s", function() --
	local project_paths = require("telescope._extensions.repo.autocmd_lcd").get_project_paths()
	local context = api.nvim_get_context({ types = { "bufs" } })
	local bufs = call("msgpackparse", { context["bufs"] })[4]

	local open_projects = vim.iter.filter(function(project_path)
		local found = vim.iter(bufs):find(function(buf_path)
			return vim.startswith(buf_path["f"], project_path)
		end)
		return found or false
	end, project_paths)

	require("telescope").extensions.repo.list(vim.tbl_extend("error", dropdown_theme, {
		search_dirs = vim.tbl_isempty(open_projects) and { "" } or open_projects,
		post_action = post_action_fn,
		prompt = " (opened projects)",
	}))
end)

My post action function takes the selected project by the user and browses jumplist to find most recent file of that project and then simply perform a vim.cmd.edit(to_edit) on the found file.

So either there could be a possibility to leave the opportunity to the users to define their own post action, or simply add a function as a whole (like telescope.extensions.repo.switch) embedded in telescope-repo` and make it public in the API.

Thanks!

glow previews not working with nvimpager

The glow previews for README.md files don't work when the PAGER environment variable is set to nvimpager, but they work with less -r and most. This is because the previews calls glow -p which uses the $PAGER environment variable. I found two workarounds. The first one was to set export MANPAGER=nvimpager and export PAGER=most so that nvimpager does not get called in the first place. The other one was to set a different pager from within init.lua using if vim.fn.executable('less') then vim.fn.setenv("PAGER", "less -r") end.

I opened an issue here and in the glow repo so that the problem is documented.

Change work dir

This is on of the features that I think would be really nice:

To have the ability to change work dir so that I can use eg. lazygit.nvim in the new location to check some stuff and then jump back.

I guess, on the other hand that this could also just be a regular vimrc function that I'd create myself to update the cwd.

Global telescope-repo configuration

Hi All

I am trying to configure telescope-repo. I want to set the fd_opts and search_dirs in telescope configuration. I tried, but the configuration is not working.

Please find the snippet from my init.lua

require("telescope").load_extension("file_browser")
require("telescope").load_extension("repo")

require("telescope").setup {
  extensions = {
     repo = {
	list = {
          fd_opts = {
           "--no-ignore-vcs",
          },
          search_dirs = {
           "~/my_projects"
          }

	}     
     }
  }
}

require("telescope").setup {
  extensions = {
	list = {
          fd_opts = {
           "--no-ignore-vcs",
          },
          search_dirs = {
           "~/my_projects"
          }

	}     
  }
}

I tried the below snippet as well

require("telescope").setup {
  extensions = {
     repo = {
	
          fd_opts = {
           "--no-ignore-vcs",
          },
          search_dirs = {
           "~/my_projects"
          }

     }
  }
}

Both are not working.
Some context: my $HOME dir is under Git. But not every subdir under $HOME is under git. The my_projects is a separate directory which contains subdirectories each of which is a Git repo.

Any idea what is wrong?

:Telescope repo list was unsuccessful - [fd error]

The Issue

This appeared off the back of fixes deployed within the dev branch on the commit b7fb147 (#39)

When running the command :Telescope repo list and then :checkhealth, the following error is displayed

telescope._extensions.repo: require("telescope._extensions.repo.health").check()
========================================================================
  - ERROR: No markdown previewer found, the extension will not work properly
  - ERROR: No markdown previewer found, the extension will not work properly
  - ERROR: `cached_list` will not function without locate
  - OK: fd: found `fd`
    fd 8.4.0
  - ERROR: `:Telescope repo list` was unsuccessful. Exit code: 1
    fd --hidden --case-sensitive --absolute-path --exec echo {//} ; ^\.git$
    [fd error]: Command not found: Command { inner: "echo" "C:\\Users\\sgoud\\AppData\\Local\\nvim", remaining_argument_length: 8136 }

I tried to resolve this error myself and came across the following links which may be of use:

I tried to get a version of the command fd --hidden --case-sensitive --absolute-path --exec echo {//} ; ^\.git$ working locally but sadly could not.

Hope the above links help!

Diagnostic Information

nvim: 0.7
telescope: latest
telescope-repo: 0.3.0
os: Windows 11
shell: PowerShell

`:Telescope repo` returns an error (as expected)

There have been reports in #10 of the following error:

E5108: Error executing lua ...id/.vim/plugged/telescope.nvim/lua/telescope/command.lua:184: attempt to call a nil value
stack traceback:
        ...id/.vim/plugged/telescope.nvim/lua/telescope/command.lua:184: in function 'run_command'
        ...id/.vim/plugged/telescope.nvim/lua/telescope/command.lua:241: in function 'load_command'
        [string ":lua"]:1: in main chunk
Press ENTER or type command to continue

When running :Telescope repo.

Maybe we could have a default subcommand running when none is supplied (maybe list, as it only requires fd)

Originally posted by @DavidEGx in #10 (comment)

default landing file

--default flag ->> always try enter default file. instead of entering telescope find files.

cronjob advice

I see there's a TODO item in the README for periodic updating of cache_list. Using your gupdatedb advice from brew install findutils, this cron job worked for me to update hourly:

0 * * * * /usr/local/bin/gupdatedb --localpaths=$HOME --prunepaths="/Volumes .*node_modules.*" --output="$HOME/locatedb" > "$HOME/cron-output-loaddb.log" 2>&1

however, is there a reason you recommend gnu locate and updatedb, when equivalent bsd commands are already installed on (most) macs? There's also mdfind which taps into Spotlight's db (but is supposedly slower than locate).

Not to mention that it's more common on MacOS to use launchctl a .plist file?

All of this automation requires some additional permissions for the scripts to generate files, thanks to SIP. So if someone understands this all better than me, they should consider coming up with a solution that is the least confusing and has troubleshooting steps, such as putil -lint /path/to/.plist, log show, etc.

Otherwise it's possibly not worth adding this todo item other than to say something generic like "Use your favorite scheduler" (and leave it up to the person to figure out).

Endless loop when execute autocmd_lcd on Windows

When open file like D:\tmp\test.js on Windows - and D:\tmp doesn't exist on the config path (project_paths)

Path:new("D:"):parent() will go back to app directory.

while not (project_paths[abs_buf_path] or abs_buf_path == "/") do
end

if abs_buf_path ~= "/" then

File jumping does not work properly

Once the project is selected, a second prompt appears, to select a file in that project.

Unfortunately, this seems not to work anymore with recent telescope version. Iā€™ll look into this asap.

Some commands crash after telescope-repo plugin update

OS: Mac OS
Neovim: 0.6.1

The issue reproduces since plugin update that added PRs #25 , #26, #30

Example commands that crash: Telescope repo list, also (telescope.health).check fails with the same error.

Error message:

E5108: Error executing lua ...escope-repo.nvim/lua/telescope/_extensions/repo/list.lua:26: bad argument #1 to 'ipairs' (table expected, got nil)
stack traceback:
        [C]: in function 'ipairs'
        ...escope-repo.nvim/lua/telescope/_extensions/repo/list.lua:26: in function 'prepare_command'
        ...escope-repo.nvim/lua/telescope/_extensions/repo/main.lua:198: in function <...escope-repo.nvim/lua/telescope/_extensions/repo/main.lua:195>
        ...re/nvim/plugged/telescope.nvim/lua/telescope/command.lua:182: in function 'run_command'
        ...re/nvim/plugged/telescope.nvim/lua/telescope/command.lua:255: in function 'load_command'
        [string ":lua"]:1: in main chunk

Add exclude dirs

I found that trepo is including packer installed plugins and other repos
that I really don't want to end up in the search.

Which is easiest:

  1. modify the locate command to exclude dirs.
  2. modify trepo?

Open `git status`

Add a shortcut to open the git status of the repository, instead of showing a file list.

Discussed in #18

Originally posted by molleweide January 12, 2022
i saw that you were working on entering git status directly. Are you doing this with neogit?

Using 'batcat' for finding 'bat'

On Debian-based systems (I'm using elementaryOS), I noticed that one would have to make a symlink to batcat, the binary that most programs expect when using bat.

Would you be open to a PR to add a check/lookup for batcat and use it if it exists and if not, use bat? I see the relevant line would be here

(Originally published at: https://jacky.wtf/2022/8/y-B0)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    šŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. šŸ“ŠšŸ“ˆšŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ā¤ļø Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.