Drop blink.cmp
This commit is contained in:
parent
2f4166f9ef
commit
303bcae87e
4 changed files with 12 additions and 46 deletions
3
.gitmodules
vendored
3
.gitmodules
vendored
|
|
@ -25,6 +25,3 @@
|
|||
[submodule "bundle/conform"]
|
||||
path = bundle/conform
|
||||
url = https://github.com/stevearc/conform.nvim.git
|
||||
[submodule "bundle/blink.cmp"]
|
||||
path = bundle/blink.cmp
|
||||
url = https://github.com/saghen/blink.cmp.git
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
Subproject commit cd79f572971c58784ca72551af29af3a63da9168
|
||||
2
init.vim
2
init.vim
|
|
@ -11,7 +11,7 @@ set sidescroll=1
|
|||
set scrolloff=3
|
||||
set nobackup
|
||||
set mouse=
|
||||
set completeopt-=preview
|
||||
"set completeopt-=preview
|
||||
set nofoldenable
|
||||
set spellcapcheck=0
|
||||
set sw=2
|
||||
|
|
|
|||
52
lua/init.lua
52
lua/init.lua
|
|
@ -206,47 +206,17 @@ vim.lsp.config("rust_analyzer", {})
|
|||
-- end,
|
||||
-- })
|
||||
|
||||
-- local function check_back_space()
|
||||
-- local col = vim.fn.col('.') - 1
|
||||
-- return col <= 0 or vim.fn.getline('.'):sub(col, col):match('%s')
|
||||
-- end
|
||||
--
|
||||
-- function tab_complete()
|
||||
-- if check_back_space() then
|
||||
-- return vim.api.nvim_replace_termcodes('<Tab>', true, false, true)
|
||||
-- end
|
||||
-- return vim.api.nvim_replace_termcodes('<C-p>', true, false, true)
|
||||
-- end
|
||||
--
|
||||
-- vim.api.nvim_set_keymap('i', '<Tab>', 'v:lua.tab_complete()', { expr = true, noremap = true })
|
||||
-- vim.api.nvim_set_keymap('i', '<S-Tab>', '<C-n>', { noremap = true })
|
||||
|
||||
local has_words_before = function()
|
||||
local col = vim.api.nvim_win_get_cursor(0)[2]
|
||||
if col == 0 then
|
||||
return false
|
||||
end
|
||||
local line = vim.api.nvim_get_current_line()
|
||||
return line:sub(col, col):match("%s") == nil
|
||||
local function check_back_space()
|
||||
local col = vim.fn.col('.') - 1
|
||||
return col <= 0 or vim.fn.getline('.'):sub(col, col):match('%s')
|
||||
end
|
||||
|
||||
require("blink.cmp").setup {
|
||||
keymap = {
|
||||
preset = "none",
|
||||
function tab_complete()
|
||||
if check_back_space() then
|
||||
return vim.api.nvim_replace_termcodes('<Tab>', true, false, true)
|
||||
end
|
||||
return vim.api.nvim_replace_termcodes('<C-p>', true, false, true)
|
||||
end
|
||||
|
||||
["<Tab>"] = {
|
||||
function(cmp)
|
||||
if not has_words_before() then
|
||||
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("<Tab>", true, true, true), "n", false)
|
||||
return true
|
||||
end
|
||||
end,
|
||||
"show", "select_next", "fallback" },
|
||||
["<S-Tab>"] = { "show", "select_prev", "fallback" },
|
||||
},
|
||||
fuzzy = { implementation = "prefer_rust_with_warning" },
|
||||
completion = {
|
||||
menu = { auto_show = false },
|
||||
list = { selection = { preselect = false, auto_insert = true }, cycle = { from_top = true } },
|
||||
},
|
||||
}
|
||||
vim.api.nvim_set_keymap('i', '<Tab>', 'v:lua.tab_complete()', { expr = true, noremap = true })
|
||||
vim.api.nvim_set_keymap('i', '<S-Tab>', '<C-n>', { noremap = true })
|
||||
|
|
|
|||
Loading…
Reference in a new issue