Skip to content

Commit

Permalink
clean up and catch rendering bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
jamestrew committed Aug 11, 2024
1 parent d5d7c39 commit 1d63fec
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 49 deletions.
91 changes: 43 additions & 48 deletions doc/telescope.txt
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,7 @@ builtin.treesitter({opts}) *telescope.builtin.treesitter()*
Lists function names, variables, and other symbols from treesitter queries
• Default keymaps:
`<C-l>`: show autocompletion menu to prefilter your query by kind of
ts node you want to see (i.e. `:var:` )
ts node you want to see (i.e. `:var:`)

Parameters: ~
{opts} (`table`)
Expand Down Expand Up @@ -1488,7 +1488,7 @@ builtin.lsp_document_symbols({opts})
Lists LSP document symbols in the current buffer
• Default keymaps:
`<C-l>`: show autocompletion menu to prefilter your query by type of
symbol you want to see (i.e. `:variable:` )
symbol you want to see (i.e. `:variable:`)

Parameters: ~
{opts} (`table`)
Expand All @@ -1512,7 +1512,7 @@ builtin.lsp_workspace_symbols({opts})
Lists LSP document symbols in the current workspace
• Default keymaps:
`<C-l>`: show autocompletion menu to prefilter your query by type of
symbol you want to see (i.e. `:variable:` )
symbol you want to see (i.e. `:variable:`)

Parameters: ~
{opts} (`table`)
Expand Down Expand Up @@ -1561,7 +1561,7 @@ builtin.diagnostics({opts}) *telescope.builtin.diagnostics()*
`:vim.diagnostic.severity:`
• Default keymaps:
`<C-l>`: show autocompletion menu to prefilter your query with the
diagnostic you want to see (i.e. `:warning:` )
diagnostic you want to see (i.e. `:warning:`)
• sort_by option:
• "buffer": order by bufnr (prioritizing current bufnr), severity, lnum
• "severity": order by severity, bufnr (prioritizing current bufnr),
Expand Down Expand Up @@ -1713,34 +1713,34 @@ ordered from the lowest priority to the highest priority.
2. In the |telescope.setup()| table, inside a picker with a given name, use
the `mappings` key >lua
require("telescope").setup {
pickers = {
find_files = {
mappings = {
n = {
["kj"] = "close",
},
},
},
},
}
pickers = {
find_files = {
mappings = {
n = {
["kj"] = "close",
},
},
},
},
}
<

3. `attach_mappings` function for a particular picker. >lua
require("telescope.builtin").find_files {
attach_mappings = function(_, map)
map("i", "asdf", function(_prompt_bufnr)
print "You typed asdf"
end)

map({"i", "n"}, "<C-r>", function(_prompt_bufnr)
print "You typed <C-r>"
end, { desc = "desc for which key"})

-- needs to return true if you want to map default_mappings and
-- false if not
return true
end,
}
attach_mappings = function(_, map)
map("i", "asdf", function(_prompt_bufnr)
print "You typed asdf"
end)

map({"i", "n"}, "<C-r>", function(_prompt_bufnr)
print "You typed <C-r>"
end, { desc = "desc for which key"})

-- needs to return true if you want to map default_mappings and
-- false if not
return true
end,
}
<

==============================================================================
Expand Down Expand Up @@ -2257,11 +2257,9 @@ entry) which contains the following important keys:
• bufnr number (optional): will be interpreted by the default `<cr>` action as
open this buffer
• lnum number (optional): lnum value which will be interpreted by the default
`<cr>`
action as a jump to this line
`<cr>` action as a jump to this line
• col number (optional): col value which will be interpreted by the default
`<cr>`
action as a jump to this column
`<cr>` action as a jump to this column

For more information on easier displaying, see
|telescope.pickers.entry_display|
Expand Down Expand Up @@ -3145,7 +3143,7 @@ actions_layout.toggle_mirror({prompt_bufnr})

*telescope.actions_layout.cycle_layout_next()*
actions_layout.cycle_layout_next({prompt_bufnr})
Cycles to the next layout in `cycle_layout_list` .
Cycles to the next layout in `cycle_layout_list`.

Note: ~
• this action is not mapped by default.
Expand All @@ -3155,7 +3153,7 @@ actions_layout.cycle_layout_next({prompt_bufnr})

*telescope.actions_layout.cycle_layout_prev()*
actions_layout.cycle_layout_prev({prompt_bufnr})
Cycles to the previous layout in `cycle_layout_list` .
Cycles to the previous layout in `cycle_layout_list`.

Note: ~
• this action is not mapped by default.
Expand Down Expand Up @@ -3233,7 +3231,7 @@ actions_utils.map_selections({prompt_bufnr}, {f})
*telescope.actions_utils.get_registered_mappings()*
actions_utils.get_registered_mappings({prompt_bufnr})
Utility to collect mappings of prompt buffer in array of
`{mode, keybind, name}` .
`{mode, keybind, name}`.

Parameters: ~
• {prompt_bufnr} (`number`) The prompt bufnr
Expand Down Expand Up @@ -3268,7 +3266,7 @@ actions_generate.which_key({opts})
• Floating window:
• Appears on the opposite side of the prompt.
• Resolves to minimum required number of lines to show hints with `opts`
or truncates entries at `max_height` .
or truncates entries at `max_height`.
• Closes automatically on action call and can be disabled with by
setting `close_with_action` to false.

Expand Down Expand Up @@ -3391,7 +3389,7 @@ previewers.new() *telescope.previewers.new()*
*telescope.previewers.new_termopen_previewer()*
previewers.new_termopen_previewer({opts})
Is a wrapper around Previewer and helps with creating a new
`termopen_previewer` .
`termopen_previewer`.

It requires you to specify one table entry `get_command(entry, status)`.
This `get_command` function has to return the terminal command that will
Expand Down Expand Up @@ -3493,9 +3491,8 @@ previewers.new_buffer_previewer({opts})
For example, that buffer can be opened in a new split, rather than
recreating that buffer in an action. To access the last buffer number:
`require('telescope.state').get_global_key("last_preview_bufnr")`
• `get_buffer_by_name = function(self, entry)`
Allows you to set a
unique name for each buffer. This is used for caching purposes.
• `get_buffer_by_name = function(self, entry)` Allows you to set a unique
name for each buffer. This is used for caching purposes.
`self.state.bufname` will be nil if the entry was never loaded or the
unique name when it was loaded once. For example, useful if you have one
file but multiple entries. This happens for grep and lsp builtins. So to
Expand All @@ -3506,8 +3503,7 @@ previewers.new_buffer_previewer({opts})
config value `dynamic_preview_title = true`

`self.state` table:
`self.state.bufnr`
Is the current buffer number, in which you have to
`self.state.bufnr` Is the current buffer number, in which you have to
write the loaded content. Don't create a buffer yourself, otherwise it's
not managed by the buffer_previewer interface and you will probably be
better off writing your own interface.
Expand Down Expand Up @@ -3544,15 +3540,14 @@ previewers.new_buffer_previewer({opts})
• If you want to use `vim.fn.search` or similar you need to run it in that
specific buffer context. Do >lua
vim.api.nvim_buf_call(bufnr, function()
-- for example `search` and `matchadd`
end)
-- for example `search` and `matchadd`
end)
<
to achieve that.
• If you want to read a file into the buffer it's best to use
`buffer_previewer_maker`. But access this function with
`require('telescope.config').values.buffer_previewer_maker`

because it can be redefined by users.
`require('telescope.config').values.buffer_previewer_maker` because it
can be redefined by users.

Parameters: ~
{opts} (`table`) options
Expand Down Expand Up @@ -3600,7 +3595,7 @@ previewers.vim_buffer_vimgrep({opts})
*telescope.previewers.vim_buffer_qflist()*
previewers.vim_buffer_qflist({opts})
Is the same as `vim_buffer_vimgrep` and only exists for consistency with
`term_previewers` .
`term_previewers`.

The preferred way of using this previewer is like this
`require('telescope.config').values.qflist_previewer` This will respect
Expand Down
2 changes: 1 addition & 1 deletion lua/telescope/builtin/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
--- Any of these functions can just be called directly by doing:
--- ```vim
--- :lua require('telescope.builtin').$NAME_OF_PICKER()
--- ````
--- ```
---
--- To use any of Telescope's default options or any picker-specific options, call your desired picker by passing a lua
--- table to the picker with all of the options you want to use. Here's an example with the live_grep picker:
Expand Down

0 comments on commit 1d63fec

Please sign in to comment.