2022-08-03 16:04:23 +00:00
|
|
|
(let [osc52 (require :osc52)
|
|
|
|
uname (vim.loop.os_uname)
|
|
|
|
clip-name :nifocClipboard]
|
2022-09-26 13:54:38 +00:00
|
|
|
(osc52.setup {:silent true})
|
|
|
|
|
2022-08-02 20:50:56 +00:00
|
|
|
(fn copy [lines _]
|
|
|
|
(-> lines
|
|
|
|
(table.concat "\n")
|
|
|
|
(osc52.copy)))
|
|
|
|
|
|
|
|
(fn paste []
|
|
|
|
[(vim.fn.split (vim.fn.getreg "") "\n") (vim.fn.getregtype "")])
|
|
|
|
|
2022-08-03 16:04:23 +00:00
|
|
|
(if (= uname.sysname :Darwin)
|
|
|
|
(set vim.g.clipboard {:name clip-name
|
2023-01-01 23:30:54 +00:00
|
|
|
:copy {:+ :pbcopy :* :pbcopy}
|
2022-08-03 16:04:23 +00:00
|
|
|
:paste {:+ :pbpaste :* :pbpaste}
|
|
|
|
:cache_enabled 0})
|
|
|
|
;; Other OS
|
|
|
|
(set vim.g.clipboard {:name clip-name
|
|
|
|
:copy {:+ copy :* copy}
|
|
|
|
:paste {:+ paste :* paste}
|
|
|
|
:cache_enabled 0}))
|
2022-08-02 20:50:56 +00:00
|
|
|
(vim.opt.clipboard:prepend :unnamedplus))
|
|
|
|
|