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.opt.wrap = true
|
||||
|
||||
local function getWords()
|
||||
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-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'
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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 = {
|
||||
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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
require('nvim-treesitter.configs').setup({
|
||||
highlight = {
|
||||
enable = true,
|
||||
}
|
||||
},
|
||||
})
|
||||
|
|
|
@ -9,6 +9,9 @@ vim.api.nvim_command('packadd packer.nvim')
|
|||
|
||||
local no_errors, error_msg = pcall(function()
|
||||
|
||||
_G._packer = _G._packer or {}
|
||||
_G._packer.inside_compile = true
|
||||
|
||||
local time
|
||||
local profile_info
|
||||
local should_profile = false
|
||||
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue