open-watcom / open-watcom-v2

Open Watcom V2.0 - Source code repository, Wiki, Latest Binary build, Archived builds including all installers for download.
Other
973 stars 159 forks source link

Vi.exe Modeless mode clipboard workflow #824

Closed Gavin-Holt closed 2 years ago

Gavin-Holt commented 2 years ago

Hi

I am having fun exploring console Vi.exe in "modeless" mode under windows (i.e. vi.exe from binnt or binnt64). The speed is addictive :)

This version of vi.exe does not have access to the system clipboard, but does offer and . However, the expected modeless single clipboard workflow does not seem to work as one might expect:

I have some custom menu entries that select text for deletion e.g.

    menuitem "Delete Word &Left   Ctrl+Bksp" keyadd \<CTRL_LEFT>\<CS_RIGHT>\<BS>
    menuitem "Delete Word &Right   Ctrl+Del" keyadd \<CTRL_RIGHT>\<CS_LEFT>\<DEL>
    menuitem ""
    menuitem "Delete to EOL         Ctrl+&K" keyadd \<SHIFT_END>\<DEL>
    menuitem "Delete to &BOL   Ctrl+Shift+K" keyadd \<SHIFT_HOME>\<DEL>

Unfortunately the text deleted replaces the contents of the "clipboard". I suspect this is not what the designer of the "modeless" mode intended.

For others interested in exploring I have attached my ed.cfg and the autohotkey script to drive it!

Kind Regards Gavin Holt

ed..txt OWVI..txt

Gavin-Holt commented 2 years ago

Hi,

I have been trying to get cut copy and paste to work in "modeless" mode and use Autohotkey to call some scripts (mapping does not work in modeless mode!) - I can report some success:

# ed.cfg &Edit menu
    menuitem "Cu&t              Ctrl+X" <CTRL_K>\h\xso mod\\cut.vi \n
    menuitem "&Copy             Ctrl+C" <CTRL_K>\h\xso mod\\copy.vi \n
    menuitem "&Paste            Ctrl+V" <CTRL_K>\h\xso mod\\paste.vi \n
autoexec section for "Open Watcom vi"
    ^c::Send !ec
    ^x::Send !et
    ^v::Send !ep

As you can see below I have had to dip my toe into the modal world of vi! Using the z copy buffer as a "single" clipboard:

# Copy.vi
    set nomodeless
    execute "zyr
    set modeless
    echo ""
# Cut.vi
    set nomodeless
    execute "zdr
    set modeless
    echo ""
# Paste.vi
    set nomodeless
    execute dr
    execute "z\<SHIFT_INS>
    set modeless
    echo ""

Hopefully this will make the editor more useful for those of us in "modeless" mode.

Kind Regards Gavin Holt

NB.

Achievements so far:

Blind alleys: