Merge branch 'main' into lang/typst

This commit is contained in:
Võ Quang Chiến 2024-11-09 07:34:42 +07:00 committed by GitHub
commit c352553069
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
74 changed files with 886 additions and 1242 deletions

View file

@ -0,0 +1,90 @@
return {
{
"hrsh7th/nvim-cmp",
enabled = false,
},
{
"saghen/blink.cmp",
version = "*",
opts_extend = { "sources.completion.enabled_providers" },
dependencies = {
"rafamadriz/friendly-snippets",
-- add blink.compat to dependencies
-- { "saghen/blink.compat", opts = {} },
},
event = "InsertEnter",
---@module 'blink.cmp'
---@type blink.cmp.Config
opts = {
highlight = {
-- sets the fallback highlight groups to nvim-cmp's highlight groups
-- useful for when your theme doesn't support blink.cmp
-- will be removed in a future release, assuming themes add support
use_nvim_cmp_as_default = false,
},
-- set to 'mono' for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
-- adjusts spacing to ensure icons are aligned
nerd_font_variant = "mono",
windows = {
autocomplete = {
-- draw = "reversed",
winblend = vim.o.pumblend,
},
documentation = {
auto_show = true,
},
ghost_text = {
enabled = true,
},
},
-- experimental auto-brackets support
accept = { auto_brackets = { enabled = true } },
-- experimental signature help support
-- trigger = { signature_help = { enabled = true } }
sources = {
completion = {
-- remember to enable your providers here
enabled_providers = { "lsp", "path", "snippets", "buffer" },
},
},
keymap = {
preset = "enter",
},
},
},
-- add icons
{
"saghen/blink.cmp",
opts = function(_, opts)
opts.kind_icons = LazyVim.config.icons.kinds
end,
},
-- lazydev
{
"saghen/blink.cmp",
opts = {
sources = {
completion = {
-- add lazydev to your completion providers
enabled_providers = { "lazydev" },
},
providers = {
lsp = {
-- dont show LuaLS require statements when lazydev has items
fallback_for = { "lazydev" },
},
lazydev = {
name = "LazyDev",
module = "lazydev.integrations.blink",
},
},
},
},
},
}

View file

@ -73,7 +73,9 @@ return {
},
config = function(_, opts)
local chat = require("CopilotChat")
require("CopilotChat.integrations.cmp").setup()
if pcall(require, "cmp") then
require("CopilotChat.integrations.cmp").setup()
end
vim.api.nvim_create_autocmd("BufEnter", {
pattern = "copilot-chat",

View file

@ -80,4 +80,46 @@ return {
})
end,
},
{
"saghen/blink.cmp",
optional = true,
specs = {
{
"zbirenbaum/copilot.lua",
event = "InsertEnter",
opts = {
suggestion = {
enabled = true,
auto_trigger = true,
keymap = { accept = false },
},
},
},
},
opts = {
windows = {
ghost_text = {
enabled = false,
},
},
keymap = {
["<Tab>"] = {
function(cmp)
if cmp.is_in_snippet() then
return cmp.accept()
elseif require("copilot.suggestion").is_visible() then
LazyVim.create_undo()
require("copilot.suggestion").accept()
return true
else
return cmp.select_and_accept()
end
end,
"snippet_forward",
"fallback",
},
},
},
},
}

View file

@ -2,6 +2,7 @@ return {
-- Tabnine cmp source
{
"nvim-cmp",
optional = true,
dependencies = {
{
"tzachar/cmp-tabnine",

View file

@ -1,11 +1,17 @@
---@param config {args?:string[]|fun():string[]?}
---@param config {type?:string, args?:string[]|fun():string[]?}
local function get_args(config)
local args = type(config.args) == "function" and (config.args() or {}) or config.args or {}
local args = type(config.args) == "function" and (config.args() or {}) or config.args or {} --[[@as string[] | string ]]
local args_str = type(args) == "table" and table.concat(args, " ") or args --[[@as string]]
config = vim.deepcopy(config)
---@cast args string[]
config.args = function()
local new_args = vim.fn.input("Run with args: ", table.concat(args, " ")) --[[@as string]]
return vim.split(vim.fn.expand(new_args) --[[@as string]], " ")
local new_args = vim.fn.expand(vim.fn.input("Run with args: ", args_str)) --[[@as string]]
if config.type and config.type == "java" then
---@diagnostic disable-next-line: return-type-mismatch
return new_args
end
return require("dap.utils").splitstr(new_args)
end
return config
end
@ -30,7 +36,7 @@ return {
{ "<leader>d", "", desc = "+debug", mode = {"n", "v"} },
{ "<leader>dB", function() require("dap").set_breakpoint(vim.fn.input('Breakpoint condition: ')) end, desc = "Breakpoint Condition" },
{ "<leader>db", function() require("dap").toggle_breakpoint() end, desc = "Toggle Breakpoint" },
{ "<leader>dc", function() require("dap").continue() end, desc = "Continue" },
{ "<leader>dc", function() require("dap").continue() end, desc = "Run/Continue" },
{ "<leader>da", function() require("dap").continue({ before = get_args }) end, desc = "Run with Args" },
{ "<leader>dC", function() require("dap").run_to_cursor() end, desc = "Run to Cursor" },
{ "<leader>dg", function() require("dap").goto_() end, desc = "Go to Line (No Execute)" },
@ -69,11 +75,6 @@ return {
vscode.json_decode = function(str)
return vim.json.decode(json.json_strip_comments(str))
end
-- Extends dap.configurations with entries read from .vscode/launch.json
if vim.fn.filereadable(".vscode/launch.json") then
vscode.load_launchjs()
end
end,
},

View file

@ -120,17 +120,17 @@ return {
months,
},
typescript = {
augend.integer.alias.decimal, -- nonnegative and negative decimal number
augend.integer.alias.decimal_int, -- nonnegative and negative decimal number
augend.constant.alias.bool, -- boolean value (true <-> false)
logical_alias,
augend.constant.new({ elements = { "let", "const" } }),
},
yaml = {
augend.integer.alias.decimal, -- nonnegative and negative decimal number
augend.integer.alias.decimal_int, -- nonnegative and negative decimal number
augend.constant.alias.bool, -- boolean value (true <-> false)
},
css = {
augend.integer.alias.decimal, -- nonnegative and negative decimal number
augend.integer.alias.decimal_int, -- nonnegative and negative decimal number
augend.hexcolor.new({
case = "lower",
}),
@ -142,11 +142,11 @@ return {
augend.misc.alias.markdown_header,
},
json = {
augend.integer.alias.decimal, -- nonnegative and negative decimal number
augend.integer.alias.decimal_int, -- nonnegative and negative decimal number
augend.semver.alias.semver, -- versioning (v1.1.2)
},
lua = {
augend.integer.alias.decimal, -- nonnegative and negative decimal number
augend.integer.alias.decimal_int, -- nonnegative and negative decimal number
augend.constant.alias.bool, -- boolean value (true <-> false)
augend.constant.new({
elements = { "and", "or" },
@ -155,7 +155,7 @@ return {
}),
},
python = {
augend.integer.alias.decimal, -- nonnegative and negative decimal number
augend.integer.alias.decimal_int, -- nonnegative and negative decimal number
capitalized_boolean,
logical_alias,
},

View file

@ -15,6 +15,21 @@ return {
config = function(_, opts)
require("illuminate").configure(opts)
Snacks.toggle({
name = "Illuminate",
get = function()
return not require("illuminate.engine").is_paused()
end,
set = function(enabled)
local m = require("illuminate")
if enabled then
m.resume()
else
m.pause()
end
end,
}):map("<leader>ux")
local function map(key, dir, buffer)
vim.keymap.set("n", key, function()
require("illuminate")["goto_" .. dir .. "_reference"](false)

View file

@ -48,7 +48,7 @@ return {
local map_split = function(buf_id, lhs, direction, close_on_file)
local rhs = function()
local new_target_window
local cur_target_window = require("mini.files").get_target_window()
local cur_target_window = require("mini.files").get_explorer_state().target_window
if cur_target_window ~= nil then
vim.api.nvim_win_call(cur_target_window, function()
vim.cmd("belowright " .. direction .. " split")
@ -104,7 +104,7 @@ return {
vim.api.nvim_create_autocmd("User", {
pattern = "MiniFilesActionRename",
callback = function(event)
LazyVim.lsp.on_rename(event.data.from, event.data.to)
Snacks.rename.on_rename_file(event.data.from, event.data.to)
end,
})
end,

View file

@ -30,14 +30,7 @@ return {
optional = true,
opts = function(_, opts)
if not vim.g.trouble_lualine then
table.insert(opts.sections.lualine_c, {
function()
return require("nvim-navic").get_location()
end,
cond = function()
return package.loaded["nvim-navic"] and require("nvim-navic").is_available()
end,
})
table.insert(opts.sections.lualine_c, { "navic", color_correction = "dynamic" })
end
end,
},

View file

@ -4,8 +4,13 @@ if lazyvim_docs then
vim.g.lazyvim_picker = "telescope"
end
local have_make = vim.fn.executable("make") == 1
local have_cmake = vim.fn.executable("cmake") == 1
local build_cmd ---@type string?
for _, cmd in ipairs({ "make", "cmake", "gmake" }) do
if vim.fn.executable(cmd) == 1 then
build_cmd = cmd
break
end
end
---@type LazyPicker
local picker = {
@ -63,9 +68,9 @@ return {
dependencies = {
{
"nvim-telescope/telescope-fzf-native.nvim",
build = have_make and "make"
build = (build_cmd ~= "cmake") and "make"
or "cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build",
enabled = have_make or have_cmake,
enabled = build_cmd ~= nil,
config = function(plugin)
LazyVim.on_load("telescope.nvim", function()
local ok, err = pcall(require("telescope").load_extension, "fzf")
@ -94,7 +99,11 @@ return {
{ "<leader>:", "<cmd>Telescope command_history<cr>", desc = "Command History" },
{ "<leader><space>", LazyVim.pick("files"), desc = "Find Files (Root Dir)" },
-- find
{ "<leader>fb", "<cmd>Telescope buffers sort_mru=true sort_lastused=true<cr>", desc = "Buffers" },
{
"<leader>fb",
"<cmd>Telescope buffers sort_mru=true sort_lastused=true ignore_current_buffer=true<cr>",
desc = "Buffers",
},
{ "<leader>fc", LazyVim.pick.config_files(), desc = "Find Config File" },
{ "<leader>ff", LazyVim.pick("files"), desc = "Find Files (Root Dir)" },
{ "<leader>fF", LazyVim.pick("files", { root = false }), desc = "Find Files (cwd)" },

View file

@ -70,7 +70,8 @@ return {
opts = function(_, opts)
opts.formatters_by_ft = opts.formatters_by_ft or {}
for _, ft in ipairs(supported) do
opts.formatters_by_ft[ft] = { "prettier" }
opts.formatters_by_ft[ft] = opts.formatters_by_ft[ft] or {}
table.insert(opts.formatters_by_ft[ft], "prettier")
end
opts.formatters = opts.formatters or {}

View file

@ -57,4 +57,15 @@ return {
})
end,
},
-- formatting
{
"conform.nvim",
opts = function(_, opts)
if LazyVim.has_extra("formatting.prettier") then
opts.formatters_by_ft = opts.formatters_by_ft or {}
opts.formatters_by_ft.htmlangular = { "prettier" }
end
end,
},
}

View file

@ -17,7 +17,7 @@ return {
{
"nvim-treesitter/nvim-treesitter",
opts = { ensure_installed = { "astro" } },
opts = { ensure_installed = { "astro", "css" } },
},
-- LSP Servers

View file

@ -1,7 +1,7 @@
return {
recommended = function()
return LazyVim.extras.wants({
ft = { "elixir", "eelixir", "heex", "surface" },
ft = { "elixir", "eelixir", "heex", "surface", "livebook" },
root = "mix.exs",
})
end,
@ -40,7 +40,11 @@ return {
},
{
"nvim-treesitter/nvim-treesitter",
opts = { ensure_installed = { "elixir", "heex", "eex" } },
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "elixir", "heex", "eex" })
vim.treesitter.language.register("markdown", "livebook")
end,
},
{
"nvim-neotest/neotest",
@ -85,4 +89,11 @@ return {
}
end,
},
{
"MeanderingProgrammer/render-markdown.nvim",
optional = true,
ft = function(_, ft)
vim.list_extend(ft, { "livebook" })
end,
},
}

View file

@ -1,4 +1,4 @@
-- This is the same as in lspconfig.server_configurations.jdtls, but avoids
-- This is the same as in lspconfig.configs.jdtls, but avoids
-- needing to require that when this module loads.
local java_filetypes = { "java" }
@ -76,7 +76,7 @@ return {
return {
-- How to find the root dir for a given filename. The default comes from
-- lspconfig which provides a function specifically for java projects.
root_dir = require("lspconfig.server_configurations.jdtls").default_config.root_dir,
root_dir = LazyVim.lsp.get_raw_config("jdtls").default_config.root_dir,
-- How to find the project name for a given root dir.
project_name = function(root_dir)

View file

@ -17,7 +17,7 @@ return {
--
-- false to disable, otherwise should be a table of options to pass to `leanls`
--
-- See https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#leanls for details.
-- See https://github.com/neovim/nvim-lspconfig/blob/master/doc/configs.md#leanls for details.
-- In particular ensure you have followed instructions setting up a callback
-- for `LspAttach` which sets your key bindings!
lsp = {

View file

@ -95,7 +95,6 @@ return {
{
"MeanderingProgrammer/render-markdown.nvim",
opts = {
file_types = { "markdown", "norg", "rmd", "org" },
code = {
sign = false,
width = "block",
@ -109,7 +108,7 @@ return {
ft = { "markdown", "norg", "rmd", "org" },
config = function(_, opts)
require("render-markdown").setup(opts)
LazyVim.toggle.map("<leader>um", {
Snacks.toggle({
name = "Render Markdown",
get = function()
return require("render-markdown.state").enabled
@ -122,7 +121,7 @@ return {
m.disable()
end
end,
})
}):map("<leader>um")
end,
},
}

View file

@ -12,23 +12,6 @@ return {
},
{
"nvim-treesitter/nvim-treesitter",
dependencies = {
{ "nushell/tree-sitter-nu" },
},
opts = function(_, opts)
---@diagnostic disable-next-line: inject-field
require("nvim-treesitter.parsers").get_parser_configs().nu = {
install_info = {
url = "https://github.com/nushell/tree-sitter-nu",
files = { "src/parser.c" },
branch = "main",
},
filetype = "nu",
}
if type(opts.ensure_installed) == "table" then
vim.list_extend(opts.ensure_installed, { "nu" })
end
end,
opts = { ensure_installed = { "nu" } },
},
}

View file

@ -18,9 +18,14 @@ return {
opts = {
servers = {
ocamllsp = {
get_language_id = function(_, ftype)
return language_id_of[ftype]
end,
filetypes = {
"ocaml",
"ocaml.menhir",
"ocaml.interface",
"ocaml.ocamllex",
"reason",
"dune",
},
root_dir = function(fname)
return require("lspconfig.util").root_pattern(
"*.opam",

View file

@ -52,8 +52,10 @@ return {
keys = {
{
"gd",
function()
LazyVim.has("telescope.nvim") and function()
require("omnisharp_extended").telescope_lsp_definitions()
end or function()
require("omnisharp_extended").lsp_definitions()
end,
desc = "Goto Definition",
},

View file

@ -133,6 +133,7 @@ return {
{
"hrsh7th/nvim-cmp",
optional = true,
opts = function(_, opts)
opts.auto_brackets = opts.auto_brackets or {}
table.insert(opts.auto_brackets, "python")

View file

@ -22,6 +22,7 @@ return {
local wk = require("which-key")
wk.add({
buffer = true,
mode = { "n", "v" },
{ "<localleader>a", group = "all" },
{ "<localleader>b", group = "between marks" },
{ "<localleader>c", group = "chunks" },

View file

@ -0,0 +1,20 @@
return {
recommended = {
ft = "rego",
},
{
"neovim/nvim-lspconfig",
opts = {
servers = {
regols = {},
regal = {},
},
},
},
{
"nvim-treesitter/nvim-treesitter",
opts = {
ensure_installed = { "rego" },
},
},
}

View file

@ -36,7 +36,10 @@ return {
enabled = lsp == "solargraph",
},
rubocop = {
enabled = formatter == "rubocop",
-- If Solargraph and Rubocop are both enabled as an LSP,
-- diagnostics will be duplicated because Solargraph
-- already calls Rubocop if it is installed
enabled = formatter == "rubocop" and lsp ~= "solargraph",
},
standardrb = {
enabled = formatter == "standardrb",
@ -64,7 +67,7 @@ return {
opts = {
formatters_by_ft = {
ruby = { formatter },
eruby = { "erb-format" },
eruby = { "erb_format" },
},
},
},

View file

@ -6,25 +6,23 @@ return {
})
end,
-- Extend auto completion
-- LSP for Cargo.toml
{
"hrsh7th/nvim-cmp",
dependencies = {
{
"Saecki/crates.nvim",
event = { "BufRead Cargo.toml" },
opts = {
completion = {
cmp = { enabled = true },
},
"Saecki/crates.nvim",
event = { "BufRead Cargo.toml" },
opts = {
completion = {
crates = {
enabled = true,
},
},
lsp = {
enabled = true,
actions = true,
completion = true,
hover = true,
},
},
---@param opts cmp.ConfigSchema
opts = function(_, opts)
opts.sources = opts.sources or {}
table.insert(opts.sources, { name = "crates" })
end,
},
-- Add Rust & related to treesitter
@ -42,7 +40,7 @@ return {
{
"mrcjkb/rustaceanvim",
version = "^4", -- Recommended
version = vim.fn.has("nvim-0.10.0") == 0 and "^4" or false,
ft = { "rust" },
opts = {
server = {
@ -94,21 +92,7 @@ return {
"neovim/nvim-lspconfig",
opts = {
servers = {
taplo = {
keys = {
{
"K",
function()
if vim.fn.expand("%:t") == "Cargo.toml" and require("crates").popup_available() then
require("crates").show_popup()
else
vim.lsp.buf.hover()
end
end,
desc = "Show Crate Documentation",
},
},
},
rust_analyzer = { enabled = false },
},
},
},

View file

@ -34,6 +34,13 @@ return {
end,
desc = "Metals compile cascade",
},
{
"<leader>mh",
function()
require("metals").hover_worksheet()
end,
desc = "Metals hover worksheet",
},
},
init_options = {
statusBarProvider = "off",

View file

@ -28,7 +28,7 @@ return {
},
setup = {
tailwindcss = function(_, opts)
local tw = require("lspconfig.server_configurations.tailwindcss")
local tw = LazyVim.lsp.get_raw_config("tailwindcss")
opts.filetypes = opts.filetypes or {}
-- Add default filetypes
@ -59,6 +59,7 @@ return {
},
{
"hrsh7th/nvim-cmp",
optional = true,
dependencies = {
{ "roobert/tailwindcss-colorizer-cmp.nvim", opts = {} },
},

View file

@ -29,6 +29,7 @@ return {
opts = function(_, opts)
local null_ls = require("null-ls")
opts.sources = vim.list_extend(opts.sources or {}, {
null_ls.builtins.formatting.packer,
null_ls.builtins.formatting.terraform_fmt,
null_ls.builtins.diagnostics.terraform_validate,
})
@ -49,6 +50,7 @@ return {
optional = true,
opts = {
formatters_by_ft = {
hcl = { "packer_fmt" },
terraform = { "terraform_fmt" },
tf = { "terraform_fmt" },
["terraform-vars"] = { "terraform_fmt" },
@ -58,9 +60,10 @@ return {
{
"nvim-telescope/telescope.nvim",
optional = true,
dependencies = {
specs = {
{
"ANGkeith/telescope-terraform-doc.nvim",
ft = { "terraform", "hcl" },
config = function()
LazyVim.on_load("telescope.nvim", function()
require("telescope").load_extension("terraform_doc")
@ -69,6 +72,7 @@ return {
},
{
"cappyzawa/telescope-terraform.nvim",
ft = { "terraform", "hcl" },
config = function()
LazyVim.on_load("telescope.nvim", function()
require("telescope").load_extension("terraform")

View file

@ -30,7 +30,7 @@ return {
vim.g.vimtex_quickfix_method = vim.fn.executable("pplatex") == 1 and "pplatex" or "latexlog"
end,
keys = {
{ "<localLeader>l", "", desc = "+vimtext" },
{ "<localLeader>l", "", desc = "+vimtex" },
},
},

View file

@ -19,9 +19,14 @@ return {
opts = {
-- make sure mason installs the server
servers = {
--- @deprecated -- tsserver renamed to ts_ls but not yet released, so keep this for now
--- the proper approach is to check the nvim-lspconfig release version when it's released to determine the server name dynamically
tsserver = {
enabled = false,
},
ts_ls = {
enabled = false,
},
vtsls = {
-- explicitly add default filetypes, so that we can extend
-- them in related extras
@ -114,10 +119,16 @@ return {
},
},
setup = {
--- @deprecated -- tsserver renamed to ts_ls but not yet released, so keep this for now
--- the proper approach is to check the nvim-lspconfig release version when it's released to determine the server name dynamically
tsserver = function()
-- disable tsserver
return true
end,
ts_ls = function()
-- disable tsserver
return true
end,
vtsls = function(_, opts)
LazyVim.lsp.on_attach(function(client, buffer)
client.commands["_typescript.moveToFileRefactoring"] = function(command, ctx)

View file

@ -11,7 +11,7 @@ return {
{
"nvim-treesitter/nvim-treesitter",
opts = { ensure_installed = { "vue" } },
opts = { ensure_installed = { "vue", "css" } },
},
-- Add LSP servers

View file

@ -0,0 +1,32 @@
return {
recommended = function()
return LazyVim.extras.wants({
ft = { "zig", "zir" },
root = { "zls.json", "build.zig" },
})
end,
{
"nvim-treesitter/nvim-treesitter",
opts = { ensure_installed = { "zig" } },
},
{
"neovim/nvim-lspconfig",
opts = {
servers = {
zls = {},
},
},
},
{
"nvim-neotest/neotest",
optional = true,
dependencies = {
"lawrence-laz/neotest-zig",
},
opts = {
adapters = {
["neotest-zig"] = {},
},
},
},
}

View file

@ -1,3 +1,10 @@
if lazyvim_docs then
-- Set to false to disable auto format
vim.g.lazyvim_eslint_auto_format = true
end
local auto_format = vim.g.lazyvim_eslint_auto_format == nil or vim.g.lazyvim_eslint_auto_format
return {
{
"neovim/nvim-lspconfig",
@ -9,11 +16,16 @@ return {
settings = {
-- helps eslint find the eslintrc when it's placed in a subfolder instead of the cwd root
workingDirectories = { mode = "auto" },
format = auto_format,
},
},
},
setup = {
eslint = function()
if not auto_format then
return
end
local function get_client(buf)
return LazyVim.lsp.get_clients({ name = "eslint", bufnr = buf })[1]
end

View file

@ -90,7 +90,7 @@ return {
adapter.adapter(config)
adapter = adapter.adapter
elseif meta and meta.__call then
adapter(config)
adapter = adapter(config)
else
error("Adapter " .. name .. " does not support setup")
end
@ -106,15 +106,15 @@ return {
-- stylua: ignore
keys = {
{"<leader>t", "", desc = "+test"},
{ "<leader>tt", function() require("neotest").run.run(vim.fn.expand("%")) end, desc = "Run File" },
{ "<leader>tT", function() require("neotest").run.run(vim.uv.cwd()) end, desc = "Run All Test Files" },
{ "<leader>tr", function() require("neotest").run.run() end, desc = "Run Nearest" },
{ "<leader>tl", function() require("neotest").run.run_last() end, desc = "Run Last" },
{ "<leader>ts", function() require("neotest").summary.toggle() end, desc = "Toggle Summary" },
{ "<leader>to", function() require("neotest").output.open({ enter = true, auto_close = true }) end, desc = "Show Output" },
{ "<leader>tO", function() require("neotest").output_panel.toggle() end, desc = "Toggle Output Panel" },
{ "<leader>tS", function() require("neotest").run.stop() end, desc = "Stop" },
{ "<leader>tw", function() require("neotest").watch.toggle(vim.fn.expand("%")) end, desc = "Toggle Watch" },
{ "<leader>tt", function() require("neotest").run.run(vim.fn.expand("%")) end, desc = "Run File (Neotest)" },
{ "<leader>tT", function() require("neotest").run.run(vim.uv.cwd()) end, desc = "Run All Test Files (Neotest)" },
{ "<leader>tr", function() require("neotest").run.run() end, desc = "Run Nearest (Neotest)" },
{ "<leader>tl", function() require("neotest").run.run_last() end, desc = "Run Last (Neotest)" },
{ "<leader>ts", function() require("neotest").summary.toggle() end, desc = "Toggle Summary (Neotest)" },
{ "<leader>to", function() require("neotest").output.open({ enter = true, auto_close = true }) end, desc = "Show Output (Neotest)" },
{ "<leader>tO", function() require("neotest").output_panel.toggle() end, desc = "Toggle Output Panel (Neotest)" },
{ "<leader>tS", function() require("neotest").run.stop() end, desc = "Stop (Neotest)" },
{ "<leader>tw", function() require("neotest").watch.toggle(vim.fn.expand("%")) end, desc = "Toggle Watch (Neotest)" },
},
},
{

View file

@ -31,14 +31,6 @@ return {
return vim.api.nvim_win_get_config(win).relative == ""
end,
},
{
ft = "lazyterm",
title = "LazyTerm",
size = { height = 0.4 },
filter = function(buf)
return not vim.b[buf].lazyterm_cmd
end,
},
"Trouble",
{ ft = "qf", title = "QuickFix" },
{
@ -103,6 +95,7 @@ return {
end
end
-- trouble
for _, pos in ipairs({ "top", "bottom", "left", "right" }) do
opts[pos] = opts[pos] or {}
table.insert(opts[pos], {
@ -116,6 +109,22 @@ return {
end,
})
end
-- snacks terminal
for _, pos in ipairs({ "top", "bottom", "left", "right" }) do
opts[pos] = opts[pos] or {}
table.insert(opts[pos], {
ft = "snacks_terminal",
size = { height = 0.4 },
title = "%{b:snacks_terminal.id}: %{b:term_title}",
filter = function(_buf, win)
return vim.w[win].snacks_win
and vim.w[win].snacks_win.position == pos
and vim.w[win].snacks_win.relative == "editor"
and not vim.w[win].trouble_preview
end,
})
end
return opts
end,
},

View file

@ -21,7 +21,7 @@ return {
end,
})
LazyVim.toggle.map("<leader>ua", {
Snacks.toggle({
name = "Mini Animate",
get = function()
return not vim.g.minianimate_disable
@ -29,7 +29,7 @@ return {
set = function(state)
vim.g.minianimate_disable = not state
end,
})
}):map("<leader>ua")
local animate = require("mini.animate")
return {

View file

@ -14,17 +14,19 @@ return {
init = function()
vim.api.nvim_create_autocmd("FileType", {
pattern = {
"Trouble",
"alpha",
"dashboard",
"fzf",
"help",
"lazy",
"lazyterm",
"mason",
"neo-tree",
"notify",
"snacks_notif",
"snacks_terminal",
"snacks_win",
"toggleterm",
"Trouble",
"trouble",
},
callback = function()

View file

@ -4,8 +4,7 @@ return {
event = "VeryLazy",
opts = function()
local tsc = require("treesitter-context")
LazyVim.toggle.map("<leader>ut", {
Snacks.toggle({
name = "Treesitter Context",
get = tsc.enabled,
set = function(state)
@ -15,8 +14,7 @@ return {
tsc.disable()
end
end,
})
}):map("<leader>ut")
return { mode = "cursor", max_lines = 3 }
end,
}

View file

@ -8,14 +8,14 @@ return {
{
"<leader>gG",
function()
LazyVim.terminal.open({ "gitui" }, { esc_esc = false, ctrl_hjkl = false })
Snacks.terminal({ "gitui" })
end,
desc = "GitUi (cwd)",
},
{
"<leader>gg",
function()
LazyVim.terminal.open({ "gitui" }, { cwd = LazyVim.root.get(), esc_esc = false, ctrl_hjkl = false })
Snacks.terminal({ "gitui" }, { cwd = LazyVim.root.get() })
end,
desc = "GitUi (Root Dir)",
},

View file

@ -91,6 +91,15 @@ return {
event = "VeryLazy",
config = function(_, opts)
require("project_nvim").setup(opts)
local history = require("project_nvim.utils.history")
history.delete_project = function(project)
for k, v in pairs(history.recent_projects) do
if v == project.value then
history.recent_projects[k] = nil
return
end
end
end
LazyVim.on_load("telescope.nvim", function()
require("telescope").load_extension("projects")
end)

View file

@ -8,11 +8,11 @@ return {
"mistweaverco/kulala.nvim",
ft = "http",
keys = {
{ "<leader>R", "", desc = "+Rest" },
{ "<leader>Rs", "<cmd>lua require('kulala').run()<cr>", desc = "Send the request" },
{ "<leader>Rt", "<cmd>lua require('kulala').toggle_view()<cr>", desc = "Toggle headers/body" },
{ "<leader>Rp", "<cmd>lua require('kulala').jump_prev()<cr>", desc = "Jump to previous request" },
{ "<leader>Rn", "<cmd>lua require('kulala').jump_next()<cr>", desc = "Jump to next request" },
{ "<leader>R", "", desc = "+Rest", ft = "http" },
{ "<leader>Rs", "<cmd>lua require('kulala').run()<cr>", desc = "Send the request", ft = "http" },
{ "<leader>Rt", "<cmd>lua require('kulala').toggle_view()<cr>", desc = "Toggle headers/body", ft = "http" },
{ "<leader>Rp", "<cmd>lua require('kulala').jump_prev()<cr>", desc = "Jump to previous request", ft = "http" },
{ "<leader>Rn", "<cmd>lua require('kulala').jump_next()<cr>", desc = "Jump to next request", ft = "http" },
},
opts = {},
},

View file

@ -33,11 +33,15 @@ vim.api.nvim_create_autocmd("User", {
pattern = "LazyVimKeymapsDefaults",
callback = function()
vim.keymap.set("n", "<leader><space>", "<cmd>Find<cr>")
vim.keymap.set("n", "<leader>/", [[<cmd>call VSCodeNotify('workbench.action.findInFiles')<cr>]])
vim.keymap.set("n", "<leader>ss", [[<cmd>call VSCodeNotify('workbench.action.gotoSymbol')<cr>]])
vim.keymap.set("n", "<leader>/", [[<cmd>lua require('vscode').action('workbench.action.findInFiles')<cr>]])
vim.keymap.set("n", "<leader>ss", [[<cmd>lua require('vscode').action('workbench.action.gotoSymbol')<cr>]])
end,
})
function LazyVim.terminal()
require("vscode").action("workbench.action.terminal.toggleTerminal")
end
return {
{
"LazyVim/LazyVim",