fix: update telegraf

This commit is contained in:
2024-02-22 20:17:41 +08:00
parent 23c83906b5
commit fad2c5fed9
8 changed files with 300 additions and 19 deletions
+1
View File
@@ -1,5 +1,6 @@
return {
{
"stevearc/conform.nvim",
}
}
+2 -2
View File
@@ -40,12 +40,12 @@ return {
cssls = {},
tailwindcss = {
root_dir = function(...)
return require("lspconfig.util").root_pattern(".git")(...)
return require("lspconfig.util").root_pattern('tailwind.config.js', 'tailwind.config.cjs', 'tailwind.config.mjs', 'tailwind.config.ts', 'postcss.config.js', 'postcss.config.cjs', 'postcss.config.mjs', 'postcss.config.ts', 'package.json', 'node_modules', '.git')(...)
end,
},
tsserver = {
root_dir = function(...)
return require("lspconfig.util").root_pattern(".git")(...)
return require("lspconfig.util").root_pattern("tsconfig.json", "package.json", "jsconfig.json", ".git")(...)
end,
single_file_support = false,
settings = {
+85
View File
@@ -0,0 +1,85 @@
local function keymapping(cmp)
return {
-- 上一个
['<C-k>'] = cmp.mapping.select_prev_item(),
-- 下一个
['<C-j>'] = cmp.mapping.select_next_item(),
-- 出现补全
['<A-.>'] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }),
-- 取消
['<A-,>'] = cmp.mapping({
i = cmp.mapping.abort(),
c = cmp.mapping.close(),
}),
-- 确认
-- Accept currently selected item. If none selected, `select` first item.
-- Set `select` to `false` to only confirm explicitly selected items.
['<CR>'] = cmp.mapping.confirm({
select = true,
behavior = cmp.ConfirmBehavior.Replace
}),
-- ['<C-y>'] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `<C-y>` mapping.
['<C-u>'] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }),
['<C-d>'] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }),
}
end
local function opts_func (_, opts)
local cmp = require("cmp")
-- Use buffer source for `/`.
cmp.setup.cmdline('/', {
sources = {
{ name = 'buffer' },
{ name = "emoji" },
}
})
-- Use cmdline & path source for ':'.
cmp.setup.cmdline(':', {
sources = cmp.config.sources({
{ name = 'path' }
}, {
{ name = 'cmdline' }
})
})
return {
mapping = keymapping(cmp),
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
-- For vsnip users.
{ name = 'vsnip' },
-- For luasnip users.
-- { name = 'luasnip' },
--For ultisnips users.
-- { name = 'ultisnips' },
-- -- For snippy users.
-- { name = 'snippy' },
{ name = 'emoji'}
}, { { name = 'buffer' },
{ name = 'path' }
}),
snippet = {
expand = function(args)
-- For `vsnip` users.
vim.fn["vsnip#anonymous"](args.body)
-- For `luasnip` users.
-- require('luasnip').lsp_expand(args.body)
-- For `ultisnips` users.
-- vim.fn["UltiSnips#Anon"](args.body)
-- For `snippy` users.
-- require'snippy'.expand_snippet(args.body)
end,
},
}
end
return {
{
"nvim-cmp",
dependencies = { "hrsh7th/cmp-emoji" },
opts = opts_func,
},
}
@@ -7,11 +7,4 @@ return {
position = "right",
},
},
{
"nvim-cmp",
dependencies = { "hrsh7th/cmp-emoji" },
opts = function(_, opts)
table.insert(opts.sources, { name = "emoji" })
end,
},
}
+187
View File
@@ -0,0 +1,187 @@
return {
{
"telescope.nvim",
dependencies = {
{
"nvim-telescope/telescope-fzf-native.nvim",
build = "make",
},
"nvim-telescope/telescope-file-browser.nvim",
},
keys = {
{
"<leader>fP",
function()
require("telescope.builtin").find_files({
cwd = require("lazy.core.config").options.root,
})
end,
desc = "Find Plugin File",
},
{
"<leader>sr",
function()
require("telescope.builtin").oldfiles({
cwd = vim.loop.cwd()
})
end,
desc = "Find Recent File",
},
{
";f",
function()
local builtin = require("telescope.builtin")
builtin.find_files({
no_ignore = false,
hidden = true,
})
end,
desc = "Lists files in your current working directory, respects .gitignore",
},
{
";r",
function()
local builtin = require("telescope.builtin")
builtin.live_grep({
additional_args = { "--hidden" },
})
end,
desc = "Search for a string in your current working directory and get results live as you type, respects .gitignore",
},
{
"\\\\",
function()
local builtin = require("telescope.builtin")
builtin.buffers()
end,
desc = "Lists open buffers",
},
{
";t",
function()
local builtin = require("telescope.builtin")
builtin.help_tags()
end,
desc = "Lists available help tags and opens a new window with the relevant help info on <cr>",
},
{
";;",
function()
local builtin = require("telescope.builtin")
builtin.resume()
end,
desc = "Resume the previous telescope picker",
},
{
";e",
function()
local builtin = require("telescope.builtin")
builtin.diagnostics()
end,
desc = "Lists Diagnostics for all open buffers or a specific buffer",
},
{
";s",
function()
local builtin = require("telescope.builtin")
builtin.treesitter()
end,
desc = "Lists Function names, variables, from Treesitter",
},
{
"sf",
function()
local telescope = require("telescope")
local function telescope_buffer_dir()
return vim.fn.expand("%:p:h")
end
telescope.extensions.file_browser.file_browser({
path = "%:p:h",
cwd = telescope_buffer_dir(),
respect_gitignore = false,
hidden = true,
grouped = true,
previewer = false,
initial_mode = "normal",
layout_config = { height = 40 },
})
end,
desc = "Open File Browser with the path of the current buffer",
},
},
config = function(_, opts)
local telescope = require("telescope")
local actions = require("telescope.actions")
local fb_actions = require("telescope").extensions.file_browser.actions
local trouble = require("trouble.providers.telescope")
opts.defaults = vim.tbl_deep_extend("force", opts.defaults, {
wrap_results = true,
layout_strategy = "horizontal",
layout_config = { prompt_position = "top" },
sorting_strategy = "ascending",
winblend = 0,
mappings = {
i = {
["<C-c>"] = actions.close,
["<ESC>"] = actions.close,
["<C-j>"] = actions.move_selection_next,
["<C-k>"] = actions.move_selection_previous,
["<c-t>"] = trouble.open_with_trouble,
["<C-q>"] = actions.smart_send_to_qflist + actions.open_qflist,
},
n = {
["<C-j>"] = actions.move_selection_next,
["<C-k>"] = actions.move_selection_previous,
["<c-t>"] = trouble.open_with_trouble,
["<C-q>"] = actions.smart_send_to_qflist + actions.open_qflist
},
},
})
opts.pickers = {
diagnostics = {
theme = "ivy",
initial_mode = "normal",
layout_config = {
preview_cutoff = 9999,
},
},
}
opts.extensions = {
file_browser = {
theme = "dropdown",
-- disables netrw and use telescope-file-browser in its place
hijack_netrw = true,
mappings = {
-- your custom insert mode mappings
["n"] = {
-- your custom normal mode mappings
["N"] = fb_actions.create,
["h"] = fb_actions.goto_parent_dir,
["/"] = function()
vim.cmd("startinsert")
end,
["<C-u>"] = function(prompt_bufnr)
for i = 1, 10 do
actions.move_selection_previous(prompt_bufnr)
end
end,
["<C-d>"] = function(prompt_bufnr)
for i = 1, 10 do
actions.move_selection_next(prompt_bufnr)
end
end,
["<PageUp>"] = actions.preview_scrolling_up,
["<PageDown>"] = actions.preview_scrolling_down,
},
},
},
}
telescope.setup(opts)
require("telescope").load_extension("fzf")
require("telescope").load_extension("file_browser")
end,
},
}
+15
View File
@@ -1,4 +1,19 @@
return {
{
'romgrk/barbar.nvim',
dependencies = {
'lewis6991/gitsigns.nvim', -- OPTIONAL: for git status
'nvim-tree/nvim-web-devicons', -- OPTIONAL: for file icons
},
init = function() vim.g.barbar_auto_setup = false end,
opts = {
-- lazy.nvim will automatically call setup for you. put your options here, anything missing will use the default:
-- animation = true,
-- insert_at_start = true,
-- …etc.
},
version = '^1.0.0', -- optional: only update when a new 1.x version is released
},
{
"nvimdev/dashboard-nvim",
event = "VimEnter",