From 617f183b9188cdda7009e5eef8c563b00ccbd75d Mon Sep 17 00:00:00 2001 From: 409 Date: Tue, 9 Apr 2024 05:40:56 +0200 Subject: [PATCH] started migrating code from after to the plugins folder --- .luarc.json | 5 ++ after/plugin/colors.lua | 18 ------ after/plugin/harpoon.lua | 12 ---- after/plugin/telescope.lua | 44 --------------- lua/409/plugins/navigation.lua | 100 ++++++++++++++++++++++++++++++--- lua/409/plugins/theme.lua | 15 +++++ 6 files changed, 111 insertions(+), 83 deletions(-) create mode 100644 .luarc.json delete mode 100755 after/plugin/colors.lua delete mode 100755 after/plugin/harpoon.lua delete mode 100755 after/plugin/telescope.lua diff --git a/.luarc.json b/.luarc.json new file mode 100644 index 0000000..deda1dc --- /dev/null +++ b/.luarc.json @@ -0,0 +1,5 @@ +{ + "diagnostics.disable": [ + "unused-local" + ] +} \ No newline at end of file diff --git a/after/plugin/colors.lua b/after/plugin/colors.lua deleted file mode 100755 index 04d8480..0000000 --- a/after/plugin/colors.lua +++ /dev/null @@ -1,18 +0,0 @@ -function Color(color) - local catppuccin_colors = require('catppuccin.palettes').get_palette('mocha') - - vim.api.nvim_set_hl(0, "Normal", { bg = "none" }) - vim.api.nvim_set_hl(0, "NormalNC", { bg = "none" }) - vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" }) - vim.api.nvim_set_hl(0, "FloatBorder", { fg = catppuccin_colors.surface2 }) - vim.api.nvim_set_hl(0, "StatusLine", { bg = "none" }) - -- If Vim thinks StatusLine and StatusLineNC are the same it overrides these settings - vim.api.nvim_set_hl(0, "StatusLineNC", { ctermbg = 0, bg = "none" }) - vim.api.nvim_set_hl(0, "CursorLine", { link = "Visual" }) - vim.api.nvim_set_hl(0, "Pmenu", { link = "Normal" }) - vim.api.nvim_set_hl(0, "PmenuSel", { link = "Visual" }) - vim.api.nvim_set_hl(0, "PmenuSbar", { link = "Normal" }) - vim.api.nvim_set_hl(0, "CmpPmenuBorder", { fg = catppuccin_colors.surface2 }) -end - -Color() diff --git a/after/plugin/harpoon.lua b/after/plugin/harpoon.lua deleted file mode 100755 index bbf75a6..0000000 --- a/after/plugin/harpoon.lua +++ /dev/null @@ -1,12 +0,0 @@ -local harpoon = require("harpoon") - --- REQUIRED -harpoon:setup() --- REQUIRED - -vim.keymap.set("n", "a", function() harpoon:list():add() end) -vim.keymap.set("n", "", function() harpoon.ui:toggle_quick_menu(harpoon:list()) end) - -for i = 1, 9, 1 do - vim.keymap.set("n", string.format("%s", i), function() harpoon:list():select(i) end) -end diff --git a/after/plugin/telescope.lua b/after/plugin/telescope.lua deleted file mode 100755 index ed1d5b2..0000000 --- a/after/plugin/telescope.lua +++ /dev/null @@ -1,44 +0,0 @@ -require("telescope").setup({ - defaults = { - layout_strategy = "horizontal", - layout_config = { - horizontal = { - prompt_position = "bottom", - preview_width = 0.55, - results_width = 0.8, - }, - vertical = { - mirror = false, - }, - width = 0.87, - height = 0.80, - preview_cutoff = 120, - }, - borderchars = require("409.ui").telescope_border, - prompt_prefix = "  ", - color_devicons = true, - }, -}) - -local builtin = require("telescope.builtin") - -vim.keymap.set("n", "pf", builtin.find_files, {}) -vim.keymap.set("n", "", builtin.git_files, {}) -vim.keymap.set("n", "pt", ":TodoTelescope") -vim.keymap.set("n", "ps", function() - local status, result = pcall(function() - return vim.fn.input("Grep > ") - end) - -- - -- prevent keyboard interrupt error - if not status then - return - end - - builtin.grep_string({ search = result }) -end) -vim.keymap.set("n", "pl", builtin.live_grep) - -vim.keymap.set("n", "", ":Telescope buffers") - -vim.api.nvim_set_hl(0, "TelescopeSelection", { link = "Visual" }) diff --git a/lua/409/plugins/navigation.lua b/lua/409/plugins/navigation.lua index 86753bb..d16b515 100644 --- a/lua/409/plugins/navigation.lua +++ b/lua/409/plugins/navigation.lua @@ -1,11 +1,93 @@ return { - { - "nvim-telescope/telescope.nvim", - dependencies = { "nvim-lua/plenary.nvim" }, - }, - { - "ThePrimeagen/harpoon", - branch = "harpoon2", - dependencies = { "nvim-lua/plenary.nvim" }, - }, + { + "nvim-telescope/telescope.nvim", + cmd = "Telescope", + dependencies = { "nvim-lua/plenary.nvim" }, + opts = { + defaults = { + layout_strategy = "horizontal", + layout_config = { + horizontal = { + prompt_position = "bottom", + preview_width = 0.55, + results_width = 0.8, + }, + vertical = { + mirror = false, + }, + width = 0.87, + height = 0.80, + preview_cutoff = 120, + }, + borderchars = require("409.ui").telescope_border, + prompt_prefix = "  ", + color_devicons = true, + }, + }, + keys = { + { + "pf", + ":Telescope find_files", + desc = "Find files" + }, + { + "", + ":Telescope git_files", + desc = "Find files (git)" + }, + { + "pt", + ":TodoTelescope", + desc = "Find TODOs" + }, + { + "ps", + function() + local status, result = pcall(function() + return vim.fn.input("Grep > ") + end) + -- + -- prevent keyboard interrupt error + if not status then + return + end + + require("telescope.builtin").grep_string({ search = result }) + end, + desc = "Grep (root dir)" + }, + { + "pl", + function() + require("telescope.builtin").live_grep() + end, + desc = "Live grep (root dir)" + }, + { + "", + ":Telescope buffers", + desc = "Find buffers" + }, + }, + config = function() + vim.api.nvim_set_hl(0, "TelescopeSelection", { link = "Visual" }) + end + }, + { + "ThePrimeagen/harpoon", + branch = "harpoon2", + dependencies = { "nvim-lua/plenary.nvim" }, + config = function() + local harpoon = require("harpoon") + + harpoon.setup() + + vim.keymap.set("n", "a", function() harpoon:list():add() end) + vim.keymap.set("n", "", function() harpoon.ui:toggle_quick_menu(harpoon:list()) end) + + for i = 1, 9, 1 do + vim.keymap.set("n", string.format("%s", i), function() harpoon:list():select(i) end) + end + end + }, } diff --git a/lua/409/plugins/theme.lua b/lua/409/plugins/theme.lua index 0a2a85a..4a77243 100644 --- a/lua/409/plugins/theme.lua +++ b/lua/409/plugins/theme.lua @@ -6,6 +6,21 @@ return { priority = 1000, config = function() vim.cmd.colorscheme('catppuccin-mocha') + + local catppuccin_colors = require('catppuccin.palettes').get_palette('mocha') + + vim.api.nvim_set_hl(0, "Normal", { bg = "none" }) + vim.api.nvim_set_hl(0, "NormalNC", { bg = "none" }) + vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" }) + vim.api.nvim_set_hl(0, "FloatBorder", { fg = catppuccin_colors.surface2 }) + vim.api.nvim_set_hl(0, "StatusLine", { bg = "none" }) + -- If Vim thinks StatusLine and StatusLineNC are the same it overrides these settings + vim.api.nvim_set_hl(0, "StatusLineNC", { ctermbg = 0, bg = "none" }) + vim.api.nvim_set_hl(0, "CursorLine", { link = "Visual" }) + vim.api.nvim_set_hl(0, "Pmenu", { link = "Normal" }) + vim.api.nvim_set_hl(0, "PmenuSel", { link = "Visual" }) + vim.api.nvim_set_hl(0, "PmenuSbar", { link = "Normal" }) + vim.api.nvim_set_hl(0, "CmpPmenuBorder", { fg = catppuccin_colors.surface2 }) end }, }