Re: How to open the latest modified file

2010-08-19 Thread Sven Guckes
* eliweiq001 [2010-08-19 09:51]: > I want to write a function in vimrc that can open > the lastest modified file in the current directory, > Is it easy to do it? How to write it? what is your goal? does it have to be a function within vim? is this a test for programming in vim? because most goo

Re: How to open the latest modified file

2010-08-19 Thread eliweiq001
I am using a portable edition of gVim in windows. I have to open gVim and then open a .c file every time,( for learning programing ), so I want a function and map a key to it, then I can open the file very quickly. Maybe It would be better that the function can both run in windows and linux. On

Re: How to open the latest modified file

2010-08-19 Thread Christian Brabandt
Hi eliweiq001! On Do, 19 Aug 2010, eliweiq001 wrote: > I am using a portable edition of gVim in windows. > I have to open gVim and then open a .c file every time,( for learning > programing ), so I want a function and map a key to it, then I can > open the file very quickly. > Maybe It would be

Re: How to open the latest modified file

2010-08-19 Thread eliweiq001
On 8月19日, 下午7时11分, Christian Brabandt wrote: > Hi eliweiq001! > > On Do, 19 Aug 2010, eliweiq001 wrote: > > > I am using a portable edition of gVim in windows. > > I have to open gVim and then open a .c file every time,( for learning > > programing ), so I want a function and map a key to it, t

Re: How to open the latest modified file

2010-08-19 Thread bill lam
Чтв, 19 Авг 2010, eliweiq001 писал(а): > > > On 8月19日, 下午7时11分, Christian Brabandt wrote: > [---=| Quote block shrunk by t-prot: 27 lines snipped |=---] > > > > com! -complete=dir -nargs=? EditLastModified :exe ':tabe ' . > > OpenLastModified() > > #v- > > > > Use :OpenLastModified to open the

Re: How to open the latest modified file

2010-08-19 Thread eliweiq001
On 8月19日, 下午10时13分, bill lam wrote: > Чтв, 19 Авг 2010, eliweiq001 писал(а): > > If you want to open the latest modified file by vim, you the use the > RecentFiles.vim plugin (there are some others, but I cannot recall their > names), which can display a list of most recently used files. > > --

Re: How to open the latest modified file

2010-08-19 Thread eliweiq001
On 8月19日, 下午10时13分, bill lam wrote: > Чтв, 19 Авг 2010, eliweiq001 писал(а): > > If you want to open the latest modified file by vim, you the use the > RecentFiles.vim plugin (there are some others, but I cannot recall their > names), which can display a list of most recently used files. > > --

Re: How to open the latest modified file

2010-08-19 Thread eliweiq001
On 8月19日, 下午10时13分, bill lam wrote: > Чтв, 19 Авг 2010, eliweiq001 писал(а): > > If you want to open the latest modified file by vim, you the use the > RecentFiles.vim plugin (there are some others, but I cannot recall their > names), which can display a list of most recently used files. > > --

Re: How to open the latest modified file

2010-08-19 Thread eliweiq001
On 8月19日, 下午7时11分, Christian Brabandt wrote: > Hi eliweiq001! > > On Do, 19 Aug 2010, eliweiq001 wrote: > > > I am using a portable edition of gVim in windows. > > I have to open gVim and then open a .c file every time,( for learning > > programing ), so I want a function and map a key to it, t

Re: How to open the latest modified file

2010-08-20 Thread Christian Brabandt
Hi eliweiq001! On Do, 19 Aug 2010, eliweiq001 wrote: > On 8月19日, 下午7时11分, Christian Brabandt wrote: > > fun! OpenLastModified(...) > > let path=(a:1 ? a:1 : getcwd() ) > > let files=split(glob(path . '/*', 1), '\n') > > call filter(files, '!isdirectory(v:val)') > > call sort(file

Re: How to open the latest modified file

2010-08-20 Thread eliweiq001
On 8月20日, 下午4时35分, Christian Brabandt wrote: > Hi eliweiq001! > > > > And besides, when I > > :call OpenLastModified(1) > > > there is an error: > > > Error detected while processing function OpenLastModified: > > Line 5: > > E684: list index out of range: -1 > > E15: Invalid expression: files[-

Re: How to open the latest modified file

2010-08-20 Thread eliweiq001
On 8月20日, 下午4时35分, Christian Brabandt wrote: > Hi eliweiq001! > > > And besides, when I > > :call OpenLastModified(1) > > > there is an error: > > > Error detected while processing function OpenLastModified: > > Line 5: > > E684: list index out of range: -1 > > E15: Invalid expression: files[-1]

Re: How to open the latest modified file

2010-08-20 Thread bill lam
By looking at message-id of your emails, it seems you actually sent this and also other posts several times. May I ask what was the reason? -- regards, GPG key 1024D/4434BAB3 2008-08-24 gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3 --

Re: How to open the latest modified file

2010-08-20 Thread eliweiq001
On 8月20日, 下午6时30分, bill lam wrote: > By looking at message-id of your emails, it seems you actually sent this > and also other posts several times. May I ask what was the reason? > > -- > regards, > > GPG key 1024D/4434BAB3 2008-08-24 > gpg -

Re: How to open the latest modified file

2010-08-20 Thread Christian Brabandt
Hi eliweiq001! On Fr, 20 Aug 2010, eliweiq001 wrote: > > > On 8月20日, 下午4时35分, Christian Brabandt wrote: > > Hi eliweiq001! > > > > > > > And besides, when I > > > :call OpenLastModified(1) > > > > > there is an error: > > > > > Error detected while processing function OpenLastModified: > > > L

Re: How to open the latest modified file

2010-08-20 Thread eliweiq001
Hi Christian ! On 8月20日, 下午7时19分, Christian Brabandt wrote: > Hi eliweiq001! > > > I see. There was 1 small problem. Use this slightly changed version > (which only selects C-files): > > fun! OpenLastModified(...) > let path=(!empty(a:1) ? a:1 : getcwd() ) > let files=split(glob(path . '/

Re: How to open the latest modified file

2010-08-22 Thread eliweiq001
Hi Christian ! On 8月20日, 下午7时19分, Christian Brabandt wrote: > Hi eliweiq001! > > On Fr, 20 Aug 2010, eliweiq001 wrote: > > > > > > > On 8月20日, 下午4时35分, Christian Brabandt wrote: > > > Hi eliweiq001! > > > > > And besides, when I > > > > :call OpenLastModified(1) > > > > > there is an error: > >

Re: How to open the latest modified file

2010-08-22 Thread Benjamin R. Haskell
On Sun, 22 Aug 2010, eliweiq001 wrote: > > I want to ask you something else. > > :exe OpenLastModified() > > You see, OpenLastModified is a function, but, why we can only use :exe > but not :call ? > I've tried :call but it won't work. OpenLastModified returns a string-form command to be exec

Re: How to open the latest modified file

2010-08-24 Thread eliweiq001
On 8月23日, 上午10时16分, "Benjamin R. Haskell" wrote: > On Sun, 22 Aug 2010, eliweiq001 wrote: > > > I want to ask you something else. > > > :exe OpenLastModified() > > > You see, OpenLastModified is a function, but, why we can only use :exe > > but not :call ? > > I've tried :call but it won't work.