From 3cec0c208b504fc2c46737e51cfdaa34e134292a Mon Sep 17 00:00:00 2001 From: ray Date: Wed, 5 Oct 2022 20:29:01 +0100 Subject: [PATCH] update --- init.plugins.vim | 3 +- lua/init-cmp.lua | 93 ++++++++++++++++++++---------------------------- lua/init.lua | 6 ++++ 3 files changed, 47 insertions(+), 55 deletions(-) diff --git a/init.plugins.vim b/init.plugins.vim index f517942..56c7a47 100644 --- a/init.plugins.vim +++ b/init.plugins.vim @@ -243,9 +243,10 @@ let g:mta_filetypes = { let g:netrw_preview = 0 let g:netrw_winsize = 50 let g:netrw_altv = &spr - let g:netrw_alto = 1 + let g:netrw_alto = 0 let g:netrw_altfile = 1 let g:netrw_mousemaps = 0 + let g:netrw_keepdir = 0 "}}} " #Obsession{{{ diff --git a/lua/init-cmp.lua b/lua/init-cmp.lua index e2a05b6..6017191 100644 --- a/lua/init-cmp.lua +++ b/lua/init-cmp.lua @@ -1,56 +1,41 @@ -local cmp = require'cmp' +local cmp = require 'cmp' cmp.setup({ - formatting = { - format = function(entry, vim_item) - -- set a name for each source - vim_item.menu = ({ - nvim_lsp = "[LSP]", - path = "[Path]", - buffer = "[Buffer]", - ultisnips = "[UltiSnips]", - })[entry.source.name] - return vim_item - end, - }, - completion = { - keyword_length = 1, - max_item_count = 20, - -- autocomplete = false - }, - snippet = { - expand = function(args) - vim.fn["UltiSnips#Anon"](args.body) - end, - }, - mapping = { - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - [""] = cmp.mapping({ - i = function() - if cmp.visible() then - cmp.select_next_item({ behavior = cmp.SelectBehavior.Insert }) - else - cmp.complete() - end - end, - }), - }, - sources = { - { - name = 'nvim_lsp', - max_item_count = 8, - keyword_length = 3, - }, - { name = 'path' }, - { - name = 'buffer', - keyword_length = 4, - max_item_count = 20, - }, - { - name = 'ultisnips', - priority_weight = 10, - keyword_length = 1, - }, - } + window = {documentation = cmp.config.window.bordered({border = "single"})}, + formatting = { + format = function(entry, vim_item) + -- set a name for each source + vim_item.menu = ({ + nvim_lsp = "[LSP]", + path = "[Path]", + buffer = "[Buffer]", + ultisnips = "[UltiSnips]" + })[entry.source.name] + return vim_item + end + }, + completion = { + keyword_length = 1, + max_item_count = 20 + -- autocomplete = false + }, + snippet = {expand = function(args) vim.fn["UltiSnips#Anon"](args.body) end}, + mapping = { + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping({ + i = function() + if cmp.visible() then + cmp.select_next_item({behavior = cmp.SelectBehavior.Insert}) + else + cmp.complete() + end + end + }) + }, + sources = { + {name = 'nvim_lsp', max_item_count = 8, keyword_length = 3}, + {name = 'path'}, + {name = 'buffer', keyword_length = 4, max_item_count = 20}, + {name = 'ultisnips', priority_weight = 10, keyword_length = 1} + } }) diff --git a/lua/init.lua b/lua/init.lua index 4eab7f2..474893d 100644 --- a/lua/init.lua +++ b/lua/init.lua @@ -8,6 +8,7 @@ vim.diagnostic.config({ update_in_insert = false, severity_sort = true, float = { + border = "single", source = "always" -- Or "if_many" } }) @@ -24,6 +25,11 @@ local border = { {"└", "FloatBorder"}, {"│", "FloatBorder"} } +vim.lsp.handlers["textDocument/hover"] = + vim.lsp.with(vim.lsp.handlers.hover, {border = "single"}) +vim.lsp.handlers["textDocument/signatureHelp"] = + vim.lsp.with(vim.lsp.handlers.signature_help, {border = "single"}) + local orig_util_open_floating_preview = vim.lsp.util.open_floating_preview function vim.lsp.util.open_floating_preview(contents, syntax, opts, ...) opts = opts or {}