mirror of
https://mzte.de/git/LordMZTE/dotfiles.git
synced 2024-12-15 21:33:43 +01:00
49 lines
988 B
Lua
49 lines
988 B
Lua
coc = {}
|
|
|
|
vim.g.coc_global_extensions = {
|
|
"coc-clangd",
|
|
"coc-fish",
|
|
"coc-go",
|
|
"coc-haxe",
|
|
"coc-java",
|
|
"coc-json",
|
|
"coc-kotlin",
|
|
"coc-lua",
|
|
"coc-rust-analyzer",
|
|
"coc-snippets",
|
|
"coc-tabnine",
|
|
"coc-toml",
|
|
}
|
|
|
|
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 coc.tab_completion()
|
|
if vim.fn.pumvisible() > 0 then
|
|
return escape_keycode("<C-n>")
|
|
end
|
|
|
|
if check_back_space() then
|
|
return escape_keycode("<TAB>")
|
|
end
|
|
|
|
return vim.fn["coc#refresh"]()
|
|
end
|
|
|
|
function coc.shift_tab_completion()
|
|
if vim.fn.pumvisible() > 0 then
|
|
return escape_keycode("<C-p>")
|
|
else
|
|
return escape_keycode("<C-h>")
|
|
end
|
|
end
|
|
|
|
function coc.cr_completion()
|
|
if vim.fn.pumvisible() > 0 then
|
|
return vim.fn["coc#_select_confirm"]()
|
|
else
|
|
return escape_keycode([[\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>]])
|
|
end
|
|
end
|