VIM for OS/2 Question - OS2

This is a discussion on VIM for OS/2 Question - OS2 ; _____ Hello All OS/2 Users, Just installed VIM v7.0. Works well. Two questions: 1) When i run vim from a 4OS2.EXE shell, i get nice colours, and the ..vimrc file is sourced correctly from the directory above the vim70 directory. ...

+ Reply to Thread
Results 1 to 20 of 20

Thread: VIM for OS/2 Question

  1. VIM for OS/2 Question

    _____
    Hello All OS/2 Users,

    Just installed VIM v7.0. Works well. Two questions:

    1) When i run vim from a 4OS2.EXE shell, i get nice colours, and the
    ..vimrc file is sourced correctly from the directory above the vim70
    directory. When i run vim from a regular CMD.EXE shell i get no
    colours, and the .vimrc file is /not/ sourced. Any idea why this is so?

    2) How would i structure an OS/2 command file to automatically create a
    80x45 sized window (using mode 80,45) after starting 4OS2.EXE, and
    launch vim? I keep winding up running CMD.EXE which does not give my
    colour and read .vimrc properly.

    --
    Regards / JCH

  2. Re: VIM for OS/2 Question

    jch wrote:
    > _____
    > Hello All OS/2 Users,
    >
    > Just installed VIM v7.0. Works well. Two questions:
    >
    > 1) When i run vim from a 4OS2.EXE shell, i get nice colours, and the
    > .vimrc file is sourced correctly from the directory above the vim70
    > directory. When i run vim from a regular CMD.EXE shell i get no
    > colours, and the .vimrc file is /not/ sourced. Any idea why this is so?
    >
    > 2) How would i structure an OS/2 command file to automatically create a
    > 80x45 sized window (using mode 80,45) after starting 4OS2.EXE, and
    > launch vim? I keep winding up running CMD.EXE which does not give my
    > colour and read .vimrc properly.

    _____
    Found one "work-around". I specified the 4os2.exe program as the os2
    shell in the config.sys file like this:
    =====
    rem -> set os2_shell=c:\os2\cmd.exe
    set os2_shell=c:\4os2\4os2.exe
    =====

    Are there any adverse consequences to this method? I can still run the
    regular command shell from 4os2 with "cmd.exe".
    --
    Regards / JCH

  3. Re: VIM for OS/2 Question

    On Sat, 21 Jun 2008 01:23:17 UTC, jch wrote:

    > 1) When i run vim from a 4OS2.EXE shell, i get nice colours, and the
    > .vimrc file is sourced correctly from the directory above the vim70
    > directory. When i run vim from a regular CMD.EXE shell i get no
    > colours, and the .vimrc file is /not/ sourced. Any idea why this is so?


    WAG, but maybe either the HOME or VIM environment variable is pointing
    somewhere incorrect under CMD?

    --
    Alex Taylor
    Fukushima, Japan
    http://www.socis.ca/~ataylo00

    Please take off hat when replying.

  4. Re: VIM for OS/2 Question

    In , on 06/21/2008
    at 07:29 AM, "Alex Taylor" said:

    Hi,

    >> .vimrc file is sourced correctly from the directory above the vim70
    >> directory. When i run vim from a regular CMD.EXE shell i get no
    >> colours, and the .vimrc file is /not/ sourced. Any idea why this is so?


    >WAG, but maybe either the HOME or VIM environment variable is pointing
    >somewhere incorrect under CMD?


    That would be my guess. It's possible you have multiple .vimrc files and
    the shell is causing the selected file to vary.

    :version
    :set option?
    :echo expr...

    can help here.

    If would also check for 4OS2 aliases, just in case.

    That said. I see no differences between 4OS2 and CMD here.

    Steven

    --
    --------------------------------------------------------------------------------------------
    Steven Levine MR2/ICE 3.00 beta 11pre14 #10183
    eCS/Warp/DIY/14.103a_W4 www.scoug.com irc.ca.webbnet.info #scoug (Wed 7pm PST)
    --------------------------------------------------------------------------------------------


  5. Re: VIM for OS/2 Question

    In , on 06/21/2008
    at 03:54 AM, jch said:

    Hi,

    >rem -> set os2_shell=c:\os2\cmd.exe
    >set os2_shell=c:\4os2\4os2.exe


    >Are there any adverse consequences to this method?


    Not in my opinion. I've run this way for many years. There are a couple
    of apps that much be installed under cmd.exe because the parse the output
    the ver command, but shelling to cmd.exe solves this problem

    Steven

    --
    --------------------------------------------------------------------------------------------
    Steven Levine MR2/ICE 3.00 beta 11pre14 #10183
    eCS/Warp/DIY/14.103a_W4 www.scoug.com irc.ca.webbnet.info #scoug (Wed 7pm PST)
    --------------------------------------------------------------------------------------------


  6. Re: VIM for OS/2 Question

    In <9KY6k.40249$gc5.1734@pd7urf2no>, on 06/21/2008
    at 01:23 AM, jch said:


    >2) How would i structure an OS/2 command file to automatically create a
    >80x45 sized window (using mode 80,45) after starting 4OS2.EXE, and
    >launch vim?


    Use the following 4OS2 script to set the window size to any valid value
    and then invoke vim.


    Steven

    --
    --------------------------------------------------------------------------------------------
    Steven Levine MR2/ICE 3.00 beta 11pre14 #10183
    eCS/Warp/DIY/14.103a_W4 www.scoug.com irc.ca.webbnet.info #scoug (Wed 7pm PST)
    --------------------------------------------------------------------------------------------
    @echo off
    :: winsize - Set VIO window size given rows/columns

    :: Copyright (c) 2005, 2007 Steven Levine and Associates, Inc.
    :: All rights reserved.

    :: This program is free software licensed under the terms of the GNU
    :: General Public License. The GPL Software License can be found in
    :: gnugpl2.txt or at http://www.gnu.org/licenses/licenses.html#GPL

    rem $TLIB$: $ &(#) %n - Ver %v, %f $
    rem TLIB: $ $

    :: 06 Apr 05 SHL Baseline
    :: 15 Sep 05 SHL Suppress info
    :: 26 Sep 07 SHL Clear after change

    on errormsg pause
    setlocal

    set R=
    set C=

    :: Evaluate args, I=num A=value X=scratch

    if "%1" == "" goto Usage

    do I = 1 to %[%=#]

    set A=%[%I]

    :: Process switch options
    set X=%@substr[%A,0,1]
    iff "%X" eq "/" .or. "%X" eq "-" then
    :: Got switch
    set X=%@lower[%@substr[%A,1,1]]
    if "%X" == "h" .or. "%X" == "?" goto Help
    iff "%X" == "?" then
    echo Switch %X unexpected
    goto Usage
    else
    echo Switch %X unexpected
    goto Usage
    endiff
    iterate
    endiff

    :: Process arguments
    iff %@numeric[%A] != 1 then
    echo Argument %A must be numeric
    goto Usage
    endiff

    iff %A ge 80 then
    iff "%C" == "" then
    set C=%A
    elseiff "%R" == "" then
    set R=%A
    else
    echo Argument %A unexpected
    got Usage
    endiff
    else
    iff "%R" == "" then
    set R=%A
    elseiff "%C" == "" then
    set C=%A
    else
    echo Argument %A unexpected
    got Usage
    endiff
    endiff
    enddo

    if "%R" == "" set R=%_ROWS
    if "%C" == "" set C=%_COLUMNS

    iff %R gt %C then
    set X=%R
    set R=%C
    set C=%X
    endiff

    mode co%C,%R

    :: font and border specs
    set FX=6
    set FY=14
    set BX=8
    set BY=25

    set CX=%@eval[%FX*%C+%BX]
    set CY=%@eval[%FY*%R+%BY]

    :: echo _XPIXELS %_XPIXELS
    :: echo _YPIXELS %_YPIXELS
    :: echo FX %FX
    :: echo FY %FY
    :: echo CX %CX
    :: echo CY %CY

    set X=%@int[%@eval[(%_XPIXELS-%CX)/2]]
    if %X lt 0 set X=0
    set Y=%@int[%@eval[(%_YPIXELS-%CY)/2]]
    if %Y lt 0 set Y=0

    option //windowstate=standard
    option //windowwidth=%CX //windowheight=%CY //windowx=%X //windowy=%Y //windowstate=custom
    cls

    quit

    :: end Main

    ::=== Usage: Report usage error ===

    :Usage
    beep
    echo Usage: %@lower[%0] `[rows [columns]]`
    cancel
    :: end Usage

    :Help
    echo.
    echo Usage: %@lower[%0] `[rows [columns]]`
    echo.
    echo ` -? This message`
    echo.
    echo ` row window rows/columns`
    echo ` columns window column/rows`
    echo.
    echo ` args assumed to be reversed if first arg 80`
    cancel
    :: end Help

    :end



  7. Re: VIM for OS/2 Question

    Steven Levine wrote:

    >> 2) How would i structure an OS/2 command file to automatically create a
    >> 80x45 sized window (using mode 80,45) after starting 4OS2.EXE, and
    >> launch vim?

    >
    > Use the following 4OS2 script to set the window size to any valid value
    > and then invoke vim.

    _____
    Steven,

    Thanks for this script. Will check it tomorrow.

    I did ":ver" in vim, and noted what environment variables should be set.
    I added to CONFIG.SYS:
    set VIM=c:\vim\vim70
    set HOME=c:\vim\vim70

    Then i put my .vimrc and .viminfo files in c:\vim\vim70. All colours,
    and settings in the .vimrc file are present! Thanks again for the hint.
    --
    Regards / JCH

  8. Re: VIM for OS/2 Question

    On 06/21/08 11:51 pm, jch wrote:
    > Steven Levine wrote:
    >
    >>> 2) How would i structure an OS/2 command file to automatically create
    >>> a 80x45 sized window (using mode 80,45) after starting 4OS2.EXE, and
    >>> launch vim?

    >>
    >> Use the following 4OS2 script to set the window size to any valid value
    >> and then invoke vim.

    > _____
    > Steven,
    >
    > Thanks for this script. Will check it tomorrow.
    >
    > I did ":ver" in vim, and noted what environment variables should be set.
    > I added to CONFIG.SYS:
    > set VIM=c:\vim\vim70
    > set HOME=c:\vim\vim70
    >
    > Then i put my .vimrc and .viminfo files in c:\vim\vim70. All colours,
    > and settings in the .vimrc file are present! Thanks again for the hint.


    Really HOME could be set to something more generic, perhaps c:/home
    (note slash instead of backslash) as lots of programs, mostly unix ports
    but even the most recent Mozilla apps and Cairo apps like Doodles
    screensaver will use %HOME% to save configuration info. You will see
    files and/or directories starting with a dot. These under *nix would be
    hidden files.
    Dave

  9. Re: VIM for OS/2 Question

    Steven Levine wrote:
    > In , on 06/21/2008
    > at 03:54 AM, jch said:
    >
    > Hi,
    >
    >>rem -> set os2_shell=c:\os2\cmd.exe
    >>set os2_shell=c:\4os2\4os2.exe

    >
    >>Are there any adverse consequences to this method?

    >
    > Not in my opinion. I've run this way for many years. There are a couple
    > of apps that much be installed under cmd.exe because the parse the output
    > the ver command, but shelling to cmd.exe solves this problem


    Move commands happen very differently between the two, but install
    scripts very rarely use those. I recall some older threads (Google
    should help) about applications which wouldn't run or install because
    4os2 was the main shell. Easy enough to work around for the few cases.

    --
    [Reverse the parts of the e-mail address to reply.]

  10. Re: VIM for OS/2 Question

    In , on 06/22/2008
    at 06:51 AM, jch said:

    >I did ":ver" in vim, and noted what environment variables should be set.
    > I added to CONFIG.SYS:
    > set VIM=c:\vim\vim70
    > set HOME=c:\vim\vim70


    >Then i put my .vimrc and .viminfo files in c:\vim\vim70. All colours,
    >and settings in the .vimrc file are present!


    I agree with Dave that you should use something generic like

    set HOME=c:\home

    It will make it easier for VIM to interoperate with other applications
    which use HOME to locate their configuration files.

    Steven

    --
    --------------------------------------------------------------------------------------------
    Steven Levine MR2/ICE 3.00 beta 11pre14 #10183
    eCS/Warp/DIY/14.103a_W4 www.scoug.com irc.ca.webbnet.info #scoug (Wed 7pm PST)
    --------------------------------------------------------------------------------------------


  11. Re: VIM for OS/2 Question

    Steven Levine wrote:
    > In , on 06/22/2008
    > at 06:51 AM, jch said:
    >
    >> I did ":ver" in vim, and noted what environment variables should be set.
    >> I added to CONFIG.SYS:
    >> set VIM=c:\vim\vim70
    >> set HOME=c:\vim\vim70

    >
    >> Then i put my .vimrc and .viminfo files in c:\vim\vim70. All colours,
    >> and settings in the .vimrc file are present!

    >
    > I agree with Dave that you should use something generic like
    >
    > set HOME=c:\home
    >
    > It will make it easier for VIM to interoperate with other applications
    > which use HOME to locate their configuration files.

    _____
    Thanks for feedback.

    Now have set VIM=c:/vim/ <- points vim to c:\vim\.vimrc
    and set HOME=c:/home <- points vim to c:\home\.viminfo

    Get correct vim behaviour with CMD.EXE and 4OS2.EXE. I still have to
    understand how to run a 4OS2 script automatically. Any hints? Still
    have to read through the 4OS2 docs.
    --
    Regards / JCH

  12. Re: VIM for OS/2 Question

    In , on 06/23/2008
    at 07:59 PM, jch said:

    Hi,

    >Get correct vim behaviour with CMD.EXE and 4OS2.EXE. I still have to
    >understand how to run a 4OS2 script automatically. Any hints? Still
    >have to read through the 4OS2 docs.


    It depends on what you mean by automatically. With 4OS2 installed to
    d:\usr\bin, the following in config.sys

    SET OS2_SHELL=D:\USR\BIN\4OS2.EXE
    SET COMSPEC=D:\USR\BIN\4OS2.EXE

    makes 4OS2 the default shell.

    Steven

    --
    --------------------------------------------------------------------------------------------
    Steven Levine MR2/ICE 3.00 beta 11pre14 #10183
    eCS/Warp/DIY/14.103a_W4 www.scoug.com irc.ca.webbnet.info #scoug (Wed 7pm PST)
    --------------------------------------------------------------------------------------------


  13. Re: VIM for OS/2 Question

    On 06/23/08 12:14 am, Steven Levine wrote:
    > In, on 06/22/2008
    > at 06:51 AM, jch said:
    >
    >> I did ":ver" in vim, and noted what environment variables should be set.
    >> I added to CONFIG.SYS:
    >> set VIM=c:\vim\vim70
    >> set HOME=c:\vim\vim70

    >
    >> Then i put my .vimrc and .viminfo files in c:\vim\vim70. All colours,
    >> and settings in the .vimrc file are present!

    >
    > I agree with Dave that you should use something generic like
    >
    > set HOME=c:\home

    [...]

    This always brings up the question of which to use, backslashes or
    normal slashes with %HOME%.
    I've always used slashes on the principal that *nix programs are more
    likely to be happy and the only problem I've come across was that the
    Gnome port needed backslashes to startup.
    Dave

  14. Re: VIM for OS/2 Question

    Steven Levine wrote:

    >> Get correct vim behaviour with CMD.EXE and 4OS2.EXE. I still have to
    >> understand how to run a 4OS2 script automatically. Any hints? Still
    >> have to read through the 4OS2 docs.

    >
    > It depends on what you mean by automatically. With 4OS2 installed to
    > d:\usr\bin, the following in config.sys
    >
    > SET OS2_SHELL=D:\USR\BIN\4OS2.EXE
    > SET COMSPEC=D:\USR\BIN\4OS2.EXE

    _____
    Forgot to set COMSPEC= ; done

    I realised that your 4OS2 script to set the window size is a 4OS2 batch
    file. I called it WSIZE.BTM. Created a new program object. When i put
    in the parameter field "C:\4OS2\WSIZE.BTM 45 80", 4OS2 starts up with
    the window size i want.

    To open VIM in a window of a specified size i use two simple OS/2
    command files i found on the net:

    VIMBIG.CMD:
    @echo off
    start "Vi Improved" /f vimbig2.cmd %1 %2 %3 %4

    VIMBIG2.CMD:
    @echo off
    mode 80,45
    vim.exe %1 %2 %3 %4
    exit

    The only "problem" i have with the VIMBIG.CMD command files is that it
    does /not/ open a file for editing when it happens to be a "shadow" and
    i drop it on the VIMBIG.CMD icon. When i drop the real file on the
    VIMBIG.CMD icon, all works as desired.
    --
    Regards / JCH

  15. Re: VIM for OS/2 Question

    In , on 06/23/2008
    at 11:37 PM, Dave Yeo said:

    Hi,

    >This always brings up the question of which to use, backslashes or
    >normal slashes with %HOME%.
    >I've always used slashes on the principal that *nix programs are more
    >likely to be happy and the only problem I've come across was that the
    >Gnome port needed backslashes to startup.


    There's no good answer for this. While native apps should not care, I've
    run across some that fail to handle slashes transparently, so I use
    backslashes in config.sys.

    If I need to use forward slashes, I typically handle this in a wrapper
    script. 4OS2 makes this relatively easy, so I use commands like

    set SANE_CONFIG_DIR=%@replace[\,/,%HOME]/.sane


    Steven

    --
    --------------------------------------------------------------------------------------------
    Steven Levine MR2/ICE 3.00 beta 11pre14 #10183
    eCS/Warp/DIY/14.103a_W4 www.scoug.com irc.ca.webbnet.info #scoug (Wed 7pm PST)
    --------------------------------------------------------------------------------------------


  16. Re: VIM for OS/2 Question

    In , on 06/24/2008
    at 01:31 AM, jch said:

    Hi,

    >I realised that your 4OS2 script to set the window size is a 4OS2 batch
    >file.


    :-)

    >I called it WSIZE.BTM. Created a new program object. When i put
    >in the parameter field "C:\4OS2\WSIZE.BTM 45 80", 4OS2 starts up with
    >the window size i want.


    It is named winsize.cmd here only because 4DOS does not support window
    resizing. I reserve .btm for scripts that will run under both 4dos or
    4os2, but that's just my style.

    >To open VIM in a window of a specified size i use two simple OS/2
    >command files i found on the net:


    >VIMBIG2.CMD:
    >@echo off
    >mode 80,45
    >vim.exe %1 %2 %3 %4
    >exit


    This will get you scroll bars if you are not running your VIO windows
    maximized. My equivalent is

    call wsize.btm 80 45
    vim.exe %$

    because I almost never run VIO windows maximized.

    >The only "problem" i have with the VIMBIG.CMD command files is that it
    >does /not/ open a file for editing when it happens to be a "shadow" and
    >i drop it on the VIMBIG.CMD icon.


    This is just the way the WPS works. It's a somewhat odd limitation, but
    it's been there forever. Someone would need to implement an enhanced
    program object to support this. Someone may have already done this, but
    if so, I'm not aware of it.

    Steven

    --
    --------------------------------------------------------------------------------------------
    Steven Levine MR2/ICE 3.00 beta 11pre14 #10183
    eCS/Warp/DIY/14.103a_W4 www.scoug.com irc.ca.webbnet.info #scoug (Wed 7pm PST)
    --------------------------------------------------------------------------------------------


  17. Re: VIM for OS/2 Question

    On Tue, 24 Jun 2008 10:31:37 -0700, Steven Levine
    wrote:

    >>The only "problem" i have with the VIMBIG.CMD command files is that it
    >>does /not/ open a file for editing when it happens to be a "shadow" and
    >>i drop it on the VIMBIG.CMD icon.

    >
    > This is just the way the WPS works. It's a somewhat odd limitation, but
    > it's been there forever. Someone would need to implement an enhanced
    > program object to support this. Someone may have already done this, but
    > if so, I'm not aware of it.


    I tried dropping a shadow of a data file on to a shadow of the Enhanced Editor
    (EPM) and it opened the file. I also tried dropping it on a shadow of the
    System Editor and it also opened the file.
    Is this just a batch file problem?

  18. Re: VIM for OS/2 Question

    Paul Ratcliffe wrote:
    > On Tue, 24 Jun 2008 10:31:37 -0700, Steven Levine
    > wrote:
    >
    >>> The only "problem" i have with the VIMBIG.CMD command files is that it
    >>> does /not/ open a file for editing when it happens to be a "shadow" and
    >>> i drop it on the VIMBIG.CMD icon.

    >> This is just the way the WPS works. It's a somewhat odd limitation, but
    >> it's been there forever. Someone would need to implement an enhanced
    >> program object to support this. Someone may have already done this, but
    >> if so, I'm not aware of it.

    >
    > I tried dropping a shadow of a data file on to a shadow of the Enhanced Editor
    > (EPM) and it opened the file. I also tried dropping it on a shadow of the
    > System Editor and it also opened the file.
    > Is this just a batch file problem?

    _____
    Paul,

    I can duplicate what you observed: drop shadow of text file onto shadow
    of E.EXE, and text file opens just fine. Dropping shadow of text file
    onto shadow of command file does nothing, while dropping the actual
    object onto command file acts on it correctly and opens the file.

    Interesting! Learning little tid-bits all the time about OS/2 after
    many years of "rest".

    / John

    --
    Regards / JCH

  19. Re: VIM for OS/2 Question

    In , on 06/24/2008
    at 09:18 PM, Paul Ratcliffe said:

    Hi,

    >I tried dropping a shadow of a data file on to a shadow of the Enhanced
    >Editor (EPM) and it opened the file. I also tried dropping it on a shadow
    >of the System Editor and it also opened the file.
    >Is this just a batch file problem?


    Forget it. Brain cramp. Shadows of physical objects are not a problem.
    It's abstract objects that don't drop as one might wish.

    It is most likely a script problem.

    Steven

    --
    --------------------------------------------------------------------------------------------
    Steven Levine MR2/ICE 3.00 beta 11pre14 #10183
    eCS/Warp/DIY/14.103a_W4 www.scoug.com irc.ca.webbnet.info #scoug (Wed 7pm PST)
    --------------------------------------------------------------------------------------------


  20. Re: VIM for OS/2 Question

    On Tue, 24 Jun 2008 23:36:05 GMT, jch wrote:

    > I can duplicate what you observed: drop shadow of text file onto shadow
    > of E.EXE, and text file opens just fine. Dropping shadow of text file
    > onto shadow of command file does nothing, while dropping the actual
    > object onto command file acts on it correctly and opens the file.


    On my system I have the shell exception handler turned off and dropping a
    shadow of a text file on to a batch file causes a trap in PMWP.DLL .
    Turning the exception handler on makes it do nothing instead of trapping,
    so obviously the crappy IBM code in the WPCommandFile class was never
    written properly to cope with shadows. This is a perfectly reasonable thing
    to expect it to do IMHO.

+ Reply to Thread