-- Autocomplete Behavior
vim.opt.wildmode = 'list:longest,list:full' -- Autocomplete common matching string
- -- first, and then the full match.
-- Folding Behavior
vim.opt.foldmethod = 'syntax' -- Use syntax highlight to define folds
vim.api.nvim_create_autocmd({'User'}, {
pattern = 'GoyoEnter',
- callback = 'Limelight'
+ command = 'Limelight'
})
vim.api.nvim_create_autocmd({'User'}, {
pattern = 'GoyoLeave',
- callback = 'Limelight!'
+ command = 'Limelight!'
})
---[[
-nnoremap <leader>i :Limelight!!<CR>==
-inoremap <leader>i <Esc>:Limelight!!<CR>==gi
-vnoremap <leader>i :<C-u>Limelight!!<CR>gv=gv
-nnoremap <leader>g :Goyo<CR>==
-inoremap <leader>g <Esc>:Goyo<CR>==gi
-vnoremap <leader>g :<C-u>Goyo<CR>gv=gv
-]]--
+
+vim.keymap.set('n', '<leader>i', ':Limelight!!<CR>==')
+vim.keymap.set('i', '<leader>i', '<Esc>:Limelight!!<CR>==gi')
+vim.keymap.set('v', '<leader>i', ':<C-u>Limelight!!<CR>gv=gv')
+vim.keymap.set('n', '<leader>g', ':Goyo<CR>==')
+vim.keymap.set('i', '<leader>g', '<Esc>:Goyo<CR>==gi')
+vim.keymap.set('v', '<leader>g', ':<C-u>Goyo<CR>gv=gv')
+
+-- CoC
+vim.keymap.set('i', '<TAB>', 'pumvisible() ? "\\<C-n>" : "\\<TAB>"', {expr = true, silent = true})
+vim.keymap.set('i', '<S-TAB>', 'pumvisible() ? "\\<C-p>" : "\\<C-h>"', {expr = true, silent = true})
+vim.keymap.set('i', '<S-TAB>', 'pumvisible() ? "\\<C-p>" : "\\<C-h>"', {expr = true, silent = true})
+vim.keymap.set('i', '<C-Space>', 'coc#refresh()', {expr = true, silent = true})
+vim.keymap.set('n', 'K', ':call CocActionAsync("doHover")<CR>', {silent = true})
+
+vim.keymap.set('n', '[g', '<Plug>(coc-diagnostic-prev)', {silent = true})
+vim.keymap.set('n', ']g', '<Plug>(coc-diagnostic-next)', {silent = true})
+
+vim.keymap.set('n', 'gd', '<Plug>(coc-definition)', {silent = true})
+vim.keymap.set('n', 'gy', '<Plug>(coc-type-definition)', {silent = true})
+vim.keymap.set('n', 'gi', '<Plug>(coc-implementation)', {silent = true})
+vim.keymap.set('n', 'gr', '<Plug>(coc-references)', {silent = true})
-- Plugins
require('plugins')