├── init.lua ├── lua ├── plugins │ ├── noused │ │ ├── README.txt │ │ ├── screenkey.lua │ │ ├── goto-preview.lua │ │ ├── db.lua │ │ ├── vim-swap.lua │ │ ├── nvim-gomove.lua │ │ ├── vim-easy-align.lua │ │ ├── toggleterm.lua │ │ ├── genghis.lua │ │ ├── sniprun.lua │ │ ├── dap-python.lua │ │ ├── printer.lua │ │ └── telescope.lua │ ├── committia.lua │ ├── faster.lua │ ├── vim-rooter.lua │ ├── surround.lua │ ├── winresizer.lua │ ├── disabled.lua │ ├── diagflow.lua │ ├── nvim-lspconfig.lua │ ├── fzf-lua.lua │ ├── conform.lua │ ├── open-browser.lua │ ├── multicursors.lua │ ├── diffview.lua │ ├── code-runner.lua │ ├── colorschema.lua │ └── dashboard.lua └── config │ ├── options.lua │ ├── autocmds.lua │ ├── lazy.lua │ └── keymaps.lua ├── .gitignore ├── .neoconf.json ├── bookmarks.db.json ├── LICENSE ├── lazyvim.json └── README.md /init.lua: -------------------------------------------------------------------------------- 1 | require("config.lazy") 2 | -------------------------------------------------------------------------------- /lua/plugins/noused/README.txt: -------------------------------------------------------------------------------- 1 | Does Not use 2 | -------------------------------------------------------------------------------- /lua/plugins/committia.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "rhysd/committia.vim", 3 | } 4 | -------------------------------------------------------------------------------- /lua/plugins/faster.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "pteroctopus/faster.nvim", 3 | } 4 | -------------------------------------------------------------------------------- /lua/plugins/vim-rooter.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "airblade/vim-rooter", 3 | } 4 | -------------------------------------------------------------------------------- /lua/plugins/surround.lua: -------------------------------------------------------------------------------- 1 | return { 2 | { "tpope/vim-surround" }, 3 | { "tpope/vim-repeat" }, 4 | } 5 | -------------------------------------------------------------------------------- /lua/plugins/winresizer.lua: -------------------------------------------------------------------------------- 1 | return { 2 | -- Ctrl + E, then 'hjkl' 3 | "simeji/winresizer", 4 | } 5 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | tt.* 2 | .tests 3 | doc/tags 4 | debug 5 | .repro 6 | foo.* 7 | *.log 8 | data 9 | lazy-lock.json 10 | lazyvim.json 11 | -------------------------------------------------------------------------------- /lua/plugins/noused/screenkey.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "NStefan002/screenkey.nvim", 3 | cmd = "Screenkey", 4 | version = "*", 5 | config = true, 6 | } 7 | -------------------------------------------------------------------------------- /lua/plugins/noused/goto-preview.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "rmagatti/goto-preview", 3 | config = function() 4 | require("goto-preview").setup({ 5 | height = 18, 6 | }) 7 | end, 8 | } 9 | -------------------------------------------------------------------------------- /lua/plugins/disabled.lua: -------------------------------------------------------------------------------- 1 | return { 2 | { 3 | "nvim-mini/mini.surround", 4 | enabled = false, 5 | }, 6 | { 7 | "folke/flash.nvim", 8 | enabled = false, 9 | }, 10 | } 11 | -------------------------------------------------------------------------------- /lua/plugins/diagflow.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "dgagn/diagflow.nvim", 3 | config = function() 4 | -- 在当前行上运行诊断程序, 默认 cursors 只在当前单词显示 5 | require("diagflow").setup({ scope = "line", placement = "inline", inline_padding_left = 3 }) 6 | end, 7 | } 8 | -------------------------------------------------------------------------------- /.neoconf.json: -------------------------------------------------------------------------------- 1 | { 2 | "neodev": { 3 | "library": { 4 | "enabled": true, 5 | "plugins": true 6 | } 7 | }, 8 | "neoconf": { 9 | "plugins": { 10 | "lua_ls": { 11 | "enabled": true 12 | } 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /lua/plugins/noused/db.lua: -------------------------------------------------------------------------------- 1 | return { 2 | { 3 | "tpope/vim-dadbod", 4 | event = "VeryLazy", 5 | }, 6 | { 7 | "kristijanhusak/vim-dadbod-ui", 8 | event = "VeryLazy", 9 | }, 10 | { 11 | "kristijanhusak/vim-dadbod-completion", 12 | event = "VeryLazy", 13 | }, 14 | } 15 | -------------------------------------------------------------------------------- /lua/plugins/noused/vim-swap.lua: -------------------------------------------------------------------------------- 1 | return { 2 | -- g<, g>,gS then hl: 左右交换 3 | -- "machakann/vim-swap", 4 | -- -- option + jk: 上下交换 5 | keys = { 6 | { 7 | "ga", 8 | "(swap-interactive)", 9 | mode = { "n", "x" }, 10 | desc = "Swap interactive", 11 | }, 12 | }, 13 | } 14 | -------------------------------------------------------------------------------- /lua/plugins/noused/nvim-gomove.lua: -------------------------------------------------------------------------------- 1 | return { 2 | -- option + shift + hjkl: n,v 模式下上下左右交换 3 | "booperlv/nvim-gomove", 4 | config = function() 5 | require("gomove").setup({ 6 | map_defaults = false, 7 | reindent = true, 8 | undojoin = true, 9 | move_past_end_col = false, 10 | }) 11 | end, 12 | } 13 | -------------------------------------------------------------------------------- /lua/plugins/nvim-lspconfig.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "neovim/nvim-lspconfig", 3 | opts = { 4 | diagnostics = { 5 | -- 不在当前行以虚拟文本形式显示错误信息 6 | underline = true, 7 | virtual_text = false, 8 | }, 9 | setup = { 10 | clangd = function(_, opts) 11 | opts.capabilities.offsetEncoding = { "utf-16" } 12 | end, 13 | }, 14 | }, 15 | } 16 | -------------------------------------------------------------------------------- /lua/plugins/fzf-lua.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "ibhagwan/fzf-lua", 3 | -- optional for icon support 4 | dependencies = { "nvim-tree/nvim-web-devicons" }, 5 | -- or if using mini.icons/mini.nvim 6 | -- dependencies = { "echasnovski/mini.icons" }, 7 | opts = { 8 | winopts = { 9 | height = 0.90, -- window height 10 | width = 0.90, 11 | }, 12 | }, 13 | } 14 | -------------------------------------------------------------------------------- /lua/plugins/noused/vim-easy-align.lua: -------------------------------------------------------------------------------- 1 | return { 2 | -- gaip= : Start EasyAlign command (ga) for inner paragraph 3 | -- vipga= : visual-select inner paragraph, Start EasyAlign command (ga), Align around = 4 | "junegunn/vim-easy-align", 5 | keys = { 6 | { 7 | "ga", 8 | "(EasyAlign)", 9 | mode = { "n", "x" }, 10 | desc = "EasyAlign text", 11 | }, 12 | }, 13 | } 14 | -------------------------------------------------------------------------------- /lua/plugins/conform.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "stevearc/conform.nvim", 3 | optional = true, 4 | opts = { 5 | formatters_by_ft = { 6 | -- 这种配置 看官方文档 *绝对* 比问 GPT 可靠 7 | -- https://docs.astral.sh/ruff/editors/setup/#vim (With the conform.nvim plugin for Neovim.) 8 | ["python"] = { "ruff_fix", "ruff_format", "ruff_organize_imports" }, 9 | ["go"] = { "goimports", "gofmt" }, 10 | }, 11 | }, 12 | } 13 | -------------------------------------------------------------------------------- /lua/plugins/open-browser.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "tyru/open-browser.vim", 3 | keys = { 4 | { 5 | "gu", 6 | "(openbrowser-smart-search)", 7 | mode = { "n", "v" }, 8 | desc = "Open URL word with browser", 9 | }, 10 | { 11 | "gw", 12 | "(openbrowser-search)", 13 | mode = { "n", "v" }, 14 | desc = "Search current word with browser", 15 | }, 16 | }, 17 | } 18 | -------------------------------------------------------------------------------- /lua/plugins/multicursors.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "smoka7/multicursors.nvim", 3 | event = "VeryLazy", 4 | dependencies = { 5 | "nvimtools/hydra.nvim", 6 | }, 7 | opts = {}, 8 | cmd = { "MCstart", "MCvisual", "MCclear", "MCpattern", "MCvisualPattern", "MCunderCursor" }, 9 | keys = { 10 | { 11 | mode = { "v", "n" }, 12 | "m", 13 | "MCstart", 14 | desc = "Multiple selected text edit", 15 | }, 16 | }, 17 | } 18 | -------------------------------------------------------------------------------- /lua/plugins/diffview.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "sindrets/diffview.nvim", 3 | cmd = { "DiffviewClose", "DiffviewFileHistory", "DiffviewOpen" }, 4 | keys = { 5 | { 6 | "gH", 7 | "DiffviewFileHistory %", 8 | desc = "DiffviewFileHistory cur file", 9 | }, 10 | { 11 | "gO", 12 | "DiffviewOpen", 13 | desc = "DiffviewOpen", 14 | }, 15 | { 16 | "gq", 17 | "DiffviewClose", 18 | desc = "DiffviewClose", 19 | }, 20 | }, 21 | } 22 | -------------------------------------------------------------------------------- /lua/config/options.lua: -------------------------------------------------------------------------------- 1 | -- local opt = vim.opt 2 | 3 | -- opt.tabstop = 4 4 | -- opt.softtabstop = 4 5 | -- opt.shiftwidth = 4 6 | -- opt.autoindent = true 7 | -- opt.smartindent = true 8 | -- opt.termguicolors = true 9 | 10 | vim.wo.colorcolumn = "120" 11 | 12 | -- for winresizer 13 | vim.g.winresizer_vert_resize = 2 14 | 15 | vim.g.snacks_animate = false 16 | 17 | -- Set to "basedpyright" to use basedpyright instead of pyright. 18 | vim.g.lazyvim_python_lsp = "pyright" 19 | -- Set to "ruff_lsp" to use the old LSP implementation version. 20 | vim.g.lazyvim_python_ruff = "pyright" 21 | -------------------------------------------------------------------------------- /bookmarks.db.json: -------------------------------------------------------------------------------- 1 | [{"id": "2024052811192720779832", "name": "Default", "is_active": true, "bookmarks": [{"id": 1716866529, "name": "pdf", "location": {"col": 1, "path": "/Users/hj.tian/AfterShip/couriers-pusher.aftershipapi.com/internal/courier/conf/parcalogistics.toml", "line": 17}, "created_at": 1716866529, "githash": "94fa6ff5", "visited_at": 1716866541, "content": "file_type = [\"pdf\"]"}, {"location": {"col": 27, "path": "/Users/navy/github/ReadLecture-web-server/src/api/order_alipay.py", "line": 96}, "id": 1733372166, "name": "", "githash": "c0dabfd", "created_at": 1733372166, "visited_at": 1733372166, "content": " return JSONResponse({\"status\": \"success\"})"}]}] -------------------------------------------------------------------------------- /lua/plugins/noused/toggleterm.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "akinsho/toggleterm.nvim", 3 | version = "*", 4 | config = true, 5 | opts = { 6 | shade_terminals = false, 7 | }, 8 | keys = { 9 | { "ft", "ToggleTerm direction=horizontal size=19", desc = "ToggleTerm bottom" }, 10 | { "fT", "ToggleTerm direction=tab", desc = "ToggleTerm tab" }, 11 | { "fl", "ToggleTerm direction=vertical size=89", desc = "ToggleTerm right" }, 12 | { "fc", "ToggleTermSendCurrentLine", desc = "ToggleTerm current line" }, 13 | { "fv", "ToggleTermSendVisualSelection", desc = "ToggleTerm visual selection" }, 14 | }, 15 | } 16 | -------------------------------------------------------------------------------- /lua/plugins/noused/genghis.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "chrisgrieser/nvim-genghis", 3 | keys = { 4 | { 5 | "yp", 6 | "lua require('genghis').copyFilepath()", 7 | mode = { "n" }, 8 | desc = "Yank Filepath", 9 | }, 10 | { 11 | "yn", 12 | "lua require('genghis').copyFilename()", 13 | mode = { "n" }, 14 | desc = "Yank Filename", 15 | }, 16 | { 17 | "yf", 18 | "lua require('genghis').duplicateFile()", 19 | mode = { "n" }, 20 | desc = "Yank File", 21 | }, 22 | { 23 | "rn", 24 | "lua require('genghis').renameFile()", 25 | mode = { "n" }, 26 | desc = "Re Name current File", 27 | }, 28 | { 29 | "fm", 30 | "lua require('genghis').moveAndRenameFile()", 31 | mode = { "n" }, 32 | desc = "File move and rename", 33 | }, 34 | { 35 | "fd", 36 | "lua require('genghis').trashFile()", 37 | mode = { "n" }, 38 | desc = "File Delete", 39 | }, 40 | { 41 | "fv", 42 | "lua require('genghis').moveSelectionToNewFile()", 43 | mode = { "v" }, 44 | desc = "Visual Selection to New File", 45 | }, 46 | }, 47 | dependencies = "stevearc/dressing.nvim", 48 | } 49 | -------------------------------------------------------------------------------- /lua/config/autocmds.lua: -------------------------------------------------------------------------------- 1 | vim.api.nvim_create_autocmd({ "FileType" }, { 2 | pattern = { "go" }, 3 | callback = function() 4 | vim.opt_local.expandtab = false -- 使用 tab 字符 5 | vim.opt.tabstop = 8 6 | vim.opt.softtabstop = 8 7 | vim.opt.shiftwidth = 8 8 | end, 9 | }) 10 | 11 | vim.api.nvim_create_autocmd({ "ExitPre" }, { 12 | callback = function() 13 | vim.opt.guicursor = "a:ver25-blinkon250-blinkoff400-blinkwait700" 14 | -- vim.opt.guicursor = "a:hor25-blinkon250-blinkoff400-blinkwait700" 15 | end, 16 | }) 17 | 18 | local function update_autoformat() 19 | local project = vim.fn.fnamemodify(vim.fn.getcwd(), ":t") 20 | 21 | local disable_autoformat_projects = { 22 | server_lucky_admin = true, 23 | server_tg_lb = true, 24 | bitslots_game = true, 25 | web3_user = true, 26 | server_pvp = true, 27 | } 28 | vim.g.autoformat = not disable_autoformat_projects[project] 29 | end 30 | 31 | -- 1️⃣ Neovim 启动完成后,跑一次(此时 cwd / session 都稳定) 32 | vim.api.nvim_create_autocmd("User", { 33 | pattern = "LazyVimStarted", 34 | callback = update_autoformat, 35 | }) 36 | 37 | vim.api.nvim_create_user_command("TrimWhitespace", function() 38 | local view = vim.fn.winsaveview() 39 | vim.cmd([[%s/\s\+$//e]]) 40 | vim.fn.winrestview(view) 41 | end, {}) 42 | -------------------------------------------------------------------------------- /lua/plugins/noused/sniprun.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "michaelb/sniprun", 3 | branch = "master", 4 | build = "sh install.sh", 5 | 6 | config = function() 7 | require("sniprun").setup({ 8 | display = { "Classic", "VirtualTextOk", "TerminalWithCode" }, 9 | display_options = { 10 | terminal_position = "horizontal", 11 | terminal_line_number = true, 12 | terminal_signcolumn = true, 13 | }, 14 | show_no_output = { "Classic", "VirtualTextOk" }, 15 | inline_messages = true, 16 | selected_interpreters = { "Python3_fifo", "JS_TS_deno" }, 17 | repl_enable = { "Python3_fifo", "JS_TS_deno" }, 18 | interpreter_options = { 19 | Python3_fifo = { 20 | interpreter = "/usr/bin/python3", 21 | }, 22 | }, 23 | }) 24 | end, 25 | keys = { 26 | { 27 | "rl", 28 | "SnipRun", 29 | mode = { "n" }, 30 | desc = "SnipRun Line", 31 | }, 32 | { 33 | "rv", 34 | "SnipRun", 35 | mode = { "v" }, 36 | desc = "SnipRun Visual Selection", 37 | }, 38 | { 39 | "rc", 40 | "SnipClose", 41 | mode = { "n" }, 42 | desc = "Snip Close", 43 | }, 44 | { 45 | "rt", 46 | "SnipReset", 47 | mode = { "n" }, 48 | desc = "Snip Reset", 49 | }, 50 | }, 51 | } 52 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /lua/plugins/code-runner.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "CRAG666/code_runner.nvim", 3 | dependencies = { "nvim-lua/plenary.nvim" }, 4 | keys = { 5 | { "rr", "RunCode", desc = "Run Code" }, 6 | { "rq", "RunClose", desc = "Run Quite" }, 7 | { "", "RunClose", desc = "Run Quite" }, 8 | }, 9 | opts = { 10 | -- mode: Mode in which you want to run. Are supported: "better_term", "float", "tab", "toggleterm" (type: bool) 11 | mode = "term", 12 | -- Focus on runner window(only works on toggle, term and tab mode) 13 | focus = false, 14 | -- startinsert (see ':h inserting-ex') 15 | startinsert = false, 16 | term = { 17 | -- Position to open the terminal, this option is ignored if mode is tab 18 | position = "bot", 19 | -- window size, this option is ignored if tab is true 20 | size = 15, 21 | }, 22 | filetype = { 23 | c = "cd $dir && gcc $fileName -o $fileNameWithoutExt && $dir/$fileNameWithoutExt", 24 | go = "cd $dir && go run $fileName", 25 | python = "python -u", 26 | javascript = "node", 27 | java = "cd $dir && javac $fileName && java $fileNameWithoutExt", 28 | cpp = "cd $dir && g++ $fileName -o $fileNameWithoutExt && $dir/$fileNameWithoutExt", 29 | sh = "bash", 30 | rust = "cd $dir && rustc $fileName && $dir$fileNameWithoutExt", 31 | }, 32 | }, 33 | ft = { "lua", "python", "c", "cpp", "go", "rust" }, 34 | } 35 | -------------------------------------------------------------------------------- /lazyvim.json: -------------------------------------------------------------------------------- 1 | { 2 | "extras": [ 3 | "lazyvim.plugins.extras.ai.copilot", 4 | "lazyvim.plugins.extras.ai.copilot-chat", 5 | "lazyvim.plugins.extras.coding.mini-comment", 6 | "lazyvim.plugins.extras.dap.core", 7 | "lazyvim.plugins.extras.editor.fzf", 8 | "lazyvim.plugins.extras.editor.leap", 9 | "lazyvim.plugins.extras.editor.mini-diff", 10 | "lazyvim.plugins.extras.editor.neo-tree", 11 | "lazyvim.plugins.extras.editor.outline", 12 | "lazyvim.plugins.extras.formatting.prettier", 13 | "lazyvim.plugins.extras.lang.clangd", 14 | "lazyvim.plugins.extras.lang.cmake", 15 | "lazyvim.plugins.extras.lang.git", 16 | "lazyvim.plugins.extras.lang.go", 17 | "lazyvim.plugins.extras.lang.json", 18 | "lazyvim.plugins.extras.lang.markdown", 19 | "lazyvim.plugins.extras.lang.python", 20 | "lazyvim.plugins.extras.lang.rust", 21 | "lazyvim.plugins.extras.lang.sql", 22 | "lazyvim.plugins.extras.lang.toml", 23 | "lazyvim.plugins.extras.lang.yaml", 24 | "lazyvim.plugins.extras.test.core", 25 | "lazyvim.plugins.extras.ui.dashboard-nvim", 26 | "lazyvim.plugins.extras.ui.treesitter-context", 27 | "lazyvim.plugins.extras.util.dot", 28 | "lazyvim.plugins.extras.util.gitui", 29 | "lazyvim.plugins.extras.util.mini-hipatterns", 30 | "lazyvim.plugins.extras.util.startuptime" 31 | ], 32 | "install_version": 7, 33 | "news": { 34 | "NEWS.md": "11866" 35 | }, 36 | "version": 8 37 | } -------------------------------------------------------------------------------- /lua/plugins/colorschema.lua: -------------------------------------------------------------------------------- 1 | return { 2 | { 3 | "catppuccin/nvim", 4 | name = "catppuccin", 5 | opts = { 6 | flavour = "mocha", 7 | transparent_background = true, 8 | term_colors = true, 9 | }, 10 | }, 11 | -- { 12 | -- "folke/tokyonight.nvim", 13 | -- opts = { 14 | -- style = "night", 15 | -- }, 16 | -- }, 17 | -- { 18 | -- "ellisonleao/gruvbox.nvim", 19 | -- opts = { 20 | -- transparent_mode = true, 21 | -- contrast = "soft", 22 | -- invert_tabline = true, 23 | -- invert_selection = true, 24 | -- invert_intend_guides = true, 25 | -- overrides = { 26 | -- Normal = { fg = nil, bg = "#ebdbb2" }, 27 | -- }, 28 | -- }, 29 | -- }, 30 | -- { 31 | -- "dracula/vim", 32 | -- name = "dracula", 33 | -- }, 34 | { 35 | "Mofiqul/dracula.nvim", 36 | name = "dracula", 37 | opts = { 38 | transparent_bg = true, 39 | }, 40 | }, 41 | -- { 42 | -- "p00f/alabaster.nvim", 43 | -- name = "alabaster", 44 | -- }, 45 | -- { 46 | -- "maxmx03/solarized.nvim", 47 | -- }, 48 | { 49 | "LazyVim/LazyVim", 50 | opts = { 51 | -- colorscheme = "gruvbox", 52 | -- colorscheme = "tokyonight-day", 53 | -- colorscheme = "catppuccin-mocha", 54 | -- colorscheme = "gruvbox-material", 55 | -- colorscheme = "solarized" 56 | -- colorscheme = "dracula", 57 | -- colorscheme = "alabaster", 58 | -- colorscheme = "tokyonight-night", 59 | -- colorscheme = "tokyonight", 60 | colorscheme = "catppuccin", 61 | }, 62 | }, 63 | } 64 | -------------------------------------------------------------------------------- /lua/config/lazy.lua: -------------------------------------------------------------------------------- 1 | local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" 2 | 3 | if not (vim.uv or vim.loop).fs_stat(lazypath) then 4 | -- bootstrap lazy.nvim 5 | -- stylua: ignore 6 | vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath }) 7 | end 8 | vim.opt.rtp:prepend(vim.env.LAZY or lazypath) 9 | 10 | require("lazy").setup({ 11 | spec = { 12 | -- add LazyVim and import its plugins 13 | { "LazyVim/LazyVim", import = "lazyvim.plugins" }, 14 | { import = "plugins" }, 15 | }, 16 | defaults = { 17 | -- By default, only LazyVim plugins will be lazy-loaded. Your custom plugins will load during startup. 18 | -- If you know what you're doing, you can set this to `true` to have all your custom plugins lazy-loaded by default. 19 | lazy = false, 20 | -- It's recommended to leave version=false for now, since a lot the plugin that support versioning, 21 | -- have outdated releases, which may break your Neovim install. 22 | version = false, -- always use the latest git commit 23 | -- version = "*", -- try installing the latest stable version for plugins that support semver 24 | }, 25 | checker = { enabled = true }, -- automatically check for plugin updates 26 | performance = { 27 | rtp = { 28 | -- disable some rtp plugins 29 | disabled_plugins = { 30 | "gzip", 31 | -- "matchit", 32 | -- "matchparen", 33 | -- "netrwPlugin", 34 | "tarPlugin", 35 | "zipPlugin", 36 | "tohtml", 37 | "tutor", 38 | }, 39 | }, 40 | }, 41 | }) 42 | -------------------------------------------------------------------------------- /lua/config/keymaps.lua: -------------------------------------------------------------------------------- 1 | -- 将 Ctrl+l 映射到移至行首 2 | vim.api.nvim_set_keymap("i", "", "", { noremap = true, silent = true }) 3 | -- 将 Ctrl+a 映射到移至行第一个非空白字符处 4 | vim.api.nvim_set_keymap("i", "", [[:normal! ^\s*\]], { noremap = true, silent = true }) 5 | -- 将 Ctrl+e 映射到移至行尾 6 | vim.api.nvim_set_keymap("i", "", "", { noremap = true, silent = true }) 7 | 8 | -- window resize, 需要确保这快捷键没有被系统占用,否则无效 9 | vim.api.nvim_set_keymap("n", "", "res +2", { noremap = true, silent = true }) 10 | vim.api.nvim_set_keymap("n", "", "res -2", { noremap = true, silent = true }) 11 | vim.api.nvim_set_keymap("n", "", "vertical resize -2", { noremap = true, silent = true }) 12 | vim.api.nvim_set_keymap("n", "", "vertical resize +2", { noremap = true, silent = true }) 13 | 14 | -- 定义 toggle 函数 15 | _G.toggle_fmt_skip = function(start_line, end_line) 16 | local buf = 0 17 | for i = start_line, end_line do 18 | local line = vim.api.nvim_buf_get_lines(buf, i - 1, i, false)[1] 19 | if line:match("# fmt: skip%s*$") then 20 | -- 删除尾部 fmt: skip 21 | local new_line = line:gsub("%s*# fmt: skip%s*$", "") 22 | vim.api.nvim_buf_set_lines(buf, i - 1, i, false, { new_line }) 23 | else 24 | -- 添加尾部 fmt: skip 25 | vim.api.nvim_buf_set_lines(buf, i - 1, i, false, { line .. " # fmt: skip" }) 26 | end 27 | end 28 | end 29 | 30 | -- 普通模式 toggle 当前行 31 | vim.api.nvim_set_keymap( 32 | "n", 33 | "gcs", 34 | [[:lua _G.toggle_fmt_skip(vim.fn.line("."), vim.fn.line("."))]], 35 | { noremap = true, silent = true } 36 | ) 37 | 38 | vim.keymap.set("n", "ct", "TrimWhitespace", { 39 | desc = "Trim trailing whitespace", 40 | }) 41 | -------------------------------------------------------------------------------- /lua/plugins/noused/dap-python.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "mfussenegger/nvim-dap-python", 3 | config = function(_, _) 4 | require("dap-python").setup(os.getenv("MYPYTHON")) 5 | require("dap-python").resolve_python = function() 6 | return os.getenv("MYPYTHON") 7 | end 8 | -- require("dap-python").setup("/opt/homebrew/bin/python3.9") 9 | local crawler_env = { 10 | ["PYTHONPATH"] = ".:crawler", 11 | ["DEFAULT_ENV_FOR_DYNACONF"] = "default", 12 | ["ROOT_PATH_FOR_DYNACONF"] = "config", 13 | ["NEW_RELIC_ENVIRONMENT"] = "development", 14 | ["ENV_FOR_DYNACONF"] = "development", 15 | ["CONFIG_CENTER_DEBUG"] = "true", 16 | ["CONFIG_CENTER_ENV"] = "development", 17 | [os.getenv("KEY1")] = os.getenv("VALUE1"), 18 | [os.getenv("KEY2")] = os.getenv("VALUE2"), 19 | [os.getenv("KEY3")] = os.getenv("VALUE3"), 20 | [os.getenv("KEY4")] = os.getenv("VALUE4"), 21 | } 22 | table.insert(require("dap").configurations.python, { 23 | type = "python", 24 | request = "launch", 25 | name = "Debug Poll Main", 26 | cwd = os.getenv("CWD"), 27 | program = os.getenv("PROGRAM"), 28 | env = crawler_env, 29 | justMyCode = false, 30 | -- ... more options, see https://github.com/microsoft/debugpy/wiki/Debug-configuration-settings 31 | }) 32 | table.insert(require("dap").configurations.python, { 33 | type = "python", 34 | request = "launch", 35 | name = "Debug pytest cur file", 36 | module = "pytest", 37 | args = { "-vv", "${file}" }, 38 | env = crawler_env, 39 | justMyCode = false, 40 | }) 41 | table.insert(require("dap").configurations.python, { 42 | type = "python", 43 | request = "launch", 44 | name = "Debug scrapy runspider", 45 | module = "scrapy", 46 | args = { "runspider", "${file}" }, 47 | justMyCode = false, 48 | }) 49 | end, 50 | } 51 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # nvim 配置 2 | 3 | > 🚀 基于 [lazy.nvim](https://github.com/folke/lazy.nvim) 和 [LazyVim](https://github.com/LazyVim/LazyVim) 的现代 Neovim 配置,专为极致效率与舒适体验而打造! 4 | 5 | --- 6 | 7 | ## ✨ 特性亮点 8 | 9 | - **模块化插件管理**:所有自定义插件集中于 [`lua/plugins`](lua/plugins) 目录,官方插件锁定在 [`lazy-lock.json`](lazy-lock.json)。 10 | - **开箱即用的现代开发体验**:涵盖 LSP、代码格式化、项目管理、多光标编辑、终端集成等。 11 | - **多种配色方案**:支持 catppuccin、tokyonight、gruvbox、dracula、solarized 等主流主题,自动适配终端环境。 12 | - **高效键位映射**:常用操作一键直达,窗口/终端/多光标/代码运行等全覆盖。 13 | - **极简配置入口**:只需 `init.lua` 一行,轻松加载所有配置。 14 | 15 | --- 16 | 17 | ## 📦 插件一览(精选) 18 | 19 | - **LSP & 代码诊断** 20 | 21 | - [`nvim-lspconfig`](lua/plugins/nvim-lspconfig.lua):主流语言智能补全与诊断 22 | - [`diagflow`](lua/plugins/diagflow.lua):行内诊断提示,专注当前行 23 | - [`conform.nvim`](lua/plugins/conform.lua):自动格式化,支持 Python、Go 等 24 | 25 | - **项目与环境管理** 26 | 27 | - [`projectmgr.nvim`](lua/plugins/projects.lua):项目切换与会话管理 28 | - [`venv-selector.nvim`](lua/plugins/venv-select.lua):Python 虚拟环境一键切换 29 | 30 | - **多光标与文本操作** 31 | 32 | - [`multicursors.nvim`](lua/plugins/multicursors.lua):多光标编辑 33 | - [`vim-surround`](lua/plugins/surround.lua):快速包裹/修改括号引号 34 | - [`open-browser.vim`](lua/plugins/open-browser.lua):选中文本一键浏览器搜索 35 | 36 | - **代码运行与终端** 37 | 38 | - [`code_runner.nvim`](lua/plugins/code-runner.lua):多语言代码一键运行 39 | - [`winresizer`](lua/plugins/winresizer.lua):窗口大小随心调整 40 | 41 | - **Fuzzy Finder & Diff** 42 | 43 | - [`fzf-lua`](lua/plugins/fzf-lua.lua):极快模糊查找 44 | - [`diffview.nvim`](lua/plugins/diffview.lua):Git 变更可视化 45 | 46 | - **配色主题** 47 | - [`colorschema.lua`](lua/plugins/colorschema.lua):多主题切换,自动适配终端 48 | 49 | > 更多插件详见 [`lua/plugins`](lua/plugins) 目录,部分插件按需启用或已禁用,详见 [`disabled.lua`](lua/plugins/disabled.lua)。 50 | 51 | --- 52 | 53 | ## 🚀 快速开始 54 | 55 | 1. **克隆本仓库到你的 Neovim 配置目录** 56 | 57 | ```sh 58 | git clone ~/.config/nvim 59 | ``` 60 | -------------------------------------------------------------------------------- /lua/plugins/noused/printer.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "rareitems/printer.nvim", 3 | 4 | config = function() 5 | require("printer").setup({ 6 | keymap = "gp", -- Plugin doesn't have any keymaps by default 7 | behavior = "insert_below", -- how operator should behave 8 | formatters = { 9 | -- you can define your formatters for specific filetypes 10 | -- by assigning function that takes two strings 11 | -- one text modified by 'add_to_inside' function 12 | -- second the variable (thing) you want to print out 13 | -- see examples in lua/formatters.lua 14 | c = function(inside, variable) 15 | if string.find(inside, '"') ~= nil then 16 | return string.format("printf('%s: %%s\\n', %s);", inside, variable) 17 | else 18 | return string.format('printf("%s: %%s\\n", %s);', inside, variable) 19 | end 20 | end, 21 | go = function(text_inside, text_var) 22 | if string.find(text_inside, '"') ~= nil then 23 | return string.format("fmt.Println('%s = ', %s)", text_inside, text_var) 24 | else 25 | return string.format('fmt.Println("%s = ", %s)', text_inside, text_var) 26 | end 27 | end, 28 | python = function(inside, variable) 29 | if string.find(inside, '"') ~= nil then 30 | return string.format("print('%s: ', %s)", inside, variable) 31 | else 32 | return string.format('print("%s: ", %s)', inside, variable) 33 | end 34 | end, 35 | javascript = function(text_inside, text_var) 36 | if string.find(text_inside, '"') ~= nil then 37 | return string.format("console.log('%s = ', %s)", text_inside, text_var) 38 | else 39 | return string.format("console.log('%s = ', %s)", text_inside, text_var) 40 | end 41 | end, 42 | }, 43 | 44 | vim.keymap.set({ "n", "v" }, "gp", "(printer_below)", { desc = "Print Below" }), 45 | vim.keymap.set("n", "pw", "(printer_print)iw", { desc = "Print current word" }), 46 | vim.keymap.set("n", "pW", "(printer_print)iW", { desc = "Print current WORD" }), 47 | }) 48 | end, 49 | } 50 | -------------------------------------------------------------------------------- /lua/plugins/noused/telescope.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "nvim-telescope/telescope.nvim", 3 | dependencies = { 4 | { 5 | "nvim-telescope/telescope-live-grep-args.nvim", 6 | -- This will not install any breaking changes. 7 | -- For major updates, this must be adjusted manually. 8 | version = "^1.0.0", 9 | }, 10 | { 11 | "nvim-telescope/telescope-fzf-native.nvim", 12 | build = "make", 13 | config = function() 14 | require("telescope").load_extension("fzf") 15 | end, 16 | }, 17 | { 18 | "nvim-telescope/telescope-project.nvim", 19 | config = function() 20 | require("telescope").load_extension("project") 21 | end, 22 | }, 23 | }, 24 | config = function() 25 | local telescope = require("telescope") 26 | local lga_actions = require("telescope-live-grep-args.actions") 27 | telescope.setup({ 28 | defaults = { 29 | path_display = { shorten = { len = 2, exclude = { 1, 2, -1, -2 } } }, 30 | dynamic_preview_title = true, 31 | layout_config = { 32 | horizontal = { 33 | preview_width = 0.6, 34 | preview_cutoff = 30, 35 | }, 36 | width = { padding = 8 }, 37 | height = { padding = 2 }, 38 | }, 39 | }, 40 | extensions = { 41 | live_grep_args = { 42 | auto_quoting = true, -- enable/disable auto-quoting 43 | -- define mappings, e.g. 44 | mappings = { -- extend mappings 45 | i = { 46 | [""] = lga_actions.quote_prompt(), 47 | [""] = lga_actions.quote_prompt({ postfix = " --iglob " }), 48 | [""] = lga_actions.quote_prompt({ postfix = " -t " }), 49 | }, 50 | }, 51 | -- ... also accepts theme settings, for example: 52 | -- theme = "dropdown", -- use dropdown theme 53 | -- theme = { }, -- use own theme spec 54 | -- layout_config = { mirror=true }, -- mirror preview pane 55 | }, 56 | }, 57 | }) 58 | telescope.load_extension("live_grep_args") 59 | end, 60 | keys = { 61 | { 62 | "/", 63 | "lua require('telescope').extensions.live_grep_args.live_grep_args()", 64 | desc = "Live Grep With Args", 65 | }, 66 | { 67 | "sg", 68 | "lua require('telescope').extensions.live_grep_args.live_grep_args()", 69 | desc = "Live Grep With Args", 70 | }, 71 | { 72 | "fp", 73 | "Telescope project", 74 | desc = "Find projects", 75 | }, 76 | }, 77 | } 78 | -------------------------------------------------------------------------------- /lua/plugins/dashboard.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "nvimdev/dashboard-nvim", 3 | lazy = false, -- As https://github.com/nvimdev/dashboard-nvim/pull/450, dashboard-nvim shouldn't be lazy-loaded to properly handle stdin. 4 | opts = function() 5 | local logo = [[ 6 | 码码要洗手 7 | :) 8 | ]] 9 | 10 | logo = string.rep("\n", 8) .. logo .. "\n\n" 11 | 12 | local opts = { 13 | theme = "doom", 14 | hide = { 15 | -- this is taken care of by lualine 16 | -- enabling this messes up the actual laststatus setting after loading a file 17 | statusline = false, 18 | }, 19 | config = { 20 | header = vim.split(logo, "\n"), 21 | -- stylua: ignore 22 | center = { 23 | { action = 'lua LazyVim.pick()()', desc = " Find File", icon = " ", key = "f" }, 24 | { action = "ene | startinsert", desc = " New File", icon = " ", key = "n" }, 25 | { action = 'lua LazyVim.pick("oldfiles")()', desc = " Recent Files", icon = " ", key = "r" }, 26 | { action = 'lua LazyVim.pick("live_grep")()', desc = " Find Text", icon = " ", key = "g" }, 27 | { action = 'lua LazyVim.pick.config_files()()', desc = " Config", icon = " ", key = "c" }, 28 | { action = 'lua require("persistence").load()', desc = " Restore Session", icon = " ", key = "s" }, 29 | { action = "LazyExtras", desc = " Lazy Extras", icon = " ", key = "x" }, 30 | { action = "Lazy", desc = " Lazy", icon = "󰒲 ", key = "l" }, 31 | { action = function() vim.api.nvim_input("qa") end, desc = " Quit", icon = " ", key = "q" }, 32 | }, 33 | footer = function() 34 | local stats = require("lazy").stats() 35 | local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100) 36 | return { "⚡ Neovim loaded " .. stats.loaded .. "/" .. stats.count .. " plugins in " .. ms .. "ms" } 37 | end, 38 | }, 39 | } 40 | 41 | for _, button in ipairs(opts.config.center) do 42 | button.desc = button.desc .. string.rep(" ", 43 - #button.desc) 43 | button.key_format = " %s" 44 | end 45 | 46 | -- open dashboard after closing lazy 47 | if vim.o.filetype == "lazy" then 48 | vim.api.nvim_create_autocmd("WinClosed", { 49 | pattern = tostring(vim.api.nvim_get_current_win()), 50 | once = true, 51 | callback = function() 52 | vim.schedule(function() 53 | vim.api.nvim_exec_autocmds("UIEnter", { group = "dashboard" }) 54 | end) 55 | end, 56 | }) 57 | end 58 | 59 | return opts 60 | end, 61 | } 62 | --------------------------------------------------------------------------------