Pergunta

Is there a plugin or snippet that I can use to automcomplete -> or => by pressing - or = + tab?

I just can't stand typing > all the time.

I tried creating the following snippets for snipmate, but they don't work because - and = are affixed to the end of a variable.

Foi útil?

Solução

Here's a snippet for you:

:inoremap <expr> <Tab> getline('.')[col('.')-2]=~#'[-=]' ? ">" : "\<Tab>"

This is an expression mapping that maps <Tab> in insert mode to > if the character before the cursor is either - or =.

See :h :map-expression.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top