From 14ede51d1354c5317c755c4745f332cc504d27ce Mon Sep 17 00:00:00 2001 From: test Date: Sun, 24 Mar 2024 16:10:18 -0400 Subject: [PATCH] added after folder --- .gitignore | 1 - after/plugin/colors.lua | 6 +++++ after/plugin/fugitive.lua | 2 ++ after/plugin/genai.lua | 9 +++++++ after/plugin/harpoon.lua | 12 +++++++++ after/plugin/lsp.lua | 54 +++++++++++++++++++++++++++++++++++++ after/plugin/telescope.lua | 7 +++++ after/plugin/treesitter.lua | 21 +++++++++++++++ after/plugin/undotree.lua | 1 + 9 files changed, 112 insertions(+), 1 deletion(-) create mode 100644 after/plugin/colors.lua create mode 100644 after/plugin/fugitive.lua create mode 100644 after/plugin/genai.lua create mode 100644 after/plugin/harpoon.lua create mode 100644 after/plugin/lsp.lua create mode 100644 after/plugin/telescope.lua create mode 100644 after/plugin/treesitter.lua create mode 100644 after/plugin/undotree.lua diff --git a/.gitignore b/.gitignore index 0759fa5..140bf0d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,2 @@ -plugin/ plugin/* plugin/packer_compiled.lua diff --git a/after/plugin/colors.lua b/after/plugin/colors.lua new file mode 100644 index 0000000..6c3e1c5 --- /dev/null +++ b/after/plugin/colors.lua @@ -0,0 +1,6 @@ +function ColorMyPencils(color) + color = color or "rose-pine" + vim.cmd.colorscheme(color) +end + +ColorMyPencils() diff --git a/after/plugin/fugitive.lua b/after/plugin/fugitive.lua new file mode 100644 index 0000000..dd4fcc3 --- /dev/null +++ b/after/plugin/fugitive.lua @@ -0,0 +1,2 @@ +vim.keymap.set("n", "gs", vim.cmd.Git); + diff --git a/after/plugin/genai.lua b/after/plugin/genai.lua new file mode 100644 index 0000000..6622aab --- /dev/null +++ b/after/plugin/genai.lua @@ -0,0 +1,9 @@ +vim.keymap.set({ 'n', 'v' }, ']', ':Gen') + +require('gen').setup({ + model = "mistral", + host = "100.74.10.45", + init = function(options) end, + + debug = false +}) diff --git a/after/plugin/harpoon.lua b/after/plugin/harpoon.lua new file mode 100644 index 0000000..9e19f47 --- /dev/null +++ b/after/plugin/harpoon.lua @@ -0,0 +1,12 @@ +local mark = require("harpoon.mark") +local ui = require("harpoon.ui") + +vim.keymap.set("n", "r", mark.add_file) +vim.keymap.set("n", "t", ui.toggle_quick_menu) + +-- vim.keymap.set("n", "a", function() ui.nav_file(1) end) +-- vim.keymap.set("n", "s", function() ui.nav_file(2) end) +-- vim.keymap.set("n", "d", function() ui.nav_file(3) end) +-- vim.keymap.set("n", "f", function() ui.nav_file(4) end) +-- + diff --git a/after/plugin/lsp.lua b/after/plugin/lsp.lua new file mode 100644 index 0000000..184db76 --- /dev/null +++ b/after/plugin/lsp.lua @@ -0,0 +1,54 @@ +local lsp_zero = require('lsp-zero') + +lsp_zero.on_attach(function(client, bufnr) + local opts = {buffer = bufnr, remap = false} + + vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts) + vim.keymap.set("n", "K", function() vim.lsp.buf.hover() end, opts) + vim.keymap.set("n", "vws", function() vim.lsp.buf.workspace_symbol() end, opts) + vim.keymap.set("n", "vd", function() vim.diagnostic.open_float() end, opts) + vim.keymap.set("n", "[d", function() vim.diagnostic.goto_next() end, opts) + vim.keymap.set("n", "]d", function() vim.diagnostic.goto_prev() end, opts) + vim.keymap.set("n", "vca", function() vim.lsp.buf.code_action() end, opts) + vim.keymap.set("n", "vrr", function() vim.lsp.buf.references() end, opts) + vim.keymap.set("n", "vrn", function() vim.lsp.buf.rename() end, opts) + vim.keymap.set("i", "", function() vim.lsp.buf.signature_help() end, opts) +end) + +-- to learn how to use mason.nvim with lsp-zero +-- read this: https://github.com/VonHeikemen/lsp-zero.nvim/blob/v3.x/doc/md/guides/integrate-with-mason-nvim.md +require('mason').setup({}) +require('mason-lspconfig').setup({ + ensure_installed = {'tsserver', 'rust_analyzer'}, + handlers = { + lsp_zero.default_setup, + lua_ls = function() + local lua_opts = lsp_zero.nvim_lua_ls() + require('lspconfig').lua_ls.setup(lua_opts) + end, + } +}) + +local cmp = require('cmp') +local cmp_select = {behavior = cmp.SelectBehavior.Select} + +-- this is the function that loads the extra snippets to luasnip +-- from rafamadriz/friendly-snippets +require('luasnip.loaders.from_vscode').lazy_load() + +cmp.setup({ + sources = { + {name = 'path'}, + {name = 'nvim_lsp'}, + {name = 'nvim_lua'}, + {name = 'luasnip', keyword_length = 2}, + {name = 'buffer', keyword_length = 3}, + }, + formatting = lsp_zero.cmp_format({details = false}), + mapping = cmp.mapping.preset.insert({ + [''] = cmp.mapping.select_prev_item(cmp_select), + [''] = cmp.mapping.select_next_item(cmp_select), + [''] = cmp.mapping.confirm({ select = true }), + [''] = cmp.mapping.complete(), + }), +}) diff --git a/after/plugin/telescope.lua b/after/plugin/telescope.lua new file mode 100644 index 0000000..7f645dd --- /dev/null +++ b/after/plugin/telescope.lua @@ -0,0 +1,7 @@ +local builtin = require('telescope.builtin') +vim.keymap.set('n', 'pf', builtin.find_files, {}) +vim.keymap.set('n', 'pg', builtin.git_files, {}) +vim.keymap.set('n', 'ps', function() + builtin.grep_string({ search = vim.fn.input("Grep > ") }); + +end) diff --git a/after/plugin/treesitter.lua b/after/plugin/treesitter.lua new file mode 100644 index 0000000..1a4731e --- /dev/null +++ b/after/plugin/treesitter.lua @@ -0,0 +1,21 @@ +require'nvim-treesitter.configs'.setup { + -- A list of parser names, or "all" (the five listed parsers should always be installed) + ensure_installed = { "python", "html", "bash", "javascript", "rust", "c", "lua", "vim", "vimdoc", "query"}, + + -- Install parsers synchronously (only applied to `ensure_installed`) + sync_install = false, + + -- Automatically install missing parsers when entering buffer + -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally + auto_install = true, + + highlight = { + enable = true, + + -- Setting this to true will run `:h syntax` and tree-sitter at the same time. + -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). + -- Using this option may slow down your editor, and you may see some duplicate highlights. + -- Instead of true it can also be a list of languages + additional_vim_regex_highlighting = false, + }, +} diff --git a/after/plugin/undotree.lua b/after/plugin/undotree.lua new file mode 100644 index 0000000..b6b9276 --- /dev/null +++ b/after/plugin/undotree.lua @@ -0,0 +1 @@ +vim.keymap.set("n", "u", vim.cmd.UndotreeToggle)