TSE: vimode

10 views
Skip to first unread message

knud van eeden

unread,
Jun 3, 2025, 8:28:11 AM6/3/25
to SemWare TSE Pro Text Editor
Hello,

> J. David Boyd wrote:
> "vimode"?   Why?

1. vimode.zip is a TSE macro one can download from the TSE Pro macros online.


3. I created a vimode.s which compiles 
(warning: but in case of run it only on a different 'test' TSE because quickly testing I could not get out of the program and had to restart TSE).

attached: "vimode.s"

4. Description:

vimode.zip83721995-02-22A TSE emulation of the unix vi command mode. Based on an earlier version posted by Charlie Harris. vi has some interesting movement and text

replacement commands that might be of interest to someone who has no interest in using the vi interface itself. Version by Arnold Hennig.
Uploaded by: Arnold Hennig


5. Mind map:

Inline image

6. Explanation taken from vimode.s:

/*
Charlie Harris posted his origional version of viTSE at an
opportune time for me, since I have had reason to start working
with a UNIX environment, but had found it difficult to learn the
editors without spending more time than I had available with
which to get nothing done, and most of my real work is with text.
His TSE vi emulation has allowed me to gradually familiarize
myself with the basic vi command set without having to come to a
comlete stop to do it.

I have also been gradually improving and adding commands as I go
along, and have recently undertaken the task of overhauling the
results of my efforts in order to put them into postable shape.

Because of differences in our primary goals, Charlie Harris and I
have taken different paths in the updating of viTSE, and anyone
interested in working with this command set may want to look at
both versions. I have expanded on the origional structure of
viTSE using a Process() with an exclusive keydef as the basic
Command mode, while he has changed to the use of a case statement
to define his key commands within a proc. His new implementation
makes possible the implementation of the dot command, while mine
makes possible the proper use of numeric input to movement
commands.

I made the statement recently that I thought that the dot command
could be implemented without too much difficulty, but this was
based on an erroneous understanding of the dot command. It is
really a variant of the famous "undo" and just as intractable,
which is why Charlie Harris found himself obliged to change his
approach in order to implement it.

I find the vi mode to be just as clumsy as its reputation for
general text entry and manipulation, but it has a good set of
movement and text change commands for the editing of existing
text. With movement by paragraph, sentence, word, or to a
specified letter in the middle of an extra long word, and with
the option to specify how many words, lines, or whatever to move,
it is easy to get to anyplace within the text.

And the commands to leave command mode and insert text allow
specifying insert, overwrite, or a combination of the two (eg.
write over two words and insert the rest of the new text before
the third word, etc).

NOTES:

1. My implementation isn't exact, either, although with a few
   stated exceptions (as noted in the source code), I have tried
   to make it as much so as possible.

2. I have had some difficulty with the sentence movement macros.
   They sometimes leave you in the wrong place, although general-
   ly not far from where you should be. This happens when the
   sentence crosses a line, but it doesn't always happen. In any
   case, with this in mind, they are useable in their present
   form, and perhaps someone else can show me what I'm missing.
   In any case I'll eventually change them, but I have to let
   them go for a while. Working on a problem too long tends to
   create mental blocks.

3. Most of the movement commands take numeric input. You type the
   number first, and it does not appear anywhere on the screen.
   When you type the command, it will do it that many times. On
   the help screen (Alt-F1), I have indicated an ³ for those
   commands which behave differently if no number is supplied.
   The c (change) and d (delete) commands require a second,
   cursor movent command, and can take the numeric input either
   first, or in between (eg. 3cw == c3w).

4. The proper implementation of the y (yank to buffer) and p
   (paste) commands would be built similiarly to the c and d
   commands, but a little more complex because they also take a
   letter buffername. I have not bothered to implement these,
   although I have thought about it, because I use viTSE mostly
   for editing existing text, and can always use the similiar TSE
   functions instead. I have deleted the rudimentary versions
   from this file so as not to create confusion as to their
   behaviour.


7. Commands:

-----------cut here -----------cut here -----------cut here-----------*/

/****************************** viTSE() ********************************/


helpdef vihelp
     Title = "vi commands"
     x = 5
     y = 2

"Cursor Movements:             h   Left"
"  w   Word forward            j   Down"
"  b   Word backward           k   Up"
"  W/B (by nonwhite group)     l   Right"
"  e   to end of word          H   to Top of Screen"
"  f(chr) forwd to char        L   to Bottom of Screen"
"  t(chr) to char before       M   to Middle of Screen"
"  F(chr) backwd to char       0   to BegLine"
"  )   Sentence forward        $   to EOL"
"  (   Sentence backward       |   to ³Col"
"  }   Paragraph forward       G   to ³Line (EOF)"
"  {   Paragraph back          %   to ³% of File"
"-----------------------------------------------------"
" Edit Commands                C  Change to EOL"
"   i  Insert at Cursor        c(mvmt)  Change text"
"   I  Insert at BegLine       d(mvmt)  Del text"
"   a  Append at cursor        D  Del to EOL"
"   A  Append to EOL           o  Open new line"
"   r  Replace Char            O  Open line above"
"   R  Overwrite Mode          <  Shift text left"
"   s  Subst., then insert     >  Shift text right"
"   S  Substitute from BOL     ~  Flip Case"
"   x  Del Char                =  Wrap Paragraph"
"   X  DelChars Left           u  Undelete"
"   J  JoinLines               U  Undo Cursor Line"
"-----------------------------------------------------"
"Colon Mode Commands           :wq   Write & Quit"
"   :q   QuitFile              :edit EditFile"
"   :w   Write                 :n    Nextfile"
"-----------------------------------------------------"
"Screen Movements:            Search"
"  ^F  Page Forward             /  Find"
"  ^B  Page Backward            ?  BackwdFind"
"  ^U  Up ³lines (½ Page)       n  Repeat Find"
"  ^D  Down ³lines (½ Page)     N  Backwrd RptFind"
"  ^E  ScrollDown"
"  ^Y  ScrollUp               Special Functions"
"  z(+,.,-) make (top,middle,    %  Matching Brace"
"          bottom) of screen     m  BookMark"
"  ^G  Show File Info            '  GotoMark"
"  ^L  Update Screen             ZZ Save & Exit"
end vihelp




VIMODE.S

knud van eeden

unread,
Jun 3, 2025, 10:04:47 AM6/3/25
to SemWare TSE Pro Text Editor
FYIO:

I wrote earlier about this viTSE / vimode.s the following:

"
Q. TSE: Vi: Mode: Emulator: vimode.s

A.
[kn, ri, su, 24-10-2010 17:55:50]


> VI

I was browsing yesterday a bit further on that text editors org pages,
and came across a description of the advantages of VI (which is
currently also the current favorite text editor of the author of those
pages).

===

One of the interesting feature of VI was that it was multi-platform.

---

But most of all that you should be able do everything on a ((very)
limited) keyboard only.

===

Basically only the alphanumeric keys and the <CTRL> key can be used.

---

No mouse (maybe handy when working with a laptop (everywhere), keeping
your fingers all the time on the keyboard only.

---

No extended keys like cursor up, cursor down, cursor left, cursor right, Home,
PageUp,
PageDown, ..., F1, F2, ...F12.

---

Because built and having its origin in the days of terminal keyboards
where no mouse and extended keyboards were available.

---

Regarding moving your fingers and hands as little as possible (e.g.
from keyboard to mouse or extended keys) this should be one of the most
minimal designs.

---

What you do in VI is constantly switching between 2 modes, command mode and
insert mode.

===

The <Escape> key always switches to command mode.

---

In VI you will constantly be changing between command mode and insert mode by
pressing the
<Escape> key.

---

In VI 'Command mode' you type commands

E.g. in that command mode typing keyboard character

'd' will 'd'elete,

'c' will change,

'f' will find or thus search

'w' represents a word

'^' represents begin of line

'$' represents end of line

typing 2 characters 'yy' will copy.

You can also create combined commands.

E.g. typing the 2 character 'dw' will 'd'elete the current 'w'ord.
You can also inform how many times you want to do that operation.
E.g. '3dw' will delete 3 words.

---

How to do such a things in TSE?

The equivalent actions in TSE are as usual typing combinations
of <CTRL>, <ALT>, <SHIFT> and the other keyboard characters
and or mouse buttons.

You could if you want change the default behavior by changing the keyboard
bindings
(which you can change in your .ui file (e.g. tse.ui or win.ui located in the \ui
directory)
then recompile that file in order to make the changes permanent).

E.g.

'd' in Vim would be typing the <Del> character in TSE or thus running the
command DelAnyChar() (= delete (a character))

'd$' in Vim would be pressing the <F6> character in TSE or thus DelToEol()
(=delete to end of line)

To emulate the behavior, you could create a tiny interpreter, as usual
using GetKey(), PressKey() to intercept the pressed keys, then
using CASE ... WHEN ... ENDCASE to check that keys and do something.

I plan to create a similar Vi mode macro some time.

===

Are there already VI mode macros created for TSE?

But checking if already something like that existed, it showed
there exist already two earlier created TSE macros

1. the macro 'vimode' created by Arnold Hennig from 1995.

After a few changes I could run this macro also in TSE v4.4

2. and another vi mode macro created by Charlie Harris.

But this macro was not found anymore anywhere.

===

Question: Anybody knows where to find this VI mode TSE macro from Charlie
Harris???

---

The other VI mode is 'Insert mode'
(where you are able to type your text and insert it in the current buffer as
usual).

It is a bit confusing when you start working with VI, because you will be by
design in 'Command mode' first.
And then when you type characters they might not be inserted as usually in your
text, and nothing seemingly happens because you are in command mode and
the characters are interpreted in another way.

---

So depending on the VI mode the *same* keyboard characters have
different meaning. E.g. typing 'd' in command mode means you want to
delete the current character, and typing 'd' in insert mode will just
insert the character at the current cursor position).

---

But there must be something in this VI mode of working, as many have
praised the capabilities of VI (and VIM which I have installed) to very
fast and efficiently and possibly optimal do your text editor actions.
So probably worth looking at the philosophy and implementation of this,
to use for your own possibilities to do the same things even better
then before.

At the end of the day VI is in this regard a special case of a command
driven text editor, using a minimum set of keys, and this commands you
can also combine in sophisticated ways (probably a bit like you combine
single commands into multiple commands in Forth)

---

But thus TSE is still my number one rated and most used program overall.
Rock solid, very reliable, very fast, handles very large files,
regular expressions, completely configurable, create your own
macros via the TSE virtual machine to do almost any text editor action and
beyond (e.g. via Microsoft Windows DLLs), ...
File corruption almost never happens, and when it happens it is not in TSE
control (e.g. because of operating system
actions, like pulling a USB while the file is saving), and crashing of TSE
happens only very rarely.
There are not much other text editors which can claim a similar record.

----

Emacs and SlickEdit are also very interesting editors. Only SlickEdit
would be usable for me though, as I work with very large files (growing
towards half a gigabyte), and default (GNU) Emacs complains about such
a large files. I plan to have a look at MicroEmacs also.

I saw some interesting demonstration of Scite about column editing on
YouTube, but that behavior could very probably also be macro programmed
into TSE if wanted.

What happened with e-Text editor? Have you used it? I bought it at the
time, and have the latest version running.
[note: e-text editor stopped being sold years ago [kn, ri, tu, 03-06-2025 16:00:54]]

There might be some things missing or not present in TSE

1. -Version control, but that you can thus e.g. create a workaround by
    e.g. using Tortoise SVN and TSE macros.

   Works really fun for me.

2. -Folding (I used it in e.g. IBM Lotus Notes, but it never convinced
    me personally. Opening when you wanted it closed, and closing when
    it was open). So not a must for me at all. Never used it really
    until now.

3. -Unicode (workaround would be to load/copy/paste/save in other text
    editors when that should occur). Interesting, but certainly not a
    must for me personally, as I only rarely have to use it.

4. -Regarding multi-platform (e.g. Linux), there should exist TSE beta
    versions, which should work pretty OK. I work sometimes on Linux,
    Unix, Solaris, and should work sometimes on AIX. But then I
    probably would use VI because that is default installed on most of
    them.

5. -Workspace and project

6. -Intellisense

Wine is another way, tried it a few times, but I think it has its restrictions
(e.g. not all Microsoft Windows programs run in it).
So better running the full operating system.

Otherwise as a workaround of still running TSE on Microsoft Windows, while
having to work in another operating system (like Linux)

I would install Oracle Sun Virtual Box on the Linux host machine and run
Microsoft
Windows with TSE in it.
You could then e.g. exchange information as usual using copy/paste or file
sharing.

Or the other way around, install Oracle Sun Virtual Box on the Microsoft Windows
host machine, and run one or
more Linux versions (like Ubuntu, Red Hat, Suse, ...) in it.

You can connect e.g. from you own computer to the remote computer e.g. using
Microsoft Remote Desktop if applicable.
Or otherwise in general using different VNC clients. Supplying the IP address of
the remote (virtual machine) computer only.
You might have to install a VNC server on the remote operating system if not
default present.

with friendly greetings,
Knud van Eeden


"

knud van eeden

unread,
Jun 3, 2025, 10:19:14 AM6/3/25
to SemWare TSE Pro Text Editor
Done: Looking in vimode.s it might be having some interesting keyboard vi
commands which might come handy when creating similar behavior in
native TSE. Should be checked by me some time I plan.

=> Conclusion: I checked the commands in the help in vimode.s and conclusion: nothing found that can really
benefit a TSE user as it can be done equivalently and in a probably much easier
way using other means like mouse, keyboard, ...

And thus as I observed earlier that installing TSE was possible on e.g.
at least 40 Linux distributions at the moment and having to use there
otherwise e.g. vi, vim or nano it is much more interesting and
versatile to install TSE on that Linux distribution instead and using
that TSE instead of using e.g. 'vim' and using its vi commands.


--

---
You received this message because you are subscribed to the Google Groups "SemWare TSE Pro text editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email to semware+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/semware/175239252.4425374.1748959483802%40mail.yahoo.com.
Reply all
Reply to author
Forward
0 new messages