Kohei Nozaki's blog 

jEdit conditional line deleting with regex


Posted on Sunday Jan 31, 2016 at 06:03PM in Technology


How to delete lines that contains a keyword?

Open Search And Replace dialog and turn Regular expressions on then put ^.*KEYWORD.*$\n to Search for box, leave Replace with blank then hit Replace All.

How to delete lines that NOT contains a keyword?

With ^((?!KEYWORD).)*$\n do the same to the above. for detail check http://stackoverflow.com/questions/406230/regular-expression-to-match-line-that-doesnt-contain-a-word


My jEdit setup on OS X


Posted on Sunday Jan 31, 2016 at 04:00PM in Technology


Make Option key work

Put a file contains following line to $HOME/Library/jEdit/startup so shortcuts that used Option work.

Debug.ALT_KEY_PRESSED_DISABLED = false;

Check http://www.nailedtothex.org/roller/kyle/entry/installing-and-configuring-jedit-5 for further information about setup jEdit on OS X.

Basic configurations

Just for my preferences:

  • Go to View section

    • check Show full path of buffer in title bar

  • Go to Editing section

    • set Word wrap to soft

    • set Wrap margin to 100

    • check Soft (emulated with spaces) tabs

  • Go to Toolbar

    • uncheck Show tool bar

  • Go to Text Area

    • check Caret: thick

Customize shortcut

First, choose keymap Mac OS X. Then customize maps that unusable by default because OS X takes precedence.

  • Incremental Search: CMD+, launches application’s preferences window. so I bind it to Option+, instead.

Note: Draw multi-key shortcuts on screen menu bar option makes some shortcut such as move to dockables unusable, I don’t know why.

Basic operations

Macros

From Macros ⇒ New Macro, you can create a BeanShell macros. For example, the macro below puts current date to the position of caret:

textArea.setSelectedText(java.time.LocalDate.now().toString());

Project Viewer

This plugin enables managing set of files in a unit named project. imagine the same name thing that implemented in some IDEs for Java development such as Eclipse or NetBeans.

There are some plugin that requires it. For example, FastOpen is a companion plugin for Project Viewer that enables open files fast with keyboard. I’ve set Delay before searching option to the smallest value (0.5sec).

The documentation of this plugin can be obtained from http://plugins.jedit.org/plugindoc/ProjectViewer/

Console

This plugin integrates console as a jEdit dockable.

Its advantages are commands that for invoking jEdit’s functionalities. for example, %edit foo.txt opens a file as a jEdit buffer. another useful one is redirecting output to a new jEdit buffer. for example, typing echo hello, jEdit in the console and hitting Ctrl+ENTER yields a new jEdit buffer with contents of hello, jEdit. also there are many useful variable syntax. e.g. ${f} for the current buffer’s path name. BeanShell console is available as well.

Also SshConsole Plugin extends its functionality to support remote hosts can be connected with SSH.

I recommend that check all three options in Console ⇒ System Shell ⇒ Events to chdir at Plugin Options.

The documentation of this plugin can be obtained from http://plugins.jedit.org/plugindoc/Console/

WhiteSpace

As its name states it make whitespaces, tabs or control characters visible. I recommend you to set to show leading and trailing tabs / spaces by this plugin.

TextTools

It provides some useful text operations, such as Toggle Range Comment. I recommend you to replace shortcuts for built-in ones by this plugin.

jDiff Plugin

It shows difference between two files pretty nicely as IntelliJ.

Others

Some worth considering plugins are:

  • FTP

  • SQL

  • XML

  • MarkerSets