Jostein --
Offhand I'm guessing the problem is that your calling EditAgendaFiles
before any org file has been opened. That function is in the org.vim
script that resides in the ftplugin directory, which means that script
and functions in it aren't loaded until a filetype of .org has been
opened.
I'm wondering why you want the EditAgendaFiles() call in your vimrc in
the first place. Unless you're trying to pick files randomly by eye
it's better to assign files (or groups of files or directories of
files) to the g:agenda_files varable directly.
For example, you can see how to set up for EditAgendaFiles() in the
sample vimrc in VimOrganizer download:
--------------------------------------------
" g:org_agenda_dirs specify directories that, along with
" their subtrees, are searched for list of .org files when
" accessing EditAgendaFiles(). Specify your own here, otherwise
" default will be for g:org_agenda_dirs to hold single
" directory which is directory of the first .org file opened
" in current Vim instance:
" Below is line I use in my Windows install:
" NOTE: case sensitive even on windows.
let g:org_agenda_select_dirs=["~/desktop/org_files"]
let g:org_agenda_files = split(glob("~/desktop/org_files/org-mod*.org"),"\n")
--------------------------------------------
That code above merely sets things up so EditAgendaFiles() will work
(once an org file is opened). However, if you wanted to actually
assign agenda files in vimrc you can do so directly in code by
assigning to the g:agenda_files variable (notice this is _not_
g:org_agenda_files):
let g:agenda_files = split(glob("~/desktop/org_files/org-mod*.org"),"\n")
Does this help? Or were you trying to do something different by
calling EditAgendaFiles() in vimrc?
-- Herb