vi mode

Ideas for new features

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
buddy213
Posts: 3
Joined: Mon Oct 25, 2004 8:45 am

vi mode

Post by buddy213 »

Would it be possible to have a selectable "vi mode"? There are many features which I really like about TextPad, and I use it for a lot of my editing, but I still find myself typing vi commands (and then untyping them), and using vi or vim for certain files.

Having this feature would be the clincher for me.
ben_josephs
Posts: 2461
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

Vi is modal. In vi, keys, including those for normal printable characters, have different effects depending on which mode you're in: entering commands or entering text.

Vi has no cursor. The cursor in most modern editors is not on a character, but between two characters. Vi uses the concept of the current character, and doesn't allow the newline character to be the current character. Thus you cannot move to the end of a line and insert text there; you have to move to the last character of the line and insert the text after it.

It is difficult to see how a non-modal, cursor-based editor such as TextPad could emulate such an editor.

(These characteristics of vi derive from the limitations of old-style dumb terminals that could only send ASCII characters and could only display text. Modern keyboards and monitors do not suffer from such restrictions, so there is no justification for this behaviour other than habit. It is the reason why some people take against vi so violently. I, of course, have no view on the matter... :-)
buddy213
Posts: 3
Joined: Mon Oct 25, 2004 8:45 am

Post by buddy213 »

Thanks for the response. I guess that would be a "no". :)
I work with databases, not deep programming so excuse my simple perspective. Concerning vi being modal, it seems that the only thing you are doing with "vi mode" would be to remap the keyboard. Perhaps this is more difficult than it sounds.
That's a good point about the cursor being on the character, I hadn't realized that. But it still seems that you would just need to translate cursor position in order to accomplish the vi command as if it were on a character.

If you press "x" in vi, it deletes the character the cursor is on.
In textpad, it could be, if you press "x" then it deletes the character to the right of the cursor. In the end, its the same thing.
If you type '3x' it deletes 3 characters.
User avatar
MudGuard
Posts: 1295
Joined: Sun Mar 02, 2003 10:15 pm
Location: Munich, Germany
Contact:

Post by MudGuard »

The problem is not the cursor position (which in my opinion is more of a philosophical question).

The problem is, that e.g. pressing the key x in vi sometimes means "put an x into the document" and sometimes means "delete the character at the cursor position" - depending on the mode vi is in. Textpad does not have such modes.

Why don't you configure a tool in Textpad that calls vi or vim with the current file?

Thus you can easily change to vi(m). After you have saved your changes you are either prompted in Textpad that the file has changed or you have to "revert" manually (depending on the settings in Textpad whether files changed externally should prompt or not).
GaryH
Posts: 1
Joined: Wed Dec 22, 2004 7:41 pm

VI

Post by GaryH »

This is something I would love to have - a VI or VIM emulation mode.
There are still times I rather use "vi" then any editor. I can do a few
things much faster through vi since I don't have to take my hands off
the keyboard to use the mouse.

Even emacs has a "vi" emulation mode. I hope to see a vi plug in someday for textpad.

>> Why don't you configure a tool in Textpad that calls vi or vim with the current file?

How do you do this? (I'm relatively new to textpad. I've had an earlier version years ago which I don't use since my preferred editor is vi, but
now I see advantage of Textpad :)).
User avatar
s_reynisson
Posts: 939
Joined: Tue May 06, 2003 1:59 pm

Re: VI

Post by s_reynisson »

GaryH wrote:>> Why don't you configure a tool in Textpad that calls vi or vim with the current file?
How do you do this?
Configure->Preferences->Tools->Add->Program.
See TP's help file under "How to Customize the Tools Menu" and "How to Customize Tool Properties".
A common configuration for a tool that takes the current file is

Code: Select all

Command: MyBrandNewAndAwseomeTool.exe
Parameters: $File
Initial folder: $FileDir
For more info on the tool parameters see TP's help file under "Tool Parameter Macros". HTH
Then I open up and see
the person fumbling here is me
a different way to be
wwphx
Posts: 8
Joined: Thu Feb 10, 2005 5:25 pm
Location: Arizona
Contact:

Post by wwphx »

ben_josephs wrote:Vi has no cursor. The cursor in most modern editors is not on a character, but between two characters. Vi uses the concept of the current character, and doesn't allow the newline character to be the current character. Thus you cannot move to the end of a line and insert text there; you have to move to the last character of the line and insert the text after it.
I wish my unix teacher had described vi in such terms. I was a long-time user of b.r.i.e.f., had to give it up when long filenames became the norm.

Found a couple of Windows versions, but I keep coming back to TextPad.
Post Reply