Merge pull request #52 from marvelman3284/main

Added `lspinstall` functionality
This commit is contained in:
siduck76 2021-06-02 00:04:22 +05:30 committed by GitHub
commit 859a557297
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 53 additions and 60 deletions

View File

@ -16,13 +16,12 @@ map("v", "dd", [=[ "_dd ]=], opt)
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-t>t", [[<Cmd> tabnew | term <CR>]], opt) -- newtab
map("n", "<C-l>", [[<Cmd>vnew term://bash <CR>]], opt) -- term over right
map("n", "<C-x>", [[<Cmd> split term://bash | resize 10 <CR>]], opt) -- term bottom
map("n", "<C-t>t", [[<Cmd> tabnew | term <CR>]], opt) -- term newtab
-- COPY EVERYTHING in the file--
-- COPY EVERYTHING --
map("n", "<C-a>", [[ <Cmd> %y+<CR>]], opt)
-- toggle numbers ---
@ -32,4 +31,5 @@ map("n", "<leader>n", [[ <Cmd> set nu!<CR>]], opt)
map("n", "<leader>z", [[ <Cmd> TZAtaraxis<CR>]], opt)
map("n", "<leader>m", [[ <Cmd> TZMinimalist<CR>]], opt)
map("n", "<C-s>", [[ <Cmd> w <CR>]], opt) -- save
map("n", "<C-s>", [[ <Cmd> w <CR>]], opt)
-- vim.cmd("inoremap jh <Esc>")

View File

@ -35,41 +35,27 @@ function on_attach(client)
end
end
-- lspInstall + lspconfig stuff
local function setup_servers()
require "lspinstall".setup()
local lspconf = require("lspconfig")
local servers = require "lspinstall".installed_servers()
-- these langs require same lspconfig so put em all in a table and loop through!
local servers = {"html", "cssls", "tsserver", "pyright", "bashls", "clangd", "ccls"}
for _, lang in ipairs(servers) do
for _, lang in pairs(servers) do
if lang ~= "lua" then
lspconf[lang].setup {
on_attach = on_attach,
root_dir = vim.loop.cwd
}
end
-- 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"
elseif lang == "lua" then
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"}
},
@ -85,6 +71,17 @@ lspconf.sumneko_lua.setup {
}
}
}
end
end
end
setup_servers()
-- Automatically reload after `:LspInstall <server>` 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"})

View File

@ -9,15 +9,15 @@ return require("packer").startup(
-- 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"
@ -43,10 +43,6 @@ 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,
{