Loading ...
Sorry, an error occurred while loading the content.

Re: problem about auto insert the current date and time

Expand Messages
  • momodi
    thank you very much! call winrestoreview(original_view) mybe it s winrestview, not winrestoreview ... --~--~---------~--~----~------------~-------~--~----~ You
    Message 1 of 3 , Jun 28, 2008
    • 0 Attachment
      thank you very much!

      call winrestoreview(original_view)
      mybe it's winrestview, not winrestoreview


      On Jun 29, 2:19 am, kana <whileimautoma...@...> wrote:
      > momodi wrote:
      > > autocmd BufWritePre,FileWritePre *.cpp   call LastMod()
      > > fun LastMod()
      > >     exe "normal ms"
      > >     exe "1," . line("$") . "g/Modified Time: /s/Modified Time: .*/
      > > Modified Time: " .
      > >         \ strftime("%c")
      > >     exe "normal `s"
      > > endfun
      >
      > > but there are also bugs with this code.
      > > when I press ctrl + s , the cursor will not change it's position.
      > > but when my program is to long, the windows will move up.
      > > (I do not know how to describe it, just have a try)
      >
      > " How about this one?
      > function! LastMod()
      >   let original_view = winsaveview()
      >   let last_line = 20 < line('$') ? 20 line('$')
      >   execute '1,'.last_line 's!Modified Time: .\zs*!'.strftime('%c').'!'
      >   call winrestoreview(original_view)
      > endfunction
      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_use" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    Your message has been successfully submitted and would be delivered to recipients shortly.