fix: Tab no longer trigger auto-complete (Use CTRL+Space instead)

This commit is contained in:
ziro 2023-04-15 09:13:27 +07:00
parent b347b3421c
commit 207ad67a7b
Signed by: null2264
GPG key ID: BA64F8B60AF3EFB6
2 changed files with 5 additions and 3 deletions

View file

@ -315,6 +315,7 @@ let g:ale_linters = {
lua <<EOF
-- Setup nvim-cmp.
local cmp = require'cmp'
local has_words_before = function()
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
@ -349,8 +350,8 @@ lua <<EOF
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif has_words_before() then
cmp.complete()
-- elseif has_words_before() then
-- cmp.complete()
else
fallback() -- The fallback function sends a already mapped key. In this case, it's probably `<Tab>`.
end

View file

@ -95,7 +95,8 @@ autocmd BufEnter *.c set ai sw=4 ts=4 sta noet fo=croql
autocmd BufEnter *.md set ai sw=3 ts=3 sta et fo=croql
autocmd Filetype html* set ai sw=4 ts=4 sta et fo=croql
autocmd Filetype *css set ai sw=4 ts=4 sta et fo=croql
autocmd Filetype javascript set ai sw=4 ts=4 sta et fo=croql
autocmd Filetype javascript* set ai sw=4 ts=4 sta et fo=croql
autocmd Filetype json set ai sw=4 ts=4 sta et fo=croql
autocmd Filetype vue set ai sw=4 ts=4 sta et fo=croql
autocmd Filetype php set ai sw=4 ts=4 sta et fo=croql