nvim: Start config refactor
This commit is contained in:
parent
15d58544a4
commit
23d0c01bcb
4 changed files with 24 additions and 23 deletions
|
@ -1,38 +1,22 @@
|
|||
local lspconfig = require('lspconfig')
|
||||
local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||
|
||||
-- Lua LSP Init
|
||||
local sumneko_root = vim.fn.expand("~/.nix-profile/share/lua-language-server")
|
||||
local sumneko_binary = sumneko_root.."/bin/lua-language-server"
|
||||
local runtime_path = vim.split(package.path, ';')
|
||||
table.insert(runtime_path, "lua/?.lua")
|
||||
table.insert(runtime_path, "lua/?/init.lua")
|
||||
lspconfig.sumneko_lua.setup {
|
||||
cmd = {sumneko_binary, "-E", sumneko_root .. "/main.lua"};
|
||||
capabilities = capabilities;
|
||||
settings = {
|
||||
Lua = {
|
||||
runtime = {
|
||||
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
|
||||
version = 'LuaJIT',
|
||||
-- Setup your lua path
|
||||
path = runtime_path,
|
||||
},
|
||||
diagnostics = {
|
||||
-- Get the language server to recognize the `vim` global
|
||||
globals = {'vim', 'table', 'package', 'print'},
|
||||
},
|
||||
workspace = {
|
||||
-- Make the server aware of Neovim runtime files
|
||||
library = vim.api.nvim_get_runtime_file("", true),
|
||||
},
|
||||
-- Do not send telemetry data containing a randomized but unique identifier
|
||||
telemetry = {
|
||||
enable = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
-- Nix LSP init
|
||||
require'lspconfig'.rnix.setup{}
|
||||
|
|
|
@ -19,7 +19,7 @@ local sources = {
|
|||
|
||||
diagnostic.shellcheck,
|
||||
diagnostic.luacheck.with({
|
||||
extra_args = {"--config", vim.fn.expand("~/.config/.luacheckrc")}
|
||||
extra_args = { "--config", vim.fn.expand("~/.config/.luacheckrc") }
|
||||
}),
|
||||
|
||||
}
|
||||
|
@ -28,8 +28,8 @@ local sources = {
|
|||
require("null-ls").setup({
|
||||
sources = sources,
|
||||
on_attach = function(client)
|
||||
if client.resolved_capabilities.document_formatting then
|
||||
vim.cmd("autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_sync()")
|
||||
if client.server_capabilities.document_formatting then
|
||||
vim.cmd("autocmd BufWritePre <buffer> lua vim.lsp.buf.format()")
|
||||
end
|
||||
end
|
||||
})
|
||||
|
|
21
home/programs/neovim/lua2/global.lua
Normal file
21
home/programs/neovim/lua2/global.lua
Normal file
|
@ -0,0 +1,21 @@
|
|||
local notify = require('notify')
|
||||
|
||||
notify.print_history = function()
|
||||
local color = {
|
||||
DEBUG = 'NotifyDEBUGTitle',
|
||||
TRACE = 'NotifyTRACETitle',
|
||||
INFO = 'NotifyINFOTitle',
|
||||
WARN = 'NotifyWARNTitle',
|
||||
ERROR = 'NotifyERRORTitle',
|
||||
}
|
||||
for _, m in ipairs(notify.history()) do
|
||||
vim.api.nvim_echo({
|
||||
{vim.fn.strftime('%FT%T', m.time), 'Identifier'},
|
||||
{' ', 'Normal'},
|
||||
{m.level, color[m.level] or 'Title'},
|
||||
{' ', 'Normal'},
|
||||
{table.concat(m.message, ' '), 'Normal'},
|
||||
}, false, {})
|
||||
end
|
||||
end
|
||||
vim.cmd([[command! Message :lua require'notify'.print_history()<CR>]])
|
|
@ -63,10 +63,6 @@ in {
|
|||
vim-table-mode
|
||||
vim-tmux
|
||||
which-key-nvim
|
||||
# {
|
||||
# plugin = wilder-nvim;
|
||||
# optional = true;
|
||||
# }
|
||||
(nvim-treesitter.withPlugins (plugins:
|
||||
with plugins; [
|
||||
tree-sitter-bash
|
||||
|
|
Loading…
Reference in a new issue