Many changes

This commit is contained in:
Fabian Becker
2022-10-16 15:44:07 +02:00
parent eb17f0ab25
commit f5a7947005
18 changed files with 222 additions and 122 deletions

View File

@@ -1,19 +1,40 @@
local Worktree = require("git-worktree")
local Job = require("plenary.job")
local function schedule_notify(message)
vim.schedule(function()
vim.notify.notify(message)
end)
end
local function is_massdriver()
return not not (string.find(vim.loop.cwd(), "massdriver.git", 1, true))
end
Worktree.on_tree_change(function (op, metadata)
Worktree.on_tree_change(function(op, metadata)
local compile_job = Job:new({
"mix", "compile"
command = "mix",
args = { "compile" },
on_start = function()
schedule_notify("Compiling...")
end,
on_exit = function(_j, _return_val)
schedule_notify("Compiling done")
end
})
local deps_job = Job:new({
command = "mix",
args = { "deps.get" },
on_start = function()
schedule_notify("Fetching dependencies...")
end,
on_exit = function(_j, _return_val)
schedule_notify("Fetched dependencies")
end
})
if op == Worktree.Operations.Create and is_massdriver() then
local deps_job = Job:new({
"mix", "deps.get"
})
deps_job:and_then(compile_job)
deps_job:sync()
compile_job:wait()

View File

@@ -67,16 +67,23 @@ nnoremap('<leader>ta', ':TestSuite<CR>')
nnoremap('<leader>tl', ':TestLast<CR>')
nnoremap('<leader>tg', ':TestVisit<CR>')
-- Vim Projectionist
nnoremap('<leader>a', ':A<CR>')
-- Reload init.lua
nnoremap('<leader>sv', ':source $MYVIMRC<CR>')
vim.cmd("nnoremap <silent> <C-p> :Lspsaga diagnostic_jump_prev<CR>")
vim.cmd("nnoremap <silent> <C-n> :Lspsaga diagnostic_jump_next<CR>")
-- -- scroll down hover doc or scroll in definition preview
vim.cmd("nnoremap <silent> <C-f> <cmd>lua require('lspsaga.action').smart_scroll_with_saga(1)<CR>")
-- -- scroll up hover doc
vim.cmd("nnoremap <silent> <C-b> <cmd>lua require('lspsaga.action').smart_scroll_with_saga(-1)<CR>")
vim.cmd('command! -nargs=0 LspVirtualTextToggle lua require("lsp/virtual_text").toggle()')
nnoremap('<C-p>', ':Lspsaga diagnostic_jump_prev<CR>')
nnoremap('<C-y>', ':Lspsaga diagnostic_jump_next<CR>')
-- Harpoon
nnoremap("<leader>m", function() require("harpoon.mark").add_file() end)
nnoremap("<C-e>", function() require("harpoon.ui").toggle_quick_menu() end)
nnoremap("<C-h>", function() require("harpoon.ui").nav_file(1) end)
nnoremap("<C-t>", function() require("harpoon.ui").nav_file(2) end)
nnoremap("<C-n>", function() require("harpoon.ui").nav_file(3) end)
nnoremap("<C-s>", function() require("harpoon.ui").nav_file(4) end)
-- Yank until end of line
nnoremap('Y', 'yg$')

View File

@@ -21,7 +21,7 @@ vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
)
-- Setup for nvim-notify
vim.lsp.set_log_level(1 )
vim.lsp.set_log_level(2)
local convert_lsp_log_level_to_neovim_log_level = function(lsp_log_level)
if lsp_log_level == 1 then
@@ -151,6 +151,7 @@ local elixir = require('elixir')
elixir.setup(config({
-- repo = "mhanberg/elixir-ls", -- defaults to elixir-lsp/elixir-ls
-- branch = "mh/all-workspace-symbols", -- defaults to nil, just checkouts out the default branch, mutually exclusive with the `tag` option
cmd = {"/usr/local/opt/elixir-ls/rel/language_server.sh"},
settings = elixir.settings({
dialyzerEnabled = true,
fetchDeps = false,
@@ -186,6 +187,12 @@ lspconfig.sumneko_lua.setup(config({
}
}))
-- Generic language server. Used to run credo
lspconfig.efm.setup(config({
on_attach = on_attach,
filetypes = {"elixir"}
}))
require('rust-tools').setup({
tools = {
inlay_hints = {

View File

@@ -1,6 +1,22 @@
require("neotest").setup({
local nnoremap = require('halfdan.keymap').nnoremap
local neotest = require('neotest')
neotest.setup({
adapters = {
require("neotest-vim-test")({ allow_file_types = { "haskell"} }),
require("neotest-elixir")
require("neotest-elixir"),
-- require("neotest-vim-test")({ allow_file_types = { "haskell"} }),
},
})
nnoremap("<leader>nt", function ()
neotest.run.run()
end)
nnoremap("<leader>nf", function ()
neotest.run.run(vim.fn.expand("%"))
end)
nnoremap("<leader>nd", function ()
neotest.run.run({strategy = "dap"})
end)

View File

@@ -1,3 +1,5 @@
require('notify').setup({
background_colour = "#000000",
max_width = 120,
max_height = 10,
})