https://github.com/lnus/fencey.nvim
Yank text as fenced code blocks
https://github.com/lnus/fencey.nvim
lua neovim neovim-lua neovim-plugin nvim
Last synced: about 2 months ago
JSON representation
Yank text as fenced code blocks
- Host: GitHub
- URL: https://github.com/lnus/fencey.nvim
- Owner: lnus
- License: mit
- Created: 2025-02-06T02:38:21.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-06T06:53:47.000Z (over 1 year ago)
- Last Synced: 2025-02-06T07:32:27.663Z (over 1 year ago)
- Topics: lua, neovim, neovim-lua, neovim-plugin, nvim
- Language: Lua
- Homepage:
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# fencey.nvim

## Features
- Yank text as a code block
- Do it again, _if you want to_
> Couldn't this just have been a gist with an autocommand?!
Yes, but this is cooler.
Feel free to repurpose the code as an autocommand if you want,
but I have added some _niceties_ that make this easier to use.
## Usage
`fencey.nvim` provides one command:
- `:FenceYank` puts you into fence yank mode
I recommend keybinding this to something reasonable, see [example config](#example-configuration).
## Installation
1. Install via your favorite package manager
```lua
-- lazy.nvim
{
'lnus/fencey.nvim',
opts = {},
},
```
2. Setup the plugin in your `init.lua`
**NOT** needed with `lazy.nvim` if `opts` is set, like above
```lua
require('fencey').setup()
```
## Configuration
The default configuration is very barebones.
```lua
{
verbose = false, -- Log more often
register = '+', -- Which register to store yank in
virtual_text = {
content = '[FY]', -- Virtual text content
hl_group = 'DiagnosticVirtualTextInfo', -- Which highlight group to use
},
}
```
### Example configuration
> Make sure to understand `cmd` and `keys` from [lazy.nvim](https://lazy.folke.io/spec/examples)
With `lazy.nvim` a config might look like this:
```lua
{
'lnus/fencey.nvim',
opts = {
verbose = false,
register = '+',
virtual_text = {
content = '[FenceY]',
hl_group = 'Comment',
},
},
cmd = { 'FenceYank' },
keys = {
{ 'fy', 'FenceYank', desc = '[F]ence [Y]ank' },
},
},
```
Or a more explicit, not lazy loaded configuration:
```lua
{
'lnus/fencey.nvim',
config = function()
vim.api.nvim_set_hl(0, 'AwesomeHighlight', { fg = '#FF0FF0', italic = true })
vim.keymap.set('n', 'yf', 'FenceYank', { desc = '[Y]ank [F]ence' })
require('fencey').setup {
verbose = false,
register = '+',
virtual_text = {
content = '[Yanking Fence]',
hl_group = 'AwesomeHighlight',
},
}
end,
},
```
## License
MIT