HbEdit

Console multiplatform text editor

About an editor. Concept

Hbedit is my attempt to make a perfect text editor. Perfect for me - everyone has their own ideas about the ideal. I am aware that even by limiting the task to my preferences, the ideal result is not achieved - that's why it is an ideal, it is always somewhere over the horizon. But to strive for it is necessary, and I am trying to do this.

The ideal editor should provide all the necessary functions, but not be overloaded with excess. It should combine the best features of the best editors, but this connection should not be eclectic. There must be a system, a harmonious connection of all parts, intuitive, logical interface.

Of course, it must be cross-platform. Must be flexible, customizable, should provide the ability to connect additional modules (plug-ins) for additional functionality.

As a basis was taken the editors that I usually use: Far's (Windows) and Midnight Commander's (Linux) built ib editors, and Vim. Of course, I never set a task to implement all Vim possibilities, or even most of them. This is too much work at first, and secondly, it is simply unnecessary. It is enough, in my opinion, to implement the main, most used functions - those that I use myself or guess someday use. And I wanted to expand the capabilities of the editing mode and, thereby, minimize switching from one mode to another.

Key features

General description

Hbedit is a multi-mode editor, it supports four modes: two main (edit mode and Vim-mode) and two additional (selection mode and command). defmode option in OPTIONS section of hbedit.ini determines which of the two, the editing mode (defmode = 0) or Vim-mode (defmode = 1) will be the default. Another option is possible when the editing mode is not only the main one, but the only one (defmode = -1) - while switching to Vim mode is impossible. This makes sense if the user is um ... not very qualified and accidental switching to Vim mode may be a shock to him.

Switching between modes depends on which one is selected in as the default (primary). If this is an editing mode, then switch to Vim mode occurs when you press Ctrl-Q, back - ESC (or one of the Vim commands: i, a, ...). If the Vim mode is selected as the main one, then switching back and forth is carried out in the same way as done in Vim: i, a, and so on - in edit mode, ESC - back to Vim. And more: if the main is the edit mode, then you can close the current window by pressing ESC, for Vim this will not work.

Editing mode is a familiar to most users way of working in text editors. If you wish, you can use this mode only. The convenience of Hbedit is that it does not impose on your specific work model.

The Vim mode is the main mode in the Vim editor. The keys in this mode do not serve to enter text, but to perform certain commands. Hbedit supports a subset of the Vim commands, you can see the full list in the next section.

To selection mode you switch automatically by starting to select text. It can be done in several ways. In edit mode you can, as in most Windows editors, use Shift + movement keys, to select a vertical block - Shift-Alt + movement keys. In Vim mode, press v to start normal selection, V - select lines, Ctrl-v - highlight vertical block. In both modes you can use F3 (as in Midnight Commander) to start the normal selection, Ctrl-F3 - selection of the vertical block, and then - movement keys. I consider selecting as a separate mode, because a key assignment is changed. In most Windows editors, when you click, say, f, during the selection process, you will delete the selected text and a f symbol will be inserted in its place. I do not see a big benefit in such an operation. In Hbedit, when you press a key, if it is a selection mode command, a certain action will be performed - in most cases this is the a corresponding Vim command. For example, when you click u, the selected text will be converted to lower case. Full list of selection mode commands is here. By pressing F9 or m you call a special menu for selection mode with a number of additional commands. So, you can add a given text to the left or right of each line of selected text, sort lines of text by selected vertical block, calculate the sum of the numbers in the selected vertical block. The list of such operations may be extended, using a special plugin, plug_selection.hrb

Command mode is also borrowed from Vim. Switching to it is made from Vim-mode, using Ctrl-Q (for convenience, if you switch to Vim from edit mode using Ctrl-Q) or, as is customary in Vim, Shift-:. You go to the command line where you can enter and run on execution of various commands. The set of these commands is so limited by compared to Vim, which makes me even embarrassed to talk about this mode. This is q, q!, e, w, set (with a very limited set of parameters), bp, bn, ls, ! - Vim users know what it is.

Hot keys

Keys fot both editing and Vim modes:

F10, Esc Exit;
F9 main menu;
F1 help;
F2 save file;
Shift-F2 save file as...;
F3 block selection;
Ctrl-F3 vertical block selection;
F4 file open dialog with a list of recent files;
Ctrl-F4 file open dialog;
Shift-F4 new window;
F7 search;
Shift-F7 search for the next entry;
Alt-F7 search for the previous entry;
Ctrl-F7 search / replace;
F8 enable / disable syntax highlighting;
Shift-F8 select code page;
Alt-F8 go to the specified position (line,position);
F11 plugins list;
F12 list of open files;
Ctrl-Q change current mode;
Ctrl-Z или Alt-BS Undo;
Ctrl-Tab, Shift-Tab switch buffer (opened file)/window;
Ctrl-v, Shift-Ins paste text from the clipboard;
Ctrl-p paste text from any of clipboard buffers;
Alt-m[a...z] set a bookmark;
Alt-'[a...z] go to the bookmark;
Alt-'. go to the last edit position;
Ctrl-b go to the pair bracket;
Alt-b Return to the previous position (after search, goto, ...)
Ctrl-w,s split window horizontally and open the same file in readonly mode;
Ctrl-w,v split window vertically and open the same file in readonly mode;
Ctrl-w,w switch window;
Ctrl-w,c close window;
Ctrl-w,o open window fully;

Selection mode keys:

Ctrl-C или Ctrl-Ins или y put text into the system buffer;
F3 put text into one of 10 internal buffers (0th is system);
Del или d delete the text;
Shift-Del или Ctrl-X put in the system buffer and delete;
c delete the text and switching to edit mode;
u, U convert, respectively, to lower or upper case;
>, < increase / decrease indent;
. repeat the last operation with a selected region;
m или F9 menu for a selected region;
o continue selection from opposite end;
r[x] replace all chars in selected text with x;
i[w,W] select a word under the cursor;
i[",'] select a text between quotes (double or single);
i[b,(,)] select a text in parentheses;
i[ select a text in square brackets;
i[B,{,}] select a text in braces;
is select a sentence;
ESC cancel selection.

Vim-mode keys:

h,j,k,l cursor left, down, up, right;
w, W the next word (big word);
e, E end of the word (big word);
b, B the beginning of the word (big word);
0 beginning of line;
^ the beginning of the first word in the line;
$ end of line;
gi go to the last edit position;
gg go to the beginning of the file;
[1...9]gg go to the specified line;
[1...9]G go to the specified line;
G go to the end of the file;
H go to the first line on the screen;
M go to the middle of the screen;
L go to the last line on the screen;
Ctrl-b PgUp
Ctrl-f PgDn
% go to the matched bracket;
f[x] find next char x;
F[x] find previous char x;
* find a word under cursor;
# find a word under cursor (backward);
/ search from the command line;
v switch to selection mode;
V switch to lines selection mode;
Ctrl-v switch to vertical block selection mode;
p, P insert text from the buffer;
yy put acurrent line into the clipboard buffer;
yi[w,W] put a word into the clipboard buffer;
yi[",'] put a text between quotes into the clipboard buffer;
yi[b,(,)] put a text in parentheses into the clipboard buffer;
yi[ put a text in square brackets into the clipboard buffer;
yi[B,{,}] put a text in braces into the clipboard buffer;
yis put a sentence into the clipboard buffer;
"[a...z,-] set a register for a next operation;
i switch to edit mode at the current position;
a switch to edit mode after the current position;
I switch to edit mode from the first word of the line;
A switch to edit mode from the end of the line;
cc delete the current line and go into edit mode;
c[w,W] delete before the beginning of the next word and go into edit mode;
c[e,E] delete the end of the word and go into edit mode;
c[b,B] delete a word before the start and go into edit mode;
сi[w,W] delete a word and go into edit mode;
сi[",'] delete a text between quotes and go into edit mode;
ci[b,(,)] delete a text in parentheses and go into edit mode;
ci[ delete a text in square brackets and go into edit mode;
ci[B,{,}] delete a text in braces and go into edit mode;
o insert a line after the current one and switch to editing mode;
r replace one character;
R replace few characters;
~ invert character case;
>> indent the current line right;
<< indent the current line left;
dd delete the current line;
d[w,W] delete before the next word;
d[e,E] delete to the end of the word;
d[b,B] delete a word before the start;
di[w,W] delete a word;
di[",'] delete a text between quotes;
di[b,(,)] delete a text in parentheses;
di[ delete a text in square brackets;
di[B,{,}] delete a text in braces;
x delete a char;
. repeat the last operation;
m[a...z] set bookmark;
'[a...z] go to the bookmark;
'. go to the last edit position;
u undo;
ZQ close all buffers without saving;
ZZ close all buffers, save updated;
q[0...9,a...z] recording macro;
@[0...9,a...z] playing macro;
@@ playing last used macro;
[0...9]@[0...9,a...z] playing macro specified number of times;

The number entered before the move command (h, j, k, l, w, w, e, E, b, B) or before dd, dw, dW, db, dB, de, dE, cc, cw, cW, cb, cB, ce, cE, yy forces appropriate action to be done a specified number of times. For <<, >> commands this number sets the quantity of lines to be indented.

Command line parameters

hbedit [-f iniFileName] [-gN] [-xy=xPos,yPos] [-size=nCols,nRows] [-ro] [files...]

hbedit.ini

hbedit.ini - editor configuration file. When starting up hbedit, it is searched first in the current directory, and then, if not found, in the directory where the executable file hbedit is located. On Linux/Unix systems, after the current directory, it is also searched in the home directory (~/hbedit/hbedit.ini). The path and name of the configuration file can also be specified on the command line when hbedit is called.

SCREEN section

Sets the size of the editor window, the font and the default code page.

START section

OPTIONS section

CODEPAGES section

The codepages used in the work are listed here (the full list is in the Codepages). Each codepage is in a separate line: cp1 = RU866, cp2 = RU1251, ...

PLUGINS section

Here are listed the plugins used in the work. Each plugin is in a separate line: p1 = ..., p2 = .... A plugin is a file with the .hrb extension in the plugins/ directory. In each line, separated by commas, there are a file name, a file type, a name that will be displayed in the menu, and, if you need a keyboard shortcut associated with this plugin (Alt-L, for example, in this case the plugin will be called when you press Alt-l).

The file type is one of the languages, defined in hbedit.ini (prg, c, go, ...). This is done for when you call the list of plugins (F11), only those, created for the language of the file in the current window are displayed. If the plugin file type is not specified (empty), then it appears in the list for any file.

HILIGHT section

The colors for the default color scheme are defined here, they are specified in Harbour color format, TextColor/BackColor. BackColor can be a value from the following list:

N, B, G, BG, R, RB, GR, W - in the default color scheme these are, respectively, black, blue, green, cyan, red, purple, brown, light gray.

TextColor - one of the BackColor list or

N+, B+, G+, BG+, R+, RB+, GR+, W+ - in the default color scheme, respectively dark gray, bare, light green, light cyan, light red, light purple, yellow, white.

In a different color scheme, solarized, for example, the indicated letters may correspond to completely different colors.

PALETTE sections

There may be several of these sections, they should have different names beginning with PALETTE: PALETTE_1, PALETTE_2, ...

LANG sections

These sections contain options related to a specific file type. Section name - LANG_<type>, where <type> - file type: LANG_PRG, LANG_C, LANG_GO, LANG_XML, ...

Codepages

Hbedit supports all codepages, which Harbour have: BG866, BGISO, BGMIK, BGWIN, BIG5, CP950, CS852, CS852C, CSISO, CSKAMC, CSWIN, DE850, DE850M, DEISO, DEWIN, DK865, EL437, EL737, ELISO, ELWIN, EN, ES850, ES850C, ES850M, ESISO, ESMWIN, ESWIN, FI850, FR850, FR850C, FR850M, FRISO, FRWIN, GBK, HE862, HEWIN, HR646, HR852, HRISO, HRWIN, HU852, HU852C, HUISO, HUWIN, IS850, IS861, IT437, IT850, IT850M, ITISB, ITISO, ITWIN, LT775, LTWIN, NL850, NL850M, NO865, PL852, PLISO, PLMAZ, PLWIN, PT850, PT860, PTISO, RO852, ROISO, ROWIN, RU1251, RU866, RUISO, RUKOI8, SK852, SK852C, SKISO, SKKAMC, SKWIN, SL646, SL852, SLISO, SLWIN, SR646, SR646C, SRWIN, SV437C, SV850, SV850M, SVISO, SVWIN, TR857, TRISO, TRWIN, UA1125, UA1251, UA866, UAKOI8, UTF8.

You may include those, which you need, in hbedit.ini, CODEPAGES section.

Plugins list

Plugins internals



Comments:       ()       prev.    next.       Add comment
The length of a comment - no more than 4000 characters.
Your name:

Email address:
(not be shown publicly)
 
Input text from an image: