fREW wrote:

Hey everyone,

How do I have a function call Normal commands?  Example: I'd like to
make a function that will open a certain file, and then set the
foldlevel to 1, and then go to the right window.  So I have:

function TodoListMode()
 execute ":e ~/.todo.otl"
 execute ":Calendar"
endfunction

and then after the second command I want to do:
<ctrl>wl
zM
zr

* may I point out that you're using "execute" when you don't need to.
* you're already in ex mode; no need to use colons to do ex mode commands
* ctrl-w_l can be performed with wincmd l .
* to perform normal mode commands in a function, use norm! (the exclamation prevents any maps from interfering)

So, with these points in mind:

fun! TodoListMode()
 e ~/.todo.otl
 wincmd l
 norm! zMzr
 Calendar
endfun

Now, I confess that I didn't test this...

Regards,
Chip Campbell

Reply via email to