Skip to content

lnus/fencey.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fencey.nvim

Fencey Demo

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.

Installation

  1. Install via your favorite package manager
-- lazy.nvim
{
    'lnus/fencey.nvim',
    opts = {},
},
  1. Setup the plugin in your init.lua

NOT needed with lazy.nvim if opts is set, like above

require('fencey').setup()

Configuration

The default configuration is very barebones.

{
    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

With lazy.nvim a config might look like this:

{
    'lnus/fencey.nvim',
    opts = {
        verbose = false,
        register = '+',
        virtual_text = {
            content = '[FenceY]',
            hl_group = 'Comment',
        },
    },
    cmd = { 'FenceYank' },
    keys = {
      { '<leader>fy', '<cmd>FenceYank<cr>', desc = '[F]ence [Y]ank' },
    },
},

Or a more explicit, not lazy loaded configuration:

{
    'lnus/fencey.nvim',
    config = function()
        vim.api.nvim_set_hl(0, 'AwesomeHighlight', { fg = '#FF0FF0', italic = true })
        vim.keymap.set('n', '<leader>yf', '<cmd>FenceYank<cr>', { desc = '[Y]ank [F]ence' })

        require('fencey').setup {
            verbose = false,
            register = '+',
            virtual_text = {
                content = '[Yanking Fence]',
                hl_group = 'AwesomeHighlight',
            },
        }
    end,
},

License

MIT

Releases

No releases published

Packages

No packages published

Languages