Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Tyler-Barham/floating-help.nvim
📚 A Neovim plugin to show `:help` in an anchorable/resizable floating window
https://github.com/Tyler-Barham/floating-help.nvim
lua neovim neovim-plugin nvim
Last synced: 3 months ago
JSON representation
📚 A Neovim plugin to show `:help` in an anchorable/resizable floating window
- Host: GitHub
- URL: https://github.com/Tyler-Barham/floating-help.nvim
- Owner: Tyler-Barham
- License: apache-2.0
- Created: 2023-08-01T03:58:24.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-05-05T20:47:15.000Z (7 months ago)
- Last Synced: 2024-05-05T21:38:47.789Z (7 months ago)
- Topics: lua, neovim, neovim-plugin, nvim
- Language: Lua
- Homepage:
- Size: 325 KB
- Stars: 30
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 📚 FloatingHelp
A Neovim plugin to show
:help
, cppman, orman
in an anchorable/resizable floating window.![FloatingHelp Screenshot](./media/floating-help-active.png)
`:FloatingHelp dap.txt position=NE height=0.55`![FloatingHelp Screenshot](./media/floating-help-inactive.png)
`:FloatingHelp test position=SW height=0.5 width=40`## ⚒️ Installation
Install with your preferred plugin manager:
```lua
-- packer.nvim
use 'Tyler-Barham/floating-help.nvim'
```Optionally, install [cppman](https://github.com/aitjcize/cppman)
## ⚙️ Configuration
### Setup
You need to call the `setup()` method to initialize the plugin
```lua
local fh = require('floating-help')fh.setup({
-- Defaults
width = 80, -- Whole numbers are columns/rows
height = 0.9, -- Decimals are a percentage of the editor
position = 'E', -- NW,N,NW,W,C,E,SW,S,SE (C==center)
border = 'rounded', -- rounded,double,single
onload = function(query_type) end, -- optional callback to be executed after help contents has been loaded
})-- Create a keymap for toggling the help window
vim.keymap.set('n', '', fh.toggle)
-- Create a keymap to search cppman for the word under the cursor
vim.keymap.set('n', '', function()
fh.open('t=cppman', vim.fn.expand(''))
end)
-- Create a keymap to search man for the word under the cursor
vim.keymap.set('n', '', function()
fh.open('t=man', vim.fn.expand(''))
end)-- Only replace cmds, not search; only replace the first instance
local function cmd_abbrev(abbrev, expansion)
local cmd = 'cabbr ' .. abbrev .. ' =(getcmdpos() == 1 && getcmdtype() == ":" ? "' .. expansion .. '" : "' .. abbrev .. '")'
vim.cmd(cmd)
end-- Redirect `:h` to `:FloatingHelp`
cmd_abbrev('h', 'FloatingHelp')
cmd_abbrev('help', 'FloatingHelp')
cmd_abbrev('helpc', 'FloatingHelpClose')
cmd_abbrev('helpclose', 'FloatingHelpClose')
```## 🚀 Usage
### Commands
- `FloatingHelp `
- `FloatingHelpToggle `
- `FloatingHelpClose`Args (none are positional):
- `` The help page to show
- `p[osition]=`
- `h[eight]=`
- `w[idth]=`
- `t[ype]=`### API
```lua
local fh = require('floating-help')fh.open({args})
fh.toggle({args})
fh.close()
```## 🤝 Contributing
All contributions are welcome! Just open a pull request.