From f7a1a5dc928be00407d584c0d636b491b8688c61 Mon Sep 17 00:00:00 2001 From: marvelman3284 Date: Tue, 1 Jun 2021 09:22:24 -0400 Subject: [PATCH 01/11] Add lspinstall functionality --- lua/mappings.lua | 4 ++-- lua/nvim-lspconfig.lua | 37 ++++++++++++++++++++++++++++++------- lua/pluginList.lua | 6 +++--- 3 files changed, 35 insertions(+), 12 deletions(-) diff --git a/lua/mappings.lua b/lua/mappings.lua index 70fde6a..1c91eee 100644 --- a/lua/mappings.lua +++ b/lua/mappings.lua @@ -18,8 +18,8 @@ map("v", "x", [=[ "_x ]=], opt) this line too ]] -- OPEN TERMINALS -- -map("n", "", [[vnew term://bash ]], opt) -- over right -map("n", "", [[ split term://bash | resize 10 ]], opt) -- bottom +map("n", "", [[vnew term://zsh ]], opt) -- over right +map("n", "", [[ split term://zsh | resize 10 ]], opt) -- bottom map("n", "t", [[ tabnew | term ]], opt) -- newtab -- COPY EVERYTHING in the file-- diff --git a/lua/nvim-lspconfig.lua b/lua/nvim-lspconfig.lua index 01655ab..b013672 100644 --- a/lua/nvim-lspconfig.lua +++ b/lua/nvim-lspconfig.lua @@ -38,14 +38,14 @@ end local lspconf = require("lspconfig") -- these langs require same lspconfig so put em all in a table and loop through! -local servers = {"html", "cssls", "tsserver", "pyright", "bashls", "clangd", "ccls"} +local lspservers = {"html", "cssls", "tsserver", "pyright", "bashls", "clangd", "ccls", "gopls"} -for _, lang in ipairs(servers) do - lspconf[lang].setup { - on_attach = on_attach, - root_dir = vim.loop.cwd - } -end +for _, lang in ipairs(lspservers) do + lspconf[lang].setup { + on_attach = on_attach, + root_dir = vim.loop.cwd + } + end -- vls conf example local vls_binary = "/usr/local/bin/vls" @@ -59,6 +59,29 @@ USER = "/home/" .. vim.fn.expand("$USER") local sumneko_root_path = USER .. "/.config/lua-language-server" local sumneko_binary = USER .. "/.config/lua-language-server/bin/Linux/lua-language-server" + +local lsp_installer = require'nvim-lsp-installer' + +function common_on_attach(client, bufnr) + -- setup buffer keymaps etc. +end + +local installed_servers = lsp_installer.get_installed_servers() + +for _, server in pairs(installed_servers) do + opts = { + on_attach = common_on_attach, + } + + -- (optional) Customize the options passed to the server + -- if server.name == "tsserver" then + -- opts.root_dir = function() ... end + -- end + + server:setup(opts) +end + + lspconf.sumneko_lua.setup { cmd = {sumneko_binary, "-E", sumneko_root_path .. "/main.lua"}, root_dir = function() diff --git a/lua/pluginList.lua b/lua/pluginList.lua index 4b60d9b..8afbfe0 100644 --- a/lua/pluginList.lua +++ b/lua/pluginList.lua @@ -4,13 +4,13 @@ local use = packer.use -- using { } for using different branch , loading plugin with certain commands etc return require("packer").startup( function() + use 'neovim/nvim-lsp-config' + use 'williamboman/nvim-lsp-installer' use "wbthomason/packer.nvim" - -- color related stuff use "siduck76/nvim-base16.lua" use "norcalli/nvim-colorizer.lua" -- use "ollykel/v-vim" -- v syntax highlighter - -- lsp stuff use "nvim-treesitter/nvim-treesitter" use "neovim/nvim-lspconfig" @@ -46,7 +46,7 @@ return require("packer").startup( -- discord rich presence --use "andweeb/presence.nvim" - + use "wakatime/vim-wakatime" use {"lukas-reineke/indent-blankline.nvim", branch = "lua"} end, { From 4b3682a34303a8eb79498cdda2d8062a76091dbc Mon Sep 17 00:00:00 2001 From: marvelman3284 Date: Tue, 1 Jun 2021 09:25:04 -0400 Subject: [PATCH 02/11] Unpersonalize my dots --- lua/nvim-lspconfig.lua | 4 ++-- lua/pluginList.lua | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/lua/nvim-lspconfig.lua b/lua/nvim-lspconfig.lua index b013672..5cc97b4 100644 --- a/lua/nvim-lspconfig.lua +++ b/lua/nvim-lspconfig.lua @@ -38,9 +38,9 @@ end local lspconf = require("lspconfig") -- these langs require same lspconfig so put em all in a table and loop through! -local lspservers = {"html", "cssls", "tsserver", "pyright", "bashls", "clangd", "ccls", "gopls"} +local servers = {"html", "cssls", "tsserver", "pyright", "bashls", "clangd", "ccls", "gopls"} -for _, lang in ipairs(lspservers) do +for _, lang in ipairs(servers) do lspconf[lang].setup { on_attach = on_attach, root_dir = vim.loop.cwd diff --git a/lua/pluginList.lua b/lua/pluginList.lua index 8afbfe0..f08ab15 100644 --- a/lua/pluginList.lua +++ b/lua/pluginList.lua @@ -4,7 +4,6 @@ local use = packer.use -- using { } for using different branch , loading plugin with certain commands etc return require("packer").startup( function() - use 'neovim/nvim-lsp-config' use 'williamboman/nvim-lsp-installer' use "wbthomason/packer.nvim" -- color related stuff @@ -46,7 +45,6 @@ return require("packer").startup( -- discord rich presence --use "andweeb/presence.nvim" - use "wakatime/vim-wakatime" use {"lukas-reineke/indent-blankline.nvim", branch = "lua"} end, { From 1e6432c4d1bb3589f6086e196f51f8af038f8614 Mon Sep 17 00:00:00 2001 From: marvelman3284 Date: Tue, 1 Jun 2021 09:25:59 -0400 Subject: [PATCH 03/11] Unpersonalize my dots --- lua/nvim-lspconfig.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/nvim-lspconfig.lua b/lua/nvim-lspconfig.lua index 5cc97b4..ca69b29 100644 --- a/lua/nvim-lspconfig.lua +++ b/lua/nvim-lspconfig.lua @@ -38,7 +38,7 @@ end local lspconf = require("lspconfig") -- these langs require same lspconfig so put em all in a table and loop through! -local servers = {"html", "cssls", "tsserver", "pyright", "bashls", "clangd", "ccls", "gopls"} +local servers = {"html", "cssls", "tsserver", "pyright", "bashls", "clangd", "ccls"} for _, lang in ipairs(servers) do lspconf[lang].setup { From 07859b4177af742a8be439561b391e7550b585c0 Mon Sep 17 00:00:00 2001 From: marvelman3284 Date: Tue, 1 Jun 2021 09:28:00 -0400 Subject: [PATCH 04/11] Unpersonalize my dots --- lua/nvim-lspconfig.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lua/nvim-lspconfig.lua b/lua/nvim-lspconfig.lua index ca69b29..ca5e205 100644 --- a/lua/nvim-lspconfig.lua +++ b/lua/nvim-lspconfig.lua @@ -42,10 +42,10 @@ local servers = {"html", "cssls", "tsserver", "pyright", "bashls", "clangd", "cc for _, lang in ipairs(servers) do lspconf[lang].setup { - on_attach = on_attach, - root_dir = vim.loop.cwd - } - end + on_attach = on_attach, + root_dir = vim.loop.cwd + } +end -- vls conf example local vls_binary = "/usr/local/bin/vls" From 9e701f08d3cad18ddd03a65a5abf42cf34ef2e8c Mon Sep 17 00:00:00 2001 From: marvelman3284 Date: Tue, 1 Jun 2021 12:03:42 -0400 Subject: [PATCH 05/11] Unpersonalize my dots --- lua/mappings.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/mappings.lua b/lua/mappings.lua index 1c91eee..73c9156 100644 --- a/lua/mappings.lua +++ b/lua/mappings.lua @@ -18,8 +18,8 @@ map("v", "x", [=[ "_x ]=], opt) this line too ]] -- OPEN TERMINALS -- -map("n", "", [[vnew term://zsh ]], opt) -- over right -map("n", "", [[ split term://zsh | resize 10 ]], opt) -- bottom +map("n", "", [[vnew term://bash]], opt) -- over right +map("n", "", [[ split term://bash| resize 10 ]], opt) -- bottom map("n", "t", [[ tabnew | term ]], opt) -- newtab -- COPY EVERYTHING in the file-- From 07a169b16de7dc3126069f500e4ddedc1427046a Mon Sep 17 00:00:00 2001 From: marvelman3284 Date: Tue, 1 Jun 2021 12:04:20 -0400 Subject: [PATCH 06/11] Remove duplicate functions --- lua/nvim-lspconfig.lua | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lua/nvim-lspconfig.lua b/lua/nvim-lspconfig.lua index ca5e205..b8e980e 100644 --- a/lua/nvim-lspconfig.lua +++ b/lua/nvim-lspconfig.lua @@ -62,10 +62,6 @@ local sumneko_binary = USER .. "/.config/lua-language-server/bin/Linux/lua-langu local lsp_installer = require'nvim-lsp-installer' -function common_on_attach(client, bufnr) - -- setup buffer keymaps etc. -end - local installed_servers = lsp_installer.get_installed_servers() for _, server in pairs(installed_servers) do From 7120f98f348a0a4dcf9b0f969b2d371a5a07a211 Mon Sep 17 00:00:00 2001 From: marvelman3284 Date: Tue, 1 Jun 2021 14:20:15 -0400 Subject: [PATCH 07/11] Change lsp-install provider --- lua/nvim-lspconfig.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/nvim-lspconfig.lua b/lua/nvim-lspconfig.lua index b8e980e..e118185 100644 --- a/lua/nvim-lspconfig.lua +++ b/lua/nvim-lspconfig.lua @@ -110,3 +110,4 @@ vim.fn.sign_define("LspDiagnosticsSignError", {text = "", numhl = "LspDiagnos vim.fn.sign_define("LspDiagnosticsSignWarning", {text = "", numhl = "LspDiagnosticsDefaultWarning"}) vim.fn.sign_define("LspDiagnosticsSignInformation", {text = "", numhl = "LspDiagnosticsDefaultInformation"}) vim.fn.sign_define("LspDiagnosticsSignHint", {text = "", numhl = "LspDiagnosticsDefaultHint"}) + From e12117a611ddacbfd6f7ce7512d9b78e99605d55 Mon Sep 17 00:00:00 2001 From: marvelman3284 Date: Tue, 1 Jun 2021 14:23:03 -0400 Subject: [PATCH 08/11] update plugin list --- lua/pluginList.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lua/pluginList.lua b/lua/pluginList.lua index f08ab15..d1bd8bd 100644 --- a/lua/pluginList.lua +++ b/lua/pluginList.lua @@ -4,8 +4,7 @@ local use = packer.use -- using { } for using different branch , loading plugin with certain commands etc return require("packer").startup( function() - use 'williamboman/nvim-lsp-installer' - use "wbthomason/packer.nvim" + use "kabouzeid/nvim-lspinstall" -- color related stuff use "siduck76/nvim-base16.lua" use "norcalli/nvim-colorizer.lua" From d7c0e1fefb9a857777f26e71994c3f3fa074f62d Mon Sep 17 00:00:00 2001 From: siduck76 Date: Tue, 1 Jun 2021 23:56:37 +0530 Subject: [PATCH 09/11] Update mappings.lua --- lua/mappings.lua | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lua/mappings.lua b/lua/mappings.lua index 73c9156..5ec8766 100644 --- a/lua/mappings.lua +++ b/lua/mappings.lua @@ -1,4 +1,4 @@ -local function map(mode, lhs, rhs, opts) + local function map(mode, lhs, rhs, opts) local options = {noremap = true} if opts then options = vim.tbl_extend("force", options, opts) @@ -16,13 +16,12 @@ map("v", "dd", [=[ "_dd ]=], opt) map("v", "x", [=[ "_x ]=], opt) this line too ]] - -- OPEN TERMINALS -- -map("n", "", [[vnew term://bash]], opt) -- over right -map("n", "", [[ split term://bash| resize 10 ]], opt) -- bottom -map("n", "t", [[ tabnew | term ]], opt) -- newtab +map("n", "", [[vnew term://bash ]], opt) -- term over right +map("n", "", [[ split term://bash | resize 10 ]], opt) -- term bottom +map("n", "t", [[ tabnew | term ]], opt) -- term newtab --- COPY EVERYTHING in the file-- +-- COPY EVERYTHING -- map("n", "", [[ %y+]], opt) -- toggle numbers --- @@ -32,4 +31,5 @@ map("n", "n", [[ set nu!]], opt) map("n", "z", [[ TZAtaraxis]], opt) map("n", "m", [[ TZMinimalist]], opt) -map("n", "", [[ w ]], opt) -- save +map("n", "", [[ w ]], opt) +-- vim.cmd("inoremap jh ") From 2d7ccc16f22bf345d7e26719e76b13d6feaa746c Mon Sep 17 00:00:00 2001 From: siduck76 Date: Tue, 1 Jun 2021 23:58:24 +0530 Subject: [PATCH 10/11] added lspInstall to pluginlist --- lua/pluginList.lua | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lua/pluginList.lua b/lua/pluginList.lua index d1bd8bd..2d7368f 100644 --- a/lua/pluginList.lua +++ b/lua/pluginList.lua @@ -4,18 +4,20 @@ local use = packer.use -- using { } for using different branch , loading plugin with certain commands etc return require("packer").startup( function() - use "kabouzeid/nvim-lspinstall" + use "wbthomason/packer.nvim" + -- color related stuff use "siduck76/nvim-base16.lua" use "norcalli/nvim-colorizer.lua" - -- use "ollykel/v-vim" -- v syntax highlighter - -- lsp stuff + + -- lang stuff use "nvim-treesitter/nvim-treesitter" use "neovim/nvim-lspconfig" use "hrsh7th/nvim-compe" use "onsails/lspkind-nvim" use "sbdchd/neoformat" use "nvim-lua/plenary.nvim" + use "kabouzeid/nvim-lspinstall" use "lewis6991/gitsigns.nvim" use "akinsho/nvim-bufferline.lua" @@ -41,14 +43,11 @@ return require("packer").startup( use "karb94/neoscroll.nvim" use "kdav5758/TrueZen.nvim" use "folke/which-key.nvim" - - -- discord rich presence - --use "andweeb/presence.nvim" use {"lukas-reineke/indent-blankline.nvim", branch = "lua"} end, { display = { - border = { "┌", "─", "┐", "│", "┘", "─", "└", "│" } + border = {"┌", "─", "┐", "│", "┘", "─", "└", "│"} } } ) From b2cefbe3b8826b7cbc3f8dfd7c2cfd38cd0e412a Mon Sep 17 00:00:00 2001 From: siduck76 Date: Wed, 2 Jun 2021 00:01:05 +0530 Subject: [PATCH 11/11] added lspconfig+lspinstall configs! --- lua/nvim-lspconfig.lua | 111 ++++++++++++++++------------------------- 1 file changed, 44 insertions(+), 67 deletions(-) diff --git a/lua/nvim-lspconfig.lua b/lua/nvim-lspconfig.lua index e118185..29fe29d 100644 --- a/lua/nvim-lspconfig.lua +++ b/lua/nvim-lspconfig.lua @@ -1,4 +1,4 @@ -function on_attach(client) + function on_attach(client) local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end @@ -35,79 +35,56 @@ function on_attach(client) end end -local lspconf = require("lspconfig") +-- lspInstall + lspconfig stuff --- these langs require same lspconfig so put em all in a table and loop through! -local servers = {"html", "cssls", "tsserver", "pyright", "bashls", "clangd", "ccls"} +local function setup_servers() + require "lspinstall".setup() -for _, lang in ipairs(servers) do - lspconf[lang].setup { - on_attach = on_attach, - root_dir = vim.loop.cwd - } -end + local lspconf = require("lspconfig") + local servers = require "lspinstall".installed_servers() --- vls conf example -local vls_binary = "/usr/local/bin/vls" -lspconf.vls.setup { - cmd = {vls_binary} -} - --- lua lsp settings -USER = "/home/" .. vim.fn.expand("$USER") - -local sumneko_root_path = USER .. "/.config/lua-language-server" -local sumneko_binary = USER .. "/.config/lua-language-server/bin/Linux/lua-language-server" - - -local lsp_installer = require'nvim-lsp-installer' - -local installed_servers = lsp_installer.get_installed_servers() - -for _, server in pairs(installed_servers) do - opts = { - on_attach = common_on_attach, - } - - -- (optional) Customize the options passed to the server - -- if server.name == "tsserver" then - -- opts.root_dir = function() ... end - -- end - - server:setup(opts) -end - - -lspconf.sumneko_lua.setup { - cmd = {sumneko_binary, "-E", sumneko_root_path .. "/main.lua"}, - root_dir = function() - return vim.loop.cwd() - end, - settings = { - Lua = { - runtime = { - version = "LuaJIT", - path = vim.split(package.path, ";") - }, - diagnostics = { - globals = {"vim"} - }, - workspace = { - library = { - [vim.fn.expand("$VIMRUNTIME/lua")] = true, - [vim.fn.expand("$VIMRUNTIME/lua/vim/lsp")] = true - } - }, - telemetry = { - enable = false + for _, lang in pairs(servers) do + if lang ~= "lua" then + lspconf[lang].setup { + on_attach = on_attach, + root_dir = vim.loop.cwd } - } - } -} + elseif lang == "lua" then + lspconf.sumneko_lua.setup { + root_dir = function() + return vim.loop.cwd() + end, + settings = { + Lua = { + diagnostics = { + globals = {"vim"} + }, + workspace = { + library = { + [vim.fn.expand("$VIMRUNTIME/lua")] = true, + [vim.fn.expand("$VIMRUNTIME/lua/vim/lsp")] = true + } + }, + telemetry = { + enable = false + } + } + } + } + end + end +end + +setup_servers() + +-- Automatically reload after `:LspInstall ` so we don't have to restart neovim +require "lspinstall".post_install_hook = function() + setup_servers() -- reload installed servers + vim.cmd("bufdo e") -- this triggers the FileType autocmd that starts the server +end -- replace the default lsp diagnostic letters with prettier symbols vim.fn.sign_define("LspDiagnosticsSignError", {text = "", numhl = "LspDiagnosticsDefaultError"}) vim.fn.sign_define("LspDiagnosticsSignWarning", {text = "", numhl = "LspDiagnosticsDefaultWarning"}) vim.fn.sign_define("LspDiagnosticsSignInformation", {text = "", numhl = "LspDiagnosticsDefaultInformation"}) vim.fn.sign_define("LspDiagnosticsSignHint", {text = "", numhl = "LspDiagnosticsDefaultHint"}) -