From 642665e53a7f5341565f0bf5bc8453883b71d17f Mon Sep 17 00:00:00 2001 From: Wayne-Cole <77279425+Wacky404@users.noreply.github.com> Date: Sat, 6 Jan 2024 08:04:28 -0600 Subject: chore: cleaned up lsp configuration --- .config/nvim/init.lua | 4 +-- .config/nvim/lua/cole/core/colorscheme.lua | 32 ++++++++++++++++++++--- .config/nvim/lua/cole/plugins-setup.lua | 16 +++++++----- .config/nvim/lua/cole/plugins/lsp/lspconfig.lua | 34 ++++++------------------- .config/nvim/lua/cole/plugins/telescope.lua | 32 +++++++++++------------ .config/nvim/plugin/packer_compiled.lua | 34 ++++++++++++------------- 6 files changed, 80 insertions(+), 72 deletions(-) diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index a0fe54f..b54e4c7 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -2,16 +2,16 @@ require("cole.plugins-setup") require("cole.core.options") require("cole.core.keymaps") require("cole.core.colorscheme") +require("cole.plugins.transparent") require("cole.plugins.comment") require("cole.plugins.nvim-tree") require("cole.plugins.lualine") require("cole.plugins.telescope") require("cole.plugins.nvim-cmp") -require("cole.plugins.nvim-linter") require("cole.plugins.lsp.mason") require("cole.plugins.lsp.lspsaga") require("cole.plugins.lsp.lspconfig") require("cole.plugins.autopairs") require("cole.plugins.treesitter") require("cole.plugins.gitsigns") -require("cole.plugins.neoformat") +require("cole.plugins.formatter") diff --git a/.config/nvim/lua/cole/core/colorscheme.lua b/.config/nvim/lua/cole/core/colorscheme.lua index d642d67..b2ec91f 100644 --- a/.config/nvim/lua/cole/core/colorscheme.lua +++ b/.config/nvim/lua/cole/core/colorscheme.lua @@ -1,5 +1,29 @@ -local status, _ = pcall(vim.cmd, "colorscheme nordic") -if not status then - print("Color Scheme not Found") - return +local tokyonight, _ = pcall(vim.cmd, "colorscheme tokyonight") +if not tokyonight then + return end + +require("tokyonight").setup({ + -- your configuration comes here + -- or leave it empty to use the default settings + style = "night", -- The theme comes in three styles, `storm`, `moon`, a darker variant `night` and `day` + light_style = "day", -- The theme is used when the background is set to light + transparent = true, -- Enable this to disable setting the background color + terminal_colors = false, -- Configure the colors used when opening a `:terminal` in [Neovim](https://github.com/neovim/neovim) + styles = { + -- Style to be applied to different syntax groups + -- Value is any valid attr-list value for `:help nvim_set_hl` + comments = { italic = true }, + keywords = { italic = true }, + functions = {}, + variables = {}, + -- Background styles. Can be "dark", "transparent" or "normal" + sidebars = "dark", -- style for sidebars, see below + floats = "dark", -- style for floating windows + }, + sidebars = { "qf", "help" }, -- Set a darker background on sidebar-like windows. For example: `["qf", "vista_kind", "terminal", "packer"]` + day_brightness = 0.3, -- Adjusts the brightness of the colors of the **Day** style. Number between 0 and 1, from dull to vibrant colors + hide_inactive_statusline = false, -- Enabling this option, will hide inactive statuslines and replace them with a thin border instead. Should work with the standard **StatusLine** and **LuaLine**. + dim_inactive = false, -- dims inactive windows + lualine_bold = false, -- When `true`, section headers in the lualine theme will be bold +}) diff --git a/.config/nvim/lua/cole/plugins-setup.lua b/.config/nvim/lua/cole/plugins-setup.lua index cecf6bc..90c8f6b 100644 --- a/.config/nvim/lua/cole/plugins-setup.lua +++ b/.config/nvim/lua/cole/plugins-setup.lua @@ -13,7 +13,7 @@ local packer_bootstrap = ensure_packer() -- true if packer was just installed -- autocommand that reloads neovim and installs/updates/removes plugins -- when file is saved -vim.cmd([[ +vim.cmd([[ augroup packer_user_config autocmd! autocmd BufWritePost plugins-setup.lua source | PackerSync @@ -33,8 +33,11 @@ return packer.startup(function(use) use("nvim-lua/plenary.nvim") -- lua functions that many plugins use + -- transparent background + use("xiyaowong/transparent.nvim") + -- Color Scheme is here!!! - use("AlexvZyl/nordic.nvim") -- preferred colorscheme + use("folke/tokyonight.nvim") -- preferred colorscheme use("christoomey/vim-tmux-navigator") -- tmux & split window navigation @@ -108,9 +111,8 @@ return packer.startup(function(use) -- git integration use("lewis6991/gitsigns.nvim") -- show line modifications on left hand side - -- nvim-lint and nvim-formatter - use({"mfussenegger/nvim-lint"}) - use({"sbdchd/neoformat"}) + -- nvim-formatter + require("packer").use({ "mhartington/formatter.nvim" }) -- toggle terminal use({ @@ -122,10 +124,10 @@ return packer.startup(function(use) direction = "horizontal", autochdir = false, }) - end, + end, }) - -- Markdown Preview + -- Markdown Preview use({ "iamcco/markdown-preview.nvim", run = "cd app && npm install", diff --git a/.config/nvim/lua/cole/plugins/lsp/lspconfig.lua b/.config/nvim/lua/cole/plugins/lsp/lspconfig.lua index 5624356..bce89ab 100644 --- a/.config/nvim/lua/cole/plugins/lsp/lspconfig.lua +++ b/.config/nvim/lua/cole/plugins/lsp/lspconfig.lua @@ -22,6 +22,7 @@ local on_attach = function(client, bufnr) keymap.set("n", "gD", "lua vim.lsp.buf.declaration()", opts) -- go to declaration keymap.set("n", "gd", "Lspsaga peek_definition", opts) -- see definition and make edits in window keymap.set("n", "gi", "lua vim.lsp.buf.implementation()", opts) -- go to implementation + keymap.set("n", "K", "lua vim.lsp.buf.hover()", opts) -- see variable in hover keymap.set("n", "ca", "Lspsaga code_action", opts) -- see available code actions keymap.set("n", "rn", "Lspsaga rename", opts) -- smart rename keymap.set("n", "D", "Lspsaga show_line_diagnostics", opts) -- show diagnostics for line @@ -43,33 +44,14 @@ for type, icon in pairs(signs) do vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" }) end --- configure cpp server -lspconfig["clangd"].setup({ - capabilities = capabilities, - on_attach = on_attach, - cmd = { - "clangd", - "--offset-encoding=utf-16", - }, -}) - --- configure arduino server -lspconfig["arduino_language_server"].setup({ - capabilities = capabilities, - on_attach = on_attach, -}) +local servers = { "clangd", "arduino_language_server", "ltex", "jedi_language_server" } --- configure latex language server -lspconfig["ltex"].setup({ - capabilities = capabilities, - on_attach = on_attach, -}) - --- configure python server -lspconfig["jedi_language_server"].setup({ - capabilities = capabilities, - on_attach = on_attach, -}) +for _, lsp in pairs(servers) do + require("lspconfig")[lsp].setup({ + capabilities = capabilities, + on_attach = on_attach, + }) +end -- configure lua server (with special settings) lspconfig["lua_ls"].setup({ diff --git a/.config/nvim/lua/cole/plugins/telescope.lua b/.config/nvim/lua/cole/plugins/telescope.lua index fea5ece..c5c7b22 100644 --- a/.config/nvim/lua/cole/plugins/telescope.lua +++ b/.config/nvim/lua/cole/plugins/telescope.lua @@ -1,25 +1,25 @@ local telescope_setup, telescope = pcall(require, "telescope") -if not telescope_setup then - return -end +if not telescope_setup then + return +end local actions_setup, actions = pcall(require, "telescope.actions") -if not actions_setup then - return -end +if not actions_setup then + return +end -- configure telescope telescope.setup({ - -- configure custom mappings - defaults = { - mappings = { - i = { - [""] = actions.move_selection_previous, -- move to prev result - [""] = actions.move_selection_next, -- move to next result - [""] = actions.send_selected_to_qflist + actions.open_qflist, -- send selected to quickfixlist - }, - }, - }, + -- configure custom mappings + defaults = { + mappings = { + i = { + [""] = actions.move_selection_previous, -- move to prev result + [""] = actions.move_selection_next, -- move to next result + [""] = actions.send_selected_to_qflist + actions.open_qflist, -- send selected to quickfixlist + }, + }, + }, }) telescope.load_extension("fzf") diff --git a/.config/nvim/plugin/packer_compiled.lua b/.config/nvim/plugin/packer_compiled.lua index b5800e3..849d706 100644 --- a/.config/nvim/plugin/packer_compiled.lua +++ b/.config/nvim/plugin/packer_compiled.lua @@ -104,6 +104,11 @@ _G.packer_plugins = { path = "/Users/cole/.local/share/nvim/site/pack/packer/start/cmp_luasnip", url = "https://github.com/saadparwaiz1/cmp_luasnip" }, + ["formatter.nvim"] = { + loaded = true, + path = "/Users/cole/.local/share/nvim/site/pack/packer/start/formatter.nvim", + url = "https://github.com/mhartington/formatter.nvim" + }, ["friendly-snippets"] = { loaded = true, path = "/Users/cole/.local/share/nvim/site/pack/packer/start/friendly-snippets", @@ -146,16 +151,6 @@ _G.packer_plugins = { path = "/Users/cole/.local/share/nvim/site/pack/packer/start/mason.nvim", url = "https://github.com/williamboman/mason.nvim" }, - neoformat = { - loaded = true, - path = "/Users/cole/.local/share/nvim/site/pack/packer/start/neoformat", - url = "https://github.com/sbdchd/neoformat" - }, - ["nordic.nvim"] = { - loaded = true, - path = "/Users/cole/.local/share/nvim/site/pack/packer/start/nordic.nvim", - url = "https://github.com/AlexvZyl/nordic.nvim" - }, ["nvim-autopairs"] = { loaded = true, path = "/Users/cole/.local/share/nvim/site/pack/packer/start/nvim-autopairs", @@ -166,11 +161,6 @@ _G.packer_plugins = { path = "/Users/cole/.local/share/nvim/site/pack/packer/start/nvim-cmp", url = "https://github.com/hrsh7th/nvim-cmp" }, - ["nvim-lint"] = { - loaded = true, - path = "/Users/cole/.local/share/nvim/site/pack/packer/start/nvim-lint", - url = "https://github.com/mfussenegger/nvim-lint" - }, ["nvim-lspconfig"] = { loaded = true, path = "/Users/cole/.local/share/nvim/site/pack/packer/start/nvim-lspconfig", @@ -219,11 +209,21 @@ _G.packer_plugins = { url = "https://github.com/nvim-telescope/telescope.nvim" }, ["toggleterm.nvim"] = { - config = { "\27LJ\2\nf\0\0\3\0\4\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0005\2\3\0B\0\2\1K\0\1\0\1\0\3\tsize\3\15\14autochdir\1\14direction\15horizontal\nsetup\15toggleterm\frequire\0" }, + config = { "\27LJ\2\nf\0\0\3\0\4\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0005\2\3\0B\0\2\1K\0\1\0\1\0\3\14direction\15horizontal\tsize\3\15\14autochdir\1\nsetup\15toggleterm\frequire\0" }, loaded = true, path = "/Users/cole/.local/share/nvim/site/pack/packer/start/toggleterm.nvim", url = "https://github.com/akinsho/toggleterm.nvim" }, + ["tokyonight.nvim"] = { + loaded = true, + path = "/Users/cole/.local/share/nvim/site/pack/packer/start/tokyonight.nvim", + url = "https://github.com/folke/tokyonight.nvim" + }, + ["transparent.nvim"] = { + loaded = true, + path = "/Users/cole/.local/share/nvim/site/pack/packer/start/transparent.nvim", + url = "https://github.com/xiyaowong/transparent.nvim" + }, ["vim-ReplaceWithRegister"] = { loaded = true, path = "/Users/cole/.local/share/nvim/site/pack/packer/start/vim-ReplaceWithRegister", @@ -253,7 +253,7 @@ try_loadstring("\27LJ\2\n=\0\0\2\0\4\0\0056\0\0\0009\0\1\0005\1\3\0=\1\2\0K\0\1\ time([[Setup for markdown-preview.nvim]], false) -- Config for: toggleterm.nvim time([[Config for toggleterm.nvim]], true) -try_loadstring("\27LJ\2\nf\0\0\3\0\4\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0005\2\3\0B\0\2\1K\0\1\0\1\0\3\tsize\3\15\14autochdir\1\14direction\15horizontal\nsetup\15toggleterm\frequire\0", "config", "toggleterm.nvim") +try_loadstring("\27LJ\2\nf\0\0\3\0\4\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0005\2\3\0B\0\2\1K\0\1\0\1\0\3\14direction\15horizontal\tsize\3\15\14autochdir\1\nsetup\15toggleterm\frequire\0", "config", "toggleterm.nvim") time([[Config for toggleterm.nvim]], false) -- Load plugins in order defined by `after` time([[Sequenced loading]], true) -- cgit v1.3-3-g829e