diff options
| author | Jacob McDonnell <jacob@jacobmcdonnell.com> | 2024-03-26 21:43:28 -0400 |
|---|---|---|
| committer | Jacob McDonnell <jacob@jacobmcdonnell.com> | 2024-03-26 21:43:28 -0400 |
| commit | 4a903ca920b43184efb05a30c0bb79d21b56e0a9 (patch) | |
| tree | 78b8a674f404954af127a2cf7546780824c3b904 /.config/nvim/after/plugin | |
| parent | f4b64685c4e5e80bd279cbb7d6f1c774041e7baa (diff) | |
Updated neovim based on theprimagen
Diffstat (limited to '.config/nvim/after/plugin')
| -rw-r--r-- | .config/nvim/after/plugin/harpoon.lua | 41 | ||||
| -rw-r--r-- | .config/nvim/after/plugin/lsp.lua | 20 | ||||
| -rw-r--r-- | .config/nvim/after/plugin/telescope.lua | 6 | ||||
| -rw-r--r-- | .config/nvim/after/plugin/treesitter.lua | 21 |
4 files changed, 88 insertions, 0 deletions
diff --git a/.config/nvim/after/plugin/harpoon.lua b/.config/nvim/after/plugin/harpoon.lua new file mode 100644 index 0000000..08b092a --- /dev/null +++ b/.config/nvim/after/plugin/harpoon.lua @@ -0,0 +1,41 @@ +local harpoon = require("harpoon") + +-- REQUIRED +harpoon:setup() +-- REQUIRED + +vim.keymap.set("n", "<leader>a", function() harpoon:list():append() end) +--vim.keymap.set("n", "<leader>q", function() harpoon.ui:toggle_quick_menu(harpoon:list()) end) + +vim.keymap.set("n", "<C-h>", function() harpoon:list():select(1) end) +vim.keymap.set("n", "<C-t>", function() harpoon:list():select(2) end) +vim.keymap.set("n", "<C-n>", function() harpoon:list():select(3) end) +vim.keymap.set("n", "<C-s>", function() harpoon:list():select(4) end) + +-- Toggle previous & next buffers stored within Harpoon list +vim.keymap.set("n", "<C-S-P>", function() harpoon:list():prev() end) +vim.keymap.set("n", "<C-S-N>", function() harpoon:list():next() end) + +local harpoon = require('harpoon') +harpoon:setup({}) + +-- basic telescope configuration +local conf = require("telescope.config").values +local function toggle_telescope(harpoon_files) + local file_paths = {} + for _, item in ipairs(harpoon_files.items) do + table.insert(file_paths, item.value) + end + + require("telescope.pickers").new({}, { + prompt_title = "Harpoon", + finder = require("telescope.finders").new_table({ + results = file_paths, + }), + previewer = conf.file_previewer({}), + sorter = conf.generic_sorter({}), + }):find() +end + +vim.keymap.set("n", "<C-e>", function() toggle_telescope(harpoon:list()) end, + { desc = "Open harpoon window" }) diff --git a/.config/nvim/after/plugin/lsp.lua b/.config/nvim/after/plugin/lsp.lua new file mode 100644 index 0000000..0960abc --- /dev/null +++ b/.config/nvim/after/plugin/lsp.lua @@ -0,0 +1,20 @@ +local lsp = require('lsp-zero') + +local cmp = require('cmp') +local cmp_action = require('lsp-zero').cmp_action() + +cmp.setup({ + window = { + completion = cmp.config.window.bordered(), + documentation = cmp.config.window.bordered(), + }, + mapping = cmp.mapping.preset.insert({ + ['<C-Space>'] = cmp.mapping.complete(), + ['<C-n>'] = cmp_action.luasnip_jump_forward(), + ['<C-p>'] = cmp_action.luasnip_jump_backward(), + ['<C-u>'] = cmp.mapping.scroll_docs(-4), + ['<C-d>'] = cmp.mapping.scroll_docs(4), + }) +}) + +require('lspconfig').clangd.setup({}) diff --git a/.config/nvim/after/plugin/telescope.lua b/.config/nvim/after/plugin/telescope.lua new file mode 100644 index 0000000..87c9ea6 --- /dev/null +++ b/.config/nvim/after/plugin/telescope.lua @@ -0,0 +1,6 @@ +local builtin = require('telescope.builtin') +vim.keymap.set('n', '<leader>ff', builtin.find_files, {}) +vim.keymap.set('n', '<leader>fp', builtin.git_files, {}) +vim.keymap.set('n', '<leader>ps', function() + builtin.grep_string({ search = vim.fn.input("Grep > ") }) +end) diff --git a/.config/nvim/after/plugin/treesitter.lua b/.config/nvim/after/plugin/treesitter.lua new file mode 100644 index 0000000..b90bdcd --- /dev/null +++ b/.config/nvim/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 = { "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, + }, +} |
