summaryrefslogtreecommitdiff
path: root/.config/nvim/after
diff options
context:
space:
mode:
authorDavid T. Sadler <davidtsadler@googlemail.com>2023-02-11 12:51:08 +0000
committerDavid T. Sadler <davidtsadler@googlemail.com>2023-02-11 12:51:08 +0000
commitc5d4e4a23a397ae1dc68682734f2fe26d3adf0f0 (patch)
tree806f51c63abab0aba0e0c17170abe75eddbe019a /.config/nvim/after
parent381b1cd773be35d3567ca562485b67b0502a152c (diff)
Switched to lua and install various plugins
Diffstat (limited to '.config/nvim/after')
-rw-r--r--.config/nvim/after/plugin/colors.lua8
-rw-r--r--.config/nvim/after/plugin/lsp.lua72
-rw-r--r--.config/nvim/after/plugin/telescope.lua11
-rw-r--r--.config/nvim/after/plugin/treesitter.lua38
4 files changed, 129 insertions, 0 deletions
diff --git a/.config/nvim/after/plugin/colors.lua b/.config/nvim/after/plugin/colors.lua
new file mode 100644
index 0000000..4d0b34d
--- /dev/null
+++ b/.config/nvim/after/plugin/colors.lua
@@ -0,0 +1,8 @@
+vim.g.nord_contrast = true
+vim.g.nord_borders = false
+vim.g.nord_disable_background = false
+vim.g.nord_italic = true
+vim.g.nord_uniform_diff_background = true
+vim.g.nord_bold = true
+
+require('nord').set()
diff --git a/.config/nvim/after/plugin/lsp.lua b/.config/nvim/after/plugin/lsp.lua
new file mode 100644
index 0000000..c4117f5
--- /dev/null
+++ b/.config/nvim/after/plugin/lsp.lua
@@ -0,0 +1,72 @@
+local lsp = require("lsp-zero")
+
+lsp.preset("recommended")
+
+lsp.ensure_installed({
+ "cssls",
+ "dockerls",
+ "html",
+ "jsonls",
+ "phpactor",
+ "sumneko_lua",
+ "tailwindcss",
+})
+
+-- 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(),
+})
+
+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.setup()
+
+vim.diagnostic.config({
+ virtual_text = true
+})
diff --git a/.config/nvim/after/plugin/telescope.lua b/.config/nvim/after/plugin/telescope.lua
new file mode 100644
index 0000000..8680444
--- /dev/null
+++ b/.config/nvim/after/plugin/telescope.lua
@@ -0,0 +1,11 @@
+local builtin = require("telescope.builtin")
+
+vim.keymap.set("n", "<leader>ff", builtin.find_files, {})
+vim.keymap.set("n", "<leader>fg", builtin.live_grep, {})
+vim.keymap.set("n", "<leader>fb", builtin.buffers, {})
+vim.keymap.set("n", "<leader>fh", builtin.help_tags, {})
+vim.keymap.set("n", "<leader>ss", builtin.spell_suggest, {})
+vim.keymap.set("n", "<leader>fs", 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..00aab20
--- /dev/null
+++ b/.config/nvim/after/plugin/treesitter.lua
@@ -0,0 +1,38 @@
+require'nvim-treesitter.configs'.setup {
+ -- A list of parser names, or "all"
+ ensure_installed = {
+ "bash",
+ "c",
+ "css",
+ "dockerfile",
+ "gitignore",
+ "help",
+ "html",
+ "javascript",
+ "json",
+ "lua",
+ "markdown",
+ "php",
+ "typescript",
+ "yaml",
+ },
+
+ -- 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 = {
+ -- `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 = true,
+ },
+}
+