diff --git a/init.lua b/init.lua index bf434bb..0f5db1e 100644 --- a/init.lua +++ b/init.lua @@ -22,10 +22,7 @@ vim.opt.termguicolors = true -- Theme require('onedark').load() --- neodev -require("neodev").setup({}) - - +-- TODO: Needs to be moved to its own file -- Mason require('mason-config') lspconfig = require "lspconfig" @@ -41,25 +38,7 @@ lspconfig.lua_ls.setup { } } lspconfig.rust_analyzer.setup {} -lspconfig.clangd.setup { - on_attach = function(client, bufnr) - navic.attach(client, bufnr) - end -} - --- conform -require("conform").setup({ - formatters_by_ft = { - lua = { "stylua" }, - -- Conform will run multiple formatters sequentially - python = { "isort", "black" }, - -- Use a sub-list to run only the first available formatter - javascript = { { "prettierd", "prettier" } }, - }, -}) - --- Telescope -require("telescope").load_extension "file_browser" +lspconfig.clangd.setup {} -- General vim.opt.number = true diff --git a/lazy-lock.json b/lazy-lock.json index f8810a2..724328a 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -25,6 +25,7 @@ "guihua.lua": { "branch": "master", "commit": "9fb6795474918b492d9ab01b1ebaf85e8bf6fe0b" }, "gx.nvim": { "branch": "main", "commit": "78070bbd8e7e15a1623cdd6832a9529d2ee63e0c" }, "harpoon": { "branch": "master", "commit": "ccae1b9bec717ae284906b0bf83d720e59d12b91" }, + "hlsearch.nvim": { "branch": "main", "commit": "fdeb60b890d15d9194e8600042e5232ef8c29b0e" }, "hop.nvim": { "branch": "master", "commit": "6d853addd6e11df8338b26e869a29b36f2c3e893" }, "inc-rename.nvim": { "branch": "main", "commit": "e346532860e1896b1085815e854ed14e2f066a2c" }, "indent-blankline.nvim": { "branch": "master", "commit": "5da5546947f3125dfd6aa85ab21074dc83f776d5" }, @@ -36,6 +37,7 @@ "mason-lspconfig.nvim": { "branch": "main", "commit": "56e435e09f8729af2d41973e81a0db440f8fe9c9" }, "mason.nvim": { "branch": "main", "commit": "41e75af1f578e55ba050c863587cffde3556ffa6" }, "maximize.nvim": { "branch": "master", "commit": "97bfc171775c404396f8248776347ebe64474fe7" }, + "move.nvim": { "branch": "main", "commit": "cccbd4ea9049ca5f99f025ffaddb7392359c7d6a" }, "neo-tree.nvim": { "branch": "v3.x", "commit": "7aad1bf3f6b849cbf108e02c55ad4d701cb4d33a" }, "neodev.nvim": { "branch": "main", "commit": "029899ea32d3dc8ed8c910ceca2ee5d16e566c11" }, "neogit": { "branch": "master", "commit": "e02121f5aad420dc16411a6cde59879230f9d5b9" }, @@ -44,6 +46,8 @@ "nvim-cmp": { "branch": "main", "commit": "538e37ba87284942c1d76ed38dd497e54e65b891" }, "nvim-lspconfig": { "branch": "master", "commit": "9099871a7c7e1c16122e00d70208a2cd02078d80" }, "nvim-notify": { "branch": "master", "commit": "ebcdd8219e2a2cbc0a4bef68002f6867f1fde269" }, + "nvim-spectre": { "branch": "master", "commit": "9653847cf2f225648967f6e9363643e327387579" }, + "nvim-spider": { "branch": "main", "commit": "828444de406bc7df3b30c8e000ce6f54f0754499" }, "nvim-surround": { "branch": "main", "commit": "a4e30d33add8a9743b4f518b3a788b3c8e5def71" }, "nvim-treesitter": { "branch": "master", "commit": "27f68c0b6a87cbad900b3d016425450af8268026" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "85b9d0cbd4ff901abcda862b50dbb34e0901848b" }, diff --git a/lua/plugin-mappings.lua b/lua/plugin-mappings.lua index 7b8e09a..12a2571 100644 --- a/lua/plugin-mappings.lua +++ b/lua/plugin-mappings.lua @@ -60,10 +60,10 @@ vim.keymap.set('', 'F', function() hop.hint_char1({ direction = directions.BEFORE_CURSOR, current_line_only = true }) end, {remap=true}) vim.keymap.set('', 't', function() - hop.hint_char1({ direction = directions.AFTER_CURSOR, current_line_only = true, hint_offset = -1 }) + hop.hint_char1({ direction = directions.AFTER_CURSOR, current_line_only = false, hint_offset = -1 }) end, {remap=true}) vim.keymap.set('', 'T', function() - hop.hint_char1({ direction = directions.BEFORE_CURSOR, current_line_only = true, hint_offset = 1 }) + hop.hint_char1({ direction = directions.BEFORE_CURSOR, current_line_only = false, hint_offset = 1 }) end, {remap=true}) -- Lspsaga @@ -72,3 +72,54 @@ vim.keymap.set("n", "lr", ":Lspsaga rename", { noremap = true, silen -- action-preview -- This is for code actions vim.keymap.set({ "v", "n" }, "", require("actions-preview").code_actions) + +-- Spectre +vim.keymap.set('n', 'S', 'lua require("spectre").toggle()', { + desc = "Toggle Spectre" +}) +vim.keymap.set('n', 'sw', 'lua require("spectre").open_visual({select_word=true})', { + desc = "Search current word" +}) +vim.keymap.set('v', 'sw', 'lua require("spectre").open_visual()', { + desc = "Search current word" +}) +vim.keymap.set('n', 'sp', 'lua require("spectre").open_file_search({select_word=true})', { + desc = "Search on current file" +}) + +-- nvim-spider +vim.keymap.set( + { "n", "o", "x" }, + "w", + "lua require('spider').motion('w')", + { desc = "Spider-w" } +) +vim.keymap.set( + { "n", "o", "x" }, + "e", + "lua require('spider').motion('e')", + { desc = "Spider-e" } +) +vim.keymap.set( + { "n", "o", "x" }, + "b", + "lua require('spider').motion('b')", + { desc = "Spider-b" } +) + +-- move.nvim +local opts = { noremap = true, silent = true } +-- Normal-mode commands +vim.keymap.set('n', '', ':MoveLine(1)', opts) +vim.keymap.set('n', '', ':MoveLine(-1)', opts) +vim.keymap.set('n', '', ':MoveHChar(-1)', opts) +vim.keymap.set('n', '', ':MoveHChar(1)', opts) +vim.keymap.set('n', 'wf', ':MoveWord(1)', opts) +vim.keymap.set('n', 'wb', ':MoveWord(-1)', opts) + +-- Visual-mode commands +vim.keymap.set('v', '', ':MoveBlock(1)', opts) +vim.keymap.set('v', '', ':MoveBlock(-1)', opts) +vim.keymap.set('v', '', ':MoveHBlock(-1)', opts) +vim.keymap.set('v', '', ':MoveHBlock(1)', opts) + diff --git a/lua/plugins.lua b/lua/plugins.lua index 3ff6fe5..d13b42c 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -1,4 +1,5 @@ return { + -- LSP 'williamboman/mason.nvim', 'williamboman/mason-lspconfig.nvim', 'neovim/nvim-lspconfig', @@ -71,22 +72,6 @@ return { winbar = 1000, } }, - sections = { - lualine_a = { 'mode' }, - lualine_b = { 'branch', 'diff', 'diagnostics' }, - lualine_c = { 'filename' }, - lualine_x = { 'encoding', 'fileformat', 'filetype', 'filename' }, - lualine_y = { 'progress' }, - lualine_z = { 'location' } - }, - inactive_sections = { - lualine_a = {}, - lualine_b = {}, - lualine_c = {}, - lualine_x = { 'filename', 'location' }, - lualine_y = {}, - lualine_z = {} - }, tabline = {}, winbar = {}, inactive_winbar = {}, @@ -106,6 +91,44 @@ return { }, 'nvim-tree/nvim-web-devicons', 'navarasu/onedark.nvim', + { + -- Hides the highlight after searching and going into insert mode + 'nvimdev/hlsearch.nvim', + event = { "BufRead" }, + config = function() + require('hlsearch').setup() + end + }, + { + 'nvim-pack/nvim-spectre' + }, + { + 'chrisgrieser/nvim-spider', + lazy = true, + }, + { + 'fedepujol/move.nvim', + config = function() + require('move').setup({ + require('move').setup({ + line = { + enable = true, -- Enables line movement + indent = true -- Toggles indentation + }, + block = { + enable = true, -- Enables block movement + indent = true -- Toggles indentation + }, + word = { + enable = true, -- Enables word movement + }, + char = { + enable = true-- Enables char movement + } + }) + }) + end + }, { 'smoka7/hop.nvim', version = "*", @@ -157,6 +180,7 @@ return { config = function() local tl = require('telescope') tl.load_extension('aerial') + tl.load_extension("file_browser") tl.setup { pickers = { find_files = { @@ -336,7 +360,12 @@ return { -- refer to the configuration section below } }, - 'folke/neodev.nvim', + { + 'folke/neodev.nvim', + config = function() + require('neodev').setup {} + end + }, { 'vladdoster/remember.nvim', config = [[ require('remember') ]] }, { -- Adds git related signs to the gutter, as well as utilities for managing changes @@ -390,6 +419,17 @@ return { { 'stevearc/conform.nvim', opts = {}, + config = function() + require("conform").setup({ + formatters_by_ft = { + lua = { "stylua" }, + -- Conform will run multiple formatters sequentially + python = { "isort", "black" }, + -- Use a sub-list to run only the first available formatter + javascript = { { "prettierd", "prettier" } }, + }, + }) + end }, { 'rmagatti/auto-session',