:help :abbreviate-local
You can combine that with a filetype plugin, e.g. put
iab <buffer> ''l ‘
iab <buffer> ''r ’
in ~/.vim/ftplugin/html.vim
or make them part of autocommands in your vimrc. I would use a function
if taking the latter approach, to avoid confusing escaping. E.g.:
function MyHTMLAbbrevs()
iab <buffer> ''l ‘
iab <buffer> ''r ’
endfunction
augroup MyAbbrevs
autocmd!
autocmd BufNewFile,BufRead *.htm,*.html,*.mkd call MyHTMLAbbrevs()
augroup END
Ben.
Well, the help at ":help :ab" mentions the ability to use an
expression, so something like
:iab <expr> ''l &ft=~'html\?\|mkd'?'‘':''''''
:iab <expr> ''r &ft=~'html\?\|mkd'?'’':''''''
might do the trick. Note that you need a "complete the
abbreviation" keystroke...usually this is a non-keyword character
as defined by 'iskeyword', however you can force the expansion
without adding an extra character by using control+] (which might
be helpful when quotes are involved)
As always, if you intend to do a bunch of these :iab for a
certain file-type, it might be worth wrapping them up in a
function to make it less onerous.
> Any help would be much appreciated and the offer of a beer is, as
> always, on... well, offer.
If you know how to get a good Yuengling lager from the
distributors in the north-eastern USA down to the north-Dallas
area, I'd be as interested in your technique as the beer itself
;-) Otherwise, take the cash you'd otherwise spend on a beer and
give it to Bram's charity of choice:
:help uganda
as I'm sure both Bram and the ICCF would appreciate it. :)
-tim