I have this bit of magic in .vimrc:
inoremap <Tab> <c-r>=InsertTabWrapper()<Return>
function! InsertTabWrapper()
let col = col('.') - 1
if !col || getline('.')[col - 1] !~ '\k'
return "\<tab>"
else
return "\<c-p>"
endif
endfunction
This works fine on all systems that I use it (insert Tab at beginning of line, autocomplete otherwise), however on one system running VIM v7.0.237 the actual text InsertTabWrapper() is inserted into the file instead of running the function. Casual googling leads me to believe that any VIM 7.x version should support function calls like this. So what else might be the issue?
<C-r>=1+2<CR>work? – romainl Jan 13 at 15:50<Return>, could you try<CR>, which executes what was before it. Also try what @romainl said. – Eduan Jan 13 at 16:29:set cpo?" (with the?as part of the command) include "<" and/or "k"? – Heptite Jan 13 at 18:56<C-r>=1+2<CR>doesn't work (it prints1+2to the file). Note that upon pressing<C-r>I do see the expected"character to let me know that I've pressed<C-r>, but upon pressing=it disappears and the following characters are printed to the file. – dotancohen Jan 14 at 11:56+evalin$ vim --version | grep eval? What about:set compatible?? – romainl Jan 14 at 17:25