Add lspinstall functionality

This commit is contained in:
marvelman3284 2021-06-01 09:22:24 -04:00
parent 2ff84eaf19
commit f7a1a5dc92
3 changed files with 35 additions and 12 deletions

View File

@ -18,8 +18,8 @@ map("v", "x", [=[ "_x ]=], opt)
this line too ]]
-- OPEN TERMINALS --
map("n", "<C-l>", [[<Cmd>vnew term://bash <CR>]], opt) -- over right
map("n", "<C-x>", [[<Cmd> split term://bash | resize 10 <CR>]], opt) -- bottom
map("n", "<C-l>", [[<Cmd>vnew term://zsh <CR>]], opt) -- over right
map("n", "<C-x>", [[<Cmd> split term://zsh | resize 10 <CR>]], opt) -- bottom
map("n", "<C-t>t", [[<Cmd> tabnew | term <CR>]], opt) -- newtab
-- COPY EVERYTHING in the file--

View File

@ -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()

View File

@ -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,
{