-- Some servers have issues with backup files, see #649. vim.opt.backup = false vim.opt.writebackup = false -- Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable -- delays and poor user experience. vim.opt.updatetime = 300 -- Always show the signcolumn, otherwise it would shift the text each time -- diagnostics appear/become resolved. vim.opt.signcolumn = "yes" -- Auto complete function _G.check_back_space() local col = vim.fn.col('.') - 1 return col == 0 or vim.fn.getline('.'):sub(col, col):match('%s') end local opts = { silent = true, noremap = true, expr = true } -- Use tab for trigger completion with characters ahead and navigate. -- NOTE: There's always complete item selected by default, you may want to enable -- no select by `"suggest.noselect": true` in your configuration file. -- NOTE: Use command ':verbose imap ' to make sure tab is not mapped by -- other plugin before putting this into your config. -- vim.api.nvim_set_keymap("i", "", -- 'coc#pum#visible() ? coc#pum#next(1) : v:lua.check_back_space() ? "" : coc#refresh()', opts) -- vim.api.nvim_set_keymap("i", "", -- [[coc#pum#visible() ? coc#pum#prev(1) : "\"]], opts) -- Make to accept selected completion item or notify coc.nvim to format -- u breaks current undo, please make your own choice. vim.api.nvim_set_keymap("i", "", [[coc#pum#visible() ? coc#pum#confirm() : "\u\\=coc#on_enter()\"]], opts)