feat: `:CopyFilepathWithTilde` (#34)
parent
b045df8264
commit
d057d47164
24
README.md
24
README.md
|
|
@ -92,25 +92,21 @@ The following applies to all commands above:
|
||||||
subdirectory, creating any non-existing folders.
|
subdirectory, creating any non-existing folders.
|
||||||
|
|
||||||
### File Utility Commands
|
### File Utility Commands
|
||||||
- `.copyFilename` or `:CopyFilename`: Copy the file name. When
|
- `.copyFilename` or `:CopyFilename`: Copy the file name.
|
||||||
`clipboard="unnamed[plus]"` has been set, copies to the `+` register, otherwise
|
- `.copyFilepath` or `:CopyFilepath`: Copy the absolute file path.
|
||||||
to `"`.
|
- `.copyFilepathWithTilde` or `:CopyFilepathWithTilde`: Copy the absolute file
|
||||||
- `.copyFilepath` or `:CopyFilepath`: Copy the absolute file path. When
|
path, replacing the home directory with `~`.
|
||||||
`clipboard="unnamed[plus]"` has been set, copies to the `+` register, otherwise
|
- `.copyRelativePath` or `:CopyRelativePath`: Copy the relative file path.
|
||||||
to `"`.
|
|
||||||
- `.copyRelativePath` or `:CopyRelativePath`: Copy the relative file path. When
|
|
||||||
`clipboard="unnamed[plus]"` has been set, copies to the `+` register, otherwise
|
|
||||||
to `"`.
|
|
||||||
- `.copyDirectoryPath` or `:CopyDirectoryPath`: Copy the absolute directory
|
- `.copyDirectoryPath` or `:CopyDirectoryPath`: Copy the absolute directory
|
||||||
path. When `clipboard="unnamed[plus]"` has been set, copies to the `+` register,
|
path.
|
||||||
otherwise to `"`.
|
|
||||||
- `.copyRelativeDirectoryPath` or `:CopyRelativeDirectoryPath`: Copy the
|
- `.copyRelativeDirectoryPath` or `:CopyRelativeDirectoryPath`: Copy the
|
||||||
relative directory path. When `clipboard="unnamed[plus]"` has been set, copies
|
relative directory path.
|
||||||
to the `+` register, otherwise to `"`.
|
|
||||||
- `.chmodx` or `:Chmodx`: Makes current file executable. Equivalent to `chmod
|
- `.chmodx` or `:Chmodx`: Makes current file executable. Equivalent to `chmod
|
||||||
+x`.
|
+x`.
|
||||||
|
|
||||||
To always use system clipboard put this in your configuration file:
|
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
|
```lua
|
||||||
-- lua
|
-- lua
|
||||||
|
|
|
||||||
|
|
@ -190,12 +190,15 @@ local function copyOp(expandOperation)
|
||||||
vim.notify(toCopy, vim.log.levels.INFO, { title = "Copied" })
|
vim.notify(toCopy, vim.log.levels.INFO, { title = "Copied" })
|
||||||
end
|
end
|
||||||
|
|
||||||
-- DOCS for the available modifiers: https://neovim.io/doc/user/builtin.html#expand()
|
-- DOCS for the modifiers
|
||||||
|
-- https://neovim.io/doc/user/builtin.html#expand()
|
||||||
|
-- https://neovim.io/doc/user/cmdline.html#filename-modifiers
|
||||||
function M.copyFilepath() copyOp("%:p") end
|
function M.copyFilepath() copyOp("%:p") end
|
||||||
|
function M.copyFilepathWithTilde() copyOp("%:~") end
|
||||||
function M.copyFilename() copyOp("%:t") end
|
function M.copyFilename() copyOp("%:t") end
|
||||||
function M.copyRelativePath() copyOp("%:~:.") end
|
function M.copyRelativePath() copyOp("%:.") end
|
||||||
function M.copyDirectoryPath() copyOp("%:p:h") end
|
function M.copyDirectoryPath() copyOp("%:p:h") end
|
||||||
function M.copyRelativeDirectoryPath() copyOp("%:~:.:h") end
|
function M.copyRelativeDirectoryPath() copyOp("%:.:h") end
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ command("Move", function() genghis.moveAndRenameFile() end, {})
|
||||||
command("MoveToFolderInCwd", function() genghis.moveToFolderInCwd() end, {})
|
command("MoveToFolderInCwd", function() genghis.moveToFolderInCwd() end, {})
|
||||||
command("CopyFilename", function() genghis.copyFilename() end, {})
|
command("CopyFilename", function() genghis.copyFilename() end, {})
|
||||||
command("CopyFilepath", function() genghis.copyFilepath() end, {})
|
command("CopyFilepath", function() genghis.copyFilepath() end, {})
|
||||||
|
command("copyFilepathWithTilde", function() genghis.copyFilepathWithTilde() end, {})
|
||||||
command("CopyRelativePath", function() genghis.copyRelativePath() end, {})
|
command("CopyRelativePath", function() genghis.copyRelativePath() end, {})
|
||||||
command("CopyDirectoryPath", function() genghis.copyDirectoryPath() end, {})
|
command("CopyDirectoryPath", function() genghis.copyDirectoryPath() end, {})
|
||||||
command("CopyRelativeDirectoryPath", function() genghis.copyRelativeDirectoryPath() end, {})
|
command("CopyRelativeDirectoryPath", function() genghis.copyRelativeDirectoryPath() end, {})
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue