fix: Tab no longer trigger auto-complete (Use CTRL+Space instead)
This commit is contained in:
parent
b347b3421c
commit
207ad67a7b
2 changed files with 5 additions and 3 deletions
|
@ -315,6 +315,7 @@ let g:ale_linters = {
|
||||||
lua <<EOF
|
lua <<EOF
|
||||||
-- Setup nvim-cmp.
|
-- Setup nvim-cmp.
|
||||||
local cmp = require'cmp'
|
local cmp = require'cmp'
|
||||||
|
|
||||||
local has_words_before = function()
|
local has_words_before = function()
|
||||||
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
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
|
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)
|
["<Tab>"] = cmp.mapping(function(fallback)
|
||||||
if cmp.visible() then
|
if cmp.visible() then
|
||||||
cmp.select_next_item()
|
cmp.select_next_item()
|
||||||
elseif has_words_before() then
|
-- elseif has_words_before() then
|
||||||
cmp.complete()
|
-- cmp.complete()
|
||||||
else
|
else
|
||||||
fallback() -- The fallback function sends a already mapped key. In this case, it's probably `<Tab>`.
|
fallback() -- The fallback function sends a already mapped key. In this case, it's probably `<Tab>`.
|
||||||
end
|
end
|
||||||
|
|
|
@ -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 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 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 *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 vue set ai sw=4 ts=4 sta et fo=croql
|
||||||
autocmd Filetype php set ai sw=4 ts=4 sta et fo=croql
|
autocmd Filetype php set ai sw=4 ts=4 sta et fo=croql
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue