improv: path-copying commands now always copy to system clipboard

remotes/origin/HEAD
Chris Grieser 2024-06-19 12:44:45 +02:00
parent 01b1d297b0
commit dda24ddca2
2 changed files with 3 additions and 14 deletions

View File

@ -105,13 +105,7 @@ to the trash location.
- `.copyRelativeDirectoryPath` or `:CopyRelativeDirectoryPath`: Copy the
relative directory path.
When `clipboard="unnamed[plus]"` has been set, copies to the `+` register,
otherwise to `"`. To always use system clipboard, put this in your configuration
file:
```lua
vim.g.genghis_use_systemclipboard = true
```
All commands use the system clipboard.
### Disable Ex-Commands

View File

@ -194,14 +194,9 @@ end
---copying file information
---@param expandOperation string
local function copyOp(expandOperation)
local reg = '"'
local clipboardOpt = vim.opt.clipboard:get()
local useSystemClipb = vim.g.genghis_use_systemclipboard
or (#clipboardOpt > 0 and clipboardOpt[1]:find("unnamed"))
if useSystemClipb then reg = "+" end
local register = "+"
local toCopy = fn.expand(expandOperation)
fn.setreg(reg, toCopy)
fn.setreg(register, toCopy)
vim.notify(toCopy, vim.log.levels.INFO, { title = "Copied" })
end