feat: enhance editor and language support with new plugins and configurations
This commit is contained in:
7 files changed
+315
-151
No files matched your search
+44
-11
@@ -156,15 +156,48 @@ return {
|
||||
end,
|
||||
},
|
||||
|
||||
-- multiple cursor
|
||||
-- {
|
||||
-- "terryma/vim-multiple-cursors",
|
||||
-- config = function()
|
||||
-- vim.g.multi_cursor_use_default_mapping = 0
|
||||
-- vim.g.multi_cursor_next_key = "<A-n>"
|
||||
-- vim.g.multi_cursor_prev_key = "<A-p>"
|
||||
-- vim.g.multi_cursor_skip_key = "<A-x>"
|
||||
-- vim.g.multi_cursor_quit_key = "<leader>mc"
|
||||
-- end,
|
||||
-- },
|
||||
-- code action
|
||||
{
|
||||
"rachartier/tiny-code-action.nvim",
|
||||
dependencies = {
|
||||
{
|
||||
"folke/snacks.nvim",
|
||||
opts = {
|
||||
terminal = {},
|
||||
},
|
||||
},
|
||||
},
|
||||
event = "LspAttach",
|
||||
config = function()
|
||||
local codeaction = require("tiny-code-action")
|
||||
|
||||
codeaction.setup({
|
||||
picker = {
|
||||
"buffer",
|
||||
opts = {
|
||||
auto_preview = true,
|
||||
hotkeys = true,
|
||||
hotkeys_mode = "sequential",
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
vim.keymap.set("n", "<leader>.", codeaction.code_action)
|
||||
end,
|
||||
},
|
||||
|
||||
-- visual multi
|
||||
{
|
||||
"mg979/vim-visual-multi",
|
||||
event = "VeryLazy",
|
||||
init = function()
|
||||
vim.g.VM_maps = {
|
||||
["Find Under"] = "<M-d>",
|
||||
["Find Subword Under"] = "<M-d>",
|
||||
["Select All"] = "<C-M-d>",
|
||||
["Add Cursor Down"] = "<C-M-j>",
|
||||
["Add Cursor Up"] = "<C-M-k>",
|
||||
}
|
||||
end,
|
||||
},
|
||||
}
|
||||
+32
-3
@@ -6,11 +6,38 @@ return {
|
||||
keys = { "<leader>tf" },
|
||||
config = function()
|
||||
require("conform").setup({
|
||||
formatters = {
|
||||
["markdown-toc"] = {
|
||||
condition = function(_, ctx)
|
||||
for _, line in ipairs(vim.api.nvim_buf_get_lines(ctx.buf, 0, -1, false)) do
|
||||
if line:find("<!%-%-% toc %-%->") then
|
||||
return true
|
||||
end
|
||||
end
|
||||
end,
|
||||
},
|
||||
["markdownlint-cli2"] = {
|
||||
condition = function(_, ctx)
|
||||
local diag = vim.tbl_filter(function(d)
|
||||
return d.source == "markdownlint"
|
||||
end, vim.diagnostic.get(ctx.buf))
|
||||
return #diag > 0
|
||||
end,
|
||||
},
|
||||
},
|
||||
formatters_by_ft = {
|
||||
lua = { "stylua" },
|
||||
python = { "black" },
|
||||
["lua"] = { "stylua" },
|
||||
["python"] = { "ruff_fix", "ruff_format", "ruff_organize_imports" },
|
||||
["javascript"] = { "prettier" },
|
||||
["typescript"] = { "prettier" },
|
||||
["markdown"] = { "prettier", "markdownlint-cli2", "markdown-toc" },
|
||||
["markdown.mdx"] = { "prettier", "markdownlint-cli2", "markdown-toc" },
|
||||
["mdx"] = { "prettier" },
|
||||
["_"] = { "trim_whitespace" },
|
||||
},
|
||||
options = {
|
||||
stop_after_first = true,
|
||||
},
|
||||
format_after_save = function(bufnr)
|
||||
if not vim.b[bufnr].conform_disable then
|
||||
return {
|
||||
@@ -27,9 +54,11 @@ return {
|
||||
end)
|
||||
require("mason-conform").setup({
|
||||
ensure_installed = {
|
||||
"black",
|
||||
"ruff",
|
||||
"stylua",
|
||||
"prettier",
|
||||
"markdown-toc",
|
||||
"markdownlint-cli2",
|
||||
},
|
||||
automatic_installation = true,
|
||||
})
|
||||
|
||||
+121
-108
@@ -1,116 +1,129 @@
|
||||
return {
|
||||
-- treesitter
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
build = ":TSUpdate",
|
||||
event = { "BufReadPost", "BufNewFile" },
|
||||
config = function()
|
||||
require("nvim-treesitter").setup({
|
||||
ensure_installed = {
|
||||
"c",
|
||||
"markdown",
|
||||
"python",
|
||||
"java",
|
||||
"cpp",
|
||||
"bash",
|
||||
"lua",
|
||||
"make",
|
||||
"latex",
|
||||
"json",
|
||||
"jsonc",
|
||||
"sql",
|
||||
"yaml",
|
||||
"toml",
|
||||
"javascript",
|
||||
"ts_ls",
|
||||
"gitignore",
|
||||
"go",
|
||||
"rust",
|
||||
"html",
|
||||
"css",
|
||||
"scss",
|
||||
"markdown_inline",
|
||||
},
|
||||
auto_install = true,
|
||||
highlight = {
|
||||
enable = true,
|
||||
additional_vim_regex_highlighting = true,
|
||||
},
|
||||
indent = {
|
||||
enable = true,
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
-- treesitter
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
build = ":TSUpdate",
|
||||
event = { "BufReadPost", "BufNewFile" },
|
||||
config = function()
|
||||
require("nvim-treesitter").setup({
|
||||
ensure_installed = {
|
||||
"c",
|
||||
"markdown",
|
||||
"python",
|
||||
"java",
|
||||
"cpp",
|
||||
"bash",
|
||||
"lua",
|
||||
"make",
|
||||
"latex",
|
||||
"json",
|
||||
"jsonc",
|
||||
"sql",
|
||||
"yaml",
|
||||
"toml",
|
||||
"javascript",
|
||||
"ts_ls",
|
||||
"gitignore",
|
||||
"go",
|
||||
"rust",
|
||||
"html",
|
||||
"css",
|
||||
"scss",
|
||||
"markdown_inline",
|
||||
},
|
||||
auto_install = true,
|
||||
highlight = {
|
||||
enable = true,
|
||||
additional_vim_regex_highlighting = true,
|
||||
},
|
||||
indent = {
|
||||
enable = true,
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
|
||||
-- rendering for html, latex, md
|
||||
{
|
||||
"OXY2DEV/markview.nvim",
|
||||
lazy = false,
|
||||
-- to load before treesitter
|
||||
priority = 45,
|
||||
config = function()
|
||||
require("markview").setup({
|
||||
markdown = {
|
||||
code_blocks = { sign = false },
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
-- rendering for html, latex, md
|
||||
{
|
||||
"OXY2DEV/markview.nvim",
|
||||
lazy = false,
|
||||
-- to load before treesitter
|
||||
priority = 45,
|
||||
config = function()
|
||||
require("markview").setup({
|
||||
markdown = {
|
||||
code_blocks = { sign = false },
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
|
||||
-- markdown preview
|
||||
{
|
||||
"iamcco/markdown-preview.nvim",
|
||||
build = "cd app && yarn install",
|
||||
init = function()
|
||||
vim.g.mkdp_filetypes = { "markdown" }
|
||||
end,
|
||||
ft = "markdown",
|
||||
cmd = { "MarkdownPreviewToggle", "MarkdownPreview" },
|
||||
},
|
||||
-- markdown preview
|
||||
{
|
||||
"iamcco/markdown-preview.nvim",
|
||||
build = "cd app && yarn install",
|
||||
init = function()
|
||||
vim.g.mkdp_filetypes = { "markdown" }
|
||||
end,
|
||||
ft = "markdown",
|
||||
cmd = { "MarkdownPreviewToggle", "MarkdownPreview" },
|
||||
},
|
||||
|
||||
{
|
||||
"danymat/neogen",
|
||||
dependencies = { "nvim-treesitter/nvim-treesitter" },
|
||||
opts = {
|
||||
snippet_engine = "luasnip",
|
||||
languages = {
|
||||
python = {
|
||||
template = {
|
||||
annotation_convention = "google_docstrings",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"danymat/neogen",
|
||||
dependencies = { "nvim-treesitter/nvim-treesitter" },
|
||||
opts = {
|
||||
snippet_engine = "luasnip",
|
||||
languages = {
|
||||
python = {
|
||||
template = {
|
||||
annotation_convention = "google_docstrings",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- auto pairs
|
||||
{
|
||||
"windwp/nvim-autopairs",
|
||||
event = "InsertEnter",
|
||||
config = function()
|
||||
require("nvim-autopairs").setup()
|
||||
-- auto pairs
|
||||
{
|
||||
"windwp/nvim-autopairs",
|
||||
event = "InsertEnter",
|
||||
config = function()
|
||||
require("nvim-autopairs").setup()
|
||||
|
||||
-- add new rules
|
||||
local pairs = require("nvim-autopairs")
|
||||
local rule = require("nvim-autopairs.rule")
|
||||
local cond = require("nvim-autopairs.conds")
|
||||
pairs.add_rules({
|
||||
rule("$", "$", { "tex", "latex", "plaintex" })
|
||||
-- do not move right when repeat character
|
||||
:with_move(cond.none()),
|
||||
})
|
||||
end,
|
||||
},
|
||||
-- add new rules
|
||||
local pairs = require("nvim-autopairs")
|
||||
local rule = require("nvim-autopairs.rule")
|
||||
local cond = require("nvim-autopairs.conds")
|
||||
pairs.add_rules({
|
||||
rule("$", "$", { "tex", "latex", "plaintex" })
|
||||
-- do not move right when repeat character
|
||||
:with_move(cond.none()),
|
||||
})
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"windwp/nvim-ts-autotag",
|
||||
event = "InsertEnter",
|
||||
lazy = true,
|
||||
opts = {
|
||||
enable_close = true,
|
||||
enable_rename = true,
|
||||
enable_close_on_slash = true,
|
||||
},
|
||||
},
|
||||
{
|
||||
"windwp/nvim-ts-autotag",
|
||||
ft = {
|
||||
"html",
|
||||
"xml",
|
||||
"javascript",
|
||||
"typescript",
|
||||
"javascriptreact",
|
||||
"typescriptreact",
|
||||
"jsx",
|
||||
"tsx",
|
||||
"vue",
|
||||
"svelte",
|
||||
"markdown",
|
||||
},
|
||||
event = "InsertEnter",
|
||||
lazy = true,
|
||||
opts = {
|
||||
enable_close = true,
|
||||
enable_rename = true,
|
||||
enable_close_on_slash = true,
|
||||
},
|
||||
},
|
||||
}
|
||||
+23
-11
@@ -2,18 +2,29 @@ return {
|
||||
"mfussenegger/nvim-lint",
|
||||
dependencies = { "rshkarin/mason-nvim-lint" },
|
||||
event = { "BufReadPost", "BufNewFile" },
|
||||
keys = {
|
||||
{
|
||||
"<leader>L",
|
||||
mode = { "n" },
|
||||
function()
|
||||
require("lint").try_lint()
|
||||
end,
|
||||
desc = "Trigger linting for current file",
|
||||
},
|
||||
},
|
||||
config = function()
|
||||
require("lint").linters_by_ft = {
|
||||
javascript = { "eslint_d" },
|
||||
typescript = { "eslint_d" },
|
||||
javascriptreact = { "eslint_d" },
|
||||
typescriptreact = { "eslint_d" },
|
||||
dockerfile = { "hadolint" },
|
||||
markdown = { "write_good", "markdownlint" },
|
||||
text = { "write_good" },
|
||||
sh = { "shellcheck" },
|
||||
yaml = { "actionlint" },
|
||||
python = { "ruff" },
|
||||
["*"] = { "codespell" },
|
||||
["javascript"] = { "eslint_d", "cspell" },
|
||||
["typescript"] = { "eslint_d", "cspell" },
|
||||
["javascriptreact"] = { "eslint_d", "cspell" },
|
||||
["typescriptreact"] = { "eslint_d", "cspell" },
|
||||
["dockerfile"] = { "hadolint" },
|
||||
["markdown"] = { "write_good", "markdownlint" },
|
||||
["text"] = { "write_good" },
|
||||
["sh"] = { "shellcheck" },
|
||||
["yaml"] = { "actionlint" },
|
||||
["python"] = { "ruff" },
|
||||
}
|
||||
require("mason-nvim-lint").setup({
|
||||
ensure_installed = {
|
||||
@@ -25,7 +36,8 @@ return {
|
||||
"actionlint",
|
||||
"djlint",
|
||||
"ruff",
|
||||
"pylint",
|
||||
"codespell",
|
||||
"cspell",
|
||||
},
|
||||
automatic_installation = true,
|
||||
})
|
||||
|
||||
+62
-18
@@ -80,7 +80,7 @@ return {
|
||||
{
|
||||
"akinsho/toggleterm.nvim",
|
||||
cmd = { "ToggleTerm" },
|
||||
version = "v2.*",
|
||||
version = "*",
|
||||
config = function()
|
||||
require("toggleterm").setup({
|
||||
size = 10,
|
||||
@@ -107,6 +107,20 @@ return {
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
"nvzone/floaterm",
|
||||
dependencies = "nvzone/volt",
|
||||
opts = {
|
||||
mappings = {
|
||||
term = function(buf)
|
||||
vim.keymap.set({ "n", "t" }, "<Tab>", function()
|
||||
require("floaterm.api").cycle_term_bufs("prev")
|
||||
end, { buffer = buf })
|
||||
end,
|
||||
},
|
||||
},
|
||||
cmd = "FloatermToggle",
|
||||
},
|
||||
|
||||
-- smooth scrolling
|
||||
{
|
||||
@@ -120,23 +134,6 @@ return {
|
||||
-- event = "VeryLazy",
|
||||
-- },
|
||||
|
||||
{
|
||||
"rachartier/tiny-code-action.nvim",
|
||||
dependencies = {
|
||||
{
|
||||
"folke/snacks.nvim",
|
||||
opts = {
|
||||
terminal = {},
|
||||
},
|
||||
},
|
||||
},
|
||||
event = "LspAttach",
|
||||
opts = {},
|
||||
vim.keymap.set({ "n", "x" }, "<leader>ca", function()
|
||||
require("tiny-code-action").code_action()
|
||||
end, { noremap = true, silent = true }),
|
||||
},
|
||||
|
||||
-- uv
|
||||
{
|
||||
"benomahony/uv.nvim",
|
||||
@@ -160,10 +157,57 @@ return {
|
||||
},
|
||||
},
|
||||
|
||||
-- Project management
|
||||
{
|
||||
"ahmedkhalf/project.nvim",
|
||||
config = function()
|
||||
require("project_nvim").setup({
|
||||
detection_methods = { "lsp", "pattern" },
|
||||
patterns = { ".git", "_darcs", ".hg", ".bzr", ".svn", "Makefile", "package.json" },
|
||||
})
|
||||
end,
|
||||
},
|
||||
|
||||
{ "wakatime/vim-wakatime", event = "VimEnter", lazy = false },
|
||||
|
||||
-- {
|
||||
-- "m4xshen/hardtime.nvim",
|
||||
-- lazy = false,
|
||||
-- opts = {},
|
||||
-- },
|
||||
|
||||
-- file operations
|
||||
{
|
||||
"chrisgrieser/nvim-genghis",
|
||||
keys = {
|
||||
{
|
||||
"<leader>fp",
|
||||
function()
|
||||
require("genghis").createNewFile()
|
||||
end,
|
||||
desc = "New File",
|
||||
},
|
||||
{
|
||||
"<leader>fd",
|
||||
function()
|
||||
require("genghis").duplicateFile()
|
||||
end,
|
||||
desc = "Duplicate File",
|
||||
},
|
||||
{
|
||||
"<leader>fr",
|
||||
function()
|
||||
require("genghis").renameFile()
|
||||
end,
|
||||
desc = "Rename File",
|
||||
},
|
||||
{
|
||||
"<leader>fx",
|
||||
function()
|
||||
require("genghis").chmodx()
|
||||
end,
|
||||
desc = "Make Executable",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -79,6 +79,20 @@ return {
|
||||
{ "<leader>fx", ":%bd|e#|bd#<cr>", desc = "Close except current" },
|
||||
{ "<leader>ff", ":lua require('snacks').picker.files()", desc = "Find Files" },
|
||||
{ "<leader>fg", ":lua require('snacks').picker.live_grep()", desc = "Live Grep" },
|
||||
{
|
||||
"<leader>fp",
|
||||
function()
|
||||
Snacks.picker.projects()
|
||||
end,
|
||||
desc = "Projects",
|
||||
},
|
||||
{
|
||||
"<leader>ft",
|
||||
function()
|
||||
Snacks.picker.todo_comments()
|
||||
end,
|
||||
desc = "Search Todos",
|
||||
},
|
||||
|
||||
{ "<leader>g", group = " Git" },
|
||||
{ "<leader>gA", ":Gitsigns stage_buffer<cr>", desc = "Stage Buffer" },
|
||||
@@ -91,7 +105,21 @@ return {
|
||||
{ "<leader>gi", ":Gitsigns preview_hunk<cr>", desc = "Hunk Info" },
|
||||
{ "<leader>gj", ":Gitsigns next_hunk<cr>", desc = "Next Hunk" },
|
||||
{ "<leader>gk", ":Gitsigns prev_hunk<cr>", desc = "Prev Hunk" },
|
||||
{
|
||||
"<leader>gl",
|
||||
function()
|
||||
Snacks.picker.git_log()
|
||||
end,
|
||||
desc = "Checkout commit",
|
||||
},
|
||||
{ "<leader>gr", ":Gitsigns reset_hunk<cr>", desc = "Reset Hunk" },
|
||||
{
|
||||
"<leader>gs",
|
||||
function()
|
||||
Snacks.picker.git_status()
|
||||
end,
|
||||
desc = "Open changed file",
|
||||
},
|
||||
{ "<leader>gu", ":Gitsigns undo_stage_hunk<cr>", desc = "Undo Stage Hunk" },
|
||||
{ "<leader>gv", ":Gitsigns select_hunk<cr>", desc = "Select Hunk" },
|
||||
{ "<leader>gw", ':lua require("snacks").gitbrowse()<cr>', desc = "Git Browse" },
|
||||
|
||||
Reference in new issue
Block a user