Skip to content

cug/clipboard-history.nvim

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 

Repository files navigation

clipboard-history.nvim

A Neovim plugin that maintains a history of yanked text and allows easy pasting from this history. Integrated support for WSL, allowing you to yank directly to windows clipboard.

Features

  • Automatically captures yanked text
  • Displays a window with the clipboard history
  • Allows selection and pasting from the history
  • Configurable maximum history size
  • Clear clipboard history
  • Yank text directly to clip.exe (useful for WSL users)

Installation

use {
    'royanirudd/clipboard-history.nvim',
    config = function()
        vim.g.clipboard_history_max_history = 200  -- Optional: set max history (default 100)
    end
}

Using lazy.nvim

{
    'royanirudd/clipboard-history.nvim',
    opts = {
        max_history = 200  -- Optional: set max history (default 100)
    }
}

Configuration

You can configure the maximum numbner of items stored in the clipboard history You can also set if you are using WSL

For packer.nvim:

use {
  "royanirudd/clipboard-history.nvim",
  config = function()
    require("clipboard-history").setup({
      max_history = 30,  -- Maximum number of items to store in the clipboard history
      enable_wsl_features = false,  -- Set to true if you're using WSL and want Windows clipboard integration
    })
  end
}

For lazy.nvim:

{
    'royanirudd/clipboard-history.nvim',
    opts = {
        max_history = 200,  -- Optional: set max history (default 100)
        enable_wsl_features = false,  -- Set to true if you're using WSL and want Windows clipboard integration
    }
}

If not specified the default value of 30 will be used.

Usage

The plugin automatically captures yanked text and stores it in the history. To open the clipboard history window:

:ClipboardHistory

In the clipboard history window

  • Navigate to the text needed
  • Press <Enter> to select and paste an item
  • Press q to close the window without selecting

To clear clipboard history

:ClipboardClear

Clears entire clipboard history

To yank text to windows

:'<,'>ClipboardYankToWindows

NOTE: The "'<,'>" Should come pre populated once you enter command mode after highlighting text

Pull requests

Feel free to change anything and submit a pull request!

TODO

  • Add search functionality within history
  • Project persistant history, maintain context of where text is yanked from
  • WSL2 Windows clipboard integration using 'clip.exe'
  • Telescope integration

By Anirudh Roy, India

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Lua 100.0%