mirror of
https://github.com/boxpositron/absolute-vim.git
synced 2026-02-28 03:30:36 +00:00
feat(lua): add configuration files for catppuccino theme, cheatsheet, comment, conform, dap, flutter-tools, gitignore, gitsigns, highlight-colors, image, incline, and indent-blank-line plugins.
feat(lsp-config.lua): Add configurations for various language servers and setup custom key mappings and settings for improved development experience. feat(lualine.lua, mason.lua, mini-diff.lua, mini.lua, notify.lua, nvim-bqf.lua, nvim-cmp.lua, nvim-silicon.lua, nvim-surround.lua): Add new Lua files and configurations for lualine theme, mason setup, mini-diff, mini map integrations, notify setup, nvim-bqf, nvim-cmp autocompletion, nvim-silicon screenshot, and nvim-surround setup. feat(nvim-tree.lua): add custom configurations for Nvim Tree plugin feat(nvim-treesitter-context.lua): implement Treesitter Context plugin setup feat(nvim-treesitter.lua): configure Nvim Treesitter with specific parsers and features feat(poet-v.lua): set up Poet-V plugin with custom settings feat(smear-cursor.lua): integrate Smear Cursor plugin with defined options feat(tailwind-sorter.lua): initialize Tailwind Sorter plugin with save patterns and settings feat(telescope.lua): add custom settings and extensions to improve Telescope functionality feat(venv-selector.lua): add venv-selector setup and key mappings for VenvSelector and VenvSelectCached to enhance venv management.
This commit is contained in:
11
lua/absolute/after/catppuccin.lua
Normal file
11
lua/absolute/after/catppuccin.lua
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
local theme = require("catppuccino")
|
||||||
|
|
||||||
|
theme.setup({
|
||||||
|
flavour = "mocha",
|
||||||
|
transparent_background = true,
|
||||||
|
dim_inactive = {
|
||||||
|
enabled = true,
|
||||||
|
shade = "dark",
|
||||||
|
percentage = 0.50,
|
||||||
|
},
|
||||||
|
})
|
||||||
9
lua/absolute/after/cheatsheet.lua
Normal file
9
lua/absolute/after/cheatsheet.lua
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
local cheatsheet = require("cheatsheet")
|
||||||
|
|
||||||
|
cheatsheet.setup({})
|
||||||
|
|
||||||
|
|
||||||
|
local opts = { noremap = true, silent = true }
|
||||||
|
|
||||||
|
opts.desc = "Show Cheatsheet"
|
||||||
|
vim.keymap.set("n", "<leader>\\", "<cmd>Cheatsheet<CR>", opts) -- toggle file explorer
|
||||||
3
lua/absolute/after/comment.lua
Normal file
3
lua/absolute/after/comment.lua
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
local comment = require("Comment")
|
||||||
|
|
||||||
|
comment.setup()
|
||||||
33
lua/absolute/after/conform.lua
Normal file
33
lua/absolute/after/conform.lua
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
local conform = require("conform")
|
||||||
|
|
||||||
|
conform.setup({
|
||||||
|
format_on_save = function(bufnr)
|
||||||
|
local disable_filetypes = {}
|
||||||
|
return {
|
||||||
|
timeout_ms = 500,
|
||||||
|
lsp_fallback = not disable_filetypes[vim.bo[bufnr].filetype],
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
formatters_by_ft = {
|
||||||
|
sh = { "shfmt" },
|
||||||
|
lua = { "stylua" },
|
||||||
|
-- Conform will run multiple formatters sequentially
|
||||||
|
python = {
|
||||||
|
|
||||||
|
-- To fix auto-fixable lint errors.
|
||||||
|
"ruff_fix",
|
||||||
|
-- To run the Ruff formatter.
|
||||||
|
"ruff_format",
|
||||||
|
-- To organize the imports.
|
||||||
|
"ruff_organize_imports",
|
||||||
|
},
|
||||||
|
-- Use a sub-list to run only the first available formatter
|
||||||
|
javascript = { "biome" },
|
||||||
|
astro = { "prettierd", "prettier", "biome" },
|
||||||
|
vue = { "prettierd", "prettier" },
|
||||||
|
proto = { "buf" },
|
||||||
|
yaml = { "prettierd", "prettier" },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- vim.o.formatexpr = "v:lua.require'conform'.formatexpr()"
|
||||||
31
lua/absolute/after/dap.lua
Normal file
31
lua/absolute/after/dap.lua
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
local dap = require("dap")
|
||||||
|
local dapui = require("dapui")
|
||||||
|
local virtual_text = require("nvim-dap-virtual-text")
|
||||||
|
|
||||||
|
-- Setup Virtual Text
|
||||||
|
virtual_text.setup({
|
||||||
|
prefix = " ",
|
||||||
|
hl = "Comment",
|
||||||
|
lines = 3,
|
||||||
|
enabled = true,
|
||||||
|
})
|
||||||
|
|
||||||
|
dapui.setup()
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
-- Setup Mappings
|
||||||
|
local opts = { noremap = true, silent = true }
|
||||||
|
|
||||||
|
opts.desc = "Toggle breakpoint"
|
||||||
|
vim.keymap.set("n", "<leader>db", "<cmd> DapToggleBreakpoint<CR>", opts)
|
||||||
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,
|
||||||
|
})
|
||||||
18
lua/absolute/after/gitignore.lua
Normal file
18
lua/absolute/after/gitignore.lua
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
local gitignore = require("gitignore")
|
||||||
|
local GetProjectRoot = require("absolute.utils.get-git-root")
|
||||||
|
|
||||||
|
-- Keymaps
|
||||||
|
|
||||||
|
local opts = { noremap = true, silent = true }
|
||||||
|
|
||||||
|
opts.desc = "GitIgnore: Generate .gitignore"
|
||||||
|
|
||||||
|
vim.keymap.set("n", "<leader>gi", function()
|
||||||
|
local path = GetProjectRoot()
|
||||||
|
|
||||||
|
gitignore.generate(path)
|
||||||
|
end, opts)
|
||||||
|
|
||||||
|
-- Global Settings
|
||||||
|
|
||||||
|
vim.g.gitignore_nvim_overwrite = true
|
||||||
3
lua/absolute/after/gitsigns.lua
Normal file
3
lua/absolute/after/gitsigns.lua
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
local gitsigns = require("gitsigns")
|
||||||
|
|
||||||
|
gitsigns.setup()
|
||||||
7
lua/absolute/after/highlight-colors.lua
Normal file
7
lua/absolute/after/highlight-colors.lua
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
local highlight = require("nvim-highlight-colors")
|
||||||
|
|
||||||
|
highlight.setup({
|
||||||
|
enable_tailwind = true,
|
||||||
|
})
|
||||||
|
|
||||||
|
highlight.turnOn()
|
||||||
37
lua/absolute/after/image.lua
Normal file
37
lua/absolute/after/image.lua
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
require("image").setup({
|
||||||
|
backend = "kitty",
|
||||||
|
processor = "magick_rock", -- or "magick_cli"
|
||||||
|
integrations = {
|
||||||
|
markdown = {
|
||||||
|
enabled = true,
|
||||||
|
clear_in_insert_mode = false,
|
||||||
|
download_remote_images = true,
|
||||||
|
only_render_image_at_cursor = false,
|
||||||
|
floating_windows = true, -- if true, images will be rendered in floating markdown windows
|
||||||
|
filetypes = { "markdown", "vimwiki" }, -- markdown extensions (ie. quarto) can go here
|
||||||
|
},
|
||||||
|
neorg = {
|
||||||
|
enabled = true,
|
||||||
|
filetypes = { "norg" },
|
||||||
|
},
|
||||||
|
typst = {
|
||||||
|
enabled = true,
|
||||||
|
filetypes = { "typst" },
|
||||||
|
},
|
||||||
|
html = {
|
||||||
|
enabled = false,
|
||||||
|
},
|
||||||
|
css = {
|
||||||
|
enabled = false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
max_width = nil,
|
||||||
|
max_height = nil,
|
||||||
|
max_width_window_percentage = nil,
|
||||||
|
max_height_window_percentage = 50,
|
||||||
|
window_overlap_clear_enabled = true, -- toggles images when windows are overlapped
|
||||||
|
window_overlap_clear_ft_ignore = { "cmp_menu", "cmp_docs", "snacks_notif", "scrollview", "scrollview_sign" },
|
||||||
|
editor_only_render_when_focused = true, -- auto show/hide images when the editor gains/looses focus
|
||||||
|
tmux_show_only_in_active_window = true, -- auto show/hide images in the correct Tmux window (needs visual-activity off)
|
||||||
|
hijack_file_patterns = { "*.png", "*.jpg", "*.jpeg", "*.gif", "*.webp", "*.avif", "*.svg" }, -- render image files as images when opened
|
||||||
|
})
|
||||||
45
lua/absolute/after/incline.lua
Normal file
45
lua/absolute/after/incline.lua
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
local incline = require("incline")
|
||||||
|
local helpers = require("incline.helpers")
|
||||||
|
local devicons = require("nvim-web-devicons")
|
||||||
|
|
||||||
|
local function shortenPath(str, max)
|
||||||
|
if #str > max then
|
||||||
|
local start = #str - max + 1
|
||||||
|
return "..." .. string.sub(str, start)
|
||||||
|
end
|
||||||
|
|
||||||
|
return str
|
||||||
|
end
|
||||||
|
|
||||||
|
incline.setup({
|
||||||
|
hide = {
|
||||||
|
cursorline = true,
|
||||||
|
},
|
||||||
|
window = {
|
||||||
|
padding = 0,
|
||||||
|
margin = { horizontal = 0 },
|
||||||
|
placement = {
|
||||||
|
horizontal = "right",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
render = function(props)
|
||||||
|
local filename = vim.fn.fnamemodify(vim.api.nvim_buf_get_name(props.buf), ":t")
|
||||||
|
local filepath = vim.fn.fnamemodify(vim.api.nvim_buf_get_name(props.buf), ":p")
|
||||||
|
local ft_icon, ft_color = devicons.get_icon_color(filename)
|
||||||
|
local modified = vim.bo[props.buf].modified
|
||||||
|
|
||||||
|
local path = vim.fn.fnamemodify(filepath, ":~:.") -- Get relative path
|
||||||
|
path = shortenPath(path, 30)
|
||||||
|
|
||||||
|
-- Shorten path from the left if the entire line is longer than 100 characters
|
||||||
|
|
||||||
|
--
|
||||||
|
return {
|
||||||
|
ft_icon and { " ", ft_icon, " ", guibg = ft_color, guifg = helpers.contrast_color(ft_color) } or "",
|
||||||
|
" ",
|
||||||
|
{ path, gui = modified and "bold,italic" or "bold" },
|
||||||
|
" ",
|
||||||
|
guibg = "#44406e",
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
})
|
||||||
1
lua/absolute/after/indent-blank-line.lua
Normal file
1
lua/absolute/after/indent-blank-line.lua
Normal file
@@ -0,0 +1 @@
|
|||||||
|
require("ibl").setup()
|
||||||
336
lua/absolute/after/lsp-config.lua
Normal file
336
lua/absolute/after/lsp-config.lua
Normal file
@@ -0,0 +1,336 @@
|
|||||||
|
-- Setup language servers.
|
||||||
|
local conform = require("conform")
|
||||||
|
local lspconfig = require("lspconfig")
|
||||||
|
local cmp_nvim_lsp = require("cmp_nvim_lsp")
|
||||||
|
|
||||||
|
local opts = { noremap = true, silent = true }
|
||||||
|
|
||||||
|
local global_node_modules = vim.fn.system("npm root -g")
|
||||||
|
|
||||||
|
-- client, buffer
|
||||||
|
local on_attach = function(client, bufnr)
|
||||||
|
opts.buffer = bufnr
|
||||||
|
|
||||||
|
-- Enable completion triggered by <c-x><c-o>
|
||||||
|
vim.bo[opts.buffer].omnifunc = "v:lua.vim.lsp.omnifunc"
|
||||||
|
|
||||||
|
opts.desc = "Go to declaration"
|
||||||
|
vim.keymap.set("n", "gD", vim.lsp.buf.declaration, opts)
|
||||||
|
|
||||||
|
opts.desc = "Go to definitions"
|
||||||
|
vim.keymap.set("n", "gd", "<cmd>Telescope lsp_definitions<CR>", opts)
|
||||||
|
|
||||||
|
opts.desc = "Show documentation for what is under cursor"
|
||||||
|
vim.keymap.set("n", "K", vim.lsp.buf.hover, opts)
|
||||||
|
|
||||||
|
opts.desc = "Show LSP Implementation"
|
||||||
|
vim.keymap.set("n", "gi", "<cmd>Telescope lsp_implementations<CR>", opts)
|
||||||
|
|
||||||
|
opts.desc = "Get Help"
|
||||||
|
vim.keymap.set("n", "<leader>gh", vim.lsp.buf.signature_help, opts)
|
||||||
|
|
||||||
|
-- vim.keymap.set('n', '<leader>wa', vim.lsp.buf.add_workspace_folder, opts)
|
||||||
|
-- vim.keymap.set('n', '<leader>wr', vim.lsp.buf.remove_workspace_folder, opts)
|
||||||
|
-- vim.keymap.set('n', '<leader>wl', function()
|
||||||
|
-- print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||||
|
-- end, opts)
|
||||||
|
|
||||||
|
opts.desc = "Show LSP type definitions"
|
||||||
|
vim.keymap.set("n", "gt", "<cmd>Telescope lsp_type_definitions<CR>", opts)
|
||||||
|
|
||||||
|
opts.desc = "Smart rename"
|
||||||
|
vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, opts)
|
||||||
|
|
||||||
|
opts.desc = "See available code actions"
|
||||||
|
vim.keymap.set({ "n", "v" }, "<leader>ca", vim.lsp.buf.code_action, opts)
|
||||||
|
|
||||||
|
opts.desc = "Show LSP references"
|
||||||
|
vim.keymap.set("n", "<leader>cr", "<cmd>Telescope lsp_references<CR>", opts)
|
||||||
|
|
||||||
|
opts.desc = "Format File"
|
||||||
|
vim.keymap.set({ "n", "v" }, "<leader>f", function()
|
||||||
|
-- vim.lsp.buf.format({ async = true })
|
||||||
|
conform.format({
|
||||||
|
bufnr = opts.buffer,
|
||||||
|
async = true,
|
||||||
|
lsp_fallback = true,
|
||||||
|
})
|
||||||
|
end, opts)
|
||||||
|
|
||||||
|
opts.desc = "Restart LSP"
|
||||||
|
vim.keymap.set("n", "<leader>rs", "<cmd>LspRestart<CR>", opts)
|
||||||
|
|
||||||
|
-- LSP Only Settings
|
||||||
|
-- Ruff & Pyright behaviour
|
||||||
|
if client.name == "ruff" then
|
||||||
|
-- Disable hover in favor of Pyright
|
||||||
|
client.server_capabilities.hoverProvider = false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local capabilities = cmp_nvim_lsp.default_capabilities()
|
||||||
|
|
||||||
|
-- Change the Diagnostic symbols in the sign column (gutter)
|
||||||
|
local signs = {
|
||||||
|
Error = " ",
|
||||||
|
Warn = " ",
|
||||||
|
Hint = " ",
|
||||||
|
Info = " ",
|
||||||
|
}
|
||||||
|
|
||||||
|
for type, icon in pairs(signs) do
|
||||||
|
local hl = "DiagnosticSign" .. type
|
||||||
|
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" })
|
||||||
|
end
|
||||||
|
|
||||||
|
-- configure html server
|
||||||
|
lspconfig["html"].setup({
|
||||||
|
capabilities = capabilities,
|
||||||
|
on_attach = on_attach,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- configure typescript server with plugin
|
||||||
|
lspconfig["ts_ls"].setup({
|
||||||
|
capabilities = capabilities,
|
||||||
|
on_attach = on_attach,
|
||||||
|
init_options = {
|
||||||
|
plugins = {
|
||||||
|
{
|
||||||
|
name = "@vue/typescript-plugin",
|
||||||
|
location = global_node_modules .. "@vue/typescript-plugin",
|
||||||
|
languages = { "vue" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
filetypes = { "typescript", "javascript", "javascriptreact", "typescriptreact", "vue" },
|
||||||
|
})
|
||||||
|
|
||||||
|
-- configure css server
|
||||||
|
lspconfig["cssls"].setup({
|
||||||
|
capabilities = capabilities,
|
||||||
|
on_attach = on_attach,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- configure tailwindcss server
|
||||||
|
lspconfig["tailwindcss"].setup({
|
||||||
|
capabilities = capabilities,
|
||||||
|
on_attach = on_attach,
|
||||||
|
filetypes = { "html", "svelte", "vue", "astro" },
|
||||||
|
})
|
||||||
|
|
||||||
|
-- configure svelte server
|
||||||
|
lspconfig["svelte"].setup({
|
||||||
|
capabilities = capabilities,
|
||||||
|
on_attach = function(client, bufnr)
|
||||||
|
on_attach(client, bufnr)
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd("BufWritePost", {
|
||||||
|
pattern = { "*.js", "*.ts" },
|
||||||
|
callback = function(ctx)
|
||||||
|
if client.name == "svelte" then
|
||||||
|
client.notify("$/onDidChangeTsOrJsFile", { uri = ctx.file })
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- configure emmet language server
|
||||||
|
lspconfig["emmet_ls"].setup({
|
||||||
|
capabilities = capabilities,
|
||||||
|
on_attach = on_attach,
|
||||||
|
filetypes = {
|
||||||
|
"html",
|
||||||
|
"typescriptreact",
|
||||||
|
"javascriptreact",
|
||||||
|
"astro",
|
||||||
|
"css",
|
||||||
|
"sass",
|
||||||
|
"scss",
|
||||||
|
"less",
|
||||||
|
"svelte",
|
||||||
|
"vue",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- configure ruff server
|
||||||
|
lspconfig["ruff"].setup({
|
||||||
|
capabilities = capabilities,
|
||||||
|
on_attach = on_attach,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- configure pyright server
|
||||||
|
lspconfig["pyright"].setup({
|
||||||
|
capabilities = capabilities,
|
||||||
|
on_attach = on_attach,
|
||||||
|
filetypes = { "python" },
|
||||||
|
settings = {
|
||||||
|
python = {
|
||||||
|
analysis = {
|
||||||
|
autoSearchPaths = true,
|
||||||
|
useLibraryCodeForTypes = true,
|
||||||
|
diagnosticMode = "workspace",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- configure docker server
|
||||||
|
lspconfig["dockerls"].setup({
|
||||||
|
capabilities = capabilities,
|
||||||
|
on_attach = on_attach,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- configure json server
|
||||||
|
lspconfig["jsonls"].setup({
|
||||||
|
capabilities = capabilities,
|
||||||
|
on_attach = on_attach,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- configure vue server
|
||||||
|
lspconfig["volar"].setup({
|
||||||
|
capabilities = capabilities,
|
||||||
|
on_attach = on_attach,
|
||||||
|
filetypes = { "vue" },
|
||||||
|
init_options = {
|
||||||
|
vue = {
|
||||||
|
hybridMode = false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
settings = {
|
||||||
|
typescript = {
|
||||||
|
inlayHints = {
|
||||||
|
enumMemberValues = {
|
||||||
|
enabled = true,
|
||||||
|
},
|
||||||
|
functionLikeReturnTypes = {
|
||||||
|
enabled = true,
|
||||||
|
},
|
||||||
|
propertyDeclarationTypes = {
|
||||||
|
enabled = true,
|
||||||
|
},
|
||||||
|
parameterTypes = {
|
||||||
|
enabled = true,
|
||||||
|
suppressWhenArgumentMatchesName = true,
|
||||||
|
},
|
||||||
|
variableTypes = {
|
||||||
|
enabled = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- configure rust server
|
||||||
|
lspconfig.rust_analyzer.setup({
|
||||||
|
-- Server-specific settings. See `:help lspconfig-setup`
|
||||||
|
on_attach = on_attach,
|
||||||
|
capabilities = capabilities,
|
||||||
|
settings = {
|
||||||
|
["rust-analyzer"] = {},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- configure lua server (with special settings)
|
||||||
|
lspconfig["lua_ls"].setup({
|
||||||
|
capabilities = capabilities,
|
||||||
|
on_attach = on_attach,
|
||||||
|
settings = { -- custom settings for lua
|
||||||
|
Lua = {
|
||||||
|
-- make the language server recognize "vim" global
|
||||||
|
diagnostics = {
|
||||||
|
globals = { "vim" },
|
||||||
|
},
|
||||||
|
workspace = {
|
||||||
|
-- make language server aware of runtime files
|
||||||
|
library = {
|
||||||
|
[vim.fn.expand("$VIMRUNTIME/lua")] = true,
|
||||||
|
[vim.fn.stdpath("config") .. "/lua"] = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- configure css server
|
||||||
|
lspconfig["cssls"].setup({
|
||||||
|
capabilities = capabilities,
|
||||||
|
on_attach = on_attach,
|
||||||
|
})
|
||||||
|
|
||||||
|
--configure docker file server
|
||||||
|
lspconfig["dockerls"].setup({
|
||||||
|
capabilities = capabilities,
|
||||||
|
on_attach = on_attach,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- configure docker compose server
|
||||||
|
lspconfig["docker_compose_language_service"].setup({
|
||||||
|
capabilities = capabilities,
|
||||||
|
on_attach = on_attach,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- configure eslint server
|
||||||
|
lspconfig["eslint"].setup({
|
||||||
|
capabilities = capabilities,
|
||||||
|
on_attach = on_attach,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- configure astro server
|
||||||
|
lspconfig["astro"].setup({
|
||||||
|
capabilities = capabilities,
|
||||||
|
on_attach = on_attach,
|
||||||
|
-- init_options = {
|
||||||
|
-- typescript = {
|
||||||
|
-- tsdk = ResolveTypescriptServer(),
|
||||||
|
-- },
|
||||||
|
-- },
|
||||||
|
})
|
||||||
|
|
||||||
|
-- configure kotlin server
|
||||||
|
lspconfig["kotlin_language_server"].setup({
|
||||||
|
capabilities = capabilities,
|
||||||
|
on_attach = on_attach,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- configure clang server
|
||||||
|
|
||||||
|
lspconfig["clangd"].setup({
|
||||||
|
cmd = { "clangd", "--compile-commands-dir=./", "--background-index=false" },
|
||||||
|
capabilities = capabilities,
|
||||||
|
on_attach = on_attach,
|
||||||
|
filetypes = { "c", "cpp", "objc", "objcpp" },
|
||||||
|
})
|
||||||
|
|
||||||
|
-- configure bufls server
|
||||||
|
|
||||||
|
lspconfig["buf_ls"].setup({
|
||||||
|
capabilities = capabilities,
|
||||||
|
on_attach = on_attach,
|
||||||
|
filetypes = { "proto" },
|
||||||
|
})
|
||||||
|
|
||||||
|
-- configure arduino language server
|
||||||
|
|
||||||
|
lspconfig["arduino_language_server"].setup({
|
||||||
|
capabilities = capabilities,
|
||||||
|
on_attach = on_attach,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- configure biome server
|
||||||
|
lspconfig["biome"].setup({
|
||||||
|
capabilities = capabilities,
|
||||||
|
on_attach = on_attach,
|
||||||
|
filetypes = {
|
||||||
|
"javascript",
|
||||||
|
"javascriptreact",
|
||||||
|
"json",
|
||||||
|
"jsonc",
|
||||||
|
"typescript",
|
||||||
|
"typescript.tsx",
|
||||||
|
"typescriptreact",
|
||||||
|
"astro",
|
||||||
|
"svelte",
|
||||||
|
"vue",
|
||||||
|
},
|
||||||
|
})
|
||||||
97
lua/absolute/after/lualine.lua
Normal file
97
lua/absolute/after/lualine.lua
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
local lualine = require("lualine")
|
||||||
|
local lazy_status = require("lazy.status") -- to configure lazy pending updates count
|
||||||
|
|
||||||
|
local colors = {
|
||||||
|
blue = "#65D1FF",
|
||||||
|
green = "#3EFFDC",
|
||||||
|
violet = "#FF61EF",
|
||||||
|
yellow = "#FFDA7B",
|
||||||
|
red = "#FF4A4A",
|
||||||
|
fg = "#c3ccdc",
|
||||||
|
bg = "#112638",
|
||||||
|
inactive_bg = "#2c3043",
|
||||||
|
}
|
||||||
|
|
||||||
|
local my_lualine_theme = {
|
||||||
|
normal = {
|
||||||
|
a = { bg = colors.blue, fg = colors.bg, gui = "bold" },
|
||||||
|
b = { bg = colors.bg, fg = colors.fg },
|
||||||
|
c = { bg = colors.bg, fg = colors.fg },
|
||||||
|
},
|
||||||
|
insert = {
|
||||||
|
a = { bg = colors.green, fg = colors.bg, gui = "bold" },
|
||||||
|
b = { bg = colors.bg, fg = colors.fg },
|
||||||
|
c = { bg = colors.bg, fg = colors.fg },
|
||||||
|
},
|
||||||
|
visual = {
|
||||||
|
a = { bg = colors.violet, fg = colors.bg, gui = "bold" },
|
||||||
|
b = { bg = colors.bg, fg = colors.fg },
|
||||||
|
c = { bg = colors.bg, fg = colors.fg },
|
||||||
|
},
|
||||||
|
command = {
|
||||||
|
a = { bg = colors.yellow, fg = colors.bg, gui = "bold" },
|
||||||
|
b = { bg = colors.bg, fg = colors.fg },
|
||||||
|
c = { bg = colors.bg, fg = colors.fg },
|
||||||
|
},
|
||||||
|
replace = {
|
||||||
|
a = { bg = colors.red, fg = colors.bg, gui = "bold" },
|
||||||
|
b = { bg = colors.bg, fg = colors.fg },
|
||||||
|
c = { bg = colors.bg, fg = colors.fg },
|
||||||
|
},
|
||||||
|
inactive = {
|
||||||
|
a = { bg = colors.inactive_bg, fg = colors.semilightgray, gui = "bold" },
|
||||||
|
b = { bg = colors.inactive_bg, fg = colors.semilightgray },
|
||||||
|
c = { bg = colors.inactive_bg, fg = colors.semilightgray },
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
function GetPoetvStatusLine()
|
||||||
|
-- Get the poetv statusline
|
||||||
|
-- If poetv is not active, return empty string
|
||||||
|
|
||||||
|
if IsPoetvActive() then
|
||||||
|
local poetv_name = vim.g.poetv_name
|
||||||
|
local poetv_statusline_symbol = vim.g.poetv_statusline_symbol
|
||||||
|
|
||||||
|
local result = string.sub(poetv_name, 1, 20) .. " " .. poetv_statusline_symbol
|
||||||
|
|
||||||
|
return result
|
||||||
|
else
|
||||||
|
return ""
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function IsPoetvActive()
|
||||||
|
-- Check if vim.g.poetv_name exists
|
||||||
|
-- If it does, then poetv is active
|
||||||
|
|
||||||
|
if vim.g.poetv_name ~= nil then
|
||||||
|
return true
|
||||||
|
else
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- configure lualine with modified theme
|
||||||
|
lualine.setup({
|
||||||
|
options = {
|
||||||
|
theme = my_lualine_theme,
|
||||||
|
},
|
||||||
|
sections = {
|
||||||
|
lualine_x = {
|
||||||
|
{
|
||||||
|
GetPoetvStatusLine,
|
||||||
|
cond = IsPoetvActive,
|
||||||
|
color = { fg = "#ff9e64" },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
lazy_status.updates,
|
||||||
|
cond = lazy_status.has_updates,
|
||||||
|
color = { fg = "#ff9e64" },
|
||||||
|
},
|
||||||
|
{ "encoding" },
|
||||||
|
{ "fileformat" },
|
||||||
|
{ "filetype" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
20
lua/absolute/after/mason.lua
Normal file
20
lua/absolute/after/mason.lua
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
require("mason").setup()
|
||||||
|
require("mason-lspconfig").setup({
|
||||||
|
ensure_installed = {
|
||||||
|
"ts_ls",
|
||||||
|
"astro",
|
||||||
|
"biome",
|
||||||
|
"rust_analyzer",
|
||||||
|
"html",
|
||||||
|
"emmet_ls",
|
||||||
|
"lua_ls",
|
||||||
|
"arduino_language_server",
|
||||||
|
"clangd",
|
||||||
|
"tailwindcss",
|
||||||
|
"svelte",
|
||||||
|
"cssls",
|
||||||
|
"jedi_language_server",
|
||||||
|
"kotlin_language_server",
|
||||||
|
},
|
||||||
|
automatic_enable = false,
|
||||||
|
})
|
||||||
6
lua/absolute/after/mini-diff.lua
Normal file
6
lua/absolute/after/mini-diff.lua
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
local diff = require("mini.diff")
|
||||||
|
|
||||||
|
diff.setup({
|
||||||
|
-- Disabled by default
|
||||||
|
source = diff.gen_source.none(),
|
||||||
|
})
|
||||||
11
lua/absolute/after/mini.lua
Normal file
11
lua/absolute/after/mini.lua
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
local map = require("mini.map")
|
||||||
|
require("mini.map").setup({
|
||||||
|
integrations = {
|
||||||
|
map.gen_integration.builtin_search(),
|
||||||
|
map.gen_integration.gitsigns(),
|
||||||
|
map.gen_integration.diagnostic()
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.keymap.set("n", "<leader>mc", map.close)
|
||||||
|
vim.keymap.set("n", "<leader>mo", map.open)
|
||||||
25
lua/absolute/after/notify.lua
Normal file
25
lua/absolute/after/notify.lua
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
local notify = require("notify")
|
||||||
|
|
||||||
|
notify.setup({
|
||||||
|
background_colour = "#000000",
|
||||||
|
fps = 15,
|
||||||
|
icons = {
|
||||||
|
DEBUG = "",
|
||||||
|
ERROR = "",
|
||||||
|
INFO = "",
|
||||||
|
TRACE = "✎",
|
||||||
|
WARN = "",
|
||||||
|
},
|
||||||
|
level = 2,
|
||||||
|
minimum_width = 50,
|
||||||
|
render = "default",
|
||||||
|
stages = "static",
|
||||||
|
time_formats = {
|
||||||
|
notification = "%T",
|
||||||
|
notification_history = "%FT%T",
|
||||||
|
},
|
||||||
|
timeout = 3000,
|
||||||
|
top_down = true,
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.notify = notify
|
||||||
0
lua/absolute/after/nvim-bqf.lua
Normal file
0
lua/absolute/after/nvim-bqf.lua
Normal file
72
lua/absolute/after/nvim-cmp.lua
Normal file
72
lua/absolute/after/nvim-cmp.lua
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
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()
|
||||||
|
|
||||||
|
cmp.setup({
|
||||||
|
completion = {
|
||||||
|
completeopt = "menu,menuone,preview,noinsert,noselect",
|
||||||
|
autocomplete = { types.cmp.TriggerEvent.TextChanged },
|
||||||
|
},
|
||||||
|
window = {
|
||||||
|
documentation = {
|
||||||
|
border = { "┌", "─", "┐", "│", "┘", "─", "└", "│" },
|
||||||
|
winhighlight = "Normal:CmpPmenu,FloatBorder:CmpPmenuBorder,CursorLine:PmenuSel,Search:None",
|
||||||
|
},
|
||||||
|
completion = {
|
||||||
|
side_padding = 1,
|
||||||
|
border = { "┌", "─", "┐", "│", "┘", "─", "└", "│" },
|
||||||
|
winhighlight = "Normal:CmpPmenu,FloatBorder:CmpPmenuBorder,CursorLine:PmenuSel,Search:None",
|
||||||
|
scrollbar = false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
snippet = { -- configure how nvim-cmp interacts with snippet engine
|
||||||
|
expand = function(args)
|
||||||
|
luasnip.lsp_expand(args.body)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
mapping = cmp.mapping.preset.insert({
|
||||||
|
["<C-.>"] = cmp.mapping.complete(), -- show completion suggestions
|
||||||
|
["C-<BS>"] = cmp.mapping.abort(), -- close completion menu
|
||||||
|
["<CR>"] = cmp.mapping.confirm({ select = true }), -- accept current selection
|
||||||
|
}),
|
||||||
|
|
||||||
|
-- sources for autocompletion
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = "nvim_lsp" },
|
||||||
|
{ name = "codecompanion" }, -- code companion for AI-assisted coding
|
||||||
|
{ name = "luasnip" }, -- snippets
|
||||||
|
{ name = "buffer" }, -- text within current buffer
|
||||||
|
{ name = "path" }, -- file system paths,
|
||||||
|
{ name = "nvim_lsp_signature_help" },
|
||||||
|
}),
|
||||||
|
-- configure lspkind for vs-code like pictograms in completion menu
|
||||||
|
formatting = {
|
||||||
|
format = lspkind.cmp_format({
|
||||||
|
maxwidth = 50,
|
||||||
|
ellipsis_char = "...",
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
|
||||||
|
cmp.setup.cmdline({ "/", "?" }, {
|
||||||
|
mapping = cmp.mapping.preset.cmdline(),
|
||||||
|
sources = {
|
||||||
|
{ name = "buffer" },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
|
||||||
|
cmp.setup.cmdline(":", {
|
||||||
|
mapping = cmp.mapping.preset.cmdline(),
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = "path" },
|
||||||
|
}, {
|
||||||
|
{ name = "cmdline" },
|
||||||
|
}),
|
||||||
|
matching = { disallow_symbol_nonprefix_matching = false },
|
||||||
|
})
|
||||||
57
lua/absolute/after/nvim-silicon.lua
Normal file
57
lua/absolute/after/nvim-silicon.lua
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
local silicon = require("silicon")
|
||||||
|
local current_os = require("absolute.utils.detect-os")
|
||||||
|
local get_git_root = require("absolute.utils.get-git-root")
|
||||||
|
|
||||||
|
local os_name = current_os.detect()
|
||||||
|
local supported_os = current_os.supported
|
||||||
|
|
||||||
|
local function generate_file_name()
|
||||||
|
-- Generate a file name
|
||||||
|
local file_name = os.date("!%Y-%m-%dT%H-%M-%S") .. "_code.png"
|
||||||
|
|
||||||
|
-- Project root
|
||||||
|
local project_root = get_git_root()
|
||||||
|
|
||||||
|
-- Create screenshots directory if it doesn't exist in the local directory
|
||||||
|
local screenshot_dir = project_root .. "/Screenshots"
|
||||||
|
if vim.fn.isdirectory(screenshot_dir) == 0 then
|
||||||
|
vim.fn.mkdir(screenshot_dir, "p")
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Return the full path to the file
|
||||||
|
return screenshot_dir .. "/" .. file_name
|
||||||
|
end
|
||||||
|
|
||||||
|
function Open_local_screenshot_folder()
|
||||||
|
local project_root = get_git_root()
|
||||||
|
local screenshot_dir = project_root .. "/Screenshots"
|
||||||
|
|
||||||
|
if os_name == supported_os.MACOS then
|
||||||
|
vim.fn.jobstart("open " .. screenshot_dir, { detach = true })
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if os_name == supported_os.UNIX then
|
||||||
|
vim.fn.jobstart("xdg-open " .. screenshot_dir, { detach = true })
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if os_name == supported_os.WINDOWS then
|
||||||
|
vim.fn.jobstart("explorer " .. screenshot_dir, { detach = true })
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Keymaps
|
||||||
|
local opts = { noremap = true, silent = true }
|
||||||
|
|
||||||
|
opts.desc = "Silicon: Create screenshot of highlighted code"
|
||||||
|
vim.api.nvim_set_keymap("v", "<leader>sc", ":'<,'>Silicon<CR>", opts)
|
||||||
|
|
||||||
|
opts.desc = "Silicon: Open screenshots directory"
|
||||||
|
vim.api.nvim_set_keymap("n", "<leader>so", "<cmd>lua Open_local_screenshot_folder()<cr>", opts)
|
||||||
|
|
||||||
|
silicon.setup({
|
||||||
|
font = "JetBrains Mono=34;Noto Emoji",
|
||||||
|
output = generate_file_name,
|
||||||
|
})
|
||||||
3
lua/absolute/after/nvim-surround.lua
Normal file
3
lua/absolute/after/nvim-surround.lua
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
local surround = require("nvim-surround")
|
||||||
|
|
||||||
|
surround.setup({})
|
||||||
49
lua/absolute/after/nvim-tree.lua
Normal file
49
lua/absolute/after/nvim-tree.lua
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
local nvimtree = require("absolute.disabled.nvim-tree")
|
||||||
|
|
||||||
|
vim.g.loaded_netrw = 1
|
||||||
|
vim.g.loaded_netrwPlugin = 1
|
||||||
|
|
||||||
|
vim.cmd([[ highlight NvimTreeIndentMarker guifg=#3FC5FF ]])
|
||||||
|
|
||||||
|
vim.cmd([[ highlight NvimTreeFolderArrowClosed guifg=#3FC5FF ]])
|
||||||
|
vim.cmd([[ highlight NvimTreeFolderArrowOpen guifg=#3FC5FF ]])
|
||||||
|
|
||||||
|
nvimtree.setup({
|
||||||
|
view = {
|
||||||
|
width = 45,
|
||||||
|
relativenumber = true,
|
||||||
|
},
|
||||||
|
update_focused_file = {
|
||||||
|
enable = true,
|
||||||
|
},
|
||||||
|
renderer = {
|
||||||
|
indent_markers = {
|
||||||
|
enable = true,
|
||||||
|
},
|
||||||
|
icons = {
|
||||||
|
glyphs = {
|
||||||
|
|
||||||
|
folder = {
|
||||||
|
arrow_closed = "", -- arrow when folder is closed
|
||||||
|
arrow_open = "", -- arrow when folder is open
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
-- disable window_picker for
|
||||||
|
-- explorer to work well with
|
||||||
|
-- window splits
|
||||||
|
actions = {
|
||||||
|
open_file = {
|
||||||
|
window_picker = {
|
||||||
|
enable = false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
filters = {
|
||||||
|
custom = { ".DS_Store" },
|
||||||
|
},
|
||||||
|
git = {
|
||||||
|
ignore = false,
|
||||||
|
},
|
||||||
|
})
|
||||||
24
lua/absolute/after/nvim-treesitter-context.lua
Normal file
24
lua/absolute/after/nvim-treesitter-context.lua
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
local treesittercontext = require("treesitter-context")
|
||||||
|
|
||||||
|
treesittercontext.setup({
|
||||||
|
enable = true, -- Enable this plugin (Can be enabled/disabled later via commands)
|
||||||
|
max_lines = 5, -- How many lines the window should span. Values <= 0 mean no limit.
|
||||||
|
min_window_height = 0, -- Minimum editor window height to enable context. Values <= 0 mean no limit.
|
||||||
|
line_numbers = true,
|
||||||
|
multiline_threshold = 20, -- Maximum number of lines to show for a single context
|
||||||
|
trim_scope = "outer", -- Which context lines to discard if `max_lines` is exceeded. Choices: 'inner', 'outer'
|
||||||
|
mode = "cursor", -- Line used to calculate context. Choices: 'cursor', 'topline'
|
||||||
|
-- Separator between context and content. Should be a single character string, like '-'.
|
||||||
|
-- When separator is set, the context will only show up when there are at least 2 lines above cursorline.
|
||||||
|
separator = nil,
|
||||||
|
zindex = 20, -- The Z-index of the context window
|
||||||
|
on_attach = nil, -- (fun(buf: integer): boolean) return false to disable attaching
|
||||||
|
})
|
||||||
|
|
||||||
|
local opts = { silent = true }
|
||||||
|
|
||||||
|
opts.desc = "Treesitter Context: Go to Previous Context"
|
||||||
|
|
||||||
|
vim.keymap.set("n", "[c", function()
|
||||||
|
treesittercontext.go_to_context(vim.v.count1)
|
||||||
|
end, opts)
|
||||||
71
lua/absolute/after/nvim-treesitter.lua
Normal file
71
lua/absolute/after/nvim-treesitter.lua
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
require("nvim-treesitter.configs").setup({
|
||||||
|
-- A list of parser names, or "all" (the five listed parsers should always be installed)
|
||||||
|
ensure_installed = {
|
||||||
|
"rust",
|
||||||
|
"javascript",
|
||||||
|
"typescript",
|
||||||
|
"python",
|
||||||
|
"proto",
|
||||||
|
"c",
|
||||||
|
"lua",
|
||||||
|
"vim",
|
||||||
|
"vimdoc",
|
||||||
|
"query",
|
||||||
|
"markdown_inline",
|
||||||
|
"markdown",
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Install parsers synchronously (only applied to `ensure_installed`)
|
||||||
|
sync_install = false,
|
||||||
|
|
||||||
|
-- Automatically install missing parsers when entering buffer
|
||||||
|
-- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
|
||||||
|
auto_install = true,
|
||||||
|
|
||||||
|
---- If you need to change the installation directory of the parsers (see -> Advanced Setup)
|
||||||
|
-- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")!
|
||||||
|
|
||||||
|
highlight = {
|
||||||
|
enable = true,
|
||||||
|
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
|
||||||
|
-- Using this option may slow down your editor, and you may see some duplicate highlights.
|
||||||
|
-- Instead of true it can also be a list of languages
|
||||||
|
additional_vim_regex_highlighting = false,
|
||||||
|
disable = { "php" },
|
||||||
|
},
|
||||||
|
textobjects = {
|
||||||
|
move = {
|
||||||
|
enable = true,
|
||||||
|
set_jumps = false, -- you can change this if you want.
|
||||||
|
goto_next_start = {
|
||||||
|
--- ... other keymaps
|
||||||
|
["]b"] = { query = "@code_cell.inner", desc = "next code block" },
|
||||||
|
},
|
||||||
|
goto_previous_start = {
|
||||||
|
--- ... other keymaps
|
||||||
|
["[b"] = { query = "@code_cell.inner", desc = "previous code block" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
select = {
|
||||||
|
enable = true,
|
||||||
|
lookahead = true, -- you can change this if you want
|
||||||
|
keymaps = {
|
||||||
|
--- ... other keymaps
|
||||||
|
["ib"] = { query = "@code_cell.inner", desc = "in block" },
|
||||||
|
["ab"] = { query = "@code_cell.outer", desc = "around block" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
swap = { -- Swap only works with code blocks that are under the same
|
||||||
|
-- markdown header
|
||||||
|
enable = true,
|
||||||
|
swap_next = {
|
||||||
|
--- ... other keymap
|
||||||
|
["<leader>sbl"] = "@code_cell.outer",
|
||||||
|
},
|
||||||
|
swap_previous = {
|
||||||
|
--- ... other keymap
|
||||||
|
["<leader>sbh"] = "@code_cell.outer",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
20
lua/absolute/after/poet-v.lua
Normal file
20
lua/absolute/after/poet-v.lua
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
vim.g.poetv_executables = { "poetry" }
|
||||||
|
vim.g.poetv_auto_activate = 0
|
||||||
|
vim.g.poetv_set_environment = 1
|
||||||
|
vim.g.poetv_statusline_symbol = "🐍"
|
||||||
|
|
||||||
|
-- Setup Autocommands
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
|
||||||
|
pattern = { "*/.venv/*", "*.py" },
|
||||||
|
callback = function()
|
||||||
|
-- check if poetv is activated
|
||||||
|
|
||||||
|
if vim.g.poetv_name ~= nil then
|
||||||
|
return
|
||||||
|
else
|
||||||
|
vim.cmd([[ PoetvActivate ]])
|
||||||
|
vim.cmd([[ LspRestart ]])
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
10
lua/absolute/after/smear-cursor.lua
Normal file
10
lua/absolute/after/smear-cursor.lua
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
local smear_cursor = require("smear_cursor")
|
||||||
|
|
||||||
|
smear_cursor.setup({
|
||||||
|
stiffness = 0.5,
|
||||||
|
trailing_stiffness = 0.49,
|
||||||
|
never_draw_over_target = false,
|
||||||
|
smear_insert_mode = false,
|
||||||
|
smear_between_buffers = true,
|
||||||
|
cursor_color = "#7DF9FF",
|
||||||
|
})
|
||||||
6
lua/absolute/after/tailwind-sorter.lua
Normal file
6
lua/absolute/after/tailwind-sorter.lua
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
local tws = require("tailwind-sorter")
|
||||||
|
|
||||||
|
tws.setup({
|
||||||
|
on_save_enabled = true,
|
||||||
|
on_save_pattern = { "*.html", "*.js", "*.jsx", "*.tsx", "*.twig", "*.hbs", "*.php", "*.heex", "*.astro", "*.vue" }, -- T
|
||||||
|
})
|
||||||
182
lua/absolute/after/telescope.lua
Normal file
182
lua/absolute/after/telescope.lua
Normal file
@@ -0,0 +1,182 @@
|
|||||||
|
local telescope = require("telescope")
|
||||||
|
local builtin = require("telescope.builtin")
|
||||||
|
local actions = require("telescope.actions")
|
||||||
|
local trouble = require("trouble.sources.telescope")
|
||||||
|
local file_browser_actions = require("telescope._extensions.file_browser.actions")
|
||||||
|
local live_grep_shortcuts = require("telescope-live-grep-args.shortcuts")
|
||||||
|
local live_grep_actions = require("telescope-live-grep-args.actions")
|
||||||
|
|
||||||
|
local image_preview = require("absolute.utils.telescope_image_preview")
|
||||||
|
|
||||||
|
-- local function chafa_previewer_mime_hook(filepath, bufnr, opts)
|
||||||
|
-- local is_image = function(current_filepath)
|
||||||
|
-- local image_extensions = { "png", "jpg", "jpeg", "gif" } -- Supported image formats
|
||||||
|
-- local split_path = vim.split(current_filepath:lower(), ".", { plain = true })
|
||||||
|
-- local extension = split_path[#split_path]
|
||||||
|
-- return vim.tbl_contains(image_extensions, extension)
|
||||||
|
-- end
|
||||||
|
-- if is_image(filepath) then
|
||||||
|
-- local term = vim.api.nvim_open_term(bufnr, {})
|
||||||
|
-- local function send_output(_, data, _)
|
||||||
|
-- for _, d in ipairs(data) do
|
||||||
|
-- vim.api.nvim_chan_send(term, d .. "\r\n")
|
||||||
|
-- end
|
||||||
|
-- end
|
||||||
|
-- vim.fn.jobstart("chafa --passthrough tmux --exact-size off --format=symbols " .. filepath, {
|
||||||
|
-- on_stdout = send_output,
|
||||||
|
-- stdout_buffered = true,
|
||||||
|
-- })
|
||||||
|
-- else
|
||||||
|
-- require("telescope.previewers.utils").set_preview_message(bufnr, opts.winid, "Binary cannot be previewed")
|
||||||
|
-- end
|
||||||
|
-- end
|
||||||
|
|
||||||
|
telescope.setup({
|
||||||
|
defaults = {
|
||||||
|
file_previewer = image_preview.file_previewer,
|
||||||
|
buffer_previewer_maker = image_preview.buffer_previewer_maker,
|
||||||
|
|
||||||
|
vimgrep_arguments = {
|
||||||
|
"rg",
|
||||||
|
"--color=never",
|
||||||
|
"--no-heading",
|
||||||
|
"--with-filename",
|
||||||
|
"--line-number",
|
||||||
|
"--column",
|
||||||
|
"--smart-case",
|
||||||
|
"--follow",
|
||||||
|
"--hidden",
|
||||||
|
"--glob=!.git/",
|
||||||
|
},
|
||||||
|
mappings = {
|
||||||
|
i = {
|
||||||
|
["<C-t>"] = trouble.open,
|
||||||
|
["<C-q>"] = actions.send_to_qflist,
|
||||||
|
},
|
||||||
|
n = {
|
||||||
|
["<C-t>"] = trouble.open,
|
||||||
|
["<C-q>"] = actions.send_to_qflist,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
extensions = {
|
||||||
|
media_files = {
|
||||||
|
filetypes = { "png", "webp", "jpg", "jpeg", "svg" },
|
||||||
|
find_cmd = "rg",
|
||||||
|
},
|
||||||
|
live_grep_args = {
|
||||||
|
auto_quoting = false,
|
||||||
|
mappings = {
|
||||||
|
i = {
|
||||||
|
["C-space"] = live_grep_actions.to_fuzzy_refine,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
file_browser = {
|
||||||
|
hijack_netrw = true,
|
||||||
|
hide_parent_dir = true,
|
||||||
|
depth = 1,
|
||||||
|
respect_gitignore = vim.fn.executable("fd") == 1,
|
||||||
|
hidden = { file_browser = true, folder_browser = false },
|
||||||
|
auto_depth = false,
|
||||||
|
browse_files = require("telescope._extensions.file_browser.finders").browse_files,
|
||||||
|
display_stat = {
|
||||||
|
date = true,
|
||||||
|
size = true,
|
||||||
|
mode = false,
|
||||||
|
},
|
||||||
|
use_fd = true,
|
||||||
|
git_status = true,
|
||||||
|
mappings = {
|
||||||
|
["i"] = {
|
||||||
|
["<A-c>"] = file_browser_actions.create,
|
||||||
|
["<S-CR>"] = file_browser_actions.create_from_prompt,
|
||||||
|
["<A-r>"] = file_browser_actions.rename,
|
||||||
|
["<A-m>"] = file_browser_actions.move,
|
||||||
|
["<A-y>"] = file_browser_actions.copy,
|
||||||
|
["<A-d>"] = file_browser_actions.remove,
|
||||||
|
["<C-o>"] = file_browser_actions.open,
|
||||||
|
["<C-g>"] = file_browser_actions.goto_parent_dir,
|
||||||
|
["<C-e>"] = file_browser_actions.goto_home_dir,
|
||||||
|
["<C-w>"] = file_browser_actions.goto_cwd,
|
||||||
|
["<C-t>"] = file_browser_actions.change_cwd,
|
||||||
|
["<C-f>"] = file_browser_actions.toggle_browser,
|
||||||
|
["<C-h>"] = file_browser_actions.toggle_hidden,
|
||||||
|
["<C-s>"] = file_browser_actions.toggle_all,
|
||||||
|
["<bs>"] = file_browser_actions.backspace,
|
||||||
|
},
|
||||||
|
["n"] = {
|
||||||
|
["c"] = file_browser_actions.create,
|
||||||
|
["r"] = file_browser_actions.rename,
|
||||||
|
["m"] = file_browser_actions.move,
|
||||||
|
["y"] = file_browser_actions.copy,
|
||||||
|
["d"] = file_browser_actions.remove,
|
||||||
|
["o"] = file_browser_actions.open,
|
||||||
|
["g"] = file_browser_actions.goto_parent_dir,
|
||||||
|
["e"] = file_browser_actions.goto_home_dir,
|
||||||
|
["w"] = file_browser_actions.goto_cwd,
|
||||||
|
["t"] = file_browser_actions.change_cwd,
|
||||||
|
["f"] = file_browser_actions.toggle_browser,
|
||||||
|
["h"] = file_browser_actions.toggle_hidden,
|
||||||
|
["s"] = file_browser_actions.toggle_all,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
telescope.load_extension("live_grep_args")
|
||||||
|
telescope.load_extension("file_browser")
|
||||||
|
telescope.load_extension("media_files")
|
||||||
|
telescope.load_extension("themes")
|
||||||
|
telescope.load_extension("dap")
|
||||||
|
|
||||||
|
local find_files = function()
|
||||||
|
builtin.find_files({
|
||||||
|
find_command = { "rg", "--files", "--hidden", "--glob", "!.git" },
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
local default_grep_files = function()
|
||||||
|
local input = vim.fn.input("[Global Search]: ")
|
||||||
|
local trimmed_input = vim.fn.trim(input)
|
||||||
|
|
||||||
|
-- Check the length of the input
|
||||||
|
|
||||||
|
local live_grep_args = telescope.extensions.live_grep_args
|
||||||
|
-- If the input is empty open the search prompt
|
||||||
|
|
||||||
|
if trimmed_input == "" then
|
||||||
|
live_grep_args.live_grep_args()
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
builtin.grep_string({ search = trimmed_input })
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Function to get the visually selected text
|
||||||
|
|
||||||
|
-- Pipe the visual selection into Telescope find_files
|
||||||
|
local opts = { noremap = true, silent = true }
|
||||||
|
|
||||||
|
opts.desc = "Open file browser (cwd)"
|
||||||
|
vim.keymap.set("n", "<leader>pf", "<cmd>Telescope file_browser<CR>", opts)
|
||||||
|
|
||||||
|
opts.desc = "Open file browser (current file)"
|
||||||
|
vim.keymap.set("n", "<leader>cf", "<cmd>Telescope file_browser path=%:p:h select_buffer=true<CR>", opts)
|
||||||
|
|
||||||
|
opts.desc = "Fuzzy find files (cwd)"
|
||||||
|
vim.keymap.set("n", "<C-p>", find_files, opts)
|
||||||
|
|
||||||
|
opts.desc = "Fuzzy find recent files"
|
||||||
|
vim.keymap.set("n", "<leader>pr", builtin.oldfiles, opts)
|
||||||
|
|
||||||
|
opts.desc = "Fuzzy find files in git in cwd"
|
||||||
|
vim.keymap.set("n", "<leader>gf", builtin.git_files, opts)
|
||||||
|
|
||||||
|
opts.desc = "Fuzzy find files in cwd"
|
||||||
|
vim.keymap.set("n", "<leader>ps", default_grep_files, opts)
|
||||||
|
|
||||||
|
opts.desc = "Fuzzy find word under cursor in cwd"
|
||||||
|
vim.keymap.set("n", "<leader>sb", live_grep_shortcuts.grep_word_under_cursor, opts)
|
||||||
25
lua/absolute/after/todo-comments.lua
Normal file
25
lua/absolute/after/todo-comments.lua
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
local todo_comments = require("todo-comments")
|
||||||
|
|
||||||
|
todo_comments.setup({})
|
||||||
|
|
||||||
|
local opts = { noremap = true, silent = true }
|
||||||
|
|
||||||
|
opts.desc = "Jump to previous comment"
|
||||||
|
vim.keymap.set("n", "[t", function()
|
||||||
|
todo_comments.jump_prev()
|
||||||
|
end, opts)
|
||||||
|
|
||||||
|
opts.desc = "Jump to next todo comment"
|
||||||
|
vim.keymap.set("n", "]t", function()
|
||||||
|
todo_comments.jump_next()
|
||||||
|
end, opts)
|
||||||
|
|
||||||
|
opts.desc = "Open Comments in Telescope"
|
||||||
|
vim.keymap.set("n", "<leader>pt", function()
|
||||||
|
vim.cmd([[TodoTelescope]])
|
||||||
|
end, opts)
|
||||||
|
|
||||||
|
opts.desc = "Open Comments in Trouble"
|
||||||
|
vim.keymap.set("n", "<leader>tt", function()
|
||||||
|
vim.cmd([[TodoTrouble]])
|
||||||
|
end, opts)
|
||||||
62
lua/absolute/after/toggleterm.lua
Normal file
62
lua/absolute/after/toggleterm.lua
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
local toggle_term = require("toggleterm")
|
||||||
|
local Terminal = require("toggleterm.terminal").Terminal
|
||||||
|
|
||||||
|
toggle_term.setup({
|
||||||
|
direction = "float",
|
||||||
|
})
|
||||||
|
|
||||||
|
local opts = { noremap = true, silent = true }
|
||||||
|
|
||||||
|
local lazygit = Terminal:new({
|
||||||
|
cmd = "lazygit",
|
||||||
|
dir = "git_dir",
|
||||||
|
direction = "float",
|
||||||
|
float_opts = {
|
||||||
|
border = "double",
|
||||||
|
},
|
||||||
|
-- function to run on opening the terminal
|
||||||
|
on_open = function(term)
|
||||||
|
vim.cmd("startinsert!")
|
||||||
|
vim.api.nvim_buf_set_keymap(term.bufnr, "n", "q", "<cmd>close<CR>", opts)
|
||||||
|
end,
|
||||||
|
-- function to run on closing the terminal
|
||||||
|
on_close = function(term)
|
||||||
|
vim.cmd("startinsert!")
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
function _LAZYGIT_TOGGLE()
|
||||||
|
lazygit:toggle()
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Todo prompt model to run
|
||||||
|
local ollama = Terminal:new({
|
||||||
|
cmd = "ollama run llama3",
|
||||||
|
dir = "git_dir",
|
||||||
|
direction = "float",
|
||||||
|
float_opts = {
|
||||||
|
border = "double",
|
||||||
|
},
|
||||||
|
-- function to run on opening the terminal
|
||||||
|
on_open = function(term)
|
||||||
|
vim.cmd("startinsert!")
|
||||||
|
vim.api.nvim_buf_set_keymap(term.bufnr, "n", "q", "<cmd>close<CR>", opts)
|
||||||
|
end,
|
||||||
|
-- function to run on closing the terminal
|
||||||
|
on_close = function(term)
|
||||||
|
vim.cmd("startinsert!")
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
function _OLLAMA_TOGGLE()
|
||||||
|
ollama:toggle()
|
||||||
|
end
|
||||||
|
|
||||||
|
opts.desc = "Open lazygit"
|
||||||
|
vim.api.nvim_set_keymap("n", "<leader>gs", "<cmd>lua _LAZYGIT_TOGGLE()<CR>", opts)
|
||||||
|
|
||||||
|
opts.desc = "Open ollama"
|
||||||
|
vim.api.nvim_set_keymap("n", "<leader>ol", "<cmd>lua _OLLAMA_TOGGLE()<CR>", opts)
|
||||||
|
|
||||||
|
-- opts.desc = "Open a terminal"
|
||||||
|
-- vim.api.nvim_set_keymap("n", "<C-`>", "<cmd>ToggleTerm<CR>", opts)
|
||||||
7
lua/absolute/after/tokyonight.lua
Normal file
7
lua/absolute/after/tokyonight.lua
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
local theme = require("tokyonight")
|
||||||
|
|
||||||
|
theme.setup({
|
||||||
|
style = "night",
|
||||||
|
transparent = true,
|
||||||
|
dim_inactive = true,
|
||||||
|
})
|
||||||
16
lua/absolute/after/treesj.lua
Normal file
16
lua/absolute/after/treesj.lua
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
local tsj = require("treesj")
|
||||||
|
|
||||||
|
|
||||||
|
local langs = {}
|
||||||
|
|
||||||
|
tsj.setup({
|
||||||
|
use_default_keymaps = false,
|
||||||
|
max_join_length = 1000,
|
||||||
|
langs = langs,
|
||||||
|
})
|
||||||
|
|
||||||
|
local opts = { silent = true, noremap = true }
|
||||||
|
|
||||||
|
opts.desc = "Toggle Treesitter Join"
|
||||||
|
|
||||||
|
vim.keymap.set("n", "<leader>m", "<cmd>TSJToggle<CR>", opts)
|
||||||
4
lua/absolute/after/undotree.lua
Normal file
4
lua/absolute/after/undotree.lua
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir"
|
||||||
|
vim.opt.undofile = true
|
||||||
|
|
||||||
|
vim.keymap.set("n", "<leader>u", vim.cmd.UndotreeToggle)
|
||||||
14
lua/absolute/after/venv-selector.lua
Normal file
14
lua/absolute/after/venv-selector.lua
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
local venvSelector = require("venv-selector")
|
||||||
|
|
||||||
|
venvSelector.setup({
|
||||||
|
-- name = "venv",
|
||||||
|
auto_refresh = false,
|
||||||
|
})
|
||||||
|
|
||||||
|
local opts = { noremap = true, silent = true }
|
||||||
|
|
||||||
|
opts.desc = "Open VenvSelector to pick a venv."
|
||||||
|
vim.api.nvim_set_keymap("n", "<leader>vs", "<cmd>VenvSelect<cr>", opts)
|
||||||
|
|
||||||
|
opts.desc = "Retrieve the venv from a cache."
|
||||||
|
vim.api.nvim_set_keymap("n", "<leader>vc", "<cmd>VenvSelectCached<cr>", opts)
|
||||||
Reference in New Issue
Block a user