Can anyone help me transform this into nvim.lua?
inoremap <silent><expr> <TAB>
\ pumvisible() ? "<C-n>" :
\ <SID>check_back_space() ? "<TAB>" : coc#refresh()
function! s:check_back_space() abort
let cpos = col('.') - 1
return !cpos || getline('.')[cpos - 1] =~# '\s'
endfunction
What I've done:
local EXPR_NOREF_NOERR_TRUNC = { expr = true, noremap = true, silent = true, nowait = true }
vim.api.nvim_set_keymap('i', '<Tab>', 'check_back_space() ? "<C-n>" : "<Tab>"', EXPR_NOREF_NOERR_TRUNC)
But I don't know what's the function in lua to get the char at left of the currnet cursor pos.