removed luasnippet, fixed lsp keybinds.
This commit is contained in:
		
							parent
							
								
									8322dfa4e1
								
							
						
					
					
						commit
						d80d290fe2
					
				
					 4 changed files with 14 additions and 19 deletions
				
			
		| 
						 | 
					@ -87,7 +87,7 @@ vim.cmd 'colorscheme moonfly'
 | 
				
			||||||
	--toggle folds with space.
 | 
						--toggle folds with space.
 | 
				
			||||||
	map('', '<Space>', 'za', opts)
 | 
						map('', '<Space>', 'za', opts)
 | 
				
			||||||
	--clear highlighting with leader+h
 | 
						--clear highlighting with leader+h
 | 
				
			||||||
	map('n', '<leader>h', ':nohls<CR>', opts)
 | 
						map('', '<leader>h', ':nohls<CR>', opts)
 | 
				
			||||||
	--open nvim-tree with leader+t
 | 
						--open nvim-tree with leader+t
 | 
				
			||||||
	map('n', '<leader>t', ':NvimTreeToggle<CR>', opts)
 | 
						map('n', '<leader>t', ':NvimTreeToggle<CR>', opts)
 | 
				
			||||||
	--telescope stuff
 | 
						--telescope stuff
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -36,6 +36,7 @@ end
 | 
				
			||||||
-- map buffer local keybindings when the language server attaches
 | 
					-- map buffer local keybindings when the language server attaches
 | 
				
			||||||
local servers = { 'pyright', 'rust_analyzer', 'texlab'}
 | 
					local servers = { 'pyright', 'rust_analyzer', 'texlab'}
 | 
				
			||||||
for _, lsp in ipairs(servers) do
 | 
					for _, lsp in ipairs(servers) do
 | 
				
			||||||
 | 
						on_attach()
 | 
				
			||||||
	nvim_lsp[lsp].setup {
 | 
						nvim_lsp[lsp].setup {
 | 
				
			||||||
		flags = {
 | 
							flags = {
 | 
				
			||||||
			debounce_text_changes = 150,
 | 
								debounce_text_changes = 150,
 | 
				
			||||||
| 
						 | 
					@ -43,11 +44,11 @@ for _, lsp in ipairs(servers) do
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
on_attach()
 | 
					 | 
				
			||||||
--lua-language-server needs seperate config.
 | 
					--lua-language-server needs seperate config.
 | 
				
			||||||
local runtime_path = vim.split(package.path, ';')
 | 
					local runtime_path = vim.split(package.path, ';')
 | 
				
			||||||
table.insert(runtime_path, "lua/?.lua")
 | 
					table.insert(runtime_path, "lua/?.lua")
 | 
				
			||||||
table.insert(runtime_path, "lua/?/init.lua")
 | 
					table.insert(runtime_path, "lua/?/init.lua")
 | 
				
			||||||
 | 
					on_attach()
 | 
				
			||||||
require'lspconfig'.sumneko_lua.setup {
 | 
					require'lspconfig'.sumneko_lua.setup {
 | 
				
			||||||
	settings = {
 | 
						settings = {
 | 
				
			||||||
		Lua = {
 | 
							Lua = {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -20,17 +20,9 @@ end
 | 
				
			||||||
-- Set completeopt to have a better completion experience
 | 
					-- Set completeopt to have a better completion experience
 | 
				
			||||||
vim.o.completeopt = 'menuone,noselect'
 | 
					vim.o.completeopt = 'menuone,noselect'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
-- luasnip setup
 | 
					 | 
				
			||||||
local luasnip = require 'luasnip'
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
-- nvim-cmp setup
 | 
					-- nvim-cmp setup
 | 
				
			||||||
local cmp = require 'cmp'
 | 
					local cmp = require 'cmp'
 | 
				
			||||||
cmp.setup {
 | 
					cmp.setup {
 | 
				
			||||||
	snippet = {
 | 
					 | 
				
			||||||
		expand = function(args)
 | 
					 | 
				
			||||||
			require('luasnip').lsp_expand(args.body)
 | 
					 | 
				
			||||||
		end,
 | 
					 | 
				
			||||||
	},
 | 
					 | 
				
			||||||
	mapping = {
 | 
						mapping = {
 | 
				
			||||||
		['<C-p>'] = cmp.mapping.select_prev_item(),
 | 
							['<C-p>'] = cmp.mapping.select_prev_item(),
 | 
				
			||||||
		['<C-n>'] = cmp.mapping.select_next_item(),
 | 
							['<C-n>'] = cmp.mapping.select_next_item(),
 | 
				
			||||||
| 
						 | 
					@ -45,8 +37,6 @@ cmp.setup {
 | 
				
			||||||
		['<Tab>'] = function(fallback)
 | 
							['<Tab>'] = function(fallback)
 | 
				
			||||||
			if cmp.visible() then
 | 
								if cmp.visible() then
 | 
				
			||||||
				cmp.select_next_item()
 | 
									cmp.select_next_item()
 | 
				
			||||||
			elseif luasnip.expand_or_jumpable() then
 | 
					 | 
				
			||||||
				luasnip.expand_or_jump()
 | 
					 | 
				
			||||||
			else
 | 
								else
 | 
				
			||||||
				fallback()
 | 
									fallback()
 | 
				
			||||||
			end
 | 
								end
 | 
				
			||||||
| 
						 | 
					@ -54,8 +44,6 @@ cmp.setup {
 | 
				
			||||||
		['<S-Tab>'] = function(fallback)
 | 
							['<S-Tab>'] = function(fallback)
 | 
				
			||||||
			if cmp.visible() then
 | 
								if cmp.visible() then
 | 
				
			||||||
				cmp.select_prev_item()
 | 
									cmp.select_prev_item()
 | 
				
			||||||
			elseif luasnip.jumpable(-1) then
 | 
					 | 
				
			||||||
				luasnip.jump(-1)
 | 
					 | 
				
			||||||
			else
 | 
								else
 | 
				
			||||||
				fallback()
 | 
									fallback()
 | 
				
			||||||
			end
 | 
								end
 | 
				
			||||||
| 
						 | 
					@ -63,6 +51,5 @@ cmp.setup {
 | 
				
			||||||
	},
 | 
						},
 | 
				
			||||||
	sources = {
 | 
						sources = {
 | 
				
			||||||
		{ name = 'nvim_lsp' },
 | 
							{ name = 'nvim_lsp' },
 | 
				
			||||||
		{ name = 'luasnip' },
 | 
					 | 
				
			||||||
	},
 | 
						},
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -88,10 +88,8 @@ return require('packer').startup(function(use)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	use {'hrsh7th/nvim-cmp',
 | 
						use {'hrsh7th/nvim-cmp',
 | 
				
			||||||
		requires = {
 | 
							requires = {
 | 
				
			||||||
			-- 'neovim/nvim-lspconfig',
 | 
								'neovim/nvim-lspconfig',
 | 
				
			||||||
			'hrsh7th/cmp-nvim-lsp',
 | 
								'hrsh7th/cmp-nvim-lsp',
 | 
				
			||||||
			'saadparwaiz1/cmp_luasnip',
 | 
					 | 
				
			||||||
			'L3MON4D3/LuaSnip'
 | 
					 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -158,7 +156,16 @@ return require('packer').startup(function(use)
 | 
				
			||||||
		config=function() require('spellsitter').setup() end
 | 
							config=function() require('spellsitter').setup() end
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	use 'lukas-reineke/indent-blankline.nvim'
 | 
						use {'lukas-reineke/indent-blankline.nvim',
 | 
				
			||||||
 | 
							config=function()
 | 
				
			||||||
 | 
								vim.opt.list = true
 | 
				
			||||||
 | 
								vim.opt.listchars:append("eol:↴")
 | 
				
			||||||
 | 
								require('indent_blankline').setup{
 | 
				
			||||||
 | 
									show_end_of_line=true,
 | 
				
			||||||
 | 
									show_current_context=true
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							end
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	use 'bluz71/vim-moonfly-colors'
 | 
						use 'bluz71/vim-moonfly-colors'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue