feat: dot plugin for new configuration
This commit is contained in:
55
lua/dot/init.lua
Normal file
55
lua/dot/init.lua
Normal file
@@ -0,0 +1,55 @@
|
||||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = " "
|
||||
|
||||
-- Filetype plugins
|
||||
vim.o.filetype = "on"
|
||||
|
||||
-- Terminal
|
||||
vim.o.termguicolors = true -- True colors
|
||||
vim.g.have_nerd_font = true
|
||||
|
||||
---- Appearance
|
||||
|
||||
-- Line numbers
|
||||
vim.o.number = true
|
||||
vim.o.relativenumber = true
|
||||
vim.o.signcolumn = "yes"
|
||||
vim.o.colorcolumn = "80"
|
||||
|
||||
-- Indentation
|
||||
vim.o.expandtab = false
|
||||
vim.o.tabstop = 4
|
||||
vim.o.softtabstop = 4
|
||||
vim.o.shiftwidth = 4
|
||||
vim.o.breakindent = true
|
||||
vim.o.list = true
|
||||
vim.opt.listchars = { tab = "│ ", trail = ".", nbsp = "␣" }
|
||||
|
||||
----
|
||||
|
||||
-- Mouse support
|
||||
vim.o.mouse = "a"
|
||||
|
||||
-- Save undo history
|
||||
vim.o.undofile = true
|
||||
|
||||
vim.o.ignorecase = true
|
||||
vim.o.smartcase = true
|
||||
|
||||
vim.o.updatetime = 250
|
||||
vim.o.timeoutlen = 300
|
||||
|
||||
vim.o.splitright = true
|
||||
vim.o.splitbelow = true
|
||||
|
||||
vim.o.inccommand = "split"
|
||||
|
||||
vim.o.cursorline = true
|
||||
|
||||
vim.o.scrolloff = 10
|
||||
|
||||
vim.o.completeopt = "menuone,noselect"
|
||||
|
||||
-- Confirm on exit
|
||||
vim.o.confirm = true
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
local grip_channel = nil
|
||||
vim.api.nvim_create_user_command("GripStart", function()
|
||||
if grip_channel then
|
||||
return
|
||||
end
|
||||
|
||||
local file = vim.api.nvim_buf_get_name(0)
|
||||
|
||||
local cmd = "go-grip -b false -H 0.0.0.0 " .. file
|
||||
|
||||
grip_channel = vim.fn.jobstart(cmd, {
|
||||
stderr_buffered = true,
|
||||
on_stderr = function(_, err)
|
||||
vim.fn.jobstop(grip_channel)
|
||||
|
||||
local content = table.concat(err, "\n")
|
||||
if content:len() > 0 then
|
||||
vim.api.nvim_notify("Grip error: " .. content, vim.log.levels.ERROR, {})
|
||||
end
|
||||
end,
|
||||
on_exit = function()
|
||||
vim.fn.chanclose(grip_channel)
|
||||
grip_channel = nil
|
||||
end,
|
||||
})
|
||||
end, {})
|
||||
|
||||
vim.api.nvim_create_user_command("GripStop", function()
|
||||
if grip_channel then
|
||||
vim.fn.jobstop(grip_channel)
|
||||
end
|
||||
end, {})
|
||||
|
||||
vim.api.nvim_create_autocmd({ "QuitPre", "BufDelete" }, {
|
||||
callback = function()
|
||||
if grip_channel then
|
||||
vim.fn.jobstop(grip_channel)
|
||||
end
|
||||
end,
|
||||
})
|
||||
@@ -1,14 +0,0 @@
|
||||
require("dot013.options")
|
||||
require("dot013.tweaks")
|
||||
require("dot013.grip")
|
||||
|
||||
vim.g.lze = {
|
||||
--@type fun(name: string)
|
||||
load = vim.cmd.packadd,
|
||||
--@type boolean
|
||||
verbose = true,
|
||||
}
|
||||
|
||||
require("lze").load("dot013.plugins")
|
||||
|
||||
require("dot013.keymap")
|
||||
@@ -1,35 +0,0 @@
|
||||
vim.keymap.set("n", "<leader>d", '"_d', { desc = "Delete to void" })
|
||||
vim.keymap.set("v", "<leader>d", '"_d', { desc = "Delete to void" })
|
||||
|
||||
vim.keymap.set("n", "<leader>v", "<cmd>:vsplit<cr>", { desc = "Split the windows vertically" })
|
||||
vim.keymap.set("n", "<leader>h", "<cmd>:split<cr>", { desc = "Split the windows horizontally" })
|
||||
|
||||
vim.keymap.set("n", "s=", "z=", { desc = "Suggest spelling currection" })
|
||||
vim.keymap.set("n", "st", function()
|
||||
vim.o.spell = not vim.o.spell
|
||||
end, { desc = "Toggle spelling correction" })
|
||||
|
||||
vim.keymap.set("n", "<leader>ee", vim.diagnostic.open_float, { desc = "Open diagnostics" })
|
||||
|
||||
vim.keymap.set({ "n", "v" }, "<leader>y", '"+y', { desc = "Copy to system's clipboard" })
|
||||
vim.keymap.set({ "n", "v" }, "<leader>p", '"+p', { desc = "Paste from system's clipboard" })
|
||||
|
||||
-- ------
|
||||
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
callback = function(e)
|
||||
vim.keymap.set("n", "<leader>r", vim.lsp.buf.rename, { desc = "[LSP] Rename", buffer = e.buf })
|
||||
vim.keymap.set("n", "<leader>a", vim.lsp.buf.code_action, { desc = "[LSP] Code action", buffer = e.buf })
|
||||
|
||||
vim.keymap.set("n", "gd", vim.lsp.buf.definition, { desc = "[LSP] Go to definition", buffer = e.buf })
|
||||
vim.keymap.set("n", "gD", vim.lsp.buf.declaration, { desc = "[LSP] Go to declaration", buffer = e.buf })
|
||||
vim.keymap.set("n", "gI", vim.lsp.buf.implementation, { desc = "[LSP] Go to implementation", buffer = e.buf })
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"<leader>D",
|
||||
vim.lsp.buf.type_definition,
|
||||
{ desc = "[LSP] Go to type definition", buffer = e.buf }
|
||||
)
|
||||
end,
|
||||
group = vim.api.nvim_create_augroup("dot013_group", {}),
|
||||
})
|
||||
@@ -1,57 +0,0 @@
|
||||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = " "
|
||||
|
||||
-- vim.g.loaded_netrw = 1;
|
||||
-- vim.g.loaded_netrwPlugin = 1;
|
||||
|
||||
vim.wo.number = true
|
||||
vim.o.mouse = "a"
|
||||
|
||||
-- True colors
|
||||
vim.o.termguicolors = true
|
||||
|
||||
-- Enable filetype plugins
|
||||
vim.o.filetype = "on"
|
||||
|
||||
-- Enable spell checking by default
|
||||
vim.o.spell = true
|
||||
|
||||
-- Set relative line numbers
|
||||
vim.o.number = true
|
||||
vim.o.relativenumber = true
|
||||
vim.o.signcolumn = "number"
|
||||
|
||||
-- Set indentation
|
||||
vim.o.expandtab = false
|
||||
vim.o.tabstop = 4
|
||||
vim.o.softtabstop = 4
|
||||
vim.o.shiftwidth = 4
|
||||
-- vim.o.expandtab = 4;
|
||||
vim.o.breakindent = true
|
||||
|
||||
-- Scroll off
|
||||
vim.o.scrolloff = 10
|
||||
|
||||
-- Line length column
|
||||
vim.o.colorcolumn = "80"
|
||||
|
||||
-- Sync NeoVim and OS clipboards
|
||||
vim.o.clipboard = ""
|
||||
|
||||
-- Highlight search
|
||||
vim.o.hlsearch = false
|
||||
vim.o.incsearch = true
|
||||
|
||||
-- Save undo history
|
||||
vim.o.undofile = true
|
||||
|
||||
-- Case-insensitive search, unless \C or capital in search
|
||||
vim.o.ignorecase = true
|
||||
vim.o.smartcase = true
|
||||
|
||||
vim.wo.signcolumn = "yes"
|
||||
|
||||
vim.o.updatetime = 250
|
||||
vim.o.timeoutlen = 300
|
||||
|
||||
vim.o.completeopt = "menuone,noselect"
|
||||
@@ -1,40 +0,0 @@
|
||||
return {
|
||||
-- Frappurccino/Catppuccin theme
|
||||
{
|
||||
"catppuccin-nvim",
|
||||
priority = 1000,
|
||||
after = function()
|
||||
require("catppuccin").setup({
|
||||
flavour = "mocha",
|
||||
transparent_background = true,
|
||||
})
|
||||
vim.cmd.colorscheme("catppuccin")
|
||||
end,
|
||||
},
|
||||
|
||||
-- Status bar
|
||||
{
|
||||
"lualine.nvim",
|
||||
priority = 1000,
|
||||
after = function()
|
||||
require("lualine").setup({
|
||||
options = {
|
||||
icons_enabled = false,
|
||||
theme = "catppuccin",
|
||||
component_separators = "|",
|
||||
section_separators = "",
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
{ "nvim-web-devicons", dep_of = { "lualine.nvim" } },
|
||||
|
||||
-- Visual indentation
|
||||
{
|
||||
"indent-blankline.nvim",
|
||||
priority = 1000,
|
||||
after = function()
|
||||
require("ibl").setup()
|
||||
end,
|
||||
},
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
return {
|
||||
-- DAP Debugger support
|
||||
{
|
||||
"nvim-dap",
|
||||
dap_of = {
|
||||
"nvim-dap-ui",
|
||||
"nvim-dap-virtual-text",
|
||||
"nvim-dap-go",
|
||||
},
|
||||
keys = {
|
||||
{ "<leader>b", ":lua require('dap').toggle_breakpoint()<cr>", "[Debugger] Toggle breakpoint" },
|
||||
{ "<leader>x", ":lua require('dap').continue()<cr>", "[Debugger] Continue debugger" },
|
||||
{ "<leader>X", ":lua require('dap').terminate()<cr>", "[Debugger] Terminate debugger" },
|
||||
{ "<leader>C", ":lua require('dap').clear_breakpoints()<cr>", "[Debugger] Clear all breakpoints" },
|
||||
-- UI
|
||||
{ "<leader>xu", ":lua require('dapui').toggle()<cr>", "[Debugger] Toggle debugger UI" },
|
||||
{
|
||||
"<leader>K",
|
||||
":lua require('dapui').eval(nil, { enter = true })<cr>",
|
||||
"[Debugger] Eval var under cursor",
|
||||
},
|
||||
},
|
||||
after = function()
|
||||
local dap = require("dap")
|
||||
|
||||
local dapui = require("dapui")
|
||||
dapui.setup()
|
||||
|
||||
local dapvt = require("nvim-dap-virtual-text")
|
||||
dapvt.setup()
|
||||
|
||||
dap.listeners.before.attach.dapui_config = function()
|
||||
dapui.open()
|
||||
end
|
||||
dap.listeners.before.launch.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
|
||||
|
||||
-- Languages
|
||||
local dapgo = require("dap-go")
|
||||
dapgo.setup()
|
||||
end,
|
||||
},
|
||||
|
||||
-- Debugger UI
|
||||
{
|
||||
"nvim-dap-ui",
|
||||
dep_of = { "nvim-dap" },
|
||||
},
|
||||
{
|
||||
"nvim-nio",
|
||||
dep_of = { "nvim-dap-ui" },
|
||||
},
|
||||
|
||||
-- Debugger state hover
|
||||
{
|
||||
"nvim-dap-virtual-text",
|
||||
dep_of = { "nvim-dap" },
|
||||
},
|
||||
|
||||
-- Language specific debuggers
|
||||
{
|
||||
"nvim-dap-go",
|
||||
dep_of = { "nvim-dap" },
|
||||
},
|
||||
}
|
||||
@@ -1,113 +0,0 @@
|
||||
local function js_fmt(bufnr)
|
||||
local f = {}
|
||||
|
||||
if require("conform").get_formatter_info("prettierd", bufnr).available then
|
||||
table.insert(f, "prettierd")
|
||||
elseif require("conform").get_formatter_info("prettier", bufnr).available then
|
||||
table.insert(f, "prettier")
|
||||
end
|
||||
|
||||
if require("conform").get_formatter_info("eslint_d", bufnr).available then
|
||||
table.insert(f, "eslint_d")
|
||||
end
|
||||
|
||||
if
|
||||
require("conform").get_formatter_info("deno_fmt", bufnr).available
|
||||
and (require("dot013.utils").is_in_cwd("deno.json") or require("dot013.utils").is_in_cwd("deno.jsonc"))
|
||||
then
|
||||
table.insert(f, "deno_fmt")
|
||||
end
|
||||
|
||||
return f
|
||||
end
|
||||
|
||||
return {
|
||||
-- Formatters support
|
||||
{
|
||||
"conform.nvim",
|
||||
event = { "InsertLeave", "TextChanged" },
|
||||
after = function()
|
||||
require("conform").setup({
|
||||
formatters_by_ft = {
|
||||
-- Simple formatters
|
||||
lua = { "stylua" },
|
||||
nix = { --[[ "nixcmdfmt", ]]
|
||||
"alejandra",
|
||||
stop_after_first = true,
|
||||
},
|
||||
rust = { "rustfmt", lsp_format = "fallback" },
|
||||
sh = { "shellharden", "shfmt" },
|
||||
xml = { "xmllint", "xmltidy" },
|
||||
xhtml = { "xmllint", "xmltidy" },
|
||||
markdown = { "mdfmt" },
|
||||
|
||||
html = { "prettierd", "prettier", stop_after_first = true },
|
||||
css = { "prettierd", "prettier", stop_after_first = true },
|
||||
scss = { "prettierd", "prettier", stop_after_first = true },
|
||||
less = { "prettierd", "prettier", stop_after_first = true },
|
||||
yaml = { "prettierd", "prettier", stop_after_first = true },
|
||||
|
||||
-- Golang's formatters used by priority
|
||||
go = function(bufnr)
|
||||
local f = {}
|
||||
|
||||
if require("conform").get_formatter_info("gofumpt", bufnr).available then
|
||||
table.insert(f, "gofumpt")
|
||||
else
|
||||
table.insert(f, "gofmt")
|
||||
end
|
||||
|
||||
if require("conform").get_formatter_info("golines", bufnr).available then
|
||||
table.insert(f, "golines")
|
||||
elseif require("conform").get_formatter_info("goimports", bufnr).available then
|
||||
table.insert(f, "goimports")
|
||||
end
|
||||
|
||||
return f
|
||||
end,
|
||||
templ = { "templ" },
|
||||
|
||||
-- JavaScript's ecosystem
|
||||
javascript = js_fmt,
|
||||
javascriptreact = js_fmt,
|
||||
typescript = js_fmt,
|
||||
typescriptreact = js_fmt,
|
||||
json = function(bufnr)
|
||||
local fmts = js_fmt(bufnr)
|
||||
if fmts then
|
||||
return fmts
|
||||
end
|
||||
return { "jq" }
|
||||
end,
|
||||
|
||||
-- Fallback for any filetype
|
||||
["*"] = { "codespell" },
|
||||
["_"] = { "trim_whitespace" },
|
||||
},
|
||||
format_on_save = {
|
||||
timeout_ms = 500,
|
||||
lsp_format = "fallback",
|
||||
},
|
||||
formatters = {
|
||||
mdfmt = {
|
||||
command = "mdfmt",
|
||||
},
|
||||
xmltidy = {
|
||||
inherit = false,
|
||||
-- Uses HTML Tidy
|
||||
command = "tidy",
|
||||
args = { "-xml", "-indent", "yes", "2", "-wrap", "100", "-" },
|
||||
},
|
||||
--[[ nixcmdfmt = {
|
||||
inherit = false,
|
||||
stdin = false,
|
||||
cwd = require("conform.util").root_file({ "flake.nix" }),
|
||||
require_cwd = true,
|
||||
command = "nix",
|
||||
args = { "fmt", "$FILENAME" },
|
||||
}, ]]
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
@@ -1,233 +0,0 @@
|
||||
return {
|
||||
-- Auto saving on file save
|
||||
{
|
||||
"auto-save.nvim",
|
||||
cmd = "ASToggle",
|
||||
event = { "InsertLeave", "TextChanged" },
|
||||
after = function()
|
||||
require("auto-save").setup({
|
||||
condition = function(buf)
|
||||
if vim.bo[buf].filetype == "harpoon" then
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end,
|
||||
})
|
||||
end,
|
||||
},
|
||||
|
||||
-- Session restore, enabled automatically in git repos
|
||||
{
|
||||
"auto-session",
|
||||
lazy = not require("dot013.utils").is_in_cwd(".git"),
|
||||
cmd = {
|
||||
"SessionSave",
|
||||
"SessionRestore",
|
||||
"SessionDelete",
|
||||
"SessionDisableAutoSave",
|
||||
"SessionToggleSave",
|
||||
"SessionPurgeOrphaned",
|
||||
"SessionSearch",
|
||||
"Auutosession",
|
||||
},
|
||||
after = function()
|
||||
require("auto-session").setup()
|
||||
end,
|
||||
},
|
||||
|
||||
-- Completion
|
||||
{
|
||||
"blink-cmp",
|
||||
event = "InsertEnter",
|
||||
dep_of = { "nvim-lspconfig" },
|
||||
after = function()
|
||||
require("blink.cmp").setup({
|
||||
keymap = {
|
||||
["<C-space>"] = { "show", "show_documentation", "hide_documentation" },
|
||||
|
||||
["<Left>"] = { "hide", "fallback" },
|
||||
["<Right>"] = { "accept", "fallback" },
|
||||
["<CR>"] = { "accept", "fallback" },
|
||||
|
||||
["<Up>"] = { "select_prev", "snippet_backward", "fallback" },
|
||||
["<Down>"] = { "select_next", "snippet_forward", "fallback" },
|
||||
|
||||
["<C-Up>"] = { "scroll_documentation_up", "fallback" },
|
||||
["<C-Down>"] = { "scroll_documentation_down", "fallback" },
|
||||
},
|
||||
snippets = {
|
||||
expand = function(snippet)
|
||||
require("luasnip").lsp_expand(snippet)
|
||||
end,
|
||||
active = function(filter)
|
||||
if filter and filter.direction then
|
||||
require("luasnip").jumpable(filter.direction)
|
||||
end
|
||||
return require("luasnip").in_snippet()
|
||||
end,
|
||||
jump = function(direction)
|
||||
require("luasnip").jump(direction)
|
||||
end,
|
||||
},
|
||||
sources = {
|
||||
default = {
|
||||
"snippets",
|
||||
"lsp",
|
||||
"path",
|
||||
"buffer",
|
||||
},
|
||||
},
|
||||
completion = {
|
||||
list = {
|
||||
selection = { preselect = true, auto_insert = true },
|
||||
},
|
||||
menu = {
|
||||
draw = {
|
||||
padding = { 1, 0 },
|
||||
columns = { { "label", "label_description", gap = 1 }, { "kind_icon", "kind" } },
|
||||
components = {
|
||||
kind_icon = { width = { fill = true } },
|
||||
},
|
||||
},
|
||||
},
|
||||
documentation = {
|
||||
auto_show = true,
|
||||
},
|
||||
},
|
||||
fuzzy = { implementation = "prefer_rust" },
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
"luasnip",
|
||||
dep_of = { "blink-cmp" },
|
||||
after = function()
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
require("luasnip").setup()
|
||||
end,
|
||||
},
|
||||
{ "friendly-snippets", dep_of = { "luasnip" } },
|
||||
|
||||
-- Environment variables and secrets hidding
|
||||
{
|
||||
"cloak.nvim",
|
||||
ft = { "sh" },
|
||||
cmd = {
|
||||
"CloakDisable",
|
||||
"CloakEnable",
|
||||
"CloakToggle",
|
||||
},
|
||||
after = function()
|
||||
require("cloak").setup()
|
||||
end,
|
||||
},
|
||||
|
||||
-- Smart comments
|
||||
{
|
||||
"comment.nvim",
|
||||
after = function()
|
||||
require("Comment").setup({
|
||||
mappings = {
|
||||
basic = true,
|
||||
extra = true,
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
|
||||
-- Git integration, enabled just in git repos
|
||||
{
|
||||
"gitsigns.nvim",
|
||||
cmd = "Gitsigns",
|
||||
keys = {
|
||||
{
|
||||
"<leader>gt",
|
||||
":Gitsigns toggle_current_line_blame<cr>",
|
||||
desc = "[Git] Toggle line blame",
|
||||
},
|
||||
},
|
||||
enabled = require("dot013.utils").is_in_cwd(".git"),
|
||||
lazy = not require("dot013.utils").is_in_cwd(".git"),
|
||||
after = function()
|
||||
require("gitsigns").setup({
|
||||
signs = {
|
||||
add = { text = "+" },
|
||||
change = { text = "~" },
|
||||
delete = { text = "+" },
|
||||
topdelete = { text = "-" },
|
||||
changedelete = { text = "~" },
|
||||
},
|
||||
current_line_blame = false,
|
||||
current_line_blame_opts = {
|
||||
delay = 0,
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
|
||||
-- Auto closing pairs
|
||||
{
|
||||
"nvim-autopairs",
|
||||
event = "InsertEnter",
|
||||
after = function()
|
||||
require("nvim-autopairs").setup()
|
||||
end,
|
||||
},
|
||||
|
||||
-- Auto closing and renaming tags
|
||||
{
|
||||
"nvim-ts-autotag",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
after = function()
|
||||
require("nvim-ts-autotag").setup({
|
||||
opts = {
|
||||
enable_close = true,
|
||||
enable_rename = true,
|
||||
enable_close_on_slash = false,
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
|
||||
-- Automatic buffer options and .editorconfig support
|
||||
{
|
||||
"vim-sleuth",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
},
|
||||
|
||||
-- Tailwind integration
|
||||
{
|
||||
"tailwind-tools.nvim",
|
||||
after = function()
|
||||
-- TODO: Fork the project to remove root_dir clauses in LSP config,
|
||||
-- since Tailwind v4 doesn't use tailwind.config.js
|
||||
require("tailwind-tools").setup()
|
||||
end,
|
||||
},
|
||||
|
||||
-- Todo comments explorer
|
||||
{
|
||||
"todo-comments.nvim",
|
||||
after = function()
|
||||
require("todo-comments").setup()
|
||||
end,
|
||||
},
|
||||
|
||||
-- File explorer
|
||||
{
|
||||
-- (Probably can be replaced by local functions in the config)
|
||||
"tfm.nvim",
|
||||
enabled = vim.fn.executable("yazi"),
|
||||
cmd = { "Ex", "Tfm", "TfmSplit", "TfmVsplit", "TfmTabedit" },
|
||||
keys = {
|
||||
{ "<C-e>", ":Tfm<cr>", desc = "[TFM] Open file manager" },
|
||||
},
|
||||
after = function()
|
||||
require("tfm").setup({
|
||||
file_manager = "yazi",
|
||||
replace_netrw = true,
|
||||
enable_cmds = true,
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
return {
|
||||
{ import = "dot013.plugins.appearance" },
|
||||
{ import = "dot013.plugins.debugger" },
|
||||
{ import = "dot013.plugins.formatting" },
|
||||
{ import = "dot013.plugins.ide" },
|
||||
{ import = "dot013.plugins.integrations" },
|
||||
{ import = "dot013.plugins.lsp" },
|
||||
{ import = "dot013.plugins.navigation" },
|
||||
{ import = "dot013.plugins.treesitter" },
|
||||
|
||||
-- Global Dependencies
|
||||
{
|
||||
"plenary.nvim",
|
||||
dep_of = { "harpoon", "telescope.nvim", "todo-comments.nvim" },
|
||||
},
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
return {
|
||||
{
|
||||
"aw-watcher.nvim",
|
||||
after = function()
|
||||
require("aw_watcher").setup({})
|
||||
end,
|
||||
},
|
||||
}
|
||||
@@ -1,142 +0,0 @@
|
||||
local lsps = {
|
||||
["cssls"] = {},
|
||||
["emmet_language_server"] = {
|
||||
filetypes = require("lspconfig.configs.emmet_language_server").default_config.filetypes,
|
||||
},
|
||||
["eslint"] = {},
|
||||
["denols"] = {},
|
||||
["lemminx"] = {
|
||||
filetypes = { "xml", "xsd", "xsl", "xslt", "svg", "xhtml" },
|
||||
},
|
||||
["lua_ls"] = {
|
||||
on_init = function(client)
|
||||
if client.workspace_folders then
|
||||
local path = client.workspace_folders[1].name
|
||||
if
|
||||
path ~= vim.fn.stdpath("config") and vim.loop.fs_stat(path .. "/.luarc.json")
|
||||
or vim.loop.fs_stat(path .. "/.luarc.jsonc")
|
||||
then
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
client.config.settings.Lua = vim.tbl_deep_extend("force", client.config.settings.Lua, {
|
||||
runtime = {
|
||||
version = "LuaJIT",
|
||||
path = {
|
||||
"lua/?.lua",
|
||||
"lua/?/init.lua",
|
||||
},
|
||||
},
|
||||
workspace = {
|
||||
checkThirdParty = false,
|
||||
library = {
|
||||
vim.env.VIMRUNTIME,
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
settings = {
|
||||
Lua = {
|
||||
codeLens = { enable = true },
|
||||
hint = { enable = true, semicolin = "Disable" },
|
||||
telemetry = { enable = false },
|
||||
},
|
||||
},
|
||||
},
|
||||
["gopls"] = {},
|
||||
["golangci_lint_ls"] = function()
|
||||
if vim.fn.executable("golangci-list") == 1 then
|
||||
return {}
|
||||
else
|
||||
return nil
|
||||
end
|
||||
end,
|
||||
["html"] = {},
|
||||
["htmx"] = {},
|
||||
["jsonls"] = {},
|
||||
["nil_ls"] = {
|
||||
cmd = { "nil" },
|
||||
filetypes = { "nix" },
|
||||
single_file_support = true,
|
||||
root_dir = nil,
|
||||
},
|
||||
["marksman"] = {},
|
||||
["ts_ls"] = {},
|
||||
["rust_analyzer"] = {},
|
||||
}
|
||||
|
||||
return {
|
||||
-- Language Server Protocol (LSP) configuration
|
||||
{
|
||||
"nvim-lspconfig",
|
||||
after = function()
|
||||
local blink = require("blink.cmp")
|
||||
for server, config in pairs(lsps) do
|
||||
if type(config) == "function" then
|
||||
config = config()
|
||||
end
|
||||
|
||||
if config == nil then
|
||||
return
|
||||
end
|
||||
|
||||
-- config.capabilities = blink.get_lsp_capabilities(config.capabilities)
|
||||
|
||||
vim.lsp.enable(server)
|
||||
if next(config) ~= nil then
|
||||
vim.lsp.config(server, config)
|
||||
end
|
||||
end
|
||||
|
||||
vim.diagnostic.config({
|
||||
virtual_text = true,
|
||||
})
|
||||
end,
|
||||
},
|
||||
|
||||
-- Emmet integration
|
||||
{
|
||||
"nvim-emmet",
|
||||
ft = lsps["emmet_language_server"].filetypes,
|
||||
keys = {
|
||||
{
|
||||
"<leader>we",
|
||||
":lua require('nvim-emmet').wrap_with_abbreviation()<cr>",
|
||||
desc = "[Emmet] Wrap with emmet abbreviation",
|
||||
mode = { "n", "v" },
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- Quickfix list and diagnostics
|
||||
{
|
||||
"trouble.nvim",
|
||||
cmd = { "Trouble" },
|
||||
keys = {
|
||||
{
|
||||
"<leader>t",
|
||||
"<cmd>Trouble diagnostics toggle severity=vim.diagnostic.severity.ERROR<cr>",
|
||||
desc = "[Trouble] Buffer diagnostics",
|
||||
},
|
||||
{
|
||||
"<leader>la",
|
||||
"<cmd>Trouble lsp toggle focus=false win.position=right win.type=split<cr>",
|
||||
desc = "[Trouble] All LSP Definitions & references",
|
||||
},
|
||||
{
|
||||
"<leader>s",
|
||||
"<cmd>Trouble symbols toggle focus=false win.position=right win.type=split<cr>",
|
||||
desc = "[Trouble] Symbols",
|
||||
},
|
||||
{
|
||||
"<leader>q",
|
||||
"<cmd>Trouble qflist toggle<cr>",
|
||||
desc = "[Trouble] Quickfix list",
|
||||
},
|
||||
},
|
||||
after = function()
|
||||
require("trouble").setup()
|
||||
end,
|
||||
},
|
||||
}
|
||||
@@ -1,144 +0,0 @@
|
||||
return {
|
||||
-- File fuzzy finder
|
||||
{
|
||||
"telescope.nvim",
|
||||
cmd = {
|
||||
"Telescope",
|
||||
},
|
||||
dep_of = { "tailwind-tools.nvim" },
|
||||
keys = {
|
||||
{
|
||||
"<leader><space>",
|
||||
":lua require('telescope.builtin').buffers()<cr>",
|
||||
desc = "[Telescope] Find existing buffers",
|
||||
},
|
||||
{
|
||||
"/",
|
||||
function()
|
||||
return require("telescope.builtin").current_buffer_fuzzy_find(
|
||||
require("telescope.themes").get_dropdown({
|
||||
windblend = 10,
|
||||
previewer = false,
|
||||
})
|
||||
)
|
||||
end,
|
||||
desc = "[Telescope] Find in current buffer",
|
||||
},
|
||||
{
|
||||
"fr",
|
||||
":lua require('telescope.builtin').oldfiles()<cr>",
|
||||
desc = "[Telescope] Find recent files",
|
||||
},
|
||||
{
|
||||
"ff",
|
||||
function()
|
||||
if require("dot013.utils").is_in_cwd(".git") then
|
||||
return require("telescope.builtin").git_files()
|
||||
else
|
||||
return require("telescope.builtin").find_files()
|
||||
end
|
||||
end,
|
||||
desc = "[Telescope] Git files",
|
||||
},
|
||||
{
|
||||
"<leader>ff",
|
||||
function()
|
||||
require("telescope.builtin").find_files({ no_ignore = true, no_ignore_parent = true, hidden = true })
|
||||
end,
|
||||
desc = "[Telescope] Find files",
|
||||
},
|
||||
{ "fw", ":lua require('telescope.builtin').grep_string()<cr>", desc = "[Telescope] Find word" },
|
||||
{
|
||||
"<leader>fw",
|
||||
"<cmd>Telescope live_grep<cr>",
|
||||
desc = "[Telescope] Find word in all files",
|
||||
},
|
||||
{ "fs", ":lua require('telescope.builtin').resume()<cr>", desc = "[Telescope] Resume search" },
|
||||
{ "<leader>u", "<cmd>Telescope undo<cr>", desc = "[Telescope] Undo history" },
|
||||
},
|
||||
after = function()
|
||||
require("telescope").setup()
|
||||
require("telescope").load_extension("zf-native")
|
||||
require("telescope").load_extension("undo")
|
||||
end,
|
||||
},
|
||||
{ "telescope-zf-native.nvim", dep_of = { "telescope.nvim" } },
|
||||
{ "telescope-undo.nvim", dep_of = { "telescope.nvim" } },
|
||||
|
||||
-- File quick switching
|
||||
{
|
||||
"harpoon2",
|
||||
keys = (function()
|
||||
local h = nil
|
||||
local function harpoon()
|
||||
if h == nil then
|
||||
h = require("harpoon")
|
||||
h:setup()
|
||||
end
|
||||
return h
|
||||
end
|
||||
|
||||
return {
|
||||
{
|
||||
"<leader>w",
|
||||
function()
|
||||
harpoon():list():add()
|
||||
end,
|
||||
desc = "[Harpoon] Append to list",
|
||||
},
|
||||
{
|
||||
"<leader>e",
|
||||
function()
|
||||
harpoon().ui:toggle_quick_menu(harpoon():list())
|
||||
end,
|
||||
desc = "[Harpoon] Open quick menu",
|
||||
},
|
||||
{
|
||||
"<leader>E",
|
||||
function()
|
||||
harpoon().ui:toggle_quick_menu(harpoon():list())
|
||||
end,
|
||||
desc = "[Harpoon] Open quick edit menu",
|
||||
},
|
||||
{
|
||||
"<C-p>",
|
||||
function()
|
||||
harpoon():list():prev()
|
||||
end,
|
||||
desc = "[Harpoon] Jump to previous item",
|
||||
},
|
||||
{
|
||||
"<C-n>",
|
||||
function()
|
||||
harpoon():list():next()
|
||||
end,
|
||||
desc = "[Harpoon] Jump to next item",
|
||||
},
|
||||
}
|
||||
end)(),
|
||||
},
|
||||
|
||||
-- Visual jump marks
|
||||
{
|
||||
"marks.nvim",
|
||||
after = function()
|
||||
require("marks").setup({
|
||||
refresh_interval = 250,
|
||||
})
|
||||
end,
|
||||
},
|
||||
|
||||
-- Tmux panel jumping
|
||||
{
|
||||
"tmux.nvim",
|
||||
keys = {
|
||||
{ "<C-h>", ":lua require('tmux').move_left()<cr>", desc = "[Tmux] Move to left pane" },
|
||||
{ "<C-j>", ":lua require('tmux').move_bottom()<cr>", desc = "[Tmux] Move to bottom pane" },
|
||||
{ "<C-k>", ":lua require('tmux').move_top()<cr>", desc = "[Tmux] Move to top pane" },
|
||||
{ "<C-l>", ":lua require('tmux').move_right()<cr>", desc = "[Tmux] Move to right pane" },
|
||||
},
|
||||
after = function()
|
||||
require("tmux").setup()
|
||||
end,
|
||||
},
|
||||
}
|
||||
@@ -1,110 +0,0 @@
|
||||
return {
|
||||
-- Syntax highlight
|
||||
{
|
||||
"nvim-treesitter",
|
||||
dep_of = { "indent-blankline.nvim" },
|
||||
priority = 1000,
|
||||
after = function()
|
||||
require("nvim-treesitter.configs").setup({
|
||||
auto_install = false,
|
||||
highlight = { enable = true },
|
||||
indent = { enable = true },
|
||||
incremental_selection = {
|
||||
enable = true,
|
||||
keymaps = {
|
||||
init_selection = "<c-space>",
|
||||
node_incremental = "<c-space>",
|
||||
scope_incremental = "<c-s>",
|
||||
node_decremental = "<M-space>",
|
||||
},
|
||||
},
|
||||
textobjects = {
|
||||
select = {
|
||||
enable = true,
|
||||
lookahead = true,
|
||||
keymaps = {
|
||||
["aa"] = "@parameter.outer",
|
||||
["ia"] = "@parameter.inner",
|
||||
["af"] = "@function.outer",
|
||||
["if"] = "@function.inner",
|
||||
["ac"] = "@class.outer",
|
||||
["ic"] = "@class.inner",
|
||||
},
|
||||
},
|
||||
move = {
|
||||
enable = true,
|
||||
set_jumps = true,
|
||||
goto_next_start = {
|
||||
["]m"] = "@function.outer",
|
||||
["]]"] = "@class.outer",
|
||||
},
|
||||
goto_next_end = {
|
||||
["]M"] = "@function.outer",
|
||||
["]["] = "@class.outer",
|
||||
},
|
||||
goto_previous_start = {
|
||||
["[m"] = "@function.outer",
|
||||
["[["] = "@class.outer",
|
||||
},
|
||||
goto_previous_end = {
|
||||
["[M"] = "@function.outer",
|
||||
["[]"] = "@class.outer",
|
||||
},
|
||||
},
|
||||
},
|
||||
textsubjects = {
|
||||
enable = true,
|
||||
prev_selection = ",",
|
||||
keymaps = {
|
||||
["."] = "textsubjects-smart",
|
||||
[";"] = "textsubjects-container-outer",
|
||||
["i;"] = "textsubjects-container-inner",
|
||||
},
|
||||
},
|
||||
swap = {
|
||||
enable = true,
|
||||
swap_next = {
|
||||
["<leader>a"] = "@parameter.inner",
|
||||
},
|
||||
swap_previous = {
|
||||
["<leader>A"] = "@parameter.inner",
|
||||
},
|
||||
},
|
||||
playground = {
|
||||
enable = true,
|
||||
disable = {},
|
||||
updatetime = 25,
|
||||
persist_queries = false,
|
||||
keybindings = {
|
||||
toggle_query_editor = "o",
|
||||
toggle_hl_groups = "i",
|
||||
toggle_injected_languages = "t",
|
||||
toggle_anonymous_nodes = "a",
|
||||
toggle_language_display = "I",
|
||||
focus_language = "f",
|
||||
unfocus_language = "F",
|
||||
update = "R",
|
||||
goto_node = "<cr>",
|
||||
show_help = "?",
|
||||
},
|
||||
},
|
||||
query_linter = {
|
||||
enable = true,
|
||||
use_virtual_text = true,
|
||||
lint_events = { "BugWrite", "CursorHold" },
|
||||
},
|
||||
})
|
||||
|
||||
local LANGUAGE_ALIASES = {
|
||||
{ from = "dataviewjs", to = "javascript" },
|
||||
{ from = "js", to = "javascript" },
|
||||
{ from = "ts", to = "typescript" },
|
||||
}
|
||||
for _, v in pairs(LANGUAGE_ALIASES) do
|
||||
vim.treesitter.language.register(v.to, v.from)
|
||||
end
|
||||
end,
|
||||
},
|
||||
{ "nvim-treesitter-textobjects", dep_of = { "nvim-treesitter" } },
|
||||
{ "nvim-treesitter-textsubjects", dep_of = { "nvim-treesitter" } },
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
-- Highlight on yank
|
||||
local highlight_group = vim.api.nvim_create_augroup("YankHighlight", { clear = true })
|
||||
vim.api.nvim_create_autocmd("TextYankPost", {
|
||||
callback = function()
|
||||
vim.highlight.on_yank()
|
||||
end,
|
||||
group = highlight_group,
|
||||
pattern = "*",
|
||||
})
|
||||
|
||||
-- Move when highlighted
|
||||
vim.keymap.set("n", "J", "mzJ`z")
|
||||
|
||||
-- Make cursor stay in place when using J
|
||||
vim.keymap.set("n", "<C-d>", "<C-d>zz")
|
||||
vim.keymap.set("n", "<C-u>", "<C-u>zz")
|
||||
|
||||
-- Just to be sure
|
||||
vim.keymap.set("n", "<C-c>", "<Esc>")
|
||||
-- Don't press Q
|
||||
vim.keymap.set("n", "Q", "<nop>")
|
||||
|
||||
vim.keymap.set({ "n", "v" }, "<Space>", "<Nop>", { desc = "Nop", silent = true })
|
||||
|
||||
vim.keymap.set("n", "k", "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
|
||||
vim.keymap.set("n", "j", "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
|
||||
@@ -1,23 +0,0 @@
|
||||
local M = {}
|
||||
|
||||
M.is_in_cwd = function(name)
|
||||
local cwd = vim.fn.getcwd()
|
||||
local cwdContent = vim.split(vim.fn.glob(cwd .. "/*"), "\n", { trimempty = true })
|
||||
local hiddenCwdContent = vim.split(vim.fn.glob(cwd .. "/.*"), "\n", { trimempty = true })
|
||||
|
||||
for _, f in pairs(hiddenCwdContent) do
|
||||
table.insert(cwdContent, f)
|
||||
end
|
||||
|
||||
local fullName = cwd .. "/" .. name
|
||||
|
||||
for _, f in pairs(cwdContent) do
|
||||
if f == fullName then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -1 +1 @@
|
||||
require("dot013")
|
||||
require("dot")
|
||||
|
||||
Reference in New Issue
Block a user