Andrea Spadaccini wrote:
Hello vimmers,
I'd like to load some settings when I enter in a directory, like for
instance setting makeprg.

Is there a way to do it?
Thanks in advance from a lurker! :)


'makeprg' is a global-local option. Maybe the other ones you want to set are also buffer-local or global-local. Then you can set them by means of ":setlocal" at the BufRead,BufNewFile events. You can also set up buffer-local mappings and abbreviations by means of ":map <buffer>" and ":abbrev <buffer>". Set them at the same events. For window-local options I suppose you should use the BufWinEnter event (still with "setlocal"). Whether you do it by means of a script, a function, or straight on the ":autocmd" line, is IMHO purely a matter of taste.

I hope you won't feel the need to set global-only options like 'guifont' -- for these ones you would need the BufEnter event, meaning they would change whenever you switched buffers by switching windows through (e.g.) ^Ww and the result could be ugly -- in that case you might want to reassess your priorities and possibly dedicate a separate instance of gvim to each distinct setting of such global-only options.


Best regards,
Tony.

Reply via email to