Last active
January 8, 2024 02:17
-
-
Save towry/9b64ffdaac414e99adc0dd411be8a1e5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
commit ee66f4d2aa9c5361f8d07ec700fba45cf2238bf9 | |
Author: Towry <[email protected]> | |
Date: Sun Jan 7 09:18:18 2024 +0800 | |
change wilmode | |
diff --git a/lua/user/config/options.lua b/lua/user/config/options.lua | |
index 058e439..2700c0d 100644 | |
--- a/lua/user/config/options.lua | |
+++ b/lua/user/config/options.lua | |
@@ -103,7 +103,8 @@ function M.init_interface() | |
o.mouse = 'a' --- Enable mouse | |
o.sidescrolloff = 8 -- Columns of context | |
o.lazyredraw = true --- lazyredraw on startup | |
- o.wildmode = { 'list:full', 'full' } -- Command-line completion mode | |
+ o.wildmode = { 'full:longest', 'list:full', 'lastused' } -- Command-line completion mode | |
+ -- o.wildchar = 9 -- trigger char, default <Tab> | |
o.cmdheight = 1 --- Give more space for displaying messages | |
o.completeopt = { 'menu', 'menuone', 'noselect' } --- Better autocompletion | |
o.complete:append('kspell') -- Add spellcheck options for autocomplete | |
commit efe48a3ff42ed6a18508dfb494719d7265601b0d | |
Author: Towry <[email protected]> | |
Date: Sun Jan 7 00:59:32 2024 +0800 | |
update wildmode | |
diff --git a/lua/user/config/options.lua b/lua/user/config/options.lua | |
index 80a2033..058e439 100644 | |
--- a/lua/user/config/options.lua | |
+++ b/lua/user/config/options.lua | |
@@ -103,7 +103,7 @@ function M.init_interface() | |
o.mouse = 'a' --- Enable mouse | |
o.sidescrolloff = 8 -- Columns of context | |
o.lazyredraw = true --- lazyredraw on startup | |
- o.wildmode = { 'longest:full', 'full' } -- Command-line completion mode | |
+ o.wildmode = { 'list:full', 'full' } -- Command-line completion mode | |
o.cmdheight = 1 --- Give more space for displaying messages | |
o.completeopt = { 'menu', 'menuone', 'noselect' } --- Better autocompletion | |
o.complete:append('kspell') -- Add spellcheck options for autocomplete | |
commit 0ad6c3c37cd54ff9b724fb65f8462a2ea1d5676d | |
Author: Towry <[email protected]> | |
Date: Sun Jan 7 00:52:20 2024 +0800 | |
update cmp opts | |
diff --git a/lua/user/plugins/autocmp.lua b/lua/user/plugins/autocmp.lua | |
index fbc3abc..5eaf556 100644 | |
--- a/lua/user/plugins/autocmp.lua | |
+++ b/lua/user/plugins/autocmp.lua | |
@@ -18,6 +18,7 @@ pack.plug({ | |
set_vim_settings = false, | |
-- h: ins-completion | |
fallback_action = '<C-x><C-l>', | |
+ delay = { completion = 150, info = 150, signature = 50 }, | |
lsp_completion = { | |
source_func = 'omnifunc', | |
auto_setup = false, | |
@@ -31,7 +32,7 @@ pack.plug({ | |
}, | |
window = { | |
info = { border = 'solid', winblend = 30 }, | |
- signature = { border = 'solid', winblend = 30 }, | |
+ signature = { border = 'single', winblend = 80 }, | |
}, | |
}) | |
end, | |
commit d03d992d464e0e5dffdcb82841c3800f3590595d | |
Author: Towry <[email protected]> | |
Date: Sun Jan 7 00:42:53 2024 +0800 | |
fix ai in native cmp | |
diff --git a/lazy-lock.json b/lazy-lock.json | |
index de5d465..f9b6652 100644 | |
--- a/lazy-lock.json | |
+++ b/lazy-lock.json | |
@@ -10,7 +10,7 @@ | |
"cheatsheet.nvim": { "branch": "master", "commit": "aa14d90e37fe267f5ef2444bf01c538e276bbabc" }, | |
"close-buffers.nvim": { "branch": "master", "commit": "3acbcad1211572342632a6c0151f839e7dead27f" }, | |
"cmd-parser.nvim": { "branch": "master", "commit": "6363b8bddef968c3ec51a38172af44f675f01ef3" }, | |
- "codeium.vim": { "branch": "main", "commit": "4063291e335e74e9ee2be04beb47d40b376312fa" }, | |
+ "copilot.vim": { "branch": "release", "commit": "5b19fb001d7f31c4c7c5556d7a97b243bd29f45f" }, | |
"crates.nvim": { "branch": "main", "commit": "6d779c7b85139d89d92a4a0bcf0afbdcf0cd961a" }, | |
"diffconflicts": { "branch": "master", "commit": "05e8d2e935a235b8f8e6d308a46a5f028ea5bf97" }, | |
"diffview.nvim": { "branch": "main", "commit": "3dc498c9777fe79156f3d32dddd483b8b3dbd95f" }, | |
diff --git a/lua/user/config/custom.lua b/lua/user/config/custom.lua | |
index 3ce60dd..5af694b 100644 | |
--- a/lua/user/config/custom.lua | |
+++ b/lua/user/config/custom.lua | |
@@ -1,9 +1,9 @@ | |
local theme = 'modus' | |
local user_cfg = { | |
ui__theme_name = vim.g.vscode and 'default' or theme, | |
- plug__enable_codeium_vim = true, | |
plug__enable_codeium_nvim = false, | |
- plug__enable_copilot_vim = false, | |
+ plug__enable_codeium_vim = false, | |
+ plug__enable_copilot_vim = true, | |
} | |
return { | |
diff --git a/lua/user/config/keymaps.lua b/lua/user/config/keymaps.lua | |
index 928f25d..134aed2 100644 | |
--- a/lua/user/config/keymaps.lua | |
+++ b/lua/user/config/keymaps.lua | |
@@ -326,7 +326,7 @@ local function setup_basic() | |
['ctrl-y'] = vim.api.nvim_replace_termcodes('<C-y>', true, true, true), | |
['ctrl-y_cr'] = vim.api.nvim_replace_termcodes('<C-y><CR>', true, true, true), | |
} | |
- set({ 'i' }, '<C-f>', function() | |
+ set({ 'i' }, '<C-y>', function() | |
-- accept ai or completion selection. | |
if vim.fn.pumvisible() ~= 0 then | |
local item_selected = vim.fn.complete_info()['selected'] ~= -1 | |
@@ -340,13 +340,14 @@ local function setup_basic() | |
else | |
-- trigger ai | |
if vim.b._copilot then | |
- vim.fn['copilot#Suggest']() | |
+ vim.fn.feedkeys(vim.fn['copilot#Suggest'](), 'i') | |
else | |
- vim.fn['codeium#Complete']() | |
+ vim.fn.feedkeys(vim.fn['codeium#Complete'](), 'i') | |
end | |
end | |
end, { | |
- silent = true, | |
+ silent = false, | |
+ expr = true, | |
desc = 'Complete AI or nvim completion', | |
}) | |
end | |
diff --git a/lua/userlib/cfg/defaults.lua b/lua/userlib/cfg/defaults.lua | |
index 488b460..90f56e8 100644 | |
--- a/lua/userlib/cfg/defaults.lua | |
+++ b/lua/userlib/cfg/defaults.lua | |
@@ -157,7 +157,7 @@ return { | |
lsp__plugin_lspsaga = true, | |
---User interfaces | |
ui__theme_name = 'default', | |
- ui__float_border = 'solid', | |
+ ui__float_border = 'single', | |
ui__window_equalalways = false, | |
workbench__lualine_theme = 'default', | |
---misc stuff. | |
commit f2c5ab8424a42fdc6458798fe0928cacdc235ac7 | |
Author: Towry <[email protected]> | |
Date: Sun Jan 7 00:30:00 2024 +0800 | |
add ai trigger | |
diff --git a/lua/user/config/keymaps.lua b/lua/user/config/keymaps.lua | |
index a5c9a0d..928f25d 100644 | |
--- a/lua/user/config/keymaps.lua | |
+++ b/lua/user/config/keymaps.lua | |
@@ -337,8 +337,16 @@ local function setup_basic() | |
elseif vim.b._codeium_completions then | |
vim.fn.feedkeys(vim.fn['codeium#Accept'](), 'i') | |
end | |
+ else | |
+ -- trigger ai | |
+ if vim.b._copilot then | |
+ vim.fn['copilot#Suggest']() | |
+ else | |
+ vim.fn['codeium#Complete']() | |
+ end | |
end | |
end, { | |
+ silent = true, | |
desc = 'Complete AI or nvim completion', | |
}) | |
end | |
commit 866900038e3b80f9d4a6a6589d2b78f433585a07 | |
Author: Towry <[email protected]> | |
Date: Sun Jan 7 00:22:23 2024 +0800 | |
feat(cmp): setup the cmp keymaps | |
diff --git a/lazy-lock.json b/lazy-lock.json | |
index b887249..de5d465 100644 | |
--- a/lazy-lock.json | |
+++ b/lazy-lock.json | |
@@ -10,7 +10,6 @@ | |
"cheatsheet.nvim": { "branch": "master", "commit": "aa14d90e37fe267f5ef2444bf01c538e276bbabc" }, | |
"close-buffers.nvim": { "branch": "master", "commit": "3acbcad1211572342632a6c0151f839e7dead27f" }, | |
"cmd-parser.nvim": { "branch": "master", "commit": "6363b8bddef968c3ec51a38172af44f675f01ef3" }, | |
- "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, | |
"codeium.vim": { "branch": "main", "commit": "4063291e335e74e9ee2be04beb47d40b376312fa" }, | |
"crates.nvim": { "branch": "main", "commit": "6d779c7b85139d89d92a4a0bcf0afbdcf0cd961a" }, | |
"diffconflicts": { "branch": "master", "commit": "05e8d2e935a235b8f8e6d308a46a5f028ea5bf97" }, | |
diff --git a/lua/user/config/keymaps.lua b/lua/user/config/keymaps.lua | |
index d0ae7c2..a5c9a0d 100644 | |
--- a/lua/user/config/keymaps.lua | |
+++ b/lua/user/config/keymaps.lua | |
@@ -321,6 +321,26 @@ local function setup_basic() | |
return '<S-Tab>' | |
end | |
end, { expr = true, silent = true }) | |
+ local keys = { | |
+ ['cr'] = vim.api.nvim_replace_termcodes('<CR>', true, true, true), | |
+ ['ctrl-y'] = vim.api.nvim_replace_termcodes('<C-y>', true, true, true), | |
+ ['ctrl-y_cr'] = vim.api.nvim_replace_termcodes('<C-y><CR>', true, true, true), | |
+ } | |
+ set({ 'i' }, '<C-f>', function() | |
+ -- accept ai or completion selection. | |
+ if vim.fn.pumvisible() ~= 0 then | |
+ local item_selected = vim.fn.complete_info()['selected'] ~= -1 | |
+ return item_selected and keys['ctrl-y'] or keys['ctrl-y_cr'] | |
+ elseif Ty.has_ai_suggestions() and Ty.has_ai_suggestion_text() then | |
+ if vim.b._copilot then | |
+ vim.fn.feedkeys(vim.fn['copilot#Accept'](), 'i') | |
+ elseif vim.b._codeium_completions then | |
+ vim.fn.feedkeys(vim.fn['codeium#Accept'](), 'i') | |
+ end | |
+ end | |
+ end, { | |
+ desc = 'Complete AI or nvim completion', | |
+ }) | |
end | |
end | |
diff --git a/lua/user/config/options.lua b/lua/user/config/options.lua | |
index 8702ab5..80a2033 100644 | |
--- a/lua/user/config/options.lua | |
+++ b/lua/user/config/options.lua | |
@@ -94,8 +94,8 @@ function M.init_interface() | |
o.relativenumber = vim.cfg.editor__relative_number and not vim.cfg.runtime__starts_as_gittool --- Enables relative number | |
o.numberwidth = 1 | |
o.number = true --- Shows current line number | |
- o.pumheight = 10 --- Max num of items in completion menu | |
- o.pumblend = 10 -- popup blend | |
+ o.pumheight = 8 --- Max num of items in completion menu | |
+ o.pumblend = 20 -- popup blend | |
o.infercase = true -- Infer letter cases for a richer built-in keyword completion | |
o.scrolloff = 10 --- Always keep space when scrolling to bottom/top edge | |
-- o.smoothscroll = true | |
@@ -105,8 +105,14 @@ function M.init_interface() | |
o.lazyredraw = true --- lazyredraw on startup | |
o.wildmode = { 'longest:full', 'full' } -- Command-line completion mode | |
o.cmdheight = 1 --- Give more space for displaying messages | |
- o.completeopt = { 'menu', 'menuone', 'noselect', 'popup' } --- Better autocompletion | |
- -- o.complete:append('kspell') -- Add spellcheck options for autocomplete | |
+ o.completeopt = { 'menu', 'menuone', 'noselect' } --- Better autocompletion | |
+ o.complete:append('kspell') -- Add spellcheck options for autocomplete | |
+ -- scan current and included files. | |
+ o.complete:append('i') | |
+ -- scan current and included files for defined name or macro | |
+ o.complete:append('d') | |
+ -- scan buffer name | |
+ o.complete:append('f') | |
o.complete:remove('t') | |
o.cursorline = true --- Highlight of current line | |
o.emoji = true --- Fix emoji display | |
diff --git a/lua/user/plugins/autocmp.lua b/lua/user/plugins/autocmp.lua | |
index 1b74e9f..c67b32d 100644 | |
--- a/lua/user/plugins/autocmp.lua | |
+++ b/lua/user/plugins/autocmp.lua | |
@@ -5,32 +5,6 @@ local libutils = require('userlib.runtime.utils') | |
local enable_cody = false | |
-local has_ai_suggestions = function() | |
- return (vim.b._copilot and vim.b._copilot.suggestions ~= nil) | |
- or (vim.b._codeium_completions and vim.b._codeium_completions.items ~= nil) | |
-end | |
-local has_ai_suggestion_text = function() | |
- if vim.b._copilot and vim.b._copilot.suggestions ~= nil then | |
- local suggestion = vim.b._copilot.suggestions[1] | |
- if suggestion ~= nil then | |
- suggestion = suggestion.displayText | |
- end | |
- return suggestion ~= nil | |
- end | |
- | |
- if vim.b._codeium_completions and vim.b._codeium_completions.items then | |
- local index = vim.b._codeium_completions.index or 0 | |
- local suggestion = vim.b._codeium_completions.items[index + 1] or {} | |
- local parts = suggestion.completionParts or {} | |
- if type(parts) ~= 'table' then | |
- return false | |
- end | |
- return #parts >= 1 | |
- end | |
- | |
- return false | |
-end | |
- | |
local MAX_INDEX_FILE_SIZE = 2000 | |
pack.plug({ | |
@@ -42,7 +16,8 @@ pack.plug({ | |
local MC = require('mini.completion') | |
MC.setup({ | |
set_vim_settings = false, | |
- fallback_action = '<C-x><C-i>', | |
+ -- h: ins-completion | |
+ fallback_action = '<C-x><C-l>', | |
lsp_completion = { | |
source_func = 'omnifunc', | |
auto_setup = false, | |
@@ -258,8 +233,8 @@ pack.plug({ | |
end | |
local entry = cmp.get_selected_entry() | |
-- copilot.vim | |
- if not entry and has_ai_suggestions() then | |
- if not has_ai_suggestion_text() then | |
+ if not entry and Ty.has_ai_suggestions() then | |
+ if not Ty.has_ai_suggestion_text() then | |
if cmp.visible() and has_words_before() then | |
cmp.confirm({ select = true }) | |
else | |
@@ -614,7 +589,7 @@ pack.plug({ | |
{ | |
'<M-u>', | |
function() | |
- if has_ai_suggestion_text() then | |
+ if Ty.has_ai_suggestion_text() then | |
local cmp = require('cmp') | |
if cmp.visible() then | |
cmp.close() | |
@@ -674,7 +649,7 @@ pack.plug({ | |
if cmp.visible() then | |
cmp.close() | |
end | |
- if has_ai_suggestion_text() then | |
+ if Ty.has_ai_suggestion_text() then | |
vim.cmd([[call copilot#Next()]]) | |
else | |
vim.cmd([[call copilot#Schedule()]]) | |
diff --git a/lua/userlib/cfg/defaults.lua b/lua/userlib/cfg/defaults.lua | |
index 90f56e8..488b460 100644 | |
--- a/lua/userlib/cfg/defaults.lua | |
+++ b/lua/userlib/cfg/defaults.lua | |
@@ -157,7 +157,7 @@ return { | |
lsp__plugin_lspsaga = true, | |
---User interfaces | |
ui__theme_name = 'default', | |
- ui__float_border = 'single', | |
+ ui__float_border = 'solid', | |
ui__window_equalalways = false, | |
workbench__lualine_theme = 'default', | |
---misc stuff. | |
diff --git a/lua/userlib/lsp/cfg/diagnostic.lua b/lua/userlib/lsp/cfg/diagnostic.lua | |
index 896f2c7..335a6cd 100644 | |
--- a/lua/userlib/lsp/cfg/diagnostic.lua | |
+++ b/lua/userlib/lsp/cfg/diagnostic.lua | |
@@ -30,10 +30,11 @@ function M.setup() | |
vim.diagnostic.config({ | |
float = { | |
- border = 'single', | |
+ border = 'solid', | |
focused = false, | |
style = 'minimal', | |
source = 'always', | |
+ winblend = 10, | |
}, | |
severity_sort = true, | |
-- @see https://github.com/neovim/neovim/pull/26193 | |
diff --git a/lua/userlib/runtime/globals.lua b/lua/userlib/runtime/globals.lua | |
index a69261c..7b53224 100644 | |
--- a/lua/userlib/runtime/globals.lua | |
+++ b/lua/userlib/runtime/globals.lua | |
@@ -168,3 +168,29 @@ Ty.client_support = function(client, method) | |
end | |
return true | |
end | |
+ | |
+Ty.has_ai_suggestions = function() | |
+ return (vim.b._copilot and vim.b._copilot.suggestions ~= nil) | |
+ or (vim.b._codeium_completions and vim.b._codeium_completions.items ~= nil) | |
+end | |
+Ty.has_ai_suggestion_text = function() | |
+ if vim.b._copilot and vim.b._copilot.suggestions ~= nil then | |
+ local suggestion = vim.b._copilot.suggestions[1] | |
+ if suggestion ~= nil then | |
+ suggestion = suggestion.displayText | |
+ end | |
+ return suggestion ~= nil | |
+ end | |
+ | |
+ if vim.b._codeium_completions and vim.b._codeium_completions.items then | |
+ local index = vim.b._codeium_completions.index or 0 | |
+ local suggestion = vim.b._codeium_completions.items[index + 1] or {} | |
+ local parts = suggestion.completionParts or {} | |
+ if type(parts) ~= 'table' then | |
+ return false | |
+ end | |
+ return #parts >= 1 | |
+ end | |
+ | |
+ return false | |
+end | |
commit e7cb6a0d9cb1b73a0d46f8214c4bb7a452f494a8 | |
Author: Towry <[email protected]> | |
Date: Sat Jan 6 23:54:45 2024 +0800 | |
feat: use native cmp | |
diff --git a/lazy-lock.json b/lazy-lock.json | |
index 88f4a3c..b887249 100644 | |
--- a/lazy-lock.json | |
+++ b/lazy-lock.json | |
@@ -10,17 +10,6 @@ | |
"cheatsheet.nvim": { "branch": "master", "commit": "aa14d90e37fe267f5ef2444bf01c538e276bbabc" }, | |
"close-buffers.nvim": { "branch": "master", "commit": "3acbcad1211572342632a6c0151f839e7dead27f" }, | |
"cmd-parser.nvim": { "branch": "master", "commit": "6363b8bddef968c3ec51a38172af44f675f01ef3" }, | |
- "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, | |
- "cmp-calc": { "branch": "main", "commit": "ce91d14d2e7a8b3f6ad86d85e34d41c1ae6268d9" }, | |
- "cmp-cmdline": { "branch": "main", "commit": "8ee981b4a91f536f52add291594e89fb6645e451" }, | |
- "cmp-git": { "branch": "main", "commit": "8d8993680d627c8f13bd85094eba84604107dbdd" }, | |
- "cmp-npm": { "branch": "main", "commit": "2337f109f51a09297596dd6b538b70ccba92b4e4" }, | |
- "cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" }, | |
- "cmp-nvim-lsp-signature-help": { "branch": "main", "commit": "3d8912ebeb56e5ae08ef0906e3a54de1c66b92f1" }, | |
- "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, | |
- "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, | |
- "cmp-registers": { "branch": "main", "commit": "a4463237a84fdc371abf930096ca1c870654916d" }, | |
- "cmp-rg": { "branch": "master", "commit": "677a7874ee8f1afc648c2e7d63a97bc21a7663c5" }, | |
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, | |
"codeium.vim": { "branch": "main", "commit": "4063291e335e74e9ee2be04beb47d40b376312fa" }, | |
"crates.nvim": { "branch": "main", "commit": "6d779c7b85139d89d92a4a0bcf0afbdcf0cd961a" }, | |
@@ -39,7 +28,6 @@ | |
"jump-tag": { "branch": "main", "commit": "b323cf42472d774f4e3564398d9a502254776de1" }, | |
"lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" }, | |
"legendary.nvim": { "branch": "master", "commit": "234e2ef8dec65db153c63a8b310c74155bb93ee7" }, | |
- "lspkind-nvim": { "branch": "master", "commit": "7f26cf5e27e2bd910ce0ea00c514da2bf97423b8" }, | |
"lua-gf.nvim": { "branch": "master", "commit": "acd0d043cab6a118a069979e8081651f2ecf6637" }, | |
"markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" }, | |
"mason-lspconfig.nvim": { "branch": "main", "commit": "56e435e09f8729af2d41973e81a0db440f8fe9c9" }, | |
@@ -48,6 +36,7 @@ | |
"mini.ai": { "branch": "main", "commit": "a1e9d8a69f608a0593d8db9cab2b774884382b29" }, | |
"mini.bufremove": { "branch": "main", "commit": "10c3feddf51b53d5a67c07858d55668dcf489c7e" }, | |
"mini.clue": { "branch": "main", "commit": "f03a61b0c5e44c2aad02d17b94186ec17826d65c" }, | |
+ "mini.completion": { "branch": "main", "commit": "3469773c1280a962bff89c06278007e8aaa30eb5" }, | |
"mini.cursorword": { "branch": "main", "commit": "bed5cc76a96ba187bfcaa292c36e366dacd6068d" }, | |
"mini.doc": { "branch": "main", "commit": "c14e342247d213e02287c8e80a51673f313c9153" }, | |
"mini.extra": { "branch": "main", "commit": "68a1df65f48d5eeade3736038af56ae21a2da983" }, | |
@@ -67,7 +56,6 @@ | |
"numb.nvim": { "branch": "master", "commit": "3f7d4a74bd456e747a1278ea1672b26116e0824d" }, | |
"nvim-bqf": { "branch": "main", "commit": "803ef8954ea42acaa8de604d813549bdbd3000dd" }, | |
"nvim-cheat.sh": { "branch": "master", "commit": "eb6acbacd39cf7c1966cb58d6586351db14607da" }, | |
- "nvim-cmp": { "branch": "main", "commit": "538e37ba87284942c1d76ed38dd497e54e65b891" }, | |
"nvim-colorizer.lua": { "branch": "master", "commit": "85855b38011114929f4058efc97af1059ab3e41d" }, | |
"nvim-dap": { "branch": "master", "commit": "f0dca670fa059eb89dda8869a6310c804241345c" }, | |
"nvim-dap-ui": { "branch": "master", "commit": "947660daced01c3eb673e3dc9527c988e42fe4cc" }, | |
diff --git a/lua/user/config/keymaps.lua b/lua/user/config/keymaps.lua | |
index 56cdfbe..d0ae7c2 100644 | |
--- a/lua/user/config/keymaps.lua | |
+++ b/lua/user/config/keymaps.lua | |
@@ -305,6 +305,23 @@ local function setup_basic() | |
desc = 'Run make', | |
silent = false, | |
}) | |
+ | |
+ if vim.cfg.edit__use_native_cmp then | |
+ -- Move inside completion list with <TAB> | |
+ set({ 'i' }, [[<Tab>]], function() | |
+ if vim.fn.pumvisible() ~= 0 then | |
+ return '<C-n>' | |
+ end | |
+ return [[<Plug>(neotab-out)]] | |
+ end, { expr = true, silent = true }) | |
+ set({ 'i' }, [[<S-Tab>]], function() | |
+ if vim.fn.pumvisible() ~= 0 then | |
+ return '<C-p>' | |
+ else | |
+ return '<S-Tab>' | |
+ end | |
+ end, { expr = true, silent = true }) | |
+ end | |
end | |
function M.setup() | |
diff --git a/lua/user/config/options.lua b/lua/user/config/options.lua | |
index e0b836a..8702ab5 100644 | |
--- a/lua/user/config/options.lua | |
+++ b/lua/user/config/options.lua | |
@@ -52,7 +52,19 @@ function M.startup() | |
-- o.shellcmdflag = '-ic' --- Make shell alias works, has bugs. | |
o.virtualedit = 'onemore' | |
-- load this early to avoid :intro screen. | |
- o.shortmess:append({ a = true, c = true, F = true, I = true, T = true, t = true }) | |
+ o.shortmess:append({ | |
+ a = true, | |
+ -- don't give ins-completion-menu messages. | |
+ c = true, | |
+ -- don't give messages while scanning for ins-completion-menu | |
+ C = true, | |
+ F = true, | |
+ I = true, | |
+ T = true, | |
+ W = true, | |
+ q = false, | |
+ t = true, | |
+ }) | |
vim.opt.laststatus = 0 --- never on startup, setup later by plugin | |
o.fillchars = { | |
stl = ' ', | |
@@ -83,7 +95,8 @@ function M.init_interface() | |
o.numberwidth = 1 | |
o.number = true --- Shows current line number | |
o.pumheight = 10 --- Max num of items in completion menu | |
- o.pumblend = 0 -- popup blend | |
+ o.pumblend = 10 -- popup blend | |
+ o.infercase = true -- Infer letter cases for a richer built-in keyword completion | |
o.scrolloff = 10 --- Always keep space when scrolling to bottom/top edge | |
-- o.smoothscroll = true | |
o.sidescroll = 10 --- Used only when 'wrap' option is off and the cursor is moved off the screen. | |
@@ -92,7 +105,9 @@ function M.init_interface() | |
o.lazyredraw = true --- lazyredraw on startup | |
o.wildmode = { 'longest:full', 'full' } -- Command-line completion mode | |
o.cmdheight = 1 --- Give more space for displaying messages | |
- o.completeopt = { 'menu', 'menuone', 'noselect' } --- Better autocompletion | |
+ o.completeopt = { 'menu', 'menuone', 'noselect', 'popup' } --- Better autocompletion | |
+ -- o.complete:append('kspell') -- Add spellcheck options for autocomplete | |
+ o.complete:remove('t') | |
o.cursorline = true --- Highlight of current line | |
o.emoji = true --- Fix emoji display | |
o.cursorlineopt = 'line' | |
@@ -118,10 +133,7 @@ function M.init_interface() | |
o.formatoptions:remove('r') | |
o.formatoptions:remove('o') | |
o.formatoptions:remove('t') | |
- if vim.fn.has('nvim-0.9.0') == 1 then | |
- o.splitkeep = 'screen' | |
- o.shortmess:append({ C = true }) | |
- end | |
+ o.splitkeep = 'screen' | |
o.lazyredraw = false --- Makes macros faster & prevent errors in complicated mappings | |
if vim.fn.executable('rg') == 1 then | |
-- credit: https://github.com/nicknisi/dotfiles/blob/1360edda1bbb39168637d0dff13dd12c2a23d095/config/nvim/init.lua#L73 | |
diff --git a/lua/user/plugins/autocmp.lua b/lua/user/plugins/autocmp.lua | |
index 1ead4da..1b74e9f 100644 | |
--- a/lua/user/plugins/autocmp.lua | |
+++ b/lua/user/plugins/autocmp.lua | |
@@ -34,14 +34,52 @@ end | |
local MAX_INDEX_FILE_SIZE = 2000 | |
pack.plug({ | |
+ { | |
+ 'echasnovski/mini.completion', | |
+ enabled = vim.cfg.edit__use_native_cmp, | |
+ event = { 'LspAttach', 'InsertEnter' }, | |
+ config = function() | |
+ local MC = require('mini.completion') | |
+ MC.setup({ | |
+ set_vim_settings = false, | |
+ fallback_action = '<C-x><C-i>', | |
+ lsp_completion = { | |
+ source_func = 'omnifunc', | |
+ auto_setup = false, | |
+ process_items = function(items, base) | |
+ -- Don't show 'Text' and 'Snippet' suggestions | |
+ -- items = vim.tbl_filter(function(x) | |
+ -- -- return x.kind ~= 1 and x.kind ~= 15 | |
+ -- end, items) | |
+ return MC.default_process_items(items, base) | |
+ end, | |
+ }, | |
+ window = { | |
+ info = { border = 'none', winblend = 30 }, | |
+ signature = { border = 'none', winblend = 30 }, | |
+ }, | |
+ }) | |
+ end, | |
+ init = function() | |
+ au.on_lsp_attach(function(_, bufnr) | |
+ vim.api.nvim_set_option_value('omnifunc', 'v:lua.MiniCompletion.completefunc_lsp', { | |
+ buf = bufnr, | |
+ }) | |
+ end) | |
+ end, | |
+ }, | |
{ | |
'L3MON4D3/LuaSnip', | |
lazy = true, | |
- dependencies = { 'rafamadriz/friendly-snippets', 'saadparwaiz1/cmp_luasnip' }, | |
+ dependencies = { | |
+ 'rafamadriz/friendly-snippets', | |
+ --'saadparwaiz1/cmp_luasnip' | |
+ }, | |
}, | |
{ | |
'petertriho/cmp-git', | |
ft = 'gitcommit', | |
+ enabled = not vim.cfg.edit__use_native_cmp, | |
dependencies = { | |
'hrsh7th/nvim-cmp', | |
'hrsh7th/cmp-buffer', | |
@@ -60,7 +98,7 @@ pack.plug({ | |
{ | |
'lukas-reineke/cmp-rg', | |
cond = function() | |
- return vim.fn.executable('rg') == 1 | |
+ return vim.fn.executable('rg') == 1 and not vim.cfg.edit__use_native_cmp | |
end, | |
ft = 'rgflow', | |
dependencies = { | |
@@ -79,6 +117,7 @@ pack.plug({ | |
}, | |
{ | |
'hrsh7th/nvim-cmp', | |
+ enabled = not vim.cfg.edit__use_native_cmp, | |
event = { 'InsertEnter', 'CmdlineEnter' }, | |
dependencies = { | |
'noearc/cmp-registers', | |
@@ -159,26 +198,6 @@ pack.plug({ | |
end | |
end | |
- -- ╭──────────────────────────────────────────────────────────╮ | |
- -- │ Setup │ | |
- -- ╰──────────────────────────────────────────────────────────╯ | |
- local source_mapping = { | |
- registers = icons.bomb .. 'REG', | |
- npm = icons.terminal .. 'NPM', | |
- cody = icons.copilot .. 'CODY', | |
- cmp_tabnine = icons.light, | |
- codeium = icons.copilot .. 'AI', | |
- copilot = icons.copilot .. 'AI', | |
- nvim_lsp = icons.paragraph .. 'LSP', | |
- nvim_lsp_signature_help = icons.typeParameter .. 'ARG', | |
- buffer = icons.buffer .. 'BUF', | |
- nvim_lua = icons.bomb, | |
- luasnip = icons.snippet .. 'SNP', | |
- path = icons.folderOpen2, | |
- treesitter = icons.tree, | |
- zsh = icons.terminal .. 'ZSH', | |
- } | |
- | |
local buffer_option = { | |
-- Complete from all visible buffers (splits) | |
get_bufnrs = function() | |
diff --git a/lua/user/plugins/lsp.lua b/lua/user/plugins/lsp.lua | |
index 1f14595..1f49a25 100644 | |
--- a/lua/user/plugins/lsp.lua | |
+++ b/lua/user/plugins/lsp.lua | |
@@ -28,7 +28,7 @@ plug({ | |
'neovim/nvim-lspconfig', | |
lazy = true, | |
dependencies = { | |
- 'hrsh7th/cmp-nvim-lsp', | |
+ -- 'hrsh7th/cmp-nvim-lsp', | |
'williamboman/mason-lspconfig.nvim', | |
'williamboman/mason.nvim', | |
{ | |
diff --git a/lua/userlib/cfg/defaults.lua b/lua/userlib/cfg/defaults.lua | |
index 11c8f35..90f56e8 100644 | |
--- a/lua/userlib/cfg/defaults.lua | |
+++ b/lua/userlib/cfg/defaults.lua | |
@@ -47,6 +47,8 @@ return { | |
'python3', | |
}, | |
runtime__python3_host_prog = '$HOME/.pyenv/shims/python', | |
+ ---editing | |
+ edit__use_native_cmp = true, | |
---editor stuff | |
--enable relative number or not. | |
editor__relative_number = true, | |
diff --git a/lua/userlib/lsp/cfg/capbilities.lua b/lua/userlib/lsp/cfg/capbilities.lua | |
index 01e6abb..0ab1e40 100644 | |
--- a/lua/userlib/lsp/cfg/capbilities.lua | |
+++ b/lua/userlib/lsp/cfg/capbilities.lua | |
@@ -1,6 +1,14 @@ | |
---@param default_capabilities? table | |
return function(default_capabilities) | |
- local capabilities = default_capabilities or require('cmp_nvim_lsp').default_capabilities() | |
+ local capabilities = default_capabilities | |
+ if not capabilities then | |
+ if vim.cfg.edit__use_native_cmp then | |
+ capabilities = vim.lsp.protocol.make_client_capabilities() | |
+ else | |
+ print("---") | |
+ capabilities = require('cmp_nvim_lsp').default_capabilities() | |
+ end | |
+ end | |
capabilities.textDocument.foldingRange = { | |
dynamicRegistration = false, | |
diff --git a/lua/userlib/lsp/cfg/init.lua b/lua/userlib/lsp/cfg/init.lua | |
index e24d956..339df4d 100644 | |
--- a/lua/userlib/lsp/cfg/init.lua | |
+++ b/lua/userlib/lsp/cfg/init.lua | |
@@ -12,7 +12,7 @@ local lsp_flags = { | |
function M.get_config_for_server(server_name) | |
local handlers = require('userlib.lsp.cfg.handlers') | |
if not capabilities then | |
- capabilities = require('userlib.lsp.cfg.capbilities')(require('cmp_nvim_lsp').default_capabilities()) | |
+ capabilities = require('userlib.lsp.cfg.capbilities')() | |
end | |
if lspconfig_cache[server_name] then |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment