Fixing nvim-cmp, adding Racket support, etc.
This commit is contained in:
		
							parent
							
								
									35dd6c19c9
								
							
						
					
					
						commit
						089e3ec0eb
					
				
					 3 changed files with 34 additions and 3 deletions
				
			
		|  | @ -12,6 +12,7 @@ end | |||
| 
 | ||||
| -- Change leader to a comma | ||||
| vim.g.mapleader = ',' | ||||
| vim.g.maplocalleader = ' ' | ||||
| 
 | ||||
| ----------------------------------------------------------- | ||||
| -- General | ||||
|  | @ -130,6 +131,5 @@ map('n', '<leader>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>') | |||
| map('n', '<leader>rn', '<cmd>lua vim.lsp.buf.rename()<CR>') | ||||
| map('n', '<leader>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>') | ||||
| map('n', '<leader>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>') | ||||
| map('n', '<leader>e', '<cmd>lua vim.lsp.diagnostic.open_float()<CR>') | ||||
| map('n', '[c', '<cmd>lua vim.diagnostic.goto_prev { wrap = false }<CR>') | ||||
| map('n', ']c', '<cmd>lua vim.diagnostic.goto_next { wrap = false }<CR>') | ||||
|  |  | |||
|  | @ -67,13 +67,18 @@ return require('packer').startup(function(use) | |||
|     -- Neovim-native LSP Implementation | ||||
|     use 'neovim/nvim-lspconfig' | ||||
| 
 | ||||
|     -- Snippet engine is REQUIRED for nvim-cmp. | ||||
|     use 'L3MON4D3/LuaSnip' | ||||
| 
 | ||||
|     -- nvim-cmp - completion plugin, used for LSP and Metals | ||||
|     use { | ||||
|         'hrsh7th/nvim-cmp', | ||||
|         requires = { | ||||
|             'hrsh7th/cmp-nvim-lsp', | ||||
|             'hrsh7th/cmp-path', | ||||
|             'hrsh7th/cmp-buffer' | ||||
|             'hrsh7th/cmp-buffer', | ||||
|             'saadparwaiz1/cmp_luasnip' | ||||
|             --'PaterJason/cmp-conjure' | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|  | @ -139,4 +144,13 @@ return require('packer').startup(function(use) | |||
|         end | ||||
|     } | ||||
| 
 | ||||
|     -- Racket support | ||||
|     use 'benknoble/vim-racket' | ||||
| 
 | ||||
|     -- Conjure: Supports all Lisps that I work with. | ||||
|     use { | ||||
|         'Olical/conjure', | ||||
|         ft = { 'rkt', 'racket' } | ||||
|     } | ||||
| 
 | ||||
| end) | ||||
|  |  | |||
|  | @ -1,13 +1,21 @@ | |||
| local cmp = require('cmp') | ||||
| 
 | ||||
| cmp.setup{ | ||||
|     snippet = { | ||||
|         -- REQUIRED - you must specify a snippet engine | ||||
|         expand = function(args) | ||||
|             require('luasnip').lsp_expand(args.body) | ||||
|         end, | ||||
|     }, | ||||
|     sources = { | ||||
|         { name = 'nvim_lsp' }, | ||||
|         { name = 'luasnip' }, | ||||
|         { name = 'path' }, | ||||
|         { name = 'buffer', option = { keyword_length = 4 }, }, | ||||
|     }, | ||||
|     mapping = { | ||||
|         ['<CR>'] = cmp.mapping.confirm({}), | ||||
|         ['<CR>'] = cmp.mapping.confirm({ select = true }), | ||||
|         ['<C-Space>'] = cmp.mapping.complete(), | ||||
|         ['<Tab>'] = function(fallback) | ||||
|             if cmp.visible() then | ||||
|                 cmp.select_next_item() | ||||
|  | @ -24,3 +32,12 @@ cmp.setup{ | |||
|         end, | ||||
|     }, | ||||
| } | ||||
|   -- Setup conjure, only for supported files | ||||
| cmp.setup.filetype('racket', { | ||||
|     sources = { | ||||
|         { name = 'conjure' }, | ||||
|         { name = 'luasnip' }, | ||||
|         { name = 'path' }, | ||||
|         { name = 'buffer', option = { keyword_length = 4 }, }, | ||||
|     } | ||||
| }) | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 pgfm
						pgfm