LSP improvements

This commit is contained in:
Devon Tingley 2022-09-26 20:15:16 -04:00
parent b439b09556
commit 4d610fd8dd
14 changed files with 82 additions and 54 deletions

View file

@ -1 +1 @@
vim.o.shiftwidth = 2
vim.opt.shiftwidth = 2

View file

@ -1 +1 @@
vim.o.expandtab = false
vim.opt.expandtab = false

View file

@ -1 +1 @@
vim.o.shiftwidth = 2
vim.opt.shiftwidth = 2

View file

@ -1 +1 @@
vim.o.shiftwidth = 2
vim.opt.shiftwidth = 2

View file

@ -1 +1 @@
vim.o.shiftwidth = 2
vim.opt.shiftwidth = 2

View file

@ -1,4 +1,5 @@
vim.keymap.set('n', 'gB', ':!tectonic main.tex<CR>')
vim.opt.wrap = true
local function getWords()
local words = vim.fn.wordcount().words

View file

@ -1 +1 @@
vim.o.shiftwidth = 2
vim.opt.shiftwidth = 2

View file

@ -1 +1 @@
vim.o.shiftwidth = 2
vim.opt.shiftwidth = 2

View file

@ -5,6 +5,8 @@ require('packer').startup(function(use)
use 'williamboman/mason.nvim'
use 'williamboman/mason-lspconfig.nvim'
use 'neovim/nvim-lspconfig'
use 'j-hui/fidget.nvim'
use 'ray-x/lsp_signature.nvim'
use 'nvim-lualine/lualine.nvim'
use 'morhetz/gruvbox'

View file

@ -1,6 +1,7 @@
local cmp = require('cmp')
cmp.setup {
mapping = {
['<C-Space>'] = cmp.mapping.complete(),
['<CR>'] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Insert,
select = true,

View file

@ -1,36 +1,37 @@
require('fidget').setup({})
require('lsp_signature').setup()
require('mason').setup()
require('mason-lspconfig').setup({
automatic_installation = true,
})
-- Format on save
local function format_on_save()
vim.lsp.buf.formatting_sync()
end
vim.api.nvim_create_autocmd(
'BufWritePre',
{
pattern = { '<buffer>' },
callback = format_on_save,
callback = vim.lsp.buf.formatting_sync,
}
)
-- Language Servers
require('lspconfig')['gopls'].setup({})
require('lspconfig')['pyright'].setup({})
require('lspconfig')['rust_analyzer'].setup({})
local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
capabilities.textDocument.completion.completionItem.snippetSupport = true
require('lspconfig')['html'].setup({})
require('lspconfig')['cssls'].setup({})
require('lspconfig')['tsserver'].setup({})
require('lspconfig')['sumneko_lua'].setup({
settings = {
Lua = {
diagnostics = {
globals = { 'vim' }
}
local language_servers = { 'gopls', 'pyright', 'rust_analyzer', 'html', 'cssls', 'tsserver', 'emmet_ls', 'sumneko_lua' }
local settings = {
Lua = {
diagnostics = {
globals = { 'vim' }
}
}
})
}
for _, server in ipairs(language_servers) do
require('lspconfig')[server].setup({
capabilities = capabilities,
settings = settings,
})
end

View file

@ -1,17 +1,18 @@
vim.cmd [[colorscheme gruvbox]]
vim.o.number = true
vim.o.relativenumber = true
vim.o.splitright = true
vim.o.splitbelow = true
vim.o.scrolloff = 10
vim.opt.wrap = false
vim.opt.number = true
vim.opt.relativenumber = true
vim.opt.splitright = true
vim.opt.splitbelow = true
vim.opt.scrolloff = 10
vim.o.foldenable = false
vim.opt.foldenable = false
vim.api.nvim_set_var('tex_flavor', 'latex')
-- Tab Settings
vim.o.tabstop = 4
vim.o.softtabstop = 0
vim.o.expandtab = true
vim.o.shiftwidth = 4
vim.o.smarttab = true
vim.opt.tabstop = 4
vim.opt.softtabstop = 0
vim.opt.expandtab = true
vim.opt.shiftwidth = 4
vim.opt.smarttab = true

View file

@ -1,5 +1,5 @@
require('nvim-treesitter.configs').setup({
highlight = {
enable = true,
}
},
})

View file

@ -9,23 +9,26 @@ vim.api.nvim_command('packadd packer.nvim')
local no_errors, error_msg = pcall(function()
local time
local profile_info
local should_profile = false
if should_profile then
local hrtime = vim.loop.hrtime
profile_info = {}
time = function(chunk, start)
if start then
profile_info[chunk] = hrtime()
else
profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6
end
_G._packer = _G._packer or {}
_G._packer.inside_compile = true
local time
local profile_info
local should_profile = false
if should_profile then
local hrtime = vim.loop.hrtime
profile_info = {}
time = function(chunk, start)
if start then
profile_info[chunk] = hrtime()
else
profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6
end
else
time = function(chunk, start) end
end
else
time = function(chunk, start) end
end
local function save_profiles(threshold)
local sorted_times = {}
for chunk_name, time_taken in pairs(profile_info) do
@ -38,8 +41,10 @@ local function save_profiles(threshold)
results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms'
end
end
if threshold then
table.insert(results, '(Only showing plugins that took longer than ' .. threshold .. ' ms ' .. 'to load)')
end
_G._packer = _G._packer or {}
_G._packer.profile_output = results
end
@ -99,6 +104,11 @@ _G.packer_plugins = {
path = "/home/digyx/.local/share/nvim/site/pack/packer/start/cmp_luasnip",
url = "https://github.com/saadparwaiz1/cmp_luasnip"
},
["fidget.nvim"] = {
loaded = true,
path = "/home/digyx/.local/share/nvim/site/pack/packer/start/fidget.nvim",
url = "https://github.com/j-hui/fidget.nvim"
},
["gitsigns.nvim"] = {
config = { "\27LJ\2\n6\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\rgitsigns\frequire\0" },
loaded = false,
@ -112,6 +122,11 @@ _G.packer_plugins = {
path = "/home/digyx/.local/share/nvim/site/pack/packer/start/gruvbox",
url = "https://github.com/morhetz/gruvbox"
},
["lsp_signature.nvim"] = {
loaded = true,
path = "/home/digyx/.local/share/nvim/site/pack/packer/start/lsp_signature.nvim",
url = "https://github.com/ray-x/lsp_signature.nvim"
},
["lualine.nvim"] = {
loaded = true,
path = "/home/digyx/.local/share/nvim/site/pack/packer/start/lualine.nvim",
@ -197,6 +212,13 @@ time([[Defining lazy-load event autocommands]], true)
vim.cmd [[au BufWinEnter * ++once lua require("packer.load")({'gitsigns.nvim'}, { event = "BufWinEnter *" }, _G.packer_plugins)]]
time([[Defining lazy-load event autocommands]], false)
vim.cmd("augroup END")
_G._packer.inside_compile = false
if _G._packer.needs_bufread == true then
vim.cmd("doautocmd BufRead")
end
_G._packer.needs_bufread = false
if should_profile then save_profiles() end
end)