mirror of
https://github.com/boxpositron/absolute-vim.git
synced 2026-02-28 11:40:36 +00:00
feat(dap.lua): add virtual text setup for better debugging experience
feat(dap.lua): add support for process.env.PORT environment variable to be able to run app on a configurable port feat(lsp-config.lua): add support for detecting python environment using DPE module feat(lualine.lua): add support for noice statusline component feat(mason.lua): update installed language servers list feat(noice.lua): add configuration for noice plugin feat(none-ls.lua): remove black and mypy formatters from null-ls setup fix(nvim-cmp.lua): change completeopt value to "menu,menuone,preview,noinsert" and add autocomplete trigger event on text change feat(nvim-cmp.lua): add border and winhighlight settings for documentation window to improve visual appearance feat(nvim-cmp.lua): add 'nvim_lsp_signature_help' as a source for autocompletion refactor(colorscheme.lua): refactor SetupWindowPreferences function to dynamically set blend values for highlight groups feat(init.lua): add setting for 'completeopt' to "menuone" feat(plugins/noice.lua): add configuration for 'noice.nvim' plugin with dependencies and event trigger feat(plugins/nvim-treesitter.lua): update configuration to run TSUpdate command silently feat(utils): add Lua utility functions to detect and manage Lua versions and paths feat(utils): add Python utility functions to check and resolve Python environments style(theme): update current theme to 'catppuccin' in Lua script
This commit is contained in:
@@ -1,21 +1,35 @@
|
||||
local dap = require("dap")
|
||||
local dapui = require("dapui")
|
||||
local dap_python = require("dap-python")
|
||||
local virtual_text = require("nvim-dap-virtual-text")
|
||||
|
||||
-- Setup Virtual Text
|
||||
virtual_text.setup({
|
||||
prefix = " ",
|
||||
hl = "Comment",
|
||||
lines = 3,
|
||||
enabled = true,
|
||||
})
|
||||
|
||||
|
||||
local mason_path = vim.fn.glob(vim.fn.stdpath("data") .. "/mason")
|
||||
local debugpy_path = mason_path .. "/packages/debugpy/venv/bin/python"
|
||||
|
||||
dapui.setup()
|
||||
dap_python.setup(debugpy_path)
|
||||
|
||||
dap.listeners.after.event_initialized["dapui_config"] = function()
|
||||
dapui.open()
|
||||
end
|
||||
|
||||
dap.listeners.before.event_terminated["dapui_config"] = function()
|
||||
dapui.close()
|
||||
end
|
||||
|
||||
dap.listeners.before.event_exited["dapui_config"] = function()
|
||||
dapui.close()
|
||||
end
|
||||
|
||||
|
||||
local path = "~/.local/share/nvim/mason/packages/debugpy/venv/bin/python"
|
||||
dap_python.setup(path)
|
||||
|
||||
-- Setup Mappings
|
||||
local opts = { noremap = true, silent = true }
|
||||
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
vim.g["jedi#popup_on_dot"] = 1
|
||||
vim.g["jedi#use_tabs_not_buffers"] = 0
|
||||
vim.g["jedi#popup_select_first"] = 0
|
||||
vim.g["jedi#show_call_signatures"] = "2"
|
||||
|
||||
|
||||
-- Keybindings
|
||||
vim.g["jedi#goto_command"] = "" -- "<leader>d"
|
||||
vim.g["jedi#goto_assignments_command"] = "<leader>gD"
|
||||
vim.g["jedi#goto_stubs_command"] = "" -- "<leader>s"
|
||||
vim.g["jedi#goto_definitions_command"] = "gd"
|
||||
vim.g["jedi#documentation_command"] = "K"
|
||||
vim.g["jedi#usages_command"] = "<leader>n"
|
||||
vim.g["jedi#completions_command"] = "<C-Space>"
|
||||
vim.g["jedi#rename_command"] = "<leader>rn"
|
||||
vim.g["jedi#rename_command_keep_name"] = "" -- "<leader>R"
|
||||
@@ -2,6 +2,8 @@
|
||||
local lspconfig = require("lspconfig")
|
||||
local cmp_nvim_lsp = require("cmp_nvim_lsp")
|
||||
|
||||
local DPE = require("absolute.utils.detect-python-env")
|
||||
|
||||
local opts = { noremap = true, silent = true }
|
||||
local on_attach = function(client, bufnr)
|
||||
opts.buffer = bufnr
|
||||
@@ -73,7 +75,7 @@ lspconfig["html"].setup({
|
||||
})
|
||||
|
||||
-- configure typescript server with plugin
|
||||
lspconfig["tsserver"].setup({
|
||||
lspconfig["ts_ls"].setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
@@ -111,8 +113,20 @@ lspconfig["svelte"].setup({
|
||||
lspconfig["emmet_ls"].setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
filetypes = { "html", "typescriptreact", "javascriptreact", "css", "sass", "scss", "less", "svelte", "vue" },
|
||||
filetypes = {
|
||||
"html",
|
||||
"typescriptreact",
|
||||
"javascriptreact",
|
||||
"css",
|
||||
"sass",
|
||||
"scss",
|
||||
"less",
|
||||
"svelte",
|
||||
"vue",
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
-- configure python lsp
|
||||
lspconfig["pylsp"].setup({
|
||||
filetypes = { "python" },
|
||||
@@ -124,22 +138,29 @@ lspconfig["pylsp"].setup({
|
||||
rope_autoimport = {
|
||||
enabled = true,
|
||||
completions = { enabled = true },
|
||||
rename = { enabled = false },
|
||||
},
|
||||
black = { enabled = true },
|
||||
autopep8 = { enabled = false },
|
||||
yapf = { enabled = false },
|
||||
flake8 = { enabled = true },
|
||||
jedi_completion = {
|
||||
enabled = true,
|
||||
include_params = true,
|
||||
fuzzy = true,
|
||||
},
|
||||
pylsp_mypy = {
|
||||
enabled = true,
|
||||
overrides = DPE.ResolvePythonEnvironment(),
|
||||
report_progress = true,
|
||||
live_mode = true,
|
||||
},
|
||||
-- import sorting
|
||||
pyls_isort = { enabled = true },
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
--
|
||||
-- -- configure jedi language server
|
||||
-- lspconfig["jedi_language_server"].setup({
|
||||
-- capabilities = capabilities,
|
||||
-- on_attach = on_attach,
|
||||
-- })
|
||||
|
||||
-- configure docker server
|
||||
lspconfig["dockerls"].setup({
|
||||
capabilities = capabilities,
|
||||
@@ -226,13 +247,27 @@ lspconfig["astro"].setup({
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
|
||||
-- configure kotlin server
|
||||
lspconfig["kotlin_language_server"].setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
|
||||
-- configure clang server
|
||||
|
||||
lspconfig["clangd"].setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
-- configure arduino language server
|
||||
|
||||
lspconfig["arduino_language_server"].setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
-- configure biome server
|
||||
lspconfig["biome"].setup({
|
||||
capabilities = capabilities,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
local lualine = require("lualine")
|
||||
local lazy_status = require("lazy.status") -- to configure lazy pending updates count
|
||||
|
||||
local noice = require("noice")
|
||||
|
||||
local colors = {
|
||||
blue = "#65D1FF",
|
||||
@@ -94,23 +94,12 @@ lualine.setup({
|
||||
theme = my_lualine_theme,
|
||||
},
|
||||
sections = {
|
||||
-- lualine_c = {
|
||||
-- -- ...other lualine components
|
||||
-- {
|
||||
-- require('tmux-status').tmux_windows,
|
||||
-- cond = require('tmux-status').show,
|
||||
-- padding = { left = 3 },
|
||||
-- },
|
||||
-- },
|
||||
-- lualine_z = {
|
||||
-- -- ...other lualine components
|
||||
-- {
|
||||
-- require('tmux-status').tmux_session,
|
||||
-- cond = require('tmux-status').show,
|
||||
-- padding = { left = 3 },
|
||||
-- },
|
||||
-- },
|
||||
lualine_x = {
|
||||
{
|
||||
noice.api.statusline.mode.get,
|
||||
cond = noice.api.statusline.mode.has,
|
||||
color = { fg = "#ff9e64" },
|
||||
},
|
||||
{
|
||||
GetFlutterToolsStatusLine,
|
||||
cond = IsFlutterToolsActive,
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
require("mason").setup()
|
||||
require("mason-lspconfig").setup({
|
||||
ensure_installed = {
|
||||
"tsserver",
|
||||
"ts_ls",
|
||||
"astro",
|
||||
"biome",
|
||||
"rust_analyzer",
|
||||
"html",
|
||||
"emmet_ls",
|
||||
"lua_ls",
|
||||
'arduino_language_server',
|
||||
'clangd',
|
||||
"tailwindcss",
|
||||
"svelte",
|
||||
"cssls",
|
||||
|
||||
92
lua/absolute/after/noice.lua
Normal file
92
lua/absolute/after/noice.lua
Normal file
@@ -0,0 +1,92 @@
|
||||
local noice = require("noice")
|
||||
local notify = require("notify")
|
||||
|
||||
|
||||
notify.setup({
|
||||
top_down = false,
|
||||
animate = false,
|
||||
stages = "static",
|
||||
})
|
||||
|
||||
noice.setup({
|
||||
routes = {
|
||||
{
|
||||
filter = {
|
||||
event = "msg_show",
|
||||
min_height = 20,
|
||||
},
|
||||
view = "cmdline_output",
|
||||
},
|
||||
{
|
||||
filter = {
|
||||
event = "lsp",
|
||||
kind = "progress",
|
||||
cond = function(message)
|
||||
local client = vim.tbl_get(message.opts, "progress", "client")
|
||||
|
||||
return client == "lua_ls"
|
||||
end
|
||||
},
|
||||
opts = { skip = true },
|
||||
}
|
||||
},
|
||||
lsp = {
|
||||
-- override markdown rendering so that **cmp** and other plugins use **Treesitter**
|
||||
override = {
|
||||
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
|
||||
["vim.lsp.util.stylize_markdown"] = true,
|
||||
["cmp.entry.get_documentation"] = true, -- requires hrsh7th/nvim-cmp
|
||||
},
|
||||
},
|
||||
cmdline = {
|
||||
format = {
|
||||
search_down = {
|
||||
view = "cmdline",
|
||||
},
|
||||
search_up = {
|
||||
view = "cmdline",
|
||||
},
|
||||
},
|
||||
},
|
||||
views = {
|
||||
cmdline_popup = {
|
||||
relative = "editor",
|
||||
position = {
|
||||
row = 5,
|
||||
col = "50%",
|
||||
},
|
||||
size = {
|
||||
width = 60,
|
||||
height = "auto",
|
||||
},
|
||||
border = {
|
||||
style = { "╭", "─", "╮", "│", "╯", "─", "╰", "│" },
|
||||
padding = { 0, 1 },
|
||||
},
|
||||
filter_options = {},
|
||||
win_options = {
|
||||
winhighlight = {
|
||||
Normal = "Normal",
|
||||
}
|
||||
},
|
||||
},
|
||||
popupmenu = {
|
||||
relative = "editor",
|
||||
position = {
|
||||
row = 8,
|
||||
col = "50%",
|
||||
},
|
||||
size = {
|
||||
width = 60,
|
||||
height = 10,
|
||||
},
|
||||
border = {
|
||||
style = "rounded",
|
||||
padding = { 0, 1 },
|
||||
},
|
||||
win_options = {
|
||||
winhighlight = { Normal = "Normal", FloatBorder = "DiagnosticInfo" },
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
@@ -1,41 +1,9 @@
|
||||
local null_ls = require("null-ls")
|
||||
|
||||
|
||||
function CheckPoetryVirtualEnv()
|
||||
local poetry = vim.fn.system("poetry env info -p 2>/dev/null")
|
||||
if poetry == "" then
|
||||
return nil
|
||||
end
|
||||
return poetry
|
||||
end
|
||||
|
||||
function ResolvePythonEnvironment()
|
||||
-- Get system global python env
|
||||
local python = vim.fn.system("which python3")
|
||||
-- Check of virtual environments exists
|
||||
local virtual = os.getenv("VIRTUAL_ENV") or os.getenv("CONDA_PREFIX") or CheckPoetryVirtualEnv()
|
||||
|
||||
if virtual == nil then
|
||||
-- Check if poetry environment exists
|
||||
|
||||
return {
|
||||
"--python-executable", python
|
||||
}
|
||||
end
|
||||
|
||||
return {
|
||||
"--python-executable", virtual .. "/bin/python3"
|
||||
}
|
||||
end
|
||||
|
||||
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 = ResolvePythonEnvironment()
|
||||
}),
|
||||
},
|
||||
})
|
||||
|
||||
@@ -1,37 +1,27 @@
|
||||
local cmp = require("cmp")
|
||||
local types = require('cmp.types')
|
||||
local luasnip = require("luasnip")
|
||||
local lspkind = require("lspkind")
|
||||
|
||||
-- loads vscode style snippets from installed plugins (e.g. friendly-snippets)
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
|
||||
local function border(hl_name)
|
||||
return {
|
||||
{ "╭", hl_name },
|
||||
{ "─", hl_name },
|
||||
{ "╮", hl_name },
|
||||
{ "│", hl_name },
|
||||
{ "╯", hl_name },
|
||||
{ "─", hl_name },
|
||||
{ "╰", hl_name },
|
||||
{ "│", hl_name },
|
||||
}
|
||||
end
|
||||
|
||||
cmp.setup({
|
||||
completion = {
|
||||
completeopt = "menu,menuone,preview,noselect",
|
||||
completeopt = "menu,menuone,preview,noinsert",
|
||||
autocomplete = { types.cmp.TriggerEvent.TextChanged },
|
||||
},
|
||||
window = {
|
||||
documentation = {
|
||||
border = { '┌', '─', '┐', '│', '┘', '─', '└', '│' },
|
||||
winhighlight = 'Normal:CmpPmenu,FloatBorder:CmpPmenuBorder,CursorLine:PmenuSel,Search:None',
|
||||
},
|
||||
completion = {
|
||||
side_padding = 1,
|
||||
winhighlight = "Normal:CmpPmenu,CursorLine:CmpSel,Search:None",
|
||||
border = { '┌', '─', '┐', '│', '┘', '─', '└', '│' },
|
||||
winhighlight = 'Normal:CmpPmenu,FloatBorder:CmpPmenuBorder,CursorLine:PmenuSel,Search:None',
|
||||
scrollbar = false,
|
||||
},
|
||||
documentation = {
|
||||
border = border "CmpDocBorder",
|
||||
winhighlight = "Normal:CmpDoc",
|
||||
},
|
||||
},
|
||||
snippet = { -- configure how nvim-cmp interacts with snippet engine
|
||||
expand = function(args)
|
||||
@@ -39,16 +29,17 @@ cmp.setup({
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<C-Space>"] = cmp.mapping.complete(), -- show completion suggestions
|
||||
["<C-o>"] = cmp.mapping.complete(), -- show completion suggestions
|
||||
["<C-e>"] = cmp.mapping.abort(), -- close completion menu
|
||||
["<CR>"] = cmp.mapping.confirm({ select = true }), -- accept current selection
|
||||
}),
|
||||
-- sources for autocompletion
|
||||
sources = cmp.config.sources({
|
||||
{ name = "otter" }, -- custom source for otter completion
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" }, -- snippets
|
||||
{ name = "buffer" }, -- text within current buffer
|
||||
{ name = "path" }, -- file system paths
|
||||
{ name = "path" }, -- file system paths,
|
||||
{ name = 'nvim_lsp_signature_help' },
|
||||
}),
|
||||
-- configure lspkind for vs-code like pictograms in completion menu
|
||||
formatting = {
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
local otter = require("otter")
|
||||
|
||||
-- table of embedded languages to look for.
|
||||
-- required (no default)
|
||||
local languages = { "python", "lua" }
|
||||
|
||||
-- enable completion/diagnostics
|
||||
-- defaults are true
|
||||
local completion = true
|
||||
local diagnostics = true
|
||||
-- treesitter query to look for embedded languages
|
||||
-- uses injections if nil or not set
|
||||
local tsquery = nil
|
||||
|
||||
otter.activate(languages, completion, diagnostics, tsquery)
|
||||
@@ -1,8 +1,12 @@
|
||||
local tsj = require("treesj")
|
||||
|
||||
|
||||
local langs = {}
|
||||
|
||||
tsj.setup({
|
||||
use_default_keymaps = false,
|
||||
max_join_length = 1000,
|
||||
langs = langs,
|
||||
})
|
||||
|
||||
local opts = { silent = true, noremap = true }
|
||||
|
||||
Reference in New Issue
Block a user