map = vim.api.nvim_set_keymap function escape_keycode(keycode) return vim.api.nvim_replace_termcodes(keycode, true, true, true) 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_completion() if vim.fn.pumvisible() > 0 then return escape_keycode("") end if check_back_space() then return escape_keycode("") end return vim.fn["coc#refresh"]() end function shift_tab_completion() if vim.fn.pumvisible() > 0 then return escape_keycode("") else return escape_keycode("") end end function cr_completion() if vim.fn.pumvisible() > 0 then return vim.fn["coc#_select_confirm"]() else return escape_keycode("") end end -- Getting stuck in ~~vim~~ terminal map("t", "", "", {}) -- telescope map("n", "ff", "Telescope find_files", { silent = true }) map("n", "fg", "Telescope live_grep", { silent = true }) -- Quick cursor movement map("n", "", "5j", { noremap = true }) map("n", "", "5k", { noremap = true }) -- Quick pasting/yoinking to system register map("n", "+y", "\"+y", { noremap = true }) map("n", "+p", "\"+p", { noremap = true }) map("n", "+d", "\"+d", { noremap = true }) map("n", "*y", "\"*y", { noremap = true }) map("n", "*p", "\"*p", { noremap = true }) map("n", "*d", "\"*d", { noremap = true }) map("i", "", "v:lua.tab_completion()", { expr = true }) map("i", "", "v:lua.shift_tab_completion()", { expr = true }) map("i", "", "v:lua.cr_completion()", { expr = true }) -- symbol renaming map("n", "-n", "(coc-rename)", { silent = true }) -- apply AutoFix to problem on current line map("n", "-f", "(coc-fix-current)", { silent = true }) -- open action dialog map("n", "-a", ":CocAction", { silent = true }) -- GoTo code navigation. map("n", "gd", "(coc-definition)", { silent = true }) map("n", "gy", "(coc-type-definition)", { silent = true }) map("n", "gi", "(coc-implementation)", { silent = true }) map("n", "gr", "(coc-references)", { silent = true }) -- Use K to show documentation in preview window. map("n", "K", ":call CocActionAsync(\'doHover\')", { silent = true }) -- use space o to show symbols map("n", "o", ":CocList -I symbols", { silent = true }) -- format code map("n", "-r", ":call CocActionAsync(\'format\')", { silent = true }) -- Use to trigger completion. map("i", "", "coc#refresh()", { silent = true, expr = true }) -- Use -d to jump to next diagnostic map("n", "-d", "(coc-diagnostic-next)", { silent = true }) -- Use -o to show outline map("n", "-o", ":CocList outline", { silent = true })