In the beginning God created the baryonic universe.

Macro to Split a jEdit Buffer

As I work with large text buffers, I find it convenient to split them into small files which can be edit faster. The following is a jEdit macro I recorded and enhanced to split a buffer at location indicated by <split>. The fragment buffers are saved to a directory with sequential numbering file names.

Note: 1) The split tag should also be on the first line. (The first 7 characters of the file are <split>) 2) Change the path to where you like to place fragment files.

   1 //
   2 // This is a jEdit java bean macro. It splits a jEdit text buffer
   3 // into many buffers and save them as files in a directory
   4 //
   5 
   6 textArea.goToBufferStart(false);
   7 SearchAndReplace.setSearchString("<split>");
   8 SearchAndReplace.setAutoWrapAround(false);
   9 SearchAndReplace.setReverseSearch(false);
  10 SearchAndReplace.setWholeWord(true);
  11 SearchAndReplace.setIgnoreCase(false);
  12 SearchAndReplace.setRegexp(true);
  13 SearchAndReplace.setSearchFileSet(new CurrentBufferSet());
  14 SearchAndReplace.find(view);
  15 SearchAndReplace.setSearchString("<split>");
  16 SearchAndReplace.setAutoWrapAround(false);
  17 SearchAndReplace.setReverseSearch(false);
  18 SearchAndReplace.setWholeWord(true);
  19 SearchAndReplace.setIgnoreCase(false);
  20 SearchAndReplace.setRegexp(true);
  21 SearchAndReplace.setSearchFileSet(new CurrentBufferSet());
  22 
  23 Integer count = 0;
  24 while ( SearchAndReplace.find(view) ){
  25 
  26     path = "C:\\Users\\dpham\\Desktop\\temp\\jedit\\c"+count.toString()+".html";
  27     textArea.goToPrevCharacter(false);
  28     textArea.goToBufferStart(true);
  29     Registers.cut(textArea,'$');
  30     buffer1 = jEdit.newFile(view);
  31     Registers.paste(textArea,'$',false);
  32 
  33     // save file here
  34     VFSManager.waitForRequests();
  35     buffer1.save( view, path );
  36 
  37     VFSManager.waitForRequests();
  38 
  39     count++;
  40 
  41     view.getEditPane().recentBuffer();
  42     textArea.goToBufferStart(false);
  43     SearchAndReplace.setSearchString("<split>");
  44     SearchAndReplace.setAutoWrapAround(false);
  45     SearchAndReplace.setReverseSearch(false);
  46     SearchAndReplace.setWholeWord(true);
  47     SearchAndReplace.setIgnoreCase(false);
  48     SearchAndReplace.setRegexp(true);
  49     SearchAndReplace.setSearchFileSet(new CurrentBufferSet());
  50     SearchAndReplace.find(view);
  51     SearchAndReplace.setSearchString("<split>");
  52     SearchAndReplace.setAutoWrapAround(false);
  53     SearchAndReplace.setReverseSearch(false);
  54     SearchAndReplace.setWholeWord(true);
  55     SearchAndReplace.setIgnoreCase(false);
  56     SearchAndReplace.setRegexp(true);
  57     SearchAndReplace.setSearchFileSet(new CurrentBufferSet());
  58 }
  59 buffer.save( view, path );
  60 
  61 
CreationWord.org
Reach for the Calling Creator

Computer Notes

CSS Color Names

CakePhp and SQLite

SQL Injection Scanner

Squish by Froglogic

Android Notes

Tools on Windows OS

Text to Speech Software

jEdit Plugins

Split File by jEdit Macro

Dark Eclipse theme

Eclipse Plugin Basics

FTP with Eclipse

Markdown with Eclipse

ON THE BOOK SHELF

Knowledge of the Holy - A.W. Tozer

The Pursuit of God - A.W. Tozer

The Dwelling Place - A.W. Tozer

Plumber of Lisburn - A.W. Tozer

Spiritual Power Vows - A.W. Tozer

Root of the Righteous - A.W. Tozer

Essays - A.W. Tozer

Fourfold Gospel - A.B. Simpson

Gospel of Healing - A.B. Simpson

Life of A.B. Simpson - C&MA

Mark Gospel 1/4 - A MacLaren

Mark Gospel 2/4 - A MacLaren

Mark Gospel 3/4 - A MacLaren

Mark Gospel 4/4 - A MacLaren

Gospel of St. John - F.D. Maurice

To the Romans - R.V. Foster

To the Romans, vol I - C. Gore

To the Corinthians - J.S. Riggs

To the Philippians - R. Rainy

To the Galatians - Luther

To the Hebrews - H.C.G. Moule

To the Hebrews - T.C. Edwards

Wisdom of James - A.T. Robertson

Epistles of John 1/2 - W. Alexander

Epistles of John 2/2 - W. Alexander

Kingdom of Heaven - E. Burbidge

Deuteronomy - C.H. Mackintosh

Religion and Theology - J. Tulloch

The Being of God - St Anselm

The Existence of God - St Anselm

God Became Man - St Anselm

The Other Wise Man - H. Van Dyke

First Christmas Tree - H. Van Dyke

A Christmas Carol - C Dickens

Thoughts on the Universe

Computer Notes

About the Website


Color Theme:   Night     Day  


May your calling be the best.