.dotfiles/nvim/lua/mappings.lua
2023-06-16 01:50:23 +02:00

29 lines
982 B
Lua

-- search for visual selection
vim.keymap.set('v', '//', 'y/<C-R>"<CR>')
vim.keymap.set('n', 'H', '^')
-- ex command
vim.keymap.set('c', '<C-p>', '<Up>')
vim.keymap.set('c', '<C-n>', '<Down>')
-- auto expand brackets
vim.keymap.set('i', '(;', '(<CR>)<C-c>O')
vim.keymap.set('i', '(,', '(<CR>),<C-c>O')
vim.keymap.set('i', '{;', '{<CR>}<C-c>O')
vim.keymap.set('i', '{,', '{<CR>},<C-c>O')
vim.keymap.set('i', '[;', '[<CR>]<C-c>O')
vim.keymap.set('i', '[,', '[<CR>],<C-c>O')
-- toggle hybrid mode
vim.keymap.set('n', '<leader>h', ':set rnu!<CR>')
-- Telescope
vim.keymap.set('n', '<C-y>', '<cmd>Telescope buffers<CR>')
vim.keymap.set('n', '<leader>f', '<cmd>Telescope find_files<CR>')
vim.keymap.set('n', '<leader>l', '<cmd>Telescope live_grep<CR>')
vim.keymap.set('n', '<silent> gy', '<cmd>Telescope treesitter<CR>')
-- spelling
vim.keymap.set('n', '<silent> <leader>se', ':set spell spelllang=en<CR>')
vim.keymap.set('n', '<silent> <leader>sd', ':set spell spelllang=de<CR>')