Add examples, API to readme

This commit is contained in:
rockerBOO
2020-08-28 01:11:04 -04:00
committed by TJ DeVries
parent 1278173acf
commit 6d54837aa2

View File

@@ -3,6 +3,7 @@
Gaze deeply into unknown regions using the power of the moon. Gaze deeply into unknown regions using the power of the moon.
![Example](./media/simple_rg_v1.gif) ![Example](./media/simple_rg_v1.gif)
[Example video](https://www.youtube.com/watch?v=65AVwHZflsU)
## Installation ## Installation
@@ -12,12 +13,18 @@ Plug 'nvim-lua/plenary.nvim'
Plug 'nvim-lua/telescope.nvim' Plug 'nvim-lua/telescope.nvim'
``` ```
### Optional
- bat (preview)
- ripgrep (finder)
- git (picker)
- LSP (picker)
- [devicons](https://github.com/kyazdani42/nvim-web-devicons)
## Usage ## Usage
(I will write a longer description later about how to create each of the objects described in Pipeline) (I will write a longer description later about how to create each of the objects described in Pipeline)
There is currently a fuzzy finder for git files builtin:
```lua ```lua
-- Fuzzy find over git files in your directory -- Fuzzy find over git files in your directory
require('telescope.builtin').git_files() require('telescope.builtin').git_files()
@@ -32,6 +39,16 @@ require('telescope.builtin').lsp_references()
require('telescope.builtin').quickfix() require('telescope.builtin').quickfix()
``` ```
### Example
```vimscript
nnoremap <Leader>p :lua require'telescope.builtin'.git_files{}<CR>
```
```vimscript
nnoremap <silent> gr <cmd>lua require'telescope.builtin'.lsp_references{}<CR>
```
## Status (Unstable API) ## Status (Unstable API)
While the underlying API & Infrastructure (A.K.A. Spaghetti Code) is still very much WIP and While the underlying API & Infrastructure (A.K.A. Spaghetti Code) is still very much WIP and
@@ -40,33 +57,46 @@ in, you can report bugs if they don't work, you should be able to keep them arou
even if everything inside of those functions is rewritten. They provide pretty simple, easy to use even if everything inside of those functions is rewritten. They provide pretty simple, easy to use
wrappers over common tasks). wrappers over common tasks).
## API
### `builtin`
Defaults:
- require'telescope.builtin'.git_files{ show_preview = true }
- require'telescope.builtin'.live_grep{}
- require'telescope.builtin'.lsp_references{}
- require'telescope.builtin'.quickfix{}
- require'telescope.builtin'.grep_string{ search = "query" }
## Goals ## Goals
### Pipeline Different Objects ### Pipeline Different Objects
(Please note, this section is still in progress) (Please note, this section is still in progress)
"finder": "finder":
- executable: rg, git ls-files, ... - executable: rg, git ls-files, ...
- things in lua already - things in lua already
- vim things - vim things
"picker": "picker":
- fzf - fzf
- sk - sk
- does this always need to be fuzzy? - does this always need to be fuzzy?
- you'll map what you want to do with vimscript / lua mappings - you'll map what you want to do with vimscript / lua mappings
"previewer": "previewer":
- sometimes built-in - sometimes built-in
- sometimes a lua callback - sometimes a lua callback
As an example, you could pipe your inputs into fzf, and then it can sort them for you. As an example, you could pipe your inputs into fzf, and then it can sort them for you.
fzf: fzf:
- have a list of inputs - have a list of inputs
- i have a prompt/things people typed - i have a prompt/things people typed
- instantly return the stuff via stdout - instantly return the stuff via stdout