2023-12-23 23:02:02 +00:00
|
|
|
local map_list = {
|
2024-04-03 10:48:21 +00:00
|
|
|
-- ["w|"] = ":vsplit", ["w-"] = ":split", -- w| / w- pour créer des splits verticaux et horizontaux
|
|
|
|
-- ["ge"] = ":bprevious", ["gn"] = ":bnext",
|
2024-11-10 14:38:47 +00:00
|
|
|
["W"] = ":w",
|
|
|
|
["<C-t>"] = ":tabnew",
|
2023-12-23 23:02:02 +00:00
|
|
|
}
|
2023-12-24 21:08:52 +00:00
|
|
|
|
|
|
|
local keymap = vim.keymap.set
|
|
|
|
|
2023-12-23 23:02:02 +00:00
|
|
|
for key, binding in pairs(map_list) do
|
2023-12-25 13:29:10 +00:00
|
|
|
keymap("n", key, binding .. "<CR>", { noremap = true, silent = true })
|
2023-12-23 23:02:02 +00:00
|
|
|
end
|
|
|
|
|
2023-12-24 10:26:30 +00:00
|
|
|
-- [[ kickstart.nvim ]]
|
|
|
|
-- Keymaps for better default experience
|
2023-12-24 21:08:52 +00:00
|
|
|
-- See `:help remap()`
|
|
|
|
keymap({ 'n', 'v' }, '<Space>', '<Nop>', { silent = true })
|
2023-12-24 10:26:30 +00:00
|
|
|
|
|
|
|
-- Remap for dealing with word wrap
|
2023-12-24 21:08:52 +00:00
|
|
|
keymap('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
|
|
|
|
keymap('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
|
2023-12-24 10:26:30 +00:00
|
|
|
|
|
|
|
-- Diagnostic keymaps
|
2023-12-24 21:08:52 +00:00
|
|
|
keymap('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous diagnostic message' })
|
|
|
|
keymap('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnostic message' })
|
|
|
|
keymap('n', '<leader>e', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' })
|
|
|
|
keymap('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' })
|
2023-12-24 10:26:30 +00:00
|
|
|
|
2023-12-25 13:29:10 +00:00
|
|
|
keymap({ "n", "v" }, "<Leader>y", '"+y', { noremap = true, silent = true, desc = "[Y]ank to system clipboard" })
|
|
|
|
keymap({ "n", "v" }, "<Leader>p", '"+p', { noremap = true, silent = true, desc = "[P]ast from system clipboard" })
|
2023-12-24 18:17:20 +00:00
|
|
|
|
|
|
|
-- z0…z9 to open folds to a certain level
|
2023-12-25 13:29:10 +00:00
|
|
|
for i = 0, 9 do
|
|
|
|
keymap('n', 'z' .. i, ':set fdl=' .. i .. '<CR>', { noremap = true, silent = false })
|
2023-12-24 18:17:20 +00:00
|
|
|
end
|
2023-12-24 21:08:52 +00:00
|
|
|
|
|
|
|
-- in :terminal esc exits edit mode
|
2023-12-25 13:29:10 +00:00
|
|
|
keymap('t', '<Esc>', '<C-\\><C-n>', { noremap = true, silent = true })
|
2024-11-29 10:43:01 +00:00
|
|
|
|
|
|
|
-- Markdown scratchpads
|
|
|
|
require('which-key').add({
|
|
|
|
{ "<leader>m", group = "[M]arkdown" },
|
|
|
|
{ "<leader>m_", hidden = "true" }
|
|
|
|
})
|
|
|
|
|
|
|
|
keymap('n', '<leader>mn', ':e ~/tmp/scratchpad.md<CR>', { desc = '[M]arkdown [N]ew', noremap = true, silent = true })
|
|
|
|
keymap('n', '<leader>me', ':e ~/tmp/scratchpad-fr.md<CR>', { desc = '[M]arkdown new Fr[e]nch', noremap = true, silent = true })
|