recoding process pipline
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
-- Some commands that I want to execute in specific timing
|
||||
vim.api.nvim_create_augroup("disable_comment_newline", { clear = true })
|
||||
vim.api.nvim_create_augroup("auto_wrap", { clear = true })
|
||||
vim.api.nvim_create_augroup("disable_suspend_with_c_z", { clear = true })
|
||||
vim.api.nvim_create_augroup("clear_last_search", { clear = true })
|
||||
|
||||
vim.keymap.set("v", "K", "<Nop>", { silent = true })
|
||||
|
||||
-- NOTE: Set colors for hightlights for similar words
|
||||
-- vim.api.nvim_set_hl(0, "LspReferenceRead", { fg = "#FF0000" })
|
||||
-- vim.api.nvim_set_hl(0, "LspReferenceWrite", { fg = "#FF0000" })
|
||||
-- vim.api.nvim_set_hl(0, "LspReferenceText", { fg = "#FF0000" })
|
||||
|
||||
vim.api.nvim_create_autocmd("BufEnter", {
|
||||
desc = "Disable auto insert comment newline",
|
||||
group = "disable_comment_newline",
|
||||
command = "set formatoptions-=cro",
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
desc = "Enable wrap and spell for text like documents",
|
||||
group = "auto_wrap",
|
||||
pattern = { "gitcommit", "markdown", "text", "plaintext" },
|
||||
callback = function()
|
||||
vim.opt_local.wrap = true
|
||||
vim.opt_local.spell = true
|
||||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("BufEnter", {
|
||||
desc = "Remap <C-z> to nothing so that it doesn't suspend terminal",
|
||||
group = "disable_suspend_with_c_z",
|
||||
command = "nnoremap <c-z> <nop>",
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("BufWinEnter", {
|
||||
desc = "Clear last search pattern",
|
||||
group = "clear_last_search",
|
||||
pattern = "*",
|
||||
command = "let @/ = ''",
|
||||
})
|
||||
|
||||
@@ -175,7 +175,6 @@ return {
|
||||
client.server_capabilities.workspaceSymbolProvider = false
|
||||
client.server_capabilities.monikerProvider = false
|
||||
client.server_capabilities.semanticTokensProvider = false
|
||||
|
||||
-- Tắt thêm các capabilities khác có thể có
|
||||
client.server_capabilities.referencesProvider = false
|
||||
client.server_capabilities.implementationProvider = false
|
||||
@@ -187,7 +186,6 @@ return {
|
||||
workspaceFolders = { supported = false },
|
||||
fileOperations = { supported = false }
|
||||
}
|
||||
|
||||
-- Giữ lại diagnostics và inlay hints
|
||||
-- client.server_capabilities.diagnosticProvider = true (mặc định)
|
||||
-- client.server_capabilities.inlayHintProvider = true (mặc định)
|
||||
|
||||
44
lua/plugins/auto-save.lua
Normal file
44
lua/plugins/auto-save.lua
Normal file
@@ -0,0 +1,44 @@
|
||||
-- Auto-save functionality
|
||||
return {
|
||||
"okuuva/auto-save.nvim",
|
||||
event = { "User AstroFile", "InsertEnter" },
|
||||
dependencies = {
|
||||
"AstroNvim/astrocore",
|
||||
opts = {
|
||||
autocmds = {
|
||||
autoformat_toggle = {
|
||||
{
|
||||
event = "User",
|
||||
desc = "Disable autoformat before saving",
|
||||
pattern = "AutoSaveWritePre",
|
||||
callback = function()
|
||||
vim.g.OLD_AUTOFORMAT = vim.g.autoformat
|
||||
vim.g.autoformat = false
|
||||
local old_autoformat_buffers = {}
|
||||
for _, bufnr in ipairs(vim.api.nvim_list_bufs()) do
|
||||
if vim.b[bufnr].autoformat then
|
||||
table.insert(old_autoformat_buffers, bufnr)
|
||||
vim.b[bufnr].autoformat = false
|
||||
end
|
||||
end
|
||||
vim.g.OLD_AUTOFORMAT_BUFFERS = old_autoformat_buffers
|
||||
end,
|
||||
},
|
||||
{
|
||||
event = "User",
|
||||
desc = "Re-enable autoformat after saving",
|
||||
pattern = "AutoSaveWritePost",
|
||||
callback = function()
|
||||
vim.g.autoformat = vim.g.OLD_AUTOFORMAT
|
||||
for _, bufnr in ipairs(vim.g.OLD_AUTOFORMAT_BUFFERS or {}) do
|
||||
vim.b[bufnr].autoformat = true
|
||||
end
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
opts = {},
|
||||
}
|
||||
|
||||
52
lua/plugins/cmps.lua
Normal file
52
lua/plugins/cmps.lua
Normal file
@@ -0,0 +1,52 @@
|
||||
return {
|
||||
{
|
||||
"github/copilot.vim",
|
||||
event = "BufRead",
|
||||
config = function()
|
||||
vim.api.nvim_set_keymap("i", "<C-f>", 'copilot#Accept("\\<CR>")', { expr = true, silent = true })
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"Saghen/blink.cmp",
|
||||
opts = {
|
||||
completion = {
|
||||
list = { selection = { preselect = true, auto_insert = true } },
|
||||
ghost_text = {
|
||||
enabled = false,
|
||||
},
|
||||
menu = {
|
||||
auto_show = function(ctx)
|
||||
return ctx.mode ~= "cmdline"
|
||||
end,
|
||||
draw = {
|
||||
columns = {
|
||||
{ "kind_icon", "label", gap = 1 },
|
||||
{ "kind" },
|
||||
},
|
||||
components = {
|
||||
kind = {
|
||||
highlight = function(ctx)
|
||||
local _, hl, _ = require("mini.icons").get("lsp", ctx.kind)
|
||||
return hl
|
||||
end,
|
||||
},
|
||||
|
||||
},
|
||||
},
|
||||
},
|
||||
accept = {
|
||||
auto_brackets = { enabled = true },
|
||||
},
|
||||
documentation = {
|
||||
auto_show = true,
|
||||
auto_show_delay_ms = 0,
|
||||
window = {
|
||||
border = "rounded",
|
||||
winhighlight = "Normal:NormalFloat,FloatBorder:FloatBorder,CursorLine:PmenuSel,Search:None",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,26 +1,56 @@
|
||||
return {
|
||||
before_init = function(_, c)
|
||||
if not c.settings then
|
||||
c.settings = {}
|
||||
end
|
||||
if not c.settings.python then
|
||||
c.settings.python = {}
|
||||
end
|
||||
c.settings.python.pythonPath = vim.fn.exepath("python")
|
||||
end,
|
||||
settings = {
|
||||
pyright = {
|
||||
disableLanguageServices = false,
|
||||
disableOrganizeImports = true,
|
||||
analysis = {
|
||||
-- diagnosticMode = "openFilesOnly",
|
||||
typeCheckingMode = "standard",
|
||||
autoSearchPath = true,
|
||||
-- diagnosticSeverityOverrides = false,
|
||||
logLevel = "Trace",
|
||||
},
|
||||
},
|
||||
-- python = {
|
||||
-- },
|
||||
},
|
||||
init_options = {
|
||||
settings = {
|
||||
lint = {
|
||||
unfixable = { "F401" },
|
||||
select = {
|
||||
"ALL",
|
||||
},
|
||||
ignore = {
|
||||
"ANN",
|
||||
"COM",
|
||||
"C90",
|
||||
"DJ",
|
||||
"EXE",
|
||||
"T10",
|
||||
"TID",
|
||||
"D100",
|
||||
"D101",
|
||||
"D102",
|
||||
"D103",
|
||||
"D104",
|
||||
"D105",
|
||||
"D106",
|
||||
"D107",
|
||||
"D200",
|
||||
"D205",
|
||||
"D212",
|
||||
"D400",
|
||||
"D401",
|
||||
"D415",
|
||||
"E402",
|
||||
"E501",
|
||||
"ERA001",
|
||||
"TRY003",
|
||||
"TD002",
|
||||
"TD003",
|
||||
"T201",
|
||||
"FIX002",
|
||||
"N803",
|
||||
"PD901",
|
||||
-- "F401",
|
||||
"I001",
|
||||
"RET504",
|
||||
"PLR2004",
|
||||
"W291",
|
||||
"PLW2901",
|
||||
"D213",
|
||||
"D202",
|
||||
"PLR0402",
|
||||
"EM101",
|
||||
"TRY301",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
49
lua/plugins/contexts.lua
Normal file
49
lua/plugins/contexts.lua
Normal file
@@ -0,0 +1,49 @@
|
||||
-- Treesitter context
|
||||
return {
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter-context",
|
||||
event = "User AstroFile",
|
||||
cmd = { "TSContext" },
|
||||
opts = {
|
||||
on_attach = function()
|
||||
vim.api.nvim_set_hl(0, "TreesitterContext", { underline = true, sp = "Red", bg = "#1e1e3f" })
|
||||
end,
|
||||
max_lines = 2,
|
||||
},
|
||||
dependencies = {
|
||||
"AstroNvim/astrocore",
|
||||
opts = {
|
||||
mappings = {
|
||||
n = {
|
||||
["<Leader>uT"] = {
|
||||
"<cmd>TSContext toggle<CR>",
|
||||
desc = "Toggle treesitter context",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- Virtual text context
|
||||
{
|
||||
"andersevenrud/nvim_context_vt",
|
||||
event = "User AstroFile",
|
||||
cmd = { "NvimContextVtToggle" },
|
||||
dependencies = {
|
||||
"AstroNvim/astrocore",
|
||||
opts = {
|
||||
mappings = {
|
||||
n = {
|
||||
["<Leader>uv"] = {
|
||||
function()
|
||||
require("nvim_context_vt").toggle()
|
||||
end,
|
||||
desc = "Toggle virutal text context",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -20,6 +20,16 @@ return {
|
||||
-- install any other package
|
||||
"tree-sitter-cli",
|
||||
},
|
||||
ui = {
|
||||
border = "single",
|
||||
width = 0.8,
|
||||
height = 0.9,
|
||||
icons = {
|
||||
package_installed = " ",
|
||||
package_pending = " ",
|
||||
package_uninstalled = " ",
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
127
lua/plugins/motions.lua
Normal file
127
lua/plugins/motions.lua
Normal file
@@ -0,0 +1,127 @@
|
||||
-- Motion, Navigation and Multiple Cursors
|
||||
return {
|
||||
-- Multi-cursors support
|
||||
{
|
||||
"brenton-leighton/multiple-cursors.nvim",
|
||||
version = "*",
|
||||
opts = {},
|
||||
keys = {
|
||||
{ "<C-Down>", "<Cmd>MultipleCursorsAddDown<CR>", mode = { "n", "i", "x" } },
|
||||
{ "<C-Up>", "<Cmd>MultipleCursorsAddUp<CR>", mode = { "n", "i", "x" } },
|
||||
{ "<A-LeftMouse>", "<Cmd>MultipleCursorsMouseAddDelete<CR>", mode = { "n", "i" } },
|
||||
{ "<Leader>a", "<Cmd>MultipleCursorsAddMatches<CR>", mode = { "n", "x" } },
|
||||
{ "<C-D>", "<Cmd>MultipleCursorsAddJumpNextMatch<CR>", mode = { "n", "x" } },
|
||||
},
|
||||
},
|
||||
-- Alternative multi-cursor plugin
|
||||
{
|
||||
"mg979/vim-visual-multi",
|
||||
event = "BufRead",
|
||||
},
|
||||
-- Better move by word
|
||||
{
|
||||
"chrisgrieser/nvim-spider",
|
||||
opts = {},
|
||||
keys = {
|
||||
{ "w", "<Cmd>lua require('spider').motion('w')<CR>", mode = { "n", "o", "x" }, desc = "Spider-w" },
|
||||
{ "e", "<Cmd>lua require('spider').motion('e')<CR>", mode = { "n", "o", "x" }, desc = "Spider-e" },
|
||||
{ "b", "<Cmd>lua require('spider').motion('b')<CR>", mode = { "n", "o", "x" }, desc = "Spider-b" },
|
||||
{ "ge", "<Cmd>lua require('spider').motion('ge')<CR>", mode = { "n", "o", "x" }, desc = "Spider-ge" },
|
||||
},
|
||||
},
|
||||
|
||||
-- Better character motion
|
||||
{
|
||||
"folke/flash.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = {},
|
||||
keys = {
|
||||
{ "gj", function() require("flash").jump() end, mode = { "n", "x", "o" }, desc = "Flash" },
|
||||
{
|
||||
"gJ",
|
||||
function() require("flash").treesitter() end,
|
||||
mode = { "n", "x", "o" },
|
||||
desc = "Flash Treesitter",
|
||||
},
|
||||
{ "r", function() require("flash").remote() end, mode = "o", desc = "Remote Flash" },
|
||||
{
|
||||
"R",
|
||||
function() require("flash").treesitter_search() end,
|
||||
mode = { "x", "o" },
|
||||
desc = "Treesitter Search",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- Move code block
|
||||
{
|
||||
"echasnovski/mini.move",
|
||||
event = "BufRead",
|
||||
config = function()
|
||||
require("mini.move").setup {
|
||||
mappings = {
|
||||
left = "<M-a>",
|
||||
right = "<M-d>",
|
||||
down = "<M-s>",
|
||||
up = "<M-w>",
|
||||
line_left = "<M-a>",
|
||||
line_right = "<M-d>",
|
||||
line_down = "<M-s>",
|
||||
line_up = "<M-w>",
|
||||
},
|
||||
}
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"mrjones2014/smart-splits.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = function(_, opts)
|
||||
opts.ignored_filetypes = { "nofile", "quickfix", "qf", "prompt", "NvimTree" }
|
||||
opts.ignored_buftypes = { "nofile" }
|
||||
opts.log_level = "error"
|
||||
end,
|
||||
keys = {
|
||||
{
|
||||
"<C-h>",
|
||||
function() require("smart-splits").move_cursor_left() end,
|
||||
mode = { "n" },
|
||||
desc = "Move to left split",
|
||||
},
|
||||
{
|
||||
"<C-l>",
|
||||
function() require("smart-splits").move_cursor_right() end,
|
||||
mode = { "n", "t" },
|
||||
desc = "Move to right split",
|
||||
},
|
||||
{
|
||||
"<C-k>",
|
||||
function() require("smart-splits").move_cursor_up() end,
|
||||
mode = { "n" },
|
||||
desc = "Move to above split",
|
||||
},
|
||||
{
|
||||
"<C-j>",
|
||||
function() require("smart-splits").move_cursor_down() end,
|
||||
mode = { "n" },
|
||||
desc = "Move to below split",
|
||||
},
|
||||
{
|
||||
"<S-h>",
|
||||
function() require("smart-splits").resize_left() end,
|
||||
mode = { "n" },
|
||||
desc = "Resize split left",
|
||||
},
|
||||
{
|
||||
"<S-l>",
|
||||
function() require("smart-splits").resize_right() end,
|
||||
mode = { "n" },
|
||||
desc = "Resize split right",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- Disabled motion plugins
|
||||
{ "Wansmer/treesj", enabled = false },
|
||||
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
return {
|
||||
{
|
||||
"ribru17/bamboo.nvim",
|
||||
lazy = false,
|
||||
priority = 1000,
|
||||
config = function()
|
||||
require("bamboo").setup {
|
||||
integrations = { mini = true },
|
||||
terminal_colors = false
|
||||
}
|
||||
require("bamboo").load()
|
||||
end,
|
||||
},
|
||||
}
|
||||
43
lua/plugins/ui.lua
Normal file
43
lua/plugins/ui.lua
Normal file
@@ -0,0 +1,43 @@
|
||||
return {
|
||||
{
|
||||
"ribru17/bamboo.nvim",
|
||||
lazy = false,
|
||||
priority = 1000,
|
||||
config = function()
|
||||
require("bamboo").setup {
|
||||
integrations = { mini = true },
|
||||
terminal_colors = false
|
||||
}
|
||||
require("bamboo").load()
|
||||
end,
|
||||
},
|
||||
{
|
||||
"rebelot/heirline.nvim",
|
||||
opts = function(_, opts)
|
||||
opts.statusline = require("plugins.configs.ui.heirline").statusline
|
||||
opts.winbar = require("plugins.configs.ui.heirline").winbar
|
||||
end,
|
||||
},
|
||||
{
|
||||
"folke/which-key.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = {
|
||||
-- your configuration comes here
|
||||
-- or leave it empty to use the default settings
|
||||
-- refer to the configuration section below
|
||||
preset = "helix",
|
||||
layout = {
|
||||
height = { min = 6 },
|
||||
},
|
||||
},
|
||||
keys = {
|
||||
{
|
||||
"<leader>?",
|
||||
function() require("which-key").show { global = false } end,
|
||||
desc = "Buffer Local Keymaps (which-key)",
|
||||
},
|
||||
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,34 +29,32 @@ return {
|
||||
keys = {},
|
||||
},
|
||||
},
|
||||
scope = {
|
||||
char = ""
|
||||
},
|
||||
|
||||
indent = {
|
||||
priority = 1,
|
||||
enabled = true, -- enable indent guides
|
||||
char = "l",
|
||||
only_scope = false, -- only show indent guides of the scope
|
||||
-- char = "l",
|
||||
only_scope = true, -- only show indent guides of the scope
|
||||
only_current = false, -- only show indent guides in the current window
|
||||
hl = "SnacksIndent", ---@type string|string[] hl groups for indent guides
|
||||
animate = {
|
||||
enabled = vim.fn.has("nvim-0.10") == 1,
|
||||
style = "out",
|
||||
easing = "linear",
|
||||
duration = {
|
||||
step = 20, -- ms per step
|
||||
total = 500, -- maximum duration
|
||||
},
|
||||
},
|
||||
---@class snacks.indent.Scope.Config: snacks.scope.Config
|
||||
scope = {
|
||||
enabled = true, -- enable highlighting the current scope
|
||||
priority = 200,
|
||||
char = "",
|
||||
underline = false, -- underline the start of the scope
|
||||
only_current = false, -- only show scope in the current window
|
||||
hl = "SnacksIndentScope", ---@type string|string[] hl group for scopes
|
||||
},
|
||||
|
||||
animate = {
|
||||
enabled = vim.fn.has("nvim-0.10") == 1,
|
||||
style = "out",
|
||||
easing = "linear",
|
||||
duration = {
|
||||
step = 10, -- ms per step
|
||||
total = 500, -- maximum duration
|
||||
},
|
||||
},
|
||||
scope = {
|
||||
enabled = true, -- enable highlighting the current scope
|
||||
priority = 200,
|
||||
char = "",
|
||||
underline = false, -- underline the start of the scope
|
||||
only_current = false, -- only show scope in the current window
|
||||
hl = "SnacksIndentScope", ---@type string|string[] hl group for scopes
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
if true then return end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE
|
||||
|
||||
-- This will run last in the setup process.
|
||||
-- This is just pure lua so anything that doesn't
|
||||
-- fit in the normal config locations above can go here
|
||||
|
||||
require"core.autocmds"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user