summaryrefslogtreecommitdiff
path: root/.config/nvim
diff options
context:
space:
mode:
authorGustaf Rydholm <gustaf.rydholm@gmail.com>2021-11-17 22:24:43 +0100
committerGustaf Rydholm <gustaf.rydholm@gmail.com>2021-11-17 22:24:43 +0100
commita3690ed8ca90823787fbaddb72f0a1874f1e999d (patch)
tree1b79521fdf10c133aa643e6b2e46522ab6b79097 /.config/nvim
parente953e2ee53503dcf070a7763743e4a76abb4518d (diff)
Add lunarvim update to lsp/general
Diffstat (limited to '.config/nvim')
-rw-r--r--.config/nvim/config.lua35
-rw-r--r--.config/nvim/ftdetect/nix.lua1
-rw-r--r--.config/nvim/ftplugin/python.lua2
-rw-r--r--.config/nvim/lua/bootstrap.lua3
-rw-r--r--.config/nvim/lua/config/defaults.lua7
-rw-r--r--.config/nvim/lua/config/init.lua5
-rw-r--r--.config/nvim/lua/core/autocmds.lua58
-rw-r--r--.config/nvim/lua/core/cmp.lua3
-rw-r--r--.config/nvim/lua/core/commands.lua1
-rw-r--r--.config/nvim/lua/core/log.lua2
-rw-r--r--.config/nvim/lua/core/nvimtree.lua2
-rw-r--r--.config/nvim/lua/core/which-key.lua4
-rw-r--r--.config/nvim/lua/keymappings.lua29
-rw-r--r--.config/nvim/lua/lsp/config.lua2
-rw-r--r--.config/nvim/lua/lsp/handlers.lua12
-rw-r--r--.config/nvim/lua/lsp/init.lua18
-rw-r--r--.config/nvim/lua/lsp/null-ls/formatters.lua29
-rw-r--r--.config/nvim/lua/lsp/null-ls/init.lua2
-rw-r--r--.config/nvim/lua/lsp/null-ls/linters.lua23
-rw-r--r--.config/nvim/lua/lsp/null-ls/services.lua14
-rw-r--r--.config/nvim/lua/plugin-loader.lua1
-rw-r--r--.config/nvim/lua/plugins.lua13
-rw-r--r--.config/nvim/lua/utils/init.lua60
23 files changed, 200 insertions, 126 deletions
diff --git a/.config/nvim/config.lua b/.config/nvim/config.lua
index ca28fa4..b391cf5 100644
--- a/.config/nvim/config.lua
+++ b/.config/nvim/config.lua
@@ -20,6 +20,7 @@ options.builtin.telescope.active = true
options.builtin.bufferline.active = true
options.builtin.lualine.active = true
options.builtin.lualine.style = "dark"
+options.builtin.project.patterns = { ".git" }
-- Whichkey
options.builtin.which_key.mappings.l.d = { "<cmd>TroubleToggle<cr>", "Diagnostics" }
@@ -58,6 +59,26 @@ options.builtin.treesitter.autotag.enable = false
options.builtin.treesitter.playground.enable = false
options.builtin.treesitter.indent.disable = { "python" }
+options.builtin.which_key.mappings["z"] = { "<cmd>ZenMode<cr>", "Zen" }
+options.builtin.which_key.mappings["r"] = {
+ name = "Replace",
+ r = { "<cmd>lua require('spectre').open()<cr>", "Replace" },
+ w = {
+ "<cmd>lua require('spectre').open_visual({select_word=true})<cr>",
+ "Replace Word",
+ },
+ f = { "<cmd>lua require('spectre').open_file_search()<cr>", "Replace Buffer" },
+}
+
+options.builtin.telescope.on_config_done = function()
+ local actions = require "telescope.actions"
+ options.builtin.telescope.defaults.mappings.i["<C-j>"] = actions.move_selection_next
+ options.builtin.telescope.defaults.mappings.i["<C-k>"] =
+ actions.move_selection_previous
+ options.builtin.telescope.defaults.mappings.i["<C-n>"] = actions.cycle_history_next
+ options.builtin.telescope.defaults.mappings.i["<C-p>"] = actions.cycle_history_prev
+end
+
-- Extra plugings
options.plugins = {
@@ -82,13 +103,13 @@ options.plugins = {
end,
},
- {
- "pwntester/octo.nvim",
- event = "BufRead",
- config = function()
- require("extra.octo").config()
- end,
- },
+ -- {
+ -- "pwntester/octo.nvim",
+ -- event = "BufRead",
+ -- config = function()
+ -- require("extra.octo").config()
+ -- end,
+ -- },
{
"unblevable/quick-scope",
diff --git a/.config/nvim/ftdetect/nix.lua b/.config/nvim/ftdetect/nix.lua
new file mode 100644
index 0000000..a85bcfd
--- /dev/null
+++ b/.config/nvim/ftdetect/nix.lua
@@ -0,0 +1 @@
+vim.cmd [[ au BufRead,BufNewFile *.nix set filetype=nix ]]
diff --git a/.config/nvim/ftplugin/python.lua b/.config/nvim/ftplugin/python.lua
index f1e9a50..a725200 100644
--- a/.config/nvim/ftplugin/python.lua
+++ b/.config/nvim/ftplugin/python.lua
@@ -1,4 +1,4 @@
local formatters = require "lsp.null-ls.formatters"
local linters = require "lsp.null-ls.linters"
formatters.setup { { exe = "black", filetypes = { "python" } } }
-formatters.setup { { exe = "flake8", filetypes = { "python" } } }
+linters.setup { { exe = "flake8", filetypes = { "python" } } }
diff --git a/.config/nvim/lua/bootstrap.lua b/.config/nvim/lua/bootstrap.lua
index a461964..4247f04 100644
--- a/.config/nvim/lua/bootstrap.lua
+++ b/.config/nvim/lua/bootstrap.lua
@@ -1,7 +1,5 @@
local M = {}
-local uv = vim.loop
-
---Join path segments that were passed as input
---@return string
function _G.join_paths(...)
@@ -67,7 +65,6 @@ function M:init()
return self
end
----Update LunarVim
---pulls the latest changes from github and, resets the startup cache
function M:update()
package.loaded["utils.hooks"] = nil
diff --git a/.config/nvim/lua/config/defaults.lua b/.config/nvim/lua/config/defaults.lua
index a4b1140..87ef57a 100644
--- a/.config/nvim/lua/config/defaults.lua
+++ b/.config/nvim/lua/config/defaults.lua
@@ -3,7 +3,12 @@ return {
colorscheme = "dark",
line_wrap_cursor_movement = true,
transparent_window = false,
- format_on_save = true,
+ format_on_save = {
+ ---@usage pattern string pattern used for the autocommand (Default: '*')
+ pattern = "*",
+ ---@usage timeout number timeout in ms for the format request (Default: 1000)
+ timeout = 1000,
+ },
keys = {},
builtin = {},
diff --git a/.config/nvim/lua/config/init.lua b/.config/nvim/lua/config/init.lua
index f40e30e..63f4d0f 100644
--- a/.config/nvim/lua/config/init.lua
+++ b/.config/nvim/lua/config/init.lua
@@ -20,7 +20,7 @@ end
-- Define options global variable
function M:init()
if vim.tbl_isempty(nvim or {}) then
- options = require "config.defaults"
+ options = vim.deepcopy(require "config.defaults")
local home_dir = vim.loop.os_homedir()
options.vsnip_dir = utils.join_paths(home_dir, ".config", "snippets")
options.database = {
@@ -112,7 +112,8 @@ function M:reload()
M:load()
local plugins = require "plugins"
- utils.toggle_autoformat()
+ local autocmds = require "core.autocmds"
+ autocmds.configure_format_on_save()
local plugin_loader = require "plugin-loader"
plugin_loader.cache_clear()
plugin_loader.load { plugins, options.plugins }
diff --git a/.config/nvim/lua/core/autocmds.lua b/.config/nvim/lua/core/autocmds.lua
index 1f50308..ecdcf36 100644
--- a/.config/nvim/lua/core/autocmds.lua
+++ b/.config/nvim/lua/core/autocmds.lua
@@ -1,4 +1,5 @@
local M = {}
+local Log = require "core.log"
--- Load the default set of autogroups and autocommands.
function M.load_augroups()
@@ -62,6 +63,63 @@ function M.load_augroups()
}
end
+local get_format_on_save_opts = function()
+ local defaults = require("config.defaults").format_on_save
+ -- accept a basic boolean `format_on_save=true`
+ if type(options.format_on_save) ~= "table" then
+ return defaults
+ end
+
+ return {
+ pattern = options.format_on_save.pattern or defaults.pattern,
+ timeout = options.format_on_save.timeout or defaults.timeout,
+ }
+end
+
+function M.enable_format_on_save(opts)
+ local fmd_cmd = string.format(
+ ":silent lua vim.lsp.buf.formatting_sync({}, %s)",
+ opts.timeout_ms
+ )
+ M.define_augroups {
+ format_on_save = { { "BufWritePre", opts.pattern, fmd_cmd } },
+ }
+ Log:debug "enabled format-on-save"
+end
+
+function M.disable_format_on_save()
+ M.remove_augroup "format_on_save"
+ Log:debug "disabled format-on-save"
+end
+
+function M.configure_format_on_save()
+ if options.format_on_save then
+ if vim.fn.exists "#format_on_save#BufWritePre" == 1 then
+ M.remove_augroup "format_on_save"
+ Log:debug "reloading format-on-save configuration"
+ end
+ local opts = get_format_on_save_opts()
+ M.enable_format_on_save(opts)
+ else
+ M.disable_format_on_save()
+ end
+end
+
+function M.toggle_format_on_save()
+ if vim.fn.exists "#format_on_save#BufWritePre" == 0 then
+ local opts = get_format_on_save_opts()
+ M.enable_format_on_save(opts)
+ else
+ M.disable_format_on_save()
+ end
+end
+
+function M.remove_augroup(name)
+ if vim.fn.exists("#" .. name) == 1 then
+ vim.cmd("au! " .. name)
+ end
+end
+
function M.define_augroups(definitions) -- {{{1
-- Create autocommand groups based on the passed definitions
--
diff --git a/.config/nvim/lua/core/cmp.lua b/.config/nvim/lua/core/cmp.lua
index 36d85fb..fe4119f 100644
--- a/.config/nvim/lua/core/cmp.lua
+++ b/.config/nvim/lua/core/cmp.lua
@@ -284,6 +284,9 @@ M.config = function()
["<C-e>"] = cmp.mapping.abort(),
["<CR>"] = cmp.mapping(function(fallback)
if cmp.visible() and cmp.confirm(options.builtin.cmp.confirm_opts) then
+ if jumpable() then
+ luasnip.jump(1)
+ end
return
end
diff --git a/.config/nvim/lua/core/commands.lua b/.config/nvim/lua/core/commands.lua
index ce635ad..bb22dea 100644
--- a/.config/nvim/lua/core/commands.lua
+++ b/.config/nvim/lua/core/commands.lua
@@ -16,6 +16,7 @@ M.defaults = {
[[ command! NvimUpdate lua require('bootstrap').update() ]],
[[ command! NvimSyncCorePlugins lua require('plugin-loader'):sync_core_plugins() ]],
[[ command! NvimReload lua require('config'):reload() ]],
+ [[ command! NvimToggleFormatOnSave lua require('core.autocmds').toggle_format_on_save() ]],
}
M.load = function(commands)
diff --git a/.config/nvim/lua/core/log.lua b/.config/nvim/lua/core/log.lua
index c44808f..815aeb1 100644
--- a/.config/nvim/lua/core/log.lua
+++ b/.config/nvim/lua/core/log.lua
@@ -1,6 +1,6 @@
local Log = {}
-local logfile = string.format("%s/%s.log", vim.fn.stdpath "cache", "nvim")
+local logfile = string.format("%s/%s.log", get_cache_dir(), "nvim")
Log.levels = {
TRACE = 1,
diff --git a/.config/nvim/lua/core/nvimtree.lua b/.config/nvim/lua/core/nvimtree.lua
index 08f5605..2ca2fb1 100644
--- a/.config/nvim/lua/core/nvimtree.lua
+++ b/.config/nvim/lua/core/nvimtree.lua
@@ -24,7 +24,7 @@ function M.config()
view = {
width = 30,
side = "left",
- auto_resize = false,
+ auto_resize = true,
mappings = {
custom_only = false,
},
diff --git a/.config/nvim/lua/core/which-key.lua b/.config/nvim/lua/core/which-key.lua
index ccf0c2d..85f766c 100644
--- a/.config/nvim/lua/core/which-key.lua
+++ b/.config/nvim/lua/core/which-key.lua
@@ -61,7 +61,7 @@ M.config = function()
-- NOTE: Prefer using : over <cmd> as the latter avoids going back in normal-mode.
-- see https://neovim.io/doc/user/map.html#:map-cmd
vmappings = {
- ["/"] = { "<ESC><CMD>lua ___comment_gc(vim.fn.visualmode())<CR>", "Comment" },
+ ["k"] = { "<ESC><CMD>lua ___comment_gc(vim.fn.visualmode())<CR>", "Comment" },
},
mappings = {
["w"] = { "<cmd>w!<CR>", "Save" },
@@ -69,7 +69,7 @@ M.config = function()
["k"] = { "<cmd>lua require('Comment').toggle()<CR>", "Comment" },
["c"] = { "<cmd>BufferClose!<CR>", "Close Buffer" },
["f"] = { "<cmd>Telescope find_files<CR>", "Find File" },
- ["h"] = { "<cmd>nohlsearch<CR>", "No Highlight" },
+ ["n"] = { "<cmd>nohlsearch<CR>", "No Highlight" },
b = {
name = "Buffers",
j = { "<cmd>BufferPick<cr>", "Jump" },
diff --git a/.config/nvim/lua/keymappings.lua b/.config/nvim/lua/keymappings.lua
index 5d71b97..74f4233 100644
--- a/.config/nvim/lua/keymappings.lua
+++ b/.config/nvim/lua/keymappings.lua
@@ -24,13 +24,34 @@ local mode_adapters = {
-- Append key mappings to lunarvim's defaults for a given mode
-- @param keymaps The table of key mappings containing a list per mode (normal_mode, insert_mode, ..)
function M.append_to_defaults(keymaps)
+ local default = M.get_defaults()
+ options.keys = options.keys or default
for mode, mappings in pairs(keymaps) do
- for k, v in ipairs(mappings) do
+ options.keys[mode] = options.keys[mode] or default[mode]
+ for k, v in pairs(mappings) do
options.keys[mode][k] = v
end
end
end
+-- Unsets all keybindings defined in keymaps
+-- @param keymaps The table of key mappings containing a list per mode (normal_mode, insert_mode, ..)
+function M.clear(keymaps)
+ local default = M.get_defaults()
+ for mode, mappings in pairs(keymaps) do
+ local translated_mode = mode_adapters[mode] and mode_adapters[mode] or mode
+ for key, _ in pairs(mappings) do
+ -- some plugins may override default bindings that the user hasn't manually overriden
+ if
+ default[mode][key] ~= nil
+ or (default[translated_mode] ~= nil and default[translated_mode][key] ~= nil)
+ then
+ pcall(vim.api.nvim_del_keymap, translated_mode, key)
+ end
+ end
+ end
+end
+
-- Set key mappings individually
-- @param mode The keymap mode, can be one of the keys of mode_adapters
-- @param key The key of keymap
@@ -41,7 +62,11 @@ function M.set_keymaps(mode, key, val)
opt = val[2]
val = val[1]
end
- vim.api.nvim_set_keymap(mode, key, val, opt)
+ if val then
+ vim.api.nvim_set_keymap(mode, key, val, opt)
+ else
+ pcall(vim.api.nvim_del_keymap, mode, key)
+ end
end
-- Load key mappings for a given mode
diff --git a/.config/nvim/lua/lsp/config.lua b/.config/nvim/lua/lsp/config.lua
index 673f924..61428aa 100644
--- a/.config/nvim/lua/lsp/config.lua
+++ b/.config/nvim/lua/lsp/config.lua
@@ -40,6 +40,7 @@ return {
},
null_ls = {
setup = {},
+ config = {},
},
override = {
"angularls",
@@ -55,6 +56,7 @@ return {
"phpactor",
"pylsp",
"rome",
+ "sorbet",
"sqlls",
"sqls",
"stylelint_lsp",
diff --git a/.config/nvim/lua/lsp/handlers.lua b/.config/nvim/lua/lsp/handlers.lua
index 01666be..fcf7630 100644
--- a/.config/nvim/lua/lsp/handlers.lua
+++ b/.config/nvim/lua/lsp/handlers.lua
@@ -37,18 +37,6 @@ function M.setup()
return
end
- local sign_names = {
- "DiagnosticSignError",
- "DiagnosticSignWarn",
- "DiagnosticSignInfo",
- "DiagnosticSignHint",
- }
- for i, sign in ipairs(options.lsp.diagnostics.signs.values) do
- vim.fn.sign_define(
- sign_names[i],
- { texthl = sign_names[i], text = sign.text, numhl = "" }
- )
- end
vim_diag.show(namespace, bufnr, diagnostics, config)
else
vim.lsp.diagnostic.save(diagnostics, bufnr, ctx.client_id)
diff --git a/.config/nvim/lua/lsp/init.lua b/.config/nvim/lua/lsp/init.lua
index f92ecd3..9cb3e78 100644
--- a/.config/nvim/lua/lsp/init.lua
+++ b/.config/nvim/lua/lsp/init.lua
@@ -150,6 +150,13 @@ function M.get_common_opts()
}
end
+local LSP_DEPRECATED_SIGN_MAP = {
+ ["LspDiagnosticsSignError"] = "DiagnosticSignError",
+ ["LspDiagnosticsSignWarning"] = "DiagnosticSignWarn",
+ ["LspDiagnosticsSignHint"] = "DiagnosticSignHint",
+ ["LspDiagnosticsSignInformation"] = "DiagnosticSignInfo",
+}
+
function M.setup()
Log:debug "Setting up LSP support"
@@ -158,7 +165,16 @@ function M.setup()
return
end
+ local is_neovim_nightly = vim.fn.has "nvim-0.5.1" > 0
+
for _, sign in ipairs(options.lsp.diagnostics.signs.values) do
+ local lsp_sign_name = LSP_DEPRECATED_SIGN_MAP[sign.name]
+ if is_neovim_nightly and lsp_sign_name then
+ vim.fn.sign_define(
+ lsp_sign_name,
+ { texthl = lsp_sign_name, text = sign.text, numhl = lsp_sign_name }
+ )
+ end
vim.fn.sign_define(
sign.name,
{ texthl = sign.name, text = sign.text, numhl = sign.name }
@@ -176,7 +192,7 @@ function M.setup()
require("lsp.null-ls").setup()
- require("utils").toggle_autoformat()
+ require("core.autocmds").configure_format_on_save()
end
return M
diff --git a/.config/nvim/lua/lsp/null-ls/formatters.lua b/.config/nvim/lua/lsp/null-ls/formatters.lua
index 991f613..7bd4dc4 100644
--- a/.config/nvim/lua/lsp/null-ls/formatters.lua
+++ b/.config/nvim/lua/lsp/null-ls/formatters.lua
@@ -4,6 +4,8 @@ local null_ls = require "null-ls"
local services = require "lsp.null-ls.services"
local Log = require "core.log"
+local is_registered = require("null-ls.sources").is_registered
+
function M.list_registered_providers(filetype)
local null_ls_methods = require "null-ls.methods"
local formatter_method = null_ls_methods.internal["FORMATTING"]
@@ -32,24 +34,29 @@ function M.list_configured(formatter_configs)
local formatters, errors = {}, {}
for _, fmt_config in ipairs(formatter_configs) do
- local formatter_name = fmt_config.exe:gsub("-", "_")
- local formatter = null_ls.builtins.formatting[formatter_name]
+ local name = fmt_config.exe:gsub("-", "_")
+ local formatter = null_ls.builtins.formatting[name]
if not formatter then
Log:error("Not a valid formatter: " .. fmt_config.exe)
- errors[fmt_config.exe] = {} -- Add data here when necessary
+ errors[name] = {} -- Add data here when necessary
+ elseif is_registered(fmt_config.exe) then
+ Log:trace "Skipping registering the source more than once"
else
local formatter_cmd = services.find_command(formatter._opts.command)
if not formatter_cmd then
Log:warn("Not found: " .. formatter._opts.command)
- errors[fmt_config.exe] = {} -- Add data here when necessary
+ errors[name] = {} -- Add data here when necessary
else
Log:debug("Using formatter: " .. formatter_cmd)
- formatters[fmt_config.exe] = formatter.with {
- command = formatter_cmd,
- extra_args = fmt_config.args,
- filetypes = fmt_config.filetypes,
- }
+ table.insert(
+ formatters,
+ formatter.with {
+ command = formatter_cmd,
+ extra_args = fmt_config.args,
+ filetypes = fmt_config.filetypes,
+ }
+ )
end
end
end
@@ -62,8 +69,8 @@ function M.setup(formatter_configs)
return
end
- local formatters_by_ft = M.list_configured(formatter_configs)
- null_ls.register { sources = formatters_by_ft.supported }
+ local formatters = M.list_configured(formatter_configs)
+ null_ls.register { sources = formatters.supported }
end
return M
diff --git a/.config/nvim/lua/lsp/null-ls/init.lua b/.config/nvim/lua/lsp/null-ls/init.lua
index 9560240..adbc5b2 100644
--- a/.config/nvim/lua/lsp/null-ls/init.lua
+++ b/.config/nvim/lua/lsp/null-ls/init.lua
@@ -9,7 +9,7 @@ function M:setup()
return
end
- null_ls.config()
+ null_ls.config(options.lsp.null_ls.config)
local default_opts = require("lsp").get_common_opts()
if vim.tbl_isempty(options.lsp.null_ls.setup or {}) then
diff --git a/.config/nvim/lua/lsp/null-ls/linters.lua b/.config/nvim/lua/lsp/null-ls/linters.lua
index 85555ba..0d34365 100644
--- a/.config/nvim/lua/lsp/null-ls/linters.lua
+++ b/.config/nvim/lua/lsp/null-ls/linters.lua
@@ -4,6 +4,8 @@ local null_ls = require "null-ls"
local services = require "lsp.null-ls.services"
local Log = require "core.log"
+local is_registered = require("null-ls.sources").is_registered
+
function M.list_registered_providers(filetype)
local null_ls_methods = require "null-ls.methods"
local linter_method = null_ls_methods.internal["DIAGNOSTICS"]
@@ -32,24 +34,29 @@ function M.list_configured(linter_configs)
local linters, errors = {}, {}
for _, lnt_config in pairs(linter_configs) do
- local linter_name = lnt_config.exe:gsub("-", "_")
- local linter = null_ls.builtins.diagnostics[linter_name]
+ local name = lnt_config.exe:gsub("-", "_")
+ local linter = null_ls.builtins.diagnostics[name]
if not linter then
Log:error("Not a valid linter: " .. lnt_config.exe)
errors[lnt_config.exe] = {} -- Add data here when necessary
+ elseif is_registered(lnt_config.exe) then
+ Log:trace "Skipping registering the source more than once"
else
local linter_cmd = services.find_command(linter._opts.command)
if not linter_cmd then
Log:warn("Not found: " .. linter._opts.command)
- errors[lnt_config.exe] = {} -- Add data here when necessary
+ errors[name] = {} -- Add data here when necessary
else
Log:debug("Using linter: " .. linter_cmd)
- linters[lnt_config.exe] = linter.with {
- command = linter_cmd,
- extra_args = lnt_config.args,
- filetypes = lnt_config.filetypes,
- }
+ table.insert(
+ linters,
+ linter.with {
+ command = linter_cmd,
+ extra_args = lnt_config.args,
+ filetypes = lnt_config.filetypes,
+ }
+ )
end
end
end
diff --git a/.config/nvim/lua/lsp/null-ls/services.lua b/.config/nvim/lua/lsp/null-ls/services.lua
index ef9e7d2..6a52520 100644
--- a/.config/nvim/lua/lsp/null-ls/services.lua
+++ b/.config/nvim/lua/lsp/null-ls/services.lua
@@ -46,15 +46,13 @@ function M.find_command(command)
end
function M.list_registered_providers_names(filetype)
- local u = require "null-ls.utils"
- local c = require "null-ls.config"
+ local s = require "null-ls.sources"
+ local available_sources = s.get_available(filetype)
local registered = {}
- for method, source in pairs(c.get()._methods) do
- for name, filetypes in pairs(source) do
- if u.filetype_matches(filetypes, filetype) then
- registered[method] = registered[method] or {}
- table.insert(registered[method], name)
- end
+ for _, source in ipairs(available_sources) do
+ for method in pairs(source.methods) do
+ registered[method] = registered[method] or {}
+ table.insert(registered[method], source.name)
end
end
return registered
diff --git a/.config/nvim/lua/plugin-loader.lua b/.config/nvim/lua/plugin-loader.lua
index d2b7972..1754b5b 100644
--- a/.config/nvim/lua/plugin-loader.lua
+++ b/.config/nvim/lua/plugin-loader.lua
@@ -31,6 +31,7 @@ function plugin_loader.init(opts)
compile_path = compile_path,
log = { level = "warn" },
git = { clone_timeout = 300 },
+ max_jobs = 50,
display = {
open_fn = function()
return require("packer.util").float { border = "rounded" }
diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua
index 0511fa8..b653803 100644
--- a/.config/nvim/lua/plugins.lua
+++ b/.config/nvim/lua/plugins.lua
@@ -1,16 +1,16 @@
local commit = {
packer = "7f62848f3a92eac61ae61def5f59ddb5e2cc6823",
- lsp_config = "6224c54a9945a52bf43a8bc1a42a112084590c0b",
+ lsp_config = "903a1fbca91b74e6fbc905366ce38364b9d7ba98",
nlsp_settings = "29f49afe27b43126d45a05baf3161a28b929f2f1",
- null_ls = "64b269b51c7490660dcb2008f59ae260f2cdbbe4",
+ null_ls = "cf2bc3185af066cb25f1bf6faa99727e2c47ef77",
fix_cursor_hold = "0e4e22d21975da60b0fd2d302285b3b603f9f71e",
- lsp_installer = "c9dbc8afc2d56227ed0cba5a3348b8dd170e3a1d",
+ lsp_installer = "37d9326f4ca4093b04eabdb697fec3764e226f88",
structlog = "6f1403a192791ff1fa7ac845a73de9e860f781f1",
popup = "f91d80973f80025d4ed00380f2e06c669dfda49d",
plenary = "96e821e8001c21bc904d3c15aa96a70c11462c5f",
telescope = "078a48db9e0720b07bfcb8b59342c5305a1d1fdc",
telescope_fzf_native = "59e38e1661ffdd586cb7fc22ca0b5a05c7caf988",
- nvim_cmp = "1774ff0f842146521c63707245d3de5db2bb3732",
+ nvim_cmp = "ca6386854982199a532150cf3bd711395475ebd2",
friendly_snippets = "94f1d917435c71bc6494d257afa90d4c9449aed2",
autopairs = "f858ab38b532715dbaf7b2773727f8622ba04322",
treesitter = "47cfda2c6711077625c90902d7722238a8294982",
@@ -37,7 +37,10 @@ return {
{ "wbthomason/packer.nvim", commit = commit.packer },
{ "neovim/nvim-lspconfig", commit = commit.lsp_config },
{ "tamago324/nlsp-settings.nvim", commit = commit.nlsp_settings },
- { "jose-elias-alvarez/null-ls.nvim", commit = commit.null_ls },
+ {
+ "jose-elias-alvarez/null-ls.nvim",
+ commit = commit.null_ls,
+ },
{ "antoinemadec/FixCursorHold.nvim", commit = commit.fix_cursor_hold }, -- Needed while issue https://github.com/neovim/neovim/issues/12587 is still open
{
"williamboman/nvim-lsp-installer",
diff --git a/.config/nvim/lua/utils/init.lua b/.config/nvim/lua/utils/init.lua
index e86b798..0d06b1f 100644
--- a/.config/nvim/lua/utils/init.lua
+++ b/.config/nvim/lua/utils/init.lua
@@ -1,5 +1,4 @@
local utils = {}
-local Log = require "core.log"
local uv = vim.loop
-- recursive Print (structure, limit, separator)
@@ -58,53 +57,6 @@ function utils.generate_settings()
io.close(file)
end
--- autoformat
-function utils.toggle_autoformat()
- if options.format_on_save then
- require("core.autocmds").define_augroups {
- autoformat = {
- {
- "BufWritePre",
- "*",
- ":silent lua vim.lsp.buf.formatting_sync()",
- },
- },
- }
- Log:debug "Format on save active"
- end
-
- if not options.format_on_save then
- vim.cmd [[
- if exists('#autoformat#BufWritePre')
- :autocmd! autoformat
- endif
- ]]
- Log:debug "Format on save off"
- end
-end
-
-function utils.reload_config()
- require("core.lualine").config()
-
- local config = require "config"
- config:load()
-
- require("keymappings").setup() -- this should be done before loading the plugins
- vim.cmd(
- "source " .. utils.join_paths(get_runtime_dir(), "lua", "plugins.lua")
- )
- local plugins = require "plugins"
- utils.toggle_autoformat()
- local plugin_loader = require "plugin-loader"
- plugin_loader:cache_reset()
- plugin_loader:load { plugins, options.plugins }
- vim.cmd ":PackerInstall"
- vim.cmd ":PackerCompile"
- -- vim.cmd ":PackerClean"
- require("lsp").setup()
- Log:info "Reloaded configuration"
-end
-
function utils.unrequire(m)
package.loaded[m] = nil
_G[m] = nil
@@ -149,18 +101,6 @@ function utils.is_directory(path)
return stat and stat.type == "directory" or false
end
-function utils.write_file(path, txt, flag)
- uv.fs_open(path, flag, 438, function(open_err, fd)
- assert(not open_err, open_err)
- uv.fs_write(fd, txt, -1, function(write_err)
- assert(not write_err, write_err)
- uv.fs_close(fd, function(close_err)
- assert(not close_err, close_err)
- end)
- end)
- end)
-end
-
utils.join_paths = _G.join_paths
function utils.write_file(path, txt, flag)