1
0
Fork 0

nvim: Improved system clipboard handling

This commit is contained in:
Daniel Kempkens 2022-08-03 18:04:23 +02:00
parent 9023e34a0a
commit 1251a81cfb
3 changed files with 20 additions and 12 deletions

View file

@ -1,6 +1,5 @@
(let [o vim.opt
g vim.g
uname (vim.loop.os_uname)]
g vim.g]
;; Preamble
(vim.cmd.filetype "plugin indent on")
(set o.shell :/bin/sh)

View file

@ -1,4 +1,6 @@
(let [osc52 (require :osc52)]
(let [osc52 (require :osc52)
uname (vim.loop.os_uname)
clip-name :nifocClipboard]
(fn copy [lines _]
(-> lines
(table.concat "\n")
@ -7,8 +9,15 @@
(fn paste []
[(vim.fn.split (vim.fn.getreg "") "\n") (vim.fn.getregtype "")])
(set vim.g.clipboard {:name :osc52
:copy {:+ copy :* copy}
:paste {:+ paste :* paste}})
(if (= uname.sysname :Darwin)
(set vim.g.clipboard {:name clip-name
:copy {:+ copy :* copy}
:paste {:+ :pbpaste :* :pbpaste}
:cache_enabled 0})
;; Other OS
(set vim.g.clipboard {:name clip-name
:copy {:+ copy :* copy}
:paste {:+ paste :* paste}
:cache_enabled 0}))
(vim.opt.clipboard:prepend :unnamedplus))

View file

@ -47,12 +47,12 @@
};
nvim-osc52 = pkgs.vimUtils.buildVimPluginFrom2Nix {
pname = "nvim-osc52";
version = "2022-07-31";
version = "2022-08-03";
src = pkgs.fetchFromGitHub {
owner = "ojroques";
repo = "nvim-osc52";
rev = "0f25ebe9eb5050bb242e947c42134a851391a73e";
sha256 = "0csd7ymia5k9pqrq8fr12yykiw4ssm06gsbz63i6xsgpvgmwnpv7";
rev = "6428be94f9a10755bb797d1b2b3f2e41334d6908";
sha256 = "1h7v1licgaazk7hrql21p81vqk2gfw1pz2n37ma8sf6anmdp1mip";
fetchSubmodules = false;
};
};
@ -208,12 +208,12 @@
};
nvim-lspconfig = pkgs.vimUtils.buildVimPluginFrom2Nix {
pname = "nvim-lspconfig";
version = "2022-08-01";
version = "2022-08-03";
src = pkgs.fetchFromGitHub {
owner = "neovim";
repo = "nvim-lspconfig";
rev = "06744ba3783ce2d502838f988dec95378543f5d7";
sha256 = "1hlwxm97wri9w40m1d90j9spzs29mi5xjr7iw86dvhhs2pa8xln4";
rev = "4bec857a983f732009ad96ba4936d389a93fdc98";
sha256 = "0xa62xbj4zp9cswmx1ikwq0jw3glkn97ydd282vhl1r5fhjm06vw";
fetchSubmodules = false;
};
};