11

The abbreviation and map commands both appear to give the user redundant functionality. :imap teh the seems to get the same job done as :iabbr teh the. I tend to make all my settings in :map commands of various types- everything from typo fixes to script-like one-liners.

Is there a real difference between maps and abbreviations? Which command is best suited for which job?

user17925
  • 989
  • 2
  • 10
  • 20
  • see also: http://stackoverflow.com/questions/3776117/what-is-the-difference-between-the-remap-noremap-nnoremap-and-vnoremap-mapping – dreftymac Jun 15 '14 at 21:57

1 Answers1

13

The biggest difference in this specific case is that iabbr will only change the text once you've pressed space, and will show each character on the screen as you type. In contrast, imap will delay the display of all characters in teh until the map has resolved one way or the other. I'd recommend iabbr in this case - you'll see characters appear as you type, words that begin with the abbreviation will be handled correctly, and (most especially) you won't get an irritating delay for all words that start with t.

Peter
  • 127,331
  • 53
  • 180
  • 211
  • 4
    space is not the only key that triggers the expansion. Any non-keyword character has the same effect. – Luc Hermitte Jan 01 '10 at 14:56
  • 1
    I see. I use the `:imap jj ` and am now noticing the delay when i start any word with `j`. Is it really just a visual thing? seeing the macro in-progress vs. not seeing it? – user17925 Jan 01 '10 at 18:00