LSP improvements
This commit is contained in:
parent
b439b09556
commit
4d610fd8dd
14 changed files with 82 additions and 54 deletions
|
@ -1 +1 @@
|
||||||
vim.o.shiftwidth = 2
|
vim.opt.shiftwidth = 2
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
vim.o.expandtab = false
|
vim.opt.expandtab = false
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
vim.o.shiftwidth = 2
|
vim.opt.shiftwidth = 2
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
vim.o.shiftwidth = 2
|
vim.opt.shiftwidth = 2
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
vim.o.shiftwidth = 2
|
vim.opt.shiftwidth = 2
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
vim.keymap.set('n', 'gB', ':!tectonic main.tex<CR>')
|
vim.keymap.set('n', 'gB', ':!tectonic main.tex<CR>')
|
||||||
|
vim.opt.wrap = true
|
||||||
|
|
||||||
local function getWords()
|
local function getWords()
|
||||||
local words = vim.fn.wordcount().words
|
local words = vim.fn.wordcount().words
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
vim.o.shiftwidth = 2
|
vim.opt.shiftwidth = 2
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
vim.o.shiftwidth = 2
|
vim.opt.shiftwidth = 2
|
||||||
|
|
|
@ -5,6 +5,8 @@ require('packer').startup(function(use)
|
||||||
use 'williamboman/mason.nvim'
|
use 'williamboman/mason.nvim'
|
||||||
use 'williamboman/mason-lspconfig.nvim'
|
use 'williamboman/mason-lspconfig.nvim'
|
||||||
use 'neovim/nvim-lspconfig'
|
use 'neovim/nvim-lspconfig'
|
||||||
|
use 'j-hui/fidget.nvim'
|
||||||
|
use 'ray-x/lsp_signature.nvim'
|
||||||
|
|
||||||
use 'nvim-lualine/lualine.nvim'
|
use 'nvim-lualine/lualine.nvim'
|
||||||
use 'morhetz/gruvbox'
|
use 'morhetz/gruvbox'
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
local cmp = require('cmp')
|
local cmp = require('cmp')
|
||||||
cmp.setup {
|
cmp.setup {
|
||||||
mapping = {
|
mapping = {
|
||||||
|
['<C-Space>'] = cmp.mapping.complete(),
|
||||||
['<CR>'] = cmp.mapping.confirm {
|
['<CR>'] = cmp.mapping.confirm {
|
||||||
behavior = cmp.ConfirmBehavior.Insert,
|
behavior = cmp.ConfirmBehavior.Insert,
|
||||||
select = true,
|
select = true,
|
||||||
|
|
|
@ -1,36 +1,37 @@
|
||||||
|
require('fidget').setup({})
|
||||||
|
require('lsp_signature').setup()
|
||||||
|
|
||||||
require('mason').setup()
|
require('mason').setup()
|
||||||
require('mason-lspconfig').setup({
|
require('mason-lspconfig').setup({
|
||||||
automatic_installation = true,
|
automatic_installation = true,
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Format on save
|
-- Format on save
|
||||||
local function format_on_save()
|
|
||||||
vim.lsp.buf.formatting_sync()
|
|
||||||
end
|
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd(
|
vim.api.nvim_create_autocmd(
|
||||||
'BufWritePre',
|
'BufWritePre',
|
||||||
{
|
{
|
||||||
pattern = { '<buffer>' },
|
pattern = { '<buffer>' },
|
||||||
callback = format_on_save,
|
callback = vim.lsp.buf.formatting_sync,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
-- Language Servers
|
-- Language Servers
|
||||||
require('lspconfig')['gopls'].setup({})
|
local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||||
require('lspconfig')['pyright'].setup({})
|
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||||
require('lspconfig')['rust_analyzer'].setup({})
|
|
||||||
|
|
||||||
require('lspconfig')['html'].setup({})
|
local language_servers = { 'gopls', 'pyright', 'rust_analyzer', 'html', 'cssls', 'tsserver', 'emmet_ls', 'sumneko_lua' }
|
||||||
require('lspconfig')['cssls'].setup({})
|
local settings = {
|
||||||
require('lspconfig')['tsserver'].setup({})
|
Lua = {
|
||||||
|
diagnostics = {
|
||||||
require('lspconfig')['sumneko_lua'].setup({
|
globals = { 'vim' }
|
||||||
settings = {
|
|
||||||
Lua = {
|
|
||||||
diagnostics = {
|
|
||||||
globals = { 'vim' }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
|
||||||
|
for _, server in ipairs(language_servers) do
|
||||||
|
require('lspconfig')[server].setup({
|
||||||
|
capabilities = capabilities,
|
||||||
|
settings = settings,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
|
@ -1,17 +1,18 @@
|
||||||
vim.cmd [[colorscheme gruvbox]]
|
vim.cmd [[colorscheme gruvbox]]
|
||||||
|
|
||||||
vim.o.number = true
|
vim.opt.wrap = false
|
||||||
vim.o.relativenumber = true
|
vim.opt.number = true
|
||||||
vim.o.splitright = true
|
vim.opt.relativenumber = true
|
||||||
vim.o.splitbelow = true
|
vim.opt.splitright = true
|
||||||
vim.o.scrolloff = 10
|
vim.opt.splitbelow = true
|
||||||
|
vim.opt.scrolloff = 10
|
||||||
|
|
||||||
vim.o.foldenable = false
|
vim.opt.foldenable = false
|
||||||
vim.api.nvim_set_var('tex_flavor', 'latex')
|
vim.api.nvim_set_var('tex_flavor', 'latex')
|
||||||
|
|
||||||
-- Tab Settings
|
-- Tab Settings
|
||||||
vim.o.tabstop = 4
|
vim.opt.tabstop = 4
|
||||||
vim.o.softtabstop = 0
|
vim.opt.softtabstop = 0
|
||||||
vim.o.expandtab = true
|
vim.opt.expandtab = true
|
||||||
vim.o.shiftwidth = 4
|
vim.opt.shiftwidth = 4
|
||||||
vim.o.smarttab = true
|
vim.opt.smarttab = true
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
require('nvim-treesitter.configs').setup({
|
require('nvim-treesitter.configs').setup({
|
||||||
highlight = {
|
highlight = {
|
||||||
enable = true,
|
enable = true,
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
|
|
|
@ -9,23 +9,26 @@ vim.api.nvim_command('packadd packer.nvim')
|
||||||
|
|
||||||
local no_errors, error_msg = pcall(function()
|
local no_errors, error_msg = pcall(function()
|
||||||
|
|
||||||
local time
|
_G._packer = _G._packer or {}
|
||||||
local profile_info
|
_G._packer.inside_compile = true
|
||||||
local should_profile = false
|
|
||||||
if should_profile then
|
local time
|
||||||
local hrtime = vim.loop.hrtime
|
local profile_info
|
||||||
profile_info = {}
|
local should_profile = false
|
||||||
time = function(chunk, start)
|
if should_profile then
|
||||||
if start then
|
local hrtime = vim.loop.hrtime
|
||||||
profile_info[chunk] = hrtime()
|
profile_info = {}
|
||||||
else
|
time = function(chunk, start)
|
||||||
profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6
|
if start then
|
||||||
end
|
profile_info[chunk] = hrtime()
|
||||||
|
else
|
||||||
|
profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6
|
||||||
end
|
end
|
||||||
else
|
|
||||||
time = function(chunk, start) end
|
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
time = function(chunk, start) end
|
||||||
|
end
|
||||||
|
|
||||||
local function save_profiles(threshold)
|
local function save_profiles(threshold)
|
||||||
local sorted_times = {}
|
local sorted_times = {}
|
||||||
for chunk_name, time_taken in pairs(profile_info) do
|
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'
|
results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms'
|
||||||
end
|
end
|
||||||
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
|
_G._packer.profile_output = results
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -99,6 +104,11 @@ _G.packer_plugins = {
|
||||||
path = "/home/digyx/.local/share/nvim/site/pack/packer/start/cmp_luasnip",
|
path = "/home/digyx/.local/share/nvim/site/pack/packer/start/cmp_luasnip",
|
||||||
url = "https://github.com/saadparwaiz1/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"] = {
|
["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" },
|
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,
|
loaded = false,
|
||||||
|
@ -112,6 +122,11 @@ _G.packer_plugins = {
|
||||||
path = "/home/digyx/.local/share/nvim/site/pack/packer/start/gruvbox",
|
path = "/home/digyx/.local/share/nvim/site/pack/packer/start/gruvbox",
|
||||||
url = "https://github.com/morhetz/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"] = {
|
["lualine.nvim"] = {
|
||||||
loaded = true,
|
loaded = true,
|
||||||
path = "/home/digyx/.local/share/nvim/site/pack/packer/start/lualine.nvim",
|
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)]]
|
vim.cmd [[au BufWinEnter * ++once lua require("packer.load")({'gitsigns.nvim'}, { event = "BufWinEnter *" }, _G.packer_plugins)]]
|
||||||
time([[Defining lazy-load event autocommands]], false)
|
time([[Defining lazy-load event autocommands]], false)
|
||||||
vim.cmd("augroup END")
|
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
|
if should_profile then save_profiles() end
|
||||||
|
|
||||||
end)
|
end)
|
||||||
|
|
Loading…
Reference in a new issue