diff options
| -rw-r--r-- | LICENCE | 204 | ||||
| -rw-r--r-- | README.md | 33 | ||||
| -rw-r--r-- | init.lua | 13 | ||||
| -rw-r--r-- | lua/config/editor.lua | 137 | ||||
| -rw-r--r-- | lua/config/lsp.lua | 108 | ||||
| -rw-r--r-- | lua/config/packer.lua | 115 |
6 files changed, 380 insertions, 230 deletions
| @@ -0,0 +1,204 @@ | |||
| 1 | Neovim is licensed under the terms of the Apache 2.0 license, except for | ||
| 2 | parts of Neovim that were contributed under the Vim license (see below). | ||
| 3 | |||
| 4 | Apache License | ||
| 5 | Version 2.0, January 2004 | ||
| 6 | http://www.apache.org/licenses/ | ||
| 7 | |||
| 8 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION | ||
| 9 | |||
| 10 | 1. Definitions. | ||
| 11 | |||
| 12 | "License" shall mean the terms and conditions for use, reproduction, | ||
| 13 | and distribution as defined by Sections 1 through 9 of this document. | ||
| 14 | |||
| 15 | "Licensor" shall mean the copyright owner or entity authorized by | ||
| 16 | the copyright owner that is granting the License. | ||
| 17 | |||
| 18 | "Legal Entity" shall mean the union of the acting entity and all | ||
| 19 | other entities that control, are controlled by, or are under common | ||
| 20 | control with that entity. For the purposes of this definition, | ||
| 21 | "control" means (i) the power, direct or indirect, to cause the | ||
| 22 | direction or management of such entity, whether by contract or | ||
| 23 | otherwise, or (ii) ownership of fifty percent (50%) or more of the | ||
| 24 | outstanding shares, or (iii) beneficial ownership of such entity. | ||
| 25 | |||
| 26 | "You" (or "Your") shall mean an individual or Legal Entity | ||
| 27 | exercising permissions granted by this License. | ||
| 28 | |||
| 29 | "Source" form shall mean the preferred form for making modifications, | ||
| 30 | including but not limited to software source code, documentation | ||
| 31 | source, and configuration files. | ||
| 32 | |||
| 33 | "Object" form shall mean any form resulting from mechanical | ||
| 34 | transformation or translation of a Source form, including but | ||
| 35 | not limited to compiled object code, generated documentation, | ||
| 36 | and conversions to other media types. | ||
| 37 | |||
| 38 | "Work" shall mean the work of authorship, whether in Source or | ||
| 39 | Object form, made available under the License, as indicated by a | ||
| 40 | copyright notice that is included in or attached to the work | ||
| 41 | (an example is provided in the Appendix below). | ||
| 42 | |||
| 43 | "Derivative Works" shall mean any work, whether in Source or Object | ||
| 44 | form, that is based on (or derived from) the Work and for which the | ||
| 45 | editorial revisions, annotations, elaborations, or other modifications | ||
| 46 | represent, as a whole, an original work of authorship. For the purposes | ||
| 47 | of this License, Derivative Works shall not include works that remain | ||
| 48 | separable from, or merely link (or bind by name) to the interfaces of, | ||
| 49 | the Work and Derivative Works thereof. | ||
| 50 | |||
| 51 | "Contribution" shall mean any work of authorship, including | ||
| 52 | the original version of the Work and any modifications or additions | ||
| 53 | to that Work or Derivative Works thereof, that is intentionally | ||
| 54 | submitted to Licensor for inclusion in the Work by the copyright owner | ||
| 55 | or by an individual or Legal Entity authorized to submit on behalf of | ||
| 56 | the copyright owner. For the purposes of this definition, "submitted" | ||
| 57 | means any form of electronic, verbal, or written communication sent | ||
| 58 | to the Licensor or its representatives, including but not limited to | ||
| 59 | communication on electronic mailing lists, source code control systems, | ||
| 60 | and issue tracking systems that are managed by, or on behalf of, the | ||
| 61 | Licensor for the purpose of discussing and improving the Work, but | ||
| 62 | excluding communication that is conspicuously marked or otherwise | ||
| 63 | designated in writing by the copyright owner as "Not a Contribution." | ||
| 64 | |||
| 65 | "Contributor" shall mean Licensor and any individual or Legal Entity | ||
| 66 | on behalf of whom a Contribution has been received by Licensor and | ||
| 67 | subsequently incorporated within the Work. | ||
| 68 | |||
| 69 | 2. Grant of Copyright License. Subject to the terms and conditions of | ||
| 70 | this License, each Contributor hereby grants to You a perpetual, | ||
| 71 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable | ||
| 72 | copyright license to reproduce, prepare Derivative Works of, | ||
| 73 | publicly display, publicly perform, sublicense, and distribute the | ||
| 74 | Work and such Derivative Works in Source or Object form. | ||
| 75 | |||
| 76 | 3. Grant of Patent License. Subject to the terms and conditions of | ||
| 77 | this License, each Contributor hereby grants to You a perpetual, | ||
| 78 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable | ||
| 79 | (except as stated in this section) patent license to make, have made, | ||
| 80 | use, offer to sell, sell, import, and otherwise transfer the Work, | ||
| 81 | where such license applies only to those patent claims licensable | ||
| 82 | by such Contributor that are necessarily infringed by their | ||
| 83 | Contribution(s) alone or by combination of their Contribution(s) | ||
| 84 | with the Work to which such Contribution(s) was submitted. If You | ||
| 85 | institute patent litigation against any entity (including a | ||
| 86 | cross-claim or counterclaim in a lawsuit) alleging that the Work | ||
| 87 | or a Contribution incorporated within the Work constitutes direct | ||
| 88 | or contributory patent infringement, then any patent licenses | ||
| 89 | granted to You under this License for that Work shall terminate | ||
| 90 | as of the date such litigation is filed. | ||
| 91 | |||
| 92 | 4. Redistribution. You may reproduce and distribute copies of the | ||
| 93 | Work or Derivative Works thereof in any medium, with or without | ||
| 94 | modifications, and in Source or Object form, provided that You | ||
| 95 | meet the following conditions: | ||
| 96 | |||
| 97 | (a) You must give any other recipients of the Work or | ||
| 98 | Derivative Works a copy of this License; and | ||
| 99 | |||
| 100 | (b) You must cause any modified files to carry prominent notices | ||
| 101 | stating that You changed the files; and | ||
| 102 | |||
| 103 | (c) You must retain, in the Source form of any Derivative Works | ||
| 104 | that You distribute, all copyright, patent, trademark, and | ||
| 105 | attribution notices from the Source form of the Work, | ||
| 106 | excluding those notices that do not pertain to any part of | ||
| 107 | the Derivative Works; and | ||
| 108 | |||
| 109 | (d) If the Work includes a "NOTICE" text file as part of its | ||
| 110 | distribution, then any Derivative Works that You distribute must | ||
| 111 | include a readable copy of the attribution notices contained | ||
| 112 | within such NOTICE file, excluding those notices that do not | ||
| 113 | pertain to any part of the Derivative Works, in at least one | ||
| 114 | of the following places: within a NOTICE text file distributed | ||
| 115 | as part of the Derivative Works; within the Source form or | ||
| 116 | documentation, if provided along with the Derivative Works; or, | ||
| 117 | within a display generated by the Derivative Works, if and | ||
| 118 | wherever such third-party notices normally appear. The contents | ||
| 119 | of the NOTICE file are for informational purposes only and | ||
| 120 | do not modify the License. You may add Your own attribution | ||
| 121 | notices within Derivative Works that You distribute, alongside | ||
| 122 | or as an addendum to the NOTICE text from the Work, provided | ||
| 123 | that such additional attribution notices cannot be construed | ||
| 124 | as modifying the License. | ||
| 125 | |||
| 126 | You may add Your own copyright statement to Your modifications and | ||
| 127 | may provide additional or different license terms and conditions | ||
| 128 | for use, reproduction, or distribution of Your modifications, or | ||
| 129 | for any such Derivative Works as a whole, provided Your use, | ||
| 130 | reproduction, and distribution of the Work otherwise complies with | ||
| 131 | the conditions stated in this License. | ||
| 132 | |||
| 133 | 5. Submission of Contributions. Unless You explicitly state otherwise, | ||
| 134 | any Contribution intentionally submitted for inclusion in the Work | ||
| 135 | by You to the Licensor shall be under the terms and conditions of | ||
| 136 | this License, without any additional terms or conditions. | ||
| 137 | Notwithstanding the above, nothing herein shall supersede or modify | ||
| 138 | the terms of any separate license agreement you may have executed | ||
| 139 | with Licensor regarding such Contributions. | ||
| 140 | |||
| 141 | 6. Trademarks. This License does not grant permission to use the trade | ||
| 142 | names, trademarks, service marks, or product names of the Licensor, | ||
| 143 | except as required for reasonable and customary use in describing the | ||
| 144 | origin of the Work and reproducing the content of the NOTICE file. | ||
| 145 | |||
| 146 | 7. Disclaimer of Warranty. Unless required by applicable law or | ||
| 147 | agreed to in writing, Licensor provides the Work (and each | ||
| 148 | Contributor provides its Contributions) on an "AS IS" BASIS, | ||
| 149 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or | ||
| 150 | implied, including, without limitation, any warranties or conditions | ||
| 151 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A | ||
| 152 | PARTICULAR PURPOSE. You are solely responsible for determining the | ||
| 153 | appropriateness of using or redistributing the Work and assume any | ||
| 154 | risks associated with Your exercise of permissions under this License. | ||
| 155 | |||
| 156 | 8. Limitation of Liability. In no event and under no legal theory, | ||
| 157 | whether in tort (including negligence), contract, or otherwise, | ||
| 158 | unless required by applicable law (such as deliberate and grossly | ||
| 159 | negligent acts) or agreed to in writing, shall any Contributor be | ||
| 160 | liable to You for damages, including any direct, indirect, special, | ||
| 161 | incidental, or consequential damages of any character arising as a | ||
| 162 | result of this License or out of the use or inability to use the | ||
| 163 | Work (including but not limited to damages for loss of goodwill, | ||
| 164 | work stoppage, computer failure or malfunction, or any and all | ||
| 165 | other commercial damages or losses), even if such Contributor | ||
| 166 | has been advised of the possibility of such damages. | ||
| 167 | |||
| 168 | 9. Accepting Warranty or Additional Liability. While redistributing | ||
| 169 | the Work or Derivative Works thereof, You may choose to offer, | ||
| 170 | and charge a fee for, acceptance of support, warranty, indemnity, | ||
| 171 | or other liability obligations and/or rights consistent with this | ||
| 172 | License. However, in accepting such obligations, You may act only | ||
| 173 | on Your own behalf and on Your sole responsibility, not on behalf | ||
| 174 | of any other Contributor, and only if You agree to indemnify, | ||
| 175 | defend, and hold each Contributor harmless for any liability | ||
| 176 | incurred by, or claims asserted against, such Contributor by reason | ||
| 177 | of your accepting any such warranty or additional liability. | ||
| 178 | |||
| 179 | END OF TERMS AND CONDITIONS | ||
| 180 | |||
| 181 | APPENDIX: How to apply the Apache License to your work. | ||
| 182 | |||
| 183 | To apply the Apache License to your work, attach the following | ||
| 184 | boilerplate notice, with the fields enclosed by brackets "[]" | ||
| 185 | replaced with your own identifying information. (Don't include | ||
| 186 | the brackets!) The text should be enclosed in the appropriate | ||
| 187 | comment syntax for the file format. We also recommend that a | ||
| 188 | file or class name and description of purpose be included on the | ||
| 189 | same "printed page" as the copyright notice for easier | ||
| 190 | identification within third-party archives. | ||
| 191 | |||
| 192 | Copyright [yyyy] [name of copyright owner] | ||
| 193 | |||
| 194 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 195 | you may not use this file except in compliance with the License. | ||
| 196 | You may obtain a copy of the License at | ||
| 197 | |||
| 198 | http://www.apache.org/licenses/LICENSE-2.0 | ||
| 199 | |||
| 200 | Unless required by applicable law or agreed to in writing, software | ||
| 201 | distributed under the License is distributed on an "AS IS" BASIS, | ||
| 202 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 203 | See the License for the specific language governing permissions and | ||
| 204 | limitations under the License. | ||
| @@ -1,25 +1,35 @@ | |||
| 1 | # My Neovim Config | 1 | # Overview |
| 2 | |||
| 2 |  | 3 |  |
| 3 | 4 | ||
| 4 | ### Introduction | 5 | ### Installation |
| 6 | |||
| 5 | Run checkhealth in your Neovim | 7 | Run checkhealth in your Neovim |
| 8 | |||
| 6 | ```vim | 9 | ```vim |
| 7 | :checkhealth | 10 | :checkhealth |
| 8 | ``` | 11 | ``` |
| 9 | Make sure you analyzed the output properly: | 12 | |
| 10 | - Your neovim must be >= 0.7.0 to run this config | 13 | Make sure you analyzed the output properly: |
| 14 | |||
| 15 | - Your neovim must be >= 0.7.0 to run this config | ||
| 11 | - You need to setup [Packer](https://github.com/wbthomason/packer.nvim) | 16 | - You need to setup [Packer](https://github.com/wbthomason/packer.nvim) |
| 17 | |||
| 12 | ```vim | 18 | ```vim |
| 13 | git clone --depth 1 https://github.com/wbthomason/packer.nvim\ | 19 | git clone --depth 1 https://github.com/wbthomason/packer.nvim\ |
| 14 | ~/.local/share/nvim/site/pack/packer/start/packer.nvim | 20 | ~/.local/share/nvim/site/pack/packer/start/packer.nvim |
| 15 | ``` | 21 | ``` |
| 16 | - You should install global python provider | 22 | |
| 23 | - You should install global python provider | ||
| 24 | |||
| 17 | ```python | 25 | ```python |
| 18 | pip install pynvim | 26 | pip install pynvim |
| 19 | ``` | 27 | ``` |
| 20 | - You should install clipboard tool (I use xclip but you can use something diffrent) | 28 | |
| 29 | - You should install clipboard tool (I use xclip but you can use something diffrent) | ||
| 21 | 30 | ||
| 22 | ### Installation | 31 | ### Installation |
| 32 | |||
| 23 | > Easy way | 33 | > Easy way |
| 24 | 34 | ||
| 25 | You can just clone this repo to your .config folder | 35 | You can just clone this repo to your .config folder |
| @@ -27,18 +37,21 @@ You can just clone this repo to your .config folder | |||
| 27 | ```bash | 37 | ```bash |
| 28 | git clone https://github.com/dsrcr/nvim ~/.config | 38 | git clone https://github.com/dsrcr/nvim ~/.config |
| 29 | ``` | 39 | ``` |
| 40 | |||
| 30 | > Recommended way | 41 | > Recommended way |
| 31 | 42 | ||
| 32 | I use gnu-stow to manage my dotfiles, so I encourage you to use it too. | 43 | I use gnu-stow to manage my dotfiles, so I encourage you to use it too. |
| 33 | 44 | ||
| 34 | Use your package manage of choice to get stow, for example: | 45 | Use your package manage of choice to get stow, for example: |
| 35 | 46 | ||
| 36 | ```bash | 47 | ```bash |
| 37 | paru -S stow | 48 | paru -S stow |
| 38 | ``` | 49 | ``` |
| 50 | |||
| 39 | Clone this repo to your prefered dir and use stow to symlink | 51 | Clone this repo to your prefered dir and use stow to symlink |
| 40 | 52 | ||
| 41 | In order to do this you need an empty nvim directory in your .config folder | 53 | In order to do this you need an empty nvim directory in your .config folder |
| 54 | |||
| 42 | ```bash | 55 | ```bash |
| 43 | cd ~/.config | 56 | cd ~/.config |
| 44 | mkdir nvim | 57 | mkdir nvim |
| @@ -53,14 +66,20 @@ The last step is running this command in your neovim | |||
| 53 | ```vim | 66 | ```vim |
| 54 | :PackerSync | 67 | :PackerSync |
| 55 | ``` | 68 | ``` |
| 69 | |||
| 56 | This command should pull everything you need | 70 | This command should pull everything you need |
| 57 | 71 | ||
| 58 | In the next step you will encounter a lot of errors, but don't worry about it. | 72 | In the next step you will encounter a lot of errors, but don't worry about it. |
| 59 | Packer needs to pull specific plugins and then you need to install Treesitter's support for specific filetypes eg. lua, rust.... etc. | 73 | Packer needs to pull specific plugins and then you need to install Treesitter's support for specific filetypes eg. lua, rust.... etc. |
| 74 | |||
| 60 | ```bash | 75 | ```bash |
| 61 | :TSUpdate | 76 | :TSUpdate |
| 62 | ``` | 77 | ``` |
| 78 | |||
| 63 | ```bash | 79 | ```bash |
| 64 | :TSInstall | 80 | :TSInstall |
| 65 | ``` | 81 | ``` |
| 66 | 82 | ||
| 83 | ### Further development | ||
| 84 | |||
| 85 | This is the only text editor on my system, so I'll be adding updates as long as I find something better(not gonna happen soon) | ||
| @@ -1,17 +1,8 @@ | |||
| 1 | -- ________ _________ _____ .__ ____ | ||
| 2 | -- \______ \ / _____/ ____ ____ ____ _/ ____\|__| / ___\ | ||
| 3 | -- | | \ \_____ \ _/ ___\ / _ \ / \\ __\ | | / /_/ > | ||
| 4 | -- | ` \ / \\ \___( <_> )| | \| | | | \___ / | ||
| 5 | -- /_______ //_______ / \___ >\____/ |___| /|__| |__|/_____/ | ||
| 6 | -- \/ \/ \/ \/ | ||
| 7 | -- Starting point for my neovim setup | ||
| 8 | -- https://github.com/dsrcr/nvim | ||
| 9 | |||
| 10 | --Open this file if you want to add new plugins | 1 | --Open this file if you want to add new plugins |
| 11 | require("config.packer") | 2 | require("config.packer") |
| 12 | 3 | ||
| 13 | -- You can find here stuff related to lsp | 4 | -- Here you can find stuff related to lsp |
| 14 | require("config.lsp") | 5 | require("config.lsp") |
| 15 | 6 | ||
| 16 | -- You can customize editor | 7 | -- And there goes editor customization |
| 17 | require("config.editor") | 8 | require("config.editor") |
diff --git a/lua/config/editor.lua b/lua/config/editor.lua index 9594778..daff2ad 100644 --- a/lua/config/editor.lua +++ b/lua/config/editor.lua | |||
| @@ -1,35 +1,30 @@ | |||
| 1 | local js_based_languages = { "typescript", "javascript", "typescriptreact", "javascriptreact" } | 1 | local js_based_languages = { "typescript", "javascript", "typescriptreact", "javascriptreact" } |
| 2 | local option = vim.opt; | 2 | local option = vim.opt |
| 3 | local keymap = vim.keymap; | 3 | local keymap = vim.keymap |
| 4 | 4 | ||
| 5 | local dap = require("dap") | 5 | local telescope = require("telescope.builtin") |
| 6 | local telescope = require('telescope.builtin'); | 6 | local autotag = require("nvim-ts-autotag").setup() |
| 7 | local autotag = require('nvim-ts-autotag').setup(); | ||
| 8 | local dap_vscode = require("dap-vscode-js").setup({ | ||
| 9 | debugger_path = "(runtimedir)/site/pack/packer/opt/vscode-js-debug", | ||
| 10 | adapters = { 'chrome', 'pwa-node', 'pwa-chrome', 'pwa-msedge', 'node-terminal', 'pwa-extensionHost', 'node', 'chrome' }, | ||
| 11 | }) | ||
| 12 | 7 | ||
| 13 | --Basic Editor Setup | 8 | --Basic Editor Setup |
| 14 | option.nu = true; | 9 | option.nu = true |
| 15 | option.tabstop = 2; | 10 | option.tabstop = 2 |
| 16 | option.softtabstop = 2; | 11 | option.softtabstop = 2 |
| 17 | option.shiftwidth = 2; | 12 | option.shiftwidth = 2 |
| 18 | option.expandtab = true; | 13 | option.expandtab = true |
| 19 | option.smartindent = true; | 14 | option.smartindent = true |
| 20 | option.wrap = false; | 15 | option.wrap = false |
| 21 | option.swapfile = false; | 16 | option.swapfile = false |
| 22 | option.hlsearch = false; | 17 | option.hlsearch = false |
| 23 | option.incsearch = true; | 18 | option.incsearch = true |
| 24 | option.updatetime = 50; | 19 | option.updatetime = 50 |
| 25 | option.laststatus = 0; | 20 | option.laststatus = 0 |
| 26 | option.signcolumn = "number"; | 21 | option.signcolumn = "number" |
| 27 | option.autoindent = true; | 22 | option.autoindent = true |
| 28 | option.clipboard = "unnamedplus"; | 23 | option.clipboard = "unnamedplus" |
| 29 | option.termguicolors = true; | 24 | option.termguicolors = true |
| 30 | 25 | ||
| 31 | -- Setup Editor Theme | 26 | -- Setup Editor Theme |
| 32 | vim.cmd.colorscheme("darkblue") | 27 | vim.cmd.colorscheme("gruvbox") |
| 33 | vim.cmd([[ | 28 | vim.cmd([[ |
| 34 | highlight GitGutterAdd ctermbg=none | 29 | highlight GitGutterAdd ctermbg=none |
| 35 | highlight GitGutterAdd guibg=none | 30 | highlight GitGutterAdd guibg=none |
| @@ -39,92 +34,42 @@ highlight signcolumn ctermbg=none | |||
| 39 | highlight signcolumn guibg=none | 34 | highlight signcolumn guibg=none |
| 40 | ]]) | 35 | ]]) |
| 41 | 36 | ||
| 37 | |||
| 42 | -- run specific commands after different file extensions | 38 | -- run specific commands after different file extensions |
| 43 | vim.cmd([[ | 39 | vim.cmd([[ |
| 44 | augroup RunPfOnSave | 40 | augroup RunPfOnSave |
| 45 | autocmd! | 41 | autocmd! |
| 46 | autocmd BufWritePost *.js,*.ts,*.jsx,*json !prettier --write % | 42 | autocmd BufWritePost *.js,*.ts,*.jsx,*json,*.tsx,*.css,*.html,*.yaml,*.md silent! !prettier --write % |
| 47 | autocmd BufWritePost *.tex :VimtexCompile | 43 | autocmd BufWritePost *.tex :VimtexCompile |
| 48 | autocmd BufWritePost *.md :MarkdownPreview | 44 | autocmd BufWritePost *.md silent! :MarkdownPreview |
| 45 | autocmd BufWritePost *.php silent! !php-cs-fixer fix % | ||
| 49 | augroup END | 46 | augroup END |
| 50 | ]]) | 47 | ]]) |
| 51 | 48 | ||
| 52 | -- Gui options | 49 | -- Gui options |
| 53 | vim.o.guifont = "Fira Code:h7" | 50 | vim.o.guifont = "Fira Code:h7" |
| 54 | vim.g.vimtex_view_method = 'zathura' | 51 | vim.g.vimtex_view_method = "zathura" |
| 55 | vim.g.vimtex_compiler_method = 'latexrun' | 52 | vim.g.vimtex_compiler_method = "latexrun" |
| 56 | vim.g.gitgutter_set_sign_backgrounds = 1; | 53 | vim.g.gitgutter_set_sign_backgrounds = 1 |
| 57 | vim.fn.sign_define('DapBreakpoint',{ text ='🟥', texthl ='', linehl ='', numhl =''}) | ||
| 58 | vim.fn.sign_define('DapStopped',{ text ='▶️', texthl ='', linehl ='', numhl =''}) | ||
| 59 | 54 | ||
| 60 | --Keybinds | 55 | --Keybinds |
| 61 | vim.g.mapleader = (" ") | 56 | vim.g.mapleader = " " |
| 62 | keymap.set("n", "<leader>e", vim.cmd.Ex) | 57 | keymap.set("n", "<leader>e", vim.cmd.Ex) |
| 63 | keymap.set('n', '<leader>f', telescope.find_files, {}) | 58 | keymap.set("n", "<leader>f", telescope.find_files, {}) |
| 64 | keymap.set('n', '<leader>fg', telescope.live_grep, {}) | 59 | keymap.set("n", "<leader>fg", telescope.live_grep, {}) |
| 65 | keymap.set('n', '<leader>fb', telescope.buffers, {}) | 60 | keymap.set("n", "<leader>fb", telescope.buffers, {}) |
| 66 | keymap.set('n', '<leader>fh', telescope.help_tags, {}) | 61 | keymap.set("n", "<leader>fh", telescope.help_tags, {}) |
| 67 | keymap.set("n", "<leader>s", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]]) | 62 | keymap.set("n", "<leader>s", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]]) |
| 68 | keymap.set("n", "<leader>a", "ggVG") | 63 | keymap.set("n", "<leader>a", "ggVG") |
| 69 | keymap.set("v", "J", ":m '>+1<CR>gv=gv") | 64 | keymap.set("v", "J", ":m '>+1<CR>gv=gv") |
| 70 | keymap.set("v", "K", ":m '<-2<CR>gv=gv") | 65 | keymap.set("v", "K", ":m '<-2<CR>gv=gv") |
| 71 | 66 | ||
| 72 | -- Debugger keybinds | ||
| 73 | keymap.set('n', '<F5>', require 'dap'.continue) | ||
| 74 | keymap.set('n', '<F10>', require 'dap'.step_over) | ||
| 75 | keymap.set('n', '<F11>', require 'dap'.step_into) | ||
| 76 | keymap.set('n', '<F12>', require 'dap'.step_out) | ||
| 77 | keymap.set('n', '<leader>b', require 'dap'.toggle_breakpoint) | ||
| 78 | |||
| 79 | keymap.set('n', '<leader>B', function() | ||
| 80 | require 'dap'.set_breakpoint(vim.fn.input('Breakpoint condition: ')) | ||
| 81 | end) | ||
| 82 | |||
| 83 | keymap.set('n', '<leader>ui', require 'dapui'.toggle) | ||
| 84 | for _, language in ipairs(js_based_languages) do | ||
| 85 | require("dap").configurations[language] = { | ||
| 86 | { | ||
| 87 | type = "pwa-node", | ||
| 88 | request = "launch", | ||
| 89 | name = "Launch file", | ||
| 90 | program = "${file}", | ||
| 91 | cwd = "${workspaceFolder}", | ||
| 92 | }, | ||
| 93 | { | ||
| 94 | type = "pwa-node", | ||
| 95 | request = "attach", | ||
| 96 | name = "Attach", | ||
| 97 | processId = require 'dap.utils'.pick_process, | ||
| 98 | cwd = "${workspaceFolder}", | ||
| 99 | }, | ||
| 100 | { | ||
| 101 | type = "pwa-chrome", | ||
| 102 | request = "launch", | ||
| 103 | name = "Start Chrome with \"localhost\"", | ||
| 104 | url = "http://localhost:3000", | ||
| 105 | webRoot = "${workspaceFolder}", | ||
| 106 | userDataDir = "${workspaceFolder}/.vscode/vscode-chrome-debug-userdatadir" | ||
| 107 | } | ||
| 108 | } | ||
| 109 | end | ||
| 110 | require("dapui").setup() | ||
| 111 | local dap, dapui = require("dap"), require("dapui") | ||
| 112 | dap.listeners.after.event_initialized["dapui_config"] = function() | ||
| 113 | dapui.open({}) | ||
| 114 | end | ||
| 115 | dap.listeners.before.event_terminated["dapui_config"] = function() | ||
| 116 | dapui.close({}) | ||
| 117 | end | ||
| 118 | dap.listeners.before.event_exited["dapui_config"] = function() | ||
| 119 | dapui.close({}) | ||
| 120 | end | ||
| 121 | |||
| 122 | --Treesitter | 67 | --Treesitter |
| 123 | require 'nvim-treesitter.configs'.setup { | 68 | require("nvim-treesitter.configs").setup({ |
| 124 | ensure_installed = { "javascript", "typescript", "rust", "c", "lua", "vim" }, | 69 | ensure_installed = { "javascript", "typescript", "rust", "c", "lua", "vim" }, |
| 125 | sync_install = false, | 70 | sync_install = false, |
| 126 | auto_install = true, | 71 | auto_install = true, |
| 127 | highlight = { | 72 | highlight = { |
| 128 | enable = true, | 73 | enable = true, |
| 129 | } | 74 | }, |
| 130 | } | 75 | }) |
diff --git a/lua/config/lsp.lua b/lua/config/lsp.lua index 3fdc2e0..fdcfe99 100644 --- a/lua/config/lsp.lua +++ b/lua/config/lsp.lua | |||
| @@ -1,78 +1,64 @@ | |||
| 1 | -- local lsp = require('lsp-zero') | 1 | -- local lsp = require('lsp-zero') |
| 2 | 2 | ||
| 3 | local lsp_zero = require('lsp-zero') | 3 | local lsp_zero = require("lsp-zero") |
| 4 | local cmp = require('cmp') | 4 | local cmp = require("cmp") |
| 5 | require("luasnip.loaders.from_vscode").lazy_load() | 5 | require("luasnip.loaders.from_vscode").lazy_load() |
| 6 | 6 | ||
| 7 | lsp_zero.preset('recommended') | 7 | lsp_zero.preset("recommended") |
| 8 | lsp_zero.setup() | 8 | lsp_zero.setup() |
| 9 | lsp_zero.on_attach(function(client, bufnr) | 9 | lsp_zero.on_attach(function(client_id, bufnr) |
| 10 | -- see :help lsp-zero-keybindings | 10 | lsp_zero.default_keymaps({ buffer = bufnr }) |
| 11 | -- to learn the available actions | ||
| 12 | lsp_zero.default_keymaps({buffer = bufnr}) | ||
| 13 | end) | 11 | end) |
| 14 | 12 | ||
| 15 | require('mason').setup({}) | 13 | require("mason").setup({}) |
| 16 | require('mason-lspconfig').setup({ | 14 | require("mason-lspconfig").setup({ |
| 17 | -- Replace the language servers listed here | 15 | ensure_installed = { "tsserver", "rust_analyzer", "eslint" }, |
| 18 | -- with the ones you want to install | 16 | handlers = { |
| 19 | ensure_installed = {'tsserver', 'rust_analyzer', 'eslint'}, | 17 | lsp_zero.default_setup, |
| 20 | handlers = { | 18 | }, |
| 21 | lsp_zero.default_setup, | ||
| 22 | }, | ||
| 23 | }) | 19 | }) |
| 24 | 20 | ||
| 25 | |||
| 26 | |||
| 27 | --require('tabnine').setup({ | ||
| 28 | -- disable_auto_comment=true, | ||
| 29 | -- accept_keymap="<Tab>", | ||
| 30 | -- dismiss_keymap = "<C-]>", | ||
| 31 | -- debounce_ms = 800, | ||
| 32 | -- suggestion_color = {gui = "#808080", cterm = 244}, | ||
| 33 | -- execlude_filetypes = {"TelescopePrompt"} | ||
| 34 | --}) | ||
| 35 | |||
| 36 | cmp.setup({ | 21 | cmp.setup({ |
| 37 | snippet = { | 22 | snippet = { |
| 38 | expand = function(args) | 23 | expand = function(args) |
| 39 | require('luasnip').lsp_expand(args.body) | 24 | require("luasnip").lsp_expand(args.body) |
| 40 | end, | 25 | end, |
| 41 | }, | 26 | }, |
| 42 | window = { | 27 | window = {}, |
| 43 | }, | 28 | mapping = cmp.mapping.preset.insert({ |
| 44 | mapping = cmp.mapping.preset.insert({ | 29 | ["<C-b>"] = cmp.mapping.scroll_docs(-4), |
| 45 | ['<C-b>'] = cmp.mapping.scroll_docs(-4), | 30 | ["<C-f>"] = cmp.mapping.scroll_docs(4), |
| 46 | ['<C-f>'] = cmp.mapping.scroll_docs(4), | 31 | ["<C-Space>"] = cmp.mapping.complete(), |
| 47 | ['<C-Space>'] = cmp.mapping.complete(), | 32 | ["<C-e>"] = cmp.mapping.abort(), |
| 48 | ['<C-e>'] = cmp.mapping.abort(), | 33 | ["<CR>"] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. |
| 49 | ['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. | 34 | }), |
| 50 | }), | 35 | sources = cmp.config.sources({ |
| 51 | sources = cmp.config.sources({ | 36 | { name = "nvim_lsp" }, |
| 52 | { name = 'nvim_lsp' }, | 37 | { name = "luasnip" }, |
| 53 | { name = 'luasnip' }, | 38 | }, { |
| 54 | }, { | 39 | { name = "buffer" }, |
| 55 | { name = 'buffer' }, | 40 | }), |
| 56 | }) | ||
| 57 | }) | 41 | }) |
| 58 | 42 | ||
| 59 | function PrintDiagnostics(opts, bufnr, line_nr, client_id) | 43 | function PrintDiagnostics(opts, bufnr, line_nr, client_id) |
| 60 | bufnr = bufnr or 0 | 44 | bufnr = bufnr or 0 |
| 61 | line_nr = line_nr or (vim.api.nvim_win_get_cursor(0)[1] - 1) | 45 | line_nr = line_nr or (vim.api.nvim_win_get_cursor(0)[1] - 1) |
| 62 | opts = opts or { ['lnum'] = line_nr } | 46 | opts = opts or { ["lnum"] = line_nr } |
| 63 | 47 | ||
| 64 | local line_diagnostics = vim.diagnostic.get(bufnr, opts) | 48 | local line_diagnostics = vim.diagnostic.get(bufnr, opts) |
| 65 | if vim.tbl_isempty(line_diagnostics) then return end | 49 | if vim.tbl_isempty(line_diagnostics) then |
| 50 | return | ||
| 51 | end | ||
| 66 | 52 | ||
| 67 | local diagnostic_message = "" | 53 | local diagnostic_message = "" |
| 68 | for i, diagnostic in ipairs(line_diagnostics) do | 54 | for i, diagnostic in ipairs(line_diagnostics) do |
| 69 | diagnostic_message = diagnostic_message .. string.format("%d: %s", i, diagnostic.message or "") | 55 | diagnostic_message = diagnostic_message .. string.format("%d: %s", i, diagnostic.message or "") |
| 70 | print(diagnostic_message) | 56 | print(diagnostic_message) |
| 71 | if i ~= #line_diagnostics then | 57 | if i ~= #line_diagnostics then |
| 72 | diagnostic_message = diagnostic_message .. "\n" | 58 | diagnostic_message = diagnostic_message .. "\n" |
| 73 | end | 59 | end |
| 74 | end | 60 | end |
| 75 | vim.api.nvim_echo({ { diagnostic_message, "Normal" } }, false, {}) | 61 | vim.api.nvim_echo({ { diagnostic_message, "Normal" } }, false, {}) |
| 76 | end | 62 | end |
| 77 | 63 | ||
| 78 | vim.cmd [[ autocmd! CursorHold * lua PrintDiagnostics() ]] | 64 | vim.cmd([[ autocmd! CursorHold * lua PrintDiagnostics() ]]) |
diff --git a/lua/config/packer.lua b/lua/config/packer.lua index 887b330..36b9058 100644 --- a/lua/config/packer.lua +++ b/lua/config/packer.lua | |||
| @@ -1,56 +1,61 @@ | |||
| 1 | vim.cmd [[packadd packer.nvim]] | 1 | vim.cmd([[packadd packer.nvim]]) |
| 2 | return require('packer').startup(function(use) | 2 | return require("packer").startup(function(use) |
| 3 | use 'wbthomason/packer.nvim' | 3 | use("wbthomason/packer.nvim") |
| 4 | use 'nvim-treesitter/nvim-treesitter' | 4 | use("nvim-treesitter/nvim-treesitter") |
| 5 | use 'neovim/nvim-lspconfig' | 5 | use("neovim/nvim-lspconfig") |
| 6 | use 'lukas-reineke/indent-blankline.nvim' | 6 | use("lukas-reineke/indent-blankline.nvim") |
| 7 | use 'lervag/vimtex' | 7 | use("lervag/vimtex") |
| 8 | use 'morhetz/gruvbox' | 8 | use("morhetz/gruvbox") |
| 9 | use 'airblade/vim-gitgutter' | 9 | use("airblade/vim-gitgutter") |
| 10 | use 'jose-elias-alvarez/null-ls.nvim' | 10 | use("jose-elias-alvarez/null-ls.nvim") |
| 11 | use 'windwp/nvim-ts-autotag' | 11 | use("windwp/nvim-ts-autotag") |
| 12 | use 'lunacookies/vim-colors-xcode' | 12 | use("lunacookies/vim-colors-xcode") |
| 13 | use 'mfussenegger/nvim-dap' | 13 | use("mfussenegger/nvim-dap") |
| 14 | use 'mxsdev/nvim-dap-vscode-js' | 14 | use("mxsdev/nvim-dap-vscode-js") |
| 15 | use { "rcarriga/nvim-dap-ui", requires = {"mfussenegger/nvim-dap"} } | 15 | use({ "rcarriga/nvim-dap-ui", requires = { "mfussenegger/nvim-dap" } }) |
| 16 | use { | 16 | use({ |
| 17 | 'nvim-telescope/telescope.nvim', tag = '0.1.4', | 17 | "nvim-telescope/telescope.nvim", |
| 18 | requires = { {'nvim-lua/plenary.nvim'} } | 18 | tag = "0.1.4", |
| 19 | } | 19 | requires = { { "nvim-lua/plenary.nvim" } }, |
| 20 | use { | 20 | }) |
| 21 | 'VonHeikemen/lsp-zero.nvim', | 21 | use({ |
| 22 | requires = { | 22 | "VonHeikemen/lsp-zero.nvim", |
| 23 | { 'neovim/nvim-lspconfig' }, | 23 | requires = { |
| 24 | { 'williamboman/mason.nvim' }, | 24 | { "neovim/nvim-lspconfig" }, |
| 25 | { 'williamboman/mason-lspconfig.nvim' }, | 25 | { "williamboman/mason.nvim" }, |
| 26 | { 'hrsh7th/nvim-cmp' }, | 26 | { "williamboman/mason-lspconfig.nvim" }, |
| 27 | { 'hrsh7th/cmp-buffer' }, | 27 | { "hrsh7th/nvim-cmp" }, |
| 28 | { 'hrsh7th/cmp-path' }, | 28 | { "hrsh7th/cmp-buffer" }, |
| 29 | { 'saadparwaiz1/cmp_luasnip' }, | 29 | { "hrsh7th/cmp-path" }, |
| 30 | { 'hrsh7th/cmp-nvim-lsp' }, | 30 | { "saadparwaiz1/cmp_luasnip" }, |
| 31 | { 'hrsh7th/cmp-nvim-lua' }, | 31 | { "hrsh7th/cmp-nvim-lsp" }, |
| 32 | { 'rafamadriz/friendly-snippets' }, | 32 | { "hrsh7th/cmp-nvim-lua" }, |
| 33 | } | 33 | { "rafamadriz/friendly-snippets" }, |
| 34 | } | 34 | }, |
| 35 | use({ | 35 | }) |
| 36 | "L3MON4D3/LuaSnip", | 36 | use({ |
| 37 | tag = "v2.*", | 37 | "L3MON4D3/LuaSnip", |
| 38 | run = "make install_jsregexp" | 38 | tag = "v2.*", |
| 39 | }) | 39 | run = "make install_jsregexp", |
| 40 | use { | 40 | }) |
| 41 | 'numToStr/Comment.nvim', | 41 | use({ |
| 42 | config = function() | 42 | "numToStr/Comment.nvim", |
| 43 | require('Comment').setup() | 43 | config = function() |
| 44 | end | 44 | require("Comment").setup() |
| 45 | } | 45 | end, |
| 46 | use({ | 46 | }) |
| 47 | "iamcco/markdown-preview.nvim", | 47 | use({ |
| 48 | run = "cd app && npm install", | 48 | "iamcco/markdown-preview.nvim", |
| 49 | setup = function() vim.g.mkdp_filetypes = { "markdown" } end, | 49 | run = "cd app && npm install", |
| 50 | ft = { "markdown" }, | 50 | setup = function() |
| 51 | }) | 51 | vim.g.mkdp_filetypes = { "markdown" } |
| 52 | use { | 52 | end, |
| 53 | "windwp/nvim-autopairs", | 53 | ft = { "markdown" }, |
| 54 | config = function() require("nvim-autopairs").setup {} end | 54 | }) |
| 55 | } | 55 | use({ |
| 56 | "windwp/nvim-autopairs", | ||
| 57 | config = function() | ||
| 58 | require("nvim-autopairs").setup({}) | ||
| 59 | end, | ||
| 60 | }) | ||
| 56 | end) | 61 | end) |
