ned-chtsh.nvim
is a Neovim plugin that allows users to query cht.sh directly from Neovim to quickly access cheat sheets on various programming languages, tools, and commands.
- Seamlessly query
cht.sh
from within Neovim. - Display cheat sheet results in a new split window.
- Supports key mappings and custom commands for quick access.
- Removes ANSI escape sequences from the results for better readability in the Neovim buffer.
Using lazy.nvim
- Install
lazy.nvim
plugin manager, if you haven't already. - Add the following line to your Neovim configuration file (
init.lua
):
-- from remote
require("lazy").setup({
{
"nedelcu-ioan/ned-chtsh.nvim",
},
})
-- from source
require("lazy").setup({
{
"ned-chtsh.nvim",
dir = "~/path/to/local/ned-chtsh", -- Point this to your cloned repo
},
})
Using packer.nvim
- Install
packer.nvim
plugin manager, if you haven't already. - Add the following line to your
packer
setup ininit.lua
:
use '~/path/to/local/ned-chtsh' -- Use the path to your local cloned plugin
use 'nedelcu-ioan/ned-chtsh.nvim'
Using vim-plug
- Install
vim-plug
if it's not already installed. - Add this line to your
init.vim
orinit.lua
:
Plug '~/path/to/local/ned-chtsh' -- Replace with your actual plugin path
Plug 'nedelcu-ioan/ned-chtsh.nvim'
- Clone the plugin into your Neovim configuration directory:
git clone https://github.com/your-username/ned-chtsh.nvim ~/.config/nvim/pack/plugins/start/ned-chtsh
- Add the following to your
init.lua
orinit.vim
:
require('ned-chtsh')
-
Create a custom command and key mapping in your Neovim configuration:
vim.api.nvim_create_user_command('Cht', function() require("ned-chtsh").getCheatSheet() end, { desc = "Query cht.sh" }) vim.keymap.set('n', '<leader>cs', ':Cht<CR>', { desc = "[C]ht.[s]h query" })
-
Once you've set it up, you can use the plugin as follows:
- Run the
:Cht
command to query a cheat sheet. - Use the key mapping
<leader>cs
to quickly open a prompt for the query.
- Run the
- Type
:Cht python
in Neovim and hit Enter. - The cheat sheet will open in a new vertical split window.
If you want to contribute or test changes locally, follow these steps:
- Clone the repository:
git clone https://github.com/your-username/ned-chtsh.nvim
-
Set up a Docker environment for testing:
- Build the container:
./build-test-container
- Run the test container:
./run-test-container
- Make your changes and test them in the isolated Docker environment.
- cht.sh for providing a useful service for quick cheat sheet access.