feat(flutter-tools.lua): add configuration for flutter-tools statusline decorations

feat(lsp-config.lua): update key bindings for code actions and references, remove pycodestyle config
feat(lualine.lua): add functions to display Flutter Tools statusline and check if Flutter Tools is active
feat(mason.lua): add kotlin_language_server to the list of supported language servers
feat(molten.lua): improve configuration for Molten plugin based on file type
feat(none-ls.lua): improve configuration for null-ls sources, resolve virtual environment for mypy diagnostics

fix(telescope.lua): update trouble import path to sources instead of providers
feat(telescope.lua): add vimgrep_arguments to improve search functionality
feat(telescope.lua): add mappings for trouble.open in insert and normal mode
feat(telescope.lua): load extensions flutter and dap
feat(telescope.lua): define custom find_files function with specific find_command
feat(trouble.lua): update trouble import path to sources instead of providers
feat(trouble.lua): update mappings to use trouble_sources.open instead of trouble_telescope.open_with_trouble
feat(core/init.lua): add ignorecase and smartcase options for case-insensitive searching
feat(core/init.lua): add backspace option for more flexible backspacing behavior
feat(core/init.lua): set cursor color based on mode in InsertEnter and InsertLeave autocmds
feat(dap.lua): add nvim-nio dependency and load telescope-dap.nvim extension
feat(flutter-tools.lua): add flutter-tools.nvim plugin configuration
feat(molten.lua): add lazy loading and ft option for Python files
feat(none-ls.lua.disabled): add none-ls.nvim plugin configuration
feat(poet-v.lua): add lazy loading and ft option for Python files
feat(vim-tmux-navigator.lua): update cmd and keys for vim-tmux-navigator plugin

chore(remap.lua): reorganize keymap descriptions for better clarity and readability
feat(remap.lua): add key mappings for jumping up, down, to next, and to previous locations with center screen
feat(remap.lua): add key mappings for resizing windows right, left, up, and down by 10 lines
feat(safe-invoke.lua): add utility function SafeInvoke to safely invoke functions and handle errors
This commit is contained in:
David Ibia
2024-06-14 02:03:40 +01:00
parent a96a4f719e
commit 2b7ce8f520
19 changed files with 314 additions and 205 deletions

View File

@@ -1,84 +1,84 @@
-- change the configuration when editing a python file
vim.api.nvim_create_autocmd("BufEnter", {
pattern = "*.py",
callback = function(e)
if string.match(e.file, ".otter.") then
return
end
if require("molten.status").initialized() == "Molten" then -- this is kinda a hack...
vim.fn.MoltenUpdateOption("virt_lines_off_by_1", false)
vim.fn.MoltenUpdateOption("virt_text_output", false)
else
vim.g.molten_virt_lines_off_by_1 = false
vim.g.molten_virt_text_output = false
end
end,
pattern = "*.py",
callback = function(e)
if string.match(e.file, ".otter.") then
return
end
if require("molten.status").initialized() == "Molten" then -- this is kinda a hack...
vim.fn.MoltenUpdateOption("virt_lines_off_by_1", false)
vim.fn.MoltenUpdateOption("virt_text_output", false)
else
vim.g.molten_virt_lines_off_by_1 = false
vim.g.molten_virt_text_output = false
end
end,
})
-- Undo those config changes when we go back to a markdown or quarto file
vim.api.nvim_create_autocmd("BufEnter", {
pattern = { "*.qmd", "*.md", "*.ipynb" },
callback = function(e)
if string.match(e.file, ".otter.") then
return
end
if require("molten.status").initialized() == "Molten" then
vim.fn.MoltenUpdateOption("virt_lines_off_by_1", true)
vim.fn.MoltenUpdateOption("virt_text_output", true)
else
vim.g.molten_virt_lines_off_by_1 = true
vim.g.molten_virt_text_output = true
end
end,
pattern = { "*.qmd", "*.md", "*.ipynb" },
callback = function(e)
if string.match(e.file, ".otter.") then
return
end
if require("molten.status").initialized() == "Molten" then
vim.fn.MoltenUpdateOption("virt_lines_off_by_1", true)
vim.fn.MoltenUpdateOption("virt_text_output", true)
else
vim.g.molten_virt_lines_off_by_1 = true
vim.g.molten_virt_text_output = true
end
end,
})
-- automatically export output chunks to a jupyter notebook on write
vim.api.nvim_create_autocmd("BufWritePost", {
pattern = { "*.ipynb" },
callback = function()
if require("molten.status").initialized() == "Molten" then
vim.cmd("MoltenExportOutput!")
end
end,
pattern = { "*.ipynb" },
callback = function()
if require("molten.status").initialized() == "Molten" then
vim.cmd("MoltenExportOutput!")
end
end,
})
-- automatically import output chunks from a jupyter notebook
-- tries to find a kernel that matches the kernel in the jupyter notebook
-- falls back to a kernel that matches the name of the active venv (if any)
local imb = function(e) -- init molten buffer
vim.schedule(function()
local kernels = vim.fn.MoltenAvailableKernels()
local try_kernel_name = function()
local metadata = vim.json.decode(io.open(e.file, "r"):read("a"))["metadata"]
return metadata.kernelspec.name
end
local ok, kernel_name = pcall(try_kernel_name)
if not ok or not vim.tbl_contains(kernels, kernel_name) then
kernel_name = nil
local venv = os.getenv("VIRTUAL_ENV")
if venv ~= nil then
kernel_name = string.match(venv, "/.+/(.+)")
end
end
if kernel_name ~= nil and vim.tbl_contains(kernels, kernel_name) then
vim.cmd(("MoltenInit %s"):format(kernel_name))
end
vim.cmd("MoltenImportOutput")
end)
vim.schedule(function()
local kernels = vim.fn.MoltenAvailableKernels()
local try_kernel_name = function()
local metadata = vim.json.decode(io.open(e.file, "r"):read("a"))["metadata"]
return metadata.kernelspec.name
end
local ok, kernel_name = pcall(try_kernel_name)
if not ok or not vim.tbl_contains(kernels, kernel_name) then
kernel_name = nil
local venv = os.getenv("VIRTUAL_ENV")
if venv ~= nil then
kernel_name = string.match(venv, "/.+/(.+)")
end
end
if kernel_name ~= nil and vim.tbl_contains(kernels, kernel_name) then
vim.cmd(("MoltenInit %s"):format(kernel_name))
end
vim.cmd("MoltenImportOutput")
end)
end
-- automatically import output chunks from a jupyter notebook
vim.api.nvim_create_autocmd("BufAdd", {
pattern = { "*.ipynb" },
callback = imb,
pattern = { "*.ipynb" },
callback = imb,
})
-- we have to do this as well so that we catch files opened like nvim ./hi.ipynb
vim.api.nvim_create_autocmd("BufEnter", {
pattern = { "*.ipynb" },
callback = function(e)
if vim.api.nvim_get_vvar("vim_did_enter") ~= 1 then
imb(e)
end
end,
pattern = { "*.ipynb" },
callback = function(e)
if vim.api.nvim_get_vvar("vim_did_enter") ~= 1 then
imb(e)
end
end,
})