mirror of
https://github.com/Baipyrus/nvim-config.git
synced 2024-11-09 11:13:49 +00:00
Added lua/keymaps.lua
This commit is contained in:
parent
7070190fa9
commit
79e010e681
28
init.lua
28
init.lua
@ -53,26 +53,8 @@ require('lazy-plugins')
|
|||||||
-- Set options
|
-- Set options
|
||||||
require('options')
|
require('options')
|
||||||
|
|
||||||
-- [[ Basic Keymaps ]]
|
-- Configure keymaps
|
||||||
|
require('keymaps')
|
||||||
-- 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 })
|
|
||||||
|
|
||||||
-- [[ Highlight on yank ]]
|
|
||||||
-- See `:help vim.highlight.on_yank()`
|
|
||||||
local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true })
|
|
||||||
vim.api.nvim_create_autocmd('TextYankPost', {
|
|
||||||
callback = function()
|
|
||||||
vim.highlight.on_yank()
|
|
||||||
end,
|
|
||||||
group = highlight_group,
|
|
||||||
pattern = '*',
|
|
||||||
})
|
|
||||||
|
|
||||||
-- [[ Configure Telescope ]]
|
-- [[ Configure Telescope ]]
|
||||||
-- See `:help telescope` and `:help telescope.setup()`
|
-- See `:help telescope` and `:help telescope.setup()`
|
||||||
@ -178,12 +160,6 @@ vim.defer_fn(function()
|
|||||||
}
|
}
|
||||||
end, 0)
|
end, 0)
|
||||||
|
|
||||||
-- 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' })
|
|
||||||
|
|
||||||
-- [[ Configure LSP ]]
|
-- [[ Configure LSP ]]
|
||||||
-- This function gets run when an LSP connects to a particular buffer.
|
-- This function gets run when an LSP connects to a particular buffer.
|
||||||
local on_attach = function(_, bufnr)
|
local on_attach = function(_, bufnr)
|
||||||
|
28
lua/keymaps.lua
Normal file
28
lua/keymaps.lua
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
-- [[ Basic Keymaps ]]
|
||||||
|
|
||||||
|
-- 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 })
|
||||||
|
|
||||||
|
-- [[ Highlight on yank ]]
|
||||||
|
-- See `:help vim.highlight.on_yank()`
|
||||||
|
local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true })
|
||||||
|
vim.api.nvim_create_autocmd('TextYankPost', {
|
||||||
|
callback = function()
|
||||||
|
vim.highlight.on_yank()
|
||||||
|
end,
|
||||||
|
group = highlight_group,
|
||||||
|
pattern = '*',
|
||||||
|
})
|
||||||
|
|
||||||
|
-- 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: ts=2 sts=2 sw=2 et
|
Loading…
Reference in New Issue
Block a user