From 991b90da98ad3f1da30dcb58c6f835bef9124097 Mon Sep 17 00:00:00 2001 From: Matthew Wozniak Date: Wed, 28 Jun 2023 10:10:19 -0400 Subject: new config --- after/plugin/colors.lua | 9 +++++++ after/plugin/lsp.lua | 60 +++++++++++++++++++++++++++++++++++++++++++++ after/plugin/lualine.lua | 9 +++++++ after/plugin/telescope.lua | 4 +++ after/plugin/treesitter.lua | 21 ++++++++++++++++ 5 files changed, 103 insertions(+) create mode 100644 after/plugin/colors.lua create mode 100644 after/plugin/lsp.lua create mode 100644 after/plugin/lualine.lua create mode 100644 after/plugin/telescope.lua create mode 100644 after/plugin/treesitter.lua (limited to 'after') diff --git a/after/plugin/colors.lua b/after/plugin/colors.lua new file mode 100644 index 0000000..54f0a12 --- /dev/null +++ b/after/plugin/colors.lua @@ -0,0 +1,9 @@ +function ColorMyPencils(color) + color = color or 'OceanicNext' + vim.cmd.colorscheme(color) + vim.api.nvim_set_hl(0, "Normal", { bg = 'none'}) + vim.api.nvim_set_hl(0, "NormalFloat", { bg = 'none'}) + vim.api.nvim_set_hl(0, "EndOfBuffer", { bg = 'none'}) +end + +ColorMyPencils() diff --git a/after/plugin/lsp.lua b/after/plugin/lsp.lua new file mode 100644 index 0000000..dfcf7ea --- /dev/null +++ b/after/plugin/lsp.lua @@ -0,0 +1,60 @@ +local lsp = require("lsp-zero") + +lsp.preset("recommended") + +lsp.ensure_installed({ + 'clangd', + 'rust_analyzer', + 'lua_ls', +}) + +-- Fix Undefined global 'vim' +lsp.nvim_workspace() + + +local cmp = require('cmp') +local cmp_select = {behavior = cmp.SelectBehavior.Select} +local cmp_mappings = lsp.defaults.cmp_mappings({ + [''] = cmp.mapping.select_prev_item(cmp_select), + [''] = cmp.mapping.select_next_item(cmp_select), + [''] = cmp.mapping.confirm({ select = true }), + [""] = cmp.mapping.complete(), +}) + +cmp_mappings[''] = nil +cmp_mappings[''] = 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", "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) + +lsp.setup() + +vim.diagnostic.config({ + virtual_text = true +}) diff --git a/after/plugin/lualine.lua b/after/plugin/lualine.lua new file mode 100644 index 0000000..9c8b1b7 --- /dev/null +++ b/after/plugin/lualine.lua @@ -0,0 +1,9 @@ +require('lualine').setup { + options = { + icons_enabled = false, + component_seperators = { left = '', right = '' }, + section_seperators = { left = '', right = '' }, + } +} + +vim.cmd [[set noshowmode]] diff --git a/after/plugin/telescope.lua b/after/plugin/telescope.lua new file mode 100644 index 0000000..8dae86b --- /dev/null +++ b/after/plugin/telescope.lua @@ -0,0 +1,4 @@ +local builtin = require('telescope.builtin') +vim.keymap.set('n', 'pf', builtin.find_files, {}) +vim.keymap.set('n', '', builtin.git_files, {}) +vim.keymap.set('n', '', builtin.live_grep, {}) diff --git a/after/plugin/treesitter.lua b/after/plugin/treesitter.lua new file mode 100644 index 0000000..86826a0 --- /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 = { "zig", "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, + }, +} -- cgit v1.2.3-54-g00ecf