1
0
mirror of https://github.com/misterunknown/ifm.git synced 2025-08-08 09:06:28 +02:00

Created Syntax highlighting and other Ace features (markdown)

Marco Dickert
2018-03-28 08:37:10 +02:00
parent bf3508267e
commit ef0d78643c

@@ -0,0 +1,17 @@
The IFM uses a very basic variant of the Ace editor, because it shouldn't contain unneccessary stuff by default to prevent it from becoming a bloatware. But for some people it would be very nice to have things like syntax highlighting etc., so I added the ability to bundle these Ace features with the IFM.
To include Ace features, you have to get them from the [Ace build repository](https://github.com/ajaxorg/ace-builds.git), which can be cloned from Github. Now choose the components from the `src-min-noconflict` directory and copy it to your local `ifm/src/includes/ace` directory. Afterwards you have to recompile the script. On Linux you could do it like this:
```bash
$ git clone https://github.com/ajaxorg/ace-builds.git /tmp/ace-builds
$ git clone https://github.com/misterunknown/ifm.git /tmp/ifm
$ cd /tmp/ifm
$ cp /tmp/ace-builds/src-min-noconflict/ext-modelist.js src/includes/ace/
$ cp /tmp/ace-builds/src-min-noconflict/mode-{html,perl,php,javascript}.js src/includes/ace/
$ php ./compiler.php --languages=en
```
With this, you would include the `modelist` extension (which is necessary for automatic syntax detection), and syntax highlighting for HTML, Perl, PHP and Javascript. The compiler builds a new ifm.php which you can copy to your
destination. (Note: You have to have the PHP CLI installed, as the compiler is written in PHP).
The recompiled ifm.php includes a new select box in the editor options where you can choose the desired syntax highlighting. As I said, if you include the `modelist` extension, the IFM will guess the syntax based on the file extension. The `src/includes/ace` directory is not tracked by git, so it's no problem to update the IFM, while keeping your custom extensions, modes and themes.