init.lua: move mappings to lua/mappings.lua

This commit is contained in:
Fabrice Mouhartem 2023-12-24 11:26:30 +01:00
parent 686b31c6e0
commit c0c294c4c8
2 changed files with 20 additions and 20 deletions

View File

@ -33,21 +33,7 @@ require('lazy-config')
-- [[ Setting options ]] -- [[ Setting options ]]
require('general-options') require('general-options')
-- [[ Basic Keymaps ]] -- [[ Basic Keymaps ]]
require('mappings')
-- 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' })
-- [[ Highlight on yank ]] -- [[ Highlight on yank ]]
-- See `:help vim.highlight.on_yank()` -- See `:help vim.highlight.on_yank()`
local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true }) local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true })
@ -381,7 +367,6 @@ cmp.setup {
-- Personnalisation -- Personnalisation
require('bepo') require('bepo')
require('mappings')
require('restore-position') require('restore-position')
-- The line beneath this is called `modeline`. See `:help modeline` -- The line beneath this is called `modeline`. See `:help modeline`

View File

@ -7,7 +7,22 @@ for key, binding in pairs(map_list) do
vim.api.nvim_set_keymap("n", key, binding .. "<CR>", {noremap = true, silent = true}) vim.api.nvim_set_keymap("n", key, binding .. "<CR>", {noremap = true, silent = true})
end end
-- vim.api.nvim_set_keymap("n", "<Leader>y", '"+y', {noremap = true, silent = true}) -- [[ kickstart.nvim ]]
-- vim.api.nvim_set_keymap("v", "<Leader>y", '"+y', {noremap = true, silent = true}) -- Keymaps for better default experience
-- vim.api.nvim_set_keymap("n", "<Leader>pp", '"+p', {noremap = true, silent = true}) -- See `:help vim.keymap.set()`
-- vim.api.nvim_set_keymap("v", "<Leader>pp", '"+p', {noremap = true, silent = true}) 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})