added vscode theme, autopairs, inlay hints
This commit is contained in:
		| @@ -1,50 +1,50 @@ | ||||
| vim.lsp.config('lua_ls', { | ||||
|   on_init = function(client) | ||||
|     if client.workspace_folders then | ||||
|       local path = client.workspace_folders[1].name | ||||
|       if | ||||
|         path ~= vim.fn.stdpath('config') | ||||
|         and (vim.uv.fs_stat(path .. '/.luarc.json') or vim.uv.fs_stat(path .. '/.luarc.jsonc')) | ||||
|       then | ||||
|         return | ||||
|       end | ||||
|     end | ||||
|     on_init = function(client) | ||||
|         if client.workspace_folders then | ||||
|             local path = client.workspace_folders[1].name | ||||
|             if | ||||
|                 path ~= vim.fn.stdpath('config') | ||||
|                 and (vim.uv.fs_stat(path .. '/.luarc.json') or vim.uv.fs_stat(path .. '/.luarc.jsonc')) | ||||
|             then | ||||
|                 return | ||||
|             end | ||||
|         end | ||||
|  | ||||
|     client.config.settings.Lua = vim.tbl_deep_extend('force', client.config.settings.Lua, { | ||||
|       runtime = { | ||||
|         -- Tell the language server which version of Lua you're using (most | ||||
|         -- likely LuaJIT in the case of Neovim) | ||||
|         version = 'LuaJIT', | ||||
|         -- Tell the language server how to find Lua modules same way as Neovim | ||||
|         -- (see `:h lua-module-load`) | ||||
|         path = { | ||||
|           'lua/?.lua', | ||||
|           'lua/?/init.lua', | ||||
|         }, | ||||
|       }, | ||||
|       -- Make the server aware of Neovim runtime files | ||||
|       workspace = { | ||||
|         checkThirdParty = false, | ||||
|         library = { | ||||
|           vim.env.VIMRUNTIME | ||||
|           -- Depending on the usage, you might want to add additional paths | ||||
|           -- here. | ||||
|           -- '${3rd}/luv/library' | ||||
|           -- '${3rd}/busted/library' | ||||
|         } | ||||
|         -- Or pull in all of 'runtimepath'. | ||||
|         -- NOTE: this is a lot slower and will cause issues when working on | ||||
|         -- your own configuration. | ||||
|         -- See https://github.com/neovim/nvim-lspconfig/issues/3189 | ||||
|         -- library = { | ||||
|         --   vim.api.nvim_get_runtime_file('', true), | ||||
|         -- } | ||||
|       } | ||||
|     }) | ||||
|   end, | ||||
|   settings = { | ||||
|     Lua = {} | ||||
|   } | ||||
|         client.config.settings.Lua = vim.tbl_deep_extend('force', client.config.settings.Lua, { | ||||
|             runtime = { | ||||
|                 -- Tell the language server which version of Lua you're using (most | ||||
|                 -- likely LuaJIT in the case of Neovim) | ||||
|                 version = 'LuaJIT', | ||||
|                 -- Tell the language server how to find Lua modules same way as Neovim | ||||
|                 -- (see `:h lua-module-load`) | ||||
|                 path = { | ||||
|                     'lua/?.lua', | ||||
|                     'lua/?/init.lua', | ||||
|                 }, | ||||
|             }, | ||||
|             -- Make the server aware of Neovim runtime files | ||||
|             workspace = { | ||||
|                 checkThirdParty = false, | ||||
|                 library = { | ||||
|                     vim.env.VIMRUNTIME | ||||
|                     -- Depending on the usage, you might want to add additional paths | ||||
|                     -- here. | ||||
|                     -- '${3rd}/luv/library' | ||||
|                     -- '${3rd}/busted/library' | ||||
|                 } | ||||
|                 -- Or pull in all of 'runtimepath'. | ||||
|                 -- NOTE: this is a lot slower and will cause issues when working on | ||||
|                 -- your own configuration. | ||||
|                 -- See https://github.com/neovim/nvim-lspconfig/issues/3189 | ||||
|                 -- library = { | ||||
|                 --   vim.api.nvim_get_runtime_file('', true), | ||||
|                 -- } | ||||
|             } | ||||
|         }) | ||||
|     end, | ||||
|     settings = { | ||||
|         Lua = {} | ||||
|     } | ||||
| }) | ||||
|  | ||||
| vim.lsp.config('rust_analyzer', { | ||||
| @@ -59,7 +59,15 @@ vim.lsp.config('rust_analyzer', { | ||||
|  | ||||
| vim.api.nvim_create_autocmd("LspAttach", { | ||||
|     callback = function(ev) | ||||
|         local opts = {buffer = ev.buf, remap = false} | ||||
|         local opts = { buffer = ev.buf, remap = false } | ||||
|         vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts) | ||||
|         vim.keymap.set("n", "K", function() vim.lsp.buf.hover() end, opts) | ||||
|         vim.keymap.set("n", "<leader>vd", function() vim.diagnostic.open_float() end, opts) | ||||
|         vim.keymap.set("n", "<leader>vrr", function() vim.lsp.buf.references() end, opts) | ||||
|         vim.keymap.set("n", "<leader>vca", function() vim.lsp.buf.code_action() end, opts) | ||||
|         vim.keymap.set("n", "<leader>vrn", function() vim.lsp.buf.rename() end, opts) | ||||
|         vim.keymap.set("n", "<leader>ii", function() | ||||
|             vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled()) | ||||
|         end, opts) | ||||
|     end | ||||
| }) | ||||
|   | ||||
| @@ -1,14 +1,24 @@ | ||||
| { | ||||
|   "coq.artifacts": { "branch": "artifacts", "commit": "ef5f21d638ccc456cfa5b8d0ab37093cefe48c8b" }, | ||||
|   "coq.thirdparty": { "branch": "3p", "commit": "6ee3c221c308dca7071387267ac76c9272b184a9" }, | ||||
|   "coq_nvim": { "branch": "coq", "commit": "666efec5bb8fdb6dbb4bc99a069b3340951d28a0" }, | ||||
|   "cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" }, | ||||
|   "cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" }, | ||||
|   "cmp-nvim-lsp": { "branch": "main", "commit": "a8912b88ce488f411177fc8aed358b04dc246d7b" }, | ||||
|   "cmp-path": { "branch": "main", "commit": "c6635aae33a50d6010bf1aa756ac2398a2d54c32" }, | ||||
|   "cmp-vsnip": { "branch": "main", "commit": "989a8a73c44e926199bfd05fa7a516d51f2d2752" }, | ||||
|   "conform.nvim": { "branch": "master", "commit": "2b2b30260203af3b93a7470ac6c8457ddd6e32d9" }, | ||||
|   "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, | ||||
|   "mason.nvim": { "branch": "main", "commit": "888d6ee499d8089a3a4be4309d239d6be1c1e6c0" }, | ||||
|   "nvim-autopairs": { "branch": "master", "commit": "4d74e75913832866aa7de35e4202463ddf6efd1b" }, | ||||
|   "nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" }, | ||||
|   "nvim-lspconfig": { "branch": "master", "commit": "ac1dfbe3b60e5e23a2cff90e3bd6a3bc88031a57" }, | ||||
|   "nvim-tree.lua": { "branch": "master", "commit": "be5b788f2dc1522c73fb7afad9092331c8aebe80" }, | ||||
|   "nvim-treesitter": { "branch": "master", "commit": "066fd6505377e3fd4aa219e61ce94c2b8bdb0b79" }, | ||||
|   "nvim-web-devicons": { "branch": "master", "commit": "d360317f8f509b99229bb31d42269987696df6ff" }, | ||||
|   "outline.nvim": { "branch": "main", "commit": "321f89ef79f168a78685f70d70c52d0e7b563abb" }, | ||||
|   "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, | ||||
|   "rose-pine": { "branch": "main", "commit": "491a0c77abc7ecb955c27a974091a5968232995f" }, | ||||
|   "telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" }, | ||||
|   "trouble.nvim": { "branch": "main", "commit": "85bedb7eb7fa331a2ccbecb9202d8abba64d37b3" }, | ||||
|   "undotree": { "branch": "master", "commit": "b951b87b46c34356d44aa71886aecf9dd7f5788a" }, | ||||
|   "vim-fugitive": { "branch": "master", "commit": "4a745ea72fa93bb15dd077109afbb3d1809383f2" } | ||||
|   "vim-fugitive": { "branch": "master", "commit": "4a745ea72fa93bb15dd077109afbb3d1809383f2" }, | ||||
|   "vim-vsnip": { "branch": "master", "commit": "0a4b8419e44f47c57eec4c90df17567ad4b1b36e" }, | ||||
|   "vscode.nvim": { "branch": "main", "commit": "57cec1509bfb57dfc3c4d5ba5e8db9a5b5e42be2" } | ||||
| } | ||||
|   | ||||
| @@ -1,2 +1,2 @@ | ||||
| vim.g.mapleader = " " | ||||
| vim.keymap.set("n", "<leader>pv", vim.cmd.Ex) | ||||
| vim.keymap.set("n", "<leader>pv", vim.cmd.NvimTreeToggle) | ||||
|   | ||||
| @@ -31,3 +31,5 @@ vim.opt.updatetime = 50 | ||||
|  | ||||
| vim.g.mapleader = " " | ||||
|  | ||||
| vim.g.loaded_netrw = 1 | ||||
| vim.g.loaded_netrwPlugin = 1 | ||||
|   | ||||
							
								
								
									
										94
									
								
								lua/plugins/lspconfig.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										94
									
								
								lua/plugins/lspconfig.lua
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,94 @@ | ||||
| local function config_lsp() | ||||
|     vim.lsp.enable("rust_analyzer") | ||||
|     vim.lsp.enable("lua_ls") | ||||
| end | ||||
|  | ||||
| return { | ||||
|     { | ||||
|         "neovim/nvim-lspconfig", | ||||
|         lazy = false, -- REQUIRED: tell lazy.nvim to start this plugin at startup | ||||
|         dependencies = { | ||||
|             'neovim/nvim-lspconfig', | ||||
|             'hrsh7th/cmp-nvim-lsp', | ||||
|             'hrsh7th/cmp-buffer', | ||||
|             'hrsh7th/cmp-path', | ||||
|             'hrsh7th/cmp-cmdline', | ||||
|             'hrsh7th/nvim-cmp', | ||||
|             'hrsh7th/cmp-vsnip', | ||||
|             'hrsh7th/vim-vsnip' | ||||
|         }, | ||||
|         config = function() | ||||
|             local cmp = require'cmp' | ||||
|  | ||||
|             cmp.setup({ | ||||
|                 snippet = { | ||||
|                     -- REQUIRED - you must specify a snippet engine | ||||
|                     expand = function(args) | ||||
|                         vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users. | ||||
|                         -- require('luasnip').lsp_expand(args.body) -- For `luasnip` users. | ||||
|                         -- require('snippy').expand_snippet(args.body) -- For `snippy` users. | ||||
|                         -- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users. | ||||
|                         -- vim.snippet.expand(args.body) -- For native neovim snippets (Neovim v0.10+) | ||||
|  | ||||
|                         -- For `mini.snippets` users: | ||||
|                         -- local insert = MiniSnippets.config.expand.insert or MiniSnippets.default_insert | ||||
|                         -- insert({ body = args.body }) -- Insert at cursor | ||||
|                         -- cmp.resubscribe({ "TextChangedI", "TextChangedP" }) | ||||
|                         -- require("cmp.config").set_onetime({ sources = {} }) | ||||
|                     end, | ||||
|                 }, | ||||
|                 window = { | ||||
|                     -- completion = cmp.config.window.bordered(), | ||||
|                     -- documentation = cmp.config.window.bordered(), | ||||
|                 }, | ||||
|                 mapping = cmp.mapping.preset.insert({ | ||||
|                     ['<C-b>'] = cmp.mapping.scroll_docs(-4), | ||||
|                     ['<C-f>'] = cmp.mapping.scroll_docs(4), | ||||
|                     ['<C-Space>'] = cmp.mapping.complete(), | ||||
|                     ['<C-e>'] = cmp.mapping.abort(), | ||||
|                     ['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. | ||||
|                 }), | ||||
|                 sources = cmp.config.sources({ | ||||
|                     { name = 'nvim_lsp' }, | ||||
|                     { name = 'vsnip' }, -- For vsnip users. | ||||
|                     -- { name = 'luasnip' }, -- For luasnip users. | ||||
|                     -- { name = 'ultisnips' }, -- For ultisnips users. | ||||
|                     -- { name = 'snippy' }, -- For snippy users. | ||||
|                 }, { | ||||
|                     { name = 'buffer' }, | ||||
|                 }) | ||||
|             }) | ||||
|  | ||||
|             -- To use git you need to install the plugin petertriho/cmp-git and uncomment lines below | ||||
|             -- Set configuration for specific filetype. | ||||
|             --[[ cmp.setup.filetype('gitcommit', { | ||||
|                 sources = cmp.config.sources({ | ||||
|                     { name = 'git' }, | ||||
|                 }, { | ||||
|                     { name = 'buffer' }, | ||||
|                 }) | ||||
|             }) | ||||
|             require("cmp_git").setup() ]]--  | ||||
|  | ||||
|             -- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore). | ||||
|             cmp.setup.cmdline({ '/', '?' }, { | ||||
|                 mapping = cmp.mapping.preset.cmdline(), | ||||
|                 sources = { | ||||
|                     { name = 'buffer' } | ||||
|                 } | ||||
|             }) | ||||
|  | ||||
|             -- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). | ||||
|             cmp.setup.cmdline(':', { | ||||
|                 mapping = cmp.mapping.preset.cmdline(), | ||||
|                 sources = cmp.config.sources({ | ||||
|                     { name = 'path' } | ||||
|                 }, { | ||||
|                     { name = 'cmdline' } | ||||
|                 }), | ||||
|                 matching = { disallow_symbol_nonprefix_matching = false } | ||||
|             }) | ||||
|             config_lsp() | ||||
|         end | ||||
|     } | ||||
| } | ||||
| @@ -9,43 +9,6 @@ return { | ||||
|     }, | ||||
|     { "mbbill/undotree" }, | ||||
|     { "tpope/vim-fugitive" }, | ||||
|     { | ||||
|         "rose-pine/neovim", | ||||
|         name = "rose-pine", | ||||
|         config = function() | ||||
|             vim.cmd("colorscheme rose-pine") | ||||
|         end | ||||
|     }, | ||||
|     { | ||||
|         "neovim/nvim-lspconfig", | ||||
|         lazy = false, -- REQUIRED: tell lazy.nvim to start this plugin at startup | ||||
|         dependencies = { | ||||
|             -- main one | ||||
|             { "ms-jpq/coq_nvim", branch = "coq" }, | ||||
|  | ||||
|             -- 9000+ Snippets | ||||
|             { "ms-jpq/coq.artifacts", branch = "artifacts" }, | ||||
|  | ||||
|             -- lua & third party sources -- See https://github.com/ms-jpq/coq.thirdparty | ||||
|             -- Need to **configure separately** | ||||
|             { 'ms-jpq/coq.thirdparty', branch = "3p" } | ||||
|             -- - shell repl | ||||
|             -- - nvim lua api | ||||
|             -- - scientific calculator | ||||
|             -- - comment banner | ||||
|             -- - etc | ||||
|         }, | ||||
|         init = function() | ||||
|             vim.g.coq_settings = { | ||||
|                 auto_start = true, -- if you want to start COQ at startup | ||||
|                 -- Your COQ settings here | ||||
|             } | ||||
|         end, | ||||
|         config = function() | ||||
|             vim.lsp.enable("rust_analyzer") | ||||
|             vim.lsp.enable("lua_ls") | ||||
|         end | ||||
|     }, | ||||
|     { | ||||
|         "folke/trouble.nvim", | ||||
|         opts = {}, -- for default options, refer to the configuration section for custom setup. | ||||
| @@ -57,5 +20,53 @@ return { | ||||
|                 desc = "Diagnostics (Trouble)", | ||||
|             } | ||||
|         } | ||||
|     }, | ||||
|     { | ||||
|         "nvim-tree/nvim-tree.lua", | ||||
|         version = "*", | ||||
|         lazy = false, | ||||
|         dependencies = { | ||||
|             "nvim-tree/nvim-web-devicons", | ||||
|         }, | ||||
|         config = function() | ||||
|             require("nvim-tree").setup { | ||||
|                 update_focused_file = { enable = true } | ||||
|             } | ||||
|         end, | ||||
|     }, | ||||
|     { | ||||
|         "mason-org/mason.nvim" | ||||
|     }, | ||||
|     { | ||||
|         "hedyhli/outline.nvim", | ||||
|         config = function() | ||||
|             -- Example mapping to toggle outline | ||||
|             vim.keymap.set("n", "<leader>o", "<cmd>Outline<CR>", | ||||
|                 { desc = "Toggle Outline" }) | ||||
|  | ||||
|             require("outline").setup { | ||||
|                 -- Your setup opts here (leave empty to use defaults) | ||||
|             } | ||||
|         end, | ||||
|     }, | ||||
|     { | ||||
|         'stevearc/conform.nvim', | ||||
|         opts = { | ||||
|             formatters_by_ft = { | ||||
|                 lua = { "stylua" }, | ||||
|                 rust = { "rustfmt", lsp_format = "fallback" } | ||||
|             }, | ||||
|             format_on_save = { | ||||
|                 timeout_ms = 500, | ||||
|                 lsp_format = "fallback", | ||||
|             }, | ||||
|         }, | ||||
|     }, | ||||
|     { | ||||
|         'windwp/nvim-autopairs', | ||||
|         event = "InsertEnter", | ||||
|         config = true | ||||
|         -- use opts = {} for passing setup options | ||||
|         -- this is equivalent to setup({}) function | ||||
|     } | ||||
| } | ||||
|   | ||||
							
								
								
									
										15
									
								
								lua/plugins/theme.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								lua/plugins/theme.lua
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,15 @@ | ||||
| return { | ||||
|     --     { | ||||
|     --         "rose-pine/neovim", | ||||
|     --         name = "rose-pine", | ||||
|     --         config = function() | ||||
|     --             vim.cmd("colorscheme rose-pine") | ||||
|     --         end | ||||
|     --     }, | ||||
|     { | ||||
|         "Mofiqul/vscode.nvim", | ||||
|         config = function() | ||||
|             vim.cmd("colorscheme vscode") | ||||
|         end | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user