Page 1 of 1
vi mode
Posted: Mon Oct 25, 2004 8:49 am
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.
Posted: Mon Oct 25, 2004 9:19 am
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... :-)
Posted: Thu Oct 28, 2004 7:16 am
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.
Posted: Thu Oct 28, 2004 8:08 am
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).
VI
Posted: Wed Dec 22, 2004 7:47 pm
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
).
Re: VI
Posted: Wed Dec 22, 2004 11:34 pm
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
Posted: Wed May 25, 2005 9:18 pm
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.