diff --git a/lua/mappings.lua b/lua/mappings.lua index 70fde6a..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 ") diff --git a/lua/nvim-lspconfig.lua b/lua/nvim-lspconfig.lua index 01655ab..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,56 +35,53 @@ 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 - } + local lspconf = require("lspconfig") + local servers = require "lspinstall".installed_servers() + + 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 --- vls conf example -local vls_binary = "/usr/local/bin/vls" -lspconf.vls.setup { - cmd = {vls_binary} -} +setup_servers() --- 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 { - 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 - } - } - } -} +-- 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"}) diff --git a/lua/pluginList.lua b/lua/pluginList.lua index 4b60d9b..2d7368f 100644 --- a/lua/pluginList.lua +++ b/lua/pluginList.lua @@ -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,15 +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 = {"┌", "─", "┐", "│", "┘", "─", "└", "│"} } } )