nvim-config-kickstart/lua/mappings.lua

33 lines
1.6 KiB
Lua

local map_list = {
["w|"] = ":vsplit", ["w-"] = ":split", -- w| / w- pour créer des splits verticaux et horizontaux
["gi"] = ":bprevious", ["ge"] = ":bnext",
["W"] = ":w", ["<C-t>"] = ":tabnew",
}
for key, binding in pairs(map_list) do
vim.api.nvim_set_keymap("n", key, binding .. "<CR>", {noremap = true, silent = true})
end
-- spelling maps
vim.api.nvim_set_keymap("n", "<Leader>s", "mz[s1z=`z", {noremap = true, silent = true})
vim.api.nvim_set_keymap("n", "à", "]s", {noremap = true, silent = true})
-- [[ kickstart.nvim ]]
-- Keymaps for better default experience
-- See `:help vim.keymap.set()`
vim.keymap.set({ 'n', 'v' }, '<Space>', '<Nop>', { silent = true })
-- Remap for dealing with word wrap
vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
-- Diagnostic keymaps
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous diagnostic message' })
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnostic message' })
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' })
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' })
vim.api.nvim_set_keymap("n", "<Leader>y", '"+y', {noremap = true, silent = true})
vim.api.nvim_set_keymap("v", "<Leader>y", '"+y', {noremap = true, silent = true})
vim.api.nvim_set_keymap("n", "<Leader>pp", '"+p', {noremap = true, silent = true})
vim.api.nvim_set_keymap("v", "<Leader>pp", '"+p', {noremap = true, silent = true})