Examples

Far Manager

Examples

Description of FAR plugins examples delivered with FAR Manager. Source files are located in %FAR%\PlugDoc\Examples\.

Editor Plugins:

Align
Performs block align in FAR editor.
A simple plug-in related to "Activated - working - done" category.
It gives an example of using EditorControl service function.
Auto Wrap
Enables auto wrap in FAR editor.
This is an example of "hooking" the input stream in FAR Manager internal editor.
When enabled plugin monitors all keyboard and mouse events using ProcessEditorInput function:
int WINAPI _export ProcessEditorInput(const INPUT_RECORD *Rec)
{
  // KEY_EVENT processing code
}
Brackets
Searches and highlights the paired brackets in FAR editor.
This is an example of a "Opened, made something, finished" plugin.
Plugin uses ECTL_GETSTRING command to search brackets, ECTL_SETPOSITION command to place cursor on the paired bracket found and ECTL_SELECT command to highlight block.
DrawLine
Enables user to draw a pseudo graphics lines and tables in the FAR editor.
The "hooking" version of plugin related to "Activated - working - done" category. This plugin uses an infinite cycle to process data using ECTL_READINPUT and ECTL_PROCESSINPUT commands:
HANDLE WINAPI _export OpenPlugin(int OpenFrom,INT_PTR Item)
{
  ...
  while (!Done)
  {
    Info.EditorControl(ECTL_READINPUT,&rec);
    ...
    Info.EditorControl(ECTL_PROCESSINPUT,&rec);
  }
  ...
}
EditCase
Enables FAR editor to change the case of the selected block or a word under cursor.
This is an example of a "Opened, made something, finished" plugin.
This plugin gets a string using ECTL_GETSTRING command then transforms it and puts it back into the document being edited using ECTL_SETSTRING command.
HlfViewer
HlfViewer adds to the FAR editor an ability to view HLF help files. HlfViewer plugin is supposed to be a useful tool for developers who create or modify HLF-files or for those who just want to view an HLF help file (processes F1 key and shows up HLF-file being edited in a window, processes "hlf:" prefix).

Other Plug-ins:

HelloWorld
"Hello, World!" is a simple plugin helping beginners to understand the common plugin structure and the way it interacts with FAR environment.
FAR Commands
FAR Commands plug-in (FARCmd) brings additional functionality to the user menu, file associations and command line usage. There are several samples of prefixes handling.
FileCase
This command enables user to change the file name case for selected files according to one of case of the case change rules specified. This plugin is quite simple so you can use it as a template to create new commands for FAR Manager.
MultiArc
This plugin extends FAR Manager to be able to read the contents of archives, compress, extract and process files using archives. MultiArc represents archive and everything within as a directory structure transparent to user with some limitations though. FAR passes your commands to external archivers to process your requests. This plugin is quite complex. It supports second-level plugins so you can add support for new archive formats by writing small modules and without having to recompile the MultiArc itself.
Network
Using Network plugin you can browse the network and network shared resources, mount and dismount them as local drives. You can press F5 to map the chosen shared resource to the next available letters or F6 if you want to choose the letter yourself. F8 disconnects already mapped drive.
TmpPanel
Temporary panel adds to FAR Manager the ability to maintain virtual file lists similar to the file panels without directory structure. Temporary panels enable processing of multiple files from different folders. Up to 10 temporary panels with different file lists can be used.