transfer key maps

This commit is contained in:
dave 2024-03-25 12:43:02 +00:00
parent dbba54cfd8
commit a827aa4410
1 changed files with 37 additions and 6 deletions

View File

@ -102,7 +102,7 @@ vim.g.have_nerd_font = false
vim.opt.number = true
-- You can also add relative line numbers, to help with jumping.
-- Experiment for yourself to see if you like it!
-- vim.opt.relativenumber = true
vim.opt.relativenumber = true
-- Enable mouse mode, can be useful for resizing splits for example!
vim.opt.mouse = 'a'
@ -190,6 +190,37 @@ vim.keymap.set('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right win
vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' })
vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' })
-- move lines vertically
vim.keymap.set('v', 'J', ":m '>+1<CR>gv=gv")
vim.keymap.set('v', 'K', ":m '<-2<CR>gv=gv")
vim.keymap.set('v', '<DOWN>', ":m '>+1<CR>gv=gv")
vim.keymap.set('v', '<UP>', ":m '<-2<CR>gv=gv")
--keep focus in centre
vim.keymap.set('n', '<C-d>', '<C-d>zz')
vim.keymap.set('n', '<C-e>', '<C-u>zz')
-- switch pwd to current file globally
vim.keymap.set('n', '<leader>cd', ':lcd %:p:h<CR>')
-- paste yanked over selection, havent quite figured this out
vim.keymap.set('x', '<leader>p', '"_dP', { desc = 'EDIT: Paste over selection' })
-- delete into registry, will not be pasted from p
vim.keymap.set('n', '<leader>d', '"_d')
vim.keymap.set('v', '<leader>d', '"_d')
-- This is going to get me cancelled
vim.keymap.set('i', '<C-c>', '<Esc>')
vim.keymap.set('i', ';;', '<Esc>')
--search and replace
vim.keymap.set('n', '<leader>s', ':%s/\\<<C-r><C-w>\\>/<C-r><C-w>/gI<Left><Left><Left>')
-- save update
vim.keymap.set('i', '<C-x><C-s>', '<Esc>:write<CR>gi')
vim.keymap.set('n', '<C-x><C-s>', ':write<CR>')
-- [[ Basic Autocommands ]]
-- See `:help lua-guide-autocommands`
@ -539,9 +570,9 @@ require('lazy').setup({
-- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
local servers = {
-- clangd = {},
-- gopls = {},
gopls = {},
-- pyright = {},
-- rust_analyzer = {},
rust_analyzer = {},
-- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
--
-- Some languages (like typescript) have entire language plugins that can be useful:
@ -680,9 +711,9 @@ require('lazy').setup({
-- No, but seriously. Please read `:help ins-completion`, it is really good!
mapping = cmp.mapping.preset.insert {
-- Select the [n]ext item
['<C-n>'] = cmp.mapping.select_next_item(),
['<C-x>'] = cmp.mapping.select_next_item(),
-- Select the [p]revious item
['<C-p>'] = cmp.mapping.select_prev_item(),
['<C-s>'] = cmp.mapping.select_prev_item(),
-- Scroll the documentation window [b]ack / [f]orward
['<C-b>'] = cmp.mapping.scroll_docs(-4),
@ -691,7 +722,7 @@ require('lazy').setup({
-- Accept ([y]es) the completion.
-- This will auto-import if your LSP supports it.
-- This will expand snippets if the LSP sent a snippet.
['<C-y>'] = cmp.mapping.confirm { select = true },
['<C-d>'] = cmp.mapping.confirm { select = true },
-- Manually trigger a completion from nvim-cmp.
-- Generally you don't need this, because nvim-cmp will display