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) map("v", "x", [=[ "_x ]=], opt)
this line too ]] this line too ]]
-- OPEN TERMINALS -- -- OPEN TERMINALS --
map("n", "<C-l>", [[<Cmd>vnew term://bash <CR>]], opt) -- over right 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) -- bottom map("n", "<C-x>", [[<Cmd> split term://bash | resize 10 <CR>]], opt) -- term bottom
map("n", "<C-t>t", [[<Cmd> tabnew | term <CR>]], opt) -- newtab 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) map("n", "<C-a>", [[ <Cmd> %y+<CR>]], opt)
-- toggle numbers --- -- 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>z", [[ <Cmd> TZAtaraxis<CR>]], opt)
map("n", "<leader>m", [[ <Cmd> TZMinimalist<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
end end
-- lspInstall + lspconfig stuff
local function setup_servers()
require "lspinstall".setup()
local lspconf = require("lspconfig") 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! for _, lang in pairs(servers) do
local servers = {"html", "cssls", "tsserver", "pyright", "bashls", "clangd", "ccls"} if lang ~= "lua" then
for _, lang in ipairs(servers) do
lspconf[lang].setup { lspconf[lang].setup {
on_attach = on_attach, on_attach = on_attach,
root_dir = vim.loop.cwd root_dir = vim.loop.cwd
} }
end elseif lang == "lua" then
-- 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"
lspconf.sumneko_lua.setup { lspconf.sumneko_lua.setup {
cmd = {sumneko_binary, "-E", sumneko_root_path .. "/main.lua"},
root_dir = function() root_dir = function()
return vim.loop.cwd() return vim.loop.cwd()
end, end,
settings = { settings = {
Lua = { Lua = {
runtime = {
version = "LuaJIT",
path = vim.split(package.path, ";")
},
diagnostics = { diagnostics = {
globals = {"vim"} 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 -- replace the default lsp diagnostic letters with prettier symbols
vim.fn.sign_define("LspDiagnosticsSignError", {text = "", numhl = "LspDiagnosticsDefaultError"}) vim.fn.sign_define("LspDiagnosticsSignError", {text = "", numhl = "LspDiagnosticsDefaultError"})

View file

@ -9,15 +9,15 @@ return require("packer").startup(
-- color related stuff -- color related stuff
use "siduck76/nvim-base16.lua" use "siduck76/nvim-base16.lua"
use "norcalli/nvim-colorizer.lua" use "norcalli/nvim-colorizer.lua"
-- use "ollykel/v-vim" -- v syntax highlighter
-- lsp stuff -- lang stuff
use "nvim-treesitter/nvim-treesitter" use "nvim-treesitter/nvim-treesitter"
use "neovim/nvim-lspconfig" use "neovim/nvim-lspconfig"
use "hrsh7th/nvim-compe" use "hrsh7th/nvim-compe"
use "onsails/lspkind-nvim" use "onsails/lspkind-nvim"
use "sbdchd/neoformat" use "sbdchd/neoformat"
use "nvim-lua/plenary.nvim" use "nvim-lua/plenary.nvim"
use "kabouzeid/nvim-lspinstall"
use "lewis6991/gitsigns.nvim" use "lewis6991/gitsigns.nvim"
use "akinsho/nvim-bufferline.lua" use "akinsho/nvim-bufferline.lua"
@ -43,10 +43,6 @@ return require("packer").startup(
use "karb94/neoscroll.nvim" use "karb94/neoscroll.nvim"
use "kdav5758/TrueZen.nvim" use "kdav5758/TrueZen.nvim"
use "folke/which-key.nvim" use "folke/which-key.nvim"
-- discord rich presence
--use "andweeb/presence.nvim"
use {"lukas-reineke/indent-blankline.nvim", branch = "lua"} use {"lukas-reineke/indent-blankline.nvim", branch = "lua"}
end, end,
{ {