forked from davidosomething/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ssh clipboard tweaking see davidosomething#580
- Loading branch information
1 parent
0337b55
commit 1aecdb4
Showing
1 changed file
with
23 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,34 @@ | ||
local smallcaps = require('dko.utils.string').smallcaps | ||
|
||
-- neovim supports built-in osc52 as of | ||
-- https://github.com/neovim/neovim/pull/25872/files | ||
-- and it is used if we are on a remote connection by default as of | ||
-- https://github.com/neovim/neovim/pull/26064/files | ||
-- When NOT being used, prefer unnamedplus (system) clipboard | ||
-- | ||
-- BUT i'm gonna *force* using it and the unnamedplus | ||
if require("dko.utils.clipboard").should_use_osc52() then | ||
if vim.g.clipboard then | ||
-- already using a plugin? | ||
return | ||
end | ||
-- else it should automatically use OSC 52 according to :h clipboard-osc52 | ||
-- BUT for docker exec shells we need to manually enable | ||
-- Not working | ||
-- if require("dko.utils.vte").is_docker_exec() then | ||
-- vim.g.clipboard = { | ||
-- name = "OSC 52 (docker)", | ||
-- copy = { | ||
-- ["+"] = require("vim.ui.clipboard.osc52").copy("+"), | ||
-- ["*"] = require("vim.ui.clipboard.osc52").copy("*"), | ||
-- }, | ||
-- paste = { | ||
-- ["+"] = require("vim.ui.clipboard.osc52").paste("+"), | ||
-- ["*"] = require("vim.ui.clipboard.osc52").paste("*"), | ||
-- }, | ||
-- } | ||
-- end | ||
else | ||
|
||
local tag = vim.env.SSH_TTY and " (" ..smallcaps("ssh")..")" or "" | ||
|
||
-- neovim automatically does this as long as 'clipboard' is not set | ||
vim.g.clipboard = { | ||
name = (smallcaps("osc") .. "52%s"):format(tag), | ||
copy = { | ||
["+"] = require("vim.ui.clipboard.osc52").copy("+"), | ||
["*"] = require("vim.ui.clipboard.osc52").copy("*"), | ||
}, | ||
-- wezterm no paste support yet | ||
-- https://github.com/wez/wezterm/issues/2050 | ||
-- paste = { | ||
-- ["+"] = require("vim.ui.clipboard.osc52").paste("+"), | ||
-- ["*"] = require("vim.ui.clipboard.osc52").paste("*"), | ||
-- }, | ||
} | ||
|
||
-- add this now | ||
vim.o.clipboard = "unnamedplus" | ||
end |