diff options
Diffstat (limited to 'after')
| -rw-r--r-- | after/plugin/colors.lua | 6 | ||||
| -rw-r--r-- | after/plugin/harpoon.lua | 10 | ||||
| -rw-r--r-- | after/plugin/lsp.lua | 60 | ||||
| -rw-r--r-- | after/plugin/telescope.lua | 6 | ||||
| -rw-r--r-- | after/plugin/treesitter.lua | 22 | ||||
| -rw-r--r-- | after/queries/tsplayground/((program.scm | 6 |
6 files changed, 110 insertions, 0 deletions
diff --git a/after/plugin/colors.lua b/after/plugin/colors.lua new file mode 100644 index 0000000..b63edb4 --- /dev/null +++ b/after/plugin/colors.lua @@ -0,0 +1,6 @@ +function Color(color) + color = color or "rose-pine" + vim.cmd.colorscheme(color) +end + +Color() diff --git a/after/plugin/harpoon.lua b/after/plugin/harpoon.lua new file mode 100644 index 0000000..eed35ed --- /dev/null +++ b/after/plugin/harpoon.lua @@ -0,0 +1,10 @@ +local mark = require("harpoon.mark") +local ui = require("harpoon.ui") + +vim.keymap.set("n", "<leader>a", mark.add_file) +vim.keymap.set("n", "<C-e>", ui.toggle_quick_menu) + +vim.keymap.set("n", "<C-h>", function() ui.nav_file(1) end) +vim.keymap.set("n", "<C-t>", function() ui.nav_file(2) end) +vim.keymap.set("n", "<C-n>", function() ui.nav_file(3) end) +vim.keymap.set("n", "<C-s>", function() ui.nav_file(4) end) diff --git a/after/plugin/lsp.lua b/after/plugin/lsp.lua new file mode 100644 index 0000000..274860a --- /dev/null +++ b/after/plugin/lsp.lua @@ -0,0 +1,60 @@ +local lsp = require("lsp-zero") + +lsp.preset("recommended") + +lsp.ensure_installed({ + 'rust_analyzer', + 'clangd' +}) + + +local cmp = require('cmp') +local cmp_select = {behavior = cmp.SelectBehavior.Select} +local cmp_mappings = lsp.defaults.cmp_mappings({ + ['<C-p>'] = cmp.mapping.select_prev_item(cmp_select), + ['<C-n>'] = cmp.mapping.select_next_item(cmp_select), + ['<C-y>'] = cmp.mapping.confirm({ select = true }), + ["<C-Space>"] = cmp.mapping.complete(), +}) + +cmp_mappings['<Tab>'] = nil +cmp_mappings['<S-Tab>'] = nil + +lsp.setup_nvim_cmp({ + mapping = cmp_mappings +}) + +lsp.set_preferences({ + suggest_lsp_servers = false, + sign_icons = { + error = 'E', + warn = 'W', + hint = 'H', + info = 'I' + } +}) + +lsp.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", "<leader>vws", function() vim.lsp.buf.workspace_symbol() end, opts) + vim.keymap.set("n", "<leader>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", "<leader>vca", function() vim.lsp.buf.code_action() end, opts) + vim.keymap.set("n", "<leader>vrr", function() vim.lsp.buf.references() end, opts) + vim.keymap.set("n", "<leader>vrn", function() vim.lsp.buf.rename() end, opts) + vim.keymap.set("i", "<C-h>", function() vim.lsp.buf.signature_help() end, opts) +end) + +lsp.skip_server_setup({'clangd'}) + +lsp.setup() + +require('clangd_extensions').setup() + +vim.diagnostic.config({ + virtual_text = true +}) diff --git a/after/plugin/telescope.lua b/after/plugin/telescope.lua new file mode 100644 index 0000000..4806008 --- /dev/null +++ b/after/plugin/telescope.lua @@ -0,0 +1,6 @@ +local builtin = require('telescope.builtin') +vim.keymap.set('n', '<leader>pf', builtin.find_files, {}) +vim.keymap.set('n', '<C-p>', builtin.git_files, {}) +vim.keymap.set('n', '<leader>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..46285d0 --- /dev/null +++ b/after/plugin/treesitter.lua @@ -0,0 +1,22 @@ +require'nvim-treesitter.configs'.setup { + -- A list of parser names, or "all" + ensure_installed = {"c", "cpp", "python", "go", "lua", "rust", "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/queries/tsplayground/((program.scm b/after/queries/tsplayground/((program.scm new file mode 100644 index 0000000..e2e092d --- /dev/null +++ b/after/queries/tsplayground/((program.scm @@ -0,0 +1,6 @@ +((program + (variable_declarator + _ (identifier) @variable_name + _ @assignment + (identifier) @_function_name)) + (#set! @assignment (= _ @variable_name))) |