add snippet engine and continue slow reorg of config files

This commit is contained in:
JesseBot 2023-03-20 20:55:25 +01:00
parent 7b74e20fa1
commit 5882498fcf
No known key found for this signature in database
GPG key ID: C01D207CE04D55D9
3 changed files with 120 additions and 73 deletions

View file

@ -1,94 +1,105 @@
-- Set barbar's options
require("bufferline").setup({
-- Enable/disable animations
animation = true,
return {
-- ------------------------------ tab line -------------------------------
-- might go to bufferline:
-- https://github.com/LazyVim/LazyVim/blob/7a8ca6222a554bdb78fb8de35404672fc4042302/lua/lazyvim/plugins/ui.lua#L52
{'romgrk/barbar.nvim',
dependencies = {'nvim-tree/nvim-web-devicons'},
lazy = true,
config = function()
-- Set barbar's options
require("bufferline").setup({
-- Enable/disable animations
animation = true,
-- Enable/disable auto-hiding the tab bar when there is a single buffer
auto_hide = true,
-- Enable/disable auto-hiding the tab bar when there is a single buffer
auto_hide = true,
-- Enable/disable current/total tabpages indicator (top right corner)
tabpages = true,
-- Enable/disable current/total tabpages indicator (top right corner)
tabpages = true,
-- Enable/disable close button
closable = true,
-- Enable/disable close button
closable = true,
-- Enables/disable clickable tabs
-- - left-click: go to buffer
-- - middle-click: delete buffer
clickable = true,
-- Enables/disable clickable tabs
-- - left-click: go to buffer
-- - middle-click: delete buffer
clickable = true,
-- Enables / disables diagnostic symbols
diagnostics = {
-- you can use a list
{enabled = true, icon = '󰋔'}, -- ERROR
{enabled = false, icon = ''}, -- WARN
{enabled = false, icon = ''}, -- INFO
{enabled = true, icon = '󰌵'}, -- HINT
},
-- Enables / disables diagnostic symbols
diagnostics = {
-- you can use a list
{enabled = true, icon = '󰋔'}, -- ERROR
{enabled = false, icon = ''}, -- WARN
{enabled = false, icon = ''}, -- INFO
{enabled = true, icon = '󰌵'}, -- HINT
},
-- Excludes buffers from the tabline
exclude_ft = {'dashboard', 'TelescopePrompt'},
-- exclude_name = {'package.json'},
-- Excludes buffers from the tabline
exclude_ft = {'dashboard', 'TelescopePrompt'},
-- exclude_name = {'package.json'},
-- Hide inactive buffers and file extensions. Other options are `alternate`, `current`, and `visible`.
hide = {extensions = true, inactive = false},
-- Hide inactive buffers and file extensions. Other options are `alternate`, `current`, and `visible`.
hide = {extensions = true, inactive = false},
-- Disable highlighting alternate buffers
highlight_alternate = false,
-- Disable highlighting alternate buffers
highlight_alternate = false,
-- Disable highlighting file icons in inactive buffers
highlight_inactive_file_icons = false,
-- Disable highlighting file icons in inactive buffers
highlight_inactive_file_icons = false,
-- Enable highlighting visible buffers
highlight_visible = true,
-- Enable highlighting visible buffers
highlight_visible = true,
-- Enable/disable icons
-- if set to 'numbers', will show buffer index in the tabline
-- if set to 'both', will show buffer index and icons in the tabline
icons = true,
-- Enable/disable icons
-- if set to 'numbers', will show buffer index in the tabline
-- if set to 'both', will show buffer index and icons in the tabline
icons = true,
-- If set, the icon color will follow its corresponding buffer
-- highlight group. By default, the Buffer*Icon group is linked to the
-- Buffer* group (see Highlighting below). Otherwise, it will take its
-- default value as defined by devicons.
icon_custom_colors = false,
-- If set, the icon color will follow its corresponding buffer
-- highlight group. By default, the Buffer*Icon group is linked to the
-- Buffer* group (see Highlighting below). Otherwise, it will take its
-- default value as defined by devicons.
icon_custom_colors = false,
-- Configure icons on the bufferline.
icon_separator_active = '',
icon_separator_inactive = '',
icon_close_tab = '󰅗',
icon_close_tab_modified = '󰽃',
icon_pinned = '',
-- Configure icons on the bufferline.
icon_separator_active = '',
icon_separator_inactive = '',
icon_close_tab = '󰅗',
icon_close_tab_modified = '󰽃',
icon_pinned = '',
-- If true, new buffers will be inserted at the start/end of the list.
-- Default is to insert after current buffer.
insert_at_end = false,
insert_at_start = false,
-- If true, new buffers will be inserted at the start/end of the list.
-- Default is to insert after current buffer.
insert_at_end = false,
insert_at_start = false,
-- Sets the maximum padding width with which to surround each tab
maximum_padding = 2,
-- Sets the maximum padding width with which to surround each tab
maximum_padding = 2,
-- Sets the minimum padding width with which to surround each tab
minimum_padding = 1,
-- Sets the minimum padding width with which to surround each tab
minimum_padding = 1,
-- Sets the maximum buffer name length.
maximum_length = 30,
-- Sets the maximum buffer name length.
maximum_length = 30,
-- If set, the letters for each buffer in buffer-pick mode will be
-- assigned based on their name. Otherwise or in case all letters are
-- already assigned, the behavior is to assign letters in order of
-- usability (see order below)
semantic_letters = true,
-- If set, the letters for each buffer in buffer-pick mode will be
-- assigned based on their name. Otherwise or in case all letters are
-- already assigned, the behavior is to assign letters in order of
-- usability (see order below)
semantic_letters = true,
-- New buffer letters are assigned in this order. This order is
-- optimal for the qwerty keyboard layout but might need adjustement
-- for other layouts.
letters = 'asdfjkl;ghnmxcvbziowerutyqpASDFJKLGHNMXCVBZIOWERUTYQP',
-- New buffer letters are assigned in this order. This order is
-- optimal for the qwerty keyboard layout but might need adjustement
-- for other layouts.
letters = 'asdfjkl;ghnmxcvbziowerutyqpASDFJKLGHNMXCVBZIOWERUTYQP',
-- Sets the name of unnamed buffers. By default format is "[Buffer X]"
-- where X is the buffer number. But only a static string is accepted here.
no_name_title = nil,
})
end
},
-- Sets the name of unnamed buffers. By default format is "[Buffer X]"
-- where X is the buffer number. But only a static string is accepted here.
no_name_title = nil,
})
require("barbecue").setup({
theme = {
normal = { bg = "NONE", fg = "#bdd8ff" },
@ -420,3 +431,4 @@ require("scrollbar").setup({
},
}
})
}

View file

@ -1,5 +1,5 @@
-- Set up nvim-cmp: https://github.com/hrsh7th/nvim-cmp/
local cmp = require'cmp'
local cmp = require('cmp')
local has_words_before = function()
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
@ -7,6 +7,13 @@ local has_words_before = function()
end
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.
end,
},
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),

View file

@ -179,7 +179,35 @@ local plugins = {
-- {'dhruvasagar/vim-table-mode'},
-- ---------------- Language Server Protocol Plugins ---------------------
--
-- snippets
{
"L3MON4D3/LuaSnip",
build = (not jit.os:find("Windows"))
and "echo -e 'NOTE: jsregexp is optional, so not a big deal if it fails to build\n'; make install_jsregexp"
or nil,
dependencies = {
"rafamadriz/friendly-snippets",
config = function()
require("luasnip.loaders.from_vscode").lazy_load()
end,
},
opts = {
history = true,
delete_check_events = "TextChanged",
},
-- stylua: ignore
keys = {
{
"<tab>",
function()
return require("luasnip").jumpable(1) and "<Plug>luasnip-jump-next" or "<tab>"
end,
expr = true, silent = true, mode = "i",
},
{ "<tab>", function() require("luasnip").jump(1) end, mode = "s" },
{ "<s-tab>", function() require("luasnip").jump(-1) end, mode = { "i", "s" } },
},
},
-- --------- completion for the above language servers and more ----------
-- our preferred neovim autocompletion plugin
{'hrsh7th/nvim-cmp',