2022-08-07 21:00:11 +08:00
|
|
|
local map = vim.api.nvim_set_keymap
|
|
|
|
|
2023-10-13 20:04:56 +08:00
|
|
|
-- vscode
|
|
|
|
if vim.g.vscode then
|
2023-11-11 10:22:57 +08:00
|
|
|
-- undo/REDO via vscode
|
|
|
|
map("n", "u", "<Cmd>call VSCodeNotify('undo')<CR>", {})
|
|
|
|
map("n", "<C-r>", "<Cmd>call VSCodeNotify('redo')<CR>", {})
|
|
|
|
map("n", "gf", "<Cmd>call VSCodeCall('editor.action.openLink')<CR>", { silent = true, noremap = true })
|
2023-10-13 20:04:56 +08:00
|
|
|
end
|
|
|
|
|
2021-09-07 23:26:21 +08:00
|
|
|
-- generic mappings
|
2022-09-16 17:36:17 +08:00
|
|
|
map('v', '<', '<gv', { noremap = true })
|
|
|
|
map('v', '>', '>gv', { noremap = true })
|
|
|
|
map('n', 'Y', 'y$', { noremap = true })
|
|
|
|
map('n', 'n', 'nzzzv', { noremap = true })
|
|
|
|
map('n', 'N', 'Nzzzv', { noremap = true })
|
2022-08-07 21:00:11 +08:00
|
|
|
|
2021-09-07 23:26:21 +08:00
|
|
|
-- Shortcutting split navigation
|
2022-08-07 21:00:11 +08:00
|
|
|
map('', '<A-h>', '<C-w>h', {})
|
|
|
|
map('', '<A-j>', '<C-w>j', {})
|
|
|
|
map('', '<A-k>', '<C-w>k', {})
|
|
|
|
map('', '<A-l>', '<C-w>l', {})
|
|
|
|
map('', '<A-H>', '<C-w>H', {})
|
|
|
|
map('', '<A-J>', '<C-w>J', {})
|
|
|
|
map('', '<A-K>', '<C-w>K', {})
|
|
|
|
map('', '<A-L>', '<C-w>L', {})
|
2022-08-07 22:57:52 +08:00
|
|
|
map('', '<M-S-.>', '<C-w>>', {})
|
|
|
|
map('', '<M-S-,>', '<C-w><', {})
|
|
|
|
map('', '<M-S-=>', '<C-w>+', {})
|
|
|
|
map('', '<M-->', '<C-w>-', {})
|
2022-08-07 21:00:11 +08:00
|
|
|
map('', '<A-T>', '<C-w>T', {})
|
|
|
|
|
2021-09-07 23:26:21 +08:00
|
|
|
-- undo to the last , . or !
|
2022-09-16 17:36:17 +08:00
|
|
|
map('i', ',', ',<c-g>u', { noremap = true })
|
|
|
|
map('i', '.', '.<c-g>u', { noremap = true })
|
|
|
|
map('i', '!', '!<c-g>u', { noremap = true })
|
|
|
|
map('i', '?', '?<c-g>u', { noremap = true })
|
2021-09-15 15:18:15 +08:00
|
|
|
|
|
|
|
-- plugin mappings
|
2021-11-01 19:29:14 +08:00
|
|
|
-- gitsigns
|
2022-09-16 17:36:17 +08:00
|
|
|
map('', '<leader>gs', ':Gitsigns toggle_signs<cr>', { silent = true })
|
2021-11-13 15:29:17 +08:00
|
|
|
-- toggle tagbar
|
2022-09-16 17:36:17 +08:00
|
|
|
map('', '<leader>tt', ':TagbarToggle<cr>', { silent = true })
|
2022-08-07 21:00:11 +08:00
|
|
|
|
2021-11-13 15:29:17 +08:00
|
|
|
-- toggle Hop
|
2022-09-16 17:36:17 +08:00
|
|
|
map('', '<leader>b', ':HopWordBC<cr>', { silent = true })
|
|
|
|
map('', '<leader>w', ':HopWordAC<cr>', { silent = true })
|
|
|
|
map('', '<leader>l', ':HopWordCurrentLine<cr>', { silent = true })
|
2022-08-07 21:00:11 +08:00
|
|
|
|
2021-11-13 15:29:17 +08:00
|
|
|
-- telescope stuff
|
2023-03-09 17:25:09 +08:00
|
|
|
map('', '<leader>fd', ':Telescope fd<cr>', { silent = true })
|
2022-09-16 17:36:17 +08:00
|
|
|
map('', '<leader>tb', ':Telescope buffers<cr>', { silent = true })
|