feat: Add copy_del and copy_cut options to config

This commit is contained in:
Akianonymus 2021-08-23 01:10:31 +05:30 committed by siduck76
parent 49216a9c93
commit 1b2ec94b75
3 changed files with 14 additions and 6 deletions

View File

@ -41,6 +41,8 @@ M.ui.plugin = {
M.options = { M.options = {
clipboard = "unnamedplus", clipboard = "unnamedplus",
cmdheight = 1, cmdheight = 1,
copy_cut = true, -- copy cut text ( x key ), visual and normal mode
copy_del = true, -- copy deleted text ( dd key ), visual and normal mode
expandtab = true, expandtab = true,
hidden = true, hidden = true,
ignorecase = true, ignorecase = true,

View File

@ -13,12 +13,6 @@ local M = {}
-- these mappings will only be called during initialization -- these mappings will only be called during initialization
M.misc = function() M.misc = function()
local function non_config_mappings() local function non_config_mappings()
-- dont copy any deleted text , this is disabled by default so uncomment the below mappings if you want them
-- map("n", "dd", [=[ "_dd ]=])
-- map("v", "dd", [=[ "_dd ]=])
-- map("v", "x", [=[ "_x ]=])
-- todo: this should be configurable via chadrc
-- Don't copy the replaced text after pasting in visual mode -- Don't copy the replaced text after pasting in visual mode
map("v", "p", '"_dP') map("v", "p", '"_dP')
@ -35,6 +29,16 @@ M.misc = function()
end end
local function optional_mappings() local function optional_mappings()
-- don't yank text on cut ( x )
if not config.options.copy_cut then
map({ "n", "v" }, "x", '"_x')
end
-- don't yank text on delete ( dd )
if not config.options.copy_del then
map({ "n", "v" }, "dd", '"_dd')
end
-- navigation within insert mode -- navigation within insert mode
if config.options.insert_nav then if config.options.insert_nav then
local inav = maps.insert_nav local inav = maps.insert_nav

View File

@ -45,6 +45,8 @@ M.ui.plugin = {
M.options = { M.options = {
clipboard = "unnamedplus", clipboard = "unnamedplus",
cmdheight = 1, cmdheight = 1,
copy_cut = true, -- copy cut text ( x key ), visual and normal mode
copy_del = true, -- copy deleted text ( dd key ), visual and normal mode
expandtab = true, expandtab = true,
hidden = true, hidden = true,
ignorecase = true, ignorecase = true,