aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--LICENCE204
-rw-r--r--README.md33
-rw-r--r--init.lua13
-rw-r--r--lua/config/editor.lua137
-rw-r--r--lua/config/lsp.lua108
-rw-r--r--lua/config/packer.lua115
6 files changed, 380 insertions, 230 deletions
diff --git a/LICENCE b/LICENCE
new file mode 100644
index 0000000..c8b2c25
--- /dev/null
+++ b/LICENCE
@@ -0,0 +1,204 @@
1Neovim is licensed under the terms of the Apache 2.0 license, except for
2parts 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.
diff --git a/README.md b/README.md
index 08b4293..77b2080 100644
--- a/README.md
+++ b/README.md
@@ -1,25 +1,35 @@
1# My Neovim Config 1# Overview
2
2![nvim](https://user-images.githubusercontent.com/91333841/212791030-440472c6-1568-4754-9181-c47e69bc42d6.png) 3![nvim](https://user-images.githubusercontent.com/91333841/212791030-440472c6-1568-4754-9181-c47e69bc42d6.png)
3 4
4### Introduction 5### Installation
6
5Run checkhealth in your Neovim 7Run checkhealth in your Neovim
8
6```vim 9```vim
7:checkhealth 10:checkhealth
8``` 11```
9Make sure you analyzed the output properly: 12
10- Your neovim must be >= 0.7.0 to run this config 13Make 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
13git clone --depth 1 https://github.com/wbthomason/packer.nvim\ 19git 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
18pip install pynvim 26pip 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
25You can just clone this repo to your .config folder 35You 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
28git clone https://github.com/dsrcr/nvim ~/.config 38git clone https://github.com/dsrcr/nvim ~/.config
29``` 39```
40
30> Recommended way 41> Recommended way
31 42
32I use gnu-stow to manage my dotfiles, so I encourage you to use it too. 43I use gnu-stow to manage my dotfiles, so I encourage you to use it too.
33 44
34Use your package manage of choice to get stow, for example: 45Use your package manage of choice to get stow, for example:
35 46
36```bash 47```bash
37paru -S stow 48paru -S stow
38``` 49```
50
39Clone this repo to your prefered dir and use stow to symlink 51Clone this repo to your prefered dir and use stow to symlink
40 52
41In order to do this you need an empty nvim directory in your .config folder 53In order to do this you need an empty nvim directory in your .config folder
54
42```bash 55```bash
43cd ~/.config 56cd ~/.config
44mkdir nvim 57mkdir 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
56This command should pull everything you need 70This command should pull everything you need
57 71
58In the next step you will encounter a lot of errors, but don't worry about it. 72In the next step you will encounter a lot of errors, but don't worry about it.
59Packer needs to pull specific plugins and then you need to install Treesitter's support for specific filetypes eg. lua, rust.... etc. 73Packer 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
85This 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)
diff --git a/init.lua b/init.lua
index 6d26278..45e6811 100644
--- a/init.lua
+++ b/init.lua
@@ -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
11require("config.packer") 2require("config.packer")
12 3
13-- You can find here stuff related to lsp 4-- Here you can find stuff related to lsp
14require("config.lsp") 5require("config.lsp")
15 6
16-- You can customize editor 7-- And there goes editor customization
17require("config.editor") 8require("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 @@
1local js_based_languages = { "typescript", "javascript", "typescriptreact", "javascriptreact" } 1local js_based_languages = { "typescript", "javascript", "typescriptreact", "javascriptreact" }
2local option = vim.opt; 2local option = vim.opt
3local keymap = vim.keymap; 3local keymap = vim.keymap
4 4
5local dap = require("dap") 5local telescope = require("telescope.builtin")
6local telescope = require('telescope.builtin'); 6local autotag = require("nvim-ts-autotag").setup()
7local autotag = require('nvim-ts-autotag').setup();
8local 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
14option.nu = true; 9option.nu = true
15option.tabstop = 2; 10option.tabstop = 2
16option.softtabstop = 2; 11option.softtabstop = 2
17option.shiftwidth = 2; 12option.shiftwidth = 2
18option.expandtab = true; 13option.expandtab = true
19option.smartindent = true; 14option.smartindent = true
20option.wrap = false; 15option.wrap = false
21option.swapfile = false; 16option.swapfile = false
22option.hlsearch = false; 17option.hlsearch = false
23option.incsearch = true; 18option.incsearch = true
24option.updatetime = 50; 19option.updatetime = 50
25option.laststatus = 0; 20option.laststatus = 0
26option.signcolumn = "number"; 21option.signcolumn = "number"
27option.autoindent = true; 22option.autoindent = true
28option.clipboard = "unnamedplus"; 23option.clipboard = "unnamedplus"
29option.termguicolors = true; 24option.termguicolors = true
30 25
31-- Setup Editor Theme 26-- Setup Editor Theme
32vim.cmd.colorscheme("darkblue") 27vim.cmd.colorscheme("gruvbox")
33vim.cmd([[ 28vim.cmd([[
34highlight GitGutterAdd ctermbg=none 29highlight GitGutterAdd ctermbg=none
35highlight GitGutterAdd guibg=none 30highlight GitGutterAdd guibg=none
@@ -39,92 +34,42 @@ highlight signcolumn ctermbg=none
39highlight signcolumn guibg=none 34highlight signcolumn guibg=none
40]]) 35]])
41 36
37
42-- run specific commands after different file extensions 38-- run specific commands after different file extensions
43vim.cmd([[ 39vim.cmd([[
44augroup RunPfOnSave 40augroup RunPfOnSave
45autocmd! 41autocmd!
46autocmd BufWritePost *.js,*.ts,*.jsx,*json !prettier --write % 42autocmd BufWritePost *.js,*.ts,*.jsx,*json,*.tsx,*.css,*.html,*.yaml,*.md silent! !prettier --write %
47autocmd BufWritePost *.tex :VimtexCompile 43autocmd BufWritePost *.tex :VimtexCompile
48autocmd BufWritePost *.md :MarkdownPreview 44autocmd BufWritePost *.md silent! :MarkdownPreview
45autocmd BufWritePost *.php silent! !php-cs-fixer fix %
49augroup END 46augroup END
50]]) 47]])
51 48
52-- Gui options 49-- Gui options
53vim.o.guifont = "Fira Code:h7" 50vim.o.guifont = "Fira Code:h7"
54vim.g.vimtex_view_method = 'zathura' 51vim.g.vimtex_view_method = "zathura"
55vim.g.vimtex_compiler_method = 'latexrun' 52vim.g.vimtex_compiler_method = "latexrun"
56vim.g.gitgutter_set_sign_backgrounds = 1; 53vim.g.gitgutter_set_sign_backgrounds = 1
57vim.fn.sign_define('DapBreakpoint',{ text ='🟥', texthl ='', linehl ='', numhl =''})
58vim.fn.sign_define('DapStopped',{ text ='▶️', texthl ='', linehl ='', numhl =''})
59 54
60--Keybinds 55--Keybinds
61vim.g.mapleader = (" ") 56vim.g.mapleader = " "
62keymap.set("n", "<leader>e", vim.cmd.Ex) 57keymap.set("n", "<leader>e", vim.cmd.Ex)
63keymap.set('n', '<leader>f', telescope.find_files, {}) 58keymap.set("n", "<leader>f", telescope.find_files, {})
64keymap.set('n', '<leader>fg', telescope.live_grep, {}) 59keymap.set("n", "<leader>fg", telescope.live_grep, {})
65keymap.set('n', '<leader>fb', telescope.buffers, {}) 60keymap.set("n", "<leader>fb", telescope.buffers, {})
66keymap.set('n', '<leader>fh', telescope.help_tags, {}) 61keymap.set("n", "<leader>fh", telescope.help_tags, {})
67keymap.set("n", "<leader>s", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]]) 62keymap.set("n", "<leader>s", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]])
68keymap.set("n", "<leader>a", "ggVG") 63keymap.set("n", "<leader>a", "ggVG")
69keymap.set("v", "J", ":m '>+1<CR>gv=gv") 64keymap.set("v", "J", ":m '>+1<CR>gv=gv")
70keymap.set("v", "K", ":m '<-2<CR>gv=gv") 65keymap.set("v", "K", ":m '<-2<CR>gv=gv")
71 66
72-- Debugger keybinds
73keymap.set('n', '<F5>', require 'dap'.continue)
74keymap.set('n', '<F10>', require 'dap'.step_over)
75keymap.set('n', '<F11>', require 'dap'.step_into)
76keymap.set('n', '<F12>', require 'dap'.step_out)
77keymap.set('n', '<leader>b', require 'dap'.toggle_breakpoint)
78
79keymap.set('n', '<leader>B', function()
80 require 'dap'.set_breakpoint(vim.fn.input('Breakpoint condition: '))
81end)
82
83keymap.set('n', '<leader>ui', require 'dapui'.toggle)
84for _, 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 }
109end
110require("dapui").setup()
111local dap, dapui = require("dap"), require("dapui")
112dap.listeners.after.event_initialized["dapui_config"] = function()
113 dapui.open({})
114end
115dap.listeners.before.event_terminated["dapui_config"] = function()
116 dapui.close({})
117end
118dap.listeners.before.event_exited["dapui_config"] = function()
119 dapui.close({})
120end
121
122--Treesitter 67--Treesitter
123require 'nvim-treesitter.configs'.setup { 68require("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
3local lsp_zero = require('lsp-zero') 3local lsp_zero = require("lsp-zero")
4local cmp = require('cmp') 4local cmp = require("cmp")
5require("luasnip.loaders.from_vscode").lazy_load() 5require("luasnip.loaders.from_vscode").lazy_load()
6 6
7lsp_zero.preset('recommended') 7lsp_zero.preset("recommended")
8lsp_zero.setup() 8lsp_zero.setup()
9lsp_zero.on_attach(function(client, bufnr) 9lsp_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})
13end) 11end)
14 12
15require('mason').setup({}) 13require("mason").setup({})
16require('mason-lspconfig').setup({ 14require("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
36cmp.setup({ 21cmp.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
59function PrintDiagnostics(opts, bufnr, line_nr, client_id) 43function 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, {})
76end 62end
77 63
78vim.cmd [[ autocmd! CursorHold * lua PrintDiagnostics() ]] 64vim.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 @@
1vim.cmd [[packadd packer.nvim]] 1vim.cmd([[packadd packer.nvim]])
2return require('packer').startup(function(use) 2return 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" } })
16use { 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 })
56end) 61end)