├── .gitignore ├── .graphqlrc.yml ├── .markdownlint.jsonc ├── .neoconf.json ├── .rgignore ├── .sqlfluff ├── .stylua.toml ├── .vscode ├── angular_launch.json ├── angular_tasks.json ├── chrome_launch.json ├── go_launch.json ├── nextjs_launch.json ├── node_launch.json ├── python_launch.json ├── rust_launch.json └── rust_tasks.json ├── README.md ├── after └── queries │ ├── lua │ └── highlights.scm │ ├── markdown │ ├── highlights.scm │ └── injections.scm │ └── styled │ └── highlights.scm ├── assets ├── imgs │ ├── bottom.png │ ├── homepage.png │ ├── lazygit.png │ ├── mysql_query.png │ ├── nvcheatsheet.png │ ├── tmux.png │ ├── tte.png │ ├── unimatrix.png │ ├── wezterm.png │ └── yazi.png └── videos │ └── tte.mp4 ├── buf.gen.yaml ├── buf.yaml ├── init.lua ├── lazy-lock.json ├── lua ├── lazy_setup.lua ├── mapping.lua ├── options.lua ├── plugins │ ├── astrocore.lua │ ├── astrolsp.lua │ ├── astroui.lua │ ├── auto-save.lua │ ├── avante.lua │ ├── blink-cmp.lua │ ├── blink.lua │ ├── bufferline.lua │ ├── colorschema.lua │ ├── comment.lua │ ├── conform.lua │ ├── dap.lua │ ├── diffview.lua │ ├── dropbar.lua │ ├── flash.lua │ ├── fzf.lua │ ├── git-blame.lua │ ├── grug-far.lua │ ├── helpview.lua │ ├── images.lua │ ├── live-server.lua │ ├── lualine.lua │ ├── mini-diff.lua │ ├── mini-pairs.lua │ ├── motlen.lua │ ├── neo-tree.lua │ ├── neotest.lua │ ├── noice.lua │ ├── nvim-highlight-colors.lua │ ├── nvim-lint.lua │ ├── nvim-surround.lua │ ├── overseer.lua │ ├── pack-angular.lua │ ├── pack-bash.lua │ ├── pack-docker.lua │ ├── pack-git.lua │ ├── pack-go.lua │ ├── pack-graphql.lua │ ├── pack-html-css.lua │ ├── pack-json.lua │ ├── pack-lua.lua │ ├── pack-markdown.lua │ ├── pack-prisma.lua │ ├── pack-proto.lua │ ├── pack-python.lua │ ├── pack-rust.lua │ ├── pack-sql.lua │ ├── pack-tailwindcss.lua │ ├── pack-thrift.lua │ ├── pack-toml.lua │ ├── pack-typescript.lua │ ├── pack-vue.lua │ ├── pack-xml.lua │ ├── pack-yaml.lua │ ├── rainbow-delimiters.lua │ ├── refactoring.lua │ ├── resession.lua │ ├── sleuth.lua │ ├── snacks.lua │ ├── trouble.lua │ ├── user.lua │ ├── visual-multi.lua │ ├── whick-key.lua │ └── yazi.lua ├── polish.lua └── utils │ ├── init.lua │ ├── lualine.lua │ └── ui.lua ├── mini_astronvim.lua ├── mini_lazyvim.lua ├── mini_template.lua ├── neovim.yml ├── prefs.toml ├── selene.toml └── snippets ├── Readme.md ├── angular17 ├── html.json ├── json.json └── typescript.json ├── angular18 ├── dockerfile.json ├── html.json ├── javascript.json ├── jsonc.json └── typescript.json ├── init ├── go.json ├── goctl.json ├── proto3.json ├── python.json ├── react.json ├── rust.json ├── solid.json └── vue.json ├── jinja ├── jinja-markdown.json ├── jinja-sql.json └── jinja-yaml.json ├── language-configuration-goctl.json └── package.json /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | .DS_Store 3 | .git 4 | -------------------------------------------------------------------------------- /.graphqlrc.yml: -------------------------------------------------------------------------------- 1 | schema: 'graph/*.graphqls' 2 | documents: 'packages/app/src/components/**/*.{tsx,ts}' 3 | extensions: 4 | endpoints: 5 | example: 6 | url: 'http://localhost:8000' 7 | -------------------------------------------------------------------------------- /.markdownlint.jsonc: -------------------------------------------------------------------------------- 1 | { 2 | "default": false, 3 | "MD003": false, 4 | "MD022": false, 5 | "MD007": { 6 | "indent": 4 7 | }, 8 | "MD013": false, 9 | "no-hard-tabs": false, 10 | "whitespace": false 11 | } 12 | -------------------------------------------------------------------------------- /.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 | "lspconfig": { 16 | "lua_ls": { 17 | "Lua.format.enable": false 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /.rgignore: -------------------------------------------------------------------------------- 1 | spell 2 | node_modules 3 | -------------------------------------------------------------------------------- /.sqlfluff: -------------------------------------------------------------------------------- 1 | # Reference: https://docs.sqlfluff.com/en/stable/rules.html 2 | [sqlfluff] 3 | dialect = bigquery 4 | templater = jinja 5 | # This change (from jinja to dbt templater) will make linting slower 6 | # because linting will first compile dbt code into data warehouse code. 7 | runaway_limit = 10 8 | max_line_length = 80 9 | indent_unit = space 10 | large_file_skip_byte_limit = 0 11 | exclude_rules = CP01,LT02,CV06,CV10,LT08,ST06,LT05,LT09,AM06,ST09,AL01,AL02,LT04,JJ01,LT01,RF02,LT13,AM04,RF05,L009 12 | ignore = templating 13 | 14 | [sqlfluff:indentation] 15 | tab_space_size = 4 16 | 17 | [sqlfluff:layout:type:comma] 18 | spacing_before = touch 19 | line_position = trailing 20 | 21 | [sqlfluff:rules:capitalisation.keywords] 22 | capitalisation_policy = lower 23 | 24 | [sqlfluff:rules:aliasing.table] 25 | aliasing = explicit 26 | 27 | [sqlfluff:rules:aliasing.column] 28 | aliasing = explicit 29 | 30 | [sqlfluff:rules:aliasing.expression] 31 | allow_scalar = False 32 | 33 | [sqlfluff:rules:capitalisation.identifiers] 34 | extended_capitalisation_policy = lower 35 | 36 | [sqlfluff:rules:capitalisation.functions] 37 | capitalisation_policy = lower 38 | 39 | [sqlfluff:rules:capitalisation.literals] 40 | capitalisation_policy = lower 41 | 42 | [sqlfluff:rules:ambiguous.column_references] # Number in group by 43 | group_by_and_order_by_style = implicit 44 | 45 | [sqlfluff:templater:jinja] 46 | apply_dbt_builtins = true 47 | 48 | [sqlfluff:templater:jinja:macros] 49 | # Macros provided as builtins for dbt projects 50 | dbt_ref = {% macro ref(model_ref) %}{{model_ref}}{% endmacro %} 51 | dbt_source = {% macro source(source_name, table) %}{{source_name}}_{{table}}{% endmacro %} 52 | dbt_config = {% macro config() %}{% for k in kwargs %}{% endfor %}{% endmacro %} 53 | dbt_var = {% macro var(variable, default='') %}item{% endmacro %} 54 | dbt_is_incremental = {% macro is_incremental() %}True{% endmacro %} 55 | 56 | -------------------------------------------------------------------------------- /.stylua.toml: -------------------------------------------------------------------------------- 1 | column_width = 120 2 | line_endings = "Unix" 3 | indent_type = "Spaces" 4 | indent_width = 2 5 | quote_style = "AutoPreferDouble" 6 | call_parentheses = "None" 7 | collapse_simple_statement = "Always" 8 | -------------------------------------------------------------------------------- /.vscode/angular_launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 3 | "version": "0.2.0", 4 | "configurations": [ 5 | { 6 | "name": "ng serve", 7 | "type": "pwa-chrome", 8 | "request": "launch", 9 | "preLaunchTask": "npm: start", 10 | "url": "http://localhost:4200/" 11 | }, 12 | { 13 | "name": "ng test", 14 | "type": "pwa-chrome", 15 | "request": "launch", 16 | "preLaunchTask": "npm: test", 17 | "url": "http://localhost:9876/debug.html" 18 | } 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /.vscode/angular_tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | // For more information, visit: https://go.microsoft.com/fwlink/?LinkId=733558 3 | "version": "2.0.0", 4 | "tasks": [ 5 | { 6 | "label": "npm: start", 7 | "type": "npm", 8 | "script": "start", 9 | "isBackground": true, 10 | "problemMatcher": { 11 | "owner": "typescript", 12 | "pattern": "$tsc", 13 | "background": { 14 | "activeOnStart": true, 15 | "beginsPattern": { 16 | "regexp": "(.*?)" 17 | }, 18 | "endsPattern": { 19 | "regexp": "bundle generation complete" 20 | } 21 | } 22 | } 23 | }, 24 | { 25 | "label": "npm: test", 26 | "type": "npm", 27 | "script": "test", 28 | "isBackground": true, 29 | "problemMatcher": { 30 | "owner": "typescript", 31 | "pattern": "$tsc", 32 | "background": { 33 | "activeOnStart": true, 34 | "beginsPattern": { 35 | "regexp": "(.*?)" 36 | }, 37 | "endsPattern": { 38 | "regexp": "bundle generation complete" 39 | } 40 | } 41 | } 42 | } 43 | ] 44 | } 45 | -------------------------------------------------------------------------------- /.vscode/chrome_launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "demo", 6 | "type": "pwa-chrome", 7 | "request": "launch", 8 | "url": "http://localhost:5173", 9 | "webRoot": "${workspaceFolder}", 10 | "protocol": "inspector", 11 | "sourceMaps": true, 12 | "skipFiles": [ 13 | "/**", 14 | "node_modules/**", 15 | "${workspaceFolder}/node_modules/**" 16 | ], 17 | "sourceMapPathOverrides": { 18 | "webpack:///src/*": "${webRoot}/*" 19 | } 20 | } 21 | ] 22 | } 23 | -------------------------------------------------------------------------------- /.vscode/go_launch.json: -------------------------------------------------------------------------------- 1 | // ${userHome} -用户的主文件夹路径 2 | // ${workspaceFolder} -在VS Code中打开的文件夹路径 3 | // ${workspaceFolderBasename} -在VS Code中打开的文件夹名,不带任何斜杠(/) 4 | // ${file} -当前打开的文件 5 | // ${fileWorkspaceFolder} -当前打开文件的工作空间文件夹 6 | // ${relativeFile} -当前打开的文件相对于工作区文件夹 7 | // ${relativeFileDirname} -当前打开的文件相对于工作区文件夹的dirname 8 | // ${fileBasename} -当前打开的文件的basename 9 | // ${fileBasenameNoExtension} -当前打开的文件的basename,没有文件扩展名 10 | // ${fileExtname} -当前打开的文件的扩展名 11 | // ${fileDirname} -当前打开文件的文件夹路径 12 | // ${fileDirnameBasename} -当前打开的文件的文件夹名称 13 | // ${cwd} -任务运行器在VS Code启动时的当前工作目录 14 | // ${lineNumber} -当前在活动文件中选择的行号 15 | // ${selectedText} -当前在活动文件中选择的文本 16 | // ${execPath}—正在运行的VS Code可执行文件的路径 17 | // ${defaultBuildTask} -默认构建任务的名称 18 | // ${pathSeparator} -操作系统用来分隔文件路径中组件的字符 19 | 20 | { 21 | "version": "0.2.0", 22 | "configurations": [ 23 | { 24 | "name": "demo", 25 | "type": "delve", 26 | "request": "launch", 27 | "mode": "debug", 28 | "program": "${workspaceFolder}/main.go", 29 | "env": {}, 30 | "args": [], 31 | "console": "integratedTerminal", 32 | "showLog": true, 33 | "cwd": "${workspaceFolder}" 34 | } 35 | ] 36 | } 37 | -------------------------------------------------------------------------------- /.vscode/nextjs_launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "Next.js: debug server-side", 6 | "type": "pwa-node", 7 | "request": "launch", 8 | "skipFiles": [ 9 | "/**" 10 | ], 11 | "console": "integratedTerminal", 12 | "cwd": "${workspaceFolder}", 13 | "runtimeExecutable": "npm", 14 | "runtimeArgs": [ 15 | "run-script", 16 | "dev" 17 | ] 18 | }, 19 | { 20 | "name": "Next.js: debug client-side", 21 | "type": "pwa-chrome", 22 | "request": "launch", 23 | "url": "http://localhost:3000" 24 | } 25 | ] 26 | } 27 | -------------------------------------------------------------------------------- /.vscode/node_launch.json: -------------------------------------------------------------------------------- 1 | // ${userHome} -用户的主文件夹路径 2 | // ${workspaceFolder} -在VS Code中打开的文件夹路径 3 | // ${workspaceFolderBasename} -在VS Code中打开的文件夹名,不带任何斜杠(/) 4 | // ${file} -当前打开的文件 5 | // ${fileWorkspaceFolder} -当前打开文件的工作空间文件夹 6 | // ${relativeFile} -当前打开的文件相对于工作区文件夹 7 | // ${relativeFileDirname} -当前打开的文件相对于工作区文件夹的dirname 8 | // ${fileBasename} -当前打开的文件的basename 9 | // ${fileBasenameNoExtension} -当前打开的文件的basename,没有文件扩展名 10 | // ${fileExtname} -当前打开的文件的扩展名 11 | // ${fileDirname} -当前打开文件的文件夹路径 12 | // ${fileDirnameBasename} -当前打开的文件的文件夹名称 13 | // ${cwd} -任务运行器在VS Code启动时的当前工作目录 14 | // ${lineNumber} -当前在活动文件中选择的行号 15 | // ${selectedText} -当前在活动文件中选择的文本 16 | // ${execPath}—正在运行的VS Code可执行文件的路径 17 | // ${defaultBuildTask} -默认构建任务的名称 18 | // ${pathSeparator} -操作系统用来分隔文件路径中组件的字符 19 | 20 | { 21 | "version": "0.2.0", 22 | "configurations": [ 23 | { 24 | "name": "demo", 25 | "type": "node", 26 | "request": "launch", 27 | "mode": "debug", 28 | "program": "${workspaceFolder}/index.js", 29 | "env": {}, 30 | "args": [], 31 | "console": "integratedTerminal", 32 | "showLog": true, 33 | "cwd": "${workspaceFolder}" 34 | } 35 | ] 36 | } 37 | -------------------------------------------------------------------------------- /.vscode/python_launch.json: -------------------------------------------------------------------------------- 1 | // ${userHome} -用户的主文件夹路径 2 | // ${workspaceFolder} -在VS Code中打开的文件夹路径 3 | // ${workspaceFolderBasename} -在VS Code中打开的文件夹名,不带任何斜杠(/) 4 | // ${file} -当前打开的文件 5 | // ${fileWorkspaceFolder} -当前打开文件的工作空间文件夹 6 | // ${relativeFile} -当前打开的文件相对于工作区文件夹 7 | // ${relativeFileDirname} -当前打开的文件相对于工作区文件夹的dirname 8 | // ${fileBasename} -当前打开的文件的basename 9 | // ${fileBasenameNoExtension} -当前打开的文件的basename,没有文件扩展名 10 | // ${fileExtname} -当前打开的文件的扩展名 11 | // ${fileDirname} -当前打开文件的文件夹路径 12 | // ${fileDirnameBasename} -当前打开的文件的文件夹名称 13 | // ${cwd} -任务运行器在VS Code启动时的当前工作目录 14 | // ${lineNumber} -当前在活动文件中选择的行号 15 | // ${selectedText} -当前在活动文件中选择的文本 16 | // ${execPath}—正在运行的VS Code可执行文件的路径 17 | // ${defaultBuildTask} -默认构建任务的名称 18 | // ${pathSeparator} -操作系统用来分隔文件路径中组件的字符 19 | { 20 | "version": "0.2.0", 21 | "configurations": [ 22 | { 23 | "name": "demo", 24 | "type": "python", 25 | "request": "launch", 26 | "mode": "debug", 27 | "program": "${workspaceFolder}/main.py", 28 | "env": {}, 29 | "args": [], 30 | "console": "integratedTerminal", 31 | "showLog": true, 32 | "cwd": "${workspaceFolder}", 33 | "justMyCode": false 34 | } 35 | ] 36 | } 37 | -------------------------------------------------------------------------------- /.vscode/rust_launch.json: -------------------------------------------------------------------------------- 1 | // ${userHome} -用户的主文件夹路径 2 | // ${workspaceFolder} -在VS Code中打开的文件夹路径 3 | // ${workspaceFolderBasename} -在VS Code中打开的文件夹名,不带任何斜杠(/) 4 | // ${file} -当前打开的文件 5 | // ${fileWorkspaceFolder} -当前打开文件的工作空间文件夹 6 | // ${relativeFile} -当前打开的文件相对于工作区文件夹 7 | // ${relativeFileDirname} -当前打开的文件相对于工作区文件夹的dirname 8 | // ${fileBasename} -当前打开的文件的basename 9 | // ${fileBasenameNoExtension} -当前打开的文件的basename,没有文件扩展名 10 | // ${fileExtname} -当前打开的文件的扩展名 11 | // ${fileDirname} -当前打开文件的文件夹路径 12 | // ${fileDirnameBasename} -当前打开的文件的文件夹名称 13 | // ${cwd} -任务运行器在VS Code启动时的当前工作目录 14 | // ${lineNumber} -当前在活动文件中选择的行号 15 | // ${selectedText} -当前在活动文件中选择的文本 16 | // ${execPath}—正在运行的VS Code可执行文件的路径 17 | // ${defaultBuildTask} -默认构建任务的名称 18 | // ${pathSeparator} -操作系统用来分隔文件路径中组件的字符 19 | { 20 | "version": "0.2.0", 21 | "configurations": [ 22 | { 23 | "name": "demo", 24 | "type": "codelldb", 25 | "request": "launch", 26 | "program": "${workspaceFolder}/target/debug/${workspaceFolderBasename}", 27 | "mode": "debug", 28 | "args": [], 29 | "stopAtEntry": false, 30 | "cwd": "${workspaceFolder}", 31 | "environment": [], 32 | "preLaunchTask": "cargo build", 33 | "externalConsole": true, 34 | "expressions": "simple", 35 | "preRunCommands": [ 36 | "command script import ~/.local/share/nvim/lazy/rust-prettifier-for-lldb/rust_prettifier_for_lldb.py" 37 | ] 38 | }, 39 | { 40 | "name": "tauri backend", 41 | "type": "codelldb", 42 | "request": "launch", 43 | "program": "${workspaceFolder}/src-tauri/target/debug/${workspaceFolderBasename}", 44 | "mode": "debug", 45 | "args": [], 46 | "stopAtEntry": false, 47 | "cwd": "${workspaceFolder}/src-tauri", 48 | "environment": [], 49 | "preLaunchTask": "tauri backend build", 50 | "externalConsole": true, 51 | "expressions": "simple", 52 | "preRunCommands": [ 53 | "command script import ~/.local/share/nvim/lazy/rust-prettifier-for-lldb/rust_prettifier_for_lldb.py" 54 | ] 55 | }, 56 | { 57 | "name": "tauri development debug", 58 | "type": "codelldb", 59 | "request": "launch", 60 | "program": "${workspaceFolder}/src-tauri/target/debug/${workspaceFolderBasename}", 61 | "cwd": "${workspaceFolder}", 62 | "mode": "debug", 63 | // task for the `beforeDevCommand` if used, must be configured in `.vscode/tasks.json` 64 | "preLaunchTask": "ui:dev" 65 | }, 66 | { 67 | "name": "tauri production debug", 68 | "type": "codelldb", 69 | "request": "launch", 70 | "program": "${workspaceFolder}/target/debug/${workspaceFolderBasename}", 71 | "mode": "debug", 72 | // task for the `beforeBuildCommand` if used, must be configured in `.vscode/tasks.json` 73 | "preLaunchTask": "ui:build" 74 | } 75 | ] 76 | } 77 | -------------------------------------------------------------------------------- /.vscode/rust_tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | // See https://go.microsoft.com/fwlink/?LinkId=733558 3 | // for the documentation about the tasks.json format 4 | "version": "2.0.0", 5 | "tasks": [ 6 | { 7 | "label": "cargo build", 8 | "type": "shell", 9 | "command": "cargo build", 10 | "group": { 11 | "kind": "build", 12 | "isDefault": true 13 | } 14 | }, 15 | { 16 | "label": "tauri backend build", 17 | "type": "shell", 18 | "command": "cd src-tauri && cargo build", 19 | "group": { 20 | "kind": "build", 21 | "isDefault": true 22 | } 23 | }, 24 | { 25 | "label": "ui:dev", 26 | "type": "shell", 27 | // `dev` keeps running in the background 28 | // ideally you should also configure a `problemMatcher` 29 | // see https://code.visualstudio.com/docs/editor/tasks#_can-a-background-task-be-used-as-a-prelaunchtask-in-launchjson 30 | "isBackground": true, 31 | // change this to your `beforeDevCommand`: 32 | "command": "yarn", 33 | "args": [ 34 | "dev" 35 | ] 36 | }, 37 | { 38 | "label": "ui:build", 39 | "type": "shell", 40 | // change this to your `beforeBuildCommand`: 41 | "command": "yarn", 42 | "args": [ 43 | "build" 44 | ] 45 | } 46 | ] 47 | } 48 | -------------------------------------------------------------------------------- /after/queries/lua/highlights.scm: -------------------------------------------------------------------------------- 1 | ;; extends 2 | 3 | ((identifier) @namespace.builtin 4 | (#eq? @namespace.builtin "vim")) 5 | -------------------------------------------------------------------------------- /after/queries/markdown/highlights.scm: -------------------------------------------------------------------------------- 1 | ;; extends 2 | ((inline) @_inline (#match? @_inline "^\(import\|export\)")) @nospell 3 | 4 | ; offset and table chars courtesy of `megalithic`: 5 | ; https://github.com/megalithic/dotfiles/blob/39aa5fcefaa4d68cce66b6de425311e47c2d54fb/config/nvim/after/queries/markdown/highlights.scm#L45-L64 6 | 7 | ; list markers/bullet points 8 | ( 9 | ([ 10 | (list_marker_star) 11 | (list_marker_plus) 12 | (list_marker_minus) 13 | ]) @markdown_list_marker 14 | (#offset! @markdown_list_marker 0 0 0 -1) 15 | (#set! conceal "•") 16 | ) 17 | 18 | ; checkboxes 19 | ((task_list_marker_unchecked) @markdown_check_undone (#set! conceal "󰄱")) 20 | ((task_list_marker_checked) @markdown_check_done (#set! conceal "󰄵")) 21 | 22 | ; box drawing characters for tables 23 | (pipe_table_header ("|") @punctuation.special @conceal (#set! conceal "│")) 24 | (pipe_table_delimiter_row ("|") @punctuation.special @conceal (#set! conceal "│")) 25 | (pipe_table_delimiter_cell ("-") @punctuation.special @conceal (#set! conceal "─")) 26 | (pipe_table_row ("|") @punctuation.special @conceal (#set! conceal "│")) 27 | 28 | ; block quotes 29 | ((block_quote_marker) @markdown_quote_marker (#set! conceal "▍")) 30 | ((block_quote 31 | (paragraph (inline 32 | (block_continuation) @markdown_quote_marker (#set! conceal "▍") 33 | )) 34 | )) 35 | 36 | ; (fenced_code_block 37 | ; (info_string) @devicon 38 | ; (#as_devicon! @devicon)) 39 | 40 | ( 41 | fenced_code_block (fenced_code_block_delimiter) @markdown_code_block_marker 42 | (#set! conceal "") 43 | ) 44 | ( 45 | [(info_string (language))] @markdown_code_block_lang_javascript 46 | (#any-of? @markdown_code_block_lang_javascript "javascript" "js" "node") 47 | (#set! conceal "") 48 | ) 49 | ( 50 | [(info_string (language))] @markdown_code_block_lang_typescript 51 | (#any-of? @markdown_code_block_lang_typescript "typescript" "ts") 52 | (#set! conceal "") 53 | ) 54 | ( 55 | [(info_string (language))] @markdown_code_block_lang_json 56 | (#any-of? @markdown_code_block_lang_json "json" "jsonc") 57 | (#set! conceal "") 58 | ) 59 | ( 60 | [(info_string (language))] @markdown_code_block_lang_bash 61 | (#any-of? @markdown_code_block_lang_bash "bash" "sh" "shell" "zsh") 62 | (#set! conceal "") 63 | ) 64 | ( 65 | [(info_string (language))] @markdown_code_block_lang_julia 66 | (#eq? @markdown_code_block_lang_julia "julia") 67 | (#set! conceal "") 68 | ) 69 | ( 70 | [(info_string (language))] @markdown_code_block_lang_lua 71 | (#eq? @markdown_code_block_lang_lua "lua") 72 | (#set! conceal "") 73 | ) 74 | ( 75 | [(info_string (language))] @markdown_code_block_lang_python 76 | (#any-of? @markdown_code_block_lang_python "python" "python3") 77 | (#set! conceal "") 78 | ) 79 | ( 80 | [(info_string (language))] @markdown_code_block_lang_diff 81 | (#eq? @markdown_code_block_lang_diff "diff") 82 | (#set! conceal "") 83 | ) 84 | ( 85 | [(info_string (language))] @markdown_code_block_lang_vim 86 | (#eq? @markdown_code_block_lang_vim "vim") 87 | (#set! conceal "") 88 | ) 89 | ( 90 | [(info_string (language))] @markdown_code_block_lang_md 91 | (#any-of? @markdown_code_block_lang_md "markdown" "md" "pandoc") 92 | (#set! conceal "") 93 | ) 94 | ( 95 | [(info_string (language))] @markdown_code_block_lang_yaml 96 | (#any-of? @markdown_code_block_lang_yaml "yaml" "yml") 97 | (#set! conceal "") 98 | ) 99 | ( 100 | [(info_string (language))] @markdown_code_block_lang_toml 101 | (#eq? @markdown_code_block_lang_toml "toml") 102 | (#set! conceal "") 103 | ) 104 | ( 105 | [(info_string (language))] @markdown_code_block_lang_java 106 | (#eq? @markdown_code_block_lang_java "java") 107 | (#set! conceal "") 108 | ) 109 | ( 110 | [(info_string (language))] @markdown_code_block_lang_html 111 | (#eq? @markdown_code_block_lang_html "xhtml") 112 | (#set! conceal "") 113 | ) 114 | ( 115 | [(info_string (language))] @markdown_code_block_lang_css 116 | (#eq? @markdown_code_block_lang_css "css") 117 | (#set! conceal "") 118 | ) 119 | ( 120 | [(info_string (language))] @markdown_code_block_lang_sql 121 | (#eq? @markdown_code_block_lang_sql "sql") 122 | (#set! conceal "") 123 | ) 124 | -------------------------------------------------------------------------------- /after/queries/markdown/injections.scm: -------------------------------------------------------------------------------- 1 | ;; extends 2 | ((((inline) @_inline (#match? @_inline "^\(import\|export\)"))) @injection.content (#set! injection.language "tsx")) 3 | -------------------------------------------------------------------------------- /after/queries/styled/highlights.scm: -------------------------------------------------------------------------------- 1 | ; extends 2 | 3 | (plain_value) @identifier 4 | (js_expression) @identifier 5 | (js_comment) @comment @spell 6 | -------------------------------------------------------------------------------- /assets/imgs/bottom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chaozwn/astronvim_user/caa2c6c4ac07fa84407c1a183e388f86873c5504/assets/imgs/bottom.png -------------------------------------------------------------------------------- /assets/imgs/homepage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chaozwn/astronvim_user/caa2c6c4ac07fa84407c1a183e388f86873c5504/assets/imgs/homepage.png -------------------------------------------------------------------------------- /assets/imgs/lazygit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chaozwn/astronvim_user/caa2c6c4ac07fa84407c1a183e388f86873c5504/assets/imgs/lazygit.png -------------------------------------------------------------------------------- /assets/imgs/mysql_query.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chaozwn/astronvim_user/caa2c6c4ac07fa84407c1a183e388f86873c5504/assets/imgs/mysql_query.png -------------------------------------------------------------------------------- /assets/imgs/nvcheatsheet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chaozwn/astronvim_user/caa2c6c4ac07fa84407c1a183e388f86873c5504/assets/imgs/nvcheatsheet.png -------------------------------------------------------------------------------- /assets/imgs/tmux.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chaozwn/astronvim_user/caa2c6c4ac07fa84407c1a183e388f86873c5504/assets/imgs/tmux.png -------------------------------------------------------------------------------- /assets/imgs/tte.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chaozwn/astronvim_user/caa2c6c4ac07fa84407c1a183e388f86873c5504/assets/imgs/tte.png -------------------------------------------------------------------------------- /assets/imgs/unimatrix.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chaozwn/astronvim_user/caa2c6c4ac07fa84407c1a183e388f86873c5504/assets/imgs/unimatrix.png -------------------------------------------------------------------------------- /assets/imgs/wezterm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chaozwn/astronvim_user/caa2c6c4ac07fa84407c1a183e388f86873c5504/assets/imgs/wezterm.png -------------------------------------------------------------------------------- /assets/imgs/yazi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chaozwn/astronvim_user/caa2c6c4ac07fa84407c1a183e388f86873c5504/assets/imgs/yazi.png -------------------------------------------------------------------------------- /assets/videos/tte.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chaozwn/astronvim_user/caa2c6c4ac07fa84407c1a183e388f86873c5504/assets/videos/tte.mp4 -------------------------------------------------------------------------------- /buf.gen.yaml: -------------------------------------------------------------------------------- 1 | version: v2 2 | 3 | plugins: 4 | - local: protoc-gen-go 5 | out: ../ 6 | -------------------------------------------------------------------------------- /buf.yaml: -------------------------------------------------------------------------------- 1 | version: v2 2 | 3 | name: buf.build/tutorials/lint 4 | breaking: 5 | use: 6 | - FILE 7 | lint: 8 | use: 9 | - DEFAULT 10 | except: 11 | - SERVICE_SUFFIX 12 | - FIELD_LOWER_SNAKE_CASE 13 | - PACKAGE_LOWER_SNAKE_CASE 14 | - PACKAGE_SAME_SWIFT_PREFIX 15 | - PACKAGE_VERSION_SUFFIX 16 | - ENUM_NO_ALLOW_ALIAS 17 | - BASIC 18 | - RPC_REQUEST_STANDARD_NAME 19 | - RPC_RESPONSE_STANDARD_NAME 20 | 21 | deps: 22 | - buf.build/bufbuild/protovalidate 23 | -------------------------------------------------------------------------------- /init.lua: -------------------------------------------------------------------------------- 1 | -- This file simply bootstraps the installation of Lazy.nvim and then calls other files for execution 2 | -- This file doesn't necessarily need to be touched, BE CAUTIOUS editing this file and proceed at your own risk. 3 | local lazypath = vim.env.LAZY or vim.fn.stdpath "data" .. "/lazy/lazy.nvim" 4 | if not (vim.env.LAZY or (vim.uv or vim.loop).fs_stat(lazypath)) then 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(lazypath) 9 | 10 | -- validate that lazy is available 11 | if not pcall(require, "lazy") then 12 | -- stylua: ignore 13 | vim.api.nvim_echo({ { ("Unable to load lazy from: %s\n"):format(lazypath), "ErrorMsg" }, { "Press any key to exit...", "MoreMsg" } }, true, {}) 14 | vim.fn.getchar() 15 | vim.cmd.quit() 16 | end 17 | 18 | require "options" 19 | require "lazy_setup" 20 | require "polish" 21 | -------------------------------------------------------------------------------- /lua/lazy_setup.lua: -------------------------------------------------------------------------------- 1 | require("lazy").setup({ 2 | { 3 | "AstroNvim/AstroNvim", 4 | -- version = "^4", -- Remove version tracking to elect for nighly AstroNvim 5 | branch = "v5", 6 | import = "astronvim.plugins", 7 | opts = { -- AstroNvim options must be set here with the `import` key 8 | mapleader = " ", -- This ensures the leader key must be configured before Lazy is set up 9 | maplocalleader = " ", -- This ensures the localleader key must be configured before Lazy is set up 10 | icons_enabled = true, -- Set to false to disable icons (if no Nerd Font is available) 11 | pin_plugins = true, -- Default will pin plugins when tracking `version` of AstroNvim, set to true/false to override 12 | }, 13 | }, 14 | { import = "plugins" }, 15 | } --[[@as LazySpec]], { 16 | ui = { backdrop = 100 }, 17 | performance = { 18 | rtp = { 19 | -- disable some rtp plugins, add more to your liking 20 | disabled_plugins = { 21 | "gzip", 22 | "netrwPlugin", 23 | "tarPlugin", 24 | "tohtml", 25 | "zipPlugin", 26 | }, 27 | }, 28 | }, 29 | } --[[@as LazyConfig]]) 30 | -------------------------------------------------------------------------------- /lua/mapping.lua: -------------------------------------------------------------------------------- 1 | local M = {} 2 | 3 | function M.core_mappings(mappings) 4 | if not mappings then mappings = require("astrocore").empty_map_table() end 5 | local maps = mappings 6 | if maps then 7 | maps.n["n"] = false 8 | maps.n["s"] = { desc = require("astroui").get_icon("GrugFar", 1, true) .. "Search" } 9 | maps.v["s"] = { desc = require("astroui").get_icon("GrugFar", 1, true) .. "Search" } 10 | 11 | maps.n.n = { require("utils").better_search "n", desc = "Next search" } 12 | maps.n.N = { require("utils").better_search "N", desc = "Previous search" } 13 | 14 | maps.v["K"] = { ":move '<-2gv-gv", desc = "Move line up", silent = true } 15 | maps.v["J"] = { ":move '>+1gv-gv", desc = "Move line down", silent = true } 16 | 17 | maps.n["n"] = { "nzz" } 18 | maps.n["N"] = { "Nzz" } 19 | 20 | -- close search highlight 21 | maps.n["nh"] = { ":nohlsearch", desc = "Close search highlight", silent = true } 22 | 23 | maps.n["H"] = { "^", desc = "Go to start without blank" } 24 | maps.n["L"] = { "$", desc = "Go to end without blank" } 25 | 26 | maps.v["<"] = { ""] = { ">gv", desc = "Indent line" } 28 | 29 | -- 在visual mode 里粘贴不要复制 30 | maps.n["x"] = { '"_x', desc = "Cut without copy" } 31 | 32 | -- lsp restart 33 | maps.n["lm"] = { "LspRestart", desc = "Lsp restart" } 34 | maps.n["lg"] = { "LspLog", desc = "Show lsp log" } 35 | 36 | if vim.fn.executable "lazygit" == 1 then 37 | maps.n["tl"] = { 38 | require("snacks.lazygit").open, 39 | desc = "ToggleTerm lazygit", 40 | } 41 | end 42 | 43 | if vim.fn.executable "btm" == 1 then 44 | maps.n["tt"] = { 45 | require("utils").toggle_btm(), 46 | desc = "ToggleTerm btm", 47 | } 48 | end 49 | 50 | maps.n["th"] = { require("snacks.terminal").toggle, desc = "ToggleTerm horizontal split" } 51 | maps.n[""] = { require("snacks.terminal").toggle, desc = "Toggle terminal" } -- requires terminal that supports binding 52 | maps.t[""] = { require("snacks.terminal").toggle, desc = "Toggle terminal" } -- requires terminal that supports binding 53 | 54 | -- window 55 | local get_icon = require("astroui").get_icon 56 | maps.n["w"] = { name = get_icon("Window", 1, true) .. "Window" } 57 | maps.n["wc"] = { "c", desc = "Close current screen" } 58 | maps.n["wo"] = { "o", desc = "Close other screen" } 59 | maps.n["we"] = { "=", desc = "Equals All Window" } 60 | end 61 | 62 | return maps 63 | end 64 | 65 | function M.lsp_mappings(mappings) 66 | if not mappings then mappings = require("astrocore").empty_map_table() end 67 | local maps = mappings 68 | if maps then 69 | maps.n["gK"] = false 70 | maps.n["gk"] = maps.n["lh"] 71 | end 72 | return maps 73 | end 74 | 75 | return M 76 | -------------------------------------------------------------------------------- /lua/options.lua: -------------------------------------------------------------------------------- 1 | vim.opt.fillchars = { 2 | foldopen = "", 3 | foldclose = "", 4 | fold = " ", 5 | foldsep = " ", 6 | diff = "╱", 7 | eob = " ", 8 | } 9 | vim.opt.conceallevel = 2 10 | vim.opt.list = false 11 | vim.opt.listchars = { tab = "│→", extends = "⟩", precedes = "⟨", trail = "·", nbsp = "␣" } 12 | vim.opt.showbreak = "↪ " 13 | vim.opt.splitkeep = "screen" 14 | vim.opt.swapfile = false 15 | vim.opt.wrap = true 16 | vim.opt.scrolloff = 5 17 | vim.opt.winwidth = 10 18 | vim.opt.winminwidth = 10 19 | vim.opt.equalalways = false 20 | vim.opt.statuscolumn = [[%!v:lua.require'snacks.statuscolumn'.get()]] 21 | 22 | vim.g.autoformat = false 23 | vim.g.trouble_lualine = true 24 | vim.o.laststatus = 3 25 | 26 | if vim.fn.has "nvim-0.10" == 1 then 27 | vim.opt.smoothscroll = true 28 | vim.opt.foldexpr = "v:lua.require'utils.ui'.foldexpr()" 29 | vim.opt.foldmethod = "expr" 30 | vim.opt.foldtext = "" 31 | else 32 | vim.opt.foldmethod = "indent" 33 | vim.opt.foldtext = "v:lua.require'utils.ui'.foldtext()" 34 | end 35 | -------------------------------------------------------------------------------- /lua/plugins/astrocore.lua: -------------------------------------------------------------------------------- 1 | ---@type LazySpec 2 | return { 3 | "AstroNvim/astrocore", 4 | version = false, 5 | branch = "v2", 6 | ---@type AstroCoreOpts 7 | ---@diagnostic disable-next-line: assign-type-mismatch 8 | opts = function(_, opts) 9 | local mappings = require("mapping").core_mappings(opts.mappings) 10 | local utils = require "utils" 11 | 12 | return vim.tbl_deep_extend("force", opts, { 13 | -- Configure core features of AstroNvim 14 | features = { 15 | large_buf = { size = 1024 * 1024 * 1.5, lines = 10000 }, -- set global limits for large files for disabling features like treesitter 16 | autopairs = false, -- enable autopairs at start 17 | cmp = false, -- enable completion at start 18 | diagnostics_mode = 3, -- diagnostic mode on start (0 = off, 1 = no signs/virtual text, 2 = no virtual text, 3 = on) 19 | highlighturl = true, -- highlight URLs at start 20 | notifications = true, -- enable notifications at start 21 | }, 22 | -- Diagnostics configuration (for vim.diagnostics.config({...})) when diagnostics are on 23 | diagnostics = { 24 | -- Diagnostics configuration (for vim.diagnostics.config({...})) when diagnostics are on 25 | virtual_text = { 26 | prefix = "", 27 | }, 28 | update_in_insert = false, 29 | underline = true, 30 | }, 31 | filetypes = { 32 | extension = { 33 | mdx = "markdown.mdx", 34 | qmd = "markdown", 35 | yml = utils.yaml_ft, 36 | yaml = utils.yaml_ft, 37 | json = "jsonc", 38 | MD = "markdown", 39 | tpl = "gotmpl", 40 | }, 41 | filename = { 42 | [".eslintrc.json"] = "jsonc", 43 | ["vimrc"] = "vim", 44 | }, 45 | pattern = { 46 | ["/tmp/neomutt.*"] = "markdown", 47 | ["tsconfig*.json"] = "jsonc", 48 | [".*/%.vscode/.*%.json"] = "jsonc", 49 | [".*/waybar/config"] = "jsonc", 50 | [".*/mako/config"] = "dosini", 51 | [".*/kitty/.+%.conf"] = "kitty", 52 | [".*/hypr/.+%.conf"] = "hyprlang", 53 | ["%.env%.[%w_.-]+"] = "sh", 54 | }, 55 | }, 56 | autocmds = { 57 | auto_close_molten_output = { 58 | { 59 | event = "FileType", 60 | pattern = { "molten_output" }, 61 | callback = function(event) 62 | vim.bo[event.buf].buflisted = false 63 | vim.schedule(function() 64 | vim.keymap.set("n", "q", function() vim.cmd "MoltenHideOutput" end, { 65 | buffer = event.buf, 66 | silent = true, 67 | desc = "Quit buffer", 68 | }) 69 | end) 70 | end, 71 | }, 72 | }, 73 | auto_close_dadbod_output = { 74 | { 75 | event = "FileType", 76 | pattern = { "dbout" }, 77 | callback = function(event) 78 | vim.bo[event.buf].buflisted = false 79 | vim.schedule(function() 80 | vim.keymap.set("n", "q", function() vim.cmd "q!" end, { 81 | buffer = event.buf, 82 | silent = true, 83 | desc = "Quit buffer", 84 | }) 85 | end) 86 | end, 87 | }, 88 | }, 89 | }, 90 | -- Mappings can be configured through AstroCore as well. 91 | -- NOTE: keycodes follow the casing in the vimdocs. For example, `` must be capitalized 92 | mappings = mappings, 93 | }) 94 | end, 95 | } 96 | -------------------------------------------------------------------------------- /lua/plugins/astrolsp.lua: -------------------------------------------------------------------------------- 1 | ---@type LazySpec 2 | return { 3 | "AstroNvim/astrolsp", 4 | version = false, 5 | branch = "v3", 6 | ---@type AstroLSPOpts 7 | ---@diagnostic disable-next-line: assign-type-mismatch 8 | opts = function(_, opts) 9 | local mappings = require("mapping").lsp_mappings(opts.mappings) 10 | return vim.tbl_deep_extend("force", opts, { 11 | -- Configuration table of features provided by AstroLSP 12 | features = { 13 | codelens = true, -- enable/disable codelens refresh on start 14 | inlay_hints = false, -- enable/disable inlay hints on start 15 | semantic_tokens = true, -- enable/disable semantic token highlighting 16 | }, 17 | -- enable servers that you already have installed without mason 18 | servers = {}, 19 | -- customize language server configuration options passed to `lspconfig` 20 | ---@diagnostic disable: missing-fields 21 | config = { 22 | -- clangd = { capabilities = { offsetEncoding = "utf-8" } }, 23 | }, 24 | -- customize how language servers are attached 25 | handlers = { 26 | -- a function without a key is simply the default handler, functions take two parameters, the server name and the configured options table for that server 27 | -- function(server, opts) require("lspconfig")[server].setup(opts) end 28 | 29 | -- the key is the server that is being setup with `lspconfig` 30 | -- rust_analyzer = false, -- setting a handler to false will disable the set up of that language server 31 | -- pyright = function(_, opts) require("lspconfig").pyright.setup(opts) end -- or a custom handler function can be passed 32 | }, 33 | -- Configure buffer local auto commands to add when attaching a language server 34 | autocmds = {}, 35 | -- mappings to be set up on attaching of a language server 36 | mappings = mappings, 37 | -- A custom `on_attach` function to be run after the default `on_attach` function 38 | -- takes two parameters `client` and `bufnr` (`:h lspconfig-setup`) 39 | on_attach = function(client, bufnr) 40 | -- this would disable semanticTokensProvider for all clients 41 | end, 42 | }) 43 | end, 44 | } 45 | -------------------------------------------------------------------------------- /lua/plugins/astroui.lua: -------------------------------------------------------------------------------- 1 | ---@type LazySpec 2 | return { 3 | "AstroNvim/astroui", 4 | version = false, 5 | branch = "v3", 6 | ---@type AstroUIOpts 7 | opts = { 8 | -- change colorscheme 9 | colorscheme = "tokyonight-moon", 10 | highlights = {}, 11 | }, 12 | } 13 | -------------------------------------------------------------------------------- /lua/plugins/auto-save.lua: -------------------------------------------------------------------------------- 1 | ---@type LazySpec 2 | return { 3 | "chaozwn/auto-save.nvim", 4 | event = { "User AstroFile", "InsertEnter" }, 5 | opts = { 6 | debounce_delay = 3000, 7 | print_enabled = false, 8 | trigger_events = { "TextChanged", "InsertLeave" }, 9 | condition = function(buf) 10 | local fn = vim.fn 11 | local utils = require "auto-save.utils.data" 12 | 13 | if fn.getbufvar(buf, "&modifiable") == 1 and utils.not_in(fn.getbufvar(buf, "&filetype"), {}) then 14 | -- check weather not in normal mode 15 | if fn.mode() ~= "n" then 16 | return false 17 | else 18 | return true 19 | end 20 | end 21 | return false -- can't save 22 | end, 23 | }, 24 | config = function(_, opts) 25 | local autoformat_group = vim.api.nvim_create_augroup("AutoformatToggle", { clear = true }) 26 | 27 | -- Disable autoformat before saving 28 | vim.api.nvim_create_autocmd("User", { 29 | group = autoformat_group, 30 | pattern = "AutoSaveWritePre", 31 | desc = "Disable autoformat before saving", 32 | callback = function() 33 | -- Save global autoformat status 34 | vim.g.OLD_AUTOFORMAT = vim.g.autoformat 35 | vim.g.autoformat = false 36 | 37 | local old_autoformat_buffers = {} 38 | -- Disable all manually enabled buffers 39 | for _, bufnr in ipairs(vim.api.nvim_list_bufs()) do 40 | if vim.b[bufnr].autoformat then 41 | table.insert(old_autoformat_buffers, bufnr) 42 | vim.b[bufnr].autoformat = false 43 | end 44 | end 45 | 46 | vim.g.OLD_AUTOFORMAT_BUFFERS = old_autoformat_buffers 47 | end, 48 | }) 49 | 50 | -- Re-enable autoformat after saving 51 | vim.api.nvim_create_autocmd("User", { 52 | group = autoformat_group, 53 | pattern = "AutoSaveWritePost", 54 | desc = "Re-enable autoformat after saving", 55 | callback = function() 56 | -- Restore global autoformat status 57 | vim.g.autoformat = vim.g.OLD_AUTOFORMAT 58 | -- Re-enable all manually enabled buffers 59 | for _, bufnr in ipairs(vim.g.OLD_AUTOFORMAT_BUFFERS or {}) do 60 | vim.b[bufnr].autoformat = true 61 | end 62 | end, 63 | }) 64 | 65 | require("auto-save").setup(opts) 66 | end, 67 | } 68 | -------------------------------------------------------------------------------- /lua/plugins/avante.lua: -------------------------------------------------------------------------------- 1 | local prefix = "P" 2 | 3 | ---@type LazySpec 4 | return { 5 | "yetone/avante.nvim", 6 | build = "make", 7 | event = "User AstroFile", 8 | cmd = { 9 | "AvanteAsk", 10 | "AvanteBuild", 11 | "AvanteEdit", 12 | "AvanteRefresh", 13 | "AvanteSwitchProvider", 14 | "AvanteChat", 15 | "AvanteToggle", 16 | "AvanteClear", 17 | }, 18 | dependencies = { 19 | { "nvim-lua/plenary.nvim", lazy = true }, 20 | { "MunifTanjim/nui.nvim", lazy = true }, 21 | }, 22 | opts = { 23 | provider = "copilot", 24 | auto_suggestions_provider = "claude", 25 | behaviour = { 26 | auto_suggestions = false, -- Experimental stage 27 | }, 28 | file_selector = { 29 | provider = "fzf", 30 | provider_opts = {}, 31 | }, 32 | mappings = { 33 | ask = prefix .. "", 34 | edit = prefix .. "e", 35 | refresh = prefix .. "r", 36 | focus = prefix .. "f", 37 | toggle = { 38 | default = prefix .. "t", 39 | debug = prefix .. "d", 40 | hint = prefix .. "h", 41 | suggestion = prefix .. "s", 42 | repomap = prefix .. "R", 43 | }, 44 | diff = { 45 | next = "]c", 46 | prev = "[c", 47 | }, 48 | files = { 49 | add_current = prefix .. ".", 50 | }, 51 | }, 52 | }, 53 | specs = { 54 | { 55 | "AstroNvim/astrocore", 56 | opts = function(_, opts) 57 | opts.mappings.n[prefix] = { desc = " Avante" } 58 | opts.options.opt.laststatus = 3 59 | end, 60 | }, 61 | { 62 | "zbirenbaum/copilot.lua", 63 | cmd = "Copilot", 64 | event = "InsertEnter", 65 | opts = { 66 | suggestion = { 67 | enabled = true, 68 | auto_trigger = true, 69 | debounce = 150, 70 | keymap = { 71 | accept = "", 72 | accept_word = false, 73 | accept_line = false, 74 | next = "", 75 | prev = "", 76 | dismiss = "", 77 | }, 78 | }, 79 | }, 80 | }, 81 | { 82 | "MeanderingProgrammer/render-markdown.nvim", 83 | optional = true, 84 | opts = function(_, opts) 85 | if not opts.file_types then opts.file_types = { "markdown" } end 86 | opts.file_types = require("astrocore").list_insert_unique(opts.file_types, { "Avante" }) 87 | end, 88 | }, 89 | { 90 | "saghen/blink.cmp", 91 | optional = true, 92 | opts = function(_, opts) 93 | if not opts.sources then opts.sources = {} end 94 | return require("astrocore").extend_tbl(opts, { 95 | sources = { 96 | compat = require("astrocore").list_insert_unique( 97 | opts.sources.compat or {}, 98 | { "avante_commands", "avante_mentions", "avante_files" } 99 | ), 100 | providers = { 101 | avante_commands = { 102 | kind = "AvanteCommands", 103 | score_offset = 90, 104 | async = true, 105 | }, 106 | avante_files = { 107 | kind = "AvanteFiles", 108 | score_offset = 100, 109 | async = true, 110 | }, 111 | avante_mentions = { 112 | name = "AvanteMentions", 113 | score_offset = 1000, 114 | async = true, 115 | }, 116 | }, 117 | }, 118 | }) 119 | end, 120 | }, 121 | }, 122 | } 123 | -------------------------------------------------------------------------------- /lua/plugins/blink-cmp.lua: -------------------------------------------------------------------------------- 1 | return { 2 | { 3 | "saghen/blink.cmp", 4 | optional = true, 5 | dependencies = { 6 | { 7 | "SergioRibera/cmp-dotenv", 8 | }, 9 | }, 10 | opts = function(_, opts) 11 | return require("astrocore").extend_tbl(opts, { 12 | sources = { 13 | compat = require("astrocore").list_insert_unique(opts.sources.compat or {}, { "dotenv" }), 14 | providers = { 15 | dotenv = { 16 | kind = "DotEnv", 17 | score_offset = -100, 18 | async = true, 19 | }, 20 | }, 21 | }, 22 | }) 23 | end, 24 | }, 25 | } 26 | -------------------------------------------------------------------------------- /lua/plugins/bufferline.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "akinsho/bufferline.nvim", 3 | specs = { 4 | { 5 | "rebelot/heirline.nvim", 6 | opts = function(_, opts) 7 | opts.tabline = nil -- remove tabline 8 | end, 9 | }, 10 | { 11 | "AstroNvim/astrocore", 12 | opts = function(_, opts) 13 | local get_icon = require("astroui").get_icon 14 | local maps = opts.mappings or {} 15 | -- remove before heirline buffer mapping 16 | for k, _ in pairs(opts.mappings.n) do 17 | if k:find "^b" then maps.n[k] = false end 18 | end 19 | maps.n["b"] = { name = get_icon("Tab", 1, true) .. "Buffers" } 20 | maps.n["]b"] = { function() require("bufferline.commands").cycle(vim.v.count1) end, desc = "Next buffer" } 21 | maps.n["[b"] = { function() require("bufferline.commands").cycle(-vim.v.count1) end, desc = "Previous buffer" } 22 | maps.n[">b"] = 23 | { function() require("bufferline.commands").move(vim.v.count1) end, desc = "Move buffer tab right" } 24 | maps.n["bb"] = { 27 | function() require("bufferline.commands").pick() end, 28 | desc = "Navigate to buffer tab with interactive picker", 29 | } 30 | maps.n["bo"] = { 31 | function() require("bufferline.commands").close_others() end, 32 | desc = "Close all buffers except the current", 33 | } 34 | maps.n["bd"] = { 35 | function() require("bufferline.commands").close_with_pick() end, 36 | desc = "Delete a buffer tab with interactive picker", 37 | } 38 | maps.n["bl"] = { 39 | function() require("bufferline.commands").close_in_direction "left" end, 40 | desc = "Close all buffers to the left of the current", 41 | } 42 | maps.n["br"] = { 43 | function() require("bufferline.commands").close_in_direction "right" end, 44 | desc = "Close all buffers to the right of the current", 45 | } 46 | maps.n["bp"] = { "BufferLineTogglePin", desc = "Toggle pin buffer" } 47 | maps.n["bse"] = 48 | { function() require("bufferline.commands").sort_by "extension" end, desc = "Sort buffers by extension" } 49 | maps.n["bsi"] = 50 | { function() require("bufferline.commands").sort_by "id" end, desc = "Sort buffers by buffer number" } 51 | maps.n["bsm"] = { 52 | function() 53 | require("bufferline.commands").sort_by(function(a, b) return a.modified and not b.modified end) 54 | end, 55 | desc = "Sort buffers by last modification", 56 | } 57 | maps.n["bsp"] = 58 | { function() require("bufferline.commands").sort_by "directory" end, desc = "Sort buffers by directory" } 59 | maps.n["bsr"] = { 60 | function() require("bufferline.commands").sort_by "relative_directory" end, 61 | desc = "Sort buffers by relative directory", 62 | } 63 | maps.n["b\\"] = { 64 | function() 65 | require("bufferline.pick").choose_then(function(id) 66 | vim.cmd "split" 67 | vim.cmd("buffer " .. id) 68 | end) 69 | end, 70 | desc = "Open a buffer tab in a new horizontal split with interactive picker", 71 | } 72 | maps.n["b|"] = { 73 | function() 74 | require("bufferline.pick").choose_then(function(id) 75 | vim.cmd "vsplit" 76 | vim.cmd("buffer " .. id) 77 | end) 78 | end, 79 | desc = "Open a buffer tab in a new vertical split with interactive picker", 80 | } 81 | return vim.tbl_deep_extend("force", opts, { 82 | options = { 83 | opt = { 84 | showtabline = 2, 85 | }, 86 | }, 87 | }) 88 | end, 89 | }, 90 | }, 91 | dependencies = { 92 | "echasnovski/mini.icons", 93 | }, 94 | event = "VeryLazy", 95 | opts = { 96 | options = { 97 | diagnostics = "nvim_lsp", 98 | always_show_bufferline = false, 99 | diagnostics_indicator = function(_, _, diag) 100 | local get_icon = require("astroui").get_icon 101 | local Error = get_icon("DiagnosticError", 1, true) 102 | local Warn = get_icon("DiagnosticWarn", 1, true) 103 | local ret = (diag.error and Error .. diag.error .. " " or "") .. (diag.warning and Warn .. diag.warning or "") 104 | return vim.trim(ret) 105 | end, 106 | ---@param opts bufferline.IconFetcherOpts 107 | get_element_icon = function(opts) 108 | local mini_icons = require "mini.icons" 109 | local icon, hl, _ = mini_icons.get("filetype", opts.filetype) 110 | return icon, hl 111 | end, 112 | }, 113 | }, 114 | } 115 | -------------------------------------------------------------------------------- /lua/plugins/colorschema.lua: -------------------------------------------------------------------------------- 1 | return { 2 | { "craftzdog/solarized-osaka.nvim", lazy = true, opts = { 3 | transparent = false, 4 | } }, 5 | { "sainnhe/everforest", lazy = true }, 6 | { "Mofiqul/dracula.nvim", lazy = true }, 7 | { "folke/tokyonight.nvim", lazy = true }, 8 | } 9 | -------------------------------------------------------------------------------- /lua/plugins/comment.lua: -------------------------------------------------------------------------------- 1 | ---@type LazySpec 2 | return { 3 | -- comments 4 | { 5 | "folke/ts-comments.nvim", 6 | event = "VeryLazy", 7 | opts = { 8 | lang = { 9 | thrift = { "//%s", "/*%s*/" }, 10 | goctl = { "//%s", "/*%s*/" }, 11 | }, 12 | }, 13 | dependencies = { 14 | { 15 | "AstroNvim/astrocore", 16 | ---@param opts AstroCoreOpts 17 | opts = function(_, opts) 18 | local maps = opts.mappings or {} 19 | maps.n[""] = opts.mappings.n["/"] 20 | maps.x[""] = opts.mappings.x["/"] 21 | -- end 22 | maps.n["/"] = false 23 | maps.x["/"] = false 24 | end, 25 | }, 26 | }, 27 | }, 28 | { 29 | "JoosepAlviste/nvim-ts-context-commentstring", 30 | enabled = false, 31 | }, 32 | { 33 | "numToStr/Comment.nvim", 34 | enabled = false, 35 | }, 36 | } 37 | -------------------------------------------------------------------------------- /lua/plugins/conform.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "stevearc/conform.nvim", 3 | event = "User AstroFile", 4 | cmd = "ConformInfo", 5 | specs = { 6 | { "AstroNvim/astrolsp", optional = true, opts = { formatting = { disabled = true } } }, 7 | { 8 | "AstroNvim/astrocore", 9 | opts = function(_, opts) 10 | local maps = opts.mappings or {} 11 | maps.n["lI"] = { function() vim.cmd.ConformInfo() end, desc = "Show Conform Info" } 12 | maps.n["lf"] = { function() vim.cmd.Format() end, desc = "Format buffer" } 13 | maps.n["uf"] = { 14 | function() 15 | if vim.b.autoformat == nil then 16 | if vim.g.autoformat == nil then vim.g.autoformat = true end 17 | vim.b.autoformat = vim.g.autoformat 18 | end 19 | vim.b.autoformat = not vim.b.autoformat 20 | require("astrocore").notify(string.format("Buffer autoformatting %s", vim.b.autoformat and "on" or "off")) 21 | end, 22 | desc = "Toggle autoformatting (buffer)", 23 | } 24 | maps.n["uF"] = { 25 | function() 26 | if vim.g.autoformat == nil then vim.g.autoformat = true end 27 | vim.g.autoformat = not vim.g.autoformat 28 | vim.b.autoformat = nil 29 | vim.notify( 30 | string.format("Global autoformatting %s", vim.g.autoformat and "on" or "off"), 31 | vim.log.levels.INFO 32 | ) 33 | end, 34 | desc = "Toggle autoformatting (global)", 35 | } 36 | return vim.tbl_deep_extend("force", opts, { 37 | options = { opt = { formatexpr = "v:lua.require'conform'.formatexpr()" } }, 38 | commands = { 39 | Format = { 40 | function(args) 41 | local range = nil 42 | if args.count ~= -1 then 43 | local end_line = vim.api.nvim_buf_get_lines(0, args.line2 - 1, args.line2, true)[1] 44 | range = { 45 | start = { args.line1, 0 }, 46 | ["end"] = { args.line2, end_line:len() }, 47 | } 48 | end 49 | require("conform").format { async = true, range = range } 50 | end, 51 | desc = "Format buffer", 52 | range = true, 53 | }, 54 | }, 55 | }) 56 | end, 57 | }, 58 | }, 59 | opts = { 60 | default_format_opts = { lsp_format = "fallback" }, 61 | format_on_save = function(bufnr) 62 | if vim.g.autoformat == nil then vim.g.autoformat = true end 63 | local autoformat = vim.b[bufnr].autoformat 64 | if autoformat == nil then autoformat = vim.g.autoformat end 65 | if autoformat then return { timeout_ms = 20000 } end 66 | end, 67 | }, 68 | } 69 | -------------------------------------------------------------------------------- /lua/plugins/diffview.lua: -------------------------------------------------------------------------------- 1 | local prefix_diff_view = "g" 2 | local set_mappings = require("astrocore").set_mappings 3 | 4 | ---@type LazySpec 5 | return { 6 | "sindrets/diffview.nvim", 7 | event = "User AstroGitFile", 8 | cmd = { "DiffviewOpen" }, 9 | specs = { 10 | { 11 | ---@type AstroCoreOpts 12 | "AstroNvim/astrocore", 13 | opts = function(_, opts) 14 | local maps = opts.mappings 15 | if vim.fn.executable "git" == 1 then 16 | maps.n[prefix_diff_view .. "g"] = { 17 | function() vim.cmd [[DiffviewOpen]] end, 18 | desc = "Open Git Diffview", 19 | } 20 | maps.n[prefix_diff_view .. "D"] = { 21 | function() vim.cmd [[DiffviewFileHistory]] end, 22 | desc = "Open current branch git history", 23 | } 24 | maps.n[prefix_diff_view .. "d"] = { 25 | function() vim.cmd [[DiffviewFileHistory %]] end, 26 | desc = "Open current file git history", 27 | } 28 | end 29 | end, 30 | }, 31 | }, 32 | opts = { 33 | enhanced_diff_hl = true, 34 | view = { 35 | default = { winbar_info = false, disable_diagnostics = true }, 36 | file_history = { winbar_info = false, disable_diagnostics = true }, 37 | }, 38 | file_panel = { 39 | win_config = { -- See |diffview-config-win_config| 40 | position = "bottom", 41 | height = require("utils").size(vim.o.lines, 0.25), 42 | }, 43 | }, 44 | hooks = { 45 | view_enter = function() 46 | set_mappings { 47 | n = { 48 | [prefix_diff_view .. "g"] = { 49 | function() vim.cmd [[DiffviewClose]] end, 50 | desc = "Close Git Diffview", 51 | }, 52 | }, 53 | } 54 | end, 55 | view_leave = function() 56 | set_mappings { 57 | n = { 58 | [prefix_diff_view .. "g"] = { 59 | function() vim.cmd [[DiffviewOpen]] end, 60 | desc = "Open Git Diffview", 61 | }, 62 | }, 63 | } 64 | end, 65 | }, 66 | }, 67 | } 68 | -------------------------------------------------------------------------------- /lua/plugins/dropbar.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "Bekaboo/dropbar.nvim", 3 | event = "User AstroFile", 4 | opts = {}, 5 | specs = { 6 | { 7 | "rebelot/heirline.nvim", 8 | optional = true, 9 | opts = function(_, opts) opts.winbar = nil end, 10 | }, 11 | }, 12 | } 13 | -------------------------------------------------------------------------------- /lua/plugins/flash.lua: -------------------------------------------------------------------------------- 1 | ---@type LazySpec 2 | return { 3 | "folke/flash.nvim", 4 | event = "VeryLazy", 5 | opts = { 6 | label = { 7 | uppercase = false, 8 | }, 9 | modes = { 10 | char = { 11 | enabled = false, 12 | }, 13 | }, 14 | }, 15 | keys = { 16 | { "s", mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash" }, 17 | { 18 | "S", 19 | mode = { "n", "x", "o" }, 20 | function() require("flash").treesitter() end, 21 | desc = "Flash Treesitter", 22 | }, 23 | { "r", mode = "o", function() require("flash").remote() end, desc = "Remote Flash" }, 24 | { 25 | "R", 26 | mode = { "o", "x" }, 27 | function() require("flash").treesitter_search() end, 28 | desc = "Treesitter Search", 29 | }, 30 | { 31 | "", 32 | mode = { "c" }, 33 | function() require("flash").toggle() end, 34 | desc = "Toggle Flash Search", 35 | }, 36 | }, 37 | } 38 | -------------------------------------------------------------------------------- /lua/plugins/git-blame.lua: -------------------------------------------------------------------------------- 1 | local prefix_git_blame = "g" 2 | 3 | ---@type LazySpec 4 | return { 5 | "f-person/git-blame.nvim", 6 | event = "User AstroGitFile", 7 | specs = { 8 | { 9 | "AstroNvim/astrocore", 10 | ---@type AstroCoreOpts 11 | opts = function(_, opts) 12 | local maps = opts.mappings or {} 13 | maps.n[prefix_git_blame .. "B"] = { desc = "Git Blame Functions" } 14 | maps.n[prefix_git_blame .. "Bc"] = 15 | { function() vim.cmd [[GitBlameOpenCommitURL]] end, desc = "Git Blame Open Commit URL" } 16 | maps.n[prefix_git_blame .. "Bs"] = { function() vim.cmd [[GitBlameCopySHA]] end, desc = "Git Blame Copy SHA" } 17 | maps.n[prefix_git_blame .. "Bo"] = 18 | { function() vim.cmd [[GitBlameOpenFileURL]] end, desc = "Git Blame Open File URL" } 19 | maps.n[prefix_git_blame .. "By"] = 20 | { function() vim.cmd [[GitBlameCopyFileURL]] end, desc = "Git Blame Copy File URL" } 21 | end, 22 | }, 23 | }, 24 | cmd = { 25 | "GitBlameToggle", 26 | "GitBlameEnable", 27 | "GitBlameOpenCommitURL", 28 | "GitBlameCopyCommitURL", 29 | "GitBlameOpenFileURL", 30 | "GitBlameCopyFileURL", 31 | "GitBlameCopySHA", 32 | }, 33 | opts = { 34 | enabled = true, 35 | date_format = "%r", 36 | message_template = "  󰔠 󰈚 ", 37 | message_when_not_committed = " Not Committed Yet", 38 | }, 39 | } 40 | -------------------------------------------------------------------------------- /lua/plugins/grug-far.lua: -------------------------------------------------------------------------------- 1 | ---@type LazySpec 2 | return { 3 | "MagicDuck/grug-far.nvim", 4 | cmd = "GrugFar", 5 | specs = { 6 | { 7 | "AstroNvim/astroui", 8 | ---@type AstroUIOpts 9 | opts = { 10 | icons = { 11 | GrugFar = "󰛔", 12 | }, 13 | }, 14 | }, 15 | { 16 | "AstroNvim/astrocore", 17 | opts = function(_, opts) 18 | local maps = opts.mappings or {} 19 | local prefix = "s" 20 | maps.n[prefix .. "r"] = { 21 | function() 22 | local file_path = vim.fn.expand "%:p" 23 | local file_name = vim.fn.fnamemodify(file_path, ":t") 24 | require("grug-far").open { prefills = { search = vim.fn.expand "", filesFilter = file_name } } 25 | end, 26 | desc = "Search and Replace", 27 | } 28 | maps.v[prefix .. "r"] = { 29 | function() 30 | local is_visual = vim.fn.mode():lower():find "v" 31 | if is_visual then -- needed to make visual selection work 32 | vim.cmd [[normal! v]] 33 | end 34 | local grug = require "grug-far" 35 | local file_path = vim.fn.expand "%:p" 36 | local file_name = vim.fn.fnamemodify(file_path, ":t"); 37 | 38 | (is_visual and grug.with_visual_selection or grug.grug_far) { 39 | prefills = { filesFilter = file_name }, 40 | } 41 | end, 42 | desc = require("astroui").get_icon("GrugFar", 1, true) .. "Search and Replace (current word)", 43 | } 44 | end, 45 | }, 46 | { 47 | "zbirenbaum/copilot.lua", 48 | optional = true, 49 | opts = { 50 | filetypes = { 51 | ["grug-far"] = false, 52 | ["grug-far-history"] = false, 53 | }, 54 | }, 55 | }, 56 | }, 57 | dependencies = { 58 | "echasnovski/mini.icons", 59 | }, 60 | ---@param opts GrugFarOptionsOverride 61 | -- NOTE: Wrapping opts into a function, because `astrocore` can set vim options 62 | opts = function(_, opts) 63 | if not opts.icons then opts.icons = {} end 64 | opts.icons.enabled = vim.g.icons_enabled 65 | if not vim.g.icons_enabled then 66 | opts.resultsSeparatorLineChar = "-" 67 | opts.spinnerStates = { 68 | "|", 69 | "\\", 70 | "-", 71 | "/", 72 | } 73 | end 74 | return vim.tbl_deep_extend("force", opts, { 75 | headerMaxWidth = 80, 76 | icons = { 77 | enabled = vim.g.icons_enabled, 78 | fileIconsProvider = "mini.icons", 79 | }, 80 | keymaps = { 81 | replace = { n = "r" }, 82 | qflist = { n = "c" }, 83 | syncLocations = { n = "s" }, 84 | syncLine = { n = "l" }, 85 | close = { n = "q" }, 86 | historyOpen = { n = "t" }, 87 | historyAdd = { n = "a" }, 88 | refresh = { n = "f" }, 89 | openLocation = { n = "o" }, 90 | gotoLocation = { n = "" }, 91 | pickHistoryEntry = { n = "" }, 92 | abort = { n = "b" }, 93 | help = { n = "g?" }, 94 | toggleShowRgCommand = { n = "p" }, 95 | }, 96 | startInInsertMode = false, 97 | } --[[@as GrugFarOptionsOverride]]) 98 | end, 99 | } 100 | -------------------------------------------------------------------------------- /lua/plugins/helpview.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "OXY2DEV/helpview.nvim", 3 | ft = "help", 4 | dependencies = { 5 | { 6 | "nvim-treesitter/nvim-treesitter", 7 | optional = true, 8 | opts = function(_, opts) 9 | if opts.ensure_installed ~= "all" then 10 | opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "vimdoc" }) 11 | end 12 | end, 13 | }, 14 | }, 15 | } 16 | -------------------------------------------------------------------------------- /lua/plugins/images.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "3rd/image.nvim", 3 | ft = { "markdown", "markdown.mdx", "norg", "vimwiki" }, 4 | dependencies = { 5 | { 6 | "nvim-treesitter/nvim-treesitter", 7 | optional = true, 8 | opts = function(_, opts) 9 | if opts.ensure_installed ~= "all" then 10 | opts.ensure_installed = 11 | require("astrocore").list_insert_unique(opts.ensure_installed, { "markdown", "markdown_inline" }) 12 | end 13 | end, 14 | }, 15 | }, 16 | opts = { 17 | backend = "kitty", 18 | processor = "magick_cli", 19 | integrations = { 20 | markdown = { 21 | enabled = true, 22 | clear_in_insert_mode = true, 23 | download_remote_images = true, 24 | only_render_image_at_cursor = true, 25 | filetypes = { "markdown", "vimwiki" }, -- markdown extensions (ie. quarto) can go here 26 | }, 27 | neorg = { 28 | enabled = true, 29 | clear_in_insert_mode = true, 30 | download_remote_images = true, 31 | only_render_image_at_cursor = true, 32 | filetypes = { "norg" }, 33 | }, 34 | }, 35 | max_width = 100, -- tweak to preference 36 | max_height = 12, -- ^ 37 | max_height_window_percentage = math.huge, -- this is necessary for a good experience 38 | max_width_window_percentage = math.huge, 39 | window_overlap_clear_enabled = true, -- toggles images when windows are overlapped 40 | window_overlap_clear_ft_ignore = { "cmp_menu", "cmp_docs", "" }, 41 | editor_only_render_when_focused = true, -- auto show/hide images when the editor gains/looses focus 42 | tmux_show_only_in_active_window = true, -- auto show/hide images in the correct Tmux window (needs visual-activity off) 43 | hijack_file_patterns = { "*.png", "*.jpg", "*.jpeg", "*.gif", "*.webp" }, -- render image files as images when opened 44 | }, 45 | } 46 | -------------------------------------------------------------------------------- /lua/plugins/live-server.lua: -------------------------------------------------------------------------------- 1 | ---@type LazySpec 2 | return { 3 | "barrett-ruth/live-server.nvim", 4 | build = "npm install -g live-server", 5 | cmd = { "LiveServerStart", "LiveServerStop" }, 6 | opts = {}, 7 | specs = { 8 | { 9 | "AstroNvim/astrocore", 10 | opts = function(_, opts) 11 | local maps = opts.mappings or {} 12 | maps.n["lw"] = { "LiveServerStart", desc = "Start Live Server" } 13 | maps.n["lW"] = { "LiveServerStop", desc = "Stop Live Server" } 14 | end, 15 | }, 16 | }, 17 | } 18 | -------------------------------------------------------------------------------- /lua/plugins/lualine.lua: -------------------------------------------------------------------------------- 1 | return { 2 | { 3 | "nvim-lualine/lualine.nvim", 4 | event = "VeryLazy", 5 | specs = { 6 | { 7 | "rebelot/heirline.nvim", 8 | enabled = false, 9 | optional = true, 10 | opts = function(_, opts) opts.statusline = nil end, 11 | }, 12 | }, 13 | init = function() 14 | vim.g.lualine_laststatus = vim.o.laststatus 15 | if vim.fn.argc(-1) > 0 then 16 | -- set an empty statusline till lualine loads 17 | vim.o.statusline = " " 18 | else 19 | -- hide the statusline on the starter page 20 | vim.o.laststatus = 0 21 | end 22 | end, 23 | opts = function() 24 | local lualine_require = require "lualine_require" 25 | lualine_require.require = require 26 | 27 | local get_icon = require("astroui").get_icon 28 | 29 | vim.o.laststatus = vim.g.lualine_laststatus 30 | 31 | local opts = { 32 | options = { 33 | theme = "auto", 34 | globalstatus = vim.o.laststatus == 3, 35 | disabled_filetypes = { statusline = { "dashboard", "alpha", "ministarter", "snacks_dashboard" } }, 36 | }, 37 | sections = { 38 | lualine_a = { "mode" }, 39 | lualine_b = { "branch" }, 40 | 41 | lualine_c = { 42 | require("utils.lualine").root_dir(), 43 | { 44 | "diagnostics", 45 | symbols = { 46 | error = get_icon("DiagnosticError", 1), 47 | warn = get_icon("DiagnosticWarn", 1), 48 | info = get_icon("DiagnosticInfo", 1), 49 | hint = get_icon("DiagnosticHint", 1), 50 | }, 51 | }, 52 | { "filetype", icon_only = true, separator = "", padding = { left = 1, right = 0 } }, 53 | { require("utils.lualine").pretty_path() }, 54 | }, 55 | lualine_x = { 56 | require("snacks").profiler.status(), 57 | -- stylua: ignore 58 | { 59 | function() return require("noice").api.status.command.get() end, 60 | cond = function() return package.loaded["noice"] and require("noice").api.status.command.has() end, 61 | color = function() return { fg = require("snacks").util.color("Statement") } end, 62 | }, 63 | -- stylua: ignore 64 | { 65 | function() return require("noice").api.status.mode.get() end, 66 | cond = function() return package.loaded["noice"] and require("noice").api.status.mode.has() end, 67 | color = function() return { fg = require("snacks").util.color("Constant") } end, 68 | }, 69 | -- stylua: ignore 70 | { 71 | function() return " " .. require("dap").status() end, 72 | cond = function() return package.loaded["dap"] and require("dap").status() ~= "" end, 73 | color = function() return { fg = require("snacks").util.color("Debug") } end, 74 | }, 75 | -- stylua: ignore 76 | { 77 | require("lazy.status").updates, 78 | cond = require("lazy.status").has_updates, 79 | color = function() return { fg = require("snacks").util.color("Special") } end, 80 | }, 81 | { 82 | "diff", 83 | symbols = { 84 | added = get_icon("GitAdd", 1), 85 | modified = get_icon("GitChange", 1), 86 | removed = get_icon("GitDelete", 1), 87 | }, 88 | source = function() 89 | local gitsigns = vim.b.gitsigns_status_dict 90 | if gitsigns then 91 | return { 92 | added = gitsigns.added, 93 | modified = gitsigns.changed, 94 | removed = gitsigns.removed, 95 | } 96 | end 97 | end, 98 | }, 99 | }, 100 | lualine_y = { 101 | { "progress", separator = " ", padding = { left = 1, right = 0 } }, 102 | { "location", padding = { left = 0, right = 1 } }, 103 | }, 104 | lualine_z = { 105 | function() return " " .. os.date "%R" end, 106 | }, 107 | }, 108 | extensions = { "neo-tree", "lazy", "fzf" }, 109 | } 110 | 111 | -- do not add trouble symbols if aerial is enabled 112 | -- And allow it to be overriden for some buffer types (see autocmds) 113 | if vim.g.trouble_lualine and require("astrocore").is_available "trouble.nvim" then 114 | local trouble = require "trouble" 115 | local symbols = trouble.statusline { 116 | mode = "symbols", 117 | groups = {}, 118 | title = false, 119 | filter = { range = true }, 120 | format = "{kind_icon}{symbol.name:Normal}", 121 | hl_group = "lualine_c_normal", 122 | } 123 | table.insert(opts.sections.lualine_c, { 124 | symbols and symbols.get, 125 | cond = function() return vim.b.trouble_lualine ~= false and symbols.has() end, 126 | }) 127 | end 128 | 129 | if require("astrocore").is_available "overseer.nvim" then 130 | table.insert(opts.sections.lualine_x, { "overseer" }) 131 | end 132 | 133 | return opts 134 | end, 135 | }, 136 | } 137 | -------------------------------------------------------------------------------- /lua/plugins/mini-diff.lua: -------------------------------------------------------------------------------- 1 | ---@type LazySpec 2 | return { 3 | "echasnovski/mini.diff", 4 | event = "User AstroGitFile", 5 | opts = function() 6 | local sign = require("astroui").get_icon "GitSign" 7 | return { 8 | view = { 9 | style = "sign", 10 | signs = { add = sign, change = sign, delete = sign }, 11 | }, 12 | mappings = { 13 | apply = "gh", 14 | goto_first = "[G", 15 | goto_last = "]G", 16 | goto_next = "]g", 17 | goto_prev = "[g", 18 | reset = "gr", 19 | textobject = "gh", 20 | }, 21 | } 22 | end, 23 | specs = { 24 | { "lewis6991/gitsigns.nvim", enabled = false }, 25 | -- lualine integration 26 | { 27 | "nvim-lualine/lualine.nvim", 28 | opts = function(_, opts) 29 | local x = opts.sections.lualine_x 30 | for _, comp in ipairs(x) do 31 | if comp[1] == "diff" then 32 | comp.source = function() 33 | local summary = vim.b.minidiff_summary 34 | return summary 35 | and { 36 | added = summary.add, 37 | modified = summary.change, 38 | removed = summary.delete, 39 | } 40 | end 41 | break 42 | end 43 | end 44 | end, 45 | }, 46 | }, 47 | } 48 | -------------------------------------------------------------------------------- /lua/plugins/mini-pairs.lua: -------------------------------------------------------------------------------- 1 | ---@type LazySpec 2 | return { 3 | "echasnovski/mini.pairs", 4 | event = "VeryLazy", 5 | opts = { 6 | modes = { insert = true, command = true, terminal = false }, 7 | -- skip autopair when next character is one of these 8 | skip_next = [=[[%w%%%'%[%"%.%`%$]]=], 9 | -- skip autopair when the cursor is inside these treesitter nodes 10 | skip_ts = { "string" }, 11 | -- skip autopair when next character is closing pair 12 | -- and there are more closing pairs than opening pairs 13 | skip_unbalanced = true, 14 | -- better deal with markdown code blocks 15 | markdown = true, 16 | }, 17 | specs = { 18 | { "windwp/nvim-autopairs", optional = false, enabled = false }, 19 | { 20 | "AstroNvim/astrocore", 21 | ---@param opts AstroCoreOpts 22 | ---@diagnostic disable: missing-fields 23 | ---@diagnostic disable: missing-parameter 24 | opts = function(_, opts) 25 | local maps = opts.mappings or {} 26 | maps.n["ua"] = { 27 | function() vim.g.minipairs_disable = not vim.g.minipairs_disable end, 28 | desc = "Toggle mini pairs", 29 | } 30 | end, 31 | }, 32 | }, 33 | config = function(_, opts) 34 | local pairs = require "mini.pairs" 35 | pairs.setup(opts) 36 | local open = pairs.open 37 | pairs.open = function(pair, neigh_pattern) 38 | if vim.fn.getcmdline() ~= "" then return open(pair, neigh_pattern) end 39 | local o, c = pair:sub(1, 1), pair:sub(2, 2) 40 | local line = vim.api.nvim_get_current_line() 41 | local cursor = vim.api.nvim_win_get_cursor(0) 42 | local next = line:sub(cursor[2] + 1, cursor[2] + 1) 43 | local before = line:sub(1, cursor[2]) 44 | if opts.markdown and o == "`" and vim.bo.filetype == "markdown" and before:match "^%s*``" then 45 | return "`\n```" .. vim.api.nvim_replace_termcodes("", true, true, true) 46 | end 47 | if opts.skip_next and next ~= "" and next:match(opts.skip_next) then return o end 48 | if opts.skip_ts and #opts.skip_ts > 0 then 49 | local ok, captures = pcall(vim.treesitter.get_captures_at_pos, 0, cursor[1] - 1, math.max(cursor[2] - 1, 0)) 50 | for _, capture in ipairs(ok and captures or {}) do 51 | if vim.tbl_contains(opts.skip_ts, capture.capture) then return o end 52 | end 53 | end 54 | if opts.skip_unbalanced and next == c and c ~= o then 55 | local _, count_open = line:gsub(vim.pesc(pair:sub(1, 1)), "") 56 | local _, count_close = line:gsub(vim.pesc(pair:sub(2, 2)), "") 57 | if count_close > count_open then return o end 58 | end 59 | return open(pair, neigh_pattern) 60 | end 61 | -- setup keymap 62 | local map_bs = function(lhs, rhs) vim.keymap.set("i", lhs, rhs, { expr = true, replace_keycodes = false }) end 63 | 64 | map_bs("", "v:lua.MiniPairs.bs()") 65 | map_bs("", 'v:lua.MiniPairs.bs("\23")') 66 | map_bs("", 'v:lua.MiniPairs.bs("\21")') 67 | end, 68 | } 69 | -------------------------------------------------------------------------------- /lua/plugins/motlen.lua: -------------------------------------------------------------------------------- 1 | local function ensure_kernel_for_venv() 2 | local venv_path = os.getenv "VIRTUAL_ENV" or os.getenv "CONDA_PREFIX" 3 | if not venv_path then 4 | vim.notify("No virtual environment found.", vim.log.levels.WARN) 5 | return 6 | end 7 | 8 | -- Canonicalize the venv_path to ensure consistency 9 | venv_path = vim.fn.fnamemodify(venv_path, ":p") 10 | 11 | -- Check if the kernel spec already exists 12 | local handle = io.popen "jupyter kernelspec list --json" 13 | local existing_kernels = {} 14 | if handle then 15 | local result = handle:read "*a" 16 | handle:close() 17 | local json = vim.fn.json_decode(result) 18 | -- Iterate over available kernel specs to find the one for this virtual environment 19 | for kernel_name, data in pairs(json.kernelspecs) do 20 | existing_kernels[kernel_name] = true -- Store existing kernel names for validation 21 | local kernel_path = vim.fn.fnamemodify(data.spec.argv[1], ":p") -- Canonicalize the kernel path 22 | if kernel_path:find(venv_path, 1, true) then 23 | vim.notify("Kernel spec for this virtual environment already exists.", vim.log.levels.INFO) 24 | return kernel_name 25 | end 26 | end 27 | end 28 | 29 | -- Prompt the user for a custom kernel name, ensuring it is unique 30 | local new_kernel_name 31 | repeat 32 | new_kernel_name = vim.fn.input "Enter a unique name for the new kernel spec: " 33 | if new_kernel_name == "" then 34 | vim.notify("Please provide a valid kernel name.", vim.log.levels.ERROR) 35 | return 36 | elseif existing_kernels[new_kernel_name] then 37 | vim.notify( 38 | "Kernel name '" .. new_kernel_name .. "' already exists. Please choose another name.", 39 | vim.log.levels.WARN 40 | ) 41 | new_kernel_name = nil 42 | end 43 | until new_kernel_name 44 | 45 | -- Create the kernel spec with the unique name 46 | print "Creating a new kernel spec for this virtual environment..." 47 | local cmd = string.format( 48 | '%s -m ipykernel install --user --name="%s"', 49 | vim.fn.shellescape(venv_path .. "/bin/python"), 50 | new_kernel_name 51 | ) 52 | 53 | os.execute(cmd) 54 | vim.notify("Kernel spec '" .. new_kernel_name .. "' created successfully.", vim.log.levels.INFO) 55 | return new_kernel_name 56 | end 57 | 58 | ---@type LazySpec 59 | return { 60 | "benlubas/molten-nvim", 61 | ft = { "python" }, 62 | cmd = { 63 | "MoltenEvaluateLine", 64 | "MoltenEvaluateVisual", 65 | "MoltenEvaluateOperator", 66 | "MoltenEvaluateArgument", 67 | "MoltenImportOutput", 68 | }, 69 | version = "^1", -- use version <2.0.0 to avoid breaking changes 70 | build = ":UpdateRemotePlugins", 71 | specs = { 72 | { "AstroNvim/astroui", opts = { icons = { Molten = "󱓞" } } }, 73 | { 74 | "AstroNvim/astrocore", 75 | opts = function(_, opts) 76 | local maps = opts.mappings or {} 77 | local prefix = "j" 78 | 79 | maps.n[prefix] = { desc = require("astroui").get_icon("Molten", 1, true) .. "Molten" } 80 | maps.n[prefix .. "e"] = { "MoltenEvaluateOperator", desc = "Run operator selection" } 81 | maps.n[prefix .. "l"] = { "MoltenEvaluateLine", desc = "Evaluate line" } 82 | maps.n[prefix .. "c"] = { "MoltenReevaluateCell", desc = "Re-evaluate cell" } 83 | maps.n[prefix .. "k"] = { ":noautocmd MoltenEnterOutput", desc = "Enter Output" } 84 | maps.v[prefix .. "k"] = { 85 | function() 86 | vim.cmd "noautocmd MoltenEnterOutput" 87 | if vim.fn.mode() == "v" or vim.fn.mode() == "V" or vim.fn.mode() == "\22" then 88 | vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("", true, false, true), "n", true) 89 | end 90 | end, 91 | desc = "Enter Output", 92 | } 93 | 94 | maps.n[prefix .. "m"] = { desc = "Commands" } 95 | maps.n[prefix .. "mi"] = { "MoltenInit", desc = "Initialize the plugin" } 96 | maps.n[prefix .. "mh"] = { "MoltenHideOutput", desc = "Hide Output" } 97 | maps.n[prefix .. "mI"] = { "MoltenInterrupt", desc = "Interrupt Kernel" } 98 | maps.n[prefix .. "mR"] = { "MoltenRestart", desc = "Restart Kernel" } 99 | -- Dynamic Kernel Initialization based on Python Virtual Environment 100 | maps.n[prefix .. "mp"] = { 101 | function() 102 | local kernel_name = ensure_kernel_for_venv() 103 | if kernel_name then 104 | vim.cmd(("MoltenInit %s"):format(kernel_name)) 105 | else 106 | vim.notify("No kernel to initialize.", vim.log.levels.WARN) 107 | end 108 | end, 109 | desc = "Initialize for Python venv", 110 | silent = true, 111 | } 112 | 113 | maps.v[prefix] = { desc = require("astroui").get_icon("Molten", 1, true) .. "Molten" } 114 | maps.v[prefix .. "r"] = { ":MoltenEvaluateVisual", desc = "Evaluate visual selection" } 115 | 116 | maps.n["]c"] = { "MoltenNext", desc = "Next Molten Cel" } 117 | maps.n["[c"] = { "MoltenPrev", desc = "Previous Molten Cell" } 118 | 119 | opts.options.g["molten_auto_image_popup"] = false 120 | opts.options.g["molten_auto_open_html_in_browser"] = false 121 | opts.options.g["molten_auto_open_output"] = false 122 | opts.options.g["molten_cover_empty_lines"] = true 123 | 124 | opts.options.g["molten_enter_output_behavior"] = "open_and_enter" 125 | -- molten_output 126 | 127 | opts.options.g["molten_image_location"] = "both" 128 | opts.options.g["molten_image_provider"] = "image.nvim" 129 | opts.options.g["molten_output_show_more"] = true 130 | opts.options.g["molten_use_border_highlights"] = true 131 | 132 | opts.options.g["molten_output_virt_lines"] = false 133 | opts.options.g["molten_virt_lines_off_by_1"] = false 134 | opts.options.g["molten_virt_text_output"] = false 135 | opts.options.g["molten_wrap_output"] = true 136 | 137 | return opts 138 | end, 139 | }, 140 | }, 141 | } 142 | -------------------------------------------------------------------------------- /lua/plugins/neotest.lua: -------------------------------------------------------------------------------- 1 | ---@type LazySpec 2 | return { 3 | "nvim-neotest/neotest", 4 | lazy = true, 5 | dependencies = { 6 | { "nvim-lua/plenary.nvim", lazy = true }, 7 | { "nvim-neotest/nvim-nio", lazy = true }, 8 | { 9 | "AstroNvim/astroui", 10 | opts = { 11 | icons = { 12 | Tests = "󰗇", 13 | Watch = "", 14 | }, 15 | }, 16 | }, 17 | { 18 | "AstroNvim/astrocore", 19 | opts = function(_, opts) 20 | local maps = opts.mappings or {} 21 | 22 | local get_file_path = function() return vim.fn.expand "%" end 23 | local get_project_path = function() return vim.fn.getcwd() end 24 | 25 | local prefix = "T" 26 | 27 | maps.n[prefix] = { 28 | desc = require("astroui").get_icon("Tests", 1, true) .. "Tests", 29 | } 30 | maps.n[prefix .. "t"] = { 31 | function() require("neotest").run.run() end, 32 | desc = "Run test", 33 | } 34 | maps.n[prefix .. "d"] = { 35 | function() require("neotest").run.run { strategy = "dap" } end, 36 | desc = "Debug test", 37 | } 38 | maps.n[prefix .. "f"] = { 39 | function() require("neotest").run.run(get_file_path()) end, 40 | desc = "Run all tests in file", 41 | } 42 | maps.n[prefix .. "p"] = { 43 | function() require("neotest").run.run(get_project_path()) end, 44 | desc = "Run all tests in project", 45 | } 46 | maps.n[prefix .. ""] = { 47 | function() require("neotest").summary.toggle() end, 48 | desc = "Test Summary", 49 | } 50 | maps.n[prefix .. "o"] = { 51 | function() require("neotest").output.open() end, 52 | desc = "Output hover", 53 | } 54 | maps.n[prefix .. "O"] = { 55 | function() require("neotest").output_panel.toggle() end, 56 | desc = "Output window", 57 | } 58 | maps.n["]T"] = { 59 | function() require("neotest").jump.next() end, 60 | desc = "Next test", 61 | } 62 | maps.n["[T"] = { 63 | function() require("neotest").jump.prev() end, 64 | desc = "Previous test", 65 | } 66 | 67 | local watch_prefix = prefix .. "W" 68 | 69 | maps.n[watch_prefix] = { 70 | desc = require("astroui").get_icon("Watch", 1, true) .. "Watch", 71 | } 72 | maps.n[watch_prefix .. "t"] = { 73 | function() require("neotest").watch.toggle() end, 74 | desc = "Toggle watch test", 75 | } 76 | maps.n[watch_prefix .. "f"] = { 77 | function() require("neotest").watch.toggle(get_file_path()) end, 78 | desc = "Toggle watch all test in file", 79 | } 80 | maps.n[watch_prefix .. "p"] = { 81 | function() require("neotest").watch.toggle(get_project_path()) end, 82 | desc = "Toggle watch all tests in project", 83 | } 84 | maps.n[watch_prefix .. "S"] = { 85 | function() 86 | --- NOTE: The proper type of the argument is missing in the documentation 87 | ---@see https://github.com/nvim-neotest/neotest/blob/master/doc/neotest.txt#L626-L632 88 | ---@diagnostic disable-next-line: missing-parameter 89 | require("neotest").watch.stop() 90 | end, 91 | desc = "Stop all watches", 92 | } 93 | end, 94 | }, 95 | }, 96 | config = function(_, opts) 97 | vim.diagnostic.config({ 98 | virtual_text = { 99 | format = function(diagnostic) 100 | local message = diagnostic.message:gsub("\n", " "):gsub("\t", " "):gsub("%s+", " "):gsub("^%s+", "") 101 | return message 102 | end, 103 | }, 104 | }, vim.api.nvim_create_namespace "neotest") 105 | require("neotest").setup(opts) 106 | end, 107 | opts = { 108 | status = { virtual_text = true }, 109 | output = { open_on_run = true }, 110 | }, 111 | } 112 | -------------------------------------------------------------------------------- /lua/plugins/noice.lua: -------------------------------------------------------------------------------- 1 | -- test filter 2 | -- string.find( 3 | -- 'vim.lsp.get_active_clients() is deprecated. Run ":checkhealth vim.deprecated" for more information', 4 | -- ".*vim.lsp.get_active_clients() is deprecated.*" 5 | -- ) 6 | 7 | ---@type LazySpec 8 | return { 9 | { 10 | "folke/noice.nvim", 11 | event = "VeryLazy", 12 | dependencies = { 13 | { "MunifTanjim/nui.nvim", lazy = true }, 14 | }, 15 | specs = { 16 | { 17 | "AstroNvim/astrolsp", 18 | optional = true, 19 | ---@param opts AstroLSPOpts 20 | opts = function(_, opts) 21 | local noice_opts = require("astrocore").plugin_opts "noice.nvim" 22 | -- disable the necessary handlers in AstroLSP 23 | if not opts.lsp_handlers then opts.lsp_handlers = {} end 24 | if vim.tbl_get(noice_opts, "lsp", "hover", "enabled") ~= false then 25 | opts.lsp_handlers["textDocument/hover"] = false 26 | end 27 | if vim.tbl_get(noice_opts, "lsp", "signature", "enabled") ~= false then 28 | opts.lsp_handlers["textDocument/signatureHelp"] = false 29 | end 30 | end, 31 | }, 32 | { 33 | "nvim-treesitter/nvim-treesitter", 34 | opts = function(_, opts) 35 | if opts.ensure_installed ~= "all" then 36 | opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "regex", "vim" }) 37 | end 38 | end, 39 | }, 40 | { 41 | "rebelot/heirline.nvim", 42 | optional = true, 43 | opts = function(_, opts) 44 | local noice_opts = require("astrocore").plugin_opts "noice.nvim" 45 | if vim.tbl_get(noice_opts, "lsp", "progress", "enabled") ~= false then -- check if lsp progress is enabled 46 | opts.statusline[9] = require("astroui.status").component.lsp { lsp_progress = false } 47 | end 48 | end, 49 | }, 50 | }, 51 | opts = function(_, opts) 52 | return vim.tbl_deep_extend("force", opts, { 53 | lsp = { 54 | hover = { 55 | enabled = false, 56 | silent = true, 57 | }, 58 | -- override markdown rendering so that **cmp** and other plugins use **Treesitter** 59 | override = { 60 | ["vim.lsp.util.convert_input_to_markdown_lines"] = true, 61 | ["vim.lsp.util.stylize_markdown"] = true, 62 | ["cmp.entry.get_documentation"] = true, 63 | }, 64 | signature = { 65 | enabled = false, 66 | auto_open = { 67 | enabled = true, 68 | trigger = true, -- Automatically show signature help when typing a trigger character from the LSP 69 | luasnip = false, -- Will open signature help when jumping to Luasnip insert nodes 70 | throttle = 50, -- Debounce lsp signature help request by 50ms 71 | }, 72 | view = nil, -- when nil, use defaults from documentation 73 | opts = {}, -- merged with defaults from documentation 74 | }, 75 | message = { 76 | enabled = true, 77 | view = "mini", 78 | opts = {}, 79 | }, 80 | }, 81 | presets = { 82 | bottom_search = false, -- use a classic bottom cmdline for search 83 | command_palette = false, -- position the cmdline and popupmenu together 84 | long_message_to_split = true, -- long messages will be sent to a split 85 | inc_rename = false, -- enables an input dialog for inc-rename.nvim 86 | lsp_doc_border = true, -- add a border to hover docs and signature help 87 | }, 88 | routes = { 89 | { filter = { event = "msg_show", find = "DB: Query%s" }, opts = { skip = true } }, 90 | { filter = { event = "msg_show", find = "%swritten" }, opts = { skip = true } }, 91 | { filter = { event = "msg_show", find = "%schange;%s" }, opts = { skip = true } }, 92 | { filter = { event = "msg_show", find = "%s已写入" }, opts = { skip = true } }, 93 | { filter = { event = "msg_show", find = ".*行发生改变.*" }, opts = { skip = true } }, 94 | { filter = { event = "msg_show", find = ".*fewer lines" }, opts = { skip = true } }, 95 | { filter = { event = "msg_show", find = ".*vim.tbl_islist is deprecated.*" }, opts = { skip = true } }, 96 | { 97 | filter = { event = "msg_show", find = '.*Run ":checkhealth vim.deprecated".*' }, 98 | opts = { skip = true }, 99 | }, 100 | { 101 | filter = { event = "msg_show", find = "%-32603: Invalid offset" }, 102 | opts = { skip = true }, 103 | }, 104 | }, 105 | }) 106 | end, 107 | }, 108 | } 109 | -------------------------------------------------------------------------------- /lua/plugins/nvim-highlight-colors.lua: -------------------------------------------------------------------------------- 1 | ---@type LazySpec 2 | return { 3 | "brenoprata10/nvim-highlight-colors", 4 | opts = { 5 | virtual_symbol = "󱓻", 6 | virtual_symbol_suffix = " ", 7 | enabled_named_colors = false, 8 | render = "virtual", 9 | virtual_symbol_position = "inline", 10 | enable_tailwind = false, 11 | enable_short_hex = false, 12 | enable_named_colors = false, 13 | enable_hex = false, 14 | }, 15 | } 16 | -------------------------------------------------------------------------------- /lua/plugins/nvim-lint.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "mfussenegger/nvim-lint", 3 | event = "User AstroFile", 4 | opts = { 5 | -- Event to trigger linters 6 | events = { "BufWritePost", "BufReadPost", "InsertLeave" }, 7 | linters_by_ft = { 8 | -- Use the "*" filetype to run linters on all filetypes. 9 | -- ['*'] = { 'global linter' }, 10 | -- Use the "_" filetype to run linters on filetypes that don't have other linters configured. 11 | -- ['_'] = { 'fallback linter' }, 12 | -- ["*"] = { "typos" }, 13 | }, 14 | -- LazyVim extension to easily override linter options 15 | -- or add custom linters. 16 | ---@type table 17 | linters = { 18 | -- -- Example of using selene only when a selene.toml file is present 19 | -- selene = { 20 | -- -- `condition` is another LazyVim extension that allows you to 21 | -- -- dynamically enable/disable linters based on the context. 22 | -- condition = function(ctx) 23 | -- return vim.fs.find({ "selene.toml" }, { path = ctx.filename, upward = true })[1] 24 | -- end, 25 | -- }, 26 | }, 27 | }, 28 | config = function(_, opts) 29 | local M = {} 30 | 31 | local lint = require "lint" 32 | for name, linter in pairs(opts.linters) do 33 | if type(linter) == "table" and type(lint.linters[name]) == "table" then 34 | lint.linters[name] = vim.tbl_deep_extend("force", lint.linters[name], linter) 35 | if type(linter.prepend_args) == "table" then 36 | lint.linters[name].args = lint.linters[name].args or {} 37 | vim.list_extend(lint.linters[name].args, linter.prepend_args) 38 | end 39 | else 40 | lint.linters[name] = linter 41 | end 42 | end 43 | lint.linters_by_ft = opts.linters_by_ft 44 | 45 | function M.debounce(ms, fn) 46 | local timer = vim.uv.new_timer() 47 | return function(...) 48 | local argv = { ... } 49 | timer:start(ms, 0, function() 50 | timer:stop() 51 | vim.schedule_wrap(fn)(unpack(argv)) 52 | end) 53 | end 54 | end 55 | 56 | function M.lint() 57 | -- Use nvim-lint's logic first: 58 | -- * checks if linters exist for the full filetype first 59 | -- * otherwise will split filetype by "." and add all those linters 60 | -- * this differs from conform.nvim which only uses the first filetype that has a formatter 61 | local names = lint._resolve_linter_by_ft(vim.bo.filetype) 62 | 63 | -- Create a copy of the names table to avoid modifying the original. 64 | names = vim.list_extend({}, names) 65 | 66 | -- Add fallback linters. 67 | if #names == 0 then vim.list_extend(names, lint.linters_by_ft["_"] or {}) end 68 | 69 | -- Add global linters. 70 | vim.list_extend(names, lint.linters_by_ft["*"] or {}) 71 | 72 | -- Filter out linters that don't exist or don't match the condition. 73 | local ctx = { filename = vim.api.nvim_buf_get_name(0) } 74 | ctx.dirname = vim.fn.fnamemodify(ctx.filename, ":h") 75 | names = vim.tbl_filter(function(name) 76 | local linter = lint.linters[name] 77 | if not linter then vim.notify("Linter not found: " .. name, vim.log.levels.WARN, { title = "nvim-lint" }) end 78 | return linter and not (type(linter) == "table" and linter.condition and not linter.condition(ctx)) 79 | end, names) 80 | 81 | -- Run linters. 82 | if #names > 0 then lint.try_lint(names) end 83 | end 84 | 85 | vim.api.nvim_create_autocmd(opts.events, { 86 | group = vim.api.nvim_create_augroup("nvim-lint", { clear = true }), 87 | callback = M.debounce(100, M.lint), 88 | }) 89 | end, 90 | } 91 | -------------------------------------------------------------------------------- /lua/plugins/nvim-surround.lua: -------------------------------------------------------------------------------- 1 | ---@type LazySpec 2 | return { 3 | "kylechui/nvim-surround", 4 | version = "*", -- Use for stability; omit to use `main` branch for the latest features 5 | event = "VeryLazy", 6 | opts = { 7 | keymaps = { 8 | insert = false, 9 | insert_line = false, 10 | visual = "gs", 11 | }, 12 | }, 13 | } 14 | -------------------------------------------------------------------------------- /lua/plugins/overseer.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "stevearc/overseer.nvim", 3 | event = "User AstroFile", 4 | ---@param opts overseer.Config 5 | opts = function(_, opts) 6 | local window_scaling_factor = 0.3 7 | local height = require("utils").size(vim.o.lines, window_scaling_factor) 8 | local width = require("utils").size(vim.o.columns, window_scaling_factor) 9 | return vim.tbl_deep_extend("force", opts, { 10 | dap = false, 11 | templates = { "builtin" }, 12 | task_list = { 13 | width = width, 14 | height = height, 15 | default_detail = 1, 16 | direction = "bottom", 17 | bindings = { 18 | [""] = false, 19 | [""] = false, 20 | [""] = false, 21 | [""] = false, 22 | q = "close", 23 | K = "IncreaseDetail", 24 | J = "DecreaseDetail", 25 | [""] = "ScrollOutputUp", 26 | [""] = "ScrollOutputDown", 27 | }, 28 | }, 29 | -- Aliases for bundles of components. Redefine the builtins, or create your own. 30 | component_aliases = { 31 | -- Most tasks are initialized with the default components 32 | default = { 33 | { "display_duration", detail_level = 2 }, 34 | "on_output_summarize", 35 | "on_exit_set_status", 36 | { "on_complete_dispose", require_view = { "SUCCESS", "FAILURE" } }, 37 | }, 38 | -- Tasks from tasks.json use these components 39 | default_vscode = { 40 | "default", 41 | "on_result_diagnostics", 42 | }, 43 | }, 44 | bundles = { 45 | -- When saving a bundle with OverseerSaveBundle or save_task_bundle(), filter the tasks with 46 | -- these options (passed to list_tasks()) 47 | save_task_opts = { 48 | bundleable = true, 49 | }, 50 | -- Autostart tasks when they are loaded from a bundle 51 | autostart_on_load = false, 52 | }, 53 | }) 54 | end, 55 | specs = { 56 | { 57 | "mfussenegger/nvim-dap", 58 | optional = true, 59 | opts = function() require("overseer").enable_dap() end, 60 | }, 61 | { 62 | "nvim-neotest/neotest", 63 | optional = true, 64 | opts = function(_, opts) 65 | opts = opts or {} 66 | opts.consumers = opts.consumers or {} 67 | opts.consumers.overseer = require "neotest.consumers.overseer" 68 | end, 69 | }, 70 | { "AstroNvim/astroui", opts = { icons = { Overseer = "" } } }, 71 | { 72 | "AstroNvim/astrocore", 73 | opts = function(_, opts) 74 | local maps = opts.mappings or {} 75 | local prefix = "m" 76 | maps.n[prefix] = { desc = require("astroui").get_icon("Overseer", 1, true) .. "Overseer" } 77 | 78 | maps.n[prefix .. "t"] = { "OverseerToggle", desc = "Toggle Overseer" } 79 | maps.n[prefix .. "c"] = { "OverseerRunCmd", desc = "Run Command" } 80 | maps.n[prefix .. "r"] = { "OverseerRun", desc = "Run Task" } 81 | maps.n[prefix .. "q"] = { "OverseerQuickAction", desc = "Quick Action" } 82 | maps.n[prefix .. "a"] = { "OverseerTaskAction", desc = "Task Action" } 83 | maps.n[prefix .. "i"] = { "OverseerInfo", desc = "Overseer Info" } 84 | end, 85 | }, 86 | }, 87 | } 88 | -------------------------------------------------------------------------------- /lua/plugins/pack-angular.lua: -------------------------------------------------------------------------------- 1 | local function get_cmd(workspace_dir) 2 | local _ = require "mason-core.functional" 3 | local path = require "mason-core.path" 4 | local platform = require "mason-core.platform" 5 | 6 | local append_node_modules = _.map(function(dir) return path.concat { dir, "node_modules" } end) 7 | local install_dir = require("mason-registry").get_package("angular-language-server"):get_install_path() 8 | 9 | local cmd = { 10 | "ngserver", 11 | "--stdio", 12 | "--tsProbeLocations", 13 | table.concat(append_node_modules { workspace_dir, install_dir }, ","), 14 | "--ngProbeLocations", 15 | table.concat( 16 | append_node_modules { 17 | workspace_dir, 18 | path.concat { install_dir, "node_modules", "@angular", "language-server" }, 19 | }, 20 | "," 21 | ), 22 | } 23 | if platform.is.win then cmd[1] = vim.fn.exepath(cmd[1]) end 24 | 25 | return cmd 26 | end 27 | 28 | local angular_html_suffix = { 29 | "%.component%.html", 30 | "%.container%.html", 31 | } 32 | 33 | return { 34 | { 35 | "AstroNvim/astrolsp", 36 | ---@type AstroLSPOpts 37 | ---@diagnostic disable-next-line: assign-type-mismatch 38 | opts = function(_, opts) 39 | return vim.tbl_deep_extend("force", opts, { 40 | ---@diagnostic disable: missing-fields 41 | config = { 42 | angularls = { 43 | on_new_config = function(new_config, root_dir) 44 | -- WARNING:remove after pr merge: https://github.com/williamboman/mason-lspconfig.nvim/pull/503 45 | new_config.cmd = get_cmd(root_dir) 46 | end, 47 | root_dir = function(...) 48 | local util = require "lspconfig.util" 49 | return util.root_pattern(unpack { 50 | "nx.json", 51 | "angular.json", 52 | })(...) 53 | end, 54 | on_attach = function(client, bufnr) 55 | if require("astrocore").is_available "angular-quickswitch.nvim" then 56 | require("astrocore").set_mappings({ 57 | n = { 58 | ["gD"] = { 59 | vim.cmd.NgQuickSwitchToggle, 60 | desc = "angular quick switch toggle", 61 | }, 62 | }, 63 | }, { buffer = true }) 64 | end 65 | client.server_capabilities.renameProvider = false 66 | 67 | local filename = vim.api.nvim_buf_get_name(bufnr) 68 | for _, suffix_pattern in ipairs(angular_html_suffix) do 69 | if string.match(filename, suffix_pattern) then 70 | vim.treesitter.start(nil, "angular") 71 | break 72 | end 73 | end 74 | end, 75 | settings = { 76 | angular = { 77 | provideAutocomplete = true, 78 | validate = true, 79 | suggest = { 80 | includeAutomaticOptionalChainCompletions = true, 81 | includeCompletionsWithSnippetText = true, 82 | }, 83 | }, 84 | }, 85 | }, 86 | vtsls = { 87 | settings = { 88 | vtsls = { 89 | tsserver = { 90 | globalPlugins = {}, 91 | }, 92 | }, 93 | }, 94 | before_init = function(_, config) 95 | local angular_plugin_config = { 96 | name = "@angular/language-server", 97 | location = require("utils").get_pkg_path( 98 | "angular-language-server", 99 | "/node_modules/@angular/language-server" 100 | ), 101 | configNamespace = "typescript", 102 | enableForWorkspaceTypeScriptVersions = true, 103 | } 104 | require("astrocore").list_insert_unique( 105 | config.settings.vtsls.tsserver.globalPlugins, 106 | { angular_plugin_config } 107 | ) 108 | end, 109 | }, 110 | }, 111 | }) 112 | end, 113 | }, 114 | { 115 | "chaozwn/angular-quickswitch.nvim", 116 | event = "VeryLazy", 117 | opts = { 118 | use_default_keymaps = false, 119 | }, 120 | }, 121 | { 122 | "nvim-treesitter/nvim-treesitter", 123 | optional = true, 124 | opts = function(_, opts) 125 | if opts.ensure_installed ~= "all" then 126 | opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "angular" }) 127 | end 128 | end, 129 | }, 130 | { 131 | "WhoIsSethDaniel/mason-tool-installer.nvim", 132 | optional = true, 133 | opts = function(_, opts) 134 | opts.ensure_installed = 135 | require("astrocore").list_insert_unique(opts.ensure_installed, { "angular-language-server" }) 136 | end, 137 | }, 138 | { 139 | "stevearc/conform.nvim", 140 | optional = true, 141 | opts = function(_, opts) 142 | if not opts.formatters_by_ft then opts.formatters_by_ft = {} end 143 | opts.formatters_by_ft.htmlangular = { "prettier" } 144 | end, 145 | }, 146 | } 147 | -------------------------------------------------------------------------------- /lua/plugins/pack-bash.lua: -------------------------------------------------------------------------------- 1 | ---@type LazySpec 2 | return { 3 | { 4 | "nvim-treesitter/nvim-treesitter", 5 | optional = true, 6 | opts = function(_, opts) 7 | if opts.ensure_installed ~= "all" then 8 | opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "bash" }) 9 | end 10 | end, 11 | }, 12 | { 13 | "WhoIsSethDaniel/mason-tool-installer.nvim", 14 | optional = true, 15 | opts = function(_, opts) 16 | opts.ensure_installed = require("astrocore").list_insert_unique( 17 | opts.ensure_installed, 18 | { "bash-language-server", "shellcheck", "shfmt", "bash-debug-adapter" } 19 | ) 20 | end, 21 | }, 22 | { 23 | "stevearc/conform.nvim", 24 | optional = true, 25 | opts = { 26 | formatters_by_ft = { 27 | sh = { "shfmt" }, 28 | }, 29 | }, 30 | }, 31 | } 32 | -------------------------------------------------------------------------------- /lua/plugins/pack-docker.lua: -------------------------------------------------------------------------------- 1 | ---@type LazySpec 2 | return { 3 | { 4 | "AstroNvim/astrocore", 5 | ---@type AstroCoreOpts 6 | opts = { 7 | filetypes = { 8 | filename = { ["docker-compose.yaml"] = "yaml.docker-compose", ["docker-compose.yml"] = "yaml.docker-compose" }, 9 | }, 10 | }, 11 | }, 12 | { 13 | "nvim-treesitter/nvim-treesitter", 14 | optional = true, 15 | opts = function(_, opts) 16 | if opts.ensure_installed ~= "all" then 17 | opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "dockerfile" }) 18 | end 19 | end, 20 | }, 21 | { 22 | "WhoIsSethDaniel/mason-tool-installer.nvim", 23 | optional = true, 24 | opts = function(_, opts) 25 | opts.ensure_installed = require("astrocore").list_insert_unique( 26 | opts.ensure_installed, 27 | { "docker-compose-language-service", "dockerfile-language-server", "hadolint" } 28 | ) 29 | end, 30 | }, 31 | { 32 | "stevearc/conform.nvim", 33 | optional = true, 34 | opts = { 35 | formatters_by_ft = { 36 | ["yaml.docker-compose"] = { "prettierd", "prettier", stop_after_first = true }, 37 | }, 38 | }, 39 | }, 40 | { 41 | "mfussenegger/nvim-lint", 42 | optional = true, 43 | opts = { 44 | linters_by_ft = { 45 | ["docker-compose"] = { "hadolint" }, 46 | }, 47 | }, 48 | }, 49 | } 50 | -------------------------------------------------------------------------------- /lua/plugins/pack-git.lua: -------------------------------------------------------------------------------- 1 | ---@type LazySpec 2 | return { 3 | -- Treesitter git support 4 | { 5 | "nvim-treesitter/nvim-treesitter", 6 | opts = { ensure_installed = { "git_config", "gitcommit", "git_rebase", "gitignore", "gitattributes" } }, 7 | }, 8 | } 9 | -------------------------------------------------------------------------------- /lua/plugins/pack-graphql.lua: -------------------------------------------------------------------------------- 1 | local function create_graphql_config_file() 2 | local source_file = vim.fn.stdpath "config" .. "/.graphqlrc.yml" 3 | local target_file = vim.fn.getcwd() .. "/.graphqlrc.yml" 4 | require("utils").copy_file(source_file, target_file) 5 | end 6 | 7 | return { 8 | { 9 | "AstroNvim/astrocore", 10 | ---@type AstroCoreOpts 11 | opts = { 12 | autocmds = { 13 | auto_create_graphql_config_file = { 14 | { 15 | event = "FileType", 16 | desc = "create completion", 17 | pattern = { "graphql" }, 18 | callback = function() 19 | require("astrocore").set_mappings({ 20 | n = { 21 | ["lc"] = { 22 | create_graphql_config_file, 23 | desc = "Create graphql config file", 24 | }, 25 | }, 26 | }, { buffer = true }) 27 | end, 28 | }, 29 | }, 30 | }, 31 | }, 32 | }, 33 | { 34 | "nvim-treesitter/nvim-treesitter", 35 | optional = true, 36 | opts = function(_, opts) 37 | if opts.ensure_installed ~= "all" then 38 | opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "graphql" }) 39 | end 40 | end, 41 | }, 42 | { 43 | "WhoIsSethDaniel/mason-tool-installer.nvim", 44 | optional = true, 45 | opts = function(_, opts) 46 | opts.ensure_installed = 47 | require("astrocore").list_insert_unique(opts.ensure_installed, { "graphql-language-service-cli" }) 48 | end, 49 | }, 50 | } 51 | -------------------------------------------------------------------------------- /lua/plugins/pack-html-css.lua: -------------------------------------------------------------------------------- 1 | local filetypes = { 2 | "css", 3 | "eruby", 4 | "html", 5 | "htmldjango", 6 | "javascriptreact", 7 | "less", 8 | "pug", 9 | "sass", 10 | "scss", 11 | "typescriptreact", 12 | "vue", 13 | } 14 | 15 | ---@type LazySpec 16 | return { 17 | { 18 | "AstroNvim/astrolsp", 19 | ---@type AstroLSPOpts 20 | opts = function(_, opts) 21 | return vim.tbl_deep_extend("force", opts, { 22 | config = { 23 | emmet_language_server = { 24 | init_options = { 25 | --- @type boolean Defaults to `true` 26 | showAbbreviationSuggestions = false, 27 | --- @type "always" | "never" Defaults to `"always"` 28 | showExpandedAbbreviation = "always", 29 | --- @type boolean Defaults to `false` 30 | showSuggestionsAsSnippets = true, 31 | }, 32 | filetypes, 33 | }, 34 | html = { init_options = { provideFormatter = false } }, 35 | cssls = { 36 | init_options = { provideFormatter = false }, 37 | settings = { 38 | css = { 39 | lint = { 40 | unknownAtRules = "ignore", 41 | }, 42 | }, 43 | less = { 44 | lint = { 45 | unknownAtRules = "ignore", 46 | }, 47 | }, 48 | scss = { 49 | validate = false, 50 | lint = { 51 | unknownAtRules = "ignore", 52 | }, 53 | }, 54 | }, 55 | }, 56 | }, 57 | }) 58 | end, 59 | }, 60 | { 61 | "nvim-treesitter/nvim-treesitter", 62 | optional = true, 63 | opts = function(_, opts) 64 | if opts.ensure_installed ~= "all" then 65 | opts.ensure_installed = 66 | require("astrocore").list_insert_unique(opts.ensure_installed, { "html", "css", "scss" }) 67 | end 68 | vim.treesitter.language.register("scss", "less") 69 | vim.treesitter.language.register("scss", "postcss") 70 | end, 71 | }, 72 | { 73 | "AstroNvim/astrocore", 74 | ---@type AstroCoreOpts 75 | opts = { filetypes = { extension = { 76 | pcss = "postcss", 77 | postcss = "postcss", 78 | } } }, 79 | }, 80 | { 81 | "WhoIsSethDaniel/mason-tool-installer.nvim", 82 | optional = true, 83 | opts = function(_, opts) 84 | opts.ensure_installed = require("astrocore").list_insert_unique( 85 | opts.ensure_installed, 86 | { "html-lsp", "cssmodules-language-server", "css-lsp", "emmet-language-server", "prettierd" } 87 | ) 88 | end, 89 | }, 90 | { 91 | "stevearc/conform.nvim", 92 | optional = true, 93 | opts = { 94 | formatters_by_ft = { 95 | html = { "prettierd", "prettier", stop_after_first = true }, 96 | css = { "prettierd", "prettier", stop_after_first = true }, 97 | scss = { "prettierd", "prettier", stop_after_first = true }, 98 | less = { "prettierd", "prettier", stop_after_first = true }, 99 | postcss = { "prettierd", "prettier", stop_after_first = true }, 100 | }, 101 | }, 102 | }, 103 | { 104 | "echasnovski/mini.icons", 105 | optional = true, 106 | opts = { 107 | filetype = { 108 | postcss = { glyph = "󰌜", hl = "MiniIconsOrange" }, 109 | }, 110 | }, 111 | }, 112 | } 113 | -------------------------------------------------------------------------------- /lua/plugins/pack-json.lua: -------------------------------------------------------------------------------- 1 | ---@type LazySpec 2 | return { 3 | { 4 | "AstroNvim/astrocore", 5 | ---@type AstroCoreOpts 6 | opts = { 7 | autocmds = { 8 | auto_conceallevel_for_json = { 9 | { 10 | event = "FileType", 11 | desc = "Fix conceallevel for json files", 12 | pattern = { "json", "jsonc", "json5" }, 13 | callback = function() 14 | vim.wo.spell = false 15 | vim.wo.conceallevel = 0 16 | end, 17 | }, 18 | }, 19 | }, 20 | }, 21 | }, 22 | { 23 | "b0o/SchemaStore.nvim", 24 | lazy = true, 25 | version = false, 26 | specs = { 27 | { 28 | "AstroNvim/astrolsp", 29 | ---@type AstroLSPOpts 30 | opts = { 31 | ---@diagnostic disable: missing-fields 32 | config = { 33 | jsonls = { 34 | on_attach = function(client, _) 35 | client.server_capabilities.document_formatting = false 36 | client.server_capabilities.document_range_formatting = false 37 | end, 38 | -- lazy-load schemastore when needed 39 | on_new_config = function(new_config) 40 | new_config.settings.json.schemas = new_config.settings.json.schemas or {} 41 | vim.list_extend(new_config.settings.json.schemas, require("schemastore").json.schemas()) 42 | end, 43 | settings = { 44 | json = { 45 | format = { 46 | enable = true, 47 | }, 48 | validate = { enable = true }, 49 | }, 50 | }, 51 | }, 52 | }, 53 | }, 54 | }, 55 | }, 56 | }, 57 | { 58 | "nvim-treesitter/nvim-treesitter", 59 | optional = true, 60 | opts = function(_, opts) 61 | if opts.ensure_installed ~= "all" then 62 | opts.ensure_installed = 63 | require("astrocore").list_insert_unique(opts.ensure_installed, { "json", "jsonc", "json5" }) 64 | end 65 | end, 66 | }, 67 | { 68 | "WhoIsSethDaniel/mason-tool-installer.nvim", 69 | optional = true, 70 | opts = function(_, opts) 71 | opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "json-lsp" }) 72 | end, 73 | }, 74 | } 75 | -------------------------------------------------------------------------------- /lua/plugins/pack-lua.lua: -------------------------------------------------------------------------------- 1 | local utils = require "astrocore" 2 | 3 | local function selene_configured(path) 4 | return #vim.fs.find("selene.toml", { path = path, upward = true, type = "file" }) > 0 5 | end 6 | 7 | ---@type LazySpec 8 | return { 9 | { 10 | "AstroNvim/astrolsp", 11 | ---@type AstroLSPOpts 12 | opts = function(_, opts) 13 | return vim.tbl_deep_extend("force", opts, { 14 | config = { 15 | lua_ls = { settings = { Lua = { hint = { enable = true, arrayIndex = "Disable" } } } }, 16 | }, 17 | }) 18 | end, 19 | }, 20 | { 21 | "nvim-treesitter/nvim-treesitter", 22 | optional = true, 23 | opts = function(_, opts) 24 | if opts.ensure_installed ~= "all" then 25 | opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, { "lua", "luap" }) 26 | end 27 | end, 28 | }, 29 | { 30 | "WhoIsSethDaniel/mason-tool-installer.nvim", 31 | optional = true, 32 | opts = function(_, opts) 33 | opts.ensure_installed = 34 | require("astrocore").list_insert_unique(opts.ensure_installed, { "lua-language-server", "stylua", "selene" }) 35 | end, 36 | }, 37 | { 38 | "stevearc/conform.nvim", 39 | optional = true, 40 | opts = { 41 | formatters_by_ft = { 42 | lua = { "stylua" }, 43 | }, 44 | }, 45 | }, 46 | { 47 | "mfussenegger/nvim-lint", 48 | optional = true, 49 | opts = { 50 | linters_by_ft = { 51 | lua = { "selene" }, 52 | }, 53 | linters = { 54 | selene = { condition = function(ctx) return selene_configured(ctx.filename) end }, 55 | }, 56 | }, 57 | }, 58 | } 59 | -------------------------------------------------------------------------------- /lua/plugins/pack-markdown.lua: -------------------------------------------------------------------------------- 1 | local utils = require "utils" 2 | 3 | local markdown_table_change = function() 4 | vim.ui.input({ prompt = "Separate Char: " }, function(input) 5 | if not input or #input == 0 then return end 6 | local execute_command = ([[:'<,'>MakeTable! ]] .. input) 7 | vim.cmd(execute_command) 8 | end) 9 | end 10 | 11 | local function diagnostic() 12 | local system_config = vim.fn.stdpath "config" .. "/.markdownlint.jsonc" 13 | local project_config = vim.fn.getcwd() .. "/.markdownlint.jsonc" 14 | 15 | local markdownlint = require("lint").linters.markdownlint 16 | if not utils.contains_arg(markdownlint.args, "--config") then table.insert(markdownlint.args, "--config") end 17 | 18 | if vim.fn.filereadable(project_config) == 1 then 19 | if not utils.contains_arg(markdownlint.args, project_config) then 20 | table.insert(markdownlint.args, project_config) 21 | end 22 | else 23 | if not utils.contains_arg(markdownlint.args, system_config) then table.insert(markdownlint.args, system_config) end 24 | end 25 | 26 | return markdownlint.args 27 | end 28 | 29 | ---@type LazySpec 30 | return { 31 | { 32 | "AstroNvim/astrocore", 33 | ---@param opts AstroCoreOpts 34 | opts = function(_, opts) 35 | return require("astrocore").extend_tbl(opts, { 36 | options = { 37 | g = { 38 | mkdp_auto_close = 0, 39 | mkdp_combine_preview = 1, 40 | }, 41 | }, 42 | }) 43 | end, 44 | }, 45 | { 46 | "AstroNvim/astrolsp", 47 | ---@type AstroLSPOpts 48 | opts = function(_, opts) 49 | return vim.tbl_deep_extend("force", opts, { 50 | ---@diagnostic disable: missing-fields 51 | config = { 52 | marksman = { 53 | on_attach = function() 54 | if require("astrocore").is_available "markdown-preview.nvim" then 55 | require("astrocore").set_mappings({ 56 | n = { 57 | ["lz"] = { "MarkdownPreview", desc = "Markdown Start Preview" }, 58 | ["lZ"] = { "MarkdownPreviewStop", desc = "Markdown Stop Preview" }, 59 | ["lp"] = { "PasteImage", desc = "Paste image from system clipboard" }, 60 | }, 61 | x = { 62 | ["lt"] = { [[:'<,'>MakeTable! \t]], desc = "Markdown csv to table(Default:\\t)" }, 63 | ["lT"] = { markdown_table_change, desc = "Markdown csv to table with separate char" }, 64 | }, 65 | }, { buffer = true }) 66 | end 67 | end, 68 | }, 69 | }, 70 | }) 71 | end, 72 | }, 73 | { 74 | "nvim-treesitter/nvim-treesitter", 75 | optional = true, 76 | opts = function(_, opts) 77 | if opts.ensure_installed ~= "all" then 78 | opts.ensure_installed = require("astrocore").list_insert_unique( 79 | opts.ensure_installed, 80 | { "markdown", "markdown_inline", "html", "latex" } 81 | ) 82 | end 83 | end, 84 | }, 85 | { 86 | "WhoIsSethDaniel/mason-tool-installer.nvim", 87 | optional = true, 88 | opts = function(_, opts) 89 | opts.ensure_installed = 90 | require("astrocore").list_insert_unique(opts.ensure_installed, { "marksman", "prettierd", "markdownlint" }) 91 | end, 92 | }, 93 | -- install with yarn or npm 94 | { 95 | "iamcco/markdown-preview.nvim", 96 | cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" }, 97 | build = "cd app && yarn install", 98 | ft = { "markdown", "markdown.mdx" }, 99 | }, 100 | { 101 | "HakonHarnes/img-clip.nvim", 102 | cmd = { "PasteImage", "ImgClipDebug", "ImgClipConfig" }, 103 | opts = { 104 | default = { 105 | prompt_for_file_name = false, 106 | embed_image_as_base64 = false, 107 | drag_and_drop = { 108 | enabled = true, 109 | insert_mode = true, 110 | }, 111 | use_absolute_path = vim.fn.has "win32" == 1, 112 | relative_to_current_file = true, 113 | show_dir_path_in_prompt = true, 114 | dir_path = "assets/imgs/", 115 | }, 116 | }, 117 | }, 118 | { 119 | "MeanderingProgrammer/render-markdown.nvim", 120 | ft = { "markdown", "markdown.mdx" }, 121 | event = "VeryLazy", 122 | opts = { 123 | bullet = { 124 | right_pad = 1, 125 | }, 126 | }, 127 | dependencies = { "nvim-treesitter/nvim-treesitter", "echasnovski/mini.icons" }, 128 | }, 129 | { 130 | "mattn/vim-maketable", 131 | cmd = "MakeTable", 132 | ft = { "markdown", "markdown.mdx" }, 133 | }, 134 | { 135 | "stevearc/conform.nvim", 136 | optional = true, 137 | opts = { 138 | formatters_by_ft = { 139 | markdown = { "prettierd", "prettier", stop_after_first = true }, 140 | }, 141 | }, 142 | }, 143 | { 144 | "mfussenegger/nvim-lint", 145 | optional = true, 146 | opts = { 147 | linters = { 148 | markdownlint = { 149 | args = diagnostic(), 150 | }, 151 | }, 152 | linters_by_ft = { 153 | markdown = { "markdownlint" }, 154 | }, 155 | }, 156 | }, 157 | } 158 | -------------------------------------------------------------------------------- /lua/plugins/pack-prisma.lua: -------------------------------------------------------------------------------- 1 | ---@type LazySpec 2 | return { 3 | { 4 | "nvim-treesitter/nvim-treesitter", 5 | optional = true, 6 | opts = function(_, opts) 7 | if opts.ensure_installed ~= "all" then 8 | opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "prisma" }) 9 | end 10 | end, 11 | }, 12 | { 13 | "WhoIsSethDaniel/mason-tool-installer.nvim", 14 | optional = true, 15 | opts = function(_, opts) 16 | opts.ensure_installed = 17 | require("astrocore").list_insert_unique(opts.ensure_installed, { "prisma-language-server" }) 18 | end, 19 | }, 20 | } 21 | -------------------------------------------------------------------------------- /lua/plugins/pack-proto.lua: -------------------------------------------------------------------------------- 1 | local utils = require "utils" 2 | 3 | local function create_buf_config_file() 4 | local source_file = vim.fn.stdpath "config" .. "/buf.yaml" 5 | local target_file = vim.fn.getcwd() .. "/buf.yaml" 6 | utils.copy_file(source_file, target_file) 7 | end 8 | 9 | local function create_buf_gen_config_file() 10 | local source_file = vim.fn.stdpath "config" .. "/buf.gen.yaml" 11 | local target_file = vim.fn.getcwd() .. "/buf.gen.yaml" 12 | utils.copy_file(source_file, target_file) 13 | end 14 | 15 | local function formatting() 16 | local system_config = vim.fn.stdpath "config" .. "/buf.yaml" 17 | local project_config = vim.fn.getcwd() .. "/buf.yaml" 18 | 19 | local format_args = { "--config" } 20 | if vim.fn.filereadable(project_config) == 1 then 21 | table.insert(format_args, project_config) 22 | else 23 | table.insert(format_args, system_config) 24 | end 25 | return format_args 26 | end 27 | 28 | local function diagnostic() 29 | local system_config = vim.fn.stdpath "config" .. "/buf.yaml" 30 | local project_config = vim.fn.getcwd() .. "/buf.yaml" 31 | 32 | local buf_lint = require("lint").linters.buf_lint 33 | if not utils.contains_arg(buf_lint.args, "--config") then table.insert(buf_lint.args, "--config") end 34 | 35 | if vim.fn.filereadable(project_config) == 1 then 36 | if not utils.contains_arg(buf_lint.args, project_config) then table.insert(buf_lint.args, project_config) end 37 | else 38 | if not utils.contains_arg(buf_lint.args, system_config) then table.insert(buf_lint.args, system_config) end 39 | end 40 | 41 | return buf_lint.args 42 | end 43 | 44 | ---@type LazySpec 45 | return { 46 | { 47 | "AstroNvim/astrocore", 48 | ---@type AstroCoreOpts 49 | opts = { 50 | autocmds = { 51 | auto_create_proto_config_file = { 52 | { 53 | event = "FileType", 54 | desc = "create completion", 55 | pattern = { "proto" }, 56 | callback = function() 57 | require("astrocore").set_mappings({ 58 | n = { 59 | ["lc"] = { 60 | function() 61 | local buf_path = vim.fn.getcwd() .. "/buf.yaml" 62 | local buf_gen_path = vim.fn.getcwd() .. "/buf.gen.yaml" 63 | if not utils.file_exists(buf_path) then 64 | local confirm = 65 | vim.fn.confirm("File `buf.yaml` Not Exist, Create it?", "&Yes\n&No", 1, "Question") 66 | if confirm == 1 then create_buf_config_file() end 67 | end 68 | 69 | if not utils.file_exists(buf_gen_path) then 70 | local confirm = 71 | vim.fn.confirm("File `buf.gen.yaml` Not Exist, Create it?", "&Yes\n&No", 1, "Question") 72 | if confirm == 1 then create_buf_gen_config_file() end 73 | end 74 | end, 75 | desc = "Create Buf Config File", 76 | }, 77 | }, 78 | }, { buffer = true }) 79 | end, 80 | }, 81 | }, 82 | }, 83 | }, 84 | }, 85 | { 86 | "nvim-treesitter/nvim-treesitter", 87 | optional = true, 88 | opts = function(_, opts) 89 | -- Ensure that opts.ensure_installed exists and is a table or string "all". 90 | if opts.ensure_installed ~= "all" then 91 | opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "proto" }) 92 | end 93 | end, 94 | }, 95 | { 96 | "WhoIsSethDaniel/mason-tool-installer.nvim", 97 | optional = true, 98 | opts = function(_, opts) 99 | opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "buf" }) 100 | end, 101 | }, 102 | { 103 | "stevearc/conform.nvim", 104 | optional = true, 105 | opts = { 106 | formatters = { 107 | buf = { 108 | prepend_args = formatting(), 109 | }, 110 | }, 111 | formatters_by_ft = { 112 | proto = { "buf" }, 113 | }, 114 | }, 115 | }, 116 | { 117 | "mfussenegger/nvim-lint", 118 | optional = true, 119 | opts = { 120 | linters = { 121 | buf_lint = { 122 | args = diagnostic(), 123 | }, 124 | }, 125 | linters_by_ft = { 126 | proto = { "buf_lint" }, 127 | }, 128 | }, 129 | }, 130 | } 131 | -------------------------------------------------------------------------------- /lua/plugins/pack-python.lua: -------------------------------------------------------------------------------- 1 | local utils = require "astrocore" 2 | -- print(vim.fn.stdpath "data" .. "/lazy/rust-prettifier-for-lldb/rust_prettifier_for_lldb.py") 3 | ---@type LazySpec 4 | return { 5 | { 6 | "AstroNvim/astrolsp", 7 | ---@type AstroLSPOpts 8 | opts = function(_, opts) 9 | return vim.tbl_deep_extend("force", opts, { 10 | ---@diagnostic disable: missing-fields 11 | config = { 12 | basedpyright = { 13 | on_attach = function() 14 | require("astrocore").set_mappings({ 15 | n = { 16 | ["lo"] = { 17 | "PyrightOrganizeImports", 18 | desc = "Organize Imports", 19 | }, 20 | }, 21 | }, { buffer = true }) 22 | end, 23 | before_init = function(_, c) 24 | if not c.settings then c.settings = {} end 25 | if not c.settings.python then c.settings.python = {} end 26 | c.settings.python.pythonPath = vim.fn.exepath "python" 27 | end, 28 | filetypes = { "python" }, 29 | single_file_support = true, 30 | root_dir = function(...) 31 | local util = require "lspconfig.util" 32 | return util.root_pattern(unpack { 33 | "pyproject.toml", 34 | "setup.py", 35 | "setup.cfg", 36 | "requirements.txt", 37 | "Pipfile", 38 | "pyrightconfig.json", 39 | })(...) 40 | end, 41 | settings = { 42 | basedpyright = { 43 | analysis = { 44 | typeCheckingMode = "basic", 45 | autoImportCompletions = true, 46 | autoSearchPaths = true, 47 | diagnosticMode = "openFilesOnly", 48 | useLibraryCodeForTypes = true, 49 | reportMissingTypeStubs = false, 50 | diagnosticSeverityOverrides = { 51 | reportUnusedImport = "information", 52 | reportUnusedFunction = "information", 53 | reportUnusedVariable = "information", 54 | reportGeneralTypeIssues = "none", 55 | reportOptionalMemberAccess = "none", 56 | reportOptionalSubscript = "none", 57 | reportPrivateImportUsage = "none", 58 | }, 59 | }, 60 | }, 61 | }, 62 | }, 63 | }, 64 | }) 65 | end, 66 | }, 67 | { 68 | "nvim-treesitter/nvim-treesitter", 69 | optional = true, 70 | opts = function(_, opts) 71 | if opts.ensure_installed ~= "all" then 72 | opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, { "python", "toml", "ninja", "rst" }) 73 | end 74 | end, 75 | }, 76 | { 77 | "WhoIsSethDaniel/mason-tool-installer.nvim", 78 | optional = true, 79 | opts = function(_, opts) 80 | opts.ensure_installed = 81 | require("astrocore").list_insert_unique(opts.ensure_installed, { "basedpyright", "black", "isort", "debugpy" }) 82 | end, 83 | }, 84 | { 85 | "mfussenegger/nvim-dap-python", 86 | ft = "python", -- NOTE: ft: lazy-load on filetype 87 | config = function() 88 | if vim.fn.has "win32" == 1 then 89 | require("dap-python").setup(require("utils").get_pkg_path("debugpy", "/venv/Scripts/pythonw.exe")) 90 | else 91 | require("dap-python").setup(require("utils").get_pkg_path("debugpy", "/venv/bin/python")) 92 | end 93 | end, 94 | }, 95 | { 96 | "nvim-neotest/neotest", 97 | optional = true, 98 | dependencies = { "nvim-neotest/neotest-python" }, 99 | opts = function(_, opts) 100 | if not opts.adapters then opts.adapters = {} end 101 | table.insert(opts.adapters, require "neotest-python"(require("astrocore").plugin_opts "neotest-python")) 102 | end, 103 | }, 104 | { 105 | "stevearc/conform.nvim", 106 | optional = true, 107 | opts = { 108 | formatters_by_ft = { 109 | python = { "isort", "black" }, 110 | }, 111 | }, 112 | }, 113 | } 114 | -------------------------------------------------------------------------------- /lua/plugins/pack-sql.lua: -------------------------------------------------------------------------------- 1 | local sql_ft = { "sql", "mysql", "plsql", "dbt" } 2 | 3 | local utils = require "utils" 4 | local astrocore = require "astrocore" 5 | local set_mappings = astrocore.set_mappings 6 | 7 | local function sql_formatter_linter(name) 8 | local f_by_ft = {} 9 | for _, ft in ipairs(sql_ft) do 10 | f_by_ft[ft] = { name } 11 | end 12 | return f_by_ft 13 | end 14 | 15 | local function create_sqlfluff_config_file() 16 | local source_file = vim.fn.stdpath "config" .. "/.sqlfluff" 17 | local target_file = vim.fn.getcwd() .. "/.sqlfluff" 18 | utils.copy_file(source_file, target_file) 19 | end 20 | 21 | local function formatting() return { "--dialect", "polyglot" } end 22 | 23 | local function diagnostic() 24 | local system_config = vim.fn.stdpath "config" .. "/.sqlfluff" 25 | local project_config = vim.fn.getcwd() .. "/.sqlfluff" 26 | 27 | local sqlfluff = { "lint", "--format=json" } 28 | table.insert(sqlfluff, "--config") 29 | 30 | if vim.fn.filereadable(project_config) == 1 then 31 | table.insert(sqlfluff, project_config) 32 | else 33 | table.insert(sqlfluff, system_config) 34 | end 35 | 36 | return sqlfluff 37 | end 38 | 39 | local function remove_special_chars(input_str) 40 | local pattern = "[%+%*%?%.%^%$%(%)%[%]%%%-&%#]" 41 | local resultStr = input_str:gsub(pattern, "") 42 | return resultStr 43 | end 44 | 45 | ---@type LazySpec 46 | return { 47 | { 48 | "kristijanhusak/vim-dadbod-ui", 49 | cmd = { "DBUI", "DBUIToggle", "DBUIAddConnection", "DBUIFindBuffer" }, 50 | dependencies = { 51 | { "tpope/vim-dadbod", cmd = "DB", lazy = true }, 52 | { "kristijanhusak/vim-dadbod-completion", ft = sql_ft, lazy = true }, 53 | }, 54 | specs = { 55 | "saghen/blink.cmp", 56 | optional = true, 57 | opts = function(_, opts) 58 | return require("astrocore").extend_tbl(opts, { 59 | sources = { 60 | default = require("astrocore").list_insert_unique(opts.sources.default, { "dadbod" }), 61 | providers = { 62 | dadbod = { name = "Dadbod", module = "vim_dadbod_completion.blink" }, 63 | }, 64 | }, 65 | }) 66 | end, 67 | }, 68 | keys = { 69 | { "D", "DBUIToggle", desc = "Toggle DBUI" }, 70 | }, 71 | init = function() 72 | local data_path = vim.fn.stdpath "data" 73 | 74 | vim.g.db_ui_auto_execute_table_helpers = 1 75 | vim.g.db_ui_save_location = data_path .. "/dadbod_ui" 76 | vim.g.db_ui_show_database_icon = true 77 | vim.g.db_ui_tmp_query_location = data_path .. "/dadbod_ui/tmp" 78 | vim.g.db_ui_use_nerd_fonts = true 79 | vim.g.db_ui_use_nvim_notify = true 80 | vim.g.db_ui_winwidth = require("utils").size(vim.o.columns, 0.3) 81 | vim.g.db_ui_win_position = "right" 82 | vim.g.db_ui_disable_info_notifications = 1 83 | 84 | vim.g.Db_ui_buffer_name_generator = function(opts) 85 | local table_name = opts.table 86 | 87 | if table_name and table_name ~= "" then 88 | return string.format("%s_%s.sql", remove_special_chars(table_name), os.time()) 89 | else 90 | return string.format("console_%s.sql", os.time()) 91 | end 92 | end 93 | 94 | -- NOTE: The default behavior of auto-execution of queries on save is disabled 95 | -- this is useful when you have a big query that you don't want to run every time 96 | -- you save the file running those queries can crash neovim to run use the 97 | -- default keymap: S 98 | vim.g.db_ui_execute_on_save = false 99 | end, 100 | }, 101 | { 102 | "AstroNvim/astrocore", 103 | ---@type AstroCoreOpts 104 | opts = { 105 | autocmds = { 106 | auto_create_sqlfluff_config_file = { 107 | { 108 | event = "FileType", 109 | desc = "create completion", 110 | pattern = sql_ft, 111 | callback = function() 112 | set_mappings({ 113 | n = { 114 | ["lc"] = { 115 | create_sqlfluff_config_file, 116 | desc = "Create sqlfluff config file", 117 | }, 118 | }, 119 | }, { buffer = true }) 120 | end, 121 | }, 122 | }, 123 | }, 124 | }, 125 | }, 126 | { 127 | "nvim-treesitter/nvim-treesitter", 128 | optional = true, 129 | opts = function(_, opts) 130 | if opts.ensure_installed ~= "all" then 131 | opts.ensure_installed = astrocore.list_insert_unique(opts.ensure_installed, { "sql" }) 132 | end 133 | end, 134 | }, 135 | { 136 | "WhoIsSethDaniel/mason-tool-installer.nvim", 137 | optional = true, 138 | opts = function(_, opts) 139 | opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "sqlfluff", "sqlfmt" }) 140 | end, 141 | }, 142 | { 143 | "stevearc/conform.nvim", 144 | optional = true, 145 | opts = function(_, opts) 146 | return vim.tbl_deep_extend("force", opts, { 147 | formatters = { 148 | sqlfmt = { 149 | prepend_args = formatting(), 150 | }, 151 | }, 152 | formatters_by_ft = sql_formatter_linter "sqlfmt", 153 | }) 154 | end, 155 | }, 156 | { 157 | "mfussenegger/nvim-lint", 158 | optional = true, 159 | opts = function(_, opts) 160 | return vim.tbl_deep_extend("force", opts, { 161 | linters = { 162 | sqlfluff = { 163 | args = diagnostic(), 164 | }, 165 | }, 166 | linters_by_ft = sql_formatter_linter "sqlfluff", 167 | }) 168 | end, 169 | }, 170 | } 171 | -------------------------------------------------------------------------------- /lua/plugins/pack-tailwindcss.lua: -------------------------------------------------------------------------------- 1 | ---@type LazySpec 2 | return { 3 | { 4 | "AstroNvim/astrolsp", 5 | ---@type AstroLSPOpts 6 | opts = function(_, opts) 7 | return vim.tbl_deep_extend("force", opts, { 8 | ---@diagnostic disable: missing-fields 9 | config = { 10 | tailwindcss = { 11 | root_dir = function(fname) 12 | local root_pattern = require("lspconfig").util.root_pattern( 13 | "tailwind.config.cjs", 14 | "tailwind.config.js", 15 | "tailwind.config.ts", 16 | "postcss.config.js", 17 | "config/tailwind.config.js" 18 | ) 19 | return root_pattern(fname) 20 | end, 21 | settings = { 22 | tailwindCSS = { 23 | classAttributes = { 24 | "class", 25 | "className", 26 | "ngClass", 27 | "classList", 28 | }, 29 | experimental = { 30 | classRegex = { 31 | { "cva\\(([^)]*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]" }, 32 | { "cx\\(([^)]*)\\)", "(?:'|\"|`)([^']*)(?:'|\"|`)" }, 33 | { 34 | "tw`([^`]*)", 35 | 'tw="([^"]*)', 36 | 'tw={"([^"}]*)', 37 | "tw\\.\\w+`([^`]*)", 38 | "tw\\(.*?\\)`([^`]*)", 39 | }, 40 | }, 41 | }, 42 | includeLanguages = { 43 | typescript = "javascript", 44 | typescriptreact = "javascript", 45 | }, 46 | emmetCompletions = false, 47 | validate = true, 48 | lint = { 49 | cssConflict = "warning", 50 | invalidApply = "error", 51 | invalidConfigPath = "error", 52 | invalidScreen = "error", 53 | invalidTailwindDirective = "error", 54 | invalidVariant = "error", 55 | recommendedVariantOrder = "warning", 56 | }, 57 | }, 58 | }, 59 | }, 60 | }, 61 | }) 62 | end, 63 | }, 64 | { 65 | "nvim-treesitter/nvim-treesitter", 66 | optional = true, 67 | opts = function(_, opts) 68 | if opts.ensure_installed ~= "all" then 69 | opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "css" }) 70 | end 71 | end, 72 | }, 73 | { 74 | "WhoIsSethDaniel/mason-tool-installer.nvim", 75 | optional = true, 76 | opts = function(_, opts) 77 | opts.ensure_installed = 78 | require("astrocore").list_insert_unique(opts.ensure_installed, { "tailwindcss-language-server" }) 79 | end, 80 | }, 81 | } 82 | -------------------------------------------------------------------------------- /lua/plugins/pack-thrift.lua: -------------------------------------------------------------------------------- 1 | ---@type LazySpec 2 | return { 3 | { 4 | "nvim-treesitter/nvim-treesitter", 5 | optional = true, 6 | opts = function(_, opts) 7 | -- Ensure that opts.ensure_installed exists and is a table or string "all". 8 | if opts.ensure_installed ~= "all" then 9 | opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "thrift" }) 10 | end 11 | end, 12 | }, 13 | { 14 | "WhoIsSethDaniel/mason-tool-installer.nvim", 15 | optional = true, 16 | opts = function(_, opts) 17 | opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "thriftls" }) 18 | end, 19 | }, 20 | } 21 | -------------------------------------------------------------------------------- /lua/plugins/pack-toml.lua: -------------------------------------------------------------------------------- 1 | ---@type LazySpec 2 | return { 3 | { 4 | "AstroNvim/astrolsp", 5 | ---@type AstroLSPOpts 6 | opts = function(_, opts) 7 | return vim.tbl_deep_extend("force", opts, { 8 | ---@diagnostic disable: missing-fields 9 | config = { 10 | taplo = { 11 | evenBetterToml = { schema = { catalogs = { "https://www.schemastore.org/api/json/catalog.json" } } }, 12 | on_attach = function() 13 | require("astrocore").set_mappings({ 14 | n = { 15 | ["K"] = { 16 | function() 17 | if vim.fn.expand "%:t" == "Cargo.toml" and require("crates").popup_available() then 18 | require("crates").show_popup() 19 | else 20 | vim.lsp.buf.hover() 21 | end 22 | end, 23 | desc = "Show Crate Documentation", 24 | }, 25 | }, 26 | }, { buffer = true }) 27 | end, 28 | }, 29 | }, 30 | }) 31 | end, 32 | }, 33 | { 34 | "nvim-treesitter/nvim-treesitter", 35 | optional = true, 36 | opts = function(_, opts) 37 | -- Ensure that opts.ensure_installed exists and is a table or string "all". 38 | if opts.ensure_installed ~= "all" then 39 | opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "toml" }) 40 | end 41 | end, 42 | }, 43 | { 44 | "WhoIsSethDaniel/mason-tool-installer.nvim", 45 | optional = true, 46 | opts = function(_, opts) 47 | opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "taplo" }) 48 | end, 49 | }, 50 | { 51 | "stevearc/conform.nvim", 52 | optional = true, 53 | opts = { 54 | formatters_by_ft = { 55 | toml = { "taplo" }, 56 | }, 57 | }, 58 | }, 59 | } 60 | -------------------------------------------------------------------------------- /lua/plugins/pack-vue.lua: -------------------------------------------------------------------------------- 1 | return { 2 | { 3 | "AstroNvim/astrolsp", 4 | optional = true, 5 | ---@type AstroLSPOpts 6 | ---@diagnostic disable-next-line: assign-type-mismatch 7 | opts = function(_, opts) 8 | local vtsls_ft = require("astrocore").list_insert_unique(vim.tbl_get(opts, "config", "vtsls", "filetypes") or { 9 | "javascript", 10 | "javascriptreact", 11 | "javascript.jsx", 12 | "typescript", 13 | "typescriptreact", 14 | "typescript.tsx", 15 | }, { "vue" }) 16 | 17 | return vim.tbl_deep_extend("force", opts, { 18 | ---@diagnostic disable: missing-fields 19 | config = { 20 | volar = { 21 | init_options = { 22 | vue = { 23 | hybridMode = true, 24 | }, 25 | }, 26 | settings = { 27 | vue = { 28 | server = { 29 | maxOldSpaceSize = 8092, 30 | }, 31 | }, 32 | }, 33 | }, 34 | vtsls = { 35 | filetypes = vtsls_ft, 36 | settings = { 37 | vtsls = { 38 | tsserver = { 39 | globalPlugins = {}, 40 | }, 41 | }, 42 | }, 43 | before_init = function(_, config) 44 | local vue_plugin_config = { 45 | name = "@vue/typescript-plugin", 46 | location = require("utils").get_pkg_path("vue-language-server", "/node_modules/@vue/language-server"), 47 | languages = { "vue" }, 48 | configNamespace = "typescript", 49 | enableForWorkspaceTypeScriptVersions = true, 50 | } 51 | local style_plugin_config = { 52 | name = "@styled/typescript-styled-plugin", 53 | location = require("utils").get_global_npm_path(), 54 | enableForWorkspaceTypeScriptVersions = true, 55 | } 56 | local nx_plugin_config = { 57 | name = "@monodon/typescript-nx-imports-plugin", 58 | location = require("utils").get_global_npm_path(), 59 | enableForWorkspaceTypeScriptVersions = true, 60 | } 61 | require("astrocore").list_insert_unique( 62 | config.settings.vtsls.tsserver.globalPlugins, 63 | { vue_plugin_config, style_plugin_config, nx_plugin_config } 64 | ) 65 | end, 66 | }, 67 | }, 68 | }) 69 | end, 70 | }, 71 | { 72 | "nvim-treesitter/nvim-treesitter", 73 | optional = true, 74 | opts = function(_, opts) 75 | if opts.ensure_installed ~= "all" then 76 | opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "vue" }) 77 | end 78 | end, 79 | }, 80 | { 81 | "WhoIsSethDaniel/mason-tool-installer.nvim", 82 | optional = true, 83 | opts = function(_, opts) 84 | opts.ensure_installed = 85 | require("astrocore").list_insert_unique(opts.ensure_installed, { "vue-language-server", "js-debug-adapter" }) 86 | end, 87 | }, 88 | } 89 | -------------------------------------------------------------------------------- /lua/plugins/pack-xml.lua: -------------------------------------------------------------------------------- 1 | return { 2 | { 3 | "nvim-treesitter/nvim-treesitter", 4 | optional = true, 5 | opts = function(_, opts) 6 | if opts.ensure_installed ~= "all" then 7 | opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "xml", "html" }) 8 | end 9 | end, 10 | }, 11 | { 12 | "WhoIsSethDaniel/mason-tool-installer.nvim", 13 | optional = true, 14 | opts = function(_, opts) 15 | opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "lemminx" }) 16 | end, 17 | }, 18 | } 19 | -------------------------------------------------------------------------------- /lua/plugins/pack-yaml.lua: -------------------------------------------------------------------------------- 1 | ---@type LazySpec 2 | return { 3 | { 4 | "b0o/SchemaStore.nvim", 5 | lazy = true, 6 | specs = { 7 | { 8 | "AstroNvim/astrolsp", 9 | ---@type AstroLSPOpts 10 | opts = function(_, opts) 11 | return vim.tbl_deep_extend("force", opts, { 12 | ---@diagnostic disable: missing-fields 13 | config = { 14 | yamlls = { 15 | on_attach = function(client, _) 16 | -- Neovim < 0.10 does not have dynamic registration for formatting 17 | if vim.fn.has "nvim-0.10" == 0 then client.server_capabilities.documentFormattingProvider = true end 18 | end, 19 | on_new_config = function(config) 20 | config.settings.yaml.schemas = vim.tbl_deep_extend( 21 | "force", 22 | config.settings.yaml.schemas or {}, 23 | require("schemastore").yaml.schemas() 24 | ) 25 | end, 26 | settings = { yaml = { schemaStore = { enable = false, url = "" } } }, 27 | }, 28 | }, 29 | }) 30 | end, 31 | }, 32 | }, 33 | }, 34 | { 35 | "WhoIsSethDaniel/mason-tool-installer.nvim", 36 | optional = true, 37 | opts = function(_, opts) 38 | opts.ensure_installed = 39 | require("astrocore").list_insert_unique(opts.ensure_installed, { "yaml-language-server", "prettierd" }) 40 | end, 41 | }, 42 | { 43 | "nvim-treesitter/nvim-treesitter", 44 | optional = true, 45 | opts = function(_, opts) 46 | if opts.ensure_installed ~= "all" then 47 | opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "xml", "yaml" }) 48 | end 49 | end, 50 | }, 51 | { 52 | "stevearc/conform.nvim", 53 | optional = true, 54 | opts = { 55 | formatters_by_ft = { 56 | yaml = { "prettierd", "prettier", stop_after_first = true }, 57 | }, 58 | }, 59 | }, 60 | } 61 | -------------------------------------------------------------------------------- /lua/plugins/rainbow-delimiters.lua: -------------------------------------------------------------------------------- 1 | ---@type LazySpec 2 | return { 3 | "HiPhish/rainbow-delimiters.nvim", 4 | dependencies = "nvim-treesitter/nvim-treesitter", 5 | event = "User AstroFile", 6 | main = "rainbow-delimiters.setup", 7 | } 8 | -------------------------------------------------------------------------------- /lua/plugins/refactoring.lua: -------------------------------------------------------------------------------- 1 | ---@type LazySpec 2 | return { 3 | "ThePrimeagen/refactoring.nvim", 4 | event = "VeryLazy", 5 | specs = { 6 | "nvim-lua/plenary.nvim", 7 | "nvim-treesitter/nvim-treesitter", 8 | { 9 | "AstroNvim/astrocore", 10 | ---@param opts AstroCoreOpts 11 | ---@diagnostic disable: missing-fields 12 | ---@diagnostic disable: missing-parameter 13 | opts = function(_, opts) 14 | local prefix = "r" 15 | local maps = opts.mappings or {} 16 | local get_icon = require("astroui").get_icon 17 | 18 | maps.n[prefix] = { name = get_icon("Refactoring", 1, true) .. "Refactor" } 19 | maps.n[prefix .. "b"] = { 20 | function() require("refactoring").refactor "Extract Block" end, 21 | desc = "Extract Block", 22 | } 23 | maps.n[prefix .. "i"] = { 24 | function() require("refactoring").refactor "Inline Variable" end, 25 | desc = "Inline Variable", 26 | } 27 | maps.n[prefix .. "p"] = { 28 | function() require("refactoring").debug.printf { below = false } end, 29 | desc = "Debug: Print Function", 30 | } 31 | maps.n[prefix .. "c"] = { 32 | function() require("refactoring").debug.cleanup {} end, 33 | desc = "Debug: Clean Up", 34 | } 35 | maps.n[prefix .. "d"] = { 36 | function() require("refactoring").debug.print_var { below = false } end, 37 | desc = "Debug: Print Variable", 38 | } 39 | maps.n[prefix .. "bf"] = { 40 | function() require("refactoring").refactor "Extract Block To File" end, 41 | desc = "Extract Block To File", 42 | } 43 | 44 | maps.x[prefix] = { name = get_icon("Refactoring", 1, true) .. "Refactor" } 45 | maps.x[prefix .. "e"] = { 46 | function() require("refactoring").refactor "Extract Function" end, 47 | desc = "Extract Function", 48 | } 49 | maps.x[prefix .. "f"] = { 50 | function() require("refactoring").refactor "Extract Function To File" end, 51 | desc = "Extract Function To File", 52 | } 53 | maps.x[prefix .. "v"] = { 54 | function() require("refactoring").refactor "Extract Variable" end, 55 | desc = "Extract Variable", 56 | } 57 | maps.x[prefix .. "i"] = { 58 | function() require("refactoring").refactor "Inline Variable" end, 59 | desc = "Inline Variable", 60 | } 61 | 62 | maps.v[prefix] = { name = get_icon("Refactoring", 1, true) .. "Refactor" } 63 | maps.v[prefix .. "e"] = { 64 | function() require("refactoring").refactor "Extract Function" end, 65 | desc = "Extract Function", 66 | } 67 | maps.v[prefix .. "f"] = { 68 | function() require("refactoring").refactor "Extract Function To File" end, 69 | desc = "Extract Function To File", 70 | } 71 | maps.v[prefix .. "v"] = { 72 | function() require("refactoring").refactor "Extract Variable" end, 73 | desc = "Extract Variable", 74 | } 75 | maps.v[prefix .. "i"] = { 76 | function() require("refactoring").refactor "Inline Variable" end, 77 | desc = "Inline Variable", 78 | } 79 | maps.v[prefix .. "b"] = { 80 | function() require("refactoring").refactor "Extract Block" end, 81 | desc = "Extract Block", 82 | } 83 | maps.v[prefix .. "bf"] = { 84 | function() require("refactoring").refactor "Extract Block To File" end, 85 | desc = "Extract Block To File", 86 | } 87 | maps.v[prefix .. "r"] = { 88 | function() require("refactoring").select_refactor() end, 89 | desc = "Select Refactor", 90 | } 91 | maps.v[prefix .. "p"] = { 92 | function() require("refactoring").debug.printf { below = false } end, 93 | desc = "Debug: Print Function", 94 | } 95 | maps.v[prefix .. "c"] = { 96 | function() require("refactoring").debug.cleanup {} end, 97 | desc = "Debug: Clean Up", 98 | } 99 | maps.v[prefix .. "d"] = { 100 | function() require("refactoring").debug.print_var { below = false } end, 101 | desc = "Debug: Print Variable", 102 | } 103 | end, 104 | }, 105 | { 106 | "AstroNvim/astroui", 107 | ---@type AstroUIOpts 108 | opts = { 109 | icons = { 110 | Refactoring = "󰣪", 111 | }, 112 | }, 113 | }, 114 | }, 115 | opts = { 116 | prompt_func_return_type = { 117 | go = true, 118 | }, 119 | prompt_func_param_type = { 120 | go = true, 121 | }, 122 | }, 123 | } 124 | -------------------------------------------------------------------------------- /lua/plugins/resession.lua: -------------------------------------------------------------------------------- 1 | return { 2 | { 3 | "stevearc/resession.nvim", 4 | specs = { 5 | { 6 | "AstroNvim/astrocore", 7 | ---@type AstroCoreOpts 8 | opts = { 9 | autocmds = { 10 | -- disable alpha autostart 11 | alpha_autostart = false, 12 | restore_session = { 13 | { 14 | event = "VimEnter", 15 | desc = "Restore previous directory session if neovim opened with no arguments", 16 | nested = true, -- trigger other autocommands as buffers open 17 | callback = function() 18 | -- Logic copied from https://github.com/AstroNvim/AstroNvim/blob/365aa6e083dcd25fa3d1c8a2515d7e71a03d51d3/lua/astronvim/plugins/alpha.lua#L49 19 | local should_skip 20 | local lines = vim.api.nvim_buf_get_lines(0, 0, 2, false) 21 | if 22 | vim.fn.argc() > 0 -- don't start when opening a file 23 | or #lines > 1 -- don't open if current buffer has more than 1 line 24 | or (#lines == 1 and lines[1]:len() > 0) -- don't open the current buffer if it has anything on the first line 25 | or #vim.tbl_filter(function(bufnr) return vim.bo[bufnr].buflisted end, vim.api.nvim_list_bufs()) > 1 -- don't open if any listed buffers 26 | or not vim.o.modifiable -- don't open if not modifiable 27 | then 28 | should_skip = true 29 | else 30 | for _, arg in pairs(vim.v.argv) do 31 | if arg == "-b" or arg == "-c" or vim.startswith(arg, "+") or arg == "-S" then 32 | should_skip = true 33 | break 34 | end 35 | end 36 | end 37 | if should_skip then return end 38 | -- if possible, load session 39 | if 40 | not pcall( 41 | function() 42 | require("resession").load(vim.fn.getcwd(), { dir = "dirsession", silence_errors = true }) 43 | end 44 | ) 45 | then 46 | -- if session was not loaded, if possible, load alpha 47 | require("lazy").load { plugins = { "alpha-nvim" } } 48 | if pcall(function() require("alpha").start(true) end) then 49 | vim.schedule(function() vim.cmd.doautocmd "FileType" end) 50 | end 51 | end 52 | end, 53 | }, 54 | }, 55 | }, 56 | }, 57 | }, 58 | }, 59 | opts = { 60 | extensions = { 61 | overseer = {}, 62 | }, 63 | }, 64 | }, 65 | } 66 | -------------------------------------------------------------------------------- /lua/plugins/sleuth.lua: -------------------------------------------------------------------------------- 1 | ---@type LazySpec 2 | return { "tpope/vim-sleuth", event = "User AstroFile" } 3 | -------------------------------------------------------------------------------- /lua/plugins/snacks.lua: -------------------------------------------------------------------------------- 1 | return { 2 | { 3 | "folke/snacks.nvim", 4 | priority = 1000, 5 | lazy = false, 6 | ---@type snacks.Config 7 | opts = { 8 | bigfile = { enabled = true }, 9 | input = { enabled = true }, 10 | debug = { enabled = true }, 11 | indent = { 12 | enabled = true, 13 | filter = function(buf) 14 | local forbidden_filetypes = { "markdown", "markdown.mdx" } -- Add your forbidden filetypes here 15 | local filetype = vim.bo[buf].filetype 16 | for _, ft in ipairs(forbidden_filetypes) do 17 | if filetype == ft then return false end 18 | end 19 | return vim.g.snacks_indent ~= false and vim.b[buf].snacks_indent ~= false and vim.bo[buf].buftype == "" 20 | end, 21 | }, 22 | notifier = { enabled = true }, 23 | scroll = { enabled = true }, 24 | scope = { enabled = true }, 25 | statuscolumn = { 26 | enabled = true, 27 | left = { "mark", "sign" }, -- priority of signs on the left (high to low) 28 | right = { "fold", "git" }, -- priority of signs on the right (high to low) 29 | folds = { 30 | open = false, -- show open fold icons 31 | git_hl = false, -- use Git Signs hl for fold icons 32 | }, 33 | git = { 34 | -- patterns to match Git signs 35 | patterns = { "GitSign", "MiniDiffSign" }, 36 | }, 37 | refresh = 50, -- refresh at most every 50ms 38 | }, 39 | profiler = { enabled = true }, 40 | lazygit = {}, 41 | terminal = {}, 42 | }, 43 | }, 44 | { 45 | "rebelot/heirline.nvim", 46 | opts = function(_, opts) opts.statuscolumn = false end, 47 | }, 48 | { "lukas-reineke/indent-blankline.nvim", enabled = false }, 49 | { "rcarriga/nvim-notify", enabled = false }, 50 | { "NMAC427/guess-indent.nvim", enabled = false }, 51 | { "akinsho/toggleterm.nvim", enabled = false }, 52 | } 53 | -------------------------------------------------------------------------------- /lua/plugins/trouble.lua: -------------------------------------------------------------------------------- 1 | ---@type LazySpec 2 | return { 3 | "folke/trouble.nvim", 4 | cmd = "Trouble", 5 | specs = { 6 | { "stevearc/aerial.nvim", optional = true, enabled = false }, 7 | { "AstroNvim/astroui", opts = { icons = { Trouble = "󱍼" } } }, 8 | { 9 | "AstroNvim/astrocore", 10 | opts = function(_, opts) 11 | local maps = opts.mappings or {} 12 | local prefix = "x" 13 | maps.n[prefix] = { desc = require("astroui").get_icon("Trouble", 1, true) .. "Trouble" } 14 | maps.n[prefix .. "x"] = { 15 | "Trouble diagnostics toggle", 16 | desc = "Diagnostics (Trouble)", 17 | } 18 | maps.n[prefix .. "X"] = 19 | { "Trouble diagnostics toggle filter.buf=0", desc = "Buffer Diagnostics (Trouble)" } 20 | maps.n["ls"] = { 21 | "Trouble symbols toggle focus=false", 22 | desc = "Symbols (Trouble)", 23 | } 24 | maps.n["lS"] = { 25 | "Trouble lsp toggle focus=false win.position=right", 26 | desc = "LSP references/definitions/... (Trouble)", 27 | } 28 | maps.n[prefix .. "L"] = { "Trouble loclist toggle", desc = "Location List (Trouble)" } 29 | maps.n[prefix .. "Q"] = { "Trouble quickfix toggle", desc = "Quickfix List (Trouble)" } 30 | maps.n["[q"] = { 31 | function() 32 | if require("trouble").is_open() then 33 | require("trouble").prev { skip_groups = true, jump = true } 34 | else 35 | local ok, err = pcall(vim.cmd.cprev) 36 | if not ok then vim.notify(err, vim.log.levels.ERROR) end 37 | end 38 | end, 39 | desc = "Previous Trouble/Quickfix Item", 40 | } 41 | 42 | maps.n["]q"] = { 43 | function() 44 | if require("trouble").is_open() then 45 | require("trouble").next { skip_groups = true, jump = true } 46 | else 47 | local ok, err = pcall(vim.cmd.cnext) 48 | if not ok then vim.notify(err, vim.log.levels.ERROR) end 49 | end 50 | end, 51 | desc = "Next Trouble/Quickfix Item", 52 | } 53 | end, 54 | }, 55 | { "lewis6991/gitsigns.nvim", opts = { trouble = true } }, 56 | }, 57 | opts = function(_, opts) 58 | if not opts.icons then opts.icons = {} end 59 | if not opts.icons.kinds then 60 | opts.icons.kinds = { 61 | Array = " ", 62 | Boolean = "󰨙 ", 63 | Class = " ", 64 | Constant = "󰏿 ", 65 | Constructor = " ", 66 | Enum = " ", 67 | EnumMember = " ", 68 | Event = " ", 69 | Field = " ", 70 | File = " ", 71 | Function = "󰊕 ", 72 | Interface = " ", 73 | Key = " ", 74 | Method = "󰊕 ", 75 | Module = " ", 76 | Namespace = "󰦮 ", 77 | Null = " ", 78 | Number = "󰎠 ", 79 | Object = " ", 80 | Operator = " ", 81 | Package = " ", 82 | Property = " ", 83 | String = " ", 84 | Struct = "󰆼 ", 85 | TypeParameter = " ", 86 | Variable = "󰀫 ", 87 | } 88 | end 89 | for kind, _ in pairs(opts.icons.kinds) do 90 | local icon, _, _ = require("mini.icons").get("lsp", kind) 91 | opts.icons.kinds[kind] = icon .. " " 92 | end 93 | return vim.tbl_deep_extend("force", opts, { 94 | modes = { 95 | lsp = { 96 | win = { position = "right" }, 97 | }, 98 | }, 99 | keys = { 100 | [""] = "close", 101 | ["q"] = "close", 102 | [""] = "close", 103 | }, 104 | auto_preview = true, -- automatically open preview when on an item 105 | auto_refresh = true, -- auto refresh when open 106 | }) 107 | end, 108 | } 109 | -------------------------------------------------------------------------------- /lua/plugins/user.lua: -------------------------------------------------------------------------------- 1 | ---@type LazySpec 2 | return { 3 | { "max397574/better-escape.nvim", enabled = false }, 4 | { "goolord/alpha-nvim", enabled = false }, 5 | { "kevinhwang91/nvim-ufo", enabled = false }, 6 | { "jay-babu/mason-null-ls.nvim", enabled = false }, 7 | { "nvimtools/none-ls.nvim", enabled = false }, 8 | } 9 | -------------------------------------------------------------------------------- /lua/plugins/visual-multi.lua: -------------------------------------------------------------------------------- 1 | ---@type LazySpec 2 | return { 3 | "mg979/vim-visual-multi", 4 | event = "User AstroFile", 5 | specs = { 6 | { 7 | "AstroNvim/astrocore", 8 | ---@param opts AstroCoreOpts 9 | opts = function(_, opts) 10 | return vim.tbl_deep_extend("force", opts, { 11 | options = { 12 | g = { 13 | ["VM_default_mappings"] = 0, 14 | ["Find Under"] = "", 15 | ["Find Subword Under"] = "", 16 | ["Add Cursor Up"] = "", 17 | ["Add Cursor Down"] = "", 18 | ["Select All"] = "", 19 | ["Skip Region"] = "", 20 | }, 21 | }, 22 | }) 23 | end, 24 | }, 25 | }, 26 | } 27 | -------------------------------------------------------------------------------- /lua/plugins/whick-key.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "folke/which-key.nvim", 3 | opts = { 4 | preset = "helix", 5 | }, 6 | } 7 | -------------------------------------------------------------------------------- /lua/plugins/yazi.lua: -------------------------------------------------------------------------------- 1 | ---@type LazySpec 2 | return { 3 | "mikavilpas/yazi.nvim", 4 | enabled = vim.fn.executable "yazi" == 1, 5 | specs = { 6 | { "nvim-neo-tree/neo-tree.nvim", enabled = false }, 7 | }, 8 | event = "VeryLazy", 9 | keys = { 10 | { 11 | "o", 12 | "Yazi", 13 | desc = "Open yazi at the current file", 14 | }, 15 | { 16 | -- Open in the current working directory 17 | "O", 18 | "Yazi toggle", 19 | desc = "Resume the last yazi session", 20 | }, 21 | { 22 | -- NOTE: this requires a version of yazi that includes 23 | -- https://github.com/sxyazi/yazi/pull/1305 from 2024-07-18 24 | "e", 25 | "Yazi cwd", 26 | desc = "Open the file manager in nvim's working directory", 27 | }, 28 | }, 29 | opts = { 30 | open_multiple_tabs = false, 31 | floating_window_scaling_factor = { 32 | height = 1, 33 | width = 0.9, 34 | }, 35 | -- the transparency of the yazi floating window (0-100). See :h winblend 36 | yazi_floating_window_winblend = 0, 37 | -- the type of border to use for the floating window. Can be many values, 38 | -- including 'none', 'rounded', 'single', 'double', 'shadow', etc. For 39 | -- more information, see :h nvim_open_win 40 | yazi_floating_window_border = "rounded", 41 | open_for_directories = true, 42 | keymaps = { 43 | show_help = "", 44 | open_file_in_vertical_split = "", 45 | open_file_in_horizontal_split = "", 46 | open_file_in_tab = "", 47 | grep_in_directory = "", 48 | replace_in_directory = "", 49 | cycle_open_buffers = "", 50 | copy_relative_path_to_selected_files = "", 51 | send_to_quickfix_list = "", 52 | change_working_directory = "", 53 | }, 54 | integrations = { 55 | grep_in_directory = "fzf-lua", 56 | grep_in_selected_files = "fzf-lua", 57 | }, 58 | future_features = { 59 | -- Whether to use `ya emit reveal` to reveal files in the file manager. 60 | -- Requires yazi 0.4.0 or later (from 2024-12-08). 61 | ya_emit_reveal = true, 62 | 63 | -- Use `ya emit open` as a more robust implementation for opening files 64 | -- in yazi. This can prevent conflicts with custom keymappings for the enter 65 | -- key. Requires yazi 0.4.0 or later (from 2024-12-08). 66 | ya_emit_open = true, 67 | }, 68 | }, 69 | } 70 | -------------------------------------------------------------------------------- /lua/polish.lua: -------------------------------------------------------------------------------- 1 | -- This will run last in the setup process and is a good place to configure 2 | -- things like custom filetypes. This just pure lua so anything that doesn't 3 | -- fit in the normal config locations above can go here 4 | vim.treesitter.language.register("bash", "kitty") 5 | -- Remove some keymaps, default set up in nvim 0.11 6 | vim.tbl_map(function(v) require("utils").remove_keymap("n", "gr" .. v) end, { "r", "a", "n", "i" }) 7 | -------------------------------------------------------------------------------- /lua/utils/lualine.lua: -------------------------------------------------------------------------------- 1 | ---@class lazyvim.util.lualine 2 | local M = {} 3 | 4 | ---@param icon string 5 | ---@param status fun(): nil|"ok"|"error"|"pending" 6 | function M.status(icon, status) 7 | local colors = { 8 | ok = "Special", 9 | error = "DiagnosticError", 10 | pending = "DiagnosticWarn", 11 | } 12 | return { 13 | function() return icon end, 14 | cond = function() return status() ~= nil end, 15 | color = function() return { fg = require("snacks").util.color(colors[status()] or colors.ok) } end, 16 | } 17 | end 18 | 19 | ---@param name string 20 | ---@param icon? string 21 | function M.cmp_source(name, icon) 22 | local mini_icon, _, _ = require("mini.icons").get("lsp", name) 23 | icon = icon or mini_icon 24 | local started = false 25 | return M.status(icon, function() 26 | if not package.loaded["cmp"] then return end 27 | for _, s in ipairs(require("cmp").core.sources or {}) do 28 | if s.name == name then 29 | if s.source:is_available() then 30 | started = true 31 | else 32 | return started and "error" or nil 33 | end 34 | if s.status == s.SourceStatus.FETCHING then return "pending" end 35 | return "ok" 36 | end 37 | end 38 | end) 39 | end 40 | 41 | ---@param component any 42 | ---@param text string 43 | ---@param hl_group? string 44 | ---@return string 45 | function M.format(component, text, hl_group) 46 | text = text:gsub("%%", "%%%%") 47 | if not hl_group or hl_group == "" then return text end 48 | ---@type table 49 | component.hl_cache = component.hl_cache or {} 50 | local lualine_hl_group = component.hl_cache[hl_group] 51 | if not lualine_hl_group then 52 | local utils = require "lualine.utils.utils" 53 | ---@type string[] 54 | local gui = vim.tbl_filter(function(x) return x end, { 55 | utils.extract_highlight_colors(hl_group, "bold") and "bold", 56 | utils.extract_highlight_colors(hl_group, "italic") and "italic", 57 | }) 58 | 59 | lualine_hl_group = component:create_hl({ 60 | fg = utils.extract_highlight_colors(hl_group, "fg"), 61 | gui = #gui > 0 and table.concat(gui, ",") or nil, 62 | }, "LV_" .. hl_group) --[[@as string]] 63 | component.hl_cache[hl_group] = lualine_hl_group 64 | end 65 | return component:format_hl(lualine_hl_group) .. text .. component:get_default_hl() 66 | end 67 | 68 | ---@param opts? {relative: "cwd"|"root", modified_hl: string?, directory_hl: string?, filename_hl: string?, modified_sign: string?, readonly_icon: string?, length: number?} 69 | function M.pretty_path(opts) 70 | opts = vim.tbl_extend("force", { 71 | relative = "cwd", 72 | modified_hl = "MatchParen", 73 | directory_hl = "", 74 | filename_hl = "Bold", 75 | modified_sign = "", 76 | readonly_icon = " 󰌾 ", 77 | length = 3, 78 | }, opts or {}) 79 | 80 | return function(self) 81 | local path = vim.fn.expand "%:p" --[[@as string]] 82 | 83 | if path == "" then return "" end 84 | 85 | path = require("astrocore.rooter").normpath(path) 86 | local root = require("utils").get_rooter() 87 | local cwd = require("utils").cwd() 88 | 89 | if opts.relative == "cwd" and path:find(cwd, 1, true) == 1 then 90 | path = path:sub(#cwd + 2) 91 | elseif path:find(root, 1, true) == 1 then 92 | path = path:sub(#root + 2) 93 | end 94 | 95 | local sep = package.config:sub(1, 1) 96 | local parts = vim.split(path, "[\\/]") 97 | 98 | if opts.length == 0 then 99 | parts = parts 100 | elseif #parts > opts.length then 101 | parts = { parts[1], "…", unpack(parts, #parts - opts.length + 2, #parts) } 102 | end 103 | 104 | if opts.modified_hl and vim.bo.modified then 105 | parts[#parts] = parts[#parts] .. opts.modified_sign 106 | parts[#parts] = M.format(self, parts[#parts], opts.modified_hl) 107 | else 108 | parts[#parts] = M.format(self, parts[#parts], opts.filename_hl) 109 | end 110 | 111 | local dir = "" 112 | if #parts > 1 then 113 | dir = table.concat({ unpack(parts, 1, #parts - 1) }, sep) 114 | dir = M.format(self, dir .. sep, opts.directory_hl) 115 | end 116 | 117 | local readonly = "" 118 | if vim.bo.readonly then readonly = M.format(self, opts.readonly_icon, opts.modified_hl) end 119 | return dir .. parts[#parts] .. readonly 120 | end 121 | end 122 | 123 | ---@param opts? {cwd:false, subdirectory: true, parent: true, other: true, icon?:string} 124 | function M.root_dir(opts) 125 | opts = vim.tbl_extend("force", { 126 | cwd = false, 127 | subdirectory = true, 128 | parent = true, 129 | other = true, 130 | icon = "󱉭 ", 131 | color = function() return { fg = require("snacks").util.color "Special" } end, 132 | }, opts or {}) 133 | 134 | local function get() 135 | local cwd = require("utils").cwd() 136 | local root = require("utils").get_rooter() 137 | local name = vim.fs.basename(root) 138 | 139 | if root == cwd then 140 | -- root is cwd 141 | return opts.cwd and name 142 | elseif root:find(cwd, 1, true) == 1 then 143 | -- root is subdirectory of cwd 144 | return opts.subdirectory and name 145 | elseif cwd:find(root, 1, true) == 1 then 146 | -- root is parent directory of cwd 147 | return opts.parent and name 148 | else 149 | -- root and cwd are not related 150 | return opts.other and name 151 | end 152 | end 153 | 154 | return { 155 | function() return (opts.icon and opts.icon .. " ") .. get() end, 156 | cond = function() return type(get()) == "string" end, 157 | color = opts.color, 158 | } 159 | end 160 | 161 | return M 162 | -------------------------------------------------------------------------------- /lua/utils/ui.lua: -------------------------------------------------------------------------------- 1 | ---@class lazyvim.util.ui 2 | local M = {} 3 | 4 | -- foldtext for Neovim < 0.10.0 5 | function M.foldtext() return vim.api.nvim_buf_get_lines(0, vim.v.lnum - 1, vim.v.lnum, false)[1] end 6 | 7 | -- optimized treesitter foldexpr for Neovim >= 0.10.0 8 | function M.foldexpr() 9 | local buf = vim.api.nvim_get_current_buf() 10 | if vim.b[buf].ts_folds == nil then 11 | -- as long as we don't have a filetype, don't bother 12 | -- checking if treesitter is available (it won't) 13 | if vim.bo[buf].filetype == "" then return "0" end 14 | if vim.bo[buf].filetype:find "dashboard" then 15 | vim.b[buf].ts_folds = false 16 | else 17 | vim.b[buf].ts_folds = pcall(vim.treesitter.get_parser, buf) 18 | end 19 | end 20 | return vim.b[buf].ts_folds and vim.treesitter.foldexpr() or "0" 21 | end 22 | 23 | return M 24 | -------------------------------------------------------------------------------- /mini_astronvim.lua: -------------------------------------------------------------------------------- 1 | -- save as repro.lua 2 | -- run with nvim -u repro.lua 3 | -- DO NOT change the paths 4 | local root = vim.fn.fnamemodify("./.repro", ":p") 5 | 6 | -- set stdpaths to use .repro 7 | for _, name in ipairs { "config", "data", "state", "runtime", "cache" } do 8 | vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name 9 | end 10 | 11 | -- bootstrap lazy 12 | local lazypath = root .. "/plugins/lazy.nvim" 13 | if not vim.loop.fs_stat(lazypath) then 14 | -- stylua: ignore 15 | vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath }) 16 | end 17 | vim.opt.rtp:prepend(vim.env.LAZY or lazypath) 18 | 19 | -- install plugins 20 | local plugins = { 21 | { "AstroNvim/AstroNvim", import = "astronvim.plugins" }, 22 | { "AstroNvim/astrocommunity" }, 23 | { 24 | "mikavilpas/yazi.nvim", 25 | enabled = vim.fn.executable "yazi" == 1, 26 | specs = { 27 | { "nvim-neo-tree/neo-tree.nvim", enabled = false }, 28 | }, 29 | event = "VeryLazy", 30 | keys = { 31 | -- 👇 in this section, choose your own keymappings! 32 | { 33 | "o", 34 | "Yazi", 35 | desc = "Open yazi at the current file", 36 | }, 37 | { 38 | -- Open in the current working directory 39 | "O", 40 | "Yazi cwd", 41 | desc = "Open the file manager in nvim's working directory", 42 | }, 43 | { 44 | -- NOTE: this requires a version of yazi that includes 45 | -- https://github.com/sxyazi/yazi/pull/1305 from 2024-07-18 46 | "e", 47 | "Yazi toggle", 48 | desc = "Resume the last yazi session", 49 | }, 50 | }, 51 | ---@type YaziConfig 52 | opts = { 53 | open_multiple_tabs = false, 54 | floating_window_scaling_factor = 0.8, 55 | -- the transparency of the yazi floating window (0-100). See :h winblend 56 | yazi_floating_window_winblend = 0, 57 | -- the type of border to use for the floating window. Can be many values, 58 | -- including 'none', 'rounded', 'single', 'double', 'shadow', etc. For 59 | -- more information, see :h nvim_open_win 60 | yazi_floating_window_border = "rounded", 61 | open_for_directories = true, 62 | keymaps = { 63 | show_help = "", 64 | open_file_in_vertical_split = "", 65 | open_file_in_horizontal_split = "", 66 | open_file_in_tab = "", 67 | grep_in_directory = "", 68 | replace_in_directory = "", 69 | cycle_open_buffers = "", 70 | copy_relative_path_to_selected_files = "", 71 | send_to_quickfix_list = "", 72 | change_working_directory = "", 73 | }, 74 | integrations = { 75 | grep_in_directory = "fzf-lua", 76 | grep_in_selected_files = "fzf-lua", 77 | }, 78 | future_features = { 79 | -- Whether to use `ya emit reveal` to reveal files in the file manager. 80 | -- Requires yazi 0.4.0 or later (from 2024-12-08). 81 | ya_emit_reveal = true, 82 | 83 | -- Use `ya emit open` as a more robust implementation for opening files 84 | -- in yazi. This can prevent conflicts with custom keymappings for the enter 85 | -- key. Requires yazi 0.4.0 or later (from 2024-12-08). 86 | ya_emit_open = true, 87 | }, 88 | }, 89 | }, 90 | -- add any other plugins/customizations here 91 | } 92 | require("lazy").setup(plugins, { 93 | root = root .. "/plugins", 94 | }) 95 | 96 | -- add anything else here (autocommands, vim.filetype, etc.) 97 | -------------------------------------------------------------------------------- /mini_lazyvim.lua: -------------------------------------------------------------------------------- 1 | -- save as repro.lua 2 | -- run with nvim -u repro.lua 3 | -- DO NOT change the paths 4 | local root = vim.fn.fnamemodify("./.repro", ":p") 5 | 6 | -- set stdpaths to use .repro 7 | for _, name in ipairs { "config", "data", "state", "runtime", "cache" } do 8 | vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name 9 | end 10 | 11 | -- bootstrap lazy 12 | local lazypath = root .. "/plugins/lazy.nvim" 13 | if not vim.loop.fs_stat(lazypath) then 14 | -- stylua: ignore 15 | vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath }) 16 | end 17 | vim.opt.rtp:prepend(vim.env.LAZY or lazypath) 18 | 19 | -- install plugins 20 | local plugins = { 21 | { "LazyVim/LazyVim", import = "lazyvim.plugins" }, 22 | { import = "lazyvim.plugins.extras.lang.typescript" }, 23 | { import = "lazyvim.plugins.extras.lang.vue" }, 24 | -- add any other plugins/customizations here 25 | } 26 | require("lazy").setup(plugins, { 27 | root = root .. "/plugins", 28 | }) 29 | 30 | -- add anything else here (autocommands, vim.filetype, etc.) 31 | -------------------------------------------------------------------------------- /mini_template.lua: -------------------------------------------------------------------------------- 1 | -- Bootstrap lazy.nvim 2 | local lazypath = vim.fn.stdpath "data" .. "/lazy/lazy.nvim" 3 | if not (vim.uv or vim.loop).fs_stat(lazypath) then 4 | local lazyrepo = "https://github.com/folke/lazy.nvim.git" 5 | local out = vim.fn.system { "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath } 6 | if vim.v.shell_error ~= 0 then 7 | vim.api.nvim_echo({ 8 | { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, 9 | { out, "WarningMsg" }, 10 | { "\nPress any key to exit..." }, 11 | }, true, {}) 12 | vim.fn.getchar() 13 | os.exit(1) 14 | end 15 | end 16 | vim.opt.rtp:prepend(lazypath) 17 | 18 | -- Make sure to setup `mapleader` and `maplocalleader` before 19 | -- loading lazy.nvim so that mappings are correct. 20 | -- This is also a good place to setup other settings (vim.opt) 21 | vim.g.mapleader = " " 22 | vim.g.maplocalleader = "\\" 23 | 24 | -- Setup lazy.nvim 25 | require("lazy").setup { 26 | spec = { 27 | -- add your plugins here 28 | { 29 | "williamboman/mason.nvim", 30 | config = function() require("mason").setup() end, 31 | }, 32 | { 33 | "mfussenegger/nvim-dap", 34 | dependencies = { "rcarriga/nvim-dap-ui", "nvim-neotest/nvim-nio" }, 35 | config = function() 36 | local dap, dapui = require "dap", require "dapui" 37 | 38 | dapui.setup() 39 | 40 | dap.listeners.before.attach.dapui_config = function() dapui.open() end 41 | dap.listeners.before.launch.dapui_config = function() dapui.open() end 42 | dap.listeners.before.event_terminated.dapui_config = function() dapui.close() end 43 | dap.listeners.before.event_exited.dapui_config = function() dapui.close() end 44 | end, 45 | }, 46 | { "mrcjkb/rustaceanvim" }, 47 | }, 48 | } 49 | -------------------------------------------------------------------------------- /neovim.yml: -------------------------------------------------------------------------------- 1 | --- 2 | base: lua51 3 | 4 | globals: 5 | vim: 6 | any: true 7 | jit: 8 | any: true 9 | astronvim: 10 | any: true 11 | -------------------------------------------------------------------------------- /prefs.toml: -------------------------------------------------------------------------------- 1 | [jobs.bacon-ls] 2 | command = [ 3 | "cargo", 4 | "clippy", 5 | "--tests", 6 | "--all-targets", 7 | "--all-features", 8 | "--message-format", 9 | "json-diagnostic-rendered-ansi", 10 | ] 11 | analyzer = "cargo_json" 12 | need_stdout = true 13 | 14 | [exports.cargo-json-spans] 15 | auto = true 16 | exporter = "analyzer" 17 | line_format = "{diagnostic.level}:{span.file_name}:{span.line_start}:{span.line_end}:{span.column_start}:{span.column_end}:{diagnostic.message}:{span.suggested_replacement}" 18 | path = ".bacon-locations" 19 | -------------------------------------------------------------------------------- /selene.toml: -------------------------------------------------------------------------------- 1 | std = "neovim" 2 | 3 | [rules] 4 | global_usage = "allow" 5 | if_same_then_else = "allow" 6 | incorrect_standard_library_use = "allow" 7 | mixed_table = "allow" 8 | multiple_statements = "allow" 9 | -------------------------------------------------------------------------------- /snippets/Readme.md: -------------------------------------------------------------------------------- 1 | ### https://github.com/rafamadriz/friendly-snippets/blob/main/package.json 2 | 3 | ### https://github.com/rafamadriz/friendly-snippets 4 | We have already been provided with a lot of configurations, which we can refer to when writing our own 5 | 6 | # VSCode Snippets 7 | 8 | ## formatting 9 | 10 | ```json 11 | "SnipetName" : { 12 | "prefix" : "sn", 13 | "body" : [ 14 | 15 | ], 16 | "description":"Snippet Description" 17 | } 18 | ``` 19 | 20 | ## 占位$ 21 | 22 | > \$1 代码段补全后光标的位置 23 | > $0 代码段最后的位置 24 | 25 | ## 相关变量 26 | 27 | - 文档 28 | - TM_SELECTED_TEXT 当前选定的文本或空字符串 29 | - TM_CURRENT_LINE 当前行内容 30 | - TM_CURRENT_WORD 光标下单词内容或空字符串 31 | - TM_LINE_INDEX 基于 0 索引的行号 32 | - TM_LINE_NUMBER 基于单索引的行号 33 | - TM_FILENAME 当前文件名 34 | - TM_FILENAME_BASE 当前文件名(无扩展名) 35 | - TM_DIRECTORY 当前文档的目录 36 | - TM_FILEPATH 当前文档绝对路径 37 | - CLIPBOARD 剪贴板的内容 38 | - WORKSPACE_NAME 当前工作空间名 39 | - 日期 40 | - CURRENT_YEAR 41 | - CURRENT_YEAR_SHORT 42 | - CURRENT_MONTH_NAME 43 | - CURRENT_MONTH_NAME_SHORT 44 | - CURRENT_DATE 45 | - CURRENT_DAY_NAME 46 | - CURRENT_DAY_NAME_SHORT 47 | - CURRENT_HOUR 48 | - CURRENT_MINUTE 49 | - CURRENT_SECOND 50 | - 注释 51 | - BLOCK_COMMENT_START 52 | - BLOCK_COMMENT_END 53 | - LINE_COMMENT 54 | -------------------------------------------------------------------------------- /snippets/angular17/json.json: -------------------------------------------------------------------------------- 1 | { 2 | "PWA Json manifest": { 3 | "prefix": "pwa-manifest", 4 | "description": "PWA Json Manifest", 5 | "types": "json", 6 | "body": [ 7 | "{", 8 | "\"dir\": \"ltr\",", 9 | "\"lang\": \"en\",", 10 | "\"name\": \"${Name}\",", 11 | "\"scope\": \"/\",", 12 | "\"display\": \"standalone\",", 13 | "\"start_url\": \"./?utm_source=web_app_manifest\",", 14 | "\"short_name\": \"${ShortName}}\",", 15 | "\"theme_color\": \"#${Color}\",", 16 | "\"description\": \"\",", 17 | "\"orientation\": \"any\",", 18 | "\"background_color\": \"#${BackgroundColor}\",", 19 | "\"related_applications\": [],", 20 | "\"prefer_related_applications\": false,", 21 | "\"icons\": [", 22 | "\t{", 23 | "\t\t\"src\": \".\/assets\/${icon}-192x192.png\",", 24 | "\t\t\"sizes\": \"192x192\",", 25 | "\t\"type\": \"image/png\"", 26 | "\t},", 27 | "\t{", 28 | "\t\t\"src\": \".\/assets\/${icon}-512x512.png\",", 29 | "\t\t\"sizes\": \"512x512\",", 30 | "\t\t\"type\": \"image/png\"", 31 | "\t\t}", 32 | "\t]", 33 | "}", 34 | "$0" 35 | ] 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /snippets/angular18/dockerfile.json: -------------------------------------------------------------------------------- 1 | { 2 | "Multi-stage Node and Angular Dockerfile": { 3 | "prefix": "docker-angular-node-multi-stage", 4 | "body": [ 5 | "# Client App", 6 | "FROM johnpapa/angular-cli as client-app", 7 | "LABEL authors=\"${1:John Papa}\"", 8 | "WORKDIR /usr/src/app", 9 | "COPY [\"package.json\", \"npm-shrinkwrap.json*\", \"./\"]", 10 | "RUN npm install --silent", 11 | "COPY . .", 12 | "RUN ng build --prod", 13 | "", 14 | "# Node server", 15 | "FROM ${2:node:12-alpine} as node-server", 16 | "WORKDIR /usr/src/app", 17 | "COPY [\"package.json\", \"npm-shrinkwrap.json*\", \"./\"]", 18 | "RUN npm install --production --silent && mv node_modules ../", 19 | "COPY ${3:server.js} .", 20 | "COPY ${4:/server} /usr/src/app/server", 21 | "", 22 | "# Final image", 23 | "FROM ${2:node:12-alpine}", 24 | "WORKDIR /usr/src/app", 25 | "COPY --from=node-server /usr/src /usr/src", 26 | "COPY --from=client-app /usr/src/app/dist ./", 27 | "EXPOSE ${5:3000}", 28 | "# CMD [\"node\", \"server.js\"]", 29 | "CMD [\"npm\", \"start\"]", 30 | "$0" 31 | ], 32 | "description": "Multi-stage Node and Angular Dockerfile" 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /snippets/angular18/html.json: -------------------------------------------------------------------------------- 1 | { 2 | "class": { 3 | "prefix": "a-class", 4 | "body": ["[class]=\"${1:expression}\""], 5 | "description": "Angular [class] binding" 6 | }, 7 | "style": { 8 | "prefix": "a-style", 9 | "body": ["[style.${1:property}]=\"${2:expression}\""], 10 | "description": "Angular [style] binding" 11 | }, 12 | "ngClass": { 13 | "prefix": "a-ngClass", 14 | "body": ["[ngClass]=\"{${1:cssClass}: ${2:expression}}\""], 15 | "description": "Angular ngClass" 16 | }, 17 | "ngFor": { 18 | "prefix": "a-ngFor", 19 | "body": ["*ngFor=\"let ${1:item} of ${2:list}\"${0}"], 20 | "description": "Angular *ngFor" 21 | }, 22 | "ngFor with trackBy": { 23 | "prefix": "a-ngFor-trackBy", 24 | "body": ["*ngFor=\"let ${1:item} of ${2:list}; trackBy:${1:trackByFnName}\"${0}"], 25 | "description": "Angular *ngFor with trackBy" 26 | }, 27 | "ngForAsync": { 28 | "prefix": "a-ngForAsync", 29 | "body": ["*ngFor=\"let ${1:item} of ${2:stream} | async as ${3:list}\"${0}"], 30 | "description": "Angular *ngForAsync" 31 | }, 32 | "ngForm": { 33 | "prefix": "a-form", 34 | "body": ["
", "
"], 35 | "description": "Form with ngSubmit and form attributes" 36 | }, 37 | "ngFormArrayName": { 38 | "prefix": "a-formArrayName", 39 | "body": ["formArrayName=\"${1:control}\""], 40 | "description": "Angular formArrayName" 41 | }, 42 | "ngFormControlName": { 43 | "prefix": "a-formControlName", 44 | "body": ["formControlName=\"${1:control}\""], 45 | "description": "Angular formControlName" 46 | }, 47 | "ngFormGroup": { 48 | "prefix": "a-formGroup", 49 | "body": ["[formGroup]=\"${1:form}\""], 50 | "description": "Angular formGroup" 51 | }, 52 | "ngFormGroupName": { 53 | "prefix": "a-formGroupName", 54 | "body": ["[formGroupName]=\"${1:name}\""], 55 | "description": "Angular formGroupName" 56 | }, 57 | "ngFormSubmit": { 58 | "prefix": "a-form-submit", 59 | "body": [""], 60 | "description": "Angular form submit" 61 | }, 62 | "ngIf": { 63 | "prefix": "a-ngIf", 64 | "body": ["*ngIf=\"${1:expression}\""], 65 | "description": "Angular *ngIf" 66 | }, 67 | "ngIfElse": { 68 | "prefix": "a-ngIfElse", 69 | "body": ["*ngIf=\"${1:expression};else ${2:templateName}\""], 70 | "description": "Angular *ngIfElse" 71 | }, 72 | "ngModel": { 73 | "prefix": "a-ngModel", 74 | "body": ["[(ngModel)]=\"${1:binding}\""], 75 | "description": "Angular ngModel" 76 | }, 77 | "ngRouterLink": { 78 | "prefix": "a-routerLink", 79 | "body": ["[routerLink]=\"['/${1:routePath}']\" routerLinkActive=\"${2:router-link-active}\" $0"], 80 | "description": "Angular routerLink" 81 | }, 82 | "ngRouterLinkWithParameter": { 83 | "prefix": "a-routerLink-param", 84 | "body": [ 85 | "[routerLink]=\"['${1:routePath}', ${2:routeParameterValue}]\"", 86 | "routerLinkActive=\"${3:router-link-active}\"$0" 87 | ], 88 | "description": "Angular routerLink with a route parameter" 89 | }, 90 | "ngSelect": { 91 | "prefix": "a-select", 92 | "body": [ 93 | "" 96 | ], 97 | "description": "