From e0032621173871c346fdef57362f0ab86a2d5c65 Mon Sep 17 00:00:00 2001 From: Chris Date: Mon, 4 Dec 2023 21:39:22 +0100 Subject: [PATCH] Adds personal plugins and config --- init.lua | 44 ++++++++++++++++++++++++++++++++++++++------ 1 file changed, 38 insertions(+), 6 deletions(-) diff --git a/init.lua b/init.lua index 36cc9a52..27452ba9 100644 --- a/init.lua +++ b/init.lua @@ -112,7 +112,7 @@ require('lazy').setup({ }, -- Useful plugin to show you pending keybinds. - { 'folke/which-key.nvim', opts = {} }, + { 'folke/which-key.nvim', opts = {} }, { -- Adds git related signs to the gutter, as well as utilities for managing changes 'lewis6991/gitsigns.nvim', @@ -190,10 +190,10 @@ require('lazy').setup({ { -- Theme inspired by Atom - 'navarasu/onedark.nvim', + 'rebelot/kanagawa.nvim', priority = 1000, config = function() - vim.cmd.colorscheme 'onedark' + vim.cmd.colorscheme 'kanagawa' end, }, @@ -252,6 +252,23 @@ require('lazy').setup({ }, build = ':TSUpdate', }, + { + "gbprod/substitute.nvim", + opts = { + + } + }, + { + "kylechui/nvim-surround", + version = "*", -- Use for stability; omit to use `main` branch for the latest features + event = "VeryLazy", + config = function() + require("nvim-surround").setup({ + -- Configuration here, or leave empty to use defaults + }) + end + } + -- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart -- These are some example plugins that I've included in the kickstart repository. @@ -276,7 +293,7 @@ require('lazy').setup({ vim.o.hlsearch = false -- Make line numbers default -vim.wo.number = true +vim.wo.rnu = true -- Enable mouse mode vim.o.mouse = 'a' @@ -284,7 +301,7 @@ vim.o.mouse = 'a' -- Sync clipboard between OS and Neovim. -- Remove this option if you want your OS clipboard to remain independent. -- See `:help 'clipboard'` -vim.o.clipboard = 'unnamedplus' +-- vim.o.clipboard = 'unnamedplus' -- Enable break indent vim.o.breakindent = true @@ -314,6 +331,7 @@ vim.o.termguicolors = true -- Keymaps for better default experience -- See `:help vim.keymap.set()` vim.keymap.set({ 'n', 'v' }, '', '', { silent = true }) +vim.keymap.set('i', 'jk', "") -- Remap for dealing with word wrap vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true }) @@ -325,6 +343,20 @@ vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnos vim.keymap.set('n', 'e', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' }) vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' }) +-- [[ substitute ]] + +vim.keymap.set("n", "gr", require('substitute').operator, { noremap = true }) +vim.keymap.set("n", "grr", require('substitute').line, { noremap = true }) +vim.keymap.set("x", "gr", require('substitute').visual, { noremap = true }) + +-- [[ clipboad ]] +vim.keymap.set({ "n", "v" }, "y", '"+y') +vim.keymap.set({ "n", "v" }, "p", '"+p') +vim.keymap.set({ "n", "v" }, "gr", function() require('substitute').operator({ register = "+" }) end, + { noremap = true }) +vim.keymap.set({ "n", "v" }, "grr", function() require('substitute').line({ register = "+" }) end, + { noremap = true }) + -- [[ Highlight on yank ]] -- See `:help vim.highlight.on_yank()` local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true }) @@ -506,7 +538,7 @@ local on_attach = function(_, bufnr) nmap('ca', vim.lsp.buf.code_action, '[C]ode [A]ction') nmap('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition') - nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') + nmap('gR', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') nmap('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation') nmap('D', require('telescope.builtin').lsp_type_definitions, 'Type [D]efinition') nmap('ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')