This commit is contained in:
Zelong Kuang
2025-05-13 19:37:28 +10:00
commit 9d1536e5af
57 changed files with 5155 additions and 0 deletions

View File

@@ -0,0 +1,67 @@
return {
{
"CRAG666/code_runner.nvim",
ft = { "lua", "python", "c", "cpp" },
dependencies = { "nvim-lua/plenary.nvim" },
keys = {
{ "<leader>rr", "<cmd>RunCode<cr>", desc = "Run Code" },
-- { "<leader>rf", "<cmd>RunFile<cr>", desc = "Run File" },
-- { "<leader>rp", "<cmd>RunProject<cr>", desc = "Run Project" },
{ "<leader>rd", "<cmd>RunClose<cr>", desc = "Run Close" },
},
opts = {
-- choose default mode (valid term, tab, float, toggle, buf)
mode = "term",
-- Focus on runner window(only works on toggle, term and tab mode)
focus = false,
-- startinsert (see ':h inserting-ex')
startinsert = false,
term = {
-- Position to open the terminal, this option is ignored if mode is tab
position = "bot",
-- window size, this option is ignored if tab is true
size = 8,
},
float = {
-- Key that close the code_runner floating window
close_key = "<ESC>",
-- Window border (see ':h nvim_open_win')
border = "none",
-- Num from `0 - 1` for measurements
height = 0.8,
width = 0.8,
x = 0.5,
y = 0.5,
-- Highlight group for floating window/border (see ':h winhl')
border_hl = "FloatBorder",
float_hl = "Normal",
-- Transparency (see ':h winblend')
blend = 0,
},
filetype_path = "", -- No default path defined
filetype = {
javascript = "node",
java = "cd $dir && javac $fileName && java $fileNameWithoutExt",
c = "cd $dir && gcc $fileName -o $fileNameWithoutExt && $dir/$fileNameWithoutExt",
cpp = "cd $dir && g++ $fileName -o $fileNameWithoutExt && $dir/$fileNameWithoutExt",
python = "python -u",
sh = "bash",
rust = "cd $dir && rustc $fileName && $dir$fileNameWithoutExt",
},
project_path = "", -- No default path defined
project = {},
},
-- config = {
-- filetype = {
-- python = "python3 -u",
-- },
-- mode = "term",
-- float = {
-- close_key = "q",
-- },
-- },
},
}

View File

@@ -0,0 +1,28 @@
return {
{
"xeluxee/competitest.nvim",
dependencies = "MunifTanjim/nui.nvim",
lazy = false,
keys = {
{ "<localleader>rt", "<cmd>CompetiTest receive testcases<CR>", "Receive testcases" },
{ "<localleader>rp", "<cmd>CompetiTest receive problem<CR>", "Receive problem" },
{ "<localleader>rc", "<cmd>CompetiTest receive contest<CR>", "Receive contest" },
{ "<localleader>c", "<cmd>CompetiTest run<CR>", "Run code" },
},
config = function()
require("competitest").setup({
received_problems_path = "$(HOME)/compcode/$(JUDGE)/$(CONTEST)/$(PROBLEM).$(FEXT)c",
received_contests_directory = "$(HOME)/compcode/$(JUDGE)/$(CONTEST)",
template_file = {
cpp = "~/compcode/templates/template.cpp",
},
compile_command = {
cpp = { exec = "clang++", args = { "$(FNAME)", "-o", "$(FNOEXT)", "-lm" } },
},
run_command = {
cpp = { exec = "./$(FNOEXT)" },
},
})
end,
},
}

View File

@@ -0,0 +1,20 @@
return {
{
"saghen/blink.cmp",
version = "*",
opts = {
-- sources = {
-- compat = { "avante_commands", "avante_mentions", "avante_files" },
-- },
keymap = {
["<C-j>"] = { "select_next", "fallback" },
["<C-k>"] = { "select_prev", "fallback" },
},
completion = {
menu = { border = "single" },
documentation = { window = { border = "single" } },
},
signature = { window = { border = "single" } },
},
},
}

View File

@@ -0,0 +1,11 @@
return {
"stevearc/conform.nvim",
opts = {
formatters_by_ft = {
["json"] = { "jq" },
["jsonc"] = { "jq" },
["tex"] = { "latexindent" },
["toml"] = { "taplo "},
}
}
}

View File

@@ -0,0 +1,15 @@
return {
-- {
-- "zbirenbaum/copilot.lua",
-- opts = {
-- copilot_model = "claude-3.7-sonnet",
-- suggestion = {
-- keymap = {
-- accept = "<D-l>",
-- next = "<D-]>",
-- prev = "<D-[>",
-- },
-- },
-- },
-- },
}

View File

@@ -0,0 +1,24 @@
return {
{
"neovim/nvim-lspconfig",
optional = true,
opts = {
servers = {
texlab = {
keys = {
{ "<Leader>K", "<plug>(vimtex-doc-package)", desc = "Vimtex Docs", silent = true },
},
settings = {
texlab = {
inlayHints = {
labelDefinitions = false,
labelReferences = false,
},
diagnostics = { ignoredPatterns = { "^Overfull", "^Underfull" } },
},
},
},
},
},
},
}

View File

@@ -0,0 +1,70 @@
return {
{
"L3MON4D3/LuaSnip",
config = function()
require("luasnip").config.set_config({
enable_autosnippets = true,
store_selection_keys = "`",
})
require("luasnip.loaders.from_lua").load({ paths = "~/.config/nvim/LuaSnip" })
local auto_expand = require("luasnip").expand_auto
require("luasnip").expand_auto = function(...)
vim.o.undolevels = vim.o.undolevels
auto_expand(...)
end
-- local types = require("luasnip.util.types")
-- require("luasnip").config.setup({
-- ext_opts = {
-- [types.choiceNode] = {
-- active = {
-- virt_text = { { "●", "GruvboxOrange" } },
-- },
-- },
-- [types.insertNode] = {
-- active = {
-- virt_text = { { "●", "GruvboxBlue" } },
-- },
-- },
-- },
-- })
end,
keys = function()
return {
{
"fj",
function()
return require("luasnip").expand_or_locally_jumpable() and "<Plug>luasnip-jump-next"
-- or "<c-\\><c-n>:call searchpair('[([{<|]', '', '[)\\]}>|]', 'W')<cr>a"
end,
expr = true,
silent = true,
mode = "i",
},
{
"fj",
function()
return require("luasnip").jump(1)
end,
mode = "s",
},
{
"fk",
function()
require("luasnip").jump(-1)
end,
mode = { "i", "s" },
},
{
"<c-h>",
"<Plug>luasnip-next-choice",
mode = { "i", "s" },
},
{
"<c-p>",
"<Plug>luasnip-prev-choice",
mode = { "i", "s" },
},
}
end,
},
}

View File

@@ -0,0 +1,22 @@
return {
{
"nvim-neo-tree/neo-tree.nvim",
lazy = true,
opts = {
filesystem = {
window = {
mappings = {
["o"] = "system_open",
},
},
commands = {
system_open = function(state)
local node = state.tree:get_node()
local path = node:get_id()
vim.api.nvim_command("silent !open -g " .. path)
end,
},
},
},
},
}

View File

@@ -0,0 +1,59 @@
return {
{
"nvim-treesitter/nvim-treesitter",
opts = function()
return {
highlight = {
enable = true,
disable = { "latex" },
additional_vim_regex_highlighting = { "latex", "markdown" },
},
indent = { enable = true, disable = { "python" } },
context_commentstring = { enable = true, enable_autocmd = false },
ensure_installed = {
"bash",
"c",
"cpp",
"html",
"json",
"lua",
"luap",
"markdown",
"make",
"markdown_inline",
"scala",
"python",
"query",
"toml",
"regex",
"vim",
"yaml",
},
incremental_selection = {
enable = true,
keymaps = {
init_selection = "<cr>",
node_incremental = "<cr>",
scope_incremental = "\\",
node_decremental = "<bs>",
},
},
}
end,
rainbow = {
enable = true,
-- list of languages you want to disable the plugin for
disable = { "jsx", "cpp" },
-- Which query to use for finding delimiters
query = "rainbow-parens",
-- Highlight the entire buffer all at once
},
keys = function()
return {
{ "<cr>", desc = "Increment selection" },
{ "<bs>", desc = "Decrement selection", mode = "x" },
}
end,
},
}

View File

@@ -0,0 +1,61 @@
return {
{
"nvim-treesitter/nvim-treesitter",
opts = function()
return {
highlight = {
enable = true,
disable = { "latex" },
-- additional_vim_regex_highlighting = { "markdown" },
},
-- ignore_install = { "latex" },
indent = { enable = true, disable = { "python" } },
context_commentstring = { enable = true, enable_autocmd = false },
ensure_installed = {
"latex",
"bash",
"c",
"cpp",
"html",
"json",
"lua",
"luap",
"markdown",
"make",
"markdown_inline",
"scala",
"python",
"query",
"toml",
"regex",
"vim",
"yaml",
},
incremental_selection = {
enable = true,
keymaps = {
init_selection = "<cr>",
node_incremental = "<cr>",
scope_incremental = "\\",
node_decremental = "<bs>",
},
},
}
end,
rainbow = {
enable = true,
-- list of languages you want to disable the plugin for
disable = { "jsx", "cpp" },
-- Which query to use for finding delimiters
query = "rainbow-parens",
-- Highlight the entire buffer all at once
},
keys = function()
return {
{ "<cr>", desc = "Increment selection" },
{ "<bs>", desc = "Decrement selection", mode = "x" },
}
end,
},
}

6
lua/plugins/disabled.lua Normal file
View File

@@ -0,0 +1,6 @@
return {
{
"rafamadriz/friendly-snippets",
enabled = false,
},
}

View File

@@ -0,0 +1,89 @@
return {
{
"yetone/avante.nvim",
event = "VeryLazy",
enabled = false,
version = false, -- Never set this value to "*"! Never!
opts = {
-- add any opts here
-- for example
-- provider = "copilot",
-- copilot = { model = "claude-3.5-sonnet" },
-- hints = { enabled = false },
-- file_selector = {
-- provider = "snack",
-- provider_opts = {},
-- },
-- openai = {
-- endpoint = "https://api.openai.com/v1",
-- model = "gpt-4o", -- your desired model (or use gpt-4o, etc.)
-- timeout = 30000, -- Timeout in milliseconds, increase this for reasoning models
-- temperature = 0,
-- max_tokens = 8192, -- Increase this to include reasoning tokens (for reasoning models)
-- --reasoning_effort = "medium", -- low|medium|high, only used for reasoning models
-- },
},
-- if you want to build from source then do `make BUILD_FROM_SOURCE=true`
build = "make",
-- build = "powershell -ExecutionPolicy Bypass -File Build.ps1 -BuildFromSource false" -- for windows
dependencies = {
"nvim-treesitter/nvim-treesitter",
"stevearc/dressing.nvim",
"nvim-lua/plenary.nvim",
"MunifTanjim/nui.nvim",
--- The below dependencies are optional,
-- "echasnovski/mini.pick", -- for file_selector provider mini.pick
-- "nvim-telescope/telescope.nvim", -- for file_selector provider telescope
-- "hrsh7th/nvim-cmp", -- autocompletion for avante commands and mentions
-- "ibhagwan/fzf-lua", -- for file_selector provider fzf
-- "nvim-tree/nvim-web-devicons", -- or echasnovski/mini.icons
"zbirenbaum/copilot.lua", -- for providers='copilot'
{
-- support for image pasting
"HakonHarnes/img-clip.nvim",
event = "VeryLazy",
opts = {
-- recommended settings
default = {
embed_image_as_base64 = false,
prompt_for_file_name = false,
drag_and_drop = {
insert_mode = true,
},
-- required for Windows users
use_absolute_path = true,
},
},
},
{
-- Make sure to set this up properly if you have lazy=true
"MeanderingProgrammer/render-markdown.nvim",
opts = {
file_types = { "markdown", "Avante" },
},
ft = { "markdown", "Avante" },
},
{
"saghen/blink.compat",
lazy = true,
opts = {},
config = function()
-- monkeypatch cmp.ConfirmBehavior for Avante
require("cmp").ConfirmBehavior = {
Insert = "insert",
Replace = "replace",
}
end,
},
{
"saghen/blink.cmp",
lazy = true,
opts = {
sources = {
compat = { "avante_commands", "avante_mentions", "avante_files" },
},
},
},
},
},
}

View File

@@ -0,0 +1,30 @@
return {
{
"neovim/nvim-lspconfig",
lazy = true,
ft = { "c", "cpp" },
opts = {
servers = {
clangd = {
cmd = {
"clangd",
"--background-index",
"--clang-tidy",
"--cross-file-rename",
"--clang-tidy-checks=performance-*,cppcoreguidelines-*,clang-analyzer-*,bugprone-*",
"-j=12",
"--all-scopes-completion",
"--header-insertion=iwyu",
"--query-driver=/usr/bin/clang,/usr/bin/clang++",
"--fallback-style=llvm",
},
},
},
},
},
{
"Civitasv/cmake-tools.nvim",
lazy = true,
ft = { "c", "cpp" },
},
}

View File

@@ -0,0 +1,43 @@
return {
{
"lervag/vimtex",
lazy = false, -- lazy-loading will disable inverse search
init = function()
vim.g.vimtex_syntax_conceal_disable = 1
vim.g.vimtex_mappings_disable = { ["n"] = { "K" } } -- disable `K` as it conflicts with LSP hover
vim.g.vimtex_view_method = "sioyek"
-- vim.g.vimtex_view_general_viewer = "open -a UPDF"
vim.g.vimtex_view_skim_sync = 1
vim.g.vimtex_compiler_silent = 1
vim.g.vimtex_compiler_method = "latexmk"
vim.g.vimtex_compiler_latexmk = {
aux_dir = "./aux",
out_dir = "",
callback = 1,
continuous = 1,
executable = "latexmk",
hooks = {},
options = {
-- "-c",
"-verbose",
"-file-line-error",
"-synctex=1",
"-interaction=nonstopmode",
"--shell-escape",
},
}
vim.g.vimtex_quickfix_ignore_filters = {
"Underfull",
"Overfull",
"specifier changed to",
"Token not allowed in a PDF string",
"LaTeX Warning: Float too large for page",
"contains only floats",
}
end,
},
{
"evesdropper/luasnip-latex-snippets.nvim",
enabled = false,
},
}

View File

@@ -0,0 +1,13 @@
return {
{
"mfussenegger/nvim-lint",
opts = {
linters = {
markdownlint = {
-- Disable line length check
args = { "--disable", "MD013", "--" },
},
},
},
},
}

View File

@@ -0,0 +1,16 @@
return {
{
"kmontocam/nvim-conda",
ft = "python",
dependencies = { "nvim-lua/plenary.nvim" },
keys = {
{ "<leader>cv", "<cmd>CondaActivate<cr>", desc = "Conda environment" },
},
},
{
"nvim-neotest/neotest",
ft = "python",
dependencies = { "nvim-neotest/neotest-python" },
opts = { adapters = { "neotest-python" } },
},
}

38
lua/plugins/leetcode.lua Normal file
View File

@@ -0,0 +1,38 @@
return {
-- {
-- "kawre/leetcode.nvim",
-- build = ":TSUpdate html",
-- dependencies = {
-- "nvim-telescope/telescope.nvim",
-- "nvim-lua/plenary.nvim", -- required by telescope
-- "MunifTanjim/nui.nvim",
--
-- -- optional
-- "nvim-treesitter/nvim-treesitter",
-- "rcarriga/nvim-notify",
-- "nvim-tree/nvim-web-devicons",
-- },
-- lazy = false,
-- keys = {
-- { "<localleader>kt", "<cmd>Leet test<CR>", desc = "Leet test" },
-- { "<localleader>ks", "<cmd>Leet submit<CR>", desc = "Leet submit" },
-- { "<localleader>kl", "<cmd>Leet lang<CR>", desc = "Leet lang" },
-- { "<localleader>kp", "<cmd>Leet list<CR>", desc = "List problem" },
-- },
-- opts = {
-- -- configuration goes here
-- ---@type string
-- arg = "leetcode.nvim",
--
-- ---@type lc.lang
-- lang = "cpp",
-- ---@type lc.storage
-- storage = {
-- home = vim.fn.stdpath("data") .. "/leetcode",
-- cache = vim.fn.stdpath("cache") .. "/leetcode",
-- },
-- ---@type boolean
-- logging = false,
-- },
-- },
}

View File

@@ -0,0 +1,4 @@
return {
{ "mason-org/mason.nvim", version = "^1.0.0" },
{ "mason-org/mason-lspconfig.nvim", version = "^1.0.0" },
}

View File

@@ -0,0 +1,19 @@
return {
-- Lazy
{
"catppuccin/nvim",
name = "catppuccin",
priority = 1000,
opts = {
flavour = "mocha",
-- transparent_background = true,
},
},
-- somewhere in your config:
{
"LazyVim/LazyVim",
opts = {
colorscheme = "catppuccin",
},
},
}

View File

@@ -0,0 +1,21 @@
return {
-- {
-- "xiyaowong/nvim-transparent",
-- opts = {
-- extra_groups = {
-- "BufferLineTabClose",
-- "BufferlineBufferSelected",
-- "BufferLineFill",
-- "BufferLineBackground",
-- "BufferLineSeparator",
-- "BufferLineIndicatorSelected",
-- },
-- },
-- },
-- {
-- "rcarriga/nvim-notify",
-- opts = {
-- background_colour = "#000000",
-- },
-- },
}

31
lua/plugins/yazi.lua Normal file
View File

@@ -0,0 +1,31 @@
---@type LazySpec
return {
{
"mikavilpas/yazi.nvim",
event = "VeryLazy",
keys = {
-- 👇 in this section, choose your own keymappings!
{
-- Open in the current working directory
"<leader>fM",
"<cmd>Yazi cwd<cr>",
desc = "Open the file manager in nvim's working directory",
},
{
-- NOTE: this requires a version of yazi that includes
-- https://github.com/sxyazi/yazi/pull/1305 from 2024-07-18
"<leader>fm",
"<cmd>Yazi toggle<cr>",
desc = "Resume the last yazi session",
},
},
---@type YaziConfig
opts = {
-- if you want to open yazi instead of netrw, see below for more info
open_for_directories = false,
keymaps = {
show_help = "<f1>",
},
},
},
}