KKEdit

Source code text editor


main

Why another text editor?

Simple, I didn't like any of the others they were all too flat ( sorry wrong sketch! ), anyway having used gedit for years it was getting increasingly difficult to keep it compiling without loads of gnome dependencies, looking around Linux text editors seem to be VERY simple (leafpad) stupidly complex (GVim,Bluefish), trying to be all things to all people.
One of the best text editors I have used is BBEdit but that is only available on the mac, so I bit the bullet and decided to write my own with the best bits from BBEdit ( the name KKEdit is a tip of the hat to BBEdit ), gedit and leafpad. A simple uncluttered interface, no major dependencies, with just the features I use all the time, and TA DAH! KKEdit.


What it's not!

KKEdit is NOT a word processor or a web page editor, it is NOT and IDE! It won't right code for you, it wont insist on inserting brackets ( REALLY annoying! ), it wont force you to use any particular style, it doesn't need you to break all your fingers trying to hit weird and wonderful key combo's and it is not tied to one particular distro, oh yes and it won't cost you a penny!

What it is and does

KKEdit is a deceptively simple text editor with syntax colouring.
It also has a function menu which allows you to jump instantly to a function definition, a navigation menu which will look in all open files for a function definition and then switch to that tab and go to the relevant line if it can't find a definition in any open files it will do a recursive search from the folder of the currently selected document, you can also highlight a #include directive and it will search for and try to open the file, include files surrounded by <> will be looked for in /usr/include, files surrounded by "" will be looked for in the current folder.
External tools can be added either globally or locally and when run can either replace the currently select text with their output, replace all the files text, be run in a terminal or you can choose to ignore the output form the script, BASH, python and perl can be used for the script language or any interpretor that uses '#' as a comment marker.
A number of simple demo scripts are included in the folder "demotoools" ( good name eh ).
You can drag and drop a file onto the main toolbar/menu to open a file.
Session can be saved and reloaded.
Any amount of bookmarks can be added anywhere, selecting a bookmark from the menu will switch to that tab and move to the appropriate line.
Just type a line number into the edit box on the toolbar to jump straight to that line.



Manual

Navigation Menu
Functions Menu
Tools Menu
Preferences
Customize The Tool Bar
Other Features
Get It And Build It
Bug Reporting


Navigation Menu

The Navigation menu has five sub-menus - Go To Definition, Open Include File, Go To Line, Search For Define and Search In Gtk-Docs.

To go where a function etc is defined, select it and choose 'Go To Definition' KKEdit will then look in open files for the definition and switch to that page and highlight the appropriate line like so:

gotodefine

define
As you can see as the definition was not in an open file KKEdit looks for the definition recursively starting from the folder where the file was opened from and if found opening the file and selecting the line with the definition.
The search depth for finding a definition is set in the prefs and defaults to 1 i.e. only looks for definitions in files in the same folder as any open documents, be careful about setting this too high as it can cause an unwanted delay when right clicking if it has to look in a lot of sub-folders.

You can also open an include file just highlight the line and select  Open Include File like so:

openinclude
Include files are looked for in either /usr/include or the directory the current document is in, depending whether the file name is surrounded by '<>' or ' "" '.

Search for Define will open an entry box and allow you to type in a definition or part of a definition and will try to find it in the usual places opening a file if necessary, the search is case insensitive.

 


Functions Menu

The Functions menu contains a list of all defined functions, variables and defines that are visible in this file, to jump to the appropriate function definition just select it from the menu like so:
funcmenu
The Functions menu will be updated after saving a file or switching tabs.



Tools Menu

The Tools menu allow you to run an external script i.e. to open a terminal with the working directory set to the folder where the current file is open:
openterm

External tools can either be added globally to /usr/share/KKEdit/tools (if you have installed with --prefix=/usr) or locally in ~/.KKEdit/tools.
External tools are passed four environment variables:
KKEDIT_CURRENTFILE - Path to current document.
KKEDIT_CURRENTDIR - Directory of current document.
KKEDIT_SELECTION - Currently selected text.

KKEDIT_DATADIR - Directory of global folder ( e.g. /usr/share/KKEdit ).
KKEDIT_HTMLFILE- Temporary file for displaying html in doc viewer

More variables may be defined later.
External tools can be created by hand or via the 'Tools->New' menu like so:

exttool

The place holders are:
%t - Currently selected text, the same as the $KKEDIT_SELECTION environment variable passed to the command .
%f - Filepath of the current document, the same as the $KKEDIT_CURRENTFILE environment variable passed to the command.
%d - Directory of the current document or ${HOME}, the same as the $KKEDIT_CURRENTDIR environment variable passed to the command.
%i -The location of the globally installed tools, the same as the $KKEDIT_DATADIR environment variable passed to the command .
%h - Temporary file for displaying html in doc viewer, the same as the $KKEDIT_HTMLFILE environment variable passed to the command .

Selecting 'Show HTML Doc' will display the file
$KKEDIT_HTMLFILE in either the Gtk Doc viewer or your default browser, this is used in the installed example tool 'Open Man Page' to display the manpage of the selection ( if it exists and if you have man2html installed, most people do ).

Only tools that have "Show Tool In Pop-Up Menu" selected will show up in the pop-up menu if you have also selected some text.
Tools that have the "Always show In Popup" selected will show in the popup menu regardless of whether any text is or is not selected.

Commands can be 'compound' commands i.e. 'cat /tmp/textfile|head' but using pipes to a terminal may not always give what you want i.e. 'xterm -hold -e 'cat "
/tmp/textfile"|tail -f'' WILL work and show the tail of the file but WILL NOT follow properly this is a feature/problem of xterm and beyond my control :(

For very
complex commands create a script and set 'command' to the file path of your script, file paths can be absolute OR relative ( see the example scripts ).

Tools can be edited by selecting from the drop down list, if you attempt to edit a globally installed tool ( i.e.i.e. one in /usr/share/KKEdit/tools ) you must have root privileges.



Preferences

prefs

The Prefs file is created ~/.KKEdit/kkedit.rc and will be created/recreated when quitting KKEdit.
Preferences should be set from 'Edit->Preferences'
You can set the command to run an external tool in a terminal from here.

You can also set the highlight colour of bookmarked lines, and also whether to show the bookmarkbar.
The 'Theme' can be set for the prefs via the drop down, update of the current page is 'live', click 'Apply' to set the theme globally or 'Cancel' to ignore changes.
Themes are stored in "/usr/share/gtksourceview-2.0/styles" ( default installed themes ) or locally in ~/.gnome2/gedit/styles, for compatability with gedit as most gktsourceview themes seem to be gedit-centric ;)



Customize The Tool Bar

You can customize what appears on the tool bar by simply clicking on a button to add it to the menu like so:


And then drag it to where you want it to appear on the toolbar like so:


To remove an item from the toolbar just hold 'CONTROL' and click on item to be removed.

Some items can only be added once 'Save', 'Open' etc when they have been added they will be greyed out and can't be added again, removing them makes them available again, the separator and the expander can be used multiple times.
You can also choose to hide/show the toolbar from the 'View' menu.


Other Features

Copy filename from tab menu.
Copy filepath from tab menu.
Spell check document from tab menu.
Copy function define.
Go to function definition.
 
Toggle bookmark.
Single or multiple instance app.
Open as hexdump.
Find API definition in Gtk Doc's.
Other

Right clicking on a tab allows copying of the document file name, file path, spell check the document ,split/insplit the view and set the source highlighting.
tabmenu

The document context menu also contains the  'Go To Definition' function for convenience.
Selecting the definition will copy it to the clipboard.
If there is no valid definition selected the menu item will not be shown.

context

The right click context menu:
popup

Spell checker dialog

spellcheck

Bookmarks

Any amount of bookmarks can be added, selecting one will switch to that document and line.
Bookmarks are stored with the 'Save Session' and can be restored with the 'Restore Session With Bookmarks' menu.
Bookmarks are now toggled so if you place the cursor on a line with a bookmark it will add it if it's not already bookmarked or remove the bookmark if it is, you can use the 'Toggle Bookmark' menu from the main menu or the main context menu, you can also just click in the bookmarks bar to toggle a mark on or off ( you will see a little bookmark icon ).
boomark

You can open a file as a hex dump ( this is NOT a hex editor though that may change later ) like so:
hexdump

Look up Gtk API

You can look up an API declaration from any installed gtk-doc's installed by selecting all or part of an API name like so:
selectapi

And then selecting 'Search In Gtk-Docs' form the Navigation menu or from the right click pop-up menu like so:
apimenu

And if you have built with the --enable-docviewer option to configure ( the default ) you will get a window pop-up with a list of possible links to the API you want, if there is only one possible link you will go straight to that.
list

Click the Link:
selected

Links can be clicked and followed in the Gtk doc viewer, and functions etc can be copied and pasted into your document.
If you had select all of the 'gtk_window_set_title ' API name you would have gone straight to the screen shown.
You can also manually enter a search term in the box and press 'enter' or click 'find'.

Other Features include:
Can be set to automatically save and restore a session ( with or without bookmarks ) when starting and exiting.
You can manually save and restore sessions via the 'File' menu, you can also restore a session with or without the saved bookmarks ( bookmarks are saved automatically with the session ), if you change a file on disk without re-saving the session you may find that some bookmarks are skewed.
You can run KKEdit either as a single instance app or as a multiple instance app , set via the prefs menu. Single instances are unique to each workspace.
You can also open a new instance of KKEdit from the file menu regardless of the prefs settings.
You can also open a new instance of KKEdit with admin privileges from the file menu, If you have installed GtkSu ( Available here ) then gtksu will be used for authentication if not a terminal will be used depending on your preferences settings. WARNING!! Editing files with admin privileges can seriously damage your system if used incorrectly.



Search and replace uses regex expressions, the quick search on the toolbar does not, searching backwards can not be used with regex, the text in the find/replace boxes are taken as literal strings.
You can find and replace in a single file or in all open files, if you choose to do a 'Replace All' in all open files you will be asked to confirm the action.
The 'Wrap' option to find/replace is ignored when searching in all open files.


You can jump to a line using the toolbar entry:

jumptoline

You can do a 'live' search by just typing into the toobar  search box::
apisearch

Split view mode:
splitscreen

The current source syntax colouring is now selectable via the 'tab' context menu like so:
Be aware that the default highlighting for a file is set by the mime-type system and so may change after saving/loading. mime-types for a file can not usually be set manually but depends on system auto magic stuff, file suffix etc.
hilite


Get it here!
KKEdit

Dependencies

A reasonably new Xorg and desktop.

gtk-2.24.13.
gtksourceview-2.11.1.
ctags.
xdg-utils-1.1.0.
Autotools.
libunique-1.1.6

webkitgtk-1.10.x. (optional but recommended)
aspell-0.60.6.1.
(optional but recommended)
GtkSu (
optional but recommended)
Manpage Editor
(optional but recommended)
Glib-Networking
(optional but recommended)

 
webkit is is an optional dependency if you want to build the Gtk-Doc viewer disable by adding --disable-docviewer to ./configure or ./autogen.sh.
Spell checking via aspell is optional and can be enabled with the '--enable-aspell' switch to ./configure or ./autogen.sh.

The presence of "GtkSu" and "Manpage Editor" are detected at configure and if installed will be used, in the case of GtkSu this is used to get admin privileges when opening a root editor from the file menu, if Manpage Editor is detected a menu item is added to the file menu, both can be downloaded from this website.

Glib-Networking is a runtime dependency and is used to do a google search if "Open Man page" or "Search in GTK-Docs" can't find anything.
 
If you use a source based distro like LFS or Slackware you should have all(most) of these installed, if you use a pre-packaged distro like debian and you have not compiled from source before you may have to install some development packages i.e.i.e. for debian ( this is from memory ) the build-essential package and the -dev packages for gtk2 and

gtksourceview, check your distros documentation and you distros forums for general help on compiling software.


Building
Unpack the tar ball,cd into the KKEdit folder and run:
./autogen.sh --prefix=/usr 
--enable-aspell  --enable-docviewer
make
sudo make install
( ./configure can now be used instead of ./autogen.sh - no need for autotools ).
PLEASE read the README file!
See the 'INSTALL' file for full details.

Reporting Bugs

Please send bug reports, feature suggestions, large bags of jewels etc to:


  kdhedger68713@gmail.com

I will get back to you as soon as I can.

Home