Using Kate As a Web Editor

There are many applications out there that provide project-based web development tools and very feature-rich interfaces, but sometimes all you really need is a good text editor. For those times, there are few editors that can stand up to the KDE powerhouse called Kate.

Kate is a multi-document interface (MDI) text editor, available for both KDE 3 and 4. It runs on multiple Linux and Unix-like platforms, Mac OS X, and  Windows. It also includes a component called KatePart, which runs inside numerous other KDE applications, including Quanta+ (on KDE 3 only), KWrite, Konqueror, and Kdevelop. Kate provides syntax highlighting for over 120 text formats, making it perfect for whatever programming language you choose.

HTML Editing

kate-php

Kate will highlight HTML markup and underline errors, particularly when you forget to close a tag.  It will also group text within tags, so that you can see what content is where. It will display folding markers, small arrows on the side, that you can use to collapse or expand a tag and its contents. To toggle folding markers, press F9. For that reason, if you are coding in XHTML, make sure to use the XML highlighting rather than HTML.  It will then appropriately mark single tags that are not closed with arrows.

Kate folding markers

To enable XML highlighting:

1. Click Tools in the main menu
2. Navigate to “Highlighting”, “Markup”, and finally to “XML”.

You can also do the same for PHP and other web scripting languages. Kate will generally highlight all of these, so you can usually leave the settings at the default.

Kate includes a dynamic word wrap feature, useful for documents with large amounts of text. Toggle it on or off with F10. Press F11 to toggle line numbers, and you will notice that a wrapped line has symbols indicating that it is still part of the previous line.

Multiple Documents

With Kate, you can edit multiple documents at once. The left-hand column will display the list of currently opened files, and you can move through them by clicking on the file you want to edit, by clicking the forward or back buttons, or by holding the Alt key and pressing the left or right arrow. Control+S will save your current document, and Control+L will save all open documents.

Sessions

Kate has a handy feature called “Sessions” that allows you to pick up work right where you left off the last time you were editing. For example, you might have eight documents for a particular project. Rather than having to open each document one at a time every time you want to work on them, you can save a Kate session that will automatically open those documents when activated. To save a session:

1. Click Sessions
2. Click Save As…
3. Give your session a name.

Kate session chooser

The next time you want to return to that project, just open the session you saved.

Remote Editing

There are times when you need to edit a document quickly right on the server. While you could SSH into the server and use whatever text editor is available from the command line, you will miss some of the many benefits of Kate. Furthermore, if you have a shared hosting account, you might not even have access to SSH.  With Kate, you can open a document live on the server via FTP, SFTP, and any other protocol supported by KDE. To accomplish this, do the following:

1. Login to your web server using the normal method. You can use Dolphin or Konqueror.
2. Navigate to the folder containing the file you want to edit.
3. Right click on the file and open it with Kate.
4. Repeat those steps for multiple files if necessary.

Find

Kate’s find feature is very useful with long documents. To activate it, press Control-F. It will open a dialog at the bottom of the window. You can find each instance individually and scroll through the results with the “Next” and “Previous” buttons, or click “Options” and “Highlight all” to see all results highlighted at once.

Click the arrow on the far right to expand the find dialog further, and it will add a “replace” feature. With it you can find a tag or piece of content and replace every instance of it with something else or nothing at all.  Kate will also remember your searches so that you can perform them again by pressing the down arrow on the right side of the search box.

I have only touched the surface of the many features available in Kate. The best way to find out exactly what Kate can offer you is to try it out for yourself. I highly recommend it, not only for KDE users, but for anyone. Kate is available through any Linux distribution that offers KDE.

11 comments

  1. Nice one Tavis! I personally use Kate for Python coding and love it. Fully featured without being overly bloated.

  2. Tavis,

    I love it when a plan comes together…IT skills is very noteworthy for a blk man such as yourself…I see a bright bright future ahead of you! Keep it up!

  3. According to the FAQ, Kate does not run on Windows. They do make mention that it might – might! – run under CygWin. They hope to make v4.0 available for Windows, but no time frame is mentioned. Oh, yeah … there is no readily discernible download link for Kate.

  4. A little bit misinformed, because you can open remote files directly from inside Kate, using the same protocols you listed. Just go to open file, and use the correct protocol (sftp, fish, ftp, smb, etc).

    There are obviously a lot of better (or more suit choices). But the author tried to enphasize (i think) a general text editor that gets the job done. Not comparing with KDE3 Quanta, or bluefish, or kompozer, or many others full-featured web IDEs.

  5. Quanta Plus is a very full-featured web editor based in Kate. It offers the many advantages of Kate, while adding numerous web-development specific features.

    Additionally, Kdevelop offers multi-language programming with Kate at its core. Again, many features, such as language reference materials, are added to the basic Kate framework to provide a more capable and efficient development environment.

  6. I’ve recently abandoned GUI-based web editing apps on Linux because they all fall down in some way, though there is at least hope for the future with KompoZer and Amaya. For the last few weeks I’ve begun using Kate extensively because it’s just so nice to use and so intuitive, even if it’s not specifically an HTML editing-oriented program.

    A couple of additional things I find very convenient: go to Settings -> Configure Kate -> Plugins and tick the File System Browser, which will install in your left pane. You can then right-click its tab on the edge of the screen, and ‘Make Persistent’, so you can have both the file system browser and document list sharing the pane.

    The other thing I find nifty is the Kate widget you can install on KDE4, which you can drag to the panel as well as the desktop, and when clicked provides a pop-up of all your sessions for instant launch.

    Along with Dolphin, Okular and Gwenview, it’s one of the shining examples of KDE4 software that is so well thought through. Credit to the developers.

  7. Try krusader, the dual-pane file manager, and it’s built-in mdi editor. Works well for me.

  8. If I was using KDE or XFCE I would but I tend to be very happy with gedit (or, more frequently, vim). *shrugs* But thanks for the feature…I’d forgotten a bit about Kate (and most other things in /usr/bin that start with k ;-).)


    Brie

Comments are closed.

Sponsored Stories