summaryrefslogtreecommitdiff
path: root/.config/nvim
diff options
context:
space:
mode:
authorAdam <adam.moloney.stuck@gmail.com>2022-03-18 15:53:37 +0100
committeradamstuck <adam.moloney.stuck@gmail.com>2022-03-18 17:48:01 +0100
commitc72b5230b168e3481b4660b006bb7681c6aa54fa (patch)
treeab57e4704554a9548b6465c068ac740ea1aec2d5 /.config/nvim
parente249ca56974a5b6aa7ad1f194decd6ae216befe2 (diff)
nvim: better cmp lazy loading, lsp format on save
Diffstat (limited to '.config/nvim')
-rw-r--r--.config/nvim/lua/plugins.lua4
-rw-r--r--.config/nvim/lua/setup/lualine.lua8
-rw-r--r--.config/nvim/lua/setup/nvim-cmp.lua1
-rw-r--r--.config/nvim/lua/setup/nvim-lsp-installer.lua7
4 files changed, 12 insertions, 8 deletions
diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua
index 008cb78..da232d4 100644
--- a/.config/nvim/lua/plugins.lua
+++ b/.config/nvim/lua/plugins.lua
@@ -90,12 +90,12 @@ local plugins = {
end
},
- -- load luasnips + cmp related in insert mode only
+ -- load luasnips + cmp related when lsp attaches
{
"L3MON4D3/LuaSnip",
wants = "friendly-snippets",
- event = "InsertEnter",
+ event = "User lspAttached",
config = function()
require("luasnip/loaders/from_vscode").lazy_load()
end,
diff --git a/.config/nvim/lua/setup/lualine.lua b/.config/nvim/lua/setup/lualine.lua
index 1182fce..8c8649e 100644
--- a/.config/nvim/lua/setup/lualine.lua
+++ b/.config/nvim/lua/setup/lualine.lua
@@ -4,7 +4,7 @@ require'lualine'.setup {
theme = 'onedark',
component_separators = {left = '', right = ''},
section_separators = {left = '', right = ''},
- disabled_filetypes = {'startify', 'terminal', 'netrw', 'NvimTree', 'packer'}
+ disabled_filetypes = {'startify', 'terminal', 'netrw', 'NvimTree', 'packer'},
},
sections = {
lualine_a = {'mode'},
@@ -12,7 +12,7 @@ require'lualine'.setup {
lualine_c = {'filename'},
lualine_x = {'encoding', 'filetype'},
lualine_y = {'progress'},
- lualine_z = {'location'}
+ lualine_z = {'location'},
},
inactive_sections = {
lualine_a = {},
@@ -20,8 +20,8 @@ require'lualine'.setup {
lualine_c = {'filename'},
lualine_x = {'location'},
lualine_y = {},
- lualine_z = {}
+ lualine_z = {},
},
tabline = {},
- extensions = {}
+ extensions = {},
}
diff --git a/.config/nvim/lua/setup/nvim-cmp.lua b/.config/nvim/lua/setup/nvim-cmp.lua
index 584da73..4f08334 100644
--- a/.config/nvim/lua/setup/nvim-cmp.lua
+++ b/.config/nvim/lua/setup/nvim-cmp.lua
@@ -48,4 +48,3 @@ cmp.setup {
{ name = 'luasnip' },
},
}
-vim.cmd('autocmd FileType markdown lua require("cmp").setup.buffer { enabled = false }')
diff --git a/.config/nvim/lua/setup/nvim-lsp-installer.lua b/.config/nvim/lua/setup/nvim-lsp-installer.lua
index bd3496e..de086f0 100644
--- a/.config/nvim/lua/setup/nvim-lsp-installer.lua
+++ b/.config/nvim/lua/setup/nvim-lsp-installer.lua
@@ -3,7 +3,12 @@ local lsp_installer = require("nvim-lsp-installer")
-- Register a handler that will be called for each installed server when it's ready (i.e. when installation is finished
-- or if the server is already installed).
lsp_installer.on_server_ready(function(server)
- local opts = {}
+ local opts = {
+ on_attach = function()
+ vim.cmd('doautocmd User lspAttached')
+ vim.cmd('autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_sync()')
+ end,
+ }
-- (optional) Customize the options passed to the server
-- if server.name == "tsserver" then