summaryrefslogtreecommitdiff
path: root/after/plugin
diff options
context:
space:
mode:
authorMitchell Riedstra <mitch@riedstra.dev>2023-01-01 14:42:32 -0500
committerMitchell Riedstra <mitch@riedstra.dev>2023-01-01 14:42:32 -0500
commit140623d2797f79ab4aecbb4db349207127ff09bc (patch)
tree5143df0cec36a10d8b129b6d517c52d9ca76569e /after/plugin
parent70648ca4f20a77b5320d4e362140553b75637151 (diff)
downloadnvim-config-140623d2797f79ab4aecbb4db349207127ff09bc.tar.gz
nvim-config-140623d2797f79ab4aecbb4db349207127ff09bc.tar.xz
Full blown rewrite of my Neovim configuration
Diffstat (limited to 'after/plugin')
-rw-r--r--after/plugin/lsp.lua101
-rw-r--r--after/plugin/nord.lua9
-rw-r--r--after/plugin/nvim-tree.lua24
-rw-r--r--after/plugin/treesitter.lua33
-rw-r--r--after/plugin/undotree.lua1
5 files changed, 168 insertions, 0 deletions
diff --git a/after/plugin/lsp.lua b/after/plugin/lsp.lua
new file mode 100644
index 0000000..8056dfa
--- /dev/null
+++ b/after/plugin/lsp.lua
@@ -0,0 +1,101 @@
+local lsp = require("lsp-zero")
+
+lsp.preset("recommended")
+
+lsp.ensure_installed({
+ 'tsserver',
+ 'eslint',
+ 'sumneko_lua',
+ 'rust_analyzer',
+ 'gopls',
+ 'clangd',
+})
+
+-- Fix Undefined global 'vim'
+lsp.configure('sumneko_lua', {
+ settings = {
+ Lua = {
+ diagnostics = {
+ globals = { 'vim' }
+ }
+ }
+ }
+})
+
+
+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(),
+})
+
+-- disable completion with tab
+-- this helps with copilot setup
+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}
+
+ if client.name == "eslint" then
+ vim.cmd.LspStop('eslint')
+ return
+ end
+
+ local nmap = function(keys, func, desc)
+ if desc then
+ desc = 'LSP: ' .. desc
+ end
+
+ vim.keymap.set('n', keys, func, { buffer = bufnr, desc = desc })
+ end
+
+ -- goto defintion
+ -- vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts)
+ -- hover docs
+ vim.keymap.set("n", "K", vim.lsp.buf.hover, opts)
+
+ nmap('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
+ nmap('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
+ nmap("<leader>gr", vim.lsp.buf.references, '[G]oto [R]eferences')
+ nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition')
+
+ nmap('gI', vim.lsp.buf.implementation, '[G]oto [I]mplementation')
+ nmap('<leader>D', vim.lsp.buf.type_definition, 'Type [D]efinition')
+ nmap('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
+ nmap('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
+
+
+
+ -- vim.keymap.set("n", "<leader>vws", vim.lsp.buf.workspace_symbol, opts)
+ -- vim.keymap.set("n", "<leader>vd", vim.diagnostic.open_float, opts)
+ -- vim.keymap.set("n", "[d", vim.diagnostic.goto_next, opts)
+ -- vim.keymap.set("n", "]d", vim.diagnostic.goto_prev, opts)
+ -- vim.keymap.set("n", "<leader>vca", vim.lsp.buf.code_action, opts)
+ -- vim.keymap.set("n", "<leader>vrn", vim.lsp.buf.rename, opts)
+ -- vim.keymap.set("i", "<C-h>", vim.lsp.buf.signature_help, opts)
+end)
+
+lsp.setup()
+
+vim.diagnostic.config({
+ virtual_text = true,
+})
+
diff --git a/after/plugin/nord.lua b/after/plugin/nord.lua
new file mode 100644
index 0000000..5181b47
--- /dev/null
+++ b/after/plugin/nord.lua
@@ -0,0 +1,9 @@
+-- vim.g.nord_contrast = true
+-- vim.g.nord_borders = false
+vim.g.nord_disable_background = true
+vim.g.nord_italic = false
+-- vim.g.nord_uniform_diff_background = true
+vim.g.nord_bold = false
+
+-- Load the colorscheme
+require('nord').set()
diff --git a/after/plugin/nvim-tree.lua b/after/plugin/nvim-tree.lua
new file mode 100644
index 0000000..d89c294
--- /dev/null
+++ b/after/plugin/nvim-tree.lua
@@ -0,0 +1,24 @@
+-- set termguicolors to enable highlight groups
+vim.opt.termguicolors = true
+
+-- empty setup using defaults
+require("nvim-tree").setup()
+
+-- OR setup with some options
+require("nvim-tree").setup({
+ sort_by = "case_sensitive",
+ view = {
+ adaptive_size = true,
+ mappings = {
+ list = {
+ { key = "u", action = "dir_up" },
+ },
+ },
+ },
+ renderer = {
+ group_empty = true,
+ },
+ filters = {
+ dotfiles = true,
+ },
+})
diff --git a/after/plugin/treesitter.lua b/after/plugin/treesitter.lua
new file mode 100644
index 0000000..2c0ff58
--- /dev/null
+++ b/after/plugin/treesitter.lua
@@ -0,0 +1,33 @@
+require'nvim-treesitter.configs'.setup {
+ -- A list of parser names, or "all"
+ -- https://github.com/nvim-treesitter/nvim-treesitter
+ ensure_installed = {
+ "c", "lua", "rust", 'javascript', 'typescript', 'go', 'hcl',
+ 'java', 'lua', 'make', 'perl', 'python', 'scheme', 'sql', 'svelte',
+ 'terraform', 'yaml', 'bash', 'css', 'haskell',
+ },
+
+ -- 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,
+
+ -- List of parsers to ignore installing (for "all")
+ -- ignore_install = { "javascript" },
+
+ ---- If you need to change the installation directory of the parsers (see -> Advanced Setup)
+ -- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")!
+
+ highlight = {
+ -- `false` will disable the whole extension
+ 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..785e017
--- /dev/null
+++ b/after/plugin/undotree.lua
@@ -0,0 +1 @@
+vim.keymap.set('n', "<leader>u", vim.cmd.UndotreeToggle)