Quick & Usefull cheatsheet viewer plugin for nvim.
Inspired by vim-cheatsheet
:Cheat
or :Cheat {cheat_name}
capture01.mov
<leader>ch
or <leader>cn
or <leader>ct
capture02.mov
Both functions are available.
-
Show 'filetype-specific' cheatsheet automatically, with the same 'one' keymap.
ex.)<leader>ch
or:Cheat
-
Show 'commonly-used' cheatsheet, by each keymaps.
ex.)<leader>cn
or:Cheat nvim
--> nvim's cheatsheet
ex.)<leader>ct
or:Cheat tmux
--> tmux's cheatsheet
Packer
use { "riodelphino/cheat.nvim" }
require('cheat').setup {}
Command | Description |
---|---|
:Cheat |
Show the cheatsheet depending on current buf's filetype, with the style set in config.window.default_style. |
:Cheat {cheat_name} |
Same with :Cheat , but show the specific cheatsheet. |
:CheatFloat |
Same with :Cheat , but with float style. (Sorry, not implemented now.) |
:CheatHSplit |
Same with :Cheat , but with horizontal split style. (Sorry, not implemented now.) |
:CheatVSplit |
Same with :Cheat , but with vertical split style. (Sorry, not implemented now.) |
Keymap | Function |
---|---|
<leader>ch |
Show the cheatsheet delepending on current buf's file pattern |
<leader>cn |
Show the nvim's cheatsheet (cheat-nvim.md) |
<leader>ct |
Show the tmux's cheatsheet (cheat-tmux.md) |
q |
Close cheatsheet. |
Default configs.
rquire('cheat').setup {
debug = false, -- show debug msg (just for me)
readonly = true, -- 'false' for editable.
window = {
default_style = "float", -- "vsplit", "hsplit" -- Choose display style. (Now only 'float' works.)
vsplit = { height = { size = 20 } },
hsplit = { width = { size = 40 } },
float = {
width = {
ratio = 0.8,
},
height = {
ratio = 0.9,
},
signcolumn = false, -- 'false' for simple display style.
},
},
file = {
dir = "~/.config/nvim/cheat", -- Directory where the cheatsheets are placed.
prefix = "cheat-", -- Cheatsheet file prefix.
ext = ".md", -- Cheatsheet extension.
},
keymaps = {
["<leader>ch"] = ":Cheat", -- Show the cheatsheet depending on filetype.
["<leader>cn"] = ":Cheat nvim", -- Show "cheat-nvim.md"
["<leader>ct"] = ":Cheat tmux", -- Show "cheat-tmux.md"
-- Add more keymaps & cheatsheets here.
},
cheatsheets = {
filetypes = { -- Open the specific cheatsheet by file pattern.
lua = { "*.lua" },
vim = { "*.vim", "*.vifmrc" }, -- The key 'vim' is the surfix of filename. ex.) cheat-vim.md
js = { "*.js", "*.mjs" },
css = { "*.css", "*.scss", "*.sass" }, -- Multiple filetypes are allowed.
md = { "*.md" },
php = { "*.php" },
html = { "*.html" },
-- Add more filetypes settings here.
},
},
}
- window.default_style = "vsplit"
- window.default_style = "hsplit"
- window.vsplit.signcolumn
- window.vsplit.signcolumn
- Logging (now just print()...)
MIT