mirror of
https://github.com/boxpositron/absolute-vim.git
synced 2026-02-28 11:40:36 +00:00
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:
12
lua/absolute/after/flutter-tools.lua
Normal file
12
lua/absolute/after/flutter-tools.lua
Normal file
@@ -0,0 +1,12 @@
|
||||
local flutter_tools = require('flutter-tools')
|
||||
|
||||
flutter_tools.setup({
|
||||
decorations = {
|
||||
statusline = {
|
||||
app_version = true,
|
||||
device = true,
|
||||
project_config = true,
|
||||
}
|
||||
},
|
||||
fvm = true,
|
||||
})
|
||||
@@ -37,10 +37,10 @@ local on_attach = function(client, bufnr)
|
||||
vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, opts)
|
||||
|
||||
opts.desc = "See available code actions"
|
||||
vim.keymap.set({ "n", "v" }, "<leader>vca", vim.lsp.buf.code_action, opts)
|
||||
vim.keymap.set({ "n", "v" }, "<leader>ca", vim.lsp.buf.code_action, opts)
|
||||
|
||||
opts.desc = "Show LSP references"
|
||||
vim.keymap.set("n", "<leader>vrr", "<cmd>Telescope lsp_references<CR>", opts)
|
||||
vim.keymap.set("n", "<leader>cr", "<cmd>Telescope lsp_references<CR>", opts)
|
||||
|
||||
opts.desc = "Format File"
|
||||
vim.keymap.set("n", "<leader>f", function()
|
||||
@@ -123,10 +123,6 @@ lspconfig["pylsp"].setup({
|
||||
jedi_completion = {
|
||||
include_params = true,
|
||||
},
|
||||
pycodestyle = {
|
||||
ignore = { "E231" },
|
||||
maxLineLength = 150,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -2,6 +2,7 @@ local lualine = require("lualine")
|
||||
local lazy_status = require("lazy.status") -- to configure lazy pending updates count
|
||||
local molten_status = require("molten.status") -- to configure molten statusline
|
||||
|
||||
|
||||
local colors = {
|
||||
blue = "#65D1FF",
|
||||
green = "#3EFFDC",
|
||||
@@ -46,6 +47,21 @@ local my_lualine_theme = {
|
||||
},
|
||||
}
|
||||
|
||||
function GetFlutterToolsStatusLine()
|
||||
local application_version = vim.g.flutter_tools_decorations.app_version
|
||||
local device = vim.g.flutter_tools_decorations.device
|
||||
|
||||
local result = "Flutter: " .. application_version .. " " .. device
|
||||
end
|
||||
|
||||
function IsFlutterToolsActive()
|
||||
if vim.g.flutter_tools_decorations ~= nil then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
function GetPoetvStatusLine()
|
||||
-- Get the poetv statusline
|
||||
-- If poetv is not active, return empty string
|
||||
@@ -80,6 +96,11 @@ lualine.setup({
|
||||
},
|
||||
sections = {
|
||||
lualine_x = {
|
||||
{
|
||||
GetFlutterToolsStatusLine,
|
||||
cond = IsFlutterToolsActive,
|
||||
color = { fg = "#ff9e64" },
|
||||
},
|
||||
{
|
||||
molten_status.initialized,
|
||||
},
|
||||
|
||||
@@ -11,6 +11,7 @@ require("mason-lspconfig").setup({
|
||||
"svelte",
|
||||
"cssls",
|
||||
"jedi_language_server",
|
||||
"kotlin_language_server"
|
||||
},
|
||||
automatic_installation = true,
|
||||
})
|
||||
|
||||
@@ -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,
|
||||
})
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
local null_ls = require("null-ls")
|
||||
|
||||
null_ls.setup({
|
||||
sources = {
|
||||
null_ls.builtins.formatting.stylua,
|
||||
null_ls.builtins.formatting.prettierd,
|
||||
null_ls.builtins.formatting.shfmt,
|
||||
null_ls.builtins.formatting.black,
|
||||
null_ls.builtins.diagnostics.mypy.with({
|
||||
extra_args = function()
|
||||
local virtual = os.getenv("VIRTUAL_ENV") or os.getenv("CONDA_PREFIX") or "/usr"
|
||||
return { "--python-executable", virtual .. "/bin/python3" }
|
||||
end,
|
||||
}),
|
||||
},
|
||||
sources = {
|
||||
null_ls.builtins.formatting.stylua,
|
||||
null_ls.builtins.formatting.prettierd,
|
||||
null_ls.builtins.formatting.shfmt,
|
||||
null_ls.builtins.formatting.black,
|
||||
null_ls.builtins.diagnostics.mypy.with({
|
||||
extra_args = function()
|
||||
-- Let's resolve the virtual environment or conda environment
|
||||
local virtual = os.getenv("VIRTUAL_ENV") or os.getenv("CONDA_PREFIX") or "/usr"
|
||||
return { "--python-executable", virtual .. "/bin/python3" }
|
||||
end,
|
||||
}),
|
||||
},
|
||||
})
|
||||
|
||||
@@ -1,23 +1,43 @@
|
||||
local telescope = require("telescope")
|
||||
local builtin = require("telescope.builtin")
|
||||
local trouble = require("trouble.providers.telescope")
|
||||
local trouble = require("trouble.sources.telescope")
|
||||
|
||||
|
||||
telescope.setup({
|
||||
defaults = {
|
||||
mappings = {
|
||||
i = {
|
||||
["<C-q>"] = trouble.open_with_trouble,
|
||||
},
|
||||
n = {
|
||||
["<C-q>"] = trouble.open_with_trouble,
|
||||
},
|
||||
},
|
||||
},
|
||||
defaults = {
|
||||
vimgrep_arguments = {
|
||||
"rg",
|
||||
"--color=never",
|
||||
"--no-heading",
|
||||
"--with-filename",
|
||||
"--line-number",
|
||||
"--column",
|
||||
"--smart-case",
|
||||
},
|
||||
mappings = {
|
||||
i = {
|
||||
["<C-q>"] = trouble.open,
|
||||
},
|
||||
n = {
|
||||
["<C-q>"] = trouble.open,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
vim.keymap.set("n", "<leader>pf", builtin.find_files, { desc = "Fuzzy find files in cwd" })
|
||||
telescope.load_extension("flutter")
|
||||
telescope.load_extension("dap")
|
||||
|
||||
|
||||
local find_files = function()
|
||||
builtin.find_files({
|
||||
find_command = { "rg", "--files", "--hidden", "--glob", "!.git" },
|
||||
})
|
||||
end
|
||||
|
||||
vim.keymap.set("n", "<leader>pf", find_files, { desc = "Fuzzy find files in cwd" })
|
||||
vim.keymap.set("n", "<leader>pr", builtin.oldfiles, { desc = "Fuzzy find recent files" })
|
||||
vim.keymap.set("n", "<C-p>", builtin.git_files, { desc = "Fuzzy find files in git in cwd" })
|
||||
vim.keymap.set("n", "<leader>ps", function()
|
||||
builtin.grep_string({ search = vim.fn.input("Grep > ") })
|
||||
builtin.grep_string({ search = vim.fn.input("Grep > ") })
|
||||
end, { desc = "Find string under cursor in cwd" })
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
local tsj = require("treesj")
|
||||
|
||||
tsj.setup({
|
||||
use_default_keymaps = false,
|
||||
max_join_length = 400,
|
||||
use_default_keymaps = false,
|
||||
max_join_length = 1000,
|
||||
})
|
||||
|
||||
local opts = { silent = true, noremap = true }
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
local telescope = require("telescope")
|
||||
local actions = require("telescope.actions")
|
||||
local trouble_telescope = require("trouble.providers.telescope")
|
||||
local trouble_sources = require("trouble.sources.telescope")
|
||||
|
||||
telescope.setup({
|
||||
defaults = {
|
||||
mappings = {
|
||||
i = {
|
||||
["<C-t>"] = trouble_telescope.open_with_trouble,
|
||||
["<C-q>"] = actions.send_to_qflist,
|
||||
},
|
||||
n = {
|
||||
["<C-t>"] = trouble_telescope.open_with_trouble,
|
||||
["<C-q>"] = actions.send_to_qflist,
|
||||
},
|
||||
},
|
||||
},
|
||||
defaults = {
|
||||
mappings = {
|
||||
i = {
|
||||
["<C-t>"] = trouble_sources.open,
|
||||
["<C-q>"] = actions.send_to_qflist,
|
||||
},
|
||||
n = {
|
||||
["<C-t>"] = trouble_sources.open,
|
||||
["<C-q>"] = actions.send_to_qflist,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
-- Keybindings
|
||||
|
||||
Reference in New Issue
Block a user