diff --git a/init.lua b/init.lua index 013fcc29..484d642b 100644 --- a/init.lua +++ b/init.lua @@ -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', '', '', { desc = 'Move focus to the right win vim.keymap.set('n', '', '', { desc = 'Move focus to the lower window' }) vim.keymap.set('n', '', '', { desc = 'Move focus to the upper window' }) +-- move lines vertically +vim.keymap.set('v', 'J', ":m '>+1gv=gv") +vim.keymap.set('v', 'K', ":m '<-2gv=gv") +vim.keymap.set('v', '', ":m '>+1gv=gv") +vim.keymap.set('v', '', ":m '<-2gv=gv") + +--keep focus in centre +vim.keymap.set('n', '', 'zz') +vim.keymap.set('n', '', 'zz') + +-- switch pwd to current file globally +vim.keymap.set('n', 'cd', ':lcd %:p:h') + +-- paste yanked over selection, havent quite figured this out +vim.keymap.set('x', 'p', '"_dP', { desc = 'EDIT: Paste over selection' }) + +-- delete into registry, will not be pasted from p +vim.keymap.set('n', 'd', '"_d') +vim.keymap.set('v', 'd', '"_d') + +-- This is going to get me cancelled +vim.keymap.set('i', '', '') +vim.keymap.set('i', ';;', '') + +--search and replace +vim.keymap.set('n', 's', ':%s/\\<\\>//gI') + +-- save update +vim.keymap.set('i', '', ':writegi') +vim.keymap.set('n', '', ':write') + -- [[ 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 - [''] = cmp.mapping.select_next_item(), + [''] = cmp.mapping.select_next_item(), -- Select the [p]revious item - [''] = cmp.mapping.select_prev_item(), + [''] = cmp.mapping.select_prev_item(), -- Scroll the documentation window [b]ack / [f]orward [''] = 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. - [''] = cmp.mapping.confirm { select = true }, + [''] = cmp.mapping.confirm { select = true }, -- Manually trigger a completion from nvim-cmp. -- Generally you don't need this, because nvim-cmp will display