Software > Text editors >
(on Wikipedia)
https://kate-editor.org/
An excellent text editor on KDE.
kedit
-
See also KWrite
- At some point I switched to Geany, probably because I abandoned KDE.
- (date unknown) - 2.5.9 (using KDE 3.5.9)
- (date unknown) - 2.5.6 (using KDE 3.5.6)
- (date unknown) - 2.5.2 (using KDE 3.5.2)
- (date unknown) - (version unknown)
-
Earlier than 2005-10-16 - it was my editor of choice.
Thoughts ∞
It's easily modified.
I love the code folding. I can rig it to easily launch scripts.
Its features are used with KWrite as well.
-
I name my scripts with the proper extension so that Kate will do highliting and code folding without my having to select things manually. It would be nice if kate would read some one-liner from within the file to determine this sort of thing, or if it were otherwise more configurable to default to a scripting language or switch all loaded scripts to a certain language.
-
If the external command doesn't work, open up a second file and run it there. Then close it and you can run it on the first. Odd bug. =/
(date unknown) - 2.5.9 (using KDE 3.5.9) ∞
-
I couldn't add any external tool entries.
(date unknown) - 2.5.6 (using KDE 3.5.6) ∞
- bug 33857, bug 80865 - Automated spellchecking
-
--title
and--name
don't seem to do anything.-s
would be nice, except it has all sorts of baggage. Bilbo Baggage.
(date unknown) - 2.5.2 (using KDE 3.5.2) ∞
- When I have a session open which has a bunch of files, and I overwrite the files via something like rsync, kate will notice that the files have changed on disk. Bravo, except there is no functionality to "reload all".
-
Needs to have a "rename this file" and "delete this file" functionality. EditPad worked wonders for this sort of functionality.
For some stupid reason 'activate next tab' and 'activate previous tab' aren't associated with going back and forth to different documents. For that, it's 'back' and 'forward'. How lame is that?! bug 111282
(date unknown) - (version unknown) ∞
Has Ruby syntax highlighting.
-
ruby-kate seems to have vanished. =/
- https://web.archive.org/web/20121118235742/http://raa.ruby-lang.org/project/ruby-kate/
- https://web.archive.org/web/20050305092709/http://rsite.enesbe.com.au/
- web.archive.org/web/*/http://www.enesbe.com.au/download/other/ruby.xml.gz
kruby plugin
fails with:
checking for X... configure: error: Can't find X includes. Please check your installation and add the correct paths!
(x11-devel
is installed. sigh) This was probably on PCLinuxOS 2007, and it can be re-tested..
External tools ∞
Rename %filename
to %selection
∞
cd %directory mv %filename %selection
- todo - When renaming, use a dialog app to let a person type in another filename in some nice way. Ask for help or search lots more, since I've had some serious issues with this before.
- todo - I don't know how to make kate close the present file. Ask for help.
-
todo - I don't know how to make kate open the new file. Ask for help.
2007-07-18 - Syntax highlighting ∞
was https://docs.kde.org/stable5/en/applications/katepart/highlight.html [ 1 ] was https://web.archive.org/web/20071110044520/http://docs.kde.org:80/stable/en/kdebase/kate/katehighlight-system.html
- extend the ruby highlighting to support my own tags, to intelligently colour blocks of comments.
-
create my own textfile highlighting syntax
- define it as a default syntax
HAHAHA.. no fucking way
- XML file
- regular expression rules
- keywords
-
...
$KDEDIR/share/apps/katepart/syntax ./share/apps/katexmltools/language.dtd.xml ./share/apps/katepart/syntax/language.dtd
2005-10-16 - Kate and ruby ∞
Run %filename
as a script ∞
Settings > Configure Kate > External Tools > New
- Label: Run Ruby Script
-
Script:
cd "%directory" && chmod u+x "%filename" && xterm -exec "./%filename"
- Executable: ruby
- Mime types:
<blank>
- Save: Current Document
-
Command line name: runscript
Settings > Configure Shortcuts
- Under "External Tools" you will see "Run Ruby Script".
-
Edit it and add a hotkey. I use
F12
.
- Notes:
Instead of plain old xterm, I refer to a script to set the window size and other preferences. You could edit this commandline to set your xterm preferences, or point Kate to a script to launch xterm.
See xterm for my preferences.
-
todo - update this as one generic 'run this file' script which detects the filetype or maybe just blindly runs the file - since it should have #!/usr/bin/ruby as the first line..
mime type: application/x-ruby
cd "%directory" && chmod u+x "%filename" && konsole -e ruby ~/working/rb/programming/libraries/pause.rb "./%filename"
2006-04-14 - Passing arguments to the script you're editing ∞
I like to use a proper editor while goofing around with scripts, but I hate having to switch to a console to try things out. It's too many keys to bother with. So I figured out how to pop open a console and run the file I'm editing. It's simple enough to do, but when errors creep into my code the console will not stay open properly nomatter what I do. Now the trick is to use ensure
to force a pause.
Unfortunately, this means that I'd have to have a block of code in every script I ever work on. This isn't right, and so when persuing this I was told to write a wrapper for my ruby scripts. I tried this and I couldn't figure anything out. I finally learned a little bit more and a little bit more, while working on other things, and today I managed to get everything working just the way I wanted. The Ruby pause wrapper is tested and works.
I also figured out how to ensure a pause using gets when the script was called with arguments. It's a simple trick, and I was annoyed to discover that gets works the way it does, but at least I solved my problem.
It was an easy solution to pass arguments when launching the script. I juse use kate's %selection
ability and pass it raw. It's a somewhat ugly solution but it works well enough for me.
So if your script is this:
puts "hello world" puts ARGV
You can add a line with comments:
# My arguments puts "hello world" puts ARGV
When highlight the text you want, and press F12
to run your script with your highlighted text as arguments.
# My arguments puts "hello world" puts ARGV
produces
hello world My arguments
Remember to put a comment ( #
) before your text, because your script is saved before it is launched.
Catching output ∞
If your script has an error in it, the console window will close without you having a chance to see it. In this case, either pop open a console (or use Kate's inline console) and run your script, or try one of two solutions.
Nothing here allows you to run a ruby script with parameters. I have not begun working on this problem.
a simple wrapper ∞
Instead of this:
-
Script:
cd "%directory" && xterm -exec ruby "./%filename" %selection
do this:
-
Script:
cd "%directory" && xterm -exec ruby ~/scripts/ruby-pause_wrapper.rb "./%filename" %selection
See Ruby pause wrapper for how to set up ~/scripts/ruby-pause_wrapper.rb
.
rescue ∞
begin # Everything in here can have its errors caught. puts "hello world" this_errors rescue => my_error_message puts my_error_message else # no errors ensure puts "<PAUSED>" pause=gets end
-
for reasons I don't understand, command line arguments completely mess this up. It's not a very important problem to solve right now.
forgetting end ∞
If you get this mess, then you forgot to put "end" somewhere. There is no clue as to where this could be.
desc.rb:58: parse error, unexpected kRESCUE, expecting kEND desc.rb:63: parse error, unexpected kENSURE, expecting kEND desc.rb:70: parse error, unexpected $, expecting kEND
sleep ∞
Instead of this:
-
Script:
cd "%directory" && xterm -exec ruby "./%filename" %selection
do this:
-
Script:
cd "%directory" && xterm -exec ~/scripts/ruby.sh "./%filename" %selection
Then you can make the ~/scripts/ruby.sh
file like this:
/usr/bin/ruby $@ sleep 3
-
I don't see a way to put a
sleep
command within kate's scriptlet. It doesn't seem to work.
a complex wrapper ∞
Your external tool will have a commandline something like this:
cd "%directory" && ~/scripts/xterm -e ruby -w ~/scripts/ruby-pause_wrapper.rb "./%filename" %selection
The ruby-pause_wrapper.rb script ensures a pause at the end of your script.
ruby -w
is to enable warnings.
Footnotes
Last updated 2021-04-25 at 21:59:33
I dropped in some random notes.
ported
ported syntax highlighting into this same article
ported the complete ruby notes from 2005-10-16