1
0
Fork 0

nvim: Handle clipboard via osc52

This commit is contained in:
Daniel Kempkens 2022-08-02 22:50:56 +02:00
parent 0cb406caef
commit ab00294b74
5 changed files with 32 additions and 8 deletions

View file

@ -60,14 +60,6 @@
(set o.swapfile false)
(set o.undofile true)
(set o.undodir (.. (os.getenv :HOME) :/.local/share/nvim/undo//))
;; Clipboard
(if (= uname.sysname :Darwin)
(do
(set g.clipboard {:name :pbcopy
:copy {:+ :pbcopy :* :pbcopy}
:paste {:+ :pbpaste :* :pbpaste}
:cache_enabled 0})
(o.clipboard:prepend :unnamedplus)))
;; Theme
(let [theme (require :nifoc.theme)]
(theme.setup))

View file

@ -0,0 +1,14 @@
(let [osc52 (require :osc52)]
(fn copy [lines _]
(-> lines
(table.concat "\n")
(osc52.copy)))
(fn paste []
[(vim.fn.split (vim.fn.getreg "") "\n") (vim.fn.getregtype "")])
(set vim.g.clipboard {:name :osc52
:copy {:+ copy :* copy}
:paste {:+ paste :* paste}})
(vim.opt.clipboard:prepend :unnamedplus))

View file

@ -67,6 +67,12 @@ in
nvim-web-devicons
# Keybindings
{
plugin = nvim-osc52;
config = builtins.readFile ../../config/nvim/plugins/osc52.fnl;
type = "fennel";
}
{
plugin = yanky-nvim;
config = builtins.readFile ../../config/nvim/plugins/yanky.fnl;

View file

@ -45,6 +45,17 @@
fetchSubmodules = false;
};
};
nvim-osc52 = pkgs.vimUtils.buildVimPluginFrom2Nix {
pname = "nvim-osc52";
version = "2022-07-31";
src = pkgs.fetchFromGitHub {
owner = "ojroques";
repo = "nvim-osc52";
rev = "0f25ebe9eb5050bb242e947c42134a851391a73e";
sha256 = "0csd7ymia5k9pqrq8fr12yykiw4ssm06gsbz63i6xsgpvgmwnpv7";
fetchSubmodules = false;
};
};
yanky-nvim = pkgs.vimUtils.buildVimPluginFrom2Nix {
pname = "yanky.nvim";
version = "2022-07-29";

View file

@ -7,6 +7,7 @@
- src: kyazdani42/nvim-web-devicons
# Keybindings
- src: ojroques/nvim-osc52
- src: gbprod/yanky.nvim
- src: gbprod/cutlass.nvim
- src: gbprod/substitute.nvim