nvim: keymappings/plugins: Add support for marks and registers

We drop vim-system-copy and will explicitly use registers when required.
Add nvim-peekup to help with registers and vim-signature for marks. Some
additional helper bindings for working with marks are added as well.
This commit is contained in:
Sanchayan Maity 2021-05-08 13:21:49 +05:30
parent 49c9fd9a2c
commit 2eea1feb69
3 changed files with 25 additions and 4 deletions

View file

@ -89,6 +89,9 @@ vim.g.vimtex_view_general_options = '--unique \\@pdf\\#src:@tex:@line:@col'
vim.g.toggle_list_no_mappings = 1
-- Enable rainbow brackets everywhere
vim.g.rainbow_active = 1
-- Needs to be set before nvim-peekup
vim.g.peekup_paste_before = '<Leader>P'
vim.g.peekup_paste_after = '<Leader>p'
-- Settings using nvim.api
-- Needs to be set before vim-sneak is loaded

View file

@ -121,5 +121,20 @@ remap('v', '<', '<gv', { noremap = true })
remap('v', '>', '>gv', { noremap = true })
-- Copy whole buffer
remap('', '<C-c><C-c>', ':norm gg0VG$cp<CR>', { noremap = false })
remap('i', '<C-c><C-c>', ':norm jkgg0VG$cp<CR>', { noremap = false })
remap('', '<C-c><C-c>', ':norm gg0VG$"*y<CR>', { noremap = false })
remap('i', '<C-c><C-c>', ':norm jkgg0VG$"*y<CR>', { noremap = false })
-- Marks
-- '0 - Position of cursor when last exited Vim.
-- '" - Position of cursor when last exited the current buffer.
-- '. - Position of last change.
-- '< & '> - Start/end of visual selection.
-- '[ & '] - Start/end of last change or yank.
-- '^ - Position of cursor when last Vim last left insert mode - This is how gi command works.
-- '' - Position before last jump (Super useful!). See :h ''.
-- Map gm to `. Instead of `a, hit gma. See :help mark-motions as to why we use backtick.
remap('n', 'gm', '`', { noremap = false })
-- Jump using marks to last change, left insert, jump.
remap('n', '<Leader>mc', ':norm `.<CR>', { noremap = true })
remap('n', '<Leader>mi', ':norm `^<CR>', { noremap = true })
remap('n', '<Leader>mj', ':norm `\'<CR>', { noremap = true })

View file

@ -95,8 +95,6 @@ local init = function ()
'liuchengxu/vim-which-key',
config = "require('modules.which_key')"
}
-- Clipboard
use 'christoomey/vim-system-copy'
-- Toggle terminal
use {
'voldikss/vim-floaterm',
@ -158,6 +156,11 @@ local init = function ()
config = "require('modules.statusline')",
requires = { 'kyazdani42/nvim-web-devicons' }
}
-- Marks and registers
use {
'kshenoy/vim-signature',
'gennaro-tedesco/nvim-peekup'
}
end
return require('packer').startup(init)