Insert lines at begin of file with writefile

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Insert lines at begin of file with writefile

Ni Va
Hi,


Is that a way to tell writefile() func to append lines at the beginning of file?

Thank you
Niva

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Insert lines at begin of file with writefile

Nikolay Aleksandrovich Pavlov
2017-05-30 11:21 GMT+03:00 Ni Va <[hidden email]>:
> Hi,
>
>
> Is that a way to tell writefile() func to append lines at the beginning of file?

Just read the whole file, prepend and then write the whole file. In
any case I do not know a way to actually prepend bytes to the file: if
you seek to the end of file (or open it in append mode) and start
writing to it you get appending. If you seek to the start and start
writing you will just overwrite first bytes. So programming languages
do not have “prepending” abstraction because it is not supported by
the OS and thus is going to either cost very much or have problems
like loosing data on crashes.

>
> Thank you
> Niva
>
> --
> --
> You received this message from the "vim_use" maillist.
> Do not top-post! Type your reply below the text you are replying to.
> For more information, visit http://www.vim.org/maillist.php
>
> ---
> You received this message because you are subscribed to the Google Groups "vim_use" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
> For more options, visit https://groups.google.com/d/optout.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Insert lines at begin of file with writefile

Ni Va
Le mardi 30 mai 2017 13:03:38 UTC+2, ZyX a écrit :

> 2017-05-30 11:21 GMT+03:00 Ni Va <[hidden email]>:
> > Hi,
> >
> >
> > Is that a way to tell writefile() func to append lines at the beginning of file?
>
> Just read the whole file, prepend and then write the whole file. In
> any case I do not know a way to actually prepend bytes to the file: if
> you seek to the end of file (or open it in append mode) and start
> writing to it you get appending. If you seek to the start and start
> writing you will just overwrite first bytes. So programming languages
> do not have “prepending” abstraction because it is not supported by
> the OS and thus is going to either cost very much or have problems
> like loosing data on crashes.
>
> >
> > Thank you
> > Niva
> >
> > --
> > --
> > You received this message from the "vim_use" maillist.
> > Do not top-post! Type your reply below the text you are replying to.
> > For more information, visit http://www.vim.org/maillist.php
> >
> > ---
> > You received this message because you are subscribed to the Google Groups "vim_use" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
> > For more options, visit https://groups.google.com/d/optout.
Do you think readfile writefile would be faster than that :

        let begin = [$vimruntime."/gvim.exe", "-c", "edit ".makefile, "-c",
                                  \"call append(0, ".string(lines2Append).")", "-c", "wq"]
        call x.add_cmd(begin) " ==>>>> Launch cmd as job

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Insert lines at begin of file with writefile

Nikolay Aleksandrovich Pavlov
2017-05-30 14:21 GMT+03:00 Ni Va <[hidden email]>:

> Le mardi 30 mai 2017 13:03:38 UTC+2, ZyX a écrit :
>> 2017-05-30 11:21 GMT+03:00 Ni Va <[hidden email]>:
>> > Hi,
>> >
>> >
>> > Is that a way to tell writefile() func to append lines at the beginning of file?
>>
>> Just read the whole file, prepend and then write the whole file. In
>> any case I do not know a way to actually prepend bytes to the file: if
>> you seek to the end of file (or open it in append mode) and start
>> writing to it you get appending. If you seek to the start and start
>> writing you will just overwrite first bytes. So programming languages
>> do not have “prepending” abstraction because it is not supported by
>> the OS and thus is going to either cost very much or have problems
>> like loosing data on crashes.
>>
>> >
>> > Thank you
>> > Niva
>> >
>> > --
>> > --
>> > You received this message from the "vim_use" maillist.
>> > Do not top-post! Type your reply below the text you are replying to.
>> > For more information, visit http://www.vim.org/maillist.php
>> >
>> > ---
>> > You received this message because you are subscribed to the Google Groups "vim_use" group.
>> > To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
>> > For more options, visit https://groups.google.com/d/optout.
>
> Do you think readfile writefile would be faster than that :
>
>         let begin = [$vimruntime."/gvim.exe", "-c", "edit ".makefile, "-c",
>                                   \"call append(0, ".string(lines2Append).")", "-c", "wq"]
>         call x.add_cmd(begin) " ==>>>> Launch cmd as job

With readfile+writefile you load a file into memory and write there.
With gvim you are forking, loading gvim.exe and a big bunch of
libraries needed for GUI, loading a file into memory (though buffer
structure should be a bit more efficient then a list from `readfile()`
AFAIK), loading a big bunch of plugins (do not do such things without
`-u NONE -i NONE`), loading GUI (use `--cmd` for such things, not
`-c`). Which is faster? Actually may be your variant if you do not
need to wait for gvim to finish prepending because time would be
limited to only forking. readfile()+writefile() if you do need to
wait.

>
> --
> --
> You received this message from the "vim_use" maillist.
> Do not top-post! Type your reply below the text you are replying to.
> For more information, visit http://www.vim.org/maillist.php
>
> ---
> You received this message because you are subscribed to the Google Groups "vim_use" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
> For more options, visit https://groups.google.com/d/optout.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Insert lines at begin of file with writefile

Ni Va
Le mardi 30 mai 2017 13:29:10 UTC+2, ZyX a écrit :

> 2017-05-30 14:21 GMT+03:00 Ni Va <[hidden email]>:
> > Le mardi 30 mai 2017 13:03:38 UTC+2, ZyX a écrit :
> >> 2017-05-30 11:21 GMT+03:00 Ni Va <[hidden email]>:
> >> > Hi,
> >> >
> >> >
> >> > Is that a way to tell writefile() func to append lines at the beginning of file?
> >>
> >> Just read the whole file, prepend and then write the whole file. In
> >> any case I do not know a way to actually prepend bytes to the file: if
> >> you seek to the end of file (or open it in append mode) and start
> >> writing to it you get appending. If you seek to the start and start
> >> writing you will just overwrite first bytes. So programming languages
> >> do not have “prepending” abstraction because it is not supported by
> >> the OS and thus is going to either cost very much or have problems
> >> like loosing data on crashes.
> >>
> >> >
> >> > Thank you
> >> > Niva
> >> >
> >> > --
> >> > --
> >> > You received this message from the "vim_use" maillist.
> >> > Do not top-post! Type your reply below the text you are replying to.
> >> > For more information, visit http://www.vim.org/maillist.php
> >> >
> >> > ---
> >> > You received this message because you are subscribed to the Google Groups "vim_use" group.
> >> > To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
> >> > For more options, visit https://groups.google.com/d/optout.
> >
> > Do you think readfile writefile would be faster than that :
> >
> >         let begin = [$vimruntime."/gvim.exe", "-c", "edit ".makefile, "-c",
> >                                   \"call append(0, ".string(lines2Append).")", "-c", "wq"]
> >         call x.add_cmd(begin) " ==>>>> Launch cmd as job
>
> With readfile+writefile you load a file into memory and write there.
> With gvim you are forking, loading gvim.exe and a big bunch of
> libraries needed for GUI, loading a file into memory (though buffer
> structure should be a bit more efficient then a list from `readfile()`
> AFAIK), loading a big bunch of plugins (do not do such things without
> `-u NONE -i NONE`), loading GUI (use `--cmd` for such things, not
> `-c`). Which is faster? Actually may be your variant if you do not
> need to wait for gvim to finish prepending because time would be
> limited to only forking. readfile()+writefile() if you do need to
> wait.
>
> >
> > --
> > --
> > You received this message from the "vim_use" maillist.
> > Do not top-post! Type your reply below the text you are replying to.
> > For more information, visit http://www.vim.org/maillist.php
> >
> > ---
> > You received this message because you are subscribed to the Google Groups "vim_use" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
> > For more options, visit https://groups.google.com/d/optout.
Ok applying your advise it is sure the radfile writefile method is amazing faster in binary mode.

Then this method 2 below can be done by job_start( ?

Thank you



        " add append lines
        let lines2Append = [
                                \  expand("SDK_INCLUDE_DIR=$ProgramFiles (x86)/Windows Kits/8.1/Include")
                                \, expand("VS_DIR=$ProgramFiles (x86)/Microsoft Visual Studio 14.0/VC")
                                \, 'CPU=AMD64'
                                \, 'FEATURES=HUGE'
                                \, 'OLE=yes'
                                \, 'GUI=yes'
                                \, 'XPM=no'
                                \, 'NETBEANS=no'
                                \, 'CSCOPE=no'
                                \, 'MBYTE=yes'
                                \, 'DYNAMIC_LUA=yes'
                                \, 'LUA=.\\lua53'
                                \, 'LUA_VER=53'
                                \, 'DYNAMIC_PYTHON=yes'
                                \, 'PYTHON=C:\Python27'
                                \, 'PYTHON_VER=27'
                                \, 'DYNAMIC_PYTHON3=no'
                                \, 'PYTHON3='
                                \, 'PYTHON3_VER='
                                \, 'EVENT_LOOP=yes'
                                \, '
'
                                \]
    " method 1 : slow to add lines but job able
        let cmd = [$vimruntime."/gvim.exe", "-c", "edit ".makefile, "-c",
                                  \"call append(0, ".string(lines2Append).")", "-c", "wq"]
        " call x.add_cmd(cmd)  "started as job by job_start( and handlers


    " method 2 : faster but no job able ??!?
    let originalFile = readfile(makefile,'b')
    call writefile( lines2Append, makefile, 'b')
    call writefile( originalFile, makefile, 'a')

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Insert lines at begin of file with writefile

Ken Takata-2
Hi,

2017/5/31 Wed 18:11:29 UTC+9 Ni Va wrote:

> Le mardi 30 mai 2017 13:29:10 UTC+2, ZyX a écrit :
> > 2017-05-30 14:21 GMT+03:00 Ni Va <[hidden email]>:
> > > Le mardi 30 mai 2017 13:03:38 UTC+2, ZyX a écrit :
> > >> 2017-05-30 11:21 GMT+03:00 Ni Va <[hidden email]>:
> > >> > Hi,
> > >> >
> > >> >
> > >> > Is that a way to tell writefile() func to append lines at the beginning of file?
> > >>
> > >> Just read the whole file, prepend and then write the whole file. In
> > >> any case I do not know a way to actually prepend bytes to the file: if
> > >> you seek to the end of file (or open it in append mode) and start
> > >> writing to it you get appending. If you seek to the start and start
> > >> writing you will just overwrite first bytes. So programming languages
> > >> do not have “prepending” abstraction because it is not supported by
> > >> the OS and thus is going to either cost very much or have problems
> > >> like loosing data on crashes.
> > >>
> > >> >
> > >> > Thank you
> > >> > Niva
> > >> >
> > >> > --
> > >> > --
> > >> > You received this message from the "vim_use" maillist.
> > >> > Do not top-post! Type your reply below the text you are replying to.
> > >> > For more information, visit http://www.vim.org/maillist.php
> > >> >
> > >> > ---
> > >> > You received this message because you are subscribed to the Google Groups "vim_use" group.
> > >> > To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
> > >> > For more options, visit https://groups.google.com/d/optout.
> > >
> > > Do you think readfile writefile would be faster than that :
> > >
> > >         let begin = [$vimruntime."/gvim.exe", "-c", "edit ".makefile, "-c",
> > >                                   \"call append(0, ".string(lines2Append).")", "-c", "wq"]
> > >         call x.add_cmd(begin) " ==>>>> Launch cmd as job
> >
> > With readfile+writefile you load a file into memory and write there.
> > With gvim you are forking, loading gvim.exe and a big bunch of
> > libraries needed for GUI, loading a file into memory (though buffer
> > structure should be a bit more efficient then a list from `readfile()`
> > AFAIK), loading a big bunch of plugins (do not do such things without
> > `-u NONE -i NONE`), loading GUI (use `--cmd` for such things, not
> > `-c`). Which is faster? Actually may be your variant if you do not
> > need to wait for gvim to finish prepending because time would be
> > limited to only forking. readfile()+writefile() if you do need to
> > wait.
> >
> > >
> > > --
> > > --
> > > You received this message from the "vim_use" maillist.
> > > Do not top-post! Type your reply below the text you are replying to.
> > > For more information, visit http://www.vim.org/maillist.php
> > >
> > > ---
> > > You received this message because you are subscribed to the Google Groups "vim_use" group.
> > > To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
> > > For more options, visit https://groups.google.com/d/optout.
>
> Ok applying your advise it is sure the radfile writefile method is amazing faster in binary mode.
>
> Then this method 2 below can be done by job_start( ?
>
> Thank you
>
>
>
> " add append lines
> let lines2Append = [
> \  expand("SDK_INCLUDE_DIR=$ProgramFiles (x86)/Windows Kits/8.1/Include")
> \, expand("VS_DIR=$ProgramFiles (x86)/Microsoft Visual Studio 14.0/VC")
> \, 'CPU=AMD64'
> \, 'FEATURES=HUGE'
> \, 'OLE=yes'
> \, 'GUI=yes'
> \, 'XPM=no'
> \, 'NETBEANS=no'
> \, 'CSCOPE=no'
> \, 'MBYTE=yes'
> \, 'DYNAMIC_LUA=yes'
> \, 'LUA=.\\lua53'
> \, 'LUA_VER=53'
> \, 'DYNAMIC_PYTHON=yes'
> \, 'PYTHON=C:\Python27'
> \, 'PYTHON_VER=27'
> \, 'DYNAMIC_PYTHON3=no'
> \, 'PYTHON3='
> \, 'PYTHON3_VER='
> \, 'EVENT_LOOP=yes'
> \, '
> '
> \]
>     " method 1 : slow to add lines but job able
> let cmd = [$vimruntime."/gvim.exe", "-c", "edit ".makefile, "-c",
>  \"call append(0, ".string(lines2Append).")", "-c", "wq"]
> " call x.add_cmd(cmd)  "started as job by job_start( and handlers
>
>
>     " method 2 : faster but no job able ??!?
>     let originalFile = readfile(makefile,'b')
>     call writefile( lines2Append, makefile, 'b')
>     call writefile( originalFile, makefile, 'a')
Just curious.
Why you edit Make_mvc.mak?

Normally you just need to specify the option in the command line. E.g.:

  nmake -f Make_mvc.mak "SDK_INCLUDE_DIR=..." CPU=AMD64 FEATURES=... ...

Another option is creating a batch file which sets the options to environment
variables, then run nmake. E.g.:

  @echo off
  set SDK_INCLUDE_DIR=...
  set CPU=AMD64
  set FEATURES=...
  ...
  nmake -f Make_mvc.mak


Regards,
Ken Takata

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Insert lines at begin of file with writefile

Ni Va
Le mercredi 31 mai 2017 18:59:13 UTC+2, Ken Takata a écrit :

> Hi,
>
> 2017/5/31 Wed 18:11:29 UTC+9 Ni Va wrote:
> > Le mardi 30 mai 2017 13:29:10 UTC+2, ZyX a écrit :
> > > 2017-05-30 14:21 GMT+03:00 Ni Va <[hidden email]>:
> > > > Le mardi 30 mai 2017 13:03:38 UTC+2, ZyX a écrit :
> > > >> 2017-05-30 11:21 GMT+03:00 Ni Va <[hidden email]>:
> > > >> > Hi,
> > > >> >
> > > >> >
> > > >> > Is that a way to tell writefile() func to append lines at the beginning of file?
> > > >>
> > > >> Just read the whole file, prepend and then write the whole file. In
> > > >> any case I do not know a way to actually prepend bytes to the file: if
> > > >> you seek to the end of file (or open it in append mode) and start
> > > >> writing to it you get appending. If you seek to the start and start
> > > >> writing you will just overwrite first bytes. So programming languages
> > > >> do not have “prepending” abstraction because it is not supported by
> > > >> the OS and thus is going to either cost very much or have problems
> > > >> like loosing data on crashes.
> > > >>
> > > >> >
> > > >> > Thank you
> > > >> > Niva
> > > >> >
> > > >> > --
> > > >> > --
> > > >> > You received this message from the "vim_use" maillist.
> > > >> > Do not top-post! Type your reply below the text you are replying to.
> > > >> > For more information, visit http://www.vim.org/maillist.php
> > > >> >
> > > >> > ---
> > > >> > You received this message because you are subscribed to the Google Groups "vim_use" group.
> > > >> > To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
> > > >> > For more options, visit https://groups.google.com/d/optout.
> > > >
> > > > Do you think readfile writefile would be faster than that :
> > > >
> > > >         let begin = [$vimruntime."/gvim.exe", "-c", "edit ".makefile, "-c",
> > > >                                   \"call append(0, ".string(lines2Append).")", "-c", "wq"]
> > > >         call x.add_cmd(begin) " ==>>>> Launch cmd as job
> > >
> > > With readfile+writefile you load a file into memory and write there.
> > > With gvim you are forking, loading gvim.exe and a big bunch of
> > > libraries needed for GUI, loading a file into memory (though buffer
> > > structure should be a bit more efficient then a list from `readfile()`
> > > AFAIK), loading a big bunch of plugins (do not do such things without
> > > `-u NONE -i NONE`), loading GUI (use `--cmd` for such things, not
> > > `-c`). Which is faster? Actually may be your variant if you do not
> > > need to wait for gvim to finish prepending because time would be
> > > limited to only forking. readfile()+writefile() if you do need to
> > > wait.
> > >
> > > >
> > > > --
> > > > --
> > > > You received this message from the "vim_use" maillist.
> > > > Do not top-post! Type your reply below the text you are replying to.
> > > > For more information, visit http://www.vim.org/maillist.php
> > > >
> > > > ---
> > > > You received this message because you are subscribed to the Google Groups "vim_use" group.
> > > > To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
> > > > For more options, visit https://groups.google.com/d/optout.
> >
> > Ok applying your advise it is sure the radfile writefile method is amazing faster in binary mode.
> >
> > Then this method 2 below can be done by job_start( ?
> >
> > Thank you
> >
> >
> >
> > " add append lines
> > let lines2Append = [
> > \  expand("SDK_INCLUDE_DIR=$ProgramFiles (x86)/Windows Kits/8.1/Include")
> > \, expand("VS_DIR=$ProgramFiles (x86)/Microsoft Visual Studio 14.0/VC")
> > \, 'CPU=AMD64'
> > \, 'FEATURES=HUGE'
> > \, 'OLE=yes'
> > \, 'GUI=yes'
> > \, 'XPM=no'
> > \, 'NETBEANS=no'
> > \, 'CSCOPE=no'
> > \, 'MBYTE=yes'
> > \, 'DYNAMIC_LUA=yes'
> > \, 'LUA=.\\lua53'
> > \, 'LUA_VER=53'
> > \, 'DYNAMIC_PYTHON=yes'
> > \, 'PYTHON=C:\Python27'
> > \, 'PYTHON_VER=27'
> > \, 'DYNAMIC_PYTHON3=no'
> > \, 'PYTHON3='
> > \, 'PYTHON3_VER='
> > \, 'EVENT_LOOP=yes'
> > \, '
> > '
> > \]
> >     " method 1 : slow to add lines but job able
> > let cmd = [$vimruntime."/gvim.exe", "-c", "edit ".makefile, "-c",
> >  \"call append(0, ".string(lines2Append).")", "-c", "wq"]
> > " call x.add_cmd(cmd)  "started as job by job_start( and handlers
> >
> >
> >     " method 2 : faster but no job able ??!?
> >     let originalFile = readfile(makefile,'b')
> >     call writefile( lines2Append, makefile, 'b')
> >     call writefile( originalFile, makefile, 'a')
>
> Just curious.
> Why you edit Make_mvc.mak?
>
> Normally you just need to specify the option in the command line. E.g.:
>
>   nmake -f Make_mvc.mak "SDK_INCLUDE_DIR=..." CPU=AMD64 FEATURES=... ...
>
> Another option is creating a batch file which sets the options to environment
> variables, then run nmake. E.g.:
>
>   @echo off
>   set SDK_INCLUDE_DIR=...
>   set CPU=AMD64
>   set FEATURES=...
>   ...
>   nmake -f Make_mvc.mak
>
>
> Regards,
> Ken Takata
Hi Ken,

My goal if it is possible is building all from within vim/gvim using and using new job_start serial sequencer I have done.

For instant, the script 1:download src from git 2:modify somes sources 3:prepare makefile 4:inprogress to set env vcvarsall 5:built gvim or vim.

To Keep out build.cmd and vcvarsall.bat I intend to.

This is the main part client vimscript written at the day :

" {{{ Make my Vim
fu! makemyvim#MakeMyVim()


        " plan cmds
        let x = cmdlauncher#new()


        " 0 - Download vim from Github
        let currentPath=getcwd()
        cd $tmp
        " call x.add_cmd('git init')
        " call x.add_cmd('git clone https://github.com/vim/vim.git')
        exe "cd ".currentPath

        " 1 - Niva pack
        "
        let src  = $VIM.'/nivamakepack'
   
        call x.add_cmd(utils#Robocopy(src, $TMP.'/vim/src','*.ico'              ))
        call x.add_cmd(utils#Robocopy(src, $TMP.'/vim/src','tools.bmp'          ))
        call x.add_cmd(utils#Robocopy(src, $TMP.'/vim/src','configure.cmd'      ))
        call x.add_cmd(utils#Robocopy(src.'/lua53', $TMP.'/vim/src'.'/lua53','*'))
   
    call x.add_cmd([$vimruntime."/gvim.exe", '-c', 'edit $tmp/vim/src/gui.h', '-c', '%s/\(TOOLBAR_BUTTON_\w\+\s\+\)\d\+/\148', '-c', 'wq'])

        " 2 - build it
        "
        let nmake_path = globpath(expand('$ProgramFiles'.' (x86)/Microsoft Visual Studio 14.0/VC/bin'),'nmake.exe')
        if !filereadable(nmake_path)
                echomsg "nmake is not available"
                echomsg "".nmake_path
                return
        endif

        let makefile   = globpath(expand('$tmp'.'/vim/src'),'Make_mvc.mak')
        if !filereadable(makefile)
                echomsg "makefile is not available"
                echomsg "".makefile
                return
        endif

        let win32_mak = globpath(expand('$ProgramFiles'.' (x86)/Windows Kits/8.1/Include'),'win32.mak')
        if !filereadable(win32_mak)
                echomsg "win32_mak is not available"
                echomsg "". win32_mak
                return
        endif

        " add append lines
        let lines2Append = [
                                \  expand("SDK_INCLUDE_DIR=$ProgramFiles (x86)/Windows Kits/8.1/Include")
                                \, expand("VS_DIR=$ProgramFiles (x86)/Microsoft Visual Studio 14.0/VC")
                                \, 'CPU=AMD64'
                                \, 'FEATURES=HUGE'
                                \, 'OLE=yes'
                                \, 'GUI=yes'
                                \, 'XPM=no'
                                \, 'NETBEANS=no'
                                \, 'CSCOPE=no'
                                \, 'MBYTE=yes'
                                \, 'DYNAMIC_LUA=yes'
                                \, 'LUA=.\\lua53'
                                \, 'LUA_VER=53'
                                \, 'DYNAMIC_PYTHON=yes'
                                \, 'PYTHON=C:\Python27'
                                \, 'PYTHON_VER=27'
                                \, 'DYNAMIC_PYTHON3=no'
                                \, 'PYTHON3='
                                \, 'PYTHON3_VER='
                                \, 'EVENT_LOOP=yes'
                                \, nr2char('<NL>',1)
                                \]

    " method 1 : slow to add lines but job able
        " let cmd = [$vimruntime."/gvim.exe", "-c", "edit ".makefile, "-c",
        "    \"call append(0, ".string(lines2Append).")", "-c", "wq"]
        " call x.add_cmd(cmd)  "started as job by job_start( and handlers


    " method 2 : faster but no job able ??!?
    let originalFile = readfile(makefile,'b')
    call writefile( lines2Append, makefile, 'b')
    call writefile( originalFile, makefile, 'a')

        " build
        let $VisualStudioVersion='14.0'
        " let $path='14.0'
        call x.add_cmd('"'.nmake_path.'" -f "'.makefile.'" clean')

        " start all jobs
        call x.start()

    return

endfu
" }}}
" vim: set ft=vim ff=dos fdm=marker ts=4 :expandtab:

 

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Loading...