Merge 'upstream' timeoutlen, cmp scroll, friendly snippets, luasnip, ruby

Merged:
- fix: disable ts indenting for Ruby
- doc: add note about advanced luasnip features
- Move friendly snippets to dependencies of LuaSnip (#759)
- Add <C-b>/<C-f> cmp mapping to scroll cmp docs (#750)
- doc: add info about timeoutlen (#691)
This commit is contained in:
Damjan 9000 2024-03-15 18:15:40 +01:00
commit 55008e9c68
3 changed files with 29 additions and 8 deletions

View File

@ -15,6 +15,17 @@ return {
end end
return 'make install_jsregexp' return 'make install_jsregexp'
end)(), end)(),
dependencies = {
-- `friendly-snippets` contains a variety of premade snippets.
-- See the README about individual language/framework/plugin snippets:
-- https://github.com/rafamadriz/friendly-snippets
-- {
-- 'rafamadriz/friendly-snippets',
-- config = function()
-- require('luasnip.loaders.from_vscode').lazy_load()
-- end,
-- },
},
}, },
'saadparwaiz1/cmp_luasnip', 'saadparwaiz1/cmp_luasnip',
@ -23,12 +34,6 @@ return {
-- into multiple repos for maintenance purposes. -- into multiple repos for maintenance purposes.
'hrsh7th/cmp-nvim-lsp', 'hrsh7th/cmp-nvim-lsp',
'hrsh7th/cmp-path', 'hrsh7th/cmp-path',
-- If you want to add a bunch of pre-configured snippets,
-- you can use this plugin to help you. It even has snippets
-- for various frameworks/libraries/etc. but you will have to
-- set up the ones that are useful for you.
-- 'rafamadriz/friendly-snippets',
}, },
config = function() config = function()
-- See `:help cmp` -- See `:help cmp`
@ -54,6 +59,10 @@ return {
-- Select the [p]revious item -- Select the [p]revious item
['<C-p>'] = cmp.mapping.select_prev_item(), ['<C-p>'] = cmp.mapping.select_prev_item(),
-- scroll the documentation window [b]ack / [f]orward
['<C-b>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
-- Accept ([y]es) the completion. -- Accept ([y]es) the completion.
-- This will auto-import if your LSP supports it. -- This will auto-import if your LSP supports it.
-- This will expand snippets if the LSP sent a snippet. -- This will expand snippets if the LSP sent a snippet.
@ -82,6 +91,9 @@ return {
luasnip.jump(-1) luasnip.jump(-1)
end end
end, { 'i', 's' }), end, { 'i', 's' }),
-- For more advanced luasnip keymaps (e.g. selecting choice nodes, expansion) see:
-- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
}, },
sources = { sources = {
{ name = 'nvim_lsp' }, { name = 'nvim_lsp' },

View File

@ -6,8 +6,14 @@ return {
ensure_installed = { 'bash', 'c', 'html', 'lua', 'markdown', 'vim', 'vimdoc' }, ensure_installed = { 'bash', 'c', 'html', 'lua', 'markdown', 'vim', 'vimdoc' },
-- Autoinstall languages that are not installed -- Autoinstall languages that are not installed
auto_install = true, auto_install = true,
highlight = { enable = true }, highlight = {
indent = { enable = true }, enable = true,
-- Some languages depend on vim's regex highlighting system (such as Ruby) for indent rules.
-- If you are experiencing weird indenting issues, add the language to
-- the list of additional_vim_regex_highlighting and disabled languages for indent.
additional_vim_regex_highlighting = { 'ruby' },
},
indent = { enable = true, disable = { 'ruby' } },
}, },
config = function(_, opts) config = function(_, opts)
-- [[ Configure Treesitter ]] See `:help nvim-treesitter` -- [[ Configure Treesitter ]] See `:help nvim-treesitter`

View File

@ -35,6 +35,9 @@ vim.opt.signcolumn = 'yes'
-- Decrease update time -- Decrease update time
vim.opt.updatetime = 250 vim.opt.updatetime = 250
-- Decrease mapped sequence wait time
-- Displays which-key popup sooner
vim.opt.timeoutlen = 300 vim.opt.timeoutlen = 300
-- Configure how new splits should be opened -- Configure how new splits should be opened