Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nvim-telescope/telescope-cheat.nvim
WIP integration
https://github.com/nvim-telescope/telescope-cheat.nvim
Last synced: 3 days ago
JSON representation
WIP integration
- Host: GitHub
- URL: https://github.com/nvim-telescope/telescope-cheat.nvim
- Owner: nvim-telescope
- License: mit
- Created: 2020-12-30T05:35:47.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2023-11-24T17:05:35.000Z (12 months ago)
- Last Synced: 2024-08-02T13:33:11.129Z (3 months ago)
- Language: Lua
- Size: 2.46 MB
- Stars: 113
- Watchers: 4
- Forks: 6
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# telescope-cheat.nvim
An attempt to recreate cheat.sh with lua, neovim, [sqlite.lua](https://github.com/kkharji/sqlite.lua), and telescope.nvim.
![](./preview.gif)
## Installation
Install via your favorite package manager:
#### [packer.nvim](https://github.com/wbthomason/packer.nvim)
```lua
use {
"nvim-telescope/telescope-cheat.nvim",
requires = {
"kkharji/sqlite.lua",
"nvim-telescope/telescope.nvim"
}
}require("telescope").load_extension("cheat")
```#### [lazy.nvim](https://github.com/folke/lazy.nvim)
```lua
require("lazy").setup({
"nvim-telescope/telescope-cheat.nvim",
dependencies = {
"kkharji/sqlite.lua",
"nvim-telescope/telescope.nvim"
}
})require("telescope").load_extension("cheat")
```## Usage
```vim
:Telescope cheat fd
:Telescope cheat recache " cheat will be auto cached with new updates on sources
```## Contribution
New sources can be defined in [./lua/telescope/\_extensions/cheat/sources.lua](https://github.com/nvim-telescope/telescope-cheat.nvim/blob/dev/lua/telescope/_extensions/cheat/sources.lua).
Example:
```lua
M[2] = {
name = "learnxinyminutes",
uri = "https://github.com/adambard/learnxinyminutes-docs",
root = "",
depth = 1,
pattern = ".*%.html%.markdown",
add_dirs = false,
ft = "markdown",
parse = function(path)
local content = p.readlines(path)
if content[1]:find('---', 1, true) then
local minus_count = 0
while minus_count < 2 do
if content[1]:find('---', 1, true) then minus_count = minus_count + 1 end
table.remove(content, 1)
end
end
while content[1] == '' do
table.remove(content, 1)
endreturn table.concat(content, '\n')
end,
get_ns_keyword = function(path)
return "lang", path:match('.*/([^./]+).*')
end
}
```