update:nvim11->12 config
This commit is contained in:
15
nvim/lua/plugins/ai.lua
Normal file
15
nvim/lua/plugins/ai.lua
Normal file
@@ -0,0 +1,15 @@
|
||||
local M = {}
|
||||
|
||||
local pack = require("utils.pack")
|
||||
|
||||
function M.setup()
|
||||
vim.api.nvim_create_autocmd("InsertEnter", {
|
||||
once = true,
|
||||
callback = function()
|
||||
pack.add({ "supermaven-nvim" })
|
||||
require("supermaven-nvim").setup({})
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
||||
20
nvim/lua/plugins/autotag.lua
Normal file
20
nvim/lua/plugins/autotag.lua
Normal file
@@ -0,0 +1,20 @@
|
||||
local M = {}
|
||||
|
||||
local pack = require("utils.pack")
|
||||
|
||||
function M.setup()
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = { "html", "xml", "javascriptreact", "typescriptreact", "astro", "templ" },
|
||||
once = true,
|
||||
callback = function()
|
||||
pack.add({ "nvim-ts-autotag" })
|
||||
require("nvim-ts-autotag").setup({
|
||||
aliases = {
|
||||
astro = "html",
|
||||
},
|
||||
})
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
||||
65
nvim/lua/plugins/catppuccin.lua
Normal file
65
nvim/lua/plugins/catppuccin.lua
Normal file
@@ -0,0 +1,65 @@
|
||||
local M = {}
|
||||
|
||||
local ui = require("utils.ui")
|
||||
local pack = require("utils.pack")
|
||||
|
||||
local function apply_theme_overrides()
|
||||
local transparent_groups = {
|
||||
"NormalFloat",
|
||||
"FloatBorder",
|
||||
"TelescopeNormal",
|
||||
"TelescopeBorder",
|
||||
"TelescopePromptNormal",
|
||||
"TelescopePromptBorder",
|
||||
"TelescopeResultsNormal",
|
||||
"TelescopeResultsBorder",
|
||||
"TelescopePreviewNormal",
|
||||
"TelescopePreviewBorder",
|
||||
}
|
||||
for _, g in ipairs(transparent_groups) do
|
||||
vim.api.nvim_set_hl(0, g, { bg = "none" })
|
||||
end
|
||||
|
||||
for _, group in ipairs(vim.fn.getcompletion("", "highlight")) do
|
||||
local ok, hl = pcall(vim.api.nvim_get_hl, 0, { name = group })
|
||||
if ok and hl and hl.italic then
|
||||
hl.italic = nil
|
||||
vim.api.nvim_set_hl(0, group, hl)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function M.setup()
|
||||
pack.add({ "catppuccin", "nvim-web-devicons" })
|
||||
|
||||
local theme_group = vim.api.nvim_create_augroup("UserThemeTweaks", { clear = true })
|
||||
vim.api.nvim_create_autocmd("ColorScheme", {
|
||||
group = theme_group,
|
||||
callback = apply_theme_overrides,
|
||||
})
|
||||
|
||||
require("catppuccin").setup({
|
||||
flavour = "macchiato",
|
||||
transparent_background = true,
|
||||
compile_path = vim.fn.stdpath("cache") .. "/catppuccin",
|
||||
integrations = {
|
||||
cmp = true,
|
||||
treesitter = true,
|
||||
},
|
||||
telescope = {
|
||||
enabled = true,
|
||||
},
|
||||
})
|
||||
|
||||
vim.cmd.colorscheme("catppuccin")
|
||||
apply_theme_overrides()
|
||||
|
||||
local orig = vim.lsp.util.open_floating_preview
|
||||
vim.lsp.util.open_floating_preview = function(contents, syntax, opts, ...)
|
||||
opts = opts or {}
|
||||
opts.border = opts.border or ui.border("FloatBorder")
|
||||
return orig(contents, syntax, opts, ...)
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
65
nvim/lua/plugins/cmp.lua
Normal file
65
nvim/lua/plugins/cmp.lua
Normal file
@@ -0,0 +1,65 @@
|
||||
local M = {}
|
||||
|
||||
local ui = require("utils.ui")
|
||||
local pack = require("utils.pack")
|
||||
|
||||
function M.setup()
|
||||
pack.add({ "nvim-cmp", "cmp-nvim-lsp", "cmp-buffer", "cmp-path", "luasnip", "cmp_luasnip" })
|
||||
|
||||
local cmp = require("cmp")
|
||||
local luasnip = require("luasnip")
|
||||
|
||||
cmp.setup({
|
||||
window = {
|
||||
completion = {
|
||||
border = ui.border("CmpBorder"),
|
||||
winhighlight = "Normal:CmpPmenu,CursorLine:PmenuSel,Search:None",
|
||||
},
|
||||
documentation = {
|
||||
border = ui.border("CmpDocBorder"),
|
||||
},
|
||||
},
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<CR>"] = cmp.mapping.confirm({ select = true }),
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif luasnip.expand_or_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" },
|
||||
{ name = "path" },
|
||||
{
|
||||
name = "buffer",
|
||||
option = {
|
||||
keyword_length = 4,
|
||||
get_bufnrs = function()
|
||||
return { vim.api.nvim_get_current_buf() }
|
||||
end,
|
||||
},
|
||||
},
|
||||
}),
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
||||
162
nvim/lua/plugins/lsp.lua
Normal file
162
nvim/lua/plugins/lsp.lua
Normal file
@@ -0,0 +1,162 @@
|
||||
local M = {}
|
||||
|
||||
local pack = require("utils.pack")
|
||||
|
||||
local tools = {
|
||||
{ kind = "lsp", lsp = "lua_ls", mason = "lua-language-server" },
|
||||
{ kind = "lsp", lsp = "bashls", mason = "bash-language-server" },
|
||||
{ kind = "lsp", lsp = "astro", mason = "astro-language-server" },
|
||||
{ kind = "lsp", lsp = "tailwindcss", mason = "tailwindcss-language-server" },
|
||||
{ kind = "lsp", lsp = "ts_ls", mason = "typescript-language-server" },
|
||||
{ kind = "lsp", lsp = "html", mason = "html-lsp" },
|
||||
{ kind = "lsp", lsp = "pyright", mason = "pyright" },
|
||||
{ kind = "lsp", lsp = "templ", mason = "templ" },
|
||||
{ kind = "lsp", lsp = "gopls", mason = "gopls" },
|
||||
{ kind = "lsp", lsp = "emmet_ls", mason = "emmet-language-server" },
|
||||
{ kind = "lsp", lsp = "rust_analyzer", mason = "rust-analyzer" },
|
||||
{ kind = "formatter", mason = "stylua", ft = { "lua" } },
|
||||
{ kind = "formatter", mason = "shfmt", ft = { "sh", "bash" } },
|
||||
{ kind = "formatter", mason = "isort", ft = { "python" } },
|
||||
{ kind = "formatter", mason = "black", ft = { "python" } },
|
||||
{ kind = "formatter", mason = "prettierd", ft = { "javascript", "typescript", "astro", "html", "css", "json", "jsonc" } },
|
||||
}
|
||||
|
||||
function M.setup()
|
||||
pack.add({ "mason", "nvim-lspconfig", "conform" })
|
||||
|
||||
require("mason").setup()
|
||||
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
pcall(function()
|
||||
capabilities = require("cmp_nvim_lsp").default_capabilities(capabilities)
|
||||
end)
|
||||
vim.lsp.config("*", { capabilities = capabilities })
|
||||
|
||||
vim.lsp.config("tailwindcss", {
|
||||
settings = {
|
||||
tailwindCSS = {
|
||||
experimental = {
|
||||
classRegex = {
|
||||
"Css = (\\{[^\\{\\}]+\\}|\\[[^\\[\\]]+\\]|'[^']+'|\"[^\"]+\")",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
filetypes = { "htmldjango", "templ", "html", "css", "javascript", "typescript", "jsx", "tsx" },
|
||||
})
|
||||
vim.lsp.config("html", { filetypes = { "html", "htmldjango", "templ" } })
|
||||
vim.lsp.config("lua_ls", {
|
||||
settings = {
|
||||
Lua = {
|
||||
diagnostics = { globals = { "vim" } },
|
||||
telemetry = { enable = false },
|
||||
workspace = { checkThirdParty = false },
|
||||
hint = { enable = true },
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
local lsp_names = {}
|
||||
for _, t in ipairs(tools) do
|
||||
if t.kind == "lsp" then
|
||||
table.insert(lsp_names, t.lsp)
|
||||
end
|
||||
end
|
||||
vim.lsp.enable(lsp_names)
|
||||
|
||||
require("conform").setup({
|
||||
formatters_by_ft = {
|
||||
lua = { "stylua" },
|
||||
sh = { "shfmt" },
|
||||
bash = { "shfmt" },
|
||||
python = { "isort", "black" },
|
||||
javascript = { "prettierd" },
|
||||
typescript = { "prettierd" },
|
||||
astro = { "prettierd" },
|
||||
html = { "prettierd" },
|
||||
css = { "prettierd" },
|
||||
json = { "prettierd" },
|
||||
jsonc = { "prettierd" },
|
||||
},
|
||||
})
|
||||
|
||||
vim.keymap.set("n", "<leader>F", function()
|
||||
require("conform").format({ async = true, lsp_fallback = true })
|
||||
end, { desc = "Format buffer" })
|
||||
|
||||
vim.api.nvim_create_user_command("MasonInstallDefaults", function()
|
||||
local registry = require("mason-registry")
|
||||
registry.refresh(function()
|
||||
local seen, to_install = {}, {}
|
||||
for _, t in ipairs(tools) do
|
||||
if t.mason and not seen[t.mason] then
|
||||
seen[t.mason] = true
|
||||
local ok, pkg = pcall(registry.get_package, t.mason)
|
||||
if ok and not pkg:is_installed() then
|
||||
table.insert(to_install, pkg)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if #to_install == 0 then
|
||||
vim.notify("MasonInstallDefaults: all tools already installed", vim.log.levels.INFO)
|
||||
return
|
||||
end
|
||||
for _, pkg in ipairs(to_install) do
|
||||
pkg:install()
|
||||
end
|
||||
vim.notify(("MasonInstallDefaults: installing %d tool(s)"):format(#to_install), vim.log.levels.INFO)
|
||||
end)
|
||||
end, { desc = "Install missing Mason tools from `tools` table" })
|
||||
|
||||
vim.diagnostic.config({ virtual_text = false })
|
||||
|
||||
local lsp_group = vim.api.nvim_create_augroup("UserLspAttach", { clear = true })
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
group = lsp_group,
|
||||
callback = function(ev)
|
||||
local bufnr = ev.buf
|
||||
local client = vim.lsp.get_client_by_id(ev.data.client_id)
|
||||
if not client then
|
||||
return
|
||||
end
|
||||
|
||||
if client:supports_method("textDocument/completion") then
|
||||
vim.bo[bufnr].omnifunc = "v:lua.vim.lsp.omnifunc"
|
||||
end
|
||||
if client:supports_method("textDocument/definition") then
|
||||
vim.bo[bufnr].tagfunc = "v:lua.vim.lsp.tagfunc"
|
||||
end
|
||||
|
||||
local map = function(mode, lhs, rhs, desc)
|
||||
vim.keymap.set(mode, lhs, rhs, {
|
||||
buffer = bufnr,
|
||||
silent = true,
|
||||
noremap = true,
|
||||
desc = desc,
|
||||
})
|
||||
end
|
||||
|
||||
map("n", "gD", vim.lsp.buf.declaration, "LSP declaration")
|
||||
map("n", "K", vim.lsp.buf.hover, "LSP hover")
|
||||
map("n", "gi", vim.lsp.buf.implementation, "LSP implementation")
|
||||
map("n", "<C-k>", vim.lsp.buf.signature_help, "LSP signature help")
|
||||
map("n", "<leader>wa", vim.lsp.buf.add_workspace_folder, "LSP add workspace folder")
|
||||
map("n", "<leader>wr", vim.lsp.buf.remove_workspace_folder, "LSP remove workspace folder")
|
||||
map("n", "<leader>wl", function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
end, "LSP list workspace folders")
|
||||
map("n", "<leader>D", vim.lsp.buf.type_definition, "LSP type definition")
|
||||
map("n", "<leader>rn", vim.lsp.buf.rename, "LSP rename")
|
||||
map({ "n", "v" }, "<leader>ca", vim.lsp.buf.code_action, "LSP code action")
|
||||
map("n", "gd", function()
|
||||
require("plugins.telescope").lsp_definitions()
|
||||
end, "LSP definitions (Telescope)")
|
||||
map("n", "gr", function()
|
||||
require("plugins.telescope").lsp_references()
|
||||
end, "LSP references (Telescope)")
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
||||
41
nvim/lua/plugins/mini.lua
Normal file
41
nvim/lua/plugins/mini.lua
Normal file
@@ -0,0 +1,41 @@
|
||||
local M = {}
|
||||
|
||||
local pack = require("utils.pack")
|
||||
|
||||
function M.setup()
|
||||
pack.add({ "mini.nvim" })
|
||||
|
||||
require("mini.comment").setup({
|
||||
options = {
|
||||
custom_commentstring = function()
|
||||
local ft = vim.bo.filetype
|
||||
if ft == "typescriptreact" then
|
||||
return "{/* %s */}"
|
||||
end
|
||||
if ft == "htmldjango" then
|
||||
return "{# %s #}"
|
||||
end
|
||||
if ft == "templ" then
|
||||
return "// %s"
|
||||
end
|
||||
return nil
|
||||
end,
|
||||
},
|
||||
})
|
||||
|
||||
vim.keymap.set("n", "<leader>cc", function()
|
||||
require("mini.comment").toggle_lines(vim.fn.line("."), vim.fn.line("."))
|
||||
end, { desc = "Toggle comment line" })
|
||||
|
||||
vim.keymap.set("v", "<leader>cc", function()
|
||||
local s, e = vim.fn.line("v"), vim.fn.line(".")
|
||||
if s > e then
|
||||
s, e = e, s
|
||||
end
|
||||
require("mini.comment").toggle_lines(s, e)
|
||||
end, { desc = "Toggle comment selection" })
|
||||
|
||||
require("mini.pairs").setup()
|
||||
end
|
||||
|
||||
return M
|
||||
56
nvim/lua/plugins/registry.lua
Normal file
56
nvim/lua/plugins/registry.lua
Normal file
@@ -0,0 +1,56 @@
|
||||
local M = {}
|
||||
|
||||
M.map = {
|
||||
catppuccin = { name = "catppuccin", src = "https://github.com/catppuccin/nvim" },
|
||||
["nvim-web-devicons"] = { name = "nvim-web-devicons", src = "https://github.com/nvim-tree/nvim-web-devicons" },
|
||||
mason = { name = "mason", src = "https://github.com/mason-org/mason.nvim" },
|
||||
["nvim-lspconfig"] = { name = "nvim-lspconfig", src = "https://github.com/neovim/nvim-lspconfig" },
|
||||
conform = { name = "conform", src = "https://github.com/stevearc/conform.nvim" },
|
||||
["nvim-cmp"] = { name = "nvim-cmp", src = "https://github.com/hrsh7th/nvim-cmp" },
|
||||
["cmp-nvim-lsp"] = { name = "cmp-nvim-lsp", src = "https://github.com/hrsh7th/cmp-nvim-lsp" },
|
||||
["cmp-buffer"] = { name = "cmp-buffer", src = "https://github.com/hrsh7th/cmp-buffer" },
|
||||
["cmp-path"] = { name = "cmp-path", src = "https://github.com/hrsh7th/cmp-path" },
|
||||
luasnip = { name = "luasnip", src = "https://github.com/L3MON4D3/LuaSnip" },
|
||||
cmp_luasnip = { name = "cmp_luasnip", src = "https://github.com/saadparwaiz1/cmp_luasnip" },
|
||||
["nvim-treesitter"] = { name = "nvim-treesitter", src = "https://github.com/nvim-treesitter/nvim-treesitter" },
|
||||
["mini.nvim"] = { name = "mini.nvim", src = "https://github.com/echasnovski/mini.nvim" },
|
||||
["indent-blankline.nvim"] = {
|
||||
name = "indent-blankline.nvim",
|
||||
src = "https://github.com/lukas-reineke/indent-blankline.nvim",
|
||||
},
|
||||
["lualine.nvim"] = { name = "lualine.nvim", src = "https://github.com/nvim-lualine/lualine.nvim" },
|
||||
["bufferline.nvim"] = { name = "bufferline.nvim", src = "https://github.com/akinsho/bufferline.nvim" },
|
||||
["plenary.nvim"] = { name = "plenary.nvim", src = "https://github.com/nvim-lua/plenary.nvim" },
|
||||
["telescope.nvim"] = { name = "telescope.nvim", src = "https://github.com/nvim-telescope/telescope.nvim" },
|
||||
["trouble.nvim"] = { name = "trouble.nvim", src = "https://github.com/folke/trouble.nvim" },
|
||||
["grug-far.nvim"] = { name = "grug-far.nvim", src = "https://github.com/MagicDuck/grug-far.nvim" },
|
||||
["nvim-ts-autotag"] = { name = "nvim-ts-autotag", src = "https://github.com/windwp/nvim-ts-autotag" },
|
||||
["supermaven-nvim"] = { name = "supermaven-nvim", src = "https://github.com/supermaven-inc/supermaven-nvim" },
|
||||
}
|
||||
|
||||
function M.by_names(names)
|
||||
local out = {}
|
||||
for _, name in ipairs(names) do
|
||||
local spec = M.map[name]
|
||||
if not spec then
|
||||
error("Unknown plugin spec: " .. tostring(name))
|
||||
end
|
||||
table.insert(out, spec)
|
||||
end
|
||||
return out
|
||||
end
|
||||
|
||||
function M.names()
|
||||
local keys = {}
|
||||
for name, _ in pairs(M.map) do
|
||||
table.insert(keys, name)
|
||||
end
|
||||
table.sort(keys)
|
||||
return keys
|
||||
end
|
||||
|
||||
function M.all()
|
||||
return M.by_names(M.names())
|
||||
end
|
||||
|
||||
return M
|
||||
70
nvim/lua/plugins/telescope.lua
Normal file
70
nvim/lua/plugins/telescope.lua
Normal file
@@ -0,0 +1,70 @@
|
||||
local M = {}
|
||||
|
||||
local lazy = require("utils.lazy")
|
||||
local pack = require("utils.pack")
|
||||
|
||||
local function with_telescope(fn)
|
||||
lazy.load_once("telescope", pack.registry({ "plenary.nvim", "telescope.nvim" }), function()
|
||||
require("telescope").setup({
|
||||
defaults = { file_ignore_patterns = { "%.git/" } },
|
||||
pickers = {
|
||||
find_files = {
|
||||
find_command = { "rg", "--files", "--hidden", "--glob", "!**/.git/*" },
|
||||
},
|
||||
live_grep = {
|
||||
additional_args = function()
|
||||
return { "--glob", "!**/.git/*", "--glob", "!**/go.sum", "--glob", "!**/go.mod" }
|
||||
end,
|
||||
},
|
||||
lsp_definitions = {
|
||||
show_line = false,
|
||||
theme = "dropdown",
|
||||
file_ignore_patterns = { ".*_templ.go" },
|
||||
},
|
||||
lsp_references = {
|
||||
show_line = false,
|
||||
include_declaration = false,
|
||||
theme = "dropdown",
|
||||
file_ignore_patterns = { ".*_templ.go" },
|
||||
},
|
||||
},
|
||||
})
|
||||
end)
|
||||
fn(require("telescope.builtin"))
|
||||
end
|
||||
|
||||
function M.lsp_definitions()
|
||||
with_telescope(function(builtin)
|
||||
builtin.lsp_definitions()
|
||||
end)
|
||||
end
|
||||
|
||||
function M.lsp_references()
|
||||
with_telescope(function(builtin)
|
||||
builtin.lsp_references()
|
||||
end)
|
||||
end
|
||||
|
||||
function M.setup_keymaps()
|
||||
vim.keymap.set("n", "<leader>f", function()
|
||||
with_telescope(function(builtin)
|
||||
builtin.find_files()
|
||||
end)
|
||||
end, { desc = "Find files" })
|
||||
|
||||
vim.keymap.set("n", "<leader>fg", function()
|
||||
with_telescope(function(builtin)
|
||||
builtin.live_grep()
|
||||
end)
|
||||
end, { desc = "Live grep" })
|
||||
|
||||
vim.keymap.set("n", "<C-f>", function()
|
||||
with_telescope(function(builtin)
|
||||
if not pcall(builtin.git_files, { show_untracked = true }) then
|
||||
vim.notify("Not a git project. Try running git init in root.", vim.log.levels.WARN)
|
||||
end
|
||||
end)
|
||||
end, { desc = "Git files" })
|
||||
end
|
||||
|
||||
return M
|
||||
58
nvim/lua/plugins/tools.lua
Normal file
58
nvim/lua/plugins/tools.lua
Normal file
@@ -0,0 +1,58 @@
|
||||
local M = {}
|
||||
|
||||
local lazy = require("utils.lazy")
|
||||
local pack = require("utils.pack")
|
||||
|
||||
local function with_trouble(fn)
|
||||
lazy.load_once("trouble", pack.registry({ "trouble.nvim" }), function()
|
||||
require("trouble").setup({})
|
||||
end)
|
||||
fn()
|
||||
end
|
||||
|
||||
local function with_grug(fn)
|
||||
lazy.load_once("grug-far", pack.registry({ "grug-far.nvim" }), function()
|
||||
require("grug-far").setup({})
|
||||
end)
|
||||
fn(require("grug-far"))
|
||||
end
|
||||
|
||||
function M.setup()
|
||||
vim.keymap.set("n", "<leader>xx", function()
|
||||
with_trouble(function()
|
||||
vim.cmd("Trouble diagnostics toggle")
|
||||
end)
|
||||
end, { desc = "Diagnostics (Trouble)" })
|
||||
|
||||
vim.keymap.set("n", "<leader>xX", function()
|
||||
with_trouble(function()
|
||||
vim.cmd("Trouble diagnostics toggle filter.buf=0")
|
||||
end)
|
||||
end, { desc = "Buffer diagnostics" })
|
||||
|
||||
vim.keymap.set("n", "<leader>xQ", function()
|
||||
with_trouble(function()
|
||||
vim.cmd("Trouble qflist toggle")
|
||||
end)
|
||||
end, { desc = "Quickfix list" })
|
||||
|
||||
vim.keymap.set("n", "<leader>S", function()
|
||||
with_grug(function()
|
||||
vim.cmd("GrugFar")
|
||||
end)
|
||||
end, { desc = "Search/replace project" })
|
||||
|
||||
vim.keymap.set("n", "<leader>s", function()
|
||||
with_grug(function(grug)
|
||||
grug.open({ prefills = { paths = vim.fn.expand("%") } })
|
||||
end)
|
||||
end, { desc = "Search/replace current file" })
|
||||
|
||||
vim.keymap.set("v", "<leader>s", function()
|
||||
with_grug(function()
|
||||
vim.cmd("'<,'>GrugFarWithin")
|
||||
end)
|
||||
end, { desc = "Search/replace in selection" })
|
||||
end
|
||||
|
||||
return M
|
||||
50
nvim/lua/plugins/treesitter.lua
Normal file
50
nvim/lua/plugins/treesitter.lua
Normal file
@@ -0,0 +1,50 @@
|
||||
local M = {}
|
||||
|
||||
local pack = require("utils.pack")
|
||||
|
||||
function M.setup()
|
||||
pack.add({ "nvim-treesitter" })
|
||||
|
||||
require("nvim-treesitter").setup({
|
||||
install_dir = vim.fn.stdpath("data") .. "/site",
|
||||
})
|
||||
|
||||
require("nvim-treesitter").install({
|
||||
"lua",
|
||||
"vim",
|
||||
"python",
|
||||
"bash",
|
||||
"javascript",
|
||||
"typescript",
|
||||
"html",
|
||||
"css",
|
||||
"json",
|
||||
"toml",
|
||||
"go",
|
||||
"astro",
|
||||
"templ",
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = {
|
||||
"lua",
|
||||
"vim",
|
||||
"python",
|
||||
"bash",
|
||||
"javascript",
|
||||
"typescript",
|
||||
"html",
|
||||
"css",
|
||||
"json",
|
||||
"toml",
|
||||
"go",
|
||||
"astro",
|
||||
"templ",
|
||||
},
|
||||
callback = function(args)
|
||||
pcall(vim.treesitter.start, args.buf)
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
||||
22
nvim/lua/plugins/ui.lua
Normal file
22
nvim/lua/plugins/ui.lua
Normal file
@@ -0,0 +1,22 @@
|
||||
local M = {}
|
||||
|
||||
local pack = require("utils.pack")
|
||||
|
||||
function M.setup()
|
||||
pack.add({ "indent-blankline.nvim", "lualine.nvim", "bufferline.nvim" })
|
||||
|
||||
require("ibl").setup({
|
||||
indent = { char = "▏" },
|
||||
scope = { enabled = false },
|
||||
})
|
||||
|
||||
require("lualine").setup()
|
||||
require("bufferline").setup({
|
||||
options = { mode = "tabs", separator_style = "thin" },
|
||||
})
|
||||
|
||||
vim.keymap.set("n", "<Tab>", "<Cmd>BufferLineCycleNext<CR>", {})
|
||||
vim.keymap.set("n", "<S-Tab>", "<Cmd>BufferLineCyclePrev<CR>", {})
|
||||
end
|
||||
|
||||
return M
|
||||
Reference in New Issue
Block a user