* feat: support base_dir option for searching for git repos * style: fix indentation * fix: only close file if exists * fix: explicitly set to false if base_dir not set * refactor: always initialize project file * refactor: separate project extraction and project writing * fix: iterate with pairs and no arg for io.lines * refactor: restructure, test, and lint * refactor: use standard telescope file structure * refactor: utilize utility functions for actions module * refactor: support max_depth arg for recursive searching * chore: add Makefile for linting and testing * test: add utils general tests * refactor: do not need file_exists function * test: add tests for creating, writing and reading projects * chore: move location of tests * test: add tests for git project scanning * test: do not need minimal_init.vim now * test: clean up tests * refactor: update git projects on setup
2.8 KiB
2.8 KiB
telescope-project.nvim
An extension for telescope.nvim that allows you to switch between projects.
Demo
Setup
You can setup the extension by adding the following to your config:
require'telescope'.load_extension('project')
You may skip explicitly loading extensions (they will then be lazy-loaded), but tab completions will not be available right away.
Available functions:
Project
The projects picker:
require'telescope'.extensions.project.project{}
Default mappings (normal mode):
| Key | Description |
|---|---|
d |
delete currently selected project |
r |
rename currently selected project |
c |
create a project* |
s |
search inside files within your project |
b |
browse inside files within your project |
w |
change to the selected project's directory without opening it |
R |
find a recently opened file within your project |
f |
find a file within your project (same as <CR>) |
* defaults to your git root if used inside a git project, otherwise, it will use your current working directory
Example key map config:
vim.api.nvim_set_keymap(
'n',
'<C-p>',
":lua require'telescope'.extensions.project.project{}<CR>",
{noremap = true, silent = true}
)
Available options:
| Keys | Description | Options |
|---|---|---|
display_type |
Show the title and the path of the project | 'full' or 'minimal' (default) |
Options can be added when requiring telescope-project, as shown below:
lua require'telescope'.extensions.project.project{ display_type = 'full' }
Available setup settings:
| Keys | Description | Options |
|---|---|---|
base_dir |
path to projects (all git repos will be added) | string (default: nil) |
max_depth |
maximum depth to recursively search for projects | integer (default: 3) |
Setup settings can be added when requiring telescope, as shown below:
require('telescope').setup {
extensions = {
project = {
base_dir = '~/projects',
max_depth = 3
}
}
}
Roadmap 🚙
- order projects by last opened ✔️
- add all (git-enabled) subdirectories automatically ✔️
- workspaces 🚧
