├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.yml │ ├── config.yml │ ├── custom_config.yml │ ├── feature_request.yml │ └── lsp_issue_report.yml └── workflows │ ├── lint_code.yml │ ├── style_check.yml │ ├── update_flake.yml │ └── update_lockfile.yml ├── .gitignore ├── LICENSE ├── README.md ├── flake.lock ├── flake.nix ├── init.lua ├── lazy-lock.json ├── lua ├── core │ ├── event.lua │ ├── global.lua │ ├── init.lua │ ├── options.lua │ ├── pack.lua │ └── settings.lua ├── keymap │ ├── bind.lua │ ├── completion.lua │ ├── editor.lua │ ├── helpers.lua │ ├── init.lua │ ├── lang.lua │ ├── tool.lua │ └── ui.lua ├── modules │ ├── configs │ │ ├── completion │ │ │ ├── cmp.lua │ │ │ ├── codeium.lua │ │ │ ├── copilot-cmp.lua │ │ │ ├── copilot.lua │ │ │ ├── formatters │ │ │ │ └── clang_format.lua │ │ │ ├── formatting.lua │ │ │ ├── glance.lua │ │ │ ├── lsp-signature.lua │ │ │ ├── lsp.lua │ │ │ ├── lspsaga.lua │ │ │ ├── luasnip.lua │ │ │ ├── mason-lspconfig.lua │ │ │ ├── mason-null-ls.lua │ │ │ ├── mason.lua │ │ │ ├── neoconf.lua │ │ │ ├── null-ls.lua │ │ │ ├── servers │ │ │ │ ├── bashls.lua │ │ │ │ ├── clangd.lua │ │ │ │ ├── dartls.lua │ │ │ │ ├── gopls.lua │ │ │ │ ├── html.lua │ │ │ │ ├── jsonls.lua │ │ │ │ ├── lua_ls.lua │ │ │ │ └── pylsp.lua │ │ │ ├── tabnine.lua │ │ │ └── tiny-inline-diagnostic.lua │ │ ├── editor │ │ │ ├── align.lua │ │ │ ├── autoclose.lua │ │ │ ├── autotag.lua │ │ │ ├── comment.lua │ │ │ ├── cursorword.lua │ │ │ ├── diffview.lua │ │ │ ├── flash.lua │ │ │ ├── grug-far.lua │ │ │ ├── highlight-colors.lua │ │ │ ├── hop.lua │ │ │ ├── matchup.lua │ │ │ ├── persisted.lua │ │ │ ├── rainbow_delims.lua │ │ │ ├── suda.lua │ │ │ ├── treesitter.lua │ │ │ ├── ts-context-commentstring.lua │ │ │ └── ts-context.lua │ │ ├── lang │ │ │ ├── bqf.lua │ │ │ ├── crates-keymap.lua │ │ │ ├── crates.lua │ │ │ ├── go.lua │ │ │ ├── render-markdown.lua │ │ │ └── rust.lua │ │ ├── tool │ │ │ ├── dap │ │ │ │ ├── clients │ │ │ │ │ ├── codelldb.lua │ │ │ │ │ ├── delve.lua │ │ │ │ │ ├── lldb.lua │ │ │ │ │ └── python.lua │ │ │ │ ├── dap-keymap.lua │ │ │ │ ├── dapui.lua │ │ │ │ └── init.lua │ │ │ ├── dropbar.lua │ │ │ ├── fcitx5.lua │ │ │ ├── fzf-lua.lua │ │ │ ├── nvim-tree.lua │ │ │ ├── project.lua │ │ │ ├── search.lua │ │ │ ├── smartyank.lua │ │ │ ├── sniprun.lua │ │ │ ├── telescope.lua │ │ │ ├── toggleterm.lua │ │ │ ├── trouble.lua │ │ │ ├── which-key.lua │ │ │ └── wilder.lua │ │ └── ui │ │ │ ├── alpha.lua │ │ │ ├── bufferline.lua │ │ │ ├── catppuccin.lua │ │ │ ├── edgy.lua │ │ │ ├── gitsigns.lua │ │ │ ├── indent-blankline.lua │ │ │ ├── lualine.lua │ │ │ ├── neoscroll.lua │ │ │ ├── notify.lua │ │ │ ├── paint.lua │ │ │ ├── scrollview.lua │ │ │ ├── splits.lua │ │ │ └── todo.lua │ ├── plugins │ │ ├── completion.lua │ │ ├── editor.lua │ │ ├── lang.lua │ │ ├── tool.lua │ │ └── ui.lua │ └── utils │ │ ├── dap.lua │ │ ├── icons.lua │ │ ├── init.lua │ │ └── keymap.lua └── user_template │ ├── configs │ ├── .gitkeep │ ├── dap-clients │ │ └── .gitkeep │ ├── formatters │ │ └── .gitkeep │ └── lsp-servers │ │ └── .gitkeep │ ├── event.lua │ ├── keymap │ ├── completion.lua │ ├── core.lua │ ├── editor.lua │ ├── init.lua │ ├── lang.lua │ ├── tool.lua │ └── ui.lua │ ├── options.lua │ ├── plugins │ └── .gitkeep │ ├── settings.lua │ └── snips │ └── .gitkeep ├── nixos ├── default.nix ├── neovim │ └── default.nix └── testEnv.nix ├── scripts ├── install.ps1 └── install.sh ├── snips ├── package.json └── snippets │ ├── c.json │ ├── cpp.json │ └── go.json ├── stylua.toml └── tutor └── dots.tutor /.github/ISSUE_TEMPLATE/bug_report.yml: -------------------------------------------------------------------------------- 1 | name: Bug Report 2 | description: File a bug report 3 | labels: [bug] 4 | body: 5 | - type: markdown 6 | attributes: 7 | value: | 8 | _Before reporting:_ Search [existing issues](https://github.com/ayamir/nvimdots/issues) and check the [FAQ](https://github.com/ayamir/nvimdots/wiki/Issues). Thank you for helping us improve! 9 | > [!IMPORTANT] 10 | > The `0.11` branch is intended for nightly Neovim builds and is **not** stable. It typically harbors subtle issues scattered throughout. Therefore, refrain from submitting issues if you happen to encounter them. They will be closed directly unless a viable solution is proposed or included. 11 | - type: checkboxes 12 | id: is-latest-commit 13 | attributes: 14 | label: "Version confirmation" 15 | description: "The local configuration is up-to-date in the current branch and this issue _persists_." 16 | options: 17 | - label: "Confirm" 18 | required: true 19 | - type: checkboxes 20 | id: prerequisites-done 21 | attributes: 22 | label: "Following prerequisites" 23 | description: "I've checked everything mentioned in [Wiki: Prerequisites](https://github.com/ayamir/nvimdots/wiki/Prerequisites)." 24 | options: 25 | - label: "Confirm" 26 | required: true 27 | - type: checkboxes 28 | id: not-user-config-issue 29 | attributes: 30 | label: "Not a user config issue" 31 | description: "This issue _persists_ after removing ALL user configs. If this is not the case, you should open a [Custom (User) Config Issue](https://github.com/ayamir/nvimdots/issues/new?assignees=&labels=usage&projects=&template=custom_config.yml) instead." 32 | options: 33 | - label: "Confirm" 34 | required: true 35 | 36 | - type: input 37 | id: nvim-version 38 | attributes: 39 | label: "Neovim version" 40 | description: "Paste the output of `nvim --version` here" 41 | placeholder: "NVIM v0.11.0-dev-194+g6c7677e5d" 42 | validations: 43 | required: true 44 | - type: input 45 | id: system-version 46 | attributes: 47 | label: "Operating system/version" 48 | placeholder: "macOS 12.6.1" 49 | validations: 50 | required: true 51 | - type: input 52 | id: terminal-version 53 | attributes: 54 | label: "Terminal name/version" 55 | placeholder: "iTerm2 Build 3.4.17" 56 | validations: 57 | required: true 58 | - type: input 59 | id: term-env 60 | attributes: 61 | label: "$TERM environment variable" 62 | placeholder: "xterm-256color" 63 | validations: 64 | required: false 65 | - type: dropdown 66 | id: branch 67 | attributes: 68 | label: "Branch info" 69 | description: "Which branch are you currently on? If you are not sure, check the output of `git rev-parse --abbrev-ref HEAD`" 70 | options: 71 | - main (Default/Latest) 72 | - 0.9 (Legacy) 73 | - 0.8 (Deprecated) 74 | - 0.11 (Nightly) 75 | validations: 76 | required: true 77 | - type: dropdown 78 | id: fetch-pref 79 | attributes: 80 | label: "Fetch Preferences" 81 | description: "In what way do you fetch resources? If you are not sure, check the value of `use_ssh` in `lua/user/settings.lua`" 82 | options: 83 | - SSH (use_ssh = true) 84 | - HTTPS (use_ssh = false) 85 | validations: 86 | required: true 87 | 88 | - type: textarea 89 | id: repro-steps 90 | attributes: 91 | label: "How to reproduce the issue" 92 | description: "Note: Issues without any information will be closed directly" 93 | placeholder: | 94 | Steps to reproduce the behavior: 95 | 1. Go to '...' 96 | 2. Click on '....' 97 | 3. Scroll down to '....' 98 | 4. See error 99 | validations: 100 | required: true 101 | 102 | - type: textarea 103 | id: expected-behavior 104 | attributes: 105 | label: "Expected behavior" 106 | description: "Describe the behavior you expect" 107 | validations: 108 | required: true 109 | - type: textarea 110 | id: actual-behavior 111 | attributes: 112 | label: "Actual behavior" 113 | validations: 114 | required: false 115 | - type: textarea 116 | id: extras 117 | attributes: 118 | label: Additional information 119 | description: If applicable, you may include logs, images, or videos to help explain your problem 120 | validations: 121 | required: false 122 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: true 2 | contact_links: 3 | - name: GitHub Discussions 4 | url: https://github.com/ayamir/nvimdots/discussions/new/choose 5 | about: Any issue that does not fall into the above categories shall go here 6 | - name: GitHub Wiki 7 | url: https://github.com/ayamir/nvimdots/wiki 8 | about: Make sure you have checked our documentation first. To be explicit, the "Issues" section -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/custom_config.yml: -------------------------------------------------------------------------------- 1 | name: Custom (User) Config Issue 2 | description: Problems when trying to implement your custom config 3 | labels: [usage] 4 | body: 5 | - type: markdown 6 | attributes: 7 | value: | 8 | _Before requesting:_ Make sure you've read through our [Wiki: Usage](https://github.com/ayamir/nvimdots/wiki/Usage) before you start to add things to nvimdots! 9 | > [!IMPORTANT] 10 | > The `0.11` branch is intended for nightly Neovim builds and is **not** stable. It typically harbors subtle issues scattered throughout. Therefore, refrain from submitting issues if you happen to encounter them. They will be closed directly unless a viable solution is proposed or included. 11 | - type: checkboxes 12 | id: is-latest-commit 13 | attributes: 14 | label: "Version confirmation" 15 | description: "The local configuration is up-to-date in the current branch and this issue _persists_." 16 | options: 17 | - label: "Confirm" 18 | required: true 19 | - type: checkboxes 20 | id: prerequisites-done 21 | attributes: 22 | label: "Following prerequisites" 23 | description: "I've checked everything mentioned in [Wiki: Prerequisites](https://github.com/ayamir/nvimdots/wiki/Prerequisites)." 24 | options: 25 | - label: "Confirm" 26 | required: true 27 | 28 | - type: input 29 | id: nvim-version 30 | attributes: 31 | label: "Neovim version" 32 | description: "Paste the output of `nvim --version` here" 33 | placeholder: "NVIM v0.11.0-dev-194+g6c7677e5d" 34 | validations: 35 | required: true 36 | - type: dropdown 37 | id: branch-info 38 | attributes: 39 | label: "Branch info" 40 | description: "This issue template mainly targets `main` branch. Check the output of `git rev-parse --abbrev-ref HEAD` if you're not sure." 41 | options: 42 | - main (Default/Latest) 43 | - 0.9 (Legacy) 44 | - 0.8 (Deprecated) 45 | - 0.11 (Nightly) 46 | validations: 47 | required: true 48 | 49 | - type: textarea 50 | id: folder-structure-ta 51 | attributes: 52 | label: "Minimal (user) folder structure required to reproduce the issue" 53 | description: "Note: You only need to describe where the *new/modified files* are. This section will be automatically formatted." 54 | render: console 55 | placeholder: | 56 | └── lua/ 57 | ├── core/ 58 | ├── keymap/ default keymaps 59 | ├── modules/ default plugins and plugin configs 60 | └── user custom configs root directory 61 | ├── configs/ custom plugin config folder 62 | │ ├── dap-clients/ custom dap client config folder 63 | │ ├── lsp-servers/ custom lsp server config folder 64 | │ └── your-config.lua your plugin configs (if applicable) 65 | ├── keymap/ custom keymap folder 66 | │ └── your-config.lua your keymap overrides (if applicable) 67 | ├── plugins/ custom plugin folder 68 | │ └── your-config.lua your plugins (if applicable) 69 | ├── event.lua custom `core/events.lua` overrides 70 | ├── options.lua custom `core/options.lua` overrides 71 | └── settings.lua custom `core/settings.lua` overrides 72 | validations: 73 | required: true 74 | 75 | - type: textarea 76 | id: repro-steps 77 | attributes: 78 | label: "Minimal config with steps on how to reproduce the issue" 79 | description: "Note: Issues without any information will be closed directly" 80 | placeholder: | 81 | This is my custom config (`specs.lua`): 82 | ```lua 83 | return { 84 | popup = { 85 | delay_ms = 20, 86 | } 87 | } 88 | ``` 89 | 90 | Steps to reproduce the behavior: 91 | 1. Go to '...' 92 | 2. Click on '....' 93 | 3. Scroll down to '....' 94 | 4. See error 95 | validations: 96 | required: true 97 | 98 | - type: textarea 99 | id: expected-behavior 100 | attributes: 101 | label: "Expected behavior" 102 | description: "Describe the behavior you expect" 103 | validations: 104 | required: true 105 | - type: textarea 106 | id: extras 107 | attributes: 108 | label: Additional information 109 | description: If applicable, you may include logs, images, or videos to help explain your problem 110 | validations: 111 | required: false 112 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.yml: -------------------------------------------------------------------------------- 1 | name: Feature Request 2 | description: Request an enhancement for this project 3 | labels: [enhancement] 4 | body: 5 | - type: markdown 6 | attributes: 7 | value: | 8 | _Before requesting:_ Search [existing issues](https://github.com/ayamir/nvimdots/labels/enhancement) and check the [FAQ](https://github.com/ayamir/nvimdots/wiki/Issues). Thank you for helping us improve! 9 | 10 | - type: textarea 11 | id: feat-desc 12 | attributes: 13 | label: "Feature description" 14 | validations: 15 | required: true 16 | - type: textarea 17 | id: extras 18 | attributes: 19 | label: "Additional information" 20 | description: "If applicable, you may include images or videos to help explain your request" 21 | validations: 22 | required: false 23 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/lsp_issue_report.yml: -------------------------------------------------------------------------------- 1 | name: LSP Issue 2 | description: File a bug report related to LSPs 3 | labels: [bug, lsp] 4 | body: 5 | - type: markdown 6 | attributes: 7 | value: | 8 | _Before reporting:_ Search [existing issues](https://github.com/ayamir/nvimdots/issues) and check the [FAQ](https://github.com/ayamir/nvimdots/wiki/Issues). Thank you for helping us improve! 9 | > [!IMPORTANT] 10 | > The `0.11` branch is intended for nightly Neovim builds and is **not** stable. It typically harbors subtle issues scattered throughout. Therefore, refrain from submitting issues if you happen to encounter them. They will be closed directly unless a viable solution is proposed or included. 11 | - type: checkboxes 12 | id: is-latest-commit 13 | attributes: 14 | label: "Version confirmation" 15 | description: "The local configuration is up-to-date in the current branch and this issue _persists_." 16 | options: 17 | - label: "Confirm" 18 | required: true 19 | - type: checkboxes 20 | id: prerequisites-done 21 | attributes: 22 | label: "Following prerequisites" 23 | description: "I've checked everything mentioned in [Wiki: Prerequisites](https://github.com/ayamir/nvimdots/wiki/Prerequisites)." 24 | options: 25 | - label: "Confirm" 26 | required: true 27 | - type: checkboxes 28 | id: not-user-config-issue 29 | attributes: 30 | label: "Not a user config issue" 31 | description: "This issue _persists_ after removing ALL user configs. If this is not the case, you should open a [Custom (User) Config Issue](https://github.com/ayamir/nvimdots/issues/new?assignees=&labels=usage&projects=&template=custom_config.yml) instead." 32 | options: 33 | - label: "Confirm" 34 | required: true 35 | 36 | - type: input 37 | id: nvim-version 38 | attributes: 39 | label: "Neovim version" 40 | description: "Paste the output of `nvim --version` here" 41 | placeholder: "NVIM v0.11.0-dev-194+g6c7677e5d" 42 | validations: 43 | required: true 44 | - type: input 45 | id: system-version 46 | attributes: 47 | label: "Operating system/version" 48 | placeholder: "macOS 12.6.1" 49 | validations: 50 | required: true 51 | - type: input 52 | id: terminal-version 53 | attributes: 54 | label: "Terminal name/version" 55 | placeholder: "iTerm2 Build 3.4.17" 56 | validations: 57 | required: true 58 | - type: input 59 | id: term-env 60 | attributes: 61 | label: "$TERM environment variable" 62 | placeholder: "xterm-256color" 63 | validations: 64 | required: false 65 | - type: dropdown 66 | id: branch 67 | attributes: 68 | label: "Branch info" 69 | description: "Which branch are you currently on? If you are not sure, check the output of `git rev-parse --abbrev-ref HEAD`" 70 | options: 71 | - main (Default/Latest) 72 | - 0.9 (Legacy) 73 | - 0.8 (Deprecated) 74 | - 0.11 (Nightly) 75 | validations: 76 | required: true 77 | - type: dropdown 78 | id: fetch-pref 79 | attributes: 80 | label: "Fetch Preferences" 81 | description: "In what way do you fetch resources? If you are not sure, check the value of `use_ssh` in `lua/user/settings.lua`" 82 | options: 83 | - SSH (use_ssh = true) 84 | - HTTPS (use_ssh = false) 85 | validations: 86 | required: true 87 | - type: input 88 | id: servers 89 | attributes: 90 | label: "Affected language servers" 91 | description: "If this issue is specific to one or more language servers, list them here. If not, write `any`" 92 | placeholder: "lua-language-server, clangd" 93 | validations: 94 | required: true 95 | 96 | - type: textarea 97 | id: repro-steps 98 | attributes: 99 | label: "How to reproduce the issue" 100 | description: "Note: Issues without any information will be closed directly" 101 | placeholder: | 102 | Steps to reproduce the behavior: 103 | 1. Go to '...' 104 | 2. Click on '....' 105 | 3. Scroll down to '....' 106 | 4. See error 107 | validations: 108 | required: true 109 | 110 | - type: textarea 111 | id: actual-behavior 112 | attributes: 113 | label: "Actual behavior" 114 | description: "Briefly describe what you've observed" 115 | validations: 116 | required: true 117 | - type: textarea 118 | id: expected-behavior 119 | attributes: 120 | label: "Expected behavior" 121 | description: "Describe the behavior you expect" 122 | validations: 123 | required: false 124 | - type: textarea 125 | id: support-info 126 | attributes: 127 | label: "Support info" 128 | description: "Plase include information (screenshots) from `:LspInfo` and `:Mason`" 129 | placeholder: | 130 | :LspInfo 131 | :Mason 132 | validations: 133 | required: true 134 | - type: textarea 135 | id: lsp-logs 136 | attributes: 137 | label: "Logs" 138 | description: "Please copy and paste any relevant log output (e.g., `${HOME}/.local/state/nvim/lsp.log` and `${HOME}/.cache/nvim/lsp.log`). This section will be automatically formatted" 139 | render: console 140 | validations: 141 | required: false 142 | - type: textarea 143 | id: extras 144 | attributes: 145 | label: "Additional information" 146 | description: "If applicable, you may include images or videos to help explain your problem" 147 | validations: 148 | required: false 149 | -------------------------------------------------------------------------------- /.github/workflows/lint_code.yml: -------------------------------------------------------------------------------- 1 | name: lint code 2 | on: [push, pull_request] 3 | 4 | jobs: 5 | luacheck: 6 | runs-on: ubuntu-latest 7 | steps: 8 | - uses: actions/checkout@v4 9 | - uses: lunarmodules/luacheck@v1 10 | with: 11 | args: . --std luajit --max-line-length 150 --no-config --globals vim _debugging _command_panel _flash_esc_or_noh _telescope_collections _toggle_inlayhint _toggle_virtualtext _toggle_lazygit 12 | -------------------------------------------------------------------------------- /.github/workflows/style_check.yml: -------------------------------------------------------------------------------- 1 | name: style check 2 | on: [push, pull_request] 3 | 4 | jobs: 5 | stylua: 6 | runs-on: ubuntu-latest 7 | steps: 8 | - uses: actions/checkout@v4 9 | - uses: JohnnyMorganz/stylua-action@v4 10 | with: 11 | token: ${{ secrets.GITHUB_TOKEN }} 12 | version: latest 13 | args: --check --config-path=stylua.toml . 14 | -------------------------------------------------------------------------------- /.github/workflows/update_flake.yml: -------------------------------------------------------------------------------- 1 | name: update flake.lock 2 | on: 3 | # Scheduled update (1st of every month) 4 | schedule: [{ cron: "30 02 1 * *" }] 5 | 6 | jobs: 7 | update-lockfile: 8 | if: github.repository_owner == 'ayamir' 9 | runs-on: ubuntu-latest 10 | permissions: 11 | contents: write 12 | steps: 13 | - uses: actions/checkout@v4 14 | - uses: cachix/install-nix-action@v26 15 | with: 16 | nix_path: nixpkgs=channel:nixos-unstable 17 | - name: Run flake-update 18 | run: | 19 | nix flake update 20 | - uses: stefanzweifel/git-auto-commit-action@v5 21 | with: 22 | commit_message: "chore(lockfile): auto update flake.lock" 23 | commit_user_name: "github-actions[bot]" 24 | commit_user_email: "41898282+github-actions[bot]@users.noreply.github.com" 25 | commit_author: "github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>" 26 | file_pattern: "flake.lock" 27 | -------------------------------------------------------------------------------- /.github/workflows/update_lockfile.yml: -------------------------------------------------------------------------------- 1 | name: update lockfile 2 | on: 3 | # Scheduled update (each day) 4 | schedule: [{ cron: "30 01 * * *" }] 5 | 6 | jobs: 7 | update-lockfile: 8 | if: github.repository_owner == 'ayamir' 9 | runs-on: ubuntu-latest 10 | permissions: 11 | contents: write 12 | steps: 13 | - uses: actions/checkout@v4 14 | with: 15 | fetch-depth: 0 # Required to count the commits 16 | - uses: andstor/file-existence-action@v3 17 | id: check_lockfile 18 | with: 19 | files: "lazy-lock.json" 20 | - name: Run count-new-commits 21 | run: | 22 | echo "NEW_COMMIT_COUNT=$(git log --oneline --since '24 hours ago' --perl-regexp --author='^((?!github-actions).*)$' | wc -l)" >> "$GITHUB_ENV" 23 | - uses: rhysd/action-setup-vim@v1 24 | if: ${{ steps.check_lockfile.outputs.files_exists == 'true' && env.NEW_COMMIT_COUNT > 0 }} 25 | with: 26 | neovim: true 27 | - name: Run lockfile-autoupdate 28 | if: ${{ steps.check_lockfile.outputs.files_exists == 'true' && env.NEW_COMMIT_COUNT > 0 }} 29 | timeout-minutes: 5 30 | run: | 31 | ./scripts/install.sh 32 | nvim --headless "+Lazy! update" +qa 33 | cp -pv "${HOME}/.config/nvim/lazy-lock.json" . 34 | - uses: stefanzweifel/git-auto-commit-action@v5 35 | if: ${{ steps.check_lockfile.outputs.files_exists == 'true' && env.NEW_COMMIT_COUNT > 0 }} 36 | with: 37 | commit_message: "chore(lockfile): auto update lazy-lock.json" 38 | commit_user_name: "github-actions[bot]" 39 | commit_user_email: "41898282+github-actions[bot]@users.noreply.github.com" 40 | commit_author: "github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>" 41 | file_pattern: "lazy-lock.json" 42 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | lua/modules/plugins/custom.lua 2 | lua/modules/configs/custom 3 | lua/user 4 | result 5 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2021 ayamir 4 | Copyright (c) 2022 Jint-lzxy, CharlesChiuGit 5 | Copyright (c) 2023 aarnphm, misumisumi 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are met: 9 | 10 | 1. Redistributions of source code must retain the above copyright notice, this 11 | list of conditions and the following disclaimer. 12 | 13 | 2. Redistributions in binary form must reproduce the above copyright notice, 14 | this list of conditions and the following disclaimer in the documentation 15 | and/or other materials provided with the distribution. 16 | 17 | 3. Neither the name of the copyright holder nor the names of its 18 | contributors may be used to endorse or promote products derived from 19 | this software without specific prior written permission. 20 | 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 24 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 25 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 27 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 28 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 29 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | -------------------------------------------------------------------------------- /flake.lock: -------------------------------------------------------------------------------- 1 | { 2 | "nodes": { 3 | "devshell": { 4 | "inputs": { 5 | "nixpkgs": "nixpkgs" 6 | }, 7 | "locked": { 8 | "lastModified": 1741473158, 9 | "narHash": "sha256-kWNaq6wQUbUMlPgw8Y+9/9wP0F8SHkjy24/mN3UAppg=", 10 | "owner": "numtide", 11 | "repo": "devshell", 12 | "rev": "7c9e793ebe66bcba8292989a68c0419b737a22a0", 13 | "type": "github" 14 | }, 15 | "original": { 16 | "owner": "numtide", 17 | "repo": "devshell", 18 | "type": "github" 19 | } 20 | }, 21 | "flake-parts": { 22 | "inputs": { 23 | "nixpkgs-lib": "nixpkgs-lib" 24 | }, 25 | "locked": { 26 | "lastModified": 1743550720, 27 | "narHash": "sha256-hIshGgKZCgWh6AYJpJmRgFdR3WUbkY04o82X05xqQiY=", 28 | "owner": "hercules-ci", 29 | "repo": "flake-parts", 30 | "rev": "c621e8422220273271f52058f618c94e405bb0f5", 31 | "type": "github" 32 | }, 33 | "original": { 34 | "owner": "hercules-ci", 35 | "repo": "flake-parts", 36 | "type": "github" 37 | } 38 | }, 39 | "home-manager": { 40 | "inputs": { 41 | "nixpkgs": [ 42 | "nixpkgs" 43 | ] 44 | }, 45 | "locked": { 46 | "lastModified": 1748737919, 47 | "narHash": "sha256-5kvBbLYdp+n7Ftanjcs6Nv+UO6sBhelp6MIGJ9nWmjQ=", 48 | "owner": "nix-community", 49 | "repo": "home-manager", 50 | "rev": "5675a9686851d9626560052a032c4e14e533c1fa", 51 | "type": "github" 52 | }, 53 | "original": { 54 | "owner": "nix-community", 55 | "repo": "home-manager", 56 | "type": "github" 57 | } 58 | }, 59 | "nixpkgs": { 60 | "locked": { 61 | "lastModified": 1722073938, 62 | "narHash": "sha256-OpX0StkL8vpXyWOGUD6G+MA26wAXK6SpT94kLJXo6B4=", 63 | "owner": "NixOS", 64 | "repo": "nixpkgs", 65 | "rev": "e36e9f57337d0ff0cf77aceb58af4c805472bfae", 66 | "type": "github" 67 | }, 68 | "original": { 69 | "owner": "NixOS", 70 | "ref": "nixpkgs-unstable", 71 | "repo": "nixpkgs", 72 | "type": "github" 73 | } 74 | }, 75 | "nixpkgs-lib": { 76 | "locked": { 77 | "lastModified": 1743296961, 78 | "narHash": "sha256-b1EdN3cULCqtorQ4QeWgLMrd5ZGOjLSLemfa00heasc=", 79 | "owner": "nix-community", 80 | "repo": "nixpkgs.lib", 81 | "rev": "e4822aea2a6d1cdd36653c134cacfd64c97ff4fa", 82 | "type": "github" 83 | }, 84 | "original": { 85 | "owner": "nix-community", 86 | "repo": "nixpkgs.lib", 87 | "type": "github" 88 | } 89 | }, 90 | "nixpkgs_2": { 91 | "locked": { 92 | "lastModified": 1748662220, 93 | "narHash": "sha256-7gGa49iB9nCnFk4h/g9zwjlQAyjtpgcFkODjcOQS0Es=", 94 | "owner": "nixos", 95 | "repo": "nixpkgs", 96 | "rev": "59138c7667b7970d205d6a05a8bfa2d78caa3643", 97 | "type": "github" 98 | }, 99 | "original": { 100 | "owner": "nixos", 101 | "ref": "nixpkgs-unstable", 102 | "repo": "nixpkgs", 103 | "type": "github" 104 | } 105 | }, 106 | "root": { 107 | "inputs": { 108 | "devshell": "devshell", 109 | "flake-parts": "flake-parts", 110 | "home-manager": "home-manager", 111 | "nixpkgs": "nixpkgs_2" 112 | } 113 | } 114 | }, 115 | "root": "root", 116 | "version": 7 117 | } 118 | -------------------------------------------------------------------------------- /flake.nix: -------------------------------------------------------------------------------- 1 | { 2 | # This provides only NixOS module 3 | # As of 2023/08/19, you need to depend on nixpkgs-unstable. 4 | # because "doq" is not included in the stable version. 5 | description = "Provide nixosModules for ayamir/nvimdots"; 6 | 7 | inputs = { 8 | flake-parts.url = "github:hercules-ci/flake-parts"; 9 | devshell.url = "github:numtide/devshell"; 10 | nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; 11 | home-manager = { 12 | url = "github:nix-community/home-manager"; 13 | inputs.nixpkgs.follows = "nixpkgs"; 14 | }; 15 | }; 16 | 17 | outputs = 18 | inputs@{ self, flake-parts, ... }: 19 | flake-parts.lib.mkFlake { inherit inputs; } { 20 | imports = [ 21 | inputs.devshell.flakeModule 22 | ]; 23 | flake.homeManagerModules.default = ./nixos; 24 | systems = [ 25 | "x86_64-linux" 26 | "aarch64-linux" 27 | "x86_64-darwin" 28 | "aarch64-darwin" 29 | ]; 30 | perSystem = 31 | { pkgs, system, ... }: 32 | { 33 | packages = { 34 | testEnv = (import ./nixos/testEnv.nix { inherit inputs pkgs; }).activationPackage; 35 | check-linker = pkgs.writeShellApplication { 36 | name = "check-linker"; 37 | text = 38 | let 39 | ldd_cmd = if pkgs.stdenv.isDarwin then "xcrun otool -L" else "${pkgs.glibc.bin}/bin/ldd"; 40 | in 41 | '' 42 | #shellcheck disable=SC1090 43 | source <(sed -ne :1 -e 'N;1,1b1' -e 'P;D' "${self.packages.${system}.testEnv}/home-path/bin/nvim") 44 | echo "Checking files under ''${XDG_DATA_HOME}/''${NVIM_APPNAME:-nvim}/mason/bin..." 45 | find "''${XDG_DATA_HOME}/''${NVIM_APPNAME:-nvim}/mason/bin" -type l | while read -r link; do 46 | "${ldd_cmd}" "$(readlink -f "$link")" > /dev/zero 2>&1 || continue 47 | linkers=$("${ldd_cmd}" "$(readlink -f "$link")" | tail -n+2) 48 | echo "$linkers" | while read -r line; do 49 | [ -z "$line" ] && continue 50 | echo "$line" | grep -q "/nix/store" || printf '%s: %s does not link to /nix/store \n' "$(basename "$link")" "$line" 51 | done 52 | done 53 | echo "*** Done ***" 54 | ''; 55 | }; 56 | }; 57 | devshells.default = { 58 | commands = [ 59 | { 60 | help = "neovim linked to testEnv."; 61 | name = "nvim"; 62 | command = '' 63 | ${self.packages.${system}.testEnv}/home-path/bin/nvim 64 | ''; 65 | } 66 | { 67 | help = "check-linker"; 68 | package = self.packages.${system}.check-linker; 69 | } 70 | ]; 71 | devshell = { 72 | motd = '' 73 | {202}🔨 Welcome to devshell{reset} 74 | Symlink configs to "''${XDG_CONFIG_HOME}"/nvimdots! 75 | And NVIM_APPNAME=nvimdots is already configured, so neovim will put files under "\$XDG_xxx_HOME"/nvimdots. 76 | To uninstall, remove "\$XDG_xxx_HOME"/nvimdots. 77 | 78 | $(type -p menu &>/dev/null && menu) 79 | ''; 80 | startup = { 81 | mkNvimDir = { 82 | text = '' 83 | mkdir -p "''${XDG_CONFIG_HOME}"/nvimdots 84 | for path in lazy-lock.json init.lua lua snips tutor; do 85 | ln -sf "''${PWD}/''${path}" "''${XDG_CONFIG_HOME}"/nvimdots/ 86 | done 87 | ''; 88 | }; 89 | }; 90 | }; 91 | env = [ 92 | { 93 | name = "NVIM_APPNAME"; 94 | value = "nvimdots"; 95 | } 96 | { 97 | name = "PATH"; 98 | prefix = "${self.packages.${system}.testEnv}/home-path/bin"; 99 | } 100 | ]; 101 | packages = with pkgs; [ 102 | nixd 103 | nixpkgs-fmt 104 | ]; 105 | }; 106 | }; 107 | }; 108 | } 109 | -------------------------------------------------------------------------------- /init.lua: -------------------------------------------------------------------------------- 1 | if not vim.g.vscode then 2 | require("core") 3 | end 4 | -------------------------------------------------------------------------------- /lua/core/event.lua: -------------------------------------------------------------------------------- 1 | -- Now use `` or `` to back to the `dotstutor`. 2 | local autocmd = {} 3 | 4 | function autocmd.nvim_create_augroups(definitions) 5 | for group_name, definition in pairs(definitions) do 6 | -- Prepend an underscore to avoid name clashes 7 | vim.api.nvim_command("augroup _" .. group_name) 8 | vim.api.nvim_command("autocmd!") 9 | for _, def in ipairs(definition) do 10 | local command = table.concat(vim.iter({ "autocmd", def }):flatten(math.huge):totable(), " ") 11 | vim.api.nvim_command(command) 12 | end 13 | vim.api.nvim_command("augroup END") 14 | end 15 | end 16 | 17 | -- Hold off on configuring anything related to the LSP until LspAttach 18 | local mapping = require("keymap.completion") 19 | vim.api.nvim_create_autocmd("LspAttach", { 20 | group = vim.api.nvim_create_augroup("LspKeymapLoader", { clear = true }), 21 | callback = function(event) 22 | if not _G._debugging then 23 | -- LSP Keymaps 24 | mapping.lsp(event.buf) 25 | 26 | -- LSP Inlay Hints 27 | local inlayhints_enabled = require("core.settings").lsp_inlayhints 28 | local client = vim.lsp.get_client_by_id(event.data.client_id) 29 | if client and client.server_capabilities.inlayHintProvider ~= nil then 30 | vim.lsp.inlay_hint.enable(inlayhints_enabled == true, { bufnr = event.buf }) 31 | end 32 | end 33 | end, 34 | }) 35 | 36 | -- auto close NvimTree 37 | vim.api.nvim_create_autocmd("BufEnter", { 38 | group = vim.api.nvim_create_augroup("NvimTreeClose", { clear = true }), 39 | pattern = "NvimTree_*", 40 | callback = function() 41 | local layout = vim.api.nvim_call_function("winlayout", {}) 42 | if 43 | layout[1] == "leaf" 44 | and vim.bo[vim.api.nvim_win_get_buf(layout[2])].filetype == "NvimTree" 45 | and layout[3] == nil 46 | then 47 | vim.api.nvim_command([[confirm quit]]) 48 | end 49 | end, 50 | }) 51 | 52 | -- auto close some filetype with 53 | vim.api.nvim_create_autocmd("FileType", { 54 | pattern = { 55 | "qf", 56 | "help", 57 | "man", 58 | "notify", 59 | "nofile", 60 | "lspinfo", 61 | "terminal", 62 | "prompt", 63 | "toggleterm", 64 | "copilot", 65 | "startuptime", 66 | "tsplayground", 67 | "PlenaryTestPopup", 68 | }, 69 | callback = function(event) 70 | vim.bo[event.buf].buflisted = false 71 | vim.api.nvim_buf_set_keymap(event.buf, "n", "q", "close", { silent = true }) 72 | end, 73 | }) 74 | 75 | function autocmd.load_autocmds() 76 | local definitions = { 77 | lazy = {}, 78 | bufs = { 79 | -- Reload vim config automatically 80 | { 81 | "BufWritePost", 82 | [[$VIM_PATH/{*.vim,*.yaml,vimrc} nested source $MYVIMRC | redraw]], 83 | }, 84 | -- Reload Vim script automatically if setlocal autoread 85 | { 86 | "BufWritePost,FileWritePost", 87 | "*.vim", 88 | [[nested if &l:autoread > 0 | source | echo 'source ' . bufname('%') | endif]], 89 | }, 90 | { "BufWritePre", "/tmp/*", "setlocal noundofile" }, 91 | { "BufWritePre", "COMMIT_EDITMSG", "setlocal noundofile" }, 92 | { "BufWritePre", "MERGE_MSG", "setlocal noundofile" }, 93 | { "BufWritePre", "*.tmp", "setlocal noundofile" }, 94 | { "BufWritePre", "*.bak", "setlocal noundofile" }, 95 | -- auto place to last edit 96 | { 97 | "BufReadPost", 98 | "*", 99 | [[if line("'\"") > 1 && line("'\"") <= line("$") | execute "normal! g'\"" | endif]], 100 | }, 101 | -- Auto toggle fcitx5 102 | -- {"InsertLeave", "* :silent", "!fcitx5-remote -c"}, 103 | -- {"BufCreate", "*", ":silent !fcitx5-remote -c"}, 104 | -- {"BufEnter", "*", ":silent !fcitx5-remote -c "}, 105 | -- {"BufLeave", "*", ":silent !fcitx5-remote -c "} 106 | }, 107 | wins = { 108 | -- Highlight current line only on focused window 109 | { 110 | "WinEnter,BufEnter,InsertLeave", 111 | "*", 112 | [[if ! &cursorline && &filetype !~# '^\(dashboard\|clap_\)' && ! &pvw | setlocal cursorline | endif]], 113 | }, 114 | { 115 | "WinLeave,BufLeave,InsertEnter", 116 | "*", 117 | [[if &cursorline && &filetype !~# '^\(dashboard\|clap_\)' && ! &pvw | setlocal nocursorline | endif]], 118 | }, 119 | -- Attempt to write shada when leaving nvim 120 | { 121 | "VimLeave", 122 | "*", 123 | [[if has('nvim') | wshada | else | wviminfo! | endif]], 124 | }, 125 | -- Check if file changed when its window is focus, more eager than 'autoread' 126 | { "FocusGained", "* checktime" }, 127 | -- Equalize window dimensions when resizing vim window 128 | { "VimResized", "*", [[tabdo wincmd =]] }, 129 | }, 130 | ft = { 131 | { "FileType", "*", "setlocal formatoptions-=cro" }, 132 | { "FileType", "alpha", "setlocal showtabline=0" }, 133 | { "FileType", "markdown", "setlocal wrap" }, 134 | { "FileType", "dap-repl", "lua require('dap.ext.autocompl').attach()" }, 135 | { 136 | "FileType", 137 | "c,cpp", 138 | "nnoremap h :ClangdSwitchSourceHeaderVSplit", 139 | }, 140 | }, 141 | yank = { 142 | { 143 | "TextYankPost", 144 | "*", 145 | [[silent! lua vim.highlight.on_yank({higroup="IncSearch", timeout=300})]], 146 | }, 147 | }, 148 | } 149 | autocmd.nvim_create_augroups(require("modules.utils").extend_config(definitions, "user.event")) 150 | end 151 | 152 | autocmd.load_autocmds() 153 | -------------------------------------------------------------------------------- /lua/core/global.lua: -------------------------------------------------------------------------------- 1 | local global = {} 2 | local os_name = vim.uv.os_uname().sysname 3 | 4 | function global:load_variables() 5 | self.is_mac = os_name == "Darwin" 6 | self.is_linux = os_name == "Linux" 7 | self.is_windows = os_name == "Windows_NT" 8 | self.is_wsl = vim.fn.has("wsl") == 1 9 | self.vim_path = vim.fn.stdpath("config") 10 | self.cache_dir = vim.fn.stdpath("cache") 11 | self.data_dir = string.format("%s/site/", vim.fn.stdpath("data")) 12 | self.modules_dir = self.vim_path .. "/modules" 13 | self.home = self.is_windows and os.getenv("USERPROFILE") or os.getenv("HOME") 14 | end 15 | 16 | global:load_variables() 17 | 18 | return global 19 | -------------------------------------------------------------------------------- /lua/core/init.lua: -------------------------------------------------------------------------------- 1 | local settings = require("core.settings") 2 | local global = require("core.global") 3 | 4 | -- Create cache dir and data dirs 5 | local createdir = function() 6 | local data_dirs = { 7 | global.cache_dir .. "/backup", 8 | global.cache_dir .. "/session", 9 | global.cache_dir .. "/swap", 10 | global.cache_dir .. "/tags", 11 | global.cache_dir .. "/undo", 12 | } 13 | -- Only check whether cache_dir exists, this would be enough. 14 | if vim.fn.isdirectory(global.cache_dir) == 0 then 15 | ---@diagnostic disable-next-line: param-type-mismatch 16 | vim.fn.mkdir(global.cache_dir, "p") 17 | for _, dir in pairs(data_dirs) do 18 | if vim.fn.isdirectory(dir) == 0 then 19 | vim.fn.mkdir(dir, "p") 20 | end 21 | end 22 | end 23 | end 24 | 25 | local leader_map = function() 26 | vim.g.mapleader = " " 27 | -- NOTE: 28 | -- > Uncomment the following if you're using a other than , and you wish 29 | -- > to disable advancing one character by pressing in normal/visual mode. 30 | -- vim.api.nvim_set_keymap("n", " ", "", { noremap = true }) 31 | -- vim.api.nvim_set_keymap("x", " ", "", { noremap = true }) 32 | end 33 | 34 | local gui_config = function() 35 | if next(settings.gui_config) then 36 | vim.api.nvim_set_option_value( 37 | "guifont", 38 | settings.gui_config.font_name .. ":h" .. settings.gui_config.font_size, 39 | {} 40 | ) 41 | end 42 | end 43 | 44 | local neovide_config = function() 45 | for name, config in pairs(settings.neovide_config) do 46 | vim.g["neovide_" .. name] = config 47 | end 48 | end 49 | 50 | local clipboard_config = function() 51 | if global.is_mac then 52 | vim.g.clipboard = { 53 | name = "macOS-clipboard", 54 | copy = { ["+"] = "pbcopy", ["*"] = "pbcopy" }, 55 | paste = { ["+"] = "pbpaste", ["*"] = "pbpaste" }, 56 | cache_enabled = 0, 57 | } 58 | elseif global.is_wsl then 59 | vim.g.clipboard = { 60 | name = "win32yank-wsl", 61 | copy = { 62 | ["+"] = "win32yank.exe -i --crlf", 63 | ["*"] = "win32yank.exe -i --crlf", 64 | }, 65 | paste = { 66 | ["+"] = "win32yank.exe -o --lf", 67 | ["*"] = "win32yank.exe -o --lf", 68 | }, 69 | cache_enabled = 0, 70 | } 71 | end 72 | end 73 | 74 | local shell_config = function() 75 | if global.is_windows then 76 | if not (vim.fn.executable("pwsh") == 1 or vim.fn.executable("powershell") == 1) then 77 | vim.notify( 78 | [[ 79 | Failed to setup terminal config 80 | 81 | PowerShell is either not installed, missing from PATH, or not executable; 82 | cmd.exe will be used instead for `:!` (shell bang) and toggleterm.nvim. 83 | 84 | You're recommended to install PowerShell for better experience.]], 85 | vim.log.levels.WARN, 86 | { title = "[core] Runtime Warning" } 87 | ) 88 | return 89 | end 90 | 91 | local basecmd = "-NoLogo -MTA -ExecutionPolicy RemoteSigned" 92 | local ctrlcmd = "-Command [console]::InputEncoding = [console]::OutputEncoding = [System.Text.Encoding]::UTF8" 93 | local set_opts = vim.api.nvim_set_option_value 94 | set_opts("shell", vim.fn.executable("pwsh") == 1 and "pwsh" or "powershell", {}) 95 | set_opts("shellcmdflag", string.format("%s %s;", basecmd, ctrlcmd), {}) 96 | set_opts("shellredir", "-RedirectStandardOutput %s -NoNewWindow -Wait", {}) 97 | set_opts("shellpipe", "2>&1 | Out-File -Encoding UTF8 %s; exit $LastExitCode", {}) 98 | set_opts("shellquote", "", {}) 99 | set_opts("shellxquote", "", {}) 100 | end 101 | end 102 | 103 | local load_core = function() 104 | createdir() 105 | leader_map() 106 | 107 | gui_config() 108 | neovide_config() 109 | clipboard_config() 110 | shell_config() 111 | 112 | require("core.options") 113 | require("core.event") 114 | require("core.pack") 115 | require("keymap") 116 | 117 | vim.api.nvim_set_option_value("background", settings.background, {}) 118 | vim.cmd.colorscheme(settings.colorscheme) 119 | end 120 | 121 | load_core() 122 | -------------------------------------------------------------------------------- /lua/core/options.lua: -------------------------------------------------------------------------------- 1 | local global = require("core.global") 2 | 3 | local function load_options() 4 | local global_local = { 5 | -- backupdir = global.cache_dir .. "/backup/", 6 | -- directory = global.cache_dir .. "/swap/", 7 | -- spellfile = global.cache_dir .. "/spell/en.uft-8.add", 8 | -- viewdir = global.cache_dir .. "/view/", 9 | autoindent = true, 10 | autoread = true, 11 | autowrite = true, 12 | backspace = "indent,eol,start", 13 | backup = false, 14 | backupskip = "/tmp/*,$TMPDIR/*,$TMP/*,$TEMP/*,*/shm/*,/private/var/*,.vault.vim", 15 | breakat = [[\ \ ;:,!?]], 16 | breakindentopt = "shift:2,min:20", 17 | clipboard = "unnamedplus", 18 | cmdheight = 1, -- 0, 1, 2 19 | cmdwinheight = 5, 20 | complete = ".,w,b,k,kspell", 21 | completeopt = "fuzzy,menuone,noselect,popup", 22 | concealcursor = "niv", 23 | conceallevel = 0, 24 | cursorcolumn = true, 25 | cursorline = true, 26 | diffopt = "filler,iwhite,internal,linematch:60,algorithm:patience", 27 | display = "lastline", 28 | encoding = "utf-8", 29 | equalalways = false, 30 | errorbells = true, 31 | fileformats = "unix,mac,dos", 32 | foldenable = true, 33 | foldlevelstart = 99, 34 | formatoptions = "1jcroql", 35 | grepformat = "%f:%l:%c:%m", 36 | grepprg = "rg --hidden --vimgrep --smart-case --", 37 | helpheight = 12, 38 | hidden = true, 39 | history = 2000, 40 | ignorecase = true, 41 | inccommand = "nosplit", 42 | incsearch = true, 43 | infercase = true, 44 | jumpoptions = "stack", 45 | laststatus = 3, 46 | linebreak = true, 47 | list = true, 48 | listchars = "tab:»·,nbsp:+,trail:·,extends:→,precedes:←", 49 | magic = true, 50 | mousescroll = "ver:3,hor:6", 51 | number = true, 52 | previewheight = 12, 53 | -- Do NOT adjust the following option (pumblend) if you're using transparent background 54 | pumblend = 0, 55 | pumheight = 15, 56 | redrawtime = 1500, 57 | relativenumber = true, 58 | ruler = true, 59 | scrolloff = 2, 60 | sessionoptions = "buffers,curdir,folds,help,tabpages,winpos,winsize", 61 | shada = "!,'500,<50,@100,s10,h", 62 | shiftround = true, 63 | shiftwidth = 4, 64 | shortmess = "aoOTIcF", 65 | showbreak = "↳ ", 66 | showcmd = false, 67 | showmode = false, 68 | showtabline = 2, 69 | sidescrolloff = 5, 70 | signcolumn = "yes", 71 | smartcase = true, 72 | smarttab = true, 73 | smoothscroll = true, 74 | splitbelow = true, 75 | splitkeep = "screen", 76 | splitright = true, 77 | startofline = false, 78 | swapfile = false, 79 | switchbuf = "usetab,uselast", 80 | synmaxcol = 2500, 81 | tabstop = 4, 82 | termguicolors = true, 83 | timeout = true, 84 | timeoutlen = 300, 85 | ttimeout = true, 86 | ttimeoutlen = 0, 87 | undodir = global.cache_dir .. "/undo/", 88 | undofile = true, 89 | -- Please do NOT set `updatetime` to above 500, otherwise most plugins may not function correctly 90 | updatetime = 200, 91 | viewoptions = "folds,cursor,curdir,slash,unix", 92 | virtualedit = "block", 93 | visualbell = true, 94 | whichwrap = "h,l,<,>,[,],~", 95 | wildignore = ".git,.hg,.svn,*.pyc,*.o,*.out,*.jpg,*.jpeg,*.png,*.gif,*.zip,**/tmp/**,*.DS_Store,**/node_modules/**,**/bower_modules/**", 96 | wildignorecase = true, 97 | -- Do NOT adjust the following option (winblend) if you're using transparent background 98 | winblend = 0, 99 | winminwidth = 10, 100 | winwidth = 30, 101 | wrap = false, 102 | wrapscan = true, 103 | writebackup = false, 104 | } 105 | 106 | local function isempty(s) 107 | return s == nil or s == "" 108 | end 109 | local function use_if_defined(val, fallback) 110 | return val ~= nil and val or fallback 111 | end 112 | 113 | -- custom python provider 114 | local conda_prefix = os.getenv("CONDA_PREFIX") 115 | if not isempty(conda_prefix) then 116 | vim.g.python_host_prog = use_if_defined(vim.g.python_host_prog, conda_prefix .. "/bin/python") 117 | vim.g.python3_host_prog = use_if_defined(vim.g.python3_host_prog, conda_prefix .. "/bin/python") 118 | else 119 | vim.g.python_host_prog = use_if_defined(vim.g.python_host_prog, "python") 120 | vim.g.python3_host_prog = use_if_defined(vim.g.python3_host_prog, "python3") 121 | end 122 | 123 | for name, value in pairs(require("modules.utils").extend_config(global_local, "user.options")) do 124 | vim.api.nvim_set_option_value(name, value, {}) 125 | end 126 | end 127 | 128 | -- Newtrw liststyle: https://medium.com/usevim/the-netrw-style-options-3ebe91d42456 129 | vim.g.netrw_liststyle = 3 130 | 131 | load_options() 132 | -------------------------------------------------------------------------------- /lua/core/pack.lua: -------------------------------------------------------------------------------- 1 | local fn, api = vim.fn, vim.api 2 | local global = require("core.global") 3 | local is_mac = global.is_mac 4 | local vim_path = global.vim_path 5 | local data_dir = global.data_dir 6 | local lazy_path = data_dir .. "lazy/lazy.nvim" 7 | local modules_dir = vim_path .. "/lua/modules" 8 | local user_config_dir = vim_path .. "/lua/user" 9 | 10 | local settings = require("core.settings") 11 | local use_ssh = settings.use_ssh 12 | 13 | local icons = { 14 | kind = require("modules.utils.icons").get("kind"), 15 | documents = require("modules.utils.icons").get("documents"), 16 | ui = require("modules.utils.icons").get("ui"), 17 | ui_sep = require("modules.utils.icons").get("ui", true), 18 | misc = require("modules.utils.icons").get("misc"), 19 | } 20 | 21 | local Lazy = {} 22 | 23 | function Lazy:load_plugins() 24 | self.modules = {} 25 | 26 | local append_nativertp = function() 27 | package.path = package.path 28 | .. string.format( 29 | ";%s;%s;%s", 30 | modules_dir .. "/configs/?.lua", 31 | modules_dir .. "/configs/?/init.lua", 32 | user_config_dir .. "/?.lua" 33 | ) 34 | end 35 | 36 | local get_plugins_list = function() 37 | local list = {} 38 | local plugins_list = vim.split(fn.glob(modules_dir .. "/plugins/*.lua"), "\n") 39 | local user_plugins_list = vim.split(fn.glob(user_config_dir .. "/plugins/*.lua"), "\n", { trimempty = true }) 40 | vim.list_extend(plugins_list, user_plugins_list) 41 | for _, f in ipairs(plugins_list) do 42 | -- aggregate the plugins from `/plugins/*.lua` and `/user/plugins/*.lua` to a plugin list of a certain field for later `require` action. 43 | -- current fields contains: completion, editor, lang, tool, ui 44 | list[#list + 1] = f:find(modules_dir) and f:sub(#modules_dir - 6, -1) or f:sub(#user_config_dir - 3, -1) 45 | end 46 | return list 47 | end 48 | 49 | append_nativertp() 50 | 51 | for _, m in ipairs(get_plugins_list()) do 52 | -- require modules returned from `get_plugins_list()` function. 53 | local modules = require(m:sub(0, #m - 4)) 54 | if type(modules) == "table" then 55 | for name, conf in pairs(modules) do 56 | self.modules[#self.modules + 1] = vim.tbl_extend("force", { name }, conf) 57 | end 58 | end 59 | end 60 | for _, name in ipairs(settings.disabled_plugins) do 61 | self.modules[#self.modules + 1] = { name, enabled = false } 62 | end 63 | end 64 | 65 | function Lazy:load_lazy() 66 | if not vim.uv.fs_stat(lazy_path) then 67 | local lazy_repo = use_ssh and "git@github.com:folke/lazy.nvim.git " or "https://github.com/folke/lazy.nvim.git " 68 | api.nvim_command("!git clone --filter=blob:none --branch=stable " .. lazy_repo .. lazy_path) 69 | end 70 | self:load_plugins() 71 | 72 | local clone_prefix = use_ssh and "git@github.com:%s.git" or "https://github.com/%s.git" 73 | local lazy_settings = { 74 | root = data_dir .. "lazy", -- directory where plugins will be installed 75 | git = { 76 | -- log = { "-10" }, -- show the last 10 commits 77 | timeout = 300, 78 | url_format = clone_prefix, 79 | }, 80 | install = { 81 | -- install missing plugins on startup. This doesn't increase startup time. 82 | missing = true, 83 | colorscheme = { settings.colorscheme }, 84 | }, 85 | ui = { 86 | -- a number <1 is a percentage., >1 is a fixed size 87 | size = { width = 0.88, height = 0.8 }, 88 | wrap = true, -- wrap the lines in the ui 89 | -- The border to use for the UI window. Accepts same border values as |nvim_open_win()|. 90 | border = "rounded", 91 | icons = { 92 | cmd = icons.misc.Code, 93 | config = icons.ui.Gear, 94 | event = icons.kind.Event, 95 | ft = icons.documents.Files, 96 | init = icons.misc.ManUp, 97 | import = icons.documents.Import, 98 | keys = icons.ui.Keyboard, 99 | loaded = icons.ui.Check, 100 | not_loaded = icons.misc.Ghost, 101 | plugin = icons.ui.Package, 102 | runtime = icons.misc.Vim, 103 | source = icons.kind.StaticMethod, 104 | start = icons.ui.Play, 105 | list = { 106 | icons.ui_sep.BigCircle, 107 | icons.ui_sep.BigUnfilledCircle, 108 | icons.ui_sep.Square, 109 | icons.ui_sep.ChevronRight, 110 | }, 111 | }, 112 | }, 113 | performance = { 114 | cache = { 115 | enabled = true, 116 | path = vim.fn.stdpath("cache") .. "/lazy/cache", 117 | -- Once one of the following events triggers, caching will be disabled. 118 | -- To cache all modules, set this to `{}`, but that is not recommended. 119 | disable_events = { "UIEnter", "BufReadPre" }, 120 | ttl = 3600 * 24 * 2, -- keep unused modules for up to 2 days 121 | }, 122 | reset_packpath = true, -- reset the package path to improve startup time 123 | rtp = { 124 | reset = true, -- reset the runtime path to $VIMRUNTIME and the config directory 125 | ---@type string[] 126 | paths = {}, -- add any custom paths here that you want to include in the rtp 127 | disabled_plugins = { 128 | -- Comment out `"editorconfig"` to enable native EditorConfig support 129 | -- WARN: Sleuth.vim already includes all the features provided by this plugin. 130 | -- Do NOT enable both at the same time, or you risk breaking the entire detection system. 131 | "editorconfig", 132 | -- Do not load spell files 133 | "spellfile", 134 | -- Do not use builtin matchit.vim and matchparen.vim because we're using vim-matchup 135 | "matchit", 136 | "matchparen", 137 | -- Do not load tohtml.vim 138 | "tohtml", 139 | -- Do not load zipPlugin.vim, gzip.vim and tarPlugin.vim (all of these plugins are 140 | -- related to reading files inside compressed containers) 141 | "gzip", 142 | "tarPlugin", 143 | "zipPlugin", 144 | -- Disable remote plugins 145 | -- NOTE: 146 | -- > Disabling rplugin.vim will make `wilder.nvim` complain about missing rplugins during :checkhealth, 147 | -- > but since it's config doesn't require python rtp (strictly), it's fine to ignore that for now. 148 | -- "rplugin", 149 | }, 150 | }, 151 | }, 152 | } 153 | if is_mac then 154 | lazy_settings.concurrency = 20 155 | end 156 | 157 | vim.opt.rtp:prepend(lazy_path) 158 | require("lazy").setup(self.modules, lazy_settings) 159 | end 160 | 161 | Lazy:load_lazy() 162 | -------------------------------------------------------------------------------- /lua/keymap/bind.lua: -------------------------------------------------------------------------------- 1 | ---@class map_rhs 2 | ---@field cmd string 3 | ---@field options table 4 | ---@field options.noremap boolean 5 | ---@field options.silent boolean 6 | ---@field options.expr boolean 7 | ---@field options.nowait boolean 8 | ---@field options.callback function 9 | ---@field options.desc string 10 | ---@field buffer boolean|number 11 | local rhs_options = {} 12 | 13 | function rhs_options:new() 14 | local instance = { 15 | cmd = "", 16 | options = { 17 | noremap = false, 18 | silent = false, 19 | expr = false, 20 | nowait = false, 21 | callback = nil, 22 | desc = "", 23 | }, 24 | buffer = false, 25 | } 26 | setmetatable(instance, self) 27 | self.__index = self 28 | return instance 29 | end 30 | 31 | ---@param cmd_string string 32 | ---@return map_rhs 33 | function rhs_options:map_cmd(cmd_string) 34 | self.cmd = cmd_string 35 | return self 36 | end 37 | 38 | ---@param cmd_string string 39 | ---@return map_rhs 40 | function rhs_options:map_cr(cmd_string) 41 | self.cmd = (":%s"):format(cmd_string) 42 | return self 43 | end 44 | 45 | ---@param cmd_string string 46 | ---@return map_rhs 47 | function rhs_options:map_args(cmd_string) 48 | self.cmd = (":%s"):format(cmd_string) 49 | return self 50 | end 51 | 52 | ---@param cmd_string string 53 | ---@return map_rhs 54 | function rhs_options:map_cu(cmd_string) 55 | -- to eliminate the automatically inserted range in visual mode 56 | self.cmd = (":%s"):format(cmd_string) 57 | return self 58 | end 59 | 60 | ---@param callback fun():nil 61 | --- Takes a callback that will be called when the key is pressed 62 | ---@return map_rhs 63 | function rhs_options:map_callback(callback) 64 | self.cmd = "" 65 | self.options.callback = callback 66 | return self 67 | end 68 | 69 | ---@return map_rhs 70 | function rhs_options:with_silent() 71 | self.options.silent = true 72 | return self 73 | end 74 | 75 | ---@param description_string string 76 | ---@return map_rhs 77 | function rhs_options:with_desc(description_string) 78 | self.options.desc = description_string 79 | return self 80 | end 81 | 82 | ---@return map_rhs 83 | function rhs_options:with_noremap() 84 | self.options.noremap = true 85 | return self 86 | end 87 | 88 | ---@return map_rhs 89 | function rhs_options:with_expr() 90 | self.options.expr = true 91 | return self 92 | end 93 | 94 | ---@return map_rhs 95 | function rhs_options:with_nowait() 96 | self.options.nowait = true 97 | return self 98 | end 99 | 100 | ---@param num number 101 | ---@return map_rhs 102 | function rhs_options:with_buffer(num) 103 | self.buffer = num 104 | return self 105 | end 106 | 107 | local bind = {} 108 | 109 | ---@param cmd_string string 110 | ---@return map_rhs 111 | function bind.map_cr(cmd_string) 112 | local ro = rhs_options:new() 113 | return ro:map_cr(cmd_string) 114 | end 115 | 116 | ---@param cmd_string string 117 | ---@return map_rhs 118 | function bind.map_cmd(cmd_string) 119 | local ro = rhs_options:new() 120 | return ro:map_cmd(cmd_string) 121 | end 122 | 123 | ---@param cmd_string string 124 | ---@return map_rhs 125 | function bind.map_cu(cmd_string) 126 | local ro = rhs_options:new() 127 | return ro:map_cu(cmd_string) 128 | end 129 | 130 | ---@param cmd_string string 131 | ---@return map_rhs 132 | function bind.map_args(cmd_string) 133 | local ro = rhs_options:new() 134 | return ro:map_args(cmd_string) 135 | end 136 | 137 | ---@param callback fun():nil 138 | ---@return map_rhs 139 | function bind.map_callback(callback) 140 | local ro = rhs_options:new() 141 | return ro:map_callback(callback) 142 | end 143 | 144 | ---@param cmd_string string 145 | ---@return string escaped_string 146 | function bind.escape_termcode(cmd_string) 147 | return vim.api.nvim_replace_termcodes(cmd_string, true, true, true) 148 | end 149 | 150 | ---@param mapping table 151 | function bind.nvim_load_mapping(mapping) 152 | for key, value in pairs(mapping) do 153 | local modes, keymap = key:match("([^|]*)|?(.*)") 154 | if type(value) == "table" then 155 | for _, mode in ipairs(vim.split(modes, "")) do 156 | local rhs = value.cmd 157 | local options = value.options 158 | local buf = value.buffer 159 | if buf and type(buf) == "number" then 160 | vim.api.nvim_buf_set_keymap(buf, mode, keymap, rhs, options) 161 | else 162 | vim.api.nvim_set_keymap(mode, keymap, rhs, options) 163 | end 164 | end 165 | end 166 | end 167 | end 168 | 169 | return bind 170 | -------------------------------------------------------------------------------- /lua/keymap/completion.lua: -------------------------------------------------------------------------------- 1 | local bind = require("keymap.bind") 2 | local map_cr = bind.map_cr 3 | local map_callback = bind.map_callback 4 | 5 | local mappings = { 6 | fmt = { 7 | ["n|"] = map_cr("FormatToggle"):with_noremap():with_silent():with_desc("formatter: Toggle format on save"), 8 | ["n|"] = map_cr("Format"):with_noremap():with_silent():with_desc("formatter: Format buffer manually"), 9 | }, 10 | } 11 | bind.nvim_load_mapping(mappings.fmt) 12 | 13 | --- The following code allows this file to be exported --- 14 | --- for use with LSP lazy-loaded keymap bindings --- 15 | 16 | local M = {} 17 | 18 | ---@param buf integer 19 | function M.lsp(buf) 20 | local map = { 21 | -- LSP-related keymaps, ONLY effective in buffers with LSP(s) attached 22 | ["n|li"] = map_cr("LspInfo"):with_silent():with_buffer(buf):with_desc("lsp: Info"), 23 | ["n|lr"] = map_cr("LspRestart"):with_silent():with_buffer(buf):with_nowait():with_desc("lsp: Restart"), 24 | ["n|go"] = map_cr("Trouble symbols toggle win.position=right") 25 | :with_silent() 26 | :with_buffer(buf) 27 | :with_desc("lsp: Toggle outline"), 28 | ["n|gto"] = map_callback(function() 29 | local search_backend = require("core.settings").search_backend 30 | if search_backend == "fzf" then 31 | local prompt_position = require("telescope.config").values.layout_config.horizontal.prompt_position 32 | require("fzf-lua").lsp_document_symbols({ 33 | fzf_opts = { ["--layout"] = prompt_position == "top" and "reverse" or "default" }, 34 | }) 35 | else 36 | require("telescope.builtin").lsp_document_symbols() 37 | end 38 | end) 39 | :with_silent() 40 | :with_buffer(buf) 41 | :with_desc("lsp: Toggle outline in Telescope"), 42 | ["n|g["] = map_cr("Lspsaga diagnostic_jump_prev") 43 | :with_silent() 44 | :with_buffer(buf) 45 | :with_desc("lsp: Prev diagnostic"), 46 | ["n|g]"] = map_cr("Lspsaga diagnostic_jump_next") 47 | :with_silent() 48 | :with_buffer(buf) 49 | :with_desc("lsp: Next diagnostic"), 50 | ["n|lx"] = map_cr("Lspsaga show_line_diagnostics ++unfocus") 51 | :with_silent() 52 | :with_buffer(buf) 53 | :with_desc("lsp: Line diagnostic"), 54 | ["n|gs"] = map_callback(function() 55 | vim.lsp.buf.signature_help() 56 | end):with_desc("lsp: Signature help"), 57 | ["n|gr"] = map_cr("Lspsaga rename") 58 | :with_silent() 59 | :with_nowait() 60 | :with_buffer(buf) 61 | :with_desc("lsp: Rename in file range"), 62 | ["n|gR"] = map_cr("Lspsaga rename ++project") 63 | :with_silent() 64 | :with_buffer(buf) 65 | :with_desc("lsp: Rename in project range"), 66 | ["n|K"] = map_cr("Lspsaga hover_doc"):with_silent():with_buffer(buf):with_desc("lsp: Show doc"), 67 | ["nv|ga"] = map_cr("Lspsaga code_action") 68 | :with_silent() 69 | :with_buffer(buf) 70 | :with_desc("lsp: Code action for cursor"), 71 | ["n|gd"] = map_cr("Glance definitions"):with_silent():with_buffer(buf):with_desc("lsp: Preview definition"), 72 | ["n|gD"] = map_cr("Lspsaga goto_definition"):with_silent():with_buffer(buf):with_desc("lsp: Goto definition"), 73 | ["n|gh"] = map_cr("Glance references"):with_silent():with_buffer(buf):with_desc("lsp: Show reference"), 74 | ["n|gm"] = map_cr("Glance implementations") 75 | :with_silent() 76 | :with_buffer(buf) 77 | :with_desc("lsp: Show implementation"), 78 | ["n|gci"] = map_cr("Lspsaga incoming_calls") 79 | :with_silent() 80 | :with_buffer(buf) 81 | :with_desc("lsp: Show incoming calls"), 82 | ["n|gco"] = map_cr("Lspsaga outgoing_calls") 83 | :with_silent() 84 | :with_buffer(buf) 85 | :with_desc("lsp: Show outgoing calls"), 86 | ["n|lv"] = map_callback(function() 87 | _toggle_virtualtext() 88 | end) 89 | :with_noremap() 90 | :with_silent() 91 | :with_desc("lsp: Toggle virtual text display"), 92 | ["n|lh"] = map_callback(function() 93 | _toggle_inlayhint() 94 | end) 95 | :with_noremap() 96 | :with_silent() 97 | :with_desc("lsp: Toggle inlay hints display"), 98 | } 99 | bind.nvim_load_mapping(map) 100 | 101 | local ok, user_mappings = pcall(require, "user.keymap.completion") 102 | if ok and type(user_mappings.lsp) == "function" then 103 | require("modules.utils.keymap").replace(user_mappings.lsp(buf)) 104 | end 105 | end 106 | 107 | return M 108 | -------------------------------------------------------------------------------- /lua/keymap/helpers.lua: -------------------------------------------------------------------------------- 1 | _G._command_panel = function() 2 | require("telescope.builtin").keymaps({ 3 | lhs_filter = function(lhs) 4 | return not string.find(lhs, "Þ") 5 | end, 6 | }) 7 | end 8 | 9 | _G._flash_esc_or_noh = function() 10 | local flash_active, state = pcall(function() 11 | return require("flash.plugins.char").state 12 | end) 13 | if flash_active and state then 14 | state:hide() 15 | else 16 | pcall(vim.cmd.noh) 17 | end 18 | end 19 | 20 | _G._telescope_collections = function(picker_type) 21 | local actions = require("telescope.actions") 22 | local action_state = require("telescope.actions.state") 23 | local conf = require("telescope.config").values 24 | local finder = require("telescope.finders") 25 | local pickers = require("telescope.pickers") 26 | picker_type = picker_type or {} 27 | 28 | local collections = vim.tbl_keys(require("search.tabs").collections) 29 | pickers 30 | .new(picker_type, { 31 | prompt_title = "Telescope Collections", 32 | finder = finder.new_table({ results = collections }), 33 | sorter = conf.generic_sorter(picker_type), 34 | attach_mappings = function(bufnr) 35 | actions.select_default:replace(function() 36 | actions.close(bufnr) 37 | local selection = action_state.get_selected_entry() 38 | require("search").open({ collection = selection[1] }) 39 | end) 40 | 41 | return true 42 | end, 43 | }) 44 | :find() 45 | end 46 | 47 | _G._toggle_inlayhint = function() 48 | local is_enabled = vim.lsp.inlay_hint.is_enabled({ bufnr = 0 }) 49 | vim.lsp.inlay_hint.enable(not is_enabled) 50 | vim.notify( 51 | (is_enabled and "Inlay hint disabled successfully" or "Inlay hint enabled successfully"), 52 | vim.log.levels.INFO, 53 | { title = "LSP Inlay Hint" } 54 | ) 55 | end 56 | 57 | _G._toggle_virtualtext = function() 58 | local _vl_enabled = require("core.settings").diagnostics_virtual_lines 59 | if _vl_enabled then 60 | local vl_config = not vim.diagnostic.config().virtual_lines 61 | vim.diagnostic.config({ virtual_lines = vl_config }) 62 | vim.notify( 63 | (vl_config and "Virtual lines is now displayed" or "Virtual lines is now hidden"), 64 | vim.log.levels.INFO, 65 | { title = "LSP Diagnostic" } 66 | ) 67 | end 68 | end 69 | 70 | local _lazygit = nil 71 | _G._toggle_lazygit = function() 72 | if vim.fn.executable("lazygit") == 1 then 73 | if not _lazygit then 74 | _lazygit = require("toggleterm.terminal").Terminal:new({ 75 | cmd = "lazygit", 76 | direction = "float", 77 | close_on_exit = true, 78 | hidden = true, 79 | }) 80 | end 81 | _lazygit:toggle() 82 | else 83 | vim.notify("Command [lazygit] not found!", vim.log.levels.ERROR, { title = "toggleterm.nvim" }) 84 | end 85 | end 86 | -------------------------------------------------------------------------------- /lua/keymap/init.lua: -------------------------------------------------------------------------------- 1 | require("keymap.helpers") 2 | local bind = require("keymap.bind") 3 | local map_cr = bind.map_cr 4 | 5 | local mappings = { 6 | core = { 7 | -- Package manager: lazy.nvim 8 | ["n|ph"] = map_cr("Lazy"):with_silent():with_noremap():with_nowait():with_desc("package: Show"), 9 | ["n|ps"] = map_cr("Lazy sync"):with_silent():with_noremap():with_nowait():with_desc("package: Sync"), 10 | ["n|pu"] = map_cr("Lazy update") 11 | :with_silent() 12 | :with_noremap() 13 | :with_nowait() 14 | :with_desc("package: Update"), 15 | ["n|pi"] = map_cr("Lazy install") 16 | :with_silent() 17 | :with_noremap() 18 | :with_nowait() 19 | :with_desc("package: Install"), 20 | ["n|pl"] = map_cr("Lazy log"):with_silent():with_noremap():with_nowait():with_desc("package: Log"), 21 | ["n|pc"] = map_cr("Lazy check"):with_silent():with_noremap():with_nowait():with_desc("package: Check"), 22 | ["n|pd"] = map_cr("Lazy debug"):with_silent():with_noremap():with_nowait():with_desc("package: Debug"), 23 | ["n|pp"] = map_cr("Lazy profile") 24 | :with_silent() 25 | :with_noremap() 26 | :with_nowait() 27 | :with_desc("package: Profile"), 28 | ["n|pr"] = map_cr("Lazy restore") 29 | :with_silent() 30 | :with_noremap() 31 | :with_nowait() 32 | :with_desc("package: Restore"), 33 | ["n|px"] = map_cr("Lazy clean"):with_silent():with_noremap():with_nowait():with_desc("package: Clean"), 34 | }, 35 | } 36 | 37 | bind.nvim_load_mapping(mappings.core) 38 | 39 | -- Builtin & Plugin keymaps 40 | require("keymap.completion") 41 | require("keymap.editor") 42 | require("keymap.lang") 43 | require("keymap.tool") 44 | require("keymap.ui") 45 | 46 | -- User keymaps 47 | local ok, def = pcall(require, "user.keymap.init") 48 | if ok then 49 | require("modules.utils.keymap").replace(def) 50 | end 51 | -------------------------------------------------------------------------------- /lua/keymap/lang.lua: -------------------------------------------------------------------------------- 1 | local bind = require("keymap.bind") 2 | local map_cr = bind.map_cr 3 | 4 | local mappings = { 5 | plugins = { 6 | -- Plugin: render-markdown.nvim 7 | ["n|"] = map_cr("RenderMarkdown toggle") 8 | :with_noremap() 9 | :with_silent() 10 | :with_desc("tool: toggle markdown preview within nvim"), 11 | -- Plugin: MarkdownPreview 12 | ["n|"] = map_cr("MarkdownPreviewToggle"):with_noremap():with_silent():with_desc("tool: Preview markdown"), 13 | }, 14 | } 15 | 16 | bind.nvim_load_mapping(mappings.plugins) 17 | -------------------------------------------------------------------------------- /lua/modules/configs/completion/codeium.lua: -------------------------------------------------------------------------------- 1 | return function() 2 | require("modules.utils").load_plugin("codeium", {}) 3 | end 4 | -------------------------------------------------------------------------------- /lua/modules/configs/completion/copilot-cmp.lua: -------------------------------------------------------------------------------- 1 | return function() 2 | require("modules.utils").load_plugin("copilot_cmp", {}) 3 | end 4 | -------------------------------------------------------------------------------- /lua/modules/configs/completion/copilot.lua: -------------------------------------------------------------------------------- 1 | return function() 2 | vim.defer_fn(function() 3 | require("modules.utils").load_plugin("copilot", { 4 | cmp = { 5 | enabled = true, 6 | method = "getCompletionsCycling", 7 | }, 8 | panel = { 9 | -- if true, it can interfere with completions in copilot-cmp 10 | enabled = false, 11 | }, 12 | suggestion = { 13 | -- if true, it can interfere with completions in copilot-cmp 14 | enabled = false, 15 | }, 16 | filetypes = { 17 | ["bigfile"] = false, 18 | ["dap-repl"] = false, 19 | ["fugitive"] = false, 20 | ["fugitiveblame"] = false, 21 | ["git"] = false, 22 | ["gitcommit"] = false, 23 | ["log"] = false, 24 | ["toggleterm"] = false, 25 | }, 26 | }) 27 | end, 100) 28 | end 29 | -------------------------------------------------------------------------------- /lua/modules/configs/completion/formatters/clang_format.lua: -------------------------------------------------------------------------------- 1 | return { "-style={BasedOnStyle: LLVM, IndentWidth: 4}" } 2 | -------------------------------------------------------------------------------- /lua/modules/configs/completion/glance.lua: -------------------------------------------------------------------------------- 1 | return function() 2 | local icons = { ui = require("modules.utils.icons").get("ui", true) } 3 | local actions = require("glance").actions 4 | 5 | require("modules.utils").load_plugin("glance", { 6 | height = 20, 7 | zindex = 50, 8 | preview_win_opts = { 9 | cursorline = true, 10 | number = true, 11 | wrap = true, 12 | }, 13 | border = { 14 | enable = require("core.settings").transparent_background, 15 | top_char = "―", 16 | bottom_char = "―", 17 | }, 18 | list = { 19 | position = "right", 20 | width = 0.33, -- 33% width relative to the active window, min 0.1, max 0.5 21 | }, 22 | folds = { 23 | folded = true, -- Automatically fold list on startup 24 | fold_closed = icons.ui.ArrowClosed, 25 | fold_open = icons.ui.ArrowOpen, 26 | }, 27 | indent_lines = { enable = true }, 28 | winbar = { enable = true }, 29 | mappings = { 30 | list = { 31 | ["k"] = actions.previous, 32 | ["j"] = actions.next, 33 | [""] = actions.previous, 34 | [""] = actions.next, 35 | [""] = actions.previous_location, -- Bring the cursor to the previous location skipping groups in the list 36 | [""] = actions.next_location, -- Bring the cursor to the next location skipping groups in the list 37 | [""] = actions.preview_scroll_win(8), 38 | [""] = actions.preview_scroll_win(-8), 39 | [""] = actions.jump, 40 | ["v"] = actions.jump_vsplit, 41 | ["s"] = actions.jump_split, 42 | ["t"] = actions.jump_tab, 43 | ["c"] = actions.close_fold, 44 | ["o"] = actions.open_fold, 45 | ["[]"] = actions.enter_win("preview"), -- Focus preview window 46 | ["q"] = actions.close, 47 | ["Q"] = actions.close, 48 | [""] = actions.close, 49 | ["gq"] = actions.quickfix, 50 | }, 51 | preview = { 52 | ["Q"] = actions.close, 53 | ["q"] = actions.close, 54 | ["o"] = actions.jump, 55 | ["v"] = actions.jump_vsplit, 56 | ["s"] = actions.jump_split, 57 | ["t"] = actions.jump_tab, 58 | [""] = actions.previous_location, 59 | [""] = actions.next_location, 60 | ["[]"] = actions.enter_win("list"), -- Focus list window 61 | }, 62 | }, 63 | hooks = { 64 | before_open = function(results, open, _, method) 65 | if #results == 0 then 66 | vim.notify( 67 | "This method is not supported by any of the servers registered for the current buffer", 68 | vim.log.levels.WARN, 69 | { title = "Glance" } 70 | ) 71 | elseif #results == 1 and method == "references" then 72 | vim.notify( 73 | "The identifier under cursor is the only one found", 74 | vim.log.levels.INFO, 75 | { title = "Glance" } 76 | ) 77 | else 78 | open(results) 79 | end 80 | end, 81 | }, 82 | }) 83 | end 84 | -------------------------------------------------------------------------------- /lua/modules/configs/completion/lsp-signature.lua: -------------------------------------------------------------------------------- 1 | return function() 2 | require("modules.utils").load_plugin("lsp_signature", { 3 | bind = true, 4 | -- TODO: Remove the following line when nvim-cmp#1613 gets resolved 5 | check_completion_visible = false, 6 | floating_window = true, 7 | floating_window_above_cur_line = true, 8 | hi_parameter = "Search", 9 | hint_enable = true, 10 | transparency = nil, -- disabled by default, allow floating win transparent value 1~100 11 | wrap = true, 12 | zindex = 45, -- avoid overlap with nvim.cmp 13 | handler_opts = { border = "single" }, 14 | }) 15 | end 16 | -------------------------------------------------------------------------------- /lua/modules/configs/completion/lsp.lua: -------------------------------------------------------------------------------- 1 | return function() 2 | local nvim_lsp = require("lspconfig") 3 | require("completion.neoconf").setup() 4 | require("completion.mason").setup() 5 | require("completion.mason-lspconfig").setup() 6 | 7 | local opts = { 8 | capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities()), 9 | } 10 | -- Setup lsps that are not supported by `mason.nvim` but supported by `nvim-lspconfig` here. 11 | if vim.fn.executable("dart") == 1 then 12 | local ok, _opts = pcall(require, "user.configs.lsp-servers.dartls") 13 | if not ok then 14 | _opts = require("completion.servers.dartls") 15 | end 16 | local final_opts = vim.tbl_deep_extend("keep", _opts, opts) 17 | nvim_lsp.dartls.setup(final_opts) 18 | end 19 | 20 | pcall(require, "user.configs.lsp") 21 | 22 | pcall(vim.cmd.LspStart) -- Start LSPs 23 | end 24 | -------------------------------------------------------------------------------- /lua/modules/configs/completion/lspsaga.lua: -------------------------------------------------------------------------------- 1 | return function() 2 | require("modules.utils").gen_lspkind_hl() 3 | 4 | local icons = { 5 | cmp = require("modules.utils.icons").get("cmp", true), 6 | diagnostics = require("modules.utils.icons").get("diagnostics", true), 7 | kind = require("modules.utils.icons").get("kind", true), 8 | type = require("modules.utils.icons").get("type", true), 9 | ui = require("modules.utils.icons").get("ui", true), 10 | } 11 | 12 | local function set_sidebar_icons() 13 | -- Set icons for sidebar 14 | vim.diagnostic.config({ 15 | signs = { 16 | text = { 17 | [vim.diagnostic.severity.ERROR] = icons.diagnostics.Error_alt, 18 | [vim.diagnostic.severity.WARN] = icons.diagnostics.Warning_alt, 19 | [vim.diagnostic.severity.INFO] = icons.diagnostics.Information_alt, 20 | [vim.diagnostic.severity.HINT] = icons.diagnostics.Hint_alt, 21 | }, 22 | }, 23 | }) 24 | end 25 | 26 | set_sidebar_icons() 27 | 28 | require("modules.utils").load_plugin("lspsaga", { 29 | -- Breadcrumbs: https://nvimdev.github.io/lspsaga/breadcrumbs/ 30 | symbol_in_winbar = { 31 | enable = false, 32 | separator = " " .. icons.ui.Separator, 33 | hide_keyword = false, 34 | show_file = false, 35 | folder_level = 1, 36 | color_mode = true, 37 | delay = 100, 38 | }, 39 | -- Callhierarchy: https://nvimdev.github.io/lspsaga/callhierarchy/ 40 | callhierarchy = { 41 | layout = "float", 42 | keys = { 43 | edit = "e", 44 | vsplit = "v", 45 | split = "s", 46 | tabe = "t", 47 | quit = "q", 48 | shuttle = "[]", 49 | toggle_or_req = "u", 50 | close = "", 51 | }, 52 | }, 53 | -- Code Action: https://nvimdev.github.io/lspsaga/codeaction/ 54 | code_action = { 55 | num_shortcut = true, 56 | only_in_cursor = false, 57 | show_server_name = true, 58 | extend_gitsigns = false, 59 | keys = { 60 | quit = "q", 61 | exec = "", 62 | }, 63 | }, 64 | -- Diagnostics: https://nvimdev.github.io/lspsaga/diagnostic/ 65 | diagnostic = { 66 | show_code_action = true, 67 | jump_num_shortcut = true, 68 | max_width = 0.5, 69 | max_height = 0.6, 70 | text_hl_follow = true, 71 | border_follow = true, 72 | extend_relatedInformation = true, 73 | show_layout = "float", 74 | show_normal_height = 10, 75 | max_show_width = 0.9, 76 | max_show_height = 0.6, 77 | diagnostic_only_current = false, 78 | keys = { 79 | exec_action = "r", 80 | quit = "q", 81 | toggle_or_jump = "", 82 | quit_in_show = { "q", "" }, 83 | }, 84 | }, 85 | -- Hover: https://nvimdev.github.io/lspsaga/hover/ 86 | hover = { 87 | max_width = 0.45, 88 | max_height = 0.7, 89 | open_link = "gl", 90 | open_cmd = "silent !" .. require("core.settings").external_browser, 91 | }, 92 | -- Impl: https://nvimdev.github.io/lspsaga/implement/ 93 | implement = { 94 | enable = true, 95 | sign = true, 96 | virtual_text = false, 97 | priority = 100, 98 | }, 99 | -- LightBulb: https://nvimdev.github.io/lspsaga/lightbulb/ 100 | lightbulb = { 101 | enable = false, 102 | sign = true, 103 | virtual_text = false, 104 | debounce = 10, 105 | sign_priority = 20, 106 | }, 107 | -- Rename: https://nvimdev.github.io/lspsaga/rename/ 108 | rename = { 109 | in_select = false, 110 | auto_save = false, 111 | project_max_width = 0.5, 112 | project_max_height = 0.5, 113 | keys = { 114 | quit = "", 115 | exec = "", 116 | select = "x", 117 | }, 118 | }, 119 | -- Beacon: https://nvimdev.github.io/lspsaga/misc/#beacon 120 | beacon = { 121 | enable = true, 122 | frequency = 12, 123 | }, 124 | -- Generic UI Options: https://nvimdev.github.io/lspsaga/misc/#generic-ui-options 125 | ui = { 126 | border = "single", -- Can be single, double, rounded, solid, shadow. 127 | devicon = true, 128 | title = true, 129 | expand = icons.ui.ArrowClosed, 130 | collapse = icons.ui.ArrowOpen, 131 | code_action = icons.ui.CodeAction, 132 | actionfix = icons.ui.Spell, 133 | lines = { "┗", "┣", "┃", "━", "┏" }, 134 | imp_sign = icons.kind.Implementation, 135 | kind = { 136 | -- Kind 137 | Class = { icons.kind.Class, "LspKindClass" }, 138 | Constant = { icons.kind.Constant, "LspKindConstant" }, 139 | Constructor = { icons.kind.Constructor, "LspKindConstructor" }, 140 | Enum = { icons.kind.Enum, "LspKindEnum" }, 141 | EnumMember = { icons.kind.EnumMember, "LspKindEnumMember" }, 142 | Event = { icons.kind.Event, "LspKindEvent" }, 143 | Field = { icons.kind.Field, "LspKindField" }, 144 | File = { icons.kind.File, "LspKindFile" }, 145 | Function = { icons.kind.Function, "LspKindFunction" }, 146 | Interface = { icons.kind.Interface, "LspKindInterface" }, 147 | Key = { icons.kind.Keyword, "LspKindKey" }, 148 | Method = { icons.kind.Method, "LspKindMethod" }, 149 | Module = { icons.kind.Module, "LspKindModule" }, 150 | Namespace = { icons.kind.Namespace, "LspKindNamespace" }, 151 | Operator = { icons.kind.Operator, "LspKindOperator" }, 152 | Package = { icons.kind.Package, "LspKindPackage" }, 153 | Property = { icons.kind.Property, "LspKindProperty" }, 154 | Struct = { icons.kind.Struct, "LspKindStruct" }, 155 | TypeParameter = { icons.kind.TypeParameter, "LspKindTypeParameter" }, 156 | Variable = { icons.kind.Variable, "LspKindVariable" }, 157 | -- Type 158 | Array = { icons.type.Array, "LspKindArray" }, 159 | Boolean = { icons.type.Boolean, "LspKindBoolean" }, 160 | Null = { icons.type.Null, "LspKindNull" }, 161 | Number = { icons.type.Number, "LspKindNumber" }, 162 | Object = { icons.type.Object, "LspKindObject" }, 163 | String = { icons.type.String, "LspKindString" }, 164 | -- ccls-specific icons. 165 | TypeAlias = { icons.kind.TypeAlias, "LspKindTypeAlias" }, 166 | Parameter = { icons.kind.Parameter, "LspKindParameter" }, 167 | StaticMethod = { icons.kind.StaticMethod, "LspKindStaticMethod" }, 168 | -- Microsoft-specific icons. 169 | Text = { icons.kind.Text, "LspKindText" }, 170 | Snippet = { icons.kind.Snippet, "LspKindSnippet" }, 171 | Folder = { icons.kind.Folder, "LspKindFolder" }, 172 | Unit = { icons.kind.Unit, "LspKindUnit" }, 173 | Value = { icons.kind.Value, "LspKindValue" }, 174 | }, 175 | }, 176 | -- Scrolling Keymaps: https://nvimdev.github.io/lspsaga/misc/#scrolling-keymaps 177 | scroll_preview = { 178 | scroll_down = "", 179 | scroll_up = "", 180 | }, 181 | request_timeout = 3000, 182 | }) 183 | end 184 | -------------------------------------------------------------------------------- /lua/modules/configs/completion/luasnip.lua: -------------------------------------------------------------------------------- 1 | return function() 2 | local vim_path = require("core.global").vim_path 3 | local snippet_path = vim_path .. "/snips/" 4 | local user_snippet_path = vim_path .. "/lua/user/snips/" 5 | 6 | require("modules.utils").load_plugin("luasnip", { 7 | history = true, 8 | update_events = "TextChanged,TextChangedI", 9 | delete_check_events = "TextChanged,InsertLeave", 10 | }, false, require("luasnip").config.set_config) 11 | 12 | require("luasnip.loaders.from_vscode").lazy_load({ 13 | paths = { 14 | snippet_path, 15 | user_snippet_path, 16 | }, 17 | }) 18 | require("luasnip.loaders.from_lua").lazy_load() 19 | require("luasnip.loaders.from_vscode").lazy_load() 20 | require("luasnip.loaders.from_snipmate").lazy_load() 21 | end 22 | -------------------------------------------------------------------------------- /lua/modules/configs/completion/mason-lspconfig.lua: -------------------------------------------------------------------------------- 1 | local M = {} 2 | 3 | M.setup = function() 4 | local diagnostics_virtual_lines = require("core.settings").diagnostics_virtual_lines 5 | local diagnostics_level = require("core.settings").diagnostics_level 6 | local lsp_deps = require("core.settings").lsp_deps 7 | 8 | require("lspconfig.ui.windows").default_options.border = "rounded" 9 | require("modules.utils").load_plugin("mason-lspconfig", { 10 | ensure_installed = lsp_deps, 11 | }) 12 | 13 | vim.diagnostic.config({ 14 | signs = true, 15 | underline = false, 16 | virtual_text = false, 17 | virtual_lines = diagnostics_virtual_lines and { 18 | severity = { 19 | min = vim.diagnostic.severity[diagnostics_level], 20 | }, 21 | } or false, 22 | -- set update_in_insert to false because it was enabled by lspsaga 23 | update_in_insert = false, 24 | }) 25 | 26 | local opts = { 27 | capabilities = vim.tbl_deep_extend( 28 | "force", 29 | vim.lsp.protocol.make_client_capabilities(), 30 | require("cmp_nvim_lsp").default_capabilities() 31 | ), 32 | } 33 | ---A handler to setup all servers defined under `completion/servers/*.lua` 34 | ---@param lsp_name string 35 | local function mason_lsp_handler(lsp_name) 36 | -- rust_analyzer is configured using mrcjkb/rustaceanvim 37 | -- warn users if they have set it up manually 38 | if lsp_name == "rust_analyzer" then 39 | local config_exist = pcall(require, "completion.servers." .. lsp_name) 40 | if config_exist then 41 | vim.notify( 42 | [[ 43 | `rust_analyzer` is configured independently via `mrcjkb/rustaceanvim`. To get rid of this warning, 44 | please REMOVE your LSP configuration (rust_analyzer.lua) from the `servers` directory and configure 45 | `rust_analyzer` using the appropriate init options provided by `rustaceanvim` instead.]], 46 | vim.log.levels.WARN, 47 | { title = "nvim-lspconfig" } 48 | ) 49 | end 50 | return 51 | end 52 | 53 | local ok, custom_handler = pcall(require, "user.configs.lsp-servers." .. lsp_name) 54 | local default_ok, default_handler = pcall(require, "completion.servers." .. lsp_name) 55 | -- Use preset if there is no user definition 56 | if not ok then 57 | ok, custom_handler = default_ok, default_handler 58 | end 59 | 60 | if not ok then 61 | -- Default to use factory config for server(s) that doesn't include a spec 62 | vim.lsp.config(lsp_name, opts) 63 | vim.lsp.enable(lsp_name) 64 | elseif type(custom_handler) == "function" then 65 | --- Case where language server requires its own setup 66 | --- Make sure to call require("lspconfig")[lsp_name].setup() in the function 67 | --- See `clangd.lua` for example. 68 | custom_handler(opts) 69 | vim.lsp.enable(lsp_name) 70 | elseif type(custom_handler) == "table" then 71 | vim.lsp.config( 72 | lsp_name, 73 | vim.tbl_deep_extend( 74 | "force", 75 | opts, 76 | type(default_handler) == "table" and default_handler or {}, 77 | custom_handler 78 | ) 79 | ) 80 | vim.lsp.enable(lsp_name) 81 | else 82 | vim.notify( 83 | string.format( 84 | "Failed to setup [%s].\n\nServer definition under `completion/servers` must return\neither a fun(opts) or a table (got '%s' instead)", 85 | lsp_name, 86 | type(custom_handler) 87 | ), 88 | vim.log.levels.ERROR, 89 | { title = "nvim-lspconfig" } 90 | ) 91 | end 92 | end 93 | 94 | for _, lsp in ipairs(lsp_deps) do 95 | mason_lsp_handler(lsp) 96 | end 97 | end 98 | 99 | return M 100 | -------------------------------------------------------------------------------- /lua/modules/configs/completion/mason-null-ls.lua: -------------------------------------------------------------------------------- 1 | local M = {} 2 | 3 | M.setup = function() 4 | require("modules.utils").load_plugin("mason-null-ls", { 5 | ensure_installed = require("core.settings").null_ls_deps, 6 | automatic_installation = false, 7 | automatic_setup = true, 8 | handlers = {}, 9 | }) 10 | end 11 | 12 | return M 13 | -------------------------------------------------------------------------------- /lua/modules/configs/completion/mason.lua: -------------------------------------------------------------------------------- 1 | local M = {} 2 | 3 | M.setup = function() 4 | local is_windows = require("core.global").is_windows 5 | 6 | local mason_registry = require("mason-registry") 7 | require("lspconfig.ui.windows").default_options.border = "rounded" 8 | 9 | local icons = { 10 | ui = require("modules.utils.icons").get("ui", true), 11 | misc = require("modules.utils.icons").get("misc", true), 12 | } 13 | 14 | require("modules.utils").load_plugin("mason", { 15 | ui = { 16 | border = "single", 17 | icons = { 18 | package_pending = icons.ui.Modified_alt, 19 | package_installed = icons.ui.Check, 20 | package_uninstalled = icons.misc.Ghost, 21 | }, 22 | keymaps = { 23 | toggle_server_expand = "", 24 | install_server = "i", 25 | update_server = "u", 26 | check_server_version = "c", 27 | update_all_servers = "U", 28 | check_outdated_servers = "C", 29 | uninstall_server = "X", 30 | cancel_installation = "", 31 | }, 32 | }, 33 | }) 34 | 35 | -- Additional plugins for pylsp 36 | mason_registry:on( 37 | "package:install:success", 38 | vim.schedule_wrap(function(pkg) 39 | if pkg.name ~= "python-lsp-server" then 40 | return 41 | end 42 | 43 | local venv = vim.fn.stdpath("data") .. "/mason/packages/python-lsp-server/venv" 44 | local python = is_windows and venv .. "/Scripts/python.exe" or venv .. "/bin/python" 45 | local black = is_windows and venv .. "/Scripts/black.exe" or venv .. "/bin/black" 46 | local ruff = is_windows and venv .. "/Scripts/ruff.exe" or venv .. "/bin/ruff" 47 | 48 | require("plenary.job") 49 | :new({ 50 | command = python, 51 | args = { 52 | "-m", 53 | "pip", 54 | "install", 55 | "-U", 56 | "--disable-pip-version-check", 57 | "python-lsp-black", 58 | "python-lsp-ruff", 59 | "pylsp-rope", 60 | }, 61 | cwd = venv, 62 | env = { VIRTUAL_ENV = venv }, 63 | on_exit = function() 64 | if vim.fn.executable(black) == 1 and vim.fn.executable(ruff) == 1 then 65 | vim.notify( 66 | "Finished installing pylsp plugins", 67 | vim.log.levels.INFO, 68 | { title = "[lsp] Install Status" } 69 | ) 70 | else 71 | vim.notify( 72 | "Failed to install pylsp plugins. [Executable not found]", 73 | vim.log.levels.ERROR, 74 | { title = "[lsp] Install Failure" } 75 | ) 76 | end 77 | end, 78 | on_start = function() 79 | vim.notify( 80 | "Now installing pylsp plugins...", 81 | vim.log.levels.INFO, 82 | { title = "[lsp] Install Status", timeout = 6000 } 83 | ) 84 | end, 85 | on_stderr = function(_, msg_stream) 86 | if msg_stream then 87 | vim.notify(msg_stream, vim.log.levels.ERROR, { title = "[lsp] Install Failure" }) 88 | end 89 | end, 90 | }) 91 | :start() 92 | end) 93 | ) 94 | end 95 | 96 | return M 97 | -------------------------------------------------------------------------------- /lua/modules/configs/completion/neoconf.lua: -------------------------------------------------------------------------------- 1 | local M = {} 2 | 3 | M.setup = function() 4 | require("modules.utils").load_plugin("neoconf", { 5 | -- send new configuration to lsp clients when changing json settings 6 | live_reload = true, 7 | -- name of the local settings files 8 | local_settings = ".neoconf.json", 9 | -- name of the global settings file in your Neovim config directory 10 | global_settings = "neoconf.json", 11 | -- import existing settings from other plugins 12 | import = { 13 | vscode = true, -- local .vscode/settings.json 14 | coc = true, -- global/local coc-settings.json 15 | nlsp = true, -- global/local nlsp-settings.nvim json settings 16 | }, 17 | }) 18 | end 19 | 20 | return M 21 | -------------------------------------------------------------------------------- /lua/modules/configs/completion/null-ls.lua: -------------------------------------------------------------------------------- 1 | return function() 2 | local null_ls = require("null-ls") 3 | local btns = null_ls.builtins 4 | 5 | ---Return formatter args required by `extra_args` 6 | ---@param formatter_name string 7 | ---@return table|nil 8 | local function formatter_args(formatter_name) 9 | local ok, args = pcall(require, "user.configs.formatters." .. formatter_name) 10 | if not ok then 11 | args = require("completion.formatters." .. formatter_name) 12 | end 13 | return args 14 | end 15 | 16 | -- Please set additional flags for the supported servers here 17 | -- Don't specify any config here if you are using the default one. 18 | local sources = { 19 | btns.formatting.clang_format.with({ 20 | filetypes = { "c", "cpp", "objc", "objcpp", "cs", "cuda", "proto" }, 21 | extra_args = formatter_args("clang_format"), 22 | }), 23 | btns.formatting.prettier.with({ 24 | filetypes = { 25 | "vue", 26 | "typescript", 27 | "javascript", 28 | "typescriptreact", 29 | "javascriptreact", 30 | "yaml", 31 | "html", 32 | "css", 33 | "scss", 34 | "sh", 35 | "markdown", 36 | }, 37 | }), 38 | } 39 | require("modules.utils").load_plugin("null-ls", { 40 | border = "rounded", 41 | debug = false, 42 | log_level = "warn", 43 | update_in_insert = false, 44 | sources = sources, 45 | default_timeout = require("core.settings").format_timeout, 46 | }) 47 | 48 | require("completion.mason-null-ls").setup() 49 | 50 | -- Setup usercmd to register/deregister available source(s) 51 | local function _gen_completion() 52 | local sources_cont = null_ls.get_source({ 53 | filetype = vim.bo.filetype, 54 | }) 55 | local completion_items = {} 56 | for _, server in pairs(sources_cont) do 57 | table.insert(completion_items, server.name) 58 | end 59 | return completion_items 60 | end 61 | vim.api.nvim_create_user_command("NullLsToggle", function(opts) 62 | if vim.tbl_contains(_gen_completion(), opts.args) then 63 | null_ls.toggle({ name = opts.args }) 64 | else 65 | vim.notify( 66 | string.format("[Null-ls] Unable to find any registered source named [%s].", opts.args), 67 | vim.log.levels.ERROR, 68 | { title = "Null-ls Internal Error" } 69 | ) 70 | end 71 | end, { 72 | nargs = 1, 73 | complete = _gen_completion, 74 | }) 75 | 76 | require("completion.formatting").configure_format_on_save() 77 | end 78 | -------------------------------------------------------------------------------- /lua/modules/configs/completion/servers/bashls.lua: -------------------------------------------------------------------------------- 1 | -- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/configs/bashls.lua 2 | return { 3 | cmd = { "bash-language-server", "start" }, 4 | filetypes = { "bash", "sh" }, 5 | } 6 | -------------------------------------------------------------------------------- /lua/modules/configs/completion/servers/clangd.lua: -------------------------------------------------------------------------------- 1 | local function switch_source_header_splitcmd(bufnr, splitcmd) 2 | bufnr = require("lspconfig").util.validate_bufnr(bufnr) 3 | local clangd_client = require("lspconfig").util.get_active_client_by_name(bufnr, "clangd") 4 | local params = { uri = vim.uri_from_bufnr(bufnr) } 5 | if clangd_client then 6 | clangd_client.request("textDocument/switchSourceHeader", params, function(err, result) 7 | if err then 8 | error(tostring(err)) 9 | end 10 | if not result then 11 | vim.notify("Corresponding file can’t be determined", vim.log.levels.ERROR, { title = "LSP Error!" }) 12 | return 13 | end 14 | vim.api.nvim_command(splitcmd .. " " .. vim.uri_to_fname(result)) 15 | end) 16 | else 17 | vim.notify( 18 | "Method textDocument/switchSourceHeader is not supported by any active server on this buffer", 19 | vim.log.levels.ERROR, 20 | { title = "LSP Error!" } 21 | ) 22 | end 23 | end 24 | 25 | local function get_binary_path_list(binaries) 26 | local path_list = {} 27 | for _, binary in ipairs(binaries) do 28 | local path = vim.fn.exepath(binary) 29 | if path ~= "" then 30 | table.insert(path_list, path) 31 | end 32 | end 33 | return table.concat(path_list, ",") 34 | end 35 | 36 | -- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/configs/clangd.lua 37 | return function(options) 38 | require("lspconfig").clangd.setup({ 39 | on_attach = options.on_attach, 40 | capabilities = vim.tbl_deep_extend("keep", { offsetEncoding = { "utf-16", "utf-8" } }, options.capabilities), 41 | single_file_support = true, 42 | cmd = { 43 | "clangd", 44 | "-j=12", 45 | "--enable-config", 46 | "--background-index", 47 | "--pch-storage=memory", 48 | -- You MUST set this arg ↓ to your c/cpp compiler location (if not included)! 49 | "--query-driver=" .. get_binary_path_list({ "clang++", "clang", "gcc", "g++" }), 50 | "--clang-tidy", 51 | "--all-scopes-completion", 52 | "--completion-style=detailed", 53 | "--header-insertion-decorators", 54 | "--header-insertion=iwyu", 55 | "--limit-references=3000", 56 | "--limit-results=350", 57 | }, 58 | commands = { 59 | ClangdSwitchSourceHeader = { 60 | function() 61 | switch_source_header_splitcmd(0, "edit") 62 | end, 63 | description = "Open source/header in current buffer", 64 | }, 65 | ClangdSwitchSourceHeaderVSplit = { 66 | function() 67 | switch_source_header_splitcmd(0, "vsplit") 68 | end, 69 | description = "Open source/header in a new vsplit", 70 | }, 71 | ClangdSwitchSourceHeaderSplit = { 72 | function() 73 | switch_source_header_splitcmd(0, "split") 74 | end, 75 | description = "Open source/header in a new split", 76 | }, 77 | }, 78 | }) 79 | end 80 | -------------------------------------------------------------------------------- /lua/modules/configs/completion/servers/dartls.lua: -------------------------------------------------------------------------------- 1 | -- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/configs/dartls.lua 2 | return { 3 | cmd = { "dart", "language-server", "--protocol=lsp" }, 4 | filetypes = { "dart" }, 5 | init_options = { 6 | closingLabels = true, 7 | flutterOutline = true, 8 | onlyAnalyzeProjectsWithOpenFiles = true, 9 | outline = true, 10 | suggestFromUnimportedLibraries = true, 11 | }, 12 | } 13 | -------------------------------------------------------------------------------- /lua/modules/configs/completion/servers/gopls.lua: -------------------------------------------------------------------------------- 1 | -- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/configs/gopls.lua 2 | return { 3 | cmd = { "gopls", "-remote.debug=:0", "-remote=auto" }, 4 | filetypes = { "go", "gomod", "gosum", "gotmpl", "gohtmltmpl", "gotexttmpl" }, 5 | flags = { allow_incremental_sync = true, debounce_text_changes = 500 }, 6 | capabilities = { 7 | textDocument = { 8 | completion = { 9 | contextSupport = true, 10 | dynamicRegistration = true, 11 | completionItem = { 12 | commitCharactersSupport = true, 13 | deprecatedSupport = true, 14 | preselectSupport = true, 15 | insertReplaceSupport = true, 16 | labelDetailsSupport = true, 17 | snippetSupport = true, 18 | documentationFormat = { "markdown", "plaintext" }, 19 | resolveSupport = { 20 | properties = { 21 | "documentation", 22 | "details", 23 | "additionalTextEdits", 24 | }, 25 | }, 26 | }, 27 | }, 28 | }, 29 | }, 30 | settings = { 31 | gopls = { 32 | staticcheck = true, 33 | semanticTokens = true, 34 | usePlaceholders = true, 35 | completeUnimported = true, 36 | symbolMatcher = "Fuzzy", 37 | buildFlags = { "-tags", "integration" }, 38 | semanticTokenTypes = { string = false }, 39 | codelenses = { 40 | generate = true, 41 | gc_details = true, 42 | test = true, 43 | tidy = true, 44 | vendor = true, 45 | regenerate_cgo = true, 46 | upgrade_dependency = true, 47 | }, 48 | }, 49 | }, 50 | } 51 | -------------------------------------------------------------------------------- /lua/modules/configs/completion/servers/html.lua: -------------------------------------------------------------------------------- 1 | -- https://github.com/vscode-langservers/vscode-html-languageserver-bin 2 | return { 3 | cmd = { "html-languageserver", "--stdio" }, 4 | filetypes = { "html" }, 5 | init_options = { 6 | configurationSection = { "html", "css", "javascript" }, 7 | embeddedLanguages = { css = true, javascript = true }, 8 | }, 9 | settings = {}, 10 | single_file_support = true, 11 | flags = { debounce_text_changes = 500 }, 12 | } 13 | -------------------------------------------------------------------------------- /lua/modules/configs/completion/servers/jsonls.lua: -------------------------------------------------------------------------------- 1 | -- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/configs/jsonls.lua 2 | return { 3 | flags = { debounce_text_changes = 500 }, 4 | settings = { 5 | json = { 6 | -- Schemas https://www.schemastore.org 7 | schemas = { 8 | { 9 | fileMatch = { "package.json" }, 10 | url = "https://json.schemastore.org/package.json", 11 | }, 12 | { 13 | fileMatch = { "tsconfig*.json" }, 14 | url = "https://json.schemastore.org/tsconfig.json", 15 | }, 16 | { 17 | fileMatch = { 18 | ".prettierrc", 19 | ".prettierrc.json", 20 | "prettier.config.json", 21 | }, 22 | url = "https://json.schemastore.org/prettierrc.json", 23 | }, 24 | { 25 | fileMatch = { ".eslintrc", ".eslintrc.json" }, 26 | url = "https://json.schemastore.org/eslintrc.json", 27 | }, 28 | { 29 | fileMatch = { 30 | ".babelrc", 31 | ".babelrc.json", 32 | "babel.config.json", 33 | }, 34 | url = "https://json.schemastore.org/babelrc.json", 35 | }, 36 | { 37 | fileMatch = { "lerna.json" }, 38 | url = "https://json.schemastore.org/lerna.json", 39 | }, 40 | { 41 | fileMatch = { 42 | ".stylelintrc", 43 | ".stylelintrc.json", 44 | "stylelint.config.json", 45 | }, 46 | url = "http://json.schemastore.org/stylelintrc.json", 47 | }, 48 | { 49 | fileMatch = { "/.github/workflows/*" }, 50 | url = "https://json.schemastore.org/github-workflow.json", 51 | }, 52 | }, 53 | }, 54 | }, 55 | } 56 | -------------------------------------------------------------------------------- /lua/modules/configs/completion/servers/lua_ls.lua: -------------------------------------------------------------------------------- 1 | -- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/configs/lua_ls.lua 2 | return { 3 | settings = { 4 | Lua = { 5 | runtime = { version = "LuaJIT" }, 6 | diagnostics = { 7 | globals = { "vim" }, 8 | disable = { "different-requires", "undefined-field" }, 9 | }, 10 | workspace = { 11 | library = { 12 | vim.fn.expand("$VIMRUNTIME/lua"), 13 | vim.fn.expand("$VIMRUNTIME/lua/vim/lsp"), 14 | }, 15 | maxPreload = 100000, 16 | preloadFileSize = 10000, 17 | }, 18 | hint = { enable = true, setType = true }, 19 | format = { enable = false }, 20 | telemetry = { enable = false }, 21 | -- Do not override treesitter lua highlighting with lua_ls's highlighting 22 | semantic = { enable = false }, 23 | }, 24 | }, 25 | } 26 | -------------------------------------------------------------------------------- /lua/modules/configs/completion/servers/pylsp.lua: -------------------------------------------------------------------------------- 1 | -- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/configs/pylsp.lua 2 | return { 3 | cmd = { "pylsp" }, 4 | filetypes = { "python" }, 5 | settings = { 6 | pylsp = { 7 | plugins = { 8 | -- Lint 9 | ruff = { 10 | enabled = true, 11 | select = { 12 | -- enable pycodestyle 13 | "E", 14 | -- enable pyflakes 15 | "F", 16 | }, 17 | ignore = { 18 | -- ignore E501 (line too long) 19 | -- "E501", 20 | -- ignore F401 (imported but unused) 21 | -- "F401", 22 | }, 23 | extendSelect = { "I" }, 24 | severities = { 25 | -- Hint, Information, Warning, Error 26 | F401 = "I", 27 | E501 = "I", 28 | }, 29 | }, 30 | flake8 = { enabled = false }, 31 | pyflakes = { enabled = false }, 32 | pycodestyle = { enabled = false }, 33 | mccabe = { enabled = false }, 34 | 35 | -- Code refactor 36 | rope = { enabled = true }, 37 | 38 | -- Formatting 39 | black = { enabled = true }, 40 | pyls_isort = { enabled = false }, 41 | autopep8 = { enabled = false }, 42 | yapf = { enabled = false }, 43 | }, 44 | }, 45 | }, 46 | } 47 | -------------------------------------------------------------------------------- /lua/modules/configs/completion/tabnine.lua: -------------------------------------------------------------------------------- 1 | return function() 2 | require("cmp_tabnine.config"):setup({ max_line = 1000, max_num_results = 20, sort = true }) 3 | end 4 | -------------------------------------------------------------------------------- /lua/modules/configs/completion/tiny-inline-diagnostic.lua: -------------------------------------------------------------------------------- 1 | return function() 2 | require("modules.utils").load_plugin("tiny-inline-diagnostic", { 3 | preset = "modern", 4 | options = { 5 | show_source = { 6 | enabled = true, 7 | if_many = true, 8 | }, 9 | use_icons_from_diagnostic = true, 10 | break_line = { 11 | enabled = true, 12 | }, 13 | }, 14 | }) 15 | end 16 | -------------------------------------------------------------------------------- /lua/modules/configs/editor/align.lua: -------------------------------------------------------------------------------- 1 | return function() 2 | require("modules.utils").load_plugin("mini.align", { 3 | -- Whether to disable showing non-error feedback 4 | silent = false, 5 | -- Module mappings. Use `''` (empty string) to disable one. 6 | mappings = { 7 | start = "gea", 8 | start_with_preview = "geA", 9 | }, 10 | }) 11 | end 12 | -------------------------------------------------------------------------------- /lua/modules/configs/editor/autoclose.lua: -------------------------------------------------------------------------------- 1 | return function() 2 | require("modules.utils").load_plugin("autoclose", { 3 | keys = { 4 | ["("] = { escape = false, close = true, pair = "()" }, 5 | ["["] = { escape = false, close = true, pair = "[]" }, 6 | ["{"] = { escape = false, close = true, pair = "{}" }, 7 | 8 | ["<"] = { escape = true, close = true, pair = "<>", enabled_filetypes = { "rust" } }, 9 | [">"] = { escape = true, close = false, pair = "<>" }, 10 | [")"] = { escape = true, close = false, pair = "()" }, 11 | ["]"] = { escape = true, close = false, pair = "[]" }, 12 | ["}"] = { escape = true, close = false, pair = "{}" }, 13 | 14 | ['"'] = { escape = true, close = true, pair = '""' }, 15 | ["`"] = { escape = true, close = true, pair = "``" }, 16 | ["'"] = { escape = true, close = true, pair = "''", disabled_filetypes = { "rust" } }, 17 | }, 18 | options = { 19 | disable_when_touch = false, 20 | disabled_filetypes = { 21 | "alpha", 22 | "bigfile", 23 | "checkhealth", 24 | "dap-repl", 25 | "diff", 26 | "help", 27 | "log", 28 | "notify", 29 | "NvimTree", 30 | "Outline", 31 | "qf", 32 | "TelescopePrompt", 33 | "toggleterm", 34 | "undotree", 35 | "vimwiki", 36 | }, 37 | }, 38 | }) 39 | end 40 | -------------------------------------------------------------------------------- /lua/modules/configs/editor/autotag.lua: -------------------------------------------------------------------------------- 1 | return function() 2 | require("modules.utils").load_plugin("nvim-ts-autotag", { 3 | opts = { 4 | enable_close = true, -- Auto close tags 5 | enable_rename = true, -- Auto rename pairs of tags 6 | enable_close_on_slash = false, -- Auto close on trailing ` 15 | current = true, 16 | -- for the current window, label targets closer to the cursor first 17 | distance = true, 18 | }, 19 | modes = { 20 | search = { enabled = false }, 21 | -- options used when flash is activated through 22 | -- `f`, `F`, `t`, `T`, `;` and `,` motions 23 | char = { 24 | enabled = true, 25 | -- hide after jump when not using jump labels 26 | autohide = false, 27 | -- show jump labels 28 | jump_labels = false, 29 | -- set to `false` to use the current line only 30 | multi_line = true, 31 | -- When using jump labels, don't use these keys 32 | -- This allows using those keys directly after the motion 33 | label = { exclude = "hjkliardc" }, 34 | }, 35 | }, 36 | }) 37 | end 38 | -------------------------------------------------------------------------------- /lua/modules/configs/editor/grug-far.lua: -------------------------------------------------------------------------------- 1 | return function() 2 | vim.g.maplocalleader = "," 3 | require("modules.utils").load_plugin("grug-far", { 4 | engine = "ripgrep", 5 | engines = { 6 | ripgrep = { 7 | path = "rg", 8 | showReplaceDiff = true, 9 | placeholders = { 10 | enabled = true, 11 | }, 12 | }, 13 | }, 14 | windowCreationCommand = "bot split", 15 | disableBufferLineNumbers = false, 16 | icons = { 17 | enabled = true, 18 | }, 19 | }) 20 | end 21 | -------------------------------------------------------------------------------- /lua/modules/configs/editor/highlight-colors.lua: -------------------------------------------------------------------------------- 1 | return function() 2 | require("modules.utils").load_plugin("nvim-highlight-colors", { 3 | render = "background", 4 | enable_hex = true, 5 | enable_short_hex = true, 6 | enable_rgb = true, 7 | enable_hsl = true, 8 | enable_var_usage = true, 9 | enable_named_colors = false, 10 | enable_tailwind = false, 11 | -- Exclude filetypes or buftypes from highlighting 12 | exclude_filetypes = { 13 | "alpha", 14 | "bigfile", 15 | "dap-repl", 16 | "fugitive", 17 | "git", 18 | "notify", 19 | "NvimTree", 20 | "Outline", 21 | "TelescopePrompt", 22 | "toggleterm", 23 | "undotree", 24 | }, 25 | exclude_buftypes = { 26 | "nofile", 27 | "prompt", 28 | "terminal", 29 | }, 30 | }) 31 | end 32 | -------------------------------------------------------------------------------- /lua/modules/configs/editor/hop.lua: -------------------------------------------------------------------------------- 1 | return function() 2 | require("modules.utils").load_plugin("hop", { keys = "etovxqpdygfblzhckisuran" }) 3 | end 4 | -------------------------------------------------------------------------------- /lua/modules/configs/editor/matchup.lua: -------------------------------------------------------------------------------- 1 | return function() 2 | vim.g.matchup_transmute_enabled = 1 3 | vim.g.matchup_surround_enabled = 1 4 | vim.g.matchup_matchparen_offscreen = { method = "popup" } 5 | end 6 | -------------------------------------------------------------------------------- /lua/modules/configs/editor/persisted.lua: -------------------------------------------------------------------------------- 1 | return function() 2 | require("modules.utils").load_plugin("persisted", { 3 | save_dir = vim.fn.expand(vim.fn.stdpath("data") .. "/sessions/"), 4 | autostart = true, 5 | -- Set `lazy = false` in `plugins/editor.lua` to enable this 6 | autoload = false, 7 | follow_cwd = true, 8 | use_git_branch = true, 9 | should_save = function() 10 | return vim.bo.filetype == "alpha" and false or true 11 | end, 12 | }) 13 | end 14 | -------------------------------------------------------------------------------- /lua/modules/configs/editor/rainbow_delims.lua: -------------------------------------------------------------------------------- 1 | return function() 2 | ---@param threshold number @Use global strategy if nr of lines exceeds this value 3 | local function init_strategy(threshold) 4 | return function() 5 | -- Disable on very large files 6 | local line_count = vim.api.nvim_buf_line_count(0) 7 | if line_count > 15000 then 8 | return nil 9 | end 10 | 11 | -- Disable on parser error 12 | local errors = 200 13 | vim.treesitter.get_parser():for_each_tree(function(lt) 14 | if lt:root():has_error() and errors >= 0 then 15 | errors = errors - 1 16 | end 17 | end) 18 | if errors < 0 then 19 | return nil 20 | end 21 | 22 | return line_count > threshold and require("rainbow-delimiters").strategy["global"] 23 | or require("rainbow-delimiters").strategy["local"] 24 | end 25 | end 26 | 27 | vim.g.rainbow_delimiters = { 28 | strategy = { 29 | [""] = init_strategy(500), 30 | c = init_strategy(300), 31 | cpp = init_strategy(300), 32 | lua = init_strategy(500), 33 | vimdoc = init_strategy(300), 34 | vim = init_strategy(300), 35 | }, 36 | query = { 37 | [""] = "rainbow-delimiters", 38 | latex = "rainbow-blocks", 39 | javascript = "rainbow-delimiters-react", 40 | }, 41 | highlight = { 42 | "RainbowDelimiterRed", 43 | "RainbowDelimiterOrange", 44 | "RainbowDelimiterYellow", 45 | "RainbowDelimiterGreen", 46 | "RainbowDelimiterBlue", 47 | "RainbowDelimiterCyan", 48 | "RainbowDelimiterViolet", 49 | }, 50 | } 51 | 52 | require("modules.utils").load_plugin("rainbow_delimiters", nil, true) 53 | end 54 | -------------------------------------------------------------------------------- /lua/modules/configs/editor/suda.lua: -------------------------------------------------------------------------------- 1 | return function() 2 | vim.g["suda#prompt"] = "Enter administrator password: " 3 | 4 | require("modules.utils").load_plugin("suda", nil, true) 5 | end 6 | -------------------------------------------------------------------------------- /lua/modules/configs/editor/treesitter.lua: -------------------------------------------------------------------------------- 1 | return vim.schedule_wrap(function() 2 | local use_ssh = require("core.settings").use_ssh 3 | 4 | vim.api.nvim_set_option_value("foldmethod", "expr", {}) 5 | vim.api.nvim_set_option_value("foldexpr", "nvim_treesitter#foldexpr()", {}) 6 | 7 | require("modules.utils").load_plugin("nvim-treesitter", { 8 | ensure_installed = require("core.settings").treesitter_deps, 9 | highlight = { 10 | enable = true, 11 | disable = function(ft) 12 | return vim.tbl_contains({ "gitcommit" }, ft) 13 | end, 14 | additional_vim_regex_highlighting = false, 15 | }, 16 | textobjects = { 17 | select = { 18 | enable = true, 19 | lookahead = true, 20 | keymaps = { 21 | ["af"] = "@function.outer", 22 | ["if"] = "@function.inner", 23 | ["ac"] = "@class.outer", 24 | ["ic"] = "@class.inner", 25 | }, 26 | }, 27 | move = { 28 | enable = true, 29 | set_jumps = true, 30 | goto_next_start = { 31 | ["]["] = "@function.outer", 32 | ["]m"] = "@class.outer", 33 | }, 34 | goto_next_end = { 35 | ["]]"] = "@function.outer", 36 | ["]M"] = "@class.outer", 37 | }, 38 | goto_previous_start = { 39 | ["[["] = "@function.outer", 40 | ["[m"] = "@class.outer", 41 | }, 42 | goto_previous_end = { 43 | ["[]"] = "@function.outer", 44 | ["[M"] = "@class.outer", 45 | }, 46 | }, 47 | }, 48 | indent = { enable = true }, 49 | matchup = { enable = true }, 50 | }, false, require("nvim-treesitter.configs").setup) 51 | require("nvim-treesitter.install").prefer_git = true 52 | if use_ssh then 53 | local parsers = require("nvim-treesitter.parsers").get_parser_configs() 54 | for _, parser in pairs(parsers) do 55 | parser.install_info.url = parser.install_info.url:gsub("https://github.com/", "git@github.com:") 56 | end 57 | end 58 | end) 59 | -------------------------------------------------------------------------------- /lua/modules/configs/editor/ts-context-commentstring.lua: -------------------------------------------------------------------------------- 1 | return function() 2 | vim.g.skip_ts_context_commentstring_module = true 3 | require("modules.utils").load_plugin("ts_context_commentstring", { 4 | -- Whether to update the `commentstring` on the `CursorHold` autocmd 5 | enable_autocmd = false, 6 | }) 7 | end 8 | -------------------------------------------------------------------------------- /lua/modules/configs/editor/ts-context.lua: -------------------------------------------------------------------------------- 1 | return function() 2 | require("modules.utils").load_plugin("treesitter-context", { 3 | enable = true, 4 | max_lines = 3, -- How many lines the window should span. Values <= 0 mean no limit. 5 | min_window_height = 0, -- Minimum editor window height to enable context. Values <= 0 mean no limit. 6 | line_numbers = true, 7 | multiline_threshold = 20, -- Maximum number of lines to collapse for a single context line 8 | trim_scope = "outer", -- Which context lines to discard if `max_lines` is exceeded. Choices: 'inner', 'outer' 9 | mode = "cursor", -- Line used to calculate context. Choices: 'cursor', 'topline' 10 | zindex = 50, -- Ensure compatibility with Glance's preview window 11 | }) 12 | end 13 | -------------------------------------------------------------------------------- /lua/modules/configs/lang/bqf.lua: -------------------------------------------------------------------------------- 1 | return function() 2 | require("modules.utils").load_plugin("bqf", { 3 | preview = { 4 | border = "single", 5 | wrap = true, 6 | winblend = 0, 7 | }, 8 | }) 9 | end 10 | -------------------------------------------------------------------------------- /lua/modules/configs/lang/crates-keymap.lua: -------------------------------------------------------------------------------- 1 | local bind = require("keymap.bind") 2 | local map_callback = bind.map_callback 3 | 4 | local crates = require("crates") 5 | local crates_keymap = { 6 | ["n|ct"] = map_callback(function() 7 | crates.toggle() 8 | end) 9 | :with_noremap() 10 | :with_silent() 11 | :with_buffer(0) 12 | :with_desc("crates: Toggle spec activities"), 13 | ["n|cr"] = map_callback(function() 14 | crates.reload() 15 | end) 16 | :with_noremap() 17 | :with_silent() 18 | :with_buffer(0) 19 | :with_desc("crates: Reload crate specs"), 20 | 21 | ["n|cs"] = map_callback(function() 22 | crates.show_popup() 23 | end) 24 | :with_noremap() 25 | :with_silent() 26 | :with_buffer(0) 27 | :with_desc("crates: Toggle pop-up window"), 28 | ["n|cv"] = map_callback(function() 29 | crates.show_versions_popup() 30 | crates.show_popup() 31 | end) 32 | :with_noremap() 33 | :with_silent() 34 | :with_buffer(0) 35 | :with_desc("crates: Select spec versions"), 36 | ["n|cf"] = map_callback(function() 37 | crates.show_features_popup() 38 | crates.show_popup() 39 | end) 40 | :with_noremap() 41 | :with_silent() 42 | :with_buffer(0) 43 | :with_desc("crates: Select spec features"), 44 | ["n|cd"] = map_callback(function() 45 | crates.show_dependencies_popup() 46 | crates.show_popup() 47 | end) 48 | :with_noremap() 49 | :with_silent() 50 | :with_buffer(0) 51 | :with_desc("crates: Show project dependencies"), 52 | 53 | ["n|cu"] = map_callback(function() 54 | crates.update_crate() 55 | end) 56 | :with_noremap() 57 | :with_silent() 58 | :with_buffer(0) 59 | :with_desc("crates: Update current crate's spec"), 60 | ["v|cu"] = map_callback(function() 61 | crates.update_crates() 62 | end) 63 | :with_noremap() 64 | :with_silent() 65 | :with_buffer(0) 66 | :with_desc("crates: Update selected crate's spec"), 67 | ["n|ca"] = map_callback(function() 68 | crates.update_all_crates() 69 | end) 70 | :with_noremap() 71 | :with_silent() 72 | :with_buffer(0) 73 | :with_desc("crates: Update all crates' specs"), 74 | ["n|cU"] = map_callback(function() 75 | crates.upgrade_crate() 76 | end) 77 | :with_noremap() 78 | :with_silent() 79 | :with_buffer(0) 80 | :with_desc("crates: Upgrade current crate"), 81 | ["v|cU"] = map_callback(function() 82 | crates.upgrade_crates() 83 | end) 84 | :with_noremap() 85 | :with_silent() 86 | :with_buffer(0) 87 | :with_desc("crates: Upgrade selected crates"), 88 | ["n|cA"] = map_callback(function() 89 | crates.upgrade_all_crates() 90 | end) 91 | :with_noremap() 92 | :with_silent() 93 | :with_buffer(0) 94 | :with_desc("crates: Upgrade all crates"), 95 | 96 | ["n|cH"] = map_callback(function() 97 | crates.open_homepage() 98 | end) 99 | :with_noremap() 100 | :with_silent() 101 | :with_buffer(0) 102 | :with_desc("crates: Open current crate's homepage"), 103 | ["n|cR"] = map_callback(function() 104 | crates.open_repository() 105 | end) 106 | :with_noremap() 107 | :with_silent() 108 | :with_buffer(0) 109 | :with_desc("crates: Open current crate's repository"), 110 | ["n|cD"] = map_callback(function() 111 | crates.open_documentation() 112 | end) 113 | :with_noremap() 114 | :with_silent() 115 | :with_buffer(0) 116 | :with_desc("crates: Open current crate's documentation"), 117 | ["n|cC"] = map_callback(function() 118 | crates.open_crates_io() 119 | end) 120 | :with_noremap() 121 | :with_silent() 122 | :with_buffer(0) 123 | :with_desc("crates: Browse current crate on crates.io"), 124 | } 125 | 126 | bind.nvim_load_mapping(crates_keymap) 127 | -------------------------------------------------------------------------------- /lua/modules/configs/lang/crates.lua: -------------------------------------------------------------------------------- 1 | return function() 2 | local icons = { 3 | diagnostics = require("modules.utils.icons").get("diagnostics", true), 4 | git = require("modules.utils.icons").get("git", true), 5 | misc = require("modules.utils.icons").get("misc", true), 6 | ui = require("modules.utils.icons").get("ui", true), 7 | kind = require("modules.utils.icons").get("kind", true), 8 | } 9 | 10 | require("modules.utils").load_plugin("crates", { 11 | smart_insert = true, 12 | insert_closing_quote = true, 13 | autoload = true, 14 | autoupdate = true, 15 | autoupdate_throttle = 250, 16 | loading_indicator = true, 17 | date_format = "%Y-%m-%d", 18 | thousands_separator = ",", 19 | notification_title = "Crates", 20 | curl_args = { "-sL", "--retry", "1" }, 21 | text = { 22 | loading = " " .. icons.misc.Watch .. "Loading", 23 | version = " " .. icons.ui.Check .. "%s", 24 | prerelease = " " .. icons.diagnostics.Warning_alt .. "%s", 25 | yanked = " " .. icons.diagnostics.Error .. "%s", 26 | nomatch = " " .. icons.diagnostics.Question .. "No match", 27 | upgrade = " " .. icons.diagnostics.Hint_alt .. "%s", 28 | error = " " .. icons.diagnostics.Error .. "Error fetching crate", 29 | }, 30 | popup = { 31 | autofocus = false, 32 | hide_on_select = true, 33 | copy_register = '"', 34 | style = "minimal", 35 | border = "rounded", 36 | show_version_date = true, 37 | show_dependency_version = true, 38 | max_height = 30, 39 | min_width = 20, 40 | padding = 1, 41 | text = { 42 | title = icons.ui.Package .. "%s", 43 | description = "%s", 44 | created_label = icons.misc.Added .. "created" .. " ", 45 | created = "%s", 46 | updated_label = icons.misc.ManUp .. "updated" .. " ", 47 | updated = "%s", 48 | downloads_label = icons.ui.CloudDownload .. "downloads ", 49 | downloads = "%s", 50 | homepage_label = icons.misc.Campass .. "homepage ", 51 | homepage = "%s", 52 | repository_label = icons.git.Repo .. "repository ", 53 | repository = "%s", 54 | documentation_label = icons.diagnostics.Information_alt .. "documentation ", 55 | documentation = "%s", 56 | crates_io_label = icons.ui.Package .. "crates.io ", 57 | crates_io = "%s", 58 | categories_label = icons.kind.Class .. "categories ", 59 | keywords_label = icons.kind.Keyword .. "keywords ", 60 | version = " %s", 61 | prerelease = icons.diagnostics.Warning_alt .. "%s prerelease", 62 | yanked = icons.diagnostics.Error .. "%s yanked", 63 | version_date = " %s", 64 | feature = " %s", 65 | enabled = icons.ui.Play .. "%s", 66 | transitive = icons.ui.List .. "%s", 67 | normal_dependencies_title = icons.kind.Interface .. "Dependencies", 68 | build_dependencies_title = icons.misc.Gavel .. "Build dependencies", 69 | dev_dependencies_title = icons.misc.Glass .. "Dev dependencies", 70 | dependency = " %s", 71 | optional = icons.ui.BigUnfilledCircle .. "%s", 72 | dependency_version = " %s", 73 | loading = " " .. icons.misc.Watch, 74 | }, 75 | }, 76 | completion = { 77 | insert_closing_quote = true, 78 | text = { 79 | prerelease = " " .. icons.diagnostics.Warning_alt .. "pre-release ", 80 | yanked = " " .. icons.diagnostics.Error_alt .. "yanked ", 81 | }, 82 | }, 83 | }) 84 | 85 | -- Set buffer-local keymaps 86 | require("lang.crates-keymap") 87 | end 88 | -------------------------------------------------------------------------------- /lua/modules/configs/lang/go.lua: -------------------------------------------------------------------------------- 1 | return function() 2 | require("modules.utils").load_plugin("go", { 3 | -- By default, we've turned off these options to prevent clashes with our gopls config 4 | icons = false, 5 | diagnostic = false, 6 | lsp_cfg = false, 7 | lsp_gofumpt = false, 8 | lsp_keymaps = false, 9 | lsp_codelens = false, 10 | lsp_document_formatting = false, 11 | lsp_inlay_hints = { enable = false }, 12 | -- DAP-related settings are also turned off here for the same reason 13 | dap_debug = false, 14 | dap_debug_keymap = false, 15 | textobjects = false, 16 | -- Miscellaneous options to seamlessly integrate with other plugins 17 | trouble = true, 18 | luasnip = false, 19 | run_in_floaterm = false, 20 | }) 21 | end 22 | -------------------------------------------------------------------------------- /lua/modules/configs/lang/render-markdown.lua: -------------------------------------------------------------------------------- 1 | return function() 2 | require("modules.utils").load_plugin("render-markdown", { 3 | -- Whether Markdown should be rendered by default or not 4 | enabled = true, 5 | -- Maximum file size (in MB) that this plugin will attempt to render 6 | -- Any file larger than this will effectively be ignored 7 | max_file_size = 2.0, 8 | -- Milliseconds that must pass before updating marks, updates occur 9 | -- within the context of the visible window, not the entire buffer 10 | debounce = 100, 11 | -- Vim modes that will show a rendered view of the markdown file 12 | -- All other modes will be uneffected by this plugin 13 | render_modes = { "n", "c", "t" }, 14 | -- This enables hiding any added text on the line the cursor is on 15 | -- This does have a performance penalty as we must listen to the 'CursorMoved' event 16 | anti_conceal = { enabled = true }, 17 | -- The level of logs to write to file: vim.fn.stdpath('state') .. '/render-markdown.log' 18 | -- Only intended to be used for plugin development / debugging 19 | log_level = "error", 20 | }) 21 | end 22 | -------------------------------------------------------------------------------- /lua/modules/configs/lang/rust.lua: -------------------------------------------------------------------------------- 1 | return function() 2 | vim.g.rustaceanvim = { 3 | -- Disable automatic DAP configuration to avoid conflicts with previous user configs 4 | dap = { 5 | adapter = false, 6 | configuration = false, 7 | autoload_configurations = false, 8 | }, 9 | } 10 | 11 | require("modules.utils").load_plugin("rustaceanvim", nil, true) 12 | end 13 | -------------------------------------------------------------------------------- /lua/modules/configs/tool/dap/clients/codelldb.lua: -------------------------------------------------------------------------------- 1 | -- https://github.com/mfussenegger/nvim-dap/wiki/C-C---Rust-(via--codelldb) 2 | return function() 3 | local dap = require("dap") 4 | local utils = require("modules.utils.dap") 5 | local is_windows = require("core.global").is_windows 6 | 7 | dap.adapters.codelldb = { 8 | type = "server", 9 | port = "${port}", 10 | executable = { 11 | command = vim.fn.exepath("codelldb"), -- Find codelldb on $PATH 12 | args = { "--port", "${port}" }, 13 | detached = is_windows and false or true, 14 | }, 15 | } 16 | dap.configurations.c = { 17 | { 18 | name = "Debug", 19 | type = "codelldb", 20 | request = "launch", 21 | program = utils.input_exec_path(), 22 | cwd = "${workspaceFolder}", 23 | stopOnEntry = false, 24 | terminal = "integrated", 25 | }, 26 | { 27 | name = "Debug (with args)", 28 | type = "codelldb", 29 | request = "launch", 30 | program = utils.input_exec_path(), 31 | args = utils.input_args(), 32 | cwd = "${workspaceFolder}", 33 | stopOnEntry = false, 34 | terminal = "integrated", 35 | }, 36 | { 37 | name = "Attach to a running process", 38 | type = "codelldb", 39 | request = "attach", 40 | program = utils.input_exec_path(), 41 | stopOnEntry = false, 42 | waitFor = true, 43 | }, 44 | } 45 | dap.configurations.cpp = dap.configurations.c 46 | dap.configurations.rust = dap.configurations.c 47 | end 48 | -------------------------------------------------------------------------------- /lua/modules/configs/tool/dap/clients/delve.lua: -------------------------------------------------------------------------------- 1 | -- https://github.com/mfussenegger/nvim-dap/wiki/Debug-Adapter-installation#go 2 | -- https://github.com/golang/vscode-go/blob/master/docs/debugging.md 3 | return function() 4 | local dap = require("dap") 5 | local utils = require("modules.utils.dap") 6 | 7 | if not require("mason-registry").is_installed("go-debug-adapter") then 8 | vim.notify( 9 | "Automatically installing `go-debug-adapter` for go debugging", 10 | vim.log.levels.INFO, 11 | { title = "nvim-dap" } 12 | ) 13 | 14 | local go_dbg = require("mason-registry").get_package("go-debug-adapter") 15 | go_dbg:install():once( 16 | "closed", 17 | vim.schedule_wrap(function() 18 | if go_dbg:is_installed() then 19 | vim.notify("Successfully installed `go-debug-adapter`", vim.log.levels.INFO, { title = "nvim-dap" }) 20 | end 21 | end) 22 | ) 23 | end 24 | 25 | dap.adapters.go = { 26 | type = "executable", 27 | command = "node", 28 | args = { 29 | require("mason-registry").get_package("go-debug-adapter"):get_install_path() 30 | .. "/extension/dist/debugAdapter.js", 31 | }, 32 | } 33 | dap.configurations.go = { 34 | { 35 | type = "go", 36 | name = "Debug (file)", 37 | request = "launch", 38 | cwd = "${workspaceFolder}", 39 | program = utils.input_file_path(), 40 | console = "integratedTerminal", 41 | dlvToolPath = vim.fn.exepath("dlv"), 42 | showLog = true, 43 | showRegisters = true, 44 | stopOnEntry = false, 45 | }, 46 | { 47 | type = "go", 48 | name = "Debug (file with args)", 49 | request = "launch", 50 | cwd = "${workspaceFolder}", 51 | program = utils.input_file_path(), 52 | args = utils.input_args(), 53 | console = "integratedTerminal", 54 | dlvToolPath = vim.fn.exepath("dlv"), 55 | showLog = true, 56 | showRegisters = true, 57 | stopOnEntry = false, 58 | }, 59 | { 60 | type = "go", 61 | name = "Debug (executable)", 62 | request = "launch", 63 | cwd = "${workspaceFolder}", 64 | program = utils.input_exec_path(), 65 | args = utils.input_args(), 66 | console = "integratedTerminal", 67 | dlvToolPath = vim.fn.exepath("dlv"), 68 | mode = "exec", 69 | showLog = true, 70 | showRegisters = true, 71 | stopOnEntry = false, 72 | }, 73 | { 74 | type = "go", 75 | name = "Debug (test file)", 76 | request = "launch", 77 | cwd = "${workspaceFolder}", 78 | program = utils.input_file_path(), 79 | console = "integratedTerminal", 80 | dlvToolPath = vim.fn.exepath("dlv"), 81 | mode = "test", 82 | showLog = true, 83 | showRegisters = true, 84 | stopOnEntry = false, 85 | }, 86 | { 87 | type = "go", 88 | name = "Debug (using go.mod)", 89 | request = "launch", 90 | cwd = "${workspaceFolder}", 91 | program = "./${relativeFileDirname}", 92 | console = "integratedTerminal", 93 | dlvToolPath = vim.fn.exepath("dlv"), 94 | mode = "test", 95 | showLog = true, 96 | showRegisters = true, 97 | stopOnEntry = false, 98 | }, 99 | } 100 | end 101 | -------------------------------------------------------------------------------- /lua/modules/configs/tool/dap/clients/lldb.lua: -------------------------------------------------------------------------------- 1 | -- https://github.com/mfussenegger/nvim-dap/wiki/Debug-Adapter-installation#ccrust-via-lldb-vscode 2 | return function() 3 | local dap = require("dap") 4 | local utils = require("modules.utils.dap") 5 | 6 | dap.adapters.lldb = { 7 | type = "executable", 8 | command = vim.fn.exepath("lldb-vscode"), -- Find lldb-vscode on $PATH 9 | } 10 | dap.configurations.c = { 11 | { 12 | name = "Launch", 13 | type = "lldb", 14 | request = "launch", 15 | program = utils.input_exec_path(), 16 | cwd = "${workspaceFolder}", 17 | args = utils.input_args(), 18 | env = utils.get_env(), 19 | 20 | -- if you change `runInTerminal` to true, you might need to change the yama/ptrace_scope setting: 21 | -- 22 | -- echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope 23 | -- 24 | -- Otherwise you might get the following error: 25 | -- 26 | -- Error on launch: Failed to attach to the target process 27 | -- 28 | -- But you should be aware of the implications: 29 | -- https://www.kernel.org/doc/html/latest/admin-guide/LSM/Yama.html 30 | runInTerminal = false, 31 | }, 32 | } 33 | 34 | dap.configurations.cpp = dap.configurations.c 35 | dap.configurations.rust = dap.configurations.c 36 | end 37 | -------------------------------------------------------------------------------- /lua/modules/configs/tool/dap/clients/python.lua: -------------------------------------------------------------------------------- 1 | -- https://github.com/mfussenegger/nvim-dap/wiki/Debug-Adapter-installation#python 2 | -- https://github.com/microsoft/debugpy/wiki/Debug-configuration-settings 3 | return function() 4 | local dap = require("dap") 5 | local utils = require("modules.utils.dap") 6 | local is_windows = require("core.global").is_windows 7 | local debugpy_root = require("mason-registry").get_package("debugpy"):get_install_path() 8 | 9 | dap.adapters.python = function(callback, config) 10 | if config.request == "attach" then 11 | local port = (config.connect or config).port 12 | local host = (config.connect or config).host or "127.0.0.1" 13 | callback({ 14 | type = "server", 15 | port = assert(port, "`connect.port` is required for a python `attach` configuration"), 16 | host = host, 17 | options = { source_filetype = "python" }, 18 | }) 19 | else 20 | callback({ 21 | type = "executable", 22 | command = is_windows and debugpy_root .. "/venv/Scripts/pythonw.exe" 23 | or debugpy_root .. "/venv/bin/python", 24 | args = { "-m", "debugpy.adapter" }, 25 | options = { source_filetype = "python" }, 26 | }) 27 | end 28 | end 29 | dap.configurations.python = { 30 | { 31 | -- The first three options are required by nvim-dap 32 | type = "python", -- the type here established the link to the adapter definition: `dap.adapters.python` 33 | request = "launch", 34 | name = "Debug", 35 | -- Options below are for debugpy, see https://github.com/microsoft/debugpy/wiki/Debug-configuration-settings for supported options 36 | console = "integratedTerminal", 37 | program = utils.input_file_path(), 38 | pythonPath = function() 39 | local venv = vim.env.CONDA_PREFIX 40 | if venv then 41 | return is_windows and venv .. "/Scripts/pythonw.exe" or venv .. "/bin/python" 42 | else 43 | return is_windows and "pythonw.exe" or "python3" 44 | end 45 | end, 46 | }, 47 | { 48 | -- NOTE: This setting is for people using venv 49 | type = "python", 50 | request = "launch", 51 | name = "Debug (using venv)", 52 | -- Options below are for debugpy, see https://github.com/microsoft/debugpy/wiki/Debug-configuration-settings for supported options 53 | console = "integratedTerminal", 54 | program = utils.input_file_path(), 55 | pythonPath = function() 56 | -- Prefer the venv that is defined by the designated environment variable. 57 | local cwd, venv = vim.fn.getcwd(), os.getenv("VIRTUAL_ENV") 58 | local python = venv and (is_windows and venv .. "/Scripts/pythonw.exe" or venv .. "/bin/python") or "" 59 | if vim.fn.executable(python) == 1 then 60 | return python 61 | end 62 | 63 | -- Otherwise, fall back to check if there are any local venvs available. 64 | venv = vim.fn.isdirectory(cwd .. "/venv") == 1 and cwd .. "/venv" or cwd .. "/.venv" 65 | python = is_windows and venv .. "/Scripts/pythonw.exe" or venv .. "/bin/python" 66 | if vim.fn.executable(python) == 1 then 67 | return python 68 | else 69 | return is_windows and "pythonw.exe" or "python3" 70 | end 71 | end, 72 | }, 73 | } 74 | end 75 | -------------------------------------------------------------------------------- /lua/modules/configs/tool/dap/dap-keymap.lua: -------------------------------------------------------------------------------- 1 | local M = {} 2 | 3 | local bind = require("keymap.bind") 4 | local map_cmd = bind.map_cmd 5 | 6 | local did_load_debug_mappings = false 7 | local debug_keymap = { 8 | ["nv|K"] = map_cmd("lua require('dapui').eval()") 9 | :with_noremap() 10 | :with_nowait() 11 | :with_desc("Evaluate expression under cursor"), 12 | } 13 | 14 | function M.load_extras() 15 | if not did_load_debug_mappings then 16 | require("modules.utils.keymap").amend("Debugging", "_debugging", debug_keymap) 17 | did_load_debug_mappings = true 18 | end 19 | end 20 | 21 | return M 22 | -------------------------------------------------------------------------------- /lua/modules/configs/tool/dap/dapui.lua: -------------------------------------------------------------------------------- 1 | return function() 2 | local icons = { 3 | ui = require("modules.utils.icons").get("ui"), 4 | dap = require("modules.utils.icons").get("dap"), 5 | } 6 | 7 | require("modules.utils").load_plugin("dapui", { 8 | force_buffers = true, 9 | icons = { 10 | expanded = icons.ui.ArrowOpen, 11 | collapsed = icons.ui.ArrowClosed, 12 | current_frame = icons.ui.Indicator, 13 | }, 14 | mappings = { 15 | -- Use a table to apply multiple mappings 16 | edit = "e", 17 | expand = { "", "<2-LeftMouse>" }, 18 | open = "o", 19 | remove = "d", 20 | repl = "r", 21 | toggle = "t", 22 | }, 23 | layouts = { 24 | { 25 | elements = { 26 | -- Provide as ID strings or tables with "id" and "size" keys 27 | { 28 | id = "scopes", 29 | size = 0.3, -- Can be float or integer > 1 30 | }, 31 | { id = "watches", size = 0.3 }, 32 | { id = "stacks", size = 0.3 }, 33 | { id = "breakpoints", size = 0.1 }, 34 | }, 35 | size = 0.3, 36 | position = "right", 37 | }, 38 | { 39 | elements = { 40 | { id = "console", size = 0.55 }, 41 | { id = "repl", size = 0.45 }, 42 | }, 43 | position = "bottom", 44 | size = 0.25, 45 | }, 46 | }, 47 | controls = { 48 | enabled = true, 49 | -- Display controls in this session 50 | element = "repl", 51 | icons = { 52 | pause = icons.dap.Pause, 53 | play = icons.dap.Play, 54 | step_into = icons.dap.StepInto, 55 | step_over = icons.dap.StepOver, 56 | step_out = icons.dap.StepOut, 57 | step_back = icons.dap.StepBack, 58 | run_last = icons.dap.RunLast, 59 | terminate = icons.dap.Terminate, 60 | }, 61 | }, 62 | floating = { 63 | max_height = nil, -- These can be integers or a float between 0 and 1. 64 | max_width = nil, -- Floats will be treated as percentage of your screen. 65 | border = "single", -- Border style. Can be "single", "double" or "rounded" 66 | mappings = { 67 | close = { "q", "" }, 68 | }, 69 | }, 70 | render = { indent = 1, max_value_lines = 85 }, 71 | }) 72 | end 73 | -------------------------------------------------------------------------------- /lua/modules/configs/tool/dap/init.lua: -------------------------------------------------------------------------------- 1 | return function() 2 | local dap = require("dap") 3 | local dapui = require("dapui") 4 | local mason_dap = require("mason-nvim-dap") 5 | 6 | local icons = { dap = require("modules.utils.icons").get("dap") } 7 | local colors = require("modules.utils").get_palette() 8 | local mappings = require("tool.dap.dap-keymap") 9 | 10 | -- Initialize debug hooks 11 | _G._debugging = false 12 | local function debug_init_cb() 13 | _G._debugging = true 14 | mappings.load_extras() 15 | dapui.open({ reset = true }) 16 | end 17 | local function debug_terminate_cb() 18 | if _debugging then 19 | _G._debugging = false 20 | dapui.close() 21 | end 22 | end 23 | dap.listeners.after.event_initialized["dapui_config"] = debug_init_cb 24 | dap.listeners.before.event_terminated["dapui_config"] = debug_terminate_cb 25 | dap.listeners.before.event_exited["dapui_config"] = debug_terminate_cb 26 | dap.listeners.before.disconnect["dapui_config"] = debug_terminate_cb 27 | 28 | -- We need to override nvim-dap's default highlight groups, AFTER requiring nvim-dap for catppuccin. 29 | vim.api.nvim_set_hl(0, "DapStopped", { fg = colors.green }) 30 | 31 | vim.fn.sign_define( 32 | "DapBreakpoint", 33 | { text = icons.dap.Breakpoint, texthl = "DapBreakpoint", linehl = "", numhl = "" } 34 | ) 35 | vim.fn.sign_define( 36 | "DapBreakpointCondition", 37 | { text = icons.dap.BreakpointCondition, texthl = "DapBreakpoint", linehl = "", numhl = "" } 38 | ) 39 | vim.fn.sign_define("DapStopped", { text = icons.dap.Stopped, texthl = "DapStopped", linehl = "", numhl = "" }) 40 | vim.fn.sign_define( 41 | "DapBreakpointRejected", 42 | { text = icons.dap.BreakpointRejected, texthl = "DapBreakpoint", linehl = "", numhl = "" } 43 | ) 44 | vim.fn.sign_define("DapLogPoint", { text = icons.dap.LogPoint, texthl = "DapLogPoint", linehl = "", numhl = "" }) 45 | 46 | ---A handler to setup all clients defined under `tool/dap/clients/*.lua` 47 | ---@param config table 48 | local function mason_dap_handler(config) 49 | local dap_name = config.name 50 | local ok, custom_handler = pcall(require, "user.configs.dap-clients." .. dap_name) 51 | if not ok then 52 | -- Use preset if there is no user definition 53 | ok, custom_handler = pcall(require, "tool.dap.clients." .. dap_name) 54 | end 55 | if not ok then 56 | -- Default to use factory config for clients(s) that doesn't include a spec 57 | mason_dap.default_setup(config) 58 | return 59 | elseif type(custom_handler) == "function" then 60 | -- Case where the protocol requires its own setup 61 | -- Make sure to set 62 | -- * dap.adpaters. = { your config } 63 | -- * dap.configurations. = { your config } 64 | -- See `codelldb.lua` for a concrete example. 65 | custom_handler(config) 66 | else 67 | vim.notify( 68 | string.format( 69 | "Failed to setup [%s].\n\nClient definition under `tool/dap/clients` must return\na fun(opts) (got '%s' instead)", 70 | config.name, 71 | type(custom_handler) 72 | ), 73 | vim.log.levels.ERROR, 74 | { title = "nvim-dap" } 75 | ) 76 | end 77 | end 78 | 79 | require("modules.utils").load_plugin("mason-nvim-dap", { 80 | ensure_installed = require("core.settings").dap_deps, 81 | automatic_installation = true, 82 | handlers = { mason_dap_handler }, 83 | }) 84 | end 85 | -------------------------------------------------------------------------------- /lua/modules/configs/tool/dropbar.lua: -------------------------------------------------------------------------------- 1 | return function() 2 | local icons = { 3 | kind = require("modules.utils.icons").get("kind", true), 4 | type = require("modules.utils.icons").get("type", true), 5 | misc = require("modules.utils.icons").get("misc", true), 6 | ui = require("modules.utils.icons").get("ui", true), 7 | } 8 | local utils = require("dropbar.utils") 9 | local sources = require("dropbar.sources") 10 | -- Custom source to display only the leaf filename in the dropbar 11 | sources.symbols = { 12 | get_symbols = function(buf, win, cursor) 13 | local symbols = sources.path.get_symbols(buf, win, cursor) 14 | return { symbols[#symbols] } 15 | end, 16 | } 17 | 18 | require("modules.utils").load_plugin("dropbar", { 19 | bar = { 20 | hover = false, 21 | truncate = true, 22 | pick = { pivots = "etovxqpdygfblzhckisuran" }, 23 | sources = function(buf) 24 | if vim.bo[buf].ft == "markdown" then 25 | return { 26 | sources.symbols, 27 | sources.markdown, 28 | } 29 | end 30 | if vim.bo[buf].buftype == "terminal" then 31 | return { 32 | sources.terminal, 33 | } 34 | end 35 | return { 36 | sources.symbols, 37 | utils.source.fallback({ 38 | sources.lsp, 39 | sources.treesitter, 40 | }), 41 | } 42 | end, 43 | }, 44 | sources = { 45 | terminal = { 46 | name = function(buf) 47 | local name = vim.api.nvim_buf_get_name(buf) 48 | local term = select(2, require("toggleterm.terminal").identify(name)) 49 | -- Trying to "snag" a display name from toggleterm 50 | if term then 51 | return term.display_name or term.name 52 | else 53 | return name 54 | end 55 | end, 56 | }, 57 | }, 58 | icons = { 59 | enable = true, 60 | kinds = { 61 | symbols = { 62 | -- Type 63 | Array = icons.type.Array, 64 | Boolean = icons.type.Boolean, 65 | Null = icons.type.Null, 66 | Number = icons.type.Number, 67 | Object = icons.type.Object, 68 | String = icons.type.String, 69 | Text = icons.type.String, 70 | 71 | -- Kind 72 | BreakStatement = icons.kind.Break, 73 | Call = icons.kind.Call, 74 | CaseStatement = icons.kind.Case, 75 | Class = icons.kind.Class, 76 | Color = icons.kind.Color, 77 | Constant = icons.kind.Constant, 78 | Constructor = icons.kind.Constructor, 79 | ContinueStatement = icons.kind.Continue, 80 | Declaration = icons.kind.Declaration, 81 | Delete = icons.kind.Delete, 82 | DoStatement = icons.kind.Loop, 83 | Enum = icons.kind.Enum, 84 | EnumMember = icons.kind.EnumMember, 85 | Event = icons.kind.Event, 86 | Field = icons.kind.Field, 87 | File = icons.kind.File, 88 | ForStatement = icons.kind.Loop, 89 | Function = icons.kind.Function, 90 | Identifier = icons.kind.Variable, 91 | Interface = icons.kind.Interface, 92 | Keyword = icons.kind.Keyword, 93 | List = icons.kind.List, 94 | Lsp = icons.misc.LspAvailable, 95 | Method = icons.kind.Method, 96 | Module = icons.kind.Module, 97 | Namespace = icons.kind.Namespace, 98 | Operator = icons.kind.Operator, 99 | Package = icons.kind.Package, 100 | Pair = icons.kind.List, 101 | Property = icons.kind.Property, 102 | Reference = icons.kind.Reference, 103 | Regex = icons.kind.Regex, 104 | Repeat = icons.kind.Loop, 105 | Scope = icons.kind.Statement, 106 | Snippet = icons.kind.Snippet, 107 | Statement = icons.kind.Statement, 108 | Struct = icons.kind.Struct, 109 | SwitchStatement = icons.kind.Switch, 110 | Type = icons.kind.Interface, 111 | TypeParameter = icons.kind.TypeParameter, 112 | Unit = icons.kind.Unit, 113 | Value = icons.kind.Value, 114 | Variable = icons.kind.Variable, 115 | WhileStatement = icons.kind.Loop, 116 | 117 | -- Microsoft-specific icons 118 | Folder = icons.kind.Folder, 119 | 120 | -- ccls-specific icons 121 | Macro = icons.kind.Macro, 122 | Terminal = icons.kind.Terminal, 123 | }, 124 | }, 125 | ui = { 126 | bar = { separator = "  " }, 127 | menu = { indicator = icons.ui.ArrowClosed }, 128 | }, 129 | }, 130 | }) 131 | end 132 | -------------------------------------------------------------------------------- /lua/modules/configs/tool/fcitx5.lua: -------------------------------------------------------------------------------- 1 | return function() 2 | require("modules.utils").load_plugin("fcitx5", { 3 | msg = nil, -- string | nil: printed when startup is completed 4 | imname = { -- fcitx5.Imname | nil: imnames on each mode set as prior. See `:h map-table` for more in-depth information. 5 | norm = nil, -- string | nil: imname to set in normal mode. if nil, will restore the mode on exit. 6 | ins = nil, 7 | cmd = nil, 8 | vis = nil, 9 | sel = nil, 10 | opr = nil, 11 | term = nil, 12 | lang = nil, 13 | }, 14 | remember_prior = true, -- boolean: if true, it remembers the mode on exit and restore it when entering the mode again. 15 | -- if false, uses what was set in config. 16 | define_autocmd = true, -- boolean: if true, defines autocmd at `ModeChanged` to switch fcitx5 mode. 17 | log = "warn", -- string: log level (default: warn) 18 | }) 19 | end 20 | -------------------------------------------------------------------------------- /lua/modules/configs/tool/fzf-lua.lua: -------------------------------------------------------------------------------- 1 | return function() 2 | local icons = { ui = require("modules.utils.icons").get("ui", true) } 3 | 4 | require("modules.utils").load_plugin("fzf-lua", { 5 | { "telescope" }, 6 | defaults = { 7 | prompt = icons.ui.Telescope .. " ", 8 | }, 9 | }) 10 | end 11 | -------------------------------------------------------------------------------- /lua/modules/configs/tool/nvim-tree.lua: -------------------------------------------------------------------------------- 1 | return function() 2 | local icons = { 3 | diagnostics = require("modules.utils.icons").get("diagnostics"), 4 | documents = require("modules.utils.icons").get("documents"), 5 | git = require("modules.utils.icons").get("git"), 6 | ui = require("modules.utils.icons").get("ui"), 7 | } 8 | 9 | require("modules.utils").load_plugin("nvim-tree", { 10 | auto_reload_on_write = true, 11 | create_in_closed_folder = false, 12 | disable_netrw = false, 13 | hijack_cursor = true, 14 | hijack_netrw = true, 15 | hijack_unnamed_buffer_when_opening = true, 16 | open_on_tab = false, 17 | respect_buf_cwd = false, 18 | sort_by = "name", 19 | sync_root_with_cwd = true, 20 | on_attach = function(bufnr) 21 | require("nvim-tree.api").config.mappings.default_on_attach(bufnr) 22 | vim.keymap.del("n", "", { buffer = bufnr }) 23 | end, 24 | view = { 25 | adaptive_size = false, 26 | centralize_selection = false, 27 | width = 30, 28 | side = "left", 29 | preserve_window_proportions = false, 30 | number = false, 31 | relativenumber = false, 32 | signcolumn = "yes", 33 | float = { 34 | enable = false, 35 | open_win_config = { 36 | relative = "editor", 37 | border = "rounded", 38 | width = 30, 39 | height = 30, 40 | row = 1, 41 | col = 1, 42 | }, 43 | }, 44 | }, 45 | renderer = { 46 | add_trailing = false, 47 | group_empty = true, 48 | highlight_git = true, 49 | full_name = false, 50 | highlight_opened_files = "none", 51 | special_files = { "Cargo.toml", "Makefile", "README.md", "readme.md", "CMakeLists.txt" }, 52 | symlink_destination = true, 53 | indent_markers = { 54 | enable = true, 55 | icons = { 56 | corner = "└ ", 57 | edge = "│ ", 58 | item = "│ ", 59 | none = " ", 60 | }, 61 | }, 62 | root_folder_label = ":.:s?.*?/..?", 63 | icons = { 64 | webdev_colors = true, 65 | git_placement = "after", 66 | show = { 67 | file = true, 68 | folder = true, 69 | folder_arrow = true, 70 | git = true, 71 | }, 72 | padding = " ", 73 | symlink_arrow = " 󰁔 ", 74 | glyphs = { 75 | default = icons.documents.Default, -- 76 | symlink = icons.documents.Symlink, -- 77 | bookmark = icons.ui.Bookmark, 78 | git = { 79 | unstaged = icons.git.Mod_alt, 80 | staged = icons.git.Add, --󰄬 81 | unmerged = icons.git.Unmerged, 82 | renamed = icons.git.Rename, --󰁔 83 | untracked = icons.git.Untracked, -- "󰞋" 84 | deleted = icons.git.Remove, -- 85 | ignored = icons.git.Ignore, --◌ 86 | }, 87 | folder = { 88 | arrow_open = icons.ui.ArrowOpen, 89 | arrow_closed = icons.ui.ArrowClosed, 90 | -- arrow_open = "", 91 | -- arrow_closed = "", 92 | default = icons.ui.Folder, 93 | open = icons.ui.FolderOpen, 94 | empty = icons.ui.EmptyFolder, 95 | empty_open = icons.ui.EmptyFolderOpen, 96 | symlink = icons.ui.SymlinkFolder, 97 | symlink_open = icons.ui.FolderOpen, 98 | }, 99 | }, 100 | }, 101 | }, 102 | hijack_directories = { 103 | enable = true, 104 | auto_open = true, 105 | }, 106 | update_focused_file = { 107 | enable = true, 108 | update_root = true, 109 | ignore_list = {}, 110 | }, 111 | filters = { 112 | dotfiles = false, 113 | custom = { ".DS_Store" }, 114 | exclude = {}, 115 | }, 116 | actions = { 117 | use_system_clipboard = true, 118 | change_dir = { 119 | enable = true, 120 | global = false, 121 | }, 122 | open_file = { 123 | quit_on_open = false, 124 | resize_window = false, 125 | window_picker = { 126 | enable = true, 127 | chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890", 128 | exclude = { 129 | buftype = { 130 | "help", 131 | "nofile", 132 | "prompt", 133 | "quickfix", 134 | "terminal", 135 | }, 136 | filetype = { 137 | "dap-repl", 138 | "diff", 139 | "fugitive", 140 | "fugitiveblame", 141 | "git", 142 | "notify", 143 | "NvimTree", 144 | "Outline", 145 | "qf", 146 | "TelescopePrompt", 147 | "toggleterm", 148 | "undotree", 149 | }, 150 | }, 151 | }, 152 | }, 153 | remove_file = { 154 | close_window = true, 155 | }, 156 | }, 157 | diagnostics = { 158 | enable = false, 159 | show_on_dirs = false, 160 | debounce_delay = 50, 161 | icons = { 162 | hint = icons.diagnostics.Hint_alt, 163 | info = icons.diagnostics.Information_alt, 164 | warning = icons.diagnostics.Warning_alt, 165 | error = icons.diagnostics.Error_alt, 166 | }, 167 | }, 168 | filesystem_watchers = { 169 | enable = true, 170 | debounce_delay = 50, 171 | }, 172 | git = { 173 | enable = true, 174 | ignore = false, 175 | show_on_dirs = true, 176 | timeout = 400, 177 | }, 178 | trash = { 179 | cmd = "gio trash", 180 | require_confirm = true, 181 | }, 182 | live_filter = { 183 | prefix = "[FILTER]: ", 184 | always_show_folders = true, 185 | }, 186 | log = { 187 | enable = false, 188 | truncate = false, 189 | types = { 190 | all = false, 191 | config = false, 192 | copy_paste = false, 193 | dev = false, 194 | diagnostics = false, 195 | git = false, 196 | profile = false, 197 | watcher = false, 198 | }, 199 | }, 200 | }) 201 | end 202 | -------------------------------------------------------------------------------- /lua/modules/configs/tool/project.lua: -------------------------------------------------------------------------------- 1 | return function() 2 | require("modules.utils").load_plugin("project_nvim", { 3 | manual_mode = false, 4 | detection_methods = { "lsp", "pattern" }, 5 | patterns = { ".git", "_darcs", ".hg", ".bzr", ".svn", "Makefile", "package.json" }, 6 | ignore_lsp = { "null-ls", "copilot" }, 7 | exclude_dirs = {}, 8 | show_hidden = false, 9 | silent_chdir = true, 10 | scope_chdir = "global", 11 | datapath = vim.fn.stdpath("data"), 12 | }) 13 | end 14 | -------------------------------------------------------------------------------- /lua/modules/configs/tool/search.lua: -------------------------------------------------------------------------------- 1 | return function() 2 | local search_backend = require("core.settings").search_backend 3 | local builtin = require("telescope.builtin") 4 | local extensions = require("telescope").extensions 5 | local vim_path = require("core.global").vim_path 6 | local prompt_position = require("telescope.config").values.layout_config.horizontal.prompt_position 7 | local fzf_opts = { fzf_opts = { ["--layout"] = prompt_position == "top" and "reverse" or "default" } } 8 | local files = function() 9 | if search_backend == "fzf" then 10 | return function() 11 | local opts = {} 12 | local fzf = require("fzf-lua") 13 | opts = vim.tbl_deep_extend("force", opts, fzf_opts) 14 | if vim.fn.getcwd() == vim_path then 15 | fzf.files(vim.tbl_deep_extend("force", opts, { no_ignore = true })) 16 | elseif vim.fn.isdirectory(".git") == 1 then 17 | fzf.git_files(opts) 18 | else 19 | fzf.files(opts) 20 | end 21 | end 22 | else 23 | return function(opts) 24 | opts = opts or {} 25 | if vim.fn.getcwd() == vim_path then 26 | builtin.find_files(vim.tbl_deep_extend("force", opts, { no_ignore = true })) 27 | elseif vim.fn.isdirectory(".git") == 1 then 28 | builtin.git_files(opts) 29 | else 30 | builtin.find_files(opts) 31 | end 32 | end 33 | end 34 | end 35 | 36 | local old_files = function() 37 | if search_backend == "fzf" then 38 | return function() 39 | local opts = {} 40 | local fzf = require("fzf-lua") 41 | opts = vim.tbl_deep_extend("force", opts, fzf_opts) 42 | fzf.oldfiles(opts) 43 | end 44 | else 45 | return function(opts) 46 | opts = opts or {} 47 | builtin.oldfiles(opts) 48 | end 49 | end 50 | end 51 | 52 | local word_in_project = function() 53 | if search_backend == "fzf" then 54 | return function() 55 | local opts = {} 56 | local fzf = require("fzf-lua") 57 | opts = vim.tbl_deep_extend("force", opts, fzf_opts) 58 | if vim.fn.getcwd() == vim_path then 59 | opts = vim.tbl_deep_extend("force", opts, { no_ignore = true }) 60 | end 61 | fzf.live_grep(opts) 62 | end 63 | else 64 | return function(opts) 65 | opts = opts or {} 66 | if vim.fn.getcwd() == vim_path then 67 | opts["additional_args"] = { "--no-ignore" } 68 | end 69 | extensions.live_grep_args.live_grep_args(opts) 70 | end 71 | end 72 | end 73 | 74 | local word_under_cursor = function() 75 | if search_backend == "fzf" then 76 | return function() 77 | local opts = {} 78 | local fzf = require("fzf-lua") 79 | opts = vim.tbl_deep_extend("force", opts, fzf_opts) 80 | if vim.fn.getcwd() == vim_path then 81 | opts = vim.tbl_deep_extend("force", opts, { no_ignore = true }) 82 | end 83 | fzf.grep_cword(opts) 84 | end 85 | else 86 | return function(opts) 87 | opts = opts or {} 88 | if vim.fn.getcwd() == vim_path then 89 | opts["additional_args"] = { "--no-ignore" } 90 | end 91 | builtin.grep_string(opts) 92 | end 93 | end 94 | end 95 | 96 | require("modules.utils").load_plugin("search", { 97 | prompt_position = prompt_position, 98 | collections = { 99 | -- Search using filenames 100 | file = { 101 | initial_tab = 1, 102 | tabs = { 103 | { 104 | name = "Files", 105 | tele_func = files(), 106 | }, 107 | { 108 | name = "Frecency", 109 | tele_func = function() 110 | extensions.frecency.frecency() 111 | end, 112 | }, 113 | { 114 | name = "Oldfiles", 115 | tele_func = old_files(), 116 | }, 117 | { 118 | name = "Buffers", 119 | tele_func = function() 120 | builtin.buffers() 121 | end, 122 | }, 123 | }, 124 | }, 125 | -- Search using patterns 126 | pattern = { 127 | initial_tab = 1, 128 | tabs = { 129 | { 130 | name = "Word in project", 131 | tele_func = word_in_project(), 132 | }, 133 | { 134 | name = "Word under cursor", 135 | tele_func = word_under_cursor(), 136 | }, 137 | }, 138 | }, 139 | -- Search Git objects (branches, commits) 140 | git = { 141 | initial_tab = 1, 142 | tabs = { 143 | { 144 | name = "Branches", 145 | tele_func = function() 146 | builtin.git_branches() 147 | end, 148 | }, 149 | { 150 | name = "Commits", 151 | tele_func = function() 152 | builtin.git_commits() 153 | end, 154 | }, 155 | { 156 | name = "Commit content", 157 | tele_func = function() 158 | extensions.advanced_git_search.search_log_content() 159 | end, 160 | }, 161 | { 162 | name = "Diff current file with commit", 163 | tele_func = function() 164 | extensions.advanced_git_search.diff_commit_file() 165 | end, 166 | }, 167 | }, 168 | }, 169 | -- Retrieve dossiers 170 | dossier = { 171 | initial_tab = 1, 172 | tabs = { 173 | { 174 | name = "Sessions", 175 | tele_func = function() 176 | extensions.persisted.persisted() 177 | end, 178 | }, 179 | { 180 | name = "Projects", 181 | tele_func = function() 182 | extensions.projects.projects({}) 183 | end, 184 | }, 185 | { 186 | name = "Zoxide", 187 | tele_func = function() 188 | extensions.zoxide.list() 189 | end, 190 | }, 191 | }, 192 | }, 193 | -- Miscellaneous 194 | misc = { 195 | initial_tab = 1, 196 | tabs = { 197 | { 198 | name = "Colorschemes", 199 | tele_func = function() 200 | builtin.colorscheme({ enable_preview = true }) 201 | end, 202 | }, 203 | { 204 | name = "Notify", 205 | tele_func = function() 206 | extensions.notify.notify() 207 | end, 208 | }, 209 | { 210 | name = "Undo History", 211 | tele_func = function() 212 | extensions.undo.undo() 213 | end, 214 | }, 215 | }, 216 | }, 217 | }, 218 | }) 219 | end 220 | -------------------------------------------------------------------------------- /lua/modules/configs/tool/smartyank.lua: -------------------------------------------------------------------------------- 1 | return function() 2 | require("modules.utils").load_plugin("smartyank", { 3 | highlight = { 4 | enabled = false, -- highlight yanked text 5 | higroup = "IncSearch", -- highlight group of yanked text 6 | timeout = 2000, -- timeout for clearing the highlight 7 | }, 8 | clipboard = { 9 | enabled = true, 10 | }, 11 | tmux = { 12 | enabled = true, 13 | -- remove `-w` to disable copy to host client's clipboard 14 | cmd = { "tmux", "set-buffer", "-w" }, 15 | }, 16 | osc52 = { 17 | enabled = true, 18 | escseq = "tmux", -- use tmux escape sequence, only enable if you're using remote tmux and have issues (see #4) 19 | ssh_only = true, -- false to OSC52 yank also in local sessions 20 | silent = false, -- true to disable the "n chars copied" echo 21 | echo_hl = "Directory", -- highlight group of the OSC52 echo message 22 | }, 23 | }) 24 | end 25 | -------------------------------------------------------------------------------- /lua/modules/configs/tool/sniprun.lua: -------------------------------------------------------------------------------- 1 | return function() 2 | require("modules.utils").load_plugin("sniprun", { 3 | selected_interpreters = {}, -- " use those instead of the default for the current filetype 4 | repl_enable = {}, -- " enable REPL-like behavior for the given interpreters 5 | repl_disable = {}, -- " disable REPL-like behavior for the given interpreters 6 | interpreter_options = {}, -- " intepreter-specific options, consult docs / :SnipInfo 7 | -- " you can combo different display modes as desired 8 | display = { 9 | "TempFloatingWindowOk", -- display ok results in the floating window 10 | "NvimNotifyErr", -- display err results with the nvim-notify plugin 11 | -- "Classic", -- display results in the command line" 12 | -- "VirtualText", -- display results in virtual text" 13 | -- "LongTempFloatingWindow", -- display results in the long floating window 14 | -- "Terminal" -- display results in a vertical split 15 | -- "TerminalWithCode" -- display results and code history in a vertical split 16 | }, 17 | display_options = { 18 | terminal_width = 45, 19 | notification_timeout = 5000, 20 | }, 21 | -- " miscellaneous compatibility/adjustement settings 22 | inline_messages = 0, -- " inline_message (0/1) is a one-line way to display messages 23 | -- " to workaround sniprun not being able to display anything 24 | borders = "single", -- " display borders around floating windows 25 | -- " possible values are 'none', 'single', 'double', or 'shadow' 26 | }) 27 | end 28 | -------------------------------------------------------------------------------- /lua/modules/configs/tool/telescope.lua: -------------------------------------------------------------------------------- 1 | return function() 2 | local icons = { ui = require("modules.utils.icons").get("ui", true) } 3 | local lga_actions = require("telescope-live-grep-args.actions") 4 | 5 | require("modules.utils").load_plugin("telescope", { 6 | defaults = { 7 | vimgrep_arguments = { 8 | "rg", 9 | "--no-heading", 10 | "--with-filename", 11 | "--line-number", 12 | "--column", 13 | "--smart-case", 14 | }, 15 | initial_mode = "insert", 16 | prompt_prefix = " " .. icons.ui.Telescope .. " ", 17 | selection_caret = icons.ui.ChevronRight, 18 | scroll_strategy = "limit", 19 | results_title = false, 20 | layout_strategy = "flex", 21 | path_display = { "absolute" }, 22 | selection_strategy = "reset", 23 | color_devicons = true, 24 | file_ignore_patterns = { ".git/", ".cache", "build/", "%.class", "%.pdf", "%.mkv", "%.mp4", "%.zip" }, 25 | layout_config = { 26 | horizontal = { 27 | preview_width = 0.55, 28 | }, 29 | vertical = { 30 | mirror = false, 31 | }, 32 | width = 0.85, 33 | height = 0.92, 34 | preview_cutoff = 120, 35 | }, 36 | file_previewer = require("telescope.previewers").vim_buffer_cat.new, 37 | grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new, 38 | qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new, 39 | file_sorter = require("telescope.sorters").get_fuzzy_file, 40 | generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter, 41 | buffer_previewer_maker = require("telescope.previewers").buffer_previewer_maker, 42 | }, 43 | extensions = { 44 | fzf = { 45 | fuzzy = false, 46 | override_generic_sorter = true, 47 | override_file_sorter = true, 48 | case_mode = "smart_case", 49 | }, 50 | frecency = { 51 | show_scores = true, 52 | show_unindexed = true, 53 | ignore_patterns = { "*.git/*", "*/tmp/*" }, 54 | }, 55 | live_grep_args = { 56 | auto_quoting = true, -- enable/disable auto-quoting 57 | mappings = { -- extend mappings 58 | i = { 59 | [""] = lga_actions.quote_prompt(), 60 | [""] = lga_actions.quote_prompt({ postfix = " --iglob " }), 61 | }, 62 | }, 63 | }, 64 | undo = { 65 | side_by_side = true, 66 | mappings = { 67 | i = { 68 | [""] = require("telescope-undo.actions").yank_additions, 69 | [""] = require("telescope-undo.actions").yank_deletions, 70 | [""] = require("telescope-undo.actions").restore, 71 | }, 72 | }, 73 | }, 74 | advanced_git_search = { 75 | diff_plugin = "diffview", 76 | git_flags = { "-c", "delta.side-by-side=true" }, 77 | entry_default_author_or_date = "author", -- one of "author" or "date" 78 | }, 79 | }, 80 | }) 81 | 82 | require("telescope").load_extension("frecency") 83 | require("telescope").load_extension("fzf") 84 | require("telescope").load_extension("live_grep_args") 85 | require("telescope").load_extension("notify") 86 | require("telescope").load_extension("projects") 87 | require("telescope").load_extension("undo") 88 | require("telescope").load_extension("zoxide") 89 | require("telescope").load_extension("persisted") 90 | require("telescope").load_extension("advanced_git_search") 91 | end 92 | -------------------------------------------------------------------------------- /lua/modules/configs/tool/toggleterm.lua: -------------------------------------------------------------------------------- 1 | return function() 2 | require("modules.utils").load_plugin("toggleterm", { 3 | -- size can be a number or function which is passed the current terminal 4 | size = function(term) 5 | if term.direction == "horizontal" then 6 | return vim.o.lines * 0.30 7 | elseif term.direction == "vertical" then 8 | return vim.o.columns * 0.40 9 | end 10 | end, 11 | on_open = function() 12 | -- Prevent infinite calls from freezing neovim. 13 | -- Only set these options specific to this terminal buffer. 14 | vim.api.nvim_set_option_value("foldmethod", "manual", { scope = "local" }) 15 | vim.api.nvim_set_option_value("foldexpr", "0", { scope = "local" }) 16 | end, 17 | highlights = { 18 | Normal = { 19 | link = "Normal", 20 | }, 21 | NormalFloat = { 22 | link = "NormalFloat", 23 | }, 24 | FloatBorder = { 25 | link = "FloatBorder", 26 | }, 27 | }, 28 | open_mapping = false, -- [[]], 29 | hide_numbers = true, -- hide the number column in toggleterm buffers 30 | shade_filetypes = {}, 31 | shade_terminals = false, 32 | shading_factor = "1", -- the degree by which to darken to terminal colour, default: 1 for dark backgrounds, 3 for light 33 | start_in_insert = true, 34 | persist_mode = false, 35 | insert_mappings = true, -- whether or not the open mapping applies in insert mode 36 | persist_size = true, 37 | direction = "horizontal", 38 | close_on_exit = true, -- close the terminal window when the process exits 39 | shell = vim.o.shell, -- change the default shell 40 | }) 41 | end 42 | -------------------------------------------------------------------------------- /lua/modules/configs/tool/trouble.lua: -------------------------------------------------------------------------------- 1 | return function() 2 | local icons = { 3 | ui = require("modules.utils.icons").get("ui", true), 4 | } 5 | 6 | require("modules.utils").load_plugin("trouble", { 7 | auto_open = false, 8 | auto_close = false, 9 | auto_jump = false, 10 | auto_preview = true, 11 | auto_refresh = true, 12 | focus = false, -- do not focus the window when opened 13 | follow = true, 14 | restore = true, 15 | icons = { 16 | indent = { 17 | fold_open = icons.ui.ArrowOpen, 18 | fold_closed = icons.ui.ArrowClosed, 19 | }, 20 | folder_closed = icons.ui.Folder, 21 | folder_open = icons.ui.FolderOpen, 22 | }, 23 | modes = { 24 | project_diagnostics = { 25 | mode = "diagnostics", 26 | filter = { 27 | any = { 28 | { 29 | function(item) 30 | return item.filename:find(vim.fn.getcwd(), 1, true) 31 | end, 32 | }, 33 | }, 34 | }, 35 | }, 36 | }, 37 | }) 38 | end 39 | -------------------------------------------------------------------------------- /lua/modules/configs/tool/which-key.lua: -------------------------------------------------------------------------------- 1 | return function() 2 | local icons = { 3 | ui = require("modules.utils.icons").get("ui"), 4 | misc = require("modules.utils.icons").get("misc"), 5 | git = require("modules.utils.icons").get("git", true), 6 | cmp = require("modules.utils.icons").get("cmp", true), 7 | } 8 | 9 | require("modules.utils").load_plugin("which-key", { 10 | preset = "classic", 11 | delay = vim.o.timeoutlen, 12 | triggers = { 13 | { "", mode = "nixso" }, 14 | }, 15 | plugins = { 16 | marks = true, 17 | registers = true, 18 | spelling = { 19 | enabled = true, 20 | suggestions = 20, 21 | }, 22 | presets = { 23 | motions = false, 24 | operators = false, 25 | text_objects = true, 26 | windows = true, 27 | nav = true, 28 | z = true, 29 | g = true, 30 | }, 31 | }, 32 | win = { 33 | border = "none", 34 | padding = { 1, 2 }, 35 | wo = { winblend = 0 }, 36 | }, 37 | expand = 1, 38 | icons = { 39 | group = "", 40 | rules = false, 41 | colors = false, 42 | breadcrumb = icons.ui.Separator, 43 | separator = icons.misc.Vbar, 44 | keys = { 45 | C = "C-", 46 | M = "A-", 47 | S = "S-", 48 | BS = " ", 49 | CR = " ", 50 | NL = " ", 51 | Esc = " ", 52 | Tab = " ", 53 | Up = " ", 54 | Down = " ", 55 | Left = " ", 56 | Right = " ", 57 | Space = " ", 58 | ScrollWheelUp = " ", 59 | ScrollWheelDown = " ", 60 | }, 61 | }, 62 | spec = { 63 | { "g", group = icons.git.Git .. "Git" }, 64 | { "d", group = icons.ui.Bug .. " Debug" }, 65 | { "s", group = icons.cmp.tmux .. "Session" }, 66 | { "b", group = icons.ui.Buffer .. " Buffer" }, 67 | { "S", group = icons.ui.Search .. " Search" }, 68 | { "W", group = icons.ui.Window .. " Window" }, 69 | { "p", group = icons.ui.Package .. " Package" }, 70 | { "l", group = icons.misc.LspAvailable .. " Lsp" }, 71 | { "f", group = icons.ui.Telescope .. " Fuzzy Find" }, 72 | { "n", group = icons.ui.FolderOpen .. " Nvim Tree" }, 73 | }, 74 | }) 75 | end 76 | -------------------------------------------------------------------------------- /lua/modules/configs/tool/wilder.lua: -------------------------------------------------------------------------------- 1 | return function() 2 | local wilder = require("wilder") 3 | local icons = { ui = require("modules.utils.icons").get("ui") } 4 | 5 | wilder.set_option("use_python_remote_plugin", 0) 6 | wilder.set_option("pipeline", { 7 | wilder.branch( 8 | wilder.cmdline_pipeline({ use_python = 0, fuzzy = 1, fuzzy_filter = wilder.lua_fzy_filter() }), 9 | wilder.vim_search_pipeline(), 10 | { 11 | wilder.check(function(_, x) 12 | return x == "" 13 | end), 14 | wilder.history(), 15 | wilder.result({ 16 | draw = { 17 | function(_, x) 18 | return icons.ui.Calendar .. " " .. x 19 | end, 20 | }, 21 | }), 22 | } 23 | ), 24 | }) 25 | 26 | local popupmenu_renderer = wilder.popupmenu_renderer(wilder.popupmenu_border_theme({ 27 | border = "rounded", 28 | highlights = { 29 | default = "Pmenu", 30 | border = "PmenuBorder", -- highlight to use for the border 31 | accent = wilder.make_hl("WilderAccent", "CmpItemAbbr", "CmpItemAbbrMatch"), 32 | }, 33 | empty_message = wilder.popupmenu_empty_message_with_spinner(), 34 | highlighter = wilder.lua_fzy_highlighter(), 35 | left = { 36 | " ", 37 | wilder.popupmenu_devicons(), 38 | wilder.popupmenu_buffer_flags({ 39 | flags = " a + ", 40 | icons = { ["+"] = icons.ui.Pencil, a = icons.ui.Indicator, h = icons.ui.File }, 41 | }), 42 | }, 43 | right = { 44 | " ", 45 | wilder.popupmenu_scrollbar(), 46 | }, 47 | })) 48 | local wildmenu_renderer = wilder.wildmenu_renderer({ 49 | apply_incsearch_fix = false, 50 | highlighter = wilder.lua_fzy_highlighter(), 51 | separator = " | ", 52 | left = { " ", wilder.wildmenu_spinner(), " " }, 53 | right = { " ", wilder.wildmenu_index() }, 54 | }) 55 | wilder.set_option( 56 | "renderer", 57 | wilder.renderer_mux({ 58 | [":"] = popupmenu_renderer, 59 | ["/"] = wildmenu_renderer, 60 | substitute = wildmenu_renderer, 61 | }) 62 | ) 63 | 64 | require("modules.utils").load_plugin("wilder", { modes = { ":", "/", "?" } }) 65 | end 66 | -------------------------------------------------------------------------------- /lua/modules/configs/ui/alpha.lua: -------------------------------------------------------------------------------- 1 | return function() 2 | local dashboard = require("alpha.themes.dashboard") 3 | require("modules.utils").gen_alpha_hl() 4 | 5 | dashboard.section.header.val = require("core.settings").dashboard_image 6 | dashboard.section.header.opts.hl = "AlphaHeader" 7 | 8 | local function button(sc, txt, leader_txt, keybind, keybind_opts) 9 | local sc_after = sc:gsub("%s", ""):gsub(leader_txt, "") 10 | 11 | local opts = { 12 | position = "center", 13 | shortcut = sc, 14 | cursor = 5, 15 | width = 50, 16 | align_shortcut = "right", 17 | hl = "AlphaButtons", 18 | hl_shortcut = "AlphaShortcut", 19 | } 20 | 21 | if nil == keybind then 22 | keybind = sc_after 23 | end 24 | keybind_opts = vim.F.if_nil(keybind_opts, { noremap = true, silent = true, nowait = true }) 25 | opts.keymap = { "n", sc_after, keybind, keybind_opts } 26 | 27 | local function on_press() 28 | -- local key = vim.api.nvim_replace_termcodes(keybind .. '', true, false, true) 29 | local key = vim.api.nvim_replace_termcodes(sc_after .. "", true, false, true) 30 | vim.api.nvim_feedkeys(key, "t", false) 31 | end 32 | 33 | return { 34 | type = "button", 35 | val = txt, 36 | on_press = on_press, 37 | opts = opts, 38 | } 39 | end 40 | 41 | local leader = " " 42 | local icons = { 43 | documents = require("modules.utils.icons").get("documents", true), 44 | git = require("modules.utils.icons").get("git", true), 45 | ui = require("modules.utils.icons").get("ui", true), 46 | misc = require("modules.utils.icons").get("misc", true), 47 | } 48 | 49 | dashboard.section.buttons.val = { 50 | button( 51 | "space f c", 52 | icons.misc.Neovim .. "Telescope collections", 53 | leader, 54 | nil, 55 | { noremap = true, silent = true, nowait = true } 56 | ), 57 | button( 58 | "space f f", 59 | icons.documents.FileFind .. "Find files", 60 | leader, 61 | nil, 62 | { noremap = true, silent = true, nowait = true } 63 | ), 64 | button( 65 | "space f d", 66 | icons.ui.FolderWithHeart .. "Retrieve dossiers", 67 | leader, 68 | nil, 69 | { noremap = true, silent = true, nowait = true } 70 | ), 71 | button( 72 | "space f p", 73 | icons.documents.Word .. "Find patterns", 74 | leader, 75 | nil, 76 | { noremap = true, silent = true, nowait = true } 77 | ), 78 | button( 79 | "space f g", 80 | icons.git.Git .. "Locate Git objects", 81 | leader, 82 | nil, 83 | { noremap = true, silent = true, nowait = true } 84 | ), 85 | button( 86 | "space f m", 87 | icons.misc.Ghost .. "Miscellaneous artifacts", 88 | leader, 89 | nil, 90 | { noremap = true, silent = true, nowait = true } 91 | ), 92 | } 93 | dashboard.section.buttons.opts.hl = "AlphaButtons" 94 | 95 | local function footer() 96 | local stats = require("lazy").stats() 97 | local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100) 98 | return "  Have Fun with neovim" 99 | .. " 󰀨 v" 100 | .. vim.version().major 101 | .. "." 102 | .. vim.version().minor 103 | .. "." 104 | .. vim.version().patch 105 | .. " 󰂖 " 106 | .. stats.count 107 | .. " plugins in " 108 | .. ms 109 | .. "ms" 110 | end 111 | 112 | dashboard.section.footer.val = footer() 113 | dashboard.section.footer.opts.hl = "AlphaFooter" 114 | 115 | local head_butt_padding = 2 116 | local occu_height = #dashboard.section.header.val + 2 * #dashboard.section.buttons.val + head_butt_padding 117 | local header_padding = math.max(0, math.ceil((vim.fn.winheight(0) - occu_height) * 0.25)) 118 | local foot_butt_padding = 1 119 | 120 | dashboard.config.layout = { 121 | { type = "padding", val = header_padding }, 122 | dashboard.section.header, 123 | { type = "padding", val = head_butt_padding }, 124 | dashboard.section.buttons, 125 | { type = "padding", val = foot_butt_padding }, 126 | dashboard.section.footer, 127 | } 128 | 129 | require("modules.utils").load_plugin("alpha", dashboard.opts) 130 | 131 | vim.api.nvim_create_autocmd("User", { 132 | pattern = "LazyVimStarted", 133 | callback = function() 134 | dashboard.section.footer.val = footer() 135 | pcall(vim.cmd.AlphaRedraw) 136 | end, 137 | }) 138 | end 139 | -------------------------------------------------------------------------------- /lua/modules/configs/ui/bufferline.lua: -------------------------------------------------------------------------------- 1 | return function() 2 | local icons = { ui = require("modules.utils.icons").get("ui") } 3 | 4 | local opts = { 5 | options = { 6 | number = nil, 7 | close_command = "BufDel! %d", 8 | right_mouse_command = "BufDel! %d", 9 | modified_icon = icons.ui.Modified, 10 | buffer_close_icon = icons.ui.Close, 11 | left_trunc_marker = icons.ui.Left, 12 | right_trunc_marker = icons.ui.Right, 13 | max_name_length = 20, 14 | max_prefix_length = 13, 15 | tab_size = 20, 16 | color_icons = true, 17 | show_buffer_icons = true, 18 | show_buffer_close_icons = true, 19 | show_close_icon = true, 20 | show_tab_indicators = true, 21 | enforce_regular_tabs = false, 22 | persist_buffer_sort = true, 23 | always_show_bufferline = true, 24 | separator_style = "thin", 25 | diagnostics = "nvim_lsp", 26 | diagnostics_indicator = function(count) 27 | return "(" .. count .. ")" 28 | end, 29 | offsets = { 30 | { 31 | filetype = "NvimTree", 32 | text = "File Explorer", 33 | text_align = "center", 34 | padding = 0, 35 | }, 36 | { 37 | filetype = "trouble", 38 | text = "LSP Outline", 39 | text_align = "center", 40 | padding = 0, 41 | }, 42 | }, 43 | }, 44 | -- Change bufferline's highlights here! See `:h bufferline-highlights` for detailed explanation. 45 | -- Note: If you use catppuccin then modify the colors below! 46 | highlights = {}, 47 | } 48 | 49 | if vim.g.colors_name:find("catppuccin") then 50 | local cp = require("modules.utils").get_palette() -- Get the palette. 51 | 52 | local catppuccin_hl_overwrite = { 53 | highlights = require("catppuccin.groups.integrations.bufferline").get({ 54 | styles = { "italic", "bold" }, 55 | custom = { 56 | all = { 57 | -- Hint 58 | hint = { fg = cp.rosewater }, 59 | hint_visible = { fg = cp.rosewater }, 60 | hint_selected = { fg = cp.rosewater }, 61 | hint_diagnostic = { fg = cp.rosewater }, 62 | hint_diagnostic_visible = { fg = cp.rosewater }, 63 | hint_diagnostic_selected = { fg = cp.rosewater }, 64 | }, 65 | }, 66 | }), 67 | } 68 | 69 | opts = vim.tbl_deep_extend("force", opts, catppuccin_hl_overwrite) 70 | end 71 | 72 | require("modules.utils").load_plugin("bufferline", opts) 73 | end 74 | -------------------------------------------------------------------------------- /lua/modules/configs/ui/catppuccin.lua: -------------------------------------------------------------------------------- 1 | return function() 2 | local transparent_background = require("core.settings").transparent_background 3 | local clear = {} 4 | 5 | require("modules.utils").load_plugin("catppuccin", { 6 | background = { light = "latte", dark = "mocha" }, -- latte, frappe, macchiato, mocha 7 | dim_inactive = { 8 | enabled = false, 9 | -- Dim inactive splits/windows/buffers. 10 | -- NOT recommended if you use old palette (a.k.a., mocha). 11 | shade = "dark", 12 | percentage = 0.15, 13 | }, 14 | transparent_background = transparent_background, 15 | show_end_of_buffer = false, -- show the '~' characters after the end of buffers 16 | term_colors = true, 17 | compile_path = vim.fn.stdpath("cache") .. "/catppuccin", 18 | styles = { 19 | comments = { "italic" }, 20 | functions = { "bold" }, 21 | keywords = { "italic" }, 22 | operators = { "bold" }, 23 | conditionals = { "bold" }, 24 | loops = { "bold" }, 25 | booleans = { "bold", "italic" }, 26 | numbers = {}, 27 | types = {}, 28 | strings = {}, 29 | variables = {}, 30 | properties = {}, 31 | }, 32 | integrations = { 33 | cmp = true, 34 | dap = true, 35 | dap_ui = true, 36 | diffview = true, 37 | dropbar = { enabled = true, color_mode = true }, 38 | fidget = true, 39 | flash = true, 40 | fzf = true, 41 | gitsigns = true, 42 | grug_far = true, 43 | hop = true, 44 | indent_blankline = { enabled = true, colored_indent_levels = true }, 45 | lsp_saga = true, 46 | lsp_trouble = true, 47 | markdown = true, 48 | mason = true, 49 | mini = { enabled = true, indentscope_color = "" }, 50 | native_lsp = { 51 | enabled = true, 52 | virtual_text = { 53 | errors = { "italic" }, 54 | hints = { "italic" }, 55 | warnings = { "italic" }, 56 | information = { "italic" }, 57 | }, 58 | underlines = { 59 | errors = { "underline" }, 60 | hints = { "underline" }, 61 | warnings = { "underline" }, 62 | information = { "underline" }, 63 | }, 64 | }, 65 | notify = true, 66 | nvimtree = true, 67 | rainbow_delimiters = true, 68 | render_markdown = true, 69 | semantic_tokens = true, 70 | telescope = { enabled = true, style = "nvchad" }, 71 | treesitter = true, 72 | treesitter_context = true, 73 | which_key = true, 74 | }, 75 | color_overrides = {}, 76 | highlight_overrides = { 77 | ---@param cp palette 78 | all = function(cp) 79 | return { 80 | -- For base configs 81 | NormalFloat = { fg = cp.text, bg = transparent_background and cp.none or cp.mantle }, 82 | FloatBorder = { 83 | fg = transparent_background and cp.blue or cp.mantle, 84 | bg = transparent_background and cp.none or cp.mantle, 85 | }, 86 | CursorLineNr = { fg = cp.green }, 87 | 88 | -- For native lsp configs 89 | DiagnosticVirtualTextError = { bg = cp.none }, 90 | DiagnosticVirtualTextWarn = { bg = cp.none }, 91 | DiagnosticVirtualTextInfo = { bg = cp.none }, 92 | DiagnosticVirtualTextHint = { bg = cp.none }, 93 | LspInfoBorder = { link = "FloatBorder" }, 94 | 95 | -- For mason.nvim 96 | MasonNormal = { link = "NormalFloat" }, 97 | 98 | -- For indent-blankline 99 | IblIndent = { fg = cp.surface0 }, 100 | IblScope = { fg = cp.surface2, style = { "bold" } }, 101 | 102 | -- For nvim-cmp and wilder.nvim 103 | Pmenu = { fg = cp.overlay2, bg = transparent_background and cp.none or cp.base }, 104 | PmenuBorder = { fg = cp.surface1, bg = transparent_background and cp.none or cp.base }, 105 | PmenuSel = { bg = cp.green, fg = cp.base }, 106 | CmpItemAbbr = { fg = cp.overlay2 }, 107 | CmpItemAbbrMatch = { fg = cp.blue, style = { "bold" } }, 108 | CmpDoc = { link = "NormalFloat" }, 109 | CmpDocBorder = { 110 | fg = transparent_background and cp.surface1 or cp.mantle, 111 | bg = transparent_background and cp.none or cp.mantle, 112 | }, 113 | 114 | -- For fidget 115 | FidgetTask = { bg = cp.none, fg = cp.surface2 }, 116 | FidgetTitle = { fg = cp.blue, style = { "bold" } }, 117 | 118 | -- For nvim-notify 119 | NotifyBackground = { bg = cp.base }, 120 | 121 | -- For nvim-tree 122 | NvimTreeRootFolder = { fg = cp.pink }, 123 | NvimTreeIndentMarker = { fg = cp.surface2 }, 124 | 125 | -- For trouble.nvim 126 | TroubleNormal = { bg = transparent_background and cp.none or cp.base }, 127 | TroubleNormalNC = { bg = transparent_background and cp.none or cp.base }, 128 | 129 | -- For telescope.nvim 130 | TelescopeMatching = { fg = cp.lavender }, 131 | TelescopeResultsDiffAdd = { fg = cp.green }, 132 | TelescopeResultsDiffChange = { fg = cp.yellow }, 133 | TelescopeResultsDiffDelete = { fg = cp.red }, 134 | 135 | -- For glance.nvim 136 | GlanceWinBarFilename = { fg = cp.subtext1, style = { "bold" } }, 137 | GlanceWinBarFilepath = { fg = cp.subtext0, style = { "italic" } }, 138 | GlanceWinBarTitle = { fg = cp.teal, style = { "bold" } }, 139 | GlanceListCount = { fg = cp.lavender }, 140 | GlanceListFilepath = { link = "Comment" }, 141 | GlanceListFilename = { fg = cp.blue }, 142 | GlanceListMatch = { fg = cp.lavender, style = { "bold" } }, 143 | GlanceFoldIcon = { fg = cp.green }, 144 | 145 | -- For nvim-treehopper 146 | TSNodeKey = { 147 | fg = cp.peach, 148 | bg = transparent_background and cp.none or cp.base, 149 | style = { "bold", "underline" }, 150 | }, 151 | 152 | -- For treesitter 153 | ["@keyword.return"] = { fg = cp.pink, style = clear }, 154 | ["@error.c"] = { fg = cp.none, style = clear }, 155 | ["@error.cpp"] = { fg = cp.none, style = clear }, 156 | } 157 | end, 158 | }, 159 | }) 160 | end 161 | -------------------------------------------------------------------------------- /lua/modules/configs/ui/edgy.lua: -------------------------------------------------------------------------------- 1 | return function() 2 | local trouble_filter = function(position) 3 | return function(_, win) 4 | return vim.w[win].trouble 5 | and vim.w[win].trouble.position == position 6 | and vim.w[win].trouble.type == "split" 7 | and vim.w[win].trouble.relative == "editor" 8 | and not vim.w[win].trouble_preview 9 | end 10 | end 11 | 12 | require("modules.utils").load_plugin("edgy", { 13 | close_when_all_hidden = true, 14 | exit_when_last = true, 15 | wo = { winbar = false }, 16 | keys = { 17 | ["q"] = false, 18 | ["Q"] = false, 19 | [""] = false, 20 | [""] = function(win) 21 | win:resize("height", -2) 22 | end, 23 | [""] = function(win) 24 | win:resize("height", 2) 25 | end, 26 | [""] = function(win) 27 | win:resize("width", -2) 28 | end, 29 | [""] = function(win) 30 | win:resize("width", 2) 31 | end, 32 | }, 33 | left = { 34 | { 35 | ft = "NvimTree", 36 | pinned = true, 37 | collapsed = false, 38 | size = { height = 0.6, width = 0.15 }, 39 | open = "NvimTreeOpen", 40 | }, 41 | { 42 | ft = "trouble", 43 | pinned = true, 44 | collapsed = false, 45 | size = { height = 0.4, width = 0.15 }, 46 | open = "Trouble symbols toggle win.position=right", 47 | filter = trouble_filter("right"), 48 | }, 49 | }, 50 | bottom = { 51 | { ft = "qf", size = { height = 0.3 } }, 52 | { 53 | ft = "toggleterm", 54 | size = { height = 0.3 }, 55 | filter = function(_, win) 56 | local not_floating = vim.api.nvim_win_get_config(win).relative == "" 57 | local term = require("toggleterm.terminal").get(1) 58 | return not_floating and term.direction == "horizontal" 59 | end, 60 | }, 61 | { 62 | ft = "help", 63 | size = { height = 0.3 }, 64 | filter = function(buf) 65 | return vim.bo[buf].buftype == "help" 66 | end, 67 | }, 68 | }, 69 | }) 70 | end 71 | -------------------------------------------------------------------------------- /lua/modules/configs/ui/gitsigns.lua: -------------------------------------------------------------------------------- 1 | return function() 2 | local mapping = require("keymap.ui") 3 | require("modules.utils").load_plugin("gitsigns", { 4 | signs = { 5 | add = { text = "┃" }, 6 | change = { text = "┃" }, 7 | delete = { text = "_" }, 8 | topdelete = { text = "‾" }, 9 | changedelete = { text = "~" }, 10 | untracked = { text = "┆" }, 11 | }, 12 | auto_attach = true, 13 | on_attach = mapping.gitsigns, 14 | signcolumn = true, 15 | sign_priority = 6, 16 | update_debounce = 100, 17 | word_diff = false, 18 | current_line_blame = true, 19 | diff_opts = { internal = true }, 20 | watch_gitdir = { follow_files = true }, 21 | current_line_blame_opts = { delay = 1000, virt_text = true, virtual_text_pos = "eol" }, 22 | }) 23 | end 24 | -------------------------------------------------------------------------------- /lua/modules/configs/ui/neoscroll.lua: -------------------------------------------------------------------------------- 1 | return function() 2 | require("modules.utils").load_plugin("neoscroll", { 3 | -- All these keys will be mapped to their corresponding default scrolling animation 4 | mappings = { 5 | "", 6 | "", 7 | "", 8 | "", 9 | "", 10 | "", 11 | "zt", 12 | "zz", 13 | "zb", 14 | }, 15 | hide_cursor = true, -- Hide cursor while scrolling 16 | stop_eof = true, -- Stop at when scrolling downwards 17 | use_local_scrolloff = false, -- Use the local scope of scrolloff instead of the global scope 18 | respect_scrolloff = false, -- Stop scrolling when the cursor reaches the scrolloff margin of the file 19 | cursor_scrolls_alone = true, -- The cursor will keep on scrolling even if the window cannot scroll further 20 | easing_function = nil, -- Default easing function 21 | pre_hook = nil, -- Function to run before the scrolling animation starts 22 | post_hook = nil, -- Function to run after the scrolling animation ends 23 | }) 24 | end 25 | -------------------------------------------------------------------------------- /lua/modules/configs/ui/notify.lua: -------------------------------------------------------------------------------- 1 | return function() 2 | local notify = require("notify") 3 | local icons = { 4 | diagnostics = require("modules.utils.icons").get("diagnostics"), 5 | ui = require("modules.utils.icons").get("ui"), 6 | } 7 | 8 | require("modules.utils").load_plugin("notify", { 9 | ---@usage Animation style one of { "fade", "slide", "fade_in_slide_out", "static" } 10 | stages = "fade", 11 | ---@usage Function called when a new window is opened, use for changing win settings/config 12 | on_open = function(win) 13 | vim.api.nvim_set_option_value("winblend", 0, { scope = "local", win = win }) 14 | vim.api.nvim_win_set_config(win, { zindex = 90 }) 15 | end, 16 | ---@usage Function called when a window is closed 17 | on_close = nil, 18 | ---@usage timeout for notifications in ms, default 5000 19 | timeout = 2000, 20 | -- @usage User render fps value 21 | fps = 20, 22 | -- Render function for notifications. See notify-render() 23 | render = "default", 24 | ---@usage highlight behind the window for stages that change opacity 25 | background_colour = "NotifyBackground", 26 | ---@usage minimum width for notification windows 27 | minimum_width = 50, 28 | ---@usage notifications with level lower than this would be ignored. [ERROR > WARN > INFO > DEBUG > TRACE] 29 | level = "INFO", 30 | ---@usage Icons for the different levels 31 | icons = { 32 | ERROR = icons.diagnostics.Error, 33 | WARN = icons.diagnostics.Warning, 34 | INFO = icons.diagnostics.Information, 35 | DEBUG = icons.ui.Bug, 36 | TRACE = icons.ui.Pencil, 37 | }, 38 | }) 39 | 40 | vim.notify = notify 41 | end 42 | -------------------------------------------------------------------------------- /lua/modules/configs/ui/paint.lua: -------------------------------------------------------------------------------- 1 | return function() 2 | require("modules.utils").load_plugin("paint", { 3 | ---type PaintHighlight[] 4 | highlights = { 5 | { 6 | -- filter can be a table of buffer options that should match, 7 | -- or a function called with buf as param that should return true. 8 | -- The example below will paint @something in comments with Constant 9 | filter = { filetype = "lua" }, 10 | pattern = "%s*%-%-%-%s*(@%w+)", 11 | hl = "Constant", 12 | }, 13 | { 14 | filter = { filetype = "python" }, 15 | pattern = "%s*([_%w]+:)", 16 | hl = "Constant", 17 | }, 18 | }, 19 | }) 20 | end 21 | -------------------------------------------------------------------------------- /lua/modules/configs/ui/scrollview.lua: -------------------------------------------------------------------------------- 1 | return function() 2 | local icons = { diagnostics = require("modules.utils.icons").get("diagnostics", true) } 3 | 4 | require("modules.utils").load_plugin("scrollview", { 5 | mode = "virtual", 6 | winblend = 0, 7 | signs_on_startup = { "diagnostics", "folds", "marks", "search", "spell" }, 8 | diagnostics_error_symbol = icons.diagnostics.Error, 9 | diagnostics_warn_symbol = icons.diagnostics.Warning, 10 | diagnostics_info_symbol = icons.diagnostics.Information, 11 | diagnostics_hint_symbol = icons.diagnostics.Hint, 12 | excluded_filetypes = { 13 | "alpha", 14 | "fugitive", 15 | "git", 16 | "notify", 17 | "NvimTree", 18 | "Outline", 19 | "TelescopePrompt", 20 | "toggleterm", 21 | "undotree", 22 | }, 23 | }) 24 | end 25 | -------------------------------------------------------------------------------- /lua/modules/configs/ui/splits.lua: -------------------------------------------------------------------------------- 1 | return function() 2 | require("modules.utils").load_plugin("smart-splits", { 3 | -- Ignored buffer types (only while resizing) 4 | ignored_buftypes = { 5 | "nofile", 6 | "quickfix", 7 | "prompt", 8 | }, 9 | -- Ignored filetypes (only while resizing) 10 | ignored_filetypes = { "NvimTree" }, 11 | -- the default number of lines/columns to resize by at a time 12 | default_amount = 3, 13 | }) 14 | end 15 | -------------------------------------------------------------------------------- /lua/modules/configs/ui/todo.lua: -------------------------------------------------------------------------------- 1 | return function() 2 | local icons = { 3 | diagnostics = require("modules.utils.icons").get("diagnostics"), 4 | ui = require("modules.utils.icons").get("ui"), 5 | } 6 | 7 | require("modules.utils").load_plugin("todo-comments", { 8 | signs = false, -- show icons in the signs column 9 | keywords = { 10 | FIX = { 11 | icon = icons.ui.Bug, 12 | color = "error", 13 | alt = { "FIXME", "BUG", "FIXIT", "ISSUE" }, 14 | }, 15 | TODO = { icon = icons.ui.Accepted, color = "info" }, 16 | -- HACK = { icon = icons.ui.Fire, color = "warning" }, 17 | WARN = { icon = icons.diagnostics.Warning, color = "warning", alt = { "WARNING", "XXX" } }, 18 | PERF = { icon = icons.ui.Perf, alt = { "OPTIM", "PERFORMANCE", "OPTIMIZE" } }, 19 | NOTE = { icon = icons.ui.Note, color = "hint", alt = { "INFO" } }, 20 | TEST = { icon = icons.ui.Lock, color = "test", alt = { "TESTING", "PASSED", "FAILED" } }, 21 | }, 22 | gui_style = { 23 | fg = "NONE", 24 | bg = "BOLD", 25 | }, 26 | merge_keywords = true, 27 | highlight = { 28 | multiline = false, 29 | keyword = "wide", -- "fg", "bg", "wide", "wide_bg", "wide_fg" or empty. 30 | after = "", 31 | comments_only = true, 32 | max_line_len = 500, 33 | exclude = { 34 | "alpha", 35 | "bigfile", 36 | "checkhealth", 37 | "dap-repl", 38 | "diff", 39 | "help", 40 | "log", 41 | "notify", 42 | "NvimTree", 43 | "Outline", 44 | "qf", 45 | "TelescopePrompt", 46 | "toggleterm", 47 | "undotree", 48 | }, 49 | }, 50 | colors = { 51 | error = { "DiagnosticError", "ErrorMsg", "#DC2626" }, 52 | warning = { "DiagnosticWarn", "WarningMsg", "#FBBF24" }, 53 | info = { "DiagnosticInfo", "#2563EB" }, 54 | hint = { "DiagnosticHint", "#F5C2E7" }, 55 | default = { "Conditional", "#7C3AED" }, 56 | }, 57 | }) 58 | end 59 | -------------------------------------------------------------------------------- /lua/modules/plugins/completion.lua: -------------------------------------------------------------------------------- 1 | local completion = {} 2 | local use_copilot = require("core.settings").use_copilot 3 | 4 | completion["neovim/nvim-lspconfig"] = { 5 | lazy = true, 6 | event = { "BufReadPre", "BufNewFile" }, 7 | config = require("completion.lsp"), 8 | dependencies = { 9 | { "mason-org/mason.nvim" }, 10 | { "mason-org/mason-lspconfig.nvim" }, 11 | { "folke/neoconf.nvim" }, 12 | { 13 | "Jint-lzxy/lsp_signature.nvim", 14 | config = require("completion.lsp-signature"), 15 | }, 16 | }, 17 | } 18 | completion["nvimdev/lspsaga.nvim"] = { 19 | lazy = true, 20 | event = "LspAttach", 21 | config = require("completion.lspsaga"), 22 | dependencies = { "nvim-tree/nvim-web-devicons" }, 23 | } 24 | completion["DNLHC/glance.nvim"] = { 25 | lazy = true, 26 | event = "LspAttach", 27 | config = require("completion.glance"), 28 | } 29 | completion["joechrisellis/lsp-format-modifications.nvim"] = { 30 | lazy = true, 31 | event = "LspAttach", 32 | } 33 | completion["nvimtools/none-ls.nvim"] = { 34 | lazy = true, 35 | event = { "CursorHold", "CursorHoldI" }, 36 | config = require("completion.null-ls"), 37 | dependencies = { 38 | "nvim-lua/plenary.nvim", 39 | "jay-babu/mason-null-ls.nvim", 40 | }, 41 | } 42 | completion["rachartier/tiny-inline-diagnostic.nvim"] = { 43 | lazy = true, 44 | event = "VeryLazy", 45 | priority = 1000, -- needs to be loaded in first 46 | config = require("completion.tiny-inline-diagnostic"), 47 | } 48 | completion["hrsh7th/nvim-cmp"] = { 49 | lazy = true, 50 | event = "InsertEnter", 51 | config = require("completion.cmp"), 52 | dependencies = { 53 | { 54 | "L3MON4D3/LuaSnip", 55 | build = "make install_jsregexp", 56 | config = require("completion.luasnip"), 57 | dependencies = { "rafamadriz/friendly-snippets" }, 58 | }, 59 | { "lukas-reineke/cmp-under-comparator" }, 60 | { "saadparwaiz1/cmp_luasnip" }, 61 | { "hrsh7th/cmp-nvim-lsp" }, 62 | { "hrsh7th/cmp-nvim-lua" }, 63 | { "andersevenrud/cmp-tmux" }, 64 | { "hrsh7th/cmp-path" }, 65 | { "f3fora/cmp-spell" }, 66 | { "hrsh7th/cmp-buffer" }, 67 | { "kdheepak/cmp-latex-symbols" }, 68 | { "ray-x/cmp-treesitter", commit = "c8e3a74" }, 69 | -- { "tzachar/cmp-tabnine", build = "./install.sh", config = require("completion.tabnine") }, 70 | -- { 71 | -- "jcdickinson/codeium.nvim", 72 | -- dependencies = { 73 | -- "nvim-lua/plenary.nvim", 74 | -- "MunifTanjim/nui.nvim", 75 | -- }, 76 | -- config = require("completion.codeium"), 77 | -- }, 78 | }, 79 | } 80 | if use_copilot then 81 | completion["zbirenbaum/copilot.lua"] = { 82 | lazy = true, 83 | cmd = "Copilot", 84 | event = "InsertEnter", 85 | config = require("completion.copilot"), 86 | dependencies = { 87 | { 88 | "zbirenbaum/copilot-cmp", 89 | config = require("completion.copilot-cmp"), 90 | }, 91 | }, 92 | } 93 | end 94 | 95 | return completion 96 | -------------------------------------------------------------------------------- /lua/modules/plugins/editor.lua: -------------------------------------------------------------------------------- 1 | local editor = {} 2 | 3 | editor["olimorris/persisted.nvim"] = { 4 | lazy = true, 5 | cmd = { 6 | "SessionToggle", 7 | "SessionStart", 8 | "SessionStop", 9 | "SessionSave", 10 | "SessionLoad", 11 | "SessionLoadLast", 12 | "SessionLoadFromFile", 13 | "SessionDelete", 14 | }, 15 | config = require("editor.persisted"), 16 | } 17 | editor["m4xshen/autoclose.nvim"] = { 18 | lazy = true, 19 | event = "InsertEnter", 20 | config = require("editor.autoclose"), 21 | } 22 | editor["pteroctopus/faster.nvim"] = { 23 | lazy = false, 24 | cond = require("core.settings").load_big_files_faster, 25 | } 26 | editor["ojroques/nvim-bufdel"] = { 27 | lazy = true, 28 | cmd = { "BufDel", "BufDelAll", "BufDelOthers" }, 29 | } 30 | -- NOTE: `flash.nvim` is a powerful plugin that can be used as partial or complete replacements for: 31 | -- > `hop.nvim`, 32 | -- > `wilder.nvim` 33 | -- > `nvim-treehopper` 34 | -- Considering its steep learning curve as well as backward compatibility issues... 35 | -- > We have no plan to remove the above plugins for the time being. 36 | -- But as usual, you can always tweak the plugin to your liking. 37 | editor["folke/flash.nvim"] = { 38 | lazy = true, 39 | event = { "CursorHold", "CursorHoldI" }, 40 | config = require("editor.flash"), 41 | } 42 | editor["numToStr/Comment.nvim"] = { 43 | lazy = true, 44 | event = { "CursorHold", "CursorHoldI" }, 45 | config = require("editor.comment"), 46 | } 47 | editor["sindrets/diffview.nvim"] = { 48 | lazy = true, 49 | cmd = { "DiffviewOpen", "DiffviewClose" }, 50 | config = require("editor.diffview"), 51 | } 52 | editor["echasnovski/mini.align"] = { 53 | lazy = true, 54 | event = { "CursorHold", "CursorHoldI" }, 55 | config = require("editor.align"), 56 | } 57 | editor["echasnovski/mini.cursorword"] = { 58 | lazy = true, 59 | event = { "BufReadPost", "BufAdd", "BufNewFile" }, 60 | config = require("editor.cursorword"), 61 | } 62 | editor["smoka7/hop.nvim"] = { 63 | lazy = true, 64 | version = "*", 65 | event = { "CursorHold", "CursorHoldI" }, 66 | config = require("editor.hop"), 67 | } 68 | editor["brenoprata10/nvim-highlight-colors"] = { 69 | lazy = true, 70 | event = { "CursorHold", "CursorHoldI" }, 71 | config = require("editor.highlight-colors"), 72 | } 73 | editor["romainl/vim-cool"] = { 74 | lazy = true, 75 | event = { "CursorMoved", "InsertEnter" }, 76 | } 77 | editor["lambdalisue/suda.vim"] = { 78 | lazy = true, 79 | cmd = { "SudaRead", "SudaWrite" }, 80 | init = require("editor.suda"), 81 | } 82 | editor["tpope/vim-sleuth"] = { 83 | lazy = true, 84 | event = { "BufNewFile", "BufReadPost", "BufFilePost" }, 85 | } 86 | editor["MagicDuck/grug-far.nvim"] = { 87 | lazy = true, 88 | cmd = "GrugFar", 89 | config = require("editor.grug-far"), 90 | } 91 | ---------------------------------------------------------------------- 92 | --  :treesitter related plugins -- 93 | ---------------------------------------------------------------------- 94 | editor["nvim-treesitter/nvim-treesitter"] = { 95 | lazy = true, 96 | build = function() 97 | if #vim.api.nvim_list_uis() > 0 then 98 | vim.api.nvim_command([[TSUpdate]]) 99 | end 100 | end, 101 | event = "BufReadPre", 102 | config = require("editor.treesitter"), 103 | dependencies = { 104 | { "mfussenegger/nvim-treehopper" }, 105 | { "nvim-treesitter/nvim-treesitter-textobjects" }, 106 | { 107 | "andymass/vim-matchup", 108 | init = require("editor.matchup"), 109 | }, 110 | { 111 | "windwp/nvim-ts-autotag", 112 | config = require("editor.autotag"), 113 | }, 114 | { 115 | "hiphish/rainbow-delimiters.nvim", 116 | config = require("editor.rainbow_delims"), 117 | }, 118 | { 119 | "nvim-treesitter/nvim-treesitter-context", 120 | config = require("editor.ts-context"), 121 | }, 122 | { 123 | "JoosepAlviste/nvim-ts-context-commentstring", 124 | config = require("editor.ts-context-commentstring"), 125 | }, 126 | }, 127 | } 128 | 129 | return editor 130 | -------------------------------------------------------------------------------- /lua/modules/plugins/lang.lua: -------------------------------------------------------------------------------- 1 | local lang = {} 2 | 3 | lang["kevinhwang91/nvim-bqf"] = { 4 | lazy = true, 5 | ft = "qf", 6 | config = require("lang.bqf"), 7 | dependencies = { 8 | { "junegunn/fzf", build = ":call fzf#install()" }, 9 | }, 10 | } 11 | lang["ray-x/go.nvim"] = { 12 | lazy = true, 13 | ft = { "go", "gomod", "gosum" }, 14 | build = ":GoInstallBinaries", 15 | config = require("lang.go"), 16 | dependencies = { "ray-x/guihua.lua" }, 17 | } 18 | lang["mrcjkb/rustaceanvim"] = { 19 | lazy = true, 20 | ft = "rust", 21 | version = "*", 22 | init = require("lang.rust"), 23 | dependencies = { "nvim-lua/plenary.nvim" }, 24 | } 25 | lang["Saecki/crates.nvim"] = { 26 | lazy = true, 27 | event = "BufReadPost Cargo.toml", 28 | config = require("lang.crates"), 29 | dependencies = { "nvim-lua/plenary.nvim" }, 30 | } 31 | lang["MeanderingProgrammer/render-markdown.nvim"] = { 32 | lazy = true, 33 | ft = "markdown", 34 | config = require("lang.render-markdown"), 35 | dependencies = { 36 | "nvim-tree/nvim-web-devicons", 37 | "nvim-treesitter/nvim-treesitter", 38 | }, 39 | } 40 | lang["iamcco/markdown-preview.nvim"] = { 41 | lazy = true, 42 | ft = "markdown", 43 | build = ":call mkdp#util#install()", 44 | } 45 | lang["chrisbra/csv.vim"] = { 46 | lazy = true, 47 | ft = "csv", 48 | } 49 | return lang 50 | -------------------------------------------------------------------------------- /lua/modules/plugins/tool.lua: -------------------------------------------------------------------------------- 1 | local tool = {} 2 | local settings = require("core.settings") 3 | 4 | tool["tpope/vim-fugitive"] = { 5 | lazy = true, 6 | cmd = { "Git", "G" }, 7 | } 8 | -- This is specifically for fcitx5 users who code in languages other than English 9 | -- tool["pysan3/fcitx5.nvim"] = { 10 | -- lazy = true, 11 | -- event = "BufReadPost", 12 | -- cond = vim.fn.executable("fcitx5-remote") == 1, 13 | -- config = require("tool.fcitx5"), 14 | -- } 15 | tool["Bekaboo/dropbar.nvim"] = { 16 | lazy = false, 17 | config = require("tool.dropbar"), 18 | dependencies = { 19 | "nvim-tree/nvim-web-devicons", 20 | "nvim-telescope/telescope-fzf-native.nvim", 21 | }, 22 | } 23 | tool["nvim-tree/nvim-tree.lua"] = { 24 | lazy = true, 25 | cmd = { 26 | "NvimTreeToggle", 27 | "NvimTreeOpen", 28 | "NvimTreeFindFile", 29 | "NvimTreeFindFileToggle", 30 | "NvimTreeRefresh", 31 | }, 32 | config = require("tool.nvim-tree"), 33 | } 34 | tool["ibhagwan/smartyank.nvim"] = { 35 | lazy = true, 36 | event = "BufReadPost", 37 | config = require("tool.smartyank"), 38 | } 39 | tool["michaelb/sniprun"] = { 40 | lazy = true, 41 | -- You need to cd to `~/.local/share/nvim/site/lazy/sniprun/` and execute `bash ./install.sh`, 42 | -- if you encountered error about no executable sniprun found. 43 | build = "bash ./install.sh", 44 | cmd = { "SnipRun", "SnipReset", "SnipInfo" }, 45 | config = require("tool.sniprun"), 46 | } 47 | tool["akinsho/toggleterm.nvim"] = { 48 | lazy = true, 49 | cmd = { 50 | "ToggleTerm", 51 | "ToggleTermSetName", 52 | "ToggleTermToggleAll", 53 | "ToggleTermSendVisualLines", 54 | "ToggleTermSendCurrentLine", 55 | "ToggleTermSendVisualSelection", 56 | }, 57 | config = require("tool.toggleterm"), 58 | } 59 | tool["folke/trouble.nvim"] = { 60 | lazy = true, 61 | cmd = { "Trouble", "TroubleToggle", "TroubleRefresh" }, 62 | config = require("tool.trouble"), 63 | } 64 | tool["folke/which-key.nvim"] = { 65 | lazy = true, 66 | event = { "CursorHold", "CursorHoldI" }, 67 | config = require("tool.which-key"), 68 | } 69 | tool["gelguy/wilder.nvim"] = { 70 | lazy = true, 71 | event = "CmdlineEnter", 72 | config = require("tool.wilder"), 73 | dependencies = { "romgrk/fzy-lua-native" }, 74 | } 75 | if settings.search_backend == "fzf" then 76 | -- require fzf binary installed 77 | tool["ibhagwan/fzf-lua"] = { 78 | lazy = true, 79 | event = "VeryLazy", 80 | config = require("tool.fzf-lua"), 81 | } 82 | end 83 | 84 | ---------------------------------------------------------------------- 85 | -- Telescope Plugins -- 86 | ---------------------------------------------------------------------- 87 | tool["nvim-telescope/telescope.nvim"] = { 88 | lazy = true, 89 | cmd = "Telescope", 90 | config = require("tool.telescope"), 91 | dependencies = { 92 | { "nvim-lua/plenary.nvim" }, 93 | { "nvim-tree/nvim-web-devicons" }, 94 | { "jvgrootveld/telescope-zoxide" }, 95 | { "debugloop/telescope-undo.nvim" }, 96 | { "nvim-telescope/telescope-frecency.nvim" }, 97 | { "nvim-telescope/telescope-live-grep-args.nvim" }, 98 | { "nvim-telescope/telescope-fzf-native.nvim", build = "make" }, 99 | { 100 | "ayamir/search.nvim", 101 | config = require("tool.search"), 102 | }, 103 | { 104 | "ayamir/project.nvim", 105 | event = { "CursorHold", "CursorHoldI" }, 106 | config = require("tool.project"), 107 | }, 108 | { 109 | "aaronhallaert/advanced-git-search.nvim", 110 | cmd = { "AdvancedGitSearch" }, 111 | dependencies = { 112 | "tpope/vim-rhubarb", 113 | "tpope/vim-fugitive", 114 | "sindrets/diffview.nvim", 115 | }, 116 | }, 117 | }, 118 | } 119 | 120 | ---------------------------------------------------------------------- 121 | -- DAP Plugins -- 122 | ---------------------------------------------------------------------- 123 | tool["mfussenegger/nvim-dap"] = { 124 | lazy = true, 125 | cmd = { 126 | "DapSetLogLevel", 127 | "DapShowLog", 128 | "DapContinue", 129 | "DapToggleBreakpoint", 130 | "DapToggleRepl", 131 | "DapStepOver", 132 | "DapStepInto", 133 | "DapStepOut", 134 | "DapTerminate", 135 | }, 136 | config = require("tool.dap"), 137 | dependencies = { 138 | { 139 | "rcarriga/nvim-dap-ui", 140 | config = require("tool.dap.dapui"), 141 | dependencies = { 142 | "nvim-neotest/nvim-nio", 143 | }, 144 | }, 145 | { "jay-babu/mason-nvim-dap.nvim" }, 146 | }, 147 | } 148 | 149 | return tool 150 | -------------------------------------------------------------------------------- /lua/modules/plugins/ui.lua: -------------------------------------------------------------------------------- 1 | local ui = {} 2 | 3 | ui["goolord/alpha-nvim"] = { 4 | lazy = true, 5 | event = "BufWinEnter", 6 | config = require("ui.alpha"), 7 | } 8 | ui["akinsho/bufferline.nvim"] = { 9 | lazy = true, 10 | event = { "BufReadPre", "BufAdd", "BufNewFile" }, 11 | config = require("ui.bufferline"), 12 | } 13 | ui["Jint-lzxy/nvim"] = { 14 | lazy = false, 15 | branch = "refactor/syntax-highlighting", 16 | name = "catppuccin", 17 | config = require("ui.catppuccin"), 18 | } 19 | ui["lewis6991/gitsigns.nvim"] = { 20 | lazy = true, 21 | event = { "CursorHold", "CursorHoldI" }, 22 | config = require("ui.gitsigns"), 23 | } 24 | ui["lukas-reineke/indent-blankline.nvim"] = { 25 | lazy = true, 26 | event = { "CursorHold", "CursorHoldI" }, 27 | config = require("ui.indent-blankline"), 28 | } 29 | ui["nvim-lualine/lualine.nvim"] = { 30 | lazy = true, 31 | event = { "BufReadPost", "BufAdd", "BufNewFile" }, 32 | config = require("ui.lualine"), 33 | } 34 | ui["karb94/neoscroll.nvim"] = { 35 | lazy = true, 36 | event = { "CursorHold", "CursorHoldI" }, 37 | config = require("ui.neoscroll"), 38 | } 39 | ui["rcarriga/nvim-notify"] = { 40 | lazy = true, 41 | event = "VeryLazy", 42 | config = require("ui.notify"), 43 | } 44 | ui["folke/paint.nvim"] = { 45 | lazy = true, 46 | event = { "CursorHold", "CursorHoldI" }, 47 | config = require("ui.paint"), 48 | } 49 | ui["mrjones2014/smart-splits.nvim"] = { 50 | lazy = true, 51 | event = { "CursorHoldI", "CursorHold" }, 52 | config = require("ui.splits"), 53 | } 54 | ui["folke/todo-comments.nvim"] = { 55 | lazy = true, 56 | event = { "CursorHold", "CursorHoldI" }, 57 | config = require("ui.todo"), 58 | dependencies = { "nvim-lua/plenary.nvim" }, 59 | } 60 | ui["dstein64/nvim-scrollview"] = { 61 | lazy = true, 62 | event = { "BufReadPost", "BufAdd", "BufNewFile" }, 63 | config = require("ui.scrollview"), 64 | } 65 | ui["folke/edgy.nvim"] = { 66 | lazy = true, 67 | event = { "VeryLazy" }, 68 | config = require("ui.edgy"), 69 | } 70 | 71 | return ui 72 | -------------------------------------------------------------------------------- /lua/modules/utils/dap.lua: -------------------------------------------------------------------------------- 1 | local M = {} 2 | 3 | function M.input_args() 4 | local argument_string = vim.fn.input("Program arg(s) (enter nothing to leave it null): ") 5 | return vim.fn.split(argument_string, " ", true) 6 | end 7 | 8 | function M.input_exec_path() 9 | return vim.fn.input('Path to executable (default to "a.out"): ', vim.fn.expand("%:p:h") .. "/a.out", "file") 10 | end 11 | 12 | function M.input_file_path() 13 | return vim.fn.input("Path to debuggee (default to the current file): ", vim.fn.expand("%:p"), "file") 14 | end 15 | 16 | function M.get_env() 17 | local variables = {} 18 | for k, v in pairs(vim.fn.environ()) do 19 | table.insert(variables, string.format("%s=%s", k, v)) 20 | end 21 | return variables 22 | end 23 | 24 | return setmetatable({}, { 25 | __index = function(_, key) 26 | return function() 27 | return function() 28 | return M[key]() 29 | end 30 | end 31 | end, 32 | }) 33 | -------------------------------------------------------------------------------- /lua/modules/utils/icons.lua: -------------------------------------------------------------------------------- 1 | local icons = {} 2 | 3 | local data = { 4 | kind = { 5 | Break = "󰙧", 6 | Call = "󰃷", 7 | Case = "󰬶", 8 | Class = "󰠱", 9 | Color = "󰏘", 10 | Constant = "󰏿", 11 | Constructor = "", 12 | Continue = "󰞘", 13 | Declaration = "󰙠", 14 | Delete = "󱟁", 15 | Enum = "", 16 | EnumMember = "", 17 | Event = "", 18 | Field = "󰇽", 19 | File = "󰈙", 20 | Folder = "󰉋", 21 | Fragment = "", 22 | Function = "󰊕", 23 | Implementation = "", 24 | Interface = "", 25 | Keyword = "󰌋", 26 | List = "󰅪", 27 | Loop = "󰑖", 28 | Method = "󰆧", 29 | Module = "", 30 | Namespace = "󰌗", 31 | Operator = "󰆕", 32 | Package = "", 33 | Property = "󰜢", 34 | Reference = "", 35 | Regex = "", 36 | Snippet = "", 37 | Statement = "󰅩", 38 | Struct = "", 39 | Switch = "", 40 | Text = "󰉿", 41 | TypeParameter = "󰅲", 42 | Undefined = "", 43 | Unit = "", 44 | Value = "󰎠", 45 | Variable = "", 46 | -- ccls-specific icons 47 | Macro = "", 48 | Parameter = "", 49 | StaticMethod = "", 50 | Terminal = "", 51 | TypeAlias = "", 52 | }, 53 | type = { 54 | Array = "󰅪", 55 | Boolean = "", 56 | Null = "󰟢", 57 | Number = "", 58 | Object = "󰅩", 59 | String = "󰉿", 60 | }, 61 | documents = { 62 | Default = "", 63 | File = "", 64 | Files = "", 65 | FileFind = "󰈞", 66 | FileTree = "󰙅", 67 | Import = "", 68 | Symlink = "", 69 | Word = "", 70 | }, 71 | git = { 72 | Add = "", 73 | Branch = "", 74 | Diff = "", 75 | Git = "󰊢", 76 | Ignore = "", 77 | Mod = "M", 78 | Mod_alt = "", 79 | Remove = "", 80 | Rename = "", 81 | Repo = "", 82 | Unmerged = "󰘬", 83 | Untracked = "󰞋", 84 | Unstaged = "", 85 | Staged = "", 86 | Conflict = "", 87 | }, 88 | ui = { 89 | Accepted = "", 90 | ArrowClosed = "", 91 | ArrowOpen = "", 92 | BigCircle = "", 93 | BigUnfilledCircle = "", 94 | BookMark = "󰃃", 95 | Buffer = "󰓩", 96 | Bug = "", 97 | Calendar = "", 98 | Character = "", 99 | Check = "󰄳", 100 | ChevronRight = "", 101 | Circle = "", 102 | Close = "󰅖", 103 | Close_alt = "", 104 | CloudDownload = "", 105 | CodeAction = "󰌵", 106 | Comment = "󰅺", 107 | Dashboard = "", 108 | DoubleSeparator = "󰄾", 109 | Emoji = "󰱫", 110 | EmptyFolder = "", 111 | EmptyFolderOpen = "", 112 | File = "󰈤", 113 | Fire = "", 114 | Folder = "", 115 | FolderOpen = "", 116 | FolderWithHeart = "󱃪", 117 | Gear = "", 118 | History = "󰄉", 119 | Incoming = "󰏷", 120 | Indicator = "", 121 | Keyboard = "", 122 | Left = "", 123 | List = "", 124 | Lock = "󰍁", 125 | Modified = "✥", 126 | Modified_alt = "", 127 | NewFile = "", 128 | Newspaper = "", 129 | Note = "󰍨", 130 | Outgoing = "󰏻", 131 | Package = "", 132 | Pencil = "󰏫", 133 | Perf = "󰅒", 134 | Play = "", 135 | Project = "", 136 | Right = "", 137 | RootFolderOpened = "", 138 | Search = "󰍉", 139 | Separator = "", 140 | SignIn = "", 141 | SignOut = "", 142 | Sort = "", 143 | Spell = "󰓆", 144 | Square = "", 145 | Symlink = "", 146 | SymlinkFolder = "", 147 | Tab = "", 148 | Table = "", 149 | Telescope = "", 150 | Window = "", 151 | }, 152 | diagnostics = { 153 | Error = "", 154 | Warning = "", 155 | Information = "", 156 | Question = "", 157 | Hint = "󰌵", 158 | -- Hollow version 159 | Error_alt = "󰅚", 160 | Warning_alt = "󰀪", 161 | Information_alt = "", 162 | Question_alt = "", 163 | Hint_alt = "󰌶", 164 | }, 165 | misc = { 166 | Add = "+", 167 | Added = "", 168 | Campass = "󰀹", 169 | Code = "", 170 | Gavel = "", 171 | Ghost = "󰊠", 172 | Glass = "󰂖", 173 | Lego = "", 174 | LspAvailable = "󱜙", 175 | ManUp = "", 176 | Neovim = "", 177 | NoActiveLsp = "󱚧", 178 | PyEnv = "󰢩", 179 | Squirrel = "", 180 | Tag = "", 181 | Tree = "", 182 | Vbar = "│", 183 | Vim = "", 184 | Watch = "", 185 | }, 186 | cmp = { 187 | buffer = "󰉿", 188 | latex_symbols = "", 189 | luasnip = "󰃐", 190 | nvim_lsp = "", 191 | nvim_lua = "", 192 | orgmode = "", 193 | path = "", 194 | spell = "󰓆", 195 | tmux = "", 196 | treesitter = "", 197 | undefined = "", 198 | -- Add source-specific icons here 199 | codeium = "", 200 | Codeium = "", 201 | copilot = "", 202 | copilot_alt = "", 203 | Copilot = "", 204 | Copilot_alt = "", 205 | TabNine = "", 206 | cmp_tabnine = "", 207 | }, 208 | dap = { 209 | Breakpoint = "󰝥", 210 | BreakpointCondition = "󰟃", 211 | BreakpointRejected = "", 212 | LogPoint = "", 213 | Pause = "", 214 | Play = "", 215 | RunLast = "↻", 216 | StepBack = "", 217 | StepInto = "󰆹", 218 | StepOut = "󰆸", 219 | StepOver = "󰆷", 220 | Stopped = "", 221 | Terminate = "󰝤", 222 | }, 223 | } 224 | 225 | ---Get a specific icon set. 226 | ---@param category "kind"|"type"|"documents"|"git"|"ui"|"diagnostics"|"misc"|"cmp"|"dap" 227 | ---@param add_space? boolean @Add trailing whitespace after the icon. 228 | function icons.get(category, add_space) 229 | if add_space then 230 | return setmetatable({}, { 231 | __index = function(_, key) 232 | return data[category][key] .. " " 233 | end, 234 | }) 235 | else 236 | return data[category] 237 | end 238 | end 239 | 240 | return icons 241 | -------------------------------------------------------------------------------- /lua/modules/utils/keymap.lua: -------------------------------------------------------------------------------- 1 | local M = {} 2 | 3 | ---Shortcut for `nvim_replace_termcodes`. 4 | ---@param keys string 5 | ---@return string 6 | local function termcodes(keys) 7 | return vim.api.nvim_replace_termcodes(keys, true, true, true) 8 | end 9 | 10 | ---Returns if two key sequence are equal or not. 11 | ---@param a string 12 | ---@param b string 13 | ---@return boolean 14 | local function keymap_equals(a, b) 15 | return termcodes(a) == termcodes(b) 16 | end 17 | 18 | ---Get map 19 | ---@param mode string 20 | ---@param lhs string 21 | ---@return table 22 | local function get_map(mode, lhs) 23 | for _, map in ipairs(vim.api.nvim_buf_get_keymap(0, mode)) do 24 | if keymap_equals(map.lhs, lhs) then 25 | vim.api.nvim_buf_del_keymap(0, mode, lhs) 26 | return { 27 | lhs = map.lhs, 28 | rhs = map.rhs or "", 29 | expr = map.expr == 1, 30 | callback = map.callback, 31 | noremap = map.noremap == 1, 32 | script = map.script == 1, 33 | silent = map.silent == 1, 34 | nowait = map.nowait == 1, 35 | buffer = true, 36 | } 37 | end 38 | end 39 | 40 | for _, map in ipairs(vim.api.nvim_get_keymap(mode)) do 41 | if keymap_equals(map.lhs, lhs) then 42 | vim.api.nvim_del_keymap(mode, lhs) 43 | return { 44 | lhs = map.lhs, 45 | rhs = map.rhs or "", 46 | expr = map.expr == 1, 47 | callback = map.callback, 48 | noremap = map.noremap == 1, 49 | script = map.script == 1, 50 | silent = map.silent == 1, 51 | nowait = map.nowait == 1, 52 | buffer = false, 53 | } 54 | end 55 | end 56 | 57 | return { 58 | lhs = lhs, 59 | rhs = lhs, 60 | expr = false, 61 | callback = nil, 62 | noremap = true, 63 | script = false, 64 | silent = true, 65 | nowait = false, 66 | buffer = false, 67 | } 68 | end 69 | 70 | ---Returns the function constructed from the passed keymap object on call of 71 | ---which the original keymapping will be executed. 72 | ---@param map table keymap object 73 | ---@return function 74 | local function get_fallback(map) 75 | return function() 76 | local keys, fmode 77 | if map.expr then 78 | if map.callback then 79 | keys = map.callback() 80 | else 81 | keys = vim.api.nvim_eval(map.rhs) 82 | end 83 | elseif map.callback then 84 | map.callback() 85 | return 86 | else 87 | keys = map.rhs 88 | end 89 | keys = termcodes(keys) 90 | fmode = map.noremap and "in" or "im" 91 | vim.api.nvim_feedkeys(keys, fmode, false) 92 | end 93 | end 94 | 95 | -- Amends a mapping (i.e., allows fallback when certain conditions are met) 96 | ---@param cond string 97 | ---@param mode string 98 | ---@param lhs string 99 | ---@param rhs function 100 | ---@param opts? table 101 | local function amend(cond, mode, lhs, rhs, opts) 102 | local map = get_map(mode, lhs) 103 | local fallback = get_fallback(map) 104 | local options = vim.deepcopy(opts) or {} 105 | options.desc = table.concat({ 106 | "[" .. cond, 107 | (options.desc and ": " .. options.desc or ""), 108 | "]", 109 | (map.desc and " / " .. map.desc or ""), 110 | }) 111 | vim.keymap.set(mode, lhs, function() 112 | rhs(fallback) 113 | end, options) 114 | end 115 | 116 | -- Completely replace a mapping 117 | ---@param mode string 118 | ---@param lhs string 119 | ---@param rhs string 120 | ---@param opts? table 121 | ---@param buf? boolean|number 122 | local function replace(mode, lhs, rhs, opts, buf) 123 | get_map(mode, lhs) 124 | 125 | local options = vim.deepcopy(opts) or {} 126 | if buf and type(buf) == "number" then 127 | vim.api.nvim_buf_set_keymap(buf, mode, lhs, rhs, options) 128 | else 129 | vim.api.nvim_set_keymap(mode, lhs, rhs, options) 130 | end 131 | end 132 | 133 | ---Amend the existing keymap. 134 | ---@param cond string 135 | ---@param mode string | string[] 136 | ---@param lhs string 137 | ---@param rhs function 138 | ---@param opts? table 139 | local function modes_amend(cond, mode, lhs, rhs, opts) 140 | if type(mode) == "table" then 141 | for _, m in ipairs(mode) do 142 | amend(cond, m, lhs, rhs, opts) 143 | end 144 | else 145 | amend(cond, mode, lhs, rhs, opts) 146 | end 147 | end 148 | 149 | ---Replace the existing keymap. 150 | ---@param mode string | string[] 151 | ---@param lhs string 152 | ---@param rhs string 153 | ---@param opts? table 154 | ---@param buf? boolean|number 155 | local function modes_replace(mode, lhs, rhs, opts, buf) 156 | if type(mode) == "table" then 157 | for _, m in ipairs(mode) do 158 | replace(m, lhs, rhs, opts, buf) 159 | end 160 | else 161 | replace(mode, lhs, rhs, opts, buf) 162 | end 163 | end 164 | 165 | ---Amend the existing keymap. 166 | ---@param cond string 167 | ---@param global_flag string 168 | ---@param mapping table 169 | function M.amend(cond, global_flag, mapping) 170 | for key, value in pairs(mapping) do 171 | local modes, keymap = key:match("([^|]*)|?(.*)") 172 | if type(value) == "table" then 173 | local rhs = value.cmd 174 | local options = value.options 175 | modes_amend(cond, vim.split(modes, ""), keymap, function(fallback) 176 | if _G[global_flag] then 177 | local fmode = options.noremap and "in" or "im" 178 | vim.api.nvim_feedkeys(termcodes(rhs), fmode, false) 179 | else 180 | fallback() 181 | end 182 | end, options) 183 | end 184 | end 185 | end 186 | 187 | ---Replace the existing keymap. 188 | ---@param mapping table 189 | function M.replace(mapping) 190 | for key, value in pairs(mapping) do 191 | local modes, keymap = key:match("([^|]*)|?(.*)") 192 | if type(value) == "table" then 193 | local rhs = value.cmd 194 | local options = value.options 195 | local buffer = value.buffer 196 | modes_replace(vim.split(modes, ""), keymap, rhs, options, buffer) 197 | elseif value == "" or value == false then 198 | for _, m in ipairs(vim.split(modes, "")) do 199 | get_map(m, keymap) 200 | end 201 | end 202 | end 203 | end 204 | 205 | return M 206 | -------------------------------------------------------------------------------- /lua/user_template/configs/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ayamir/nvimdots/72eee314b221e11a01dd5dcaa95c155ad3a34ae8/lua/user_template/configs/.gitkeep -------------------------------------------------------------------------------- /lua/user_template/configs/dap-clients/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ayamir/nvimdots/72eee314b221e11a01dd5dcaa95c155ad3a34ae8/lua/user_template/configs/dap-clients/.gitkeep -------------------------------------------------------------------------------- /lua/user_template/configs/formatters/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ayamir/nvimdots/72eee314b221e11a01dd5dcaa95c155ad3a34ae8/lua/user_template/configs/formatters/.gitkeep -------------------------------------------------------------------------------- /lua/user_template/configs/lsp-servers/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ayamir/nvimdots/72eee314b221e11a01dd5dcaa95c155ad3a34ae8/lua/user_template/configs/lsp-servers/.gitkeep -------------------------------------------------------------------------------- /lua/user_template/event.lua: -------------------------------------------------------------------------------- 1 | local definitions = { 2 | -- Example 3 | bufs = { 4 | { "BufWritePre", "COMMIT_EDITMSG", "setlocal noundofile" }, 5 | }, 6 | } 7 | 8 | return definitions 9 | -------------------------------------------------------------------------------- /lua/user_template/keymap/completion.lua: -------------------------------------------------------------------------------- 1 | local mappings = {} 2 | 3 | -- Place global keymaps here. 4 | mappings["plug_map"] = {} 5 | 6 | -- NOTE: This function is special! Keymaps defined here are ONLY effective in buffers with LSP(s) attached 7 | -- NOTE: Make sure to include `:with_buffer(buf)` to limit the scope of your mappings. 8 | ---@param buf number @The effective bufnr 9 | mappings["lsp"] = function(buf) 10 | return { 11 | -- Example 12 | ["n|K"] = require("keymap.bind").map_cr("Lspsaga hover_doc"):with_buffer(buf):with_desc("lsp: Show doc"), 13 | } 14 | end 15 | 16 | return mappings 17 | -------------------------------------------------------------------------------- /lua/user_template/keymap/core.lua: -------------------------------------------------------------------------------- 1 | return {} 2 | -------------------------------------------------------------------------------- /lua/user_template/keymap/editor.lua: -------------------------------------------------------------------------------- 1 | return {} 2 | -------------------------------------------------------------------------------- /lua/user_template/keymap/init.lua: -------------------------------------------------------------------------------- 1 | return vim.tbl_extend( 2 | "force", 3 | require("user.keymap.core"), 4 | require("user.keymap.completion").plug_map, 5 | require("user.keymap.editor"), 6 | require("user.keymap.lang"), 7 | require("user.keymap.tool"), 8 | require("user.keymap.ui") 9 | ) 10 | -------------------------------------------------------------------------------- /lua/user_template/keymap/lang.lua: -------------------------------------------------------------------------------- 1 | return {} 2 | -------------------------------------------------------------------------------- /lua/user_template/keymap/tool.lua: -------------------------------------------------------------------------------- 1 | return {} 2 | -------------------------------------------------------------------------------- /lua/user_template/keymap/ui.lua: -------------------------------------------------------------------------------- 1 | return {} 2 | -------------------------------------------------------------------------------- /lua/user_template/options.lua: -------------------------------------------------------------------------------- 1 | local options = { 2 | -- Example 3 | autoindent = true, 4 | } 5 | 6 | return options 7 | -------------------------------------------------------------------------------- /lua/user_template/plugins/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ayamir/nvimdots/72eee314b221e11a01dd5dcaa95c155ad3a34ae8/lua/user_template/plugins/.gitkeep -------------------------------------------------------------------------------- /lua/user_template/settings.lua: -------------------------------------------------------------------------------- 1 | -- Please check `lua/core/settings.lua` to view the full list of configurable settings 2 | local settings = {} 3 | 4 | -- Examples 5 | settings["use_ssh"] = true 6 | 7 | settings["colorscheme"] = "catppuccin" 8 | 9 | return settings 10 | -------------------------------------------------------------------------------- /lua/user_template/snips/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ayamir/nvimdots/72eee314b221e11a01dd5dcaa95c155ad3a34ae8/lua/user_template/snips/.gitkeep -------------------------------------------------------------------------------- /nixos/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | imports = [ 3 | ./neovim 4 | ]; 5 | } 6 | -------------------------------------------------------------------------------- /nixos/testEnv.nix: -------------------------------------------------------------------------------- 1 | { inputs, pkgs, ... }: 2 | let 3 | testSettings = 4 | { config, ... }: 5 | { 6 | warnings = [ 7 | "home-manager version: ${config.home.version.release}" 8 | ]; 9 | home = { 10 | username = "hm-user"; 11 | homeDirectory = "/home/hm-user"; 12 | stateVersion = config.home.version.release; 13 | }; 14 | xdg.enable = true; 15 | programs = { 16 | home-manager.enable = true; 17 | git.enable = true; 18 | neovim = { 19 | enable = true; 20 | nvimdots = { 21 | enable = true; 22 | setBuildEnv = true; 23 | withBuildTools = true; 24 | withHaskell = true; 25 | }; 26 | }; 27 | }; 28 | }; 29 | in 30 | inputs.home-manager.lib.homeManagerConfiguration { 31 | inherit pkgs; 32 | modules = [ 33 | ./default.nix 34 | testSettings 35 | ]; 36 | } 37 | -------------------------------------------------------------------------------- /snips/snippets/c.json: -------------------------------------------------------------------------------- 1 | { 2 | "fori": { 3 | "prefix": "fori", 4 | "body": [ 5 | "for (${1:int} ${2:i} = ${3:0}; $2 < ${4:length}; ++$2) {", 6 | "\t$0", 7 | "}" 8 | ], 9 | "description": "Code snippet for 'fori' loop" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /snips/snippets/cpp.json: -------------------------------------------------------------------------------- 1 | { 2 | "solu": { 3 | "prefix": "solu", 4 | "body": [ 5 | "class Solution", 6 | "{", 7 | "public:", 8 | "\t$1 $2($3) {", 9 | "\t\t$4", 10 | "\t}", 11 | "};" 12 | ], 13 | "description": "leetcode class Solution template" 14 | }, 15 | "lc": { 16 | "prefix": "lc", 17 | "body": [ 18 | "#include ", 19 | "", 20 | "using namespace std;", 21 | "", 22 | "class Solution", 23 | "{", 24 | "public:", 25 | "\t$1 $2($3) {", 26 | "\t\t$4", 27 | "\t}", 28 | "};", 29 | "", 30 | "int main(int argc, char *argv[]) {", 31 | "\tSolution s;", 32 | "\treturn 0;", 33 | "}" 34 | ], 35 | "description": "leetcode template" 36 | }, 37 | "hdef": { 38 | "prefix": "hdef", 39 | "body": [ 40 | "#ifndef $1", 41 | "#define $1", 42 | "", 43 | "#endif // $1" 44 | ], 45 | "description": "header file definitions" 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /snips/snippets/go.json: -------------------------------------------------------------------------------- 1 | { 2 | "map declaration": { 3 | "prefix": "map", 4 | "body": "map[${1:type}]${2:type}", 5 | "description": "Snippet for a map" 6 | }, 7 | "goroutine anonymous function": { 8 | "prefix": "go", 9 | "body": "go func($1) {\n\t$0\n}($2)", 10 | "description": "Snippet for anonymous goroutine declaration" 11 | }, 12 | "goroutine function": { 13 | "prefix": "gf", 14 | "body": "go ${1:func}($0)", 15 | "description": "Snippet for goroutine declaration" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /stylua.toml: -------------------------------------------------------------------------------- 1 | column_width = 120 2 | line_endings = "Unix" 3 | indent_type = "Tabs" 4 | indent_width = 4 5 | quote_style = "AutoPreferDouble" 6 | call_parentheses = "Always" 7 | --------------------------------------------------------------------------------