From 77ed4bd95039beb8b5085c695f6a2d924187bc42 Mon Sep 17 00:00:00 2001 From: Youwen Wu Date: Fri, 11 Oct 2024 23:53:54 -0700 Subject: [PATCH] fix: better blink-cmp config, no more render-markdown --- lua/plugins/blink-cmp.lua | 172 +------------------------------- lua/plugins/render-markdown.lua | 14 --- 2 files changed, 1 insertion(+), 185 deletions(-) diff --git a/lua/plugins/blink-cmp.lua b/lua/plugins/blink-cmp.lua index cb61406..eecba0d 100644 --- a/lua/plugins/blink-cmp.lua +++ b/lua/plugins/blink-cmp.lua @@ -21,51 +21,6 @@ return { snippet_backward = "", }, - accept = { - create_undo_point = true, - auto_brackets = { - enabled = false, - default_brackets = { "(", ")" }, - override_brackets_for_filetypes = {}, - -- Overrides the default blocked filetypes - force_allow_filetypes = {}, - blocked_filetypes = {}, - -- Synchronously use the kind of the item to determine if brackets should be added - kind_resolution = { - enabled = true, - blocked_filetypes = { "typescript", "typescriptreact", "javascript", "javascriptreact", "vue" }, - }, - -- Asynchronously use semantic token to determine if brackets should be added - semantic_token_resolution = { - enabled = true, - blocked_filetypes = {}, - }, - }, - }, - - trigger = { - completion = { - -- regex used to get the text when fuzzy matching - -- changing this may break some sources, so please report if you run into issues - -- todo: shouldnt this also affect the accept command? should this also be per language? - keyword_regex = "[%w_\\-]", - -- LSPs can indicate when to show the completion window via trigger characters - -- however, some LSPs (*cough* tsserver *cough*) return characters that would essentially - -- always show the window. We block these by default - blocked_trigger_characters = { " ", "\n", "\t" }, - -- when true, will show the completion window when the cursor comes after a trigger character when entering insert mode - show_on_insert_on_trigger_character = true, - }, - - signature_help = { - enabled = false, - blocked_trigger_characters = {}, - blocked_retrigger_characters = {}, - -- when true, will show the signature help window when the cursor comes after a trigger character when entering insert mode - show_on_insert_on_trigger_character = true, - }, - }, - fuzzy = { -- frencency tracks the most recently/frequently used items and boosts the score of the item use_frecency = true, @@ -78,7 +33,7 @@ return { prebuiltBinaries = { -- Whether or not to automatically download a prebuilt binary from github. If this is set to `false` -- you will need to manually build the fuzzy binary dependencies by running `cargo build --release` - download = true, + download = false, -- When downloading a prebuilt binary force the downloader to resolve this version. If this is uset -- then the downloader will attempt to infer the version from the checked out git tag (if any). -- @@ -87,91 +42,12 @@ return { }, }, - sources = { - -- similar to nvim-cmp's sources, but we point directly to the source's lua module - -- multiple groups can be provided, where it'll fallback to the next group if the previous - -- returns no completion items - -- WARN: This API will have breaking changes during the beta - -- FOR REF: full example - providers = { - { - -- all of these properties work on every source - { - "blink.cmp.sources.lsp", - keyword_length = 0, - score_offset = 0, - trigger_characters = { "f", "o", "o" }, - opts = {}, - }, - -- the follow two sources have additional options - { - "blink.cmp.sources.path", - opts = { - trailing_slash = false, - label_trailing_slash = true, - get_cwd = function(context) - return vim.fn.expand(("#%d:p:h"):format(context.bufnr)) - end, - show_hidden_files_by_default = true, - }, - }, - { - "blink.cmp.sources.snippets", - score_offset = -3, - -- similar to https://github.com/garymjr/nvim-snippets - opts = { - friendly_snippets = true, - search_paths = { vim.fn.stdpath("config") .. "/snippets" }, - global_snippets = { "all" }, - extended_filetypes = {}, - ignored_filetypes = {}, - }, - }, - }, - { { "blink.cmp.sources.buffer" } }, - }, - }, - windows = { - autocomplete = { - min_width = 30, - max_width = 60, - max_height = 10, - border = "none", - winhighlight = "Normal:BlinkCmpMenu,FloatBorder:BlinkCmpMenuBorder,CursorLine:BlinkCmpMenuSelection,Search:None", - -- keep the cursor X lines away from the top/bottom of the window - scrolloff = 2, - -- which directions to show the window, - -- falling back to the next direction when there's not enough space - direction_priority = { "s", "n" }, - -- whether to preselect the first item in the completion list - preselect = true, - -- Controls how the completion items are rendered on the popup window - -- 'simple' will render the item's kind icon the left alongside the label - -- 'reversed' will render the label on the left and the kind icon + name on the right - -- 'function(blink.cmp.CompletionRenderContext): blink.cmp.Component[]' for custom rendering - draw = "simple", - -- Controls the cycling behavior when reaching the beginning or end of the completion list. - cycle = { - -- When `true`, calling `select_next` at the *bottom* of the completion list will select the *first* completion item. - from_bottom = true, - -- When `true`, calling `select_prev` at the *top* of the completion list will select the *last* completion item. - from_top = true, - }, - }, documentation = { min_width = 10, max_width = 60, max_height = 20, border = "padded", - winhighlight = "Normal:BlinkCmpDoc,FloatBorder:BlinkCmpDocBorder,CursorLine:BlinkCmpDocCursorLine,Search:None", - -- which directions to show the documentation window, - -- for each of the possible autocomplete window directions, - -- falling back to the next direction when there's not enough space - direction_priority = { - autocomplete_north = { "e", "w", "n", "s" }, - autocomplete_south = { "e", "w", "s", "n" }, - }, auto_show = true, auto_show_delay_ms = 500, update_delay_ms = 100, @@ -181,54 +57,8 @@ return { max_width = 100, max_height = 10, border = "padded", - winhighlight = "Normal:BlinkCmpSignatureHelp,FloatBorder:BlinkCmpSignatureHelpBorder", }, }, - - highlight = { - ns = vim.api.nvim_create_namespace("blink_cmp"), - -- sets the fallback highlight groups to nvim-cmp's highlight groups - -- useful for when your theme doesn't support blink.cmp - -- will be removed in a future release, assuming themes add support - use_nvim_cmp_as_default = false, - }, - - -- set to 'mono' for 'Nerd Font Mono' or 'normal' for 'Nerd Font' - -- adjusts spacing to ensure icons are aligned - nerd_font_variant = "normal", - - kind_icons = { - Text = "󰉿", - Method = "󰊕", - Function = "󰊕", - Constructor = "󰒓", - - Field = "󰜢", - Variable = "󰆦", - Property = "󰖷", - - Class = "󱡠", - Interface = "󱡠", - Struct = "󱡠", - Module = "󰅩", - - Unit = "󰪚", - Value = "󰦨", - Enum = "󰦨", - EnumMember = "󰦨", - - Keyword = "󰻾", - Constant = "󰏿", - - Snippet = "󱄽", - Color = "󰏘", - File = "󰈔", - Reference = "󰬲", - Folder = "󰉋", - Event = "󱐋", - Operator = "󰪚", - TypeParameter = "󰬛", - }, }) end, } diff --git a/lua/plugins/render-markdown.lua b/lua/plugins/render-markdown.lua index a506269..239cd4c 100644 --- a/lua/plugins/render-markdown.lua +++ b/lua/plugins/render-markdown.lua @@ -4,20 +4,6 @@ return { after = function() require("render-markdown").setup({ file_types = { "markdown" }, - overrides = { - buftype = { - nofile = { - render_modes = { "n", "c", "i" }, - debounce = 5, - code = { - left_pad = 0, - right_pad = 0, - language_pad = 0, - }, - }, - }, - filetype = {}, - }, }) end, },