Improve common string mapping instruction
This commit is contained in:
@@ -211,9 +211,7 @@ NOTE: You can call these functions in mapping via `<Cmd>lua require('cmp').compl
|
|||||||
mapping = {
|
mapping = {
|
||||||
['<C-l>'] = cmp.mapping(function(fallback)
|
['<C-l>'] = cmp.mapping(function(fallback)
|
||||||
if cmp.visible() then
|
if cmp.visible() then
|
||||||
if cmp.complete_common_string() then
|
return cmp.complete_common_string()
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
fallback()
|
fallback()
|
||||||
end, { 'i', 'c' }),
|
end, { 'i', 'c' }),
|
||||||
|
|||||||
@@ -249,7 +249,7 @@ core.complete_common_string = function(self)
|
|||||||
common_string = str.get_common_string(common_string, vim_item.word)
|
common_string = str.get_common_string(common_string, vim_item.word)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if common_string and #common_string >= (1 + cursor[2] - offset) then
|
if common_string and #common_string > (1 + cursor[2] - offset) then
|
||||||
feedkeys.call(keymap.backspace(string.sub(api.get_current_line(), offset, cursor[2])) .. common_string, 'n')
|
feedkeys.call(keymap.backspace(string.sub(api.get_current_line(), offset, cursor[2])) .. common_string, 'n')
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user