Tree View plugin introduction

Kate has been my favorite editor for some time now. And only recently has it not been able to do something I asked it do to. I was working on a rather large project in Perl when things started getting confusing. The classic file list had 50+ files in it, some of them have the same file name, so would have (1) or (2) or even (4) after the file name, and while thats handy, it gets confusing pretty quickly.

So I spent a week to try and bring order to the chaos. And this is what I came up with.

Now I can tell people are thinking, but Thomas, that doesn’t look so confusing.. Granted.

Here’s what my larger project looks like with the file list:

I think anyone will have a hard time working with that unholy mess. After trying to manage that for more than a couple of days I sat down and decided to write the tree plugin. Heres what the mess looks like now:

Is that not a lot better?

Some of you reading this might have noticed that it isn’t creating a full file system tree. That is it isn’t making “/” or “C:\” the root of the tree. Indeed. It uses a couple tricks to make sure the tree isn’t cluttered with directories you really don’t care about. If people are interested I can explain more about how it does what it does in a more technical post.

I’ve heard a few people ask if this shouldn’t just outright replace the existing file list. The Kate developers don’t see why not, but I have my doubts that it is a proper “one size fits all” solution. As far as I can tell, it is impossible to make the tree behave in a fully sane and expected manner. In some cases it won’t merge some folders you think it should, but (IMO) trying to make the tree behave any “better” would make it less useful (at least to me). I’m interested in what people think, is it “good enough” to become the default document list, or even replace the existing one outright?

I’ve committed the plugin to KDE svn, and just uploaded to kde-apps if anyone is interested in giving it a try. I’ve tested it with Kate/KDE 4.4, 4.5, and Kate from trunk. Please let me know what you think, and tell me if you have any problems or concerns! Thanks :)

p.s. I’m new to this whole blogging thing, please be gentle ;)

18 thoughts on “Tree View plugin introduction

  1. It’s a great feature then. Thanks.. But I guess the old ‘plain’ style might also be desirable in some cases. For example, if I have single files from different directories opened in the editor, having them listed in a tree might not be very convenient. I’d like to see both types of navigation panes to be available.
    Thanks again for the good work..

  2. This is great, as now I have to use the filesystem view and use the tree view on the main folder of my proyect, add filters to remove ~, pyc, … files and be carefull not to click on any folder because the view will change to that one and lost all the opened folders I had.

    Great contribution!

  3. oh great great ! I already love it :)
    But it could be better to be conservative and keep the two options (two different plugins ? or check option in the contextual menu ?)

    What would be ├╝ber great would be to have the Document Tree area horizontally splitted with at the top a “favorite” area”, where I could drag some files one use very often (CSS file in a web projet, a TODO/FIXME file…). Maybe they could be simply marked as favorite by right-clicking on them so that the favorite area can be automatically hidden if there are no favorite ?
    With this, one can keep the old feature where one can manually sort the tree to keep important files at the top for example.

    Btw, is it possible to only compile the plugin without compiling Kate from trunk (I’d like to keep it stable at work) ?

    Oh, and thanks for your work, really useful :)

    1. Yeah, it works with kate from 4.4, and 4.5. I’ve tested both. But its a bit of a pain to build since kate doesn’t distribute headers, you have to grab 4.4 or 4.5 kdesdk from svn build that, then the plugin.

      Have to think about that favorite area thing a bit though.

  4. Hi, I’m using Tree View in kate from git, it’s a very nice and useful (I’ve often more than 30 doc open), but there is one thing I do really miss, the possibility to navigate between fopened files in a coherent manner, at the moment using Alt+{left,right}-arrow just don’t get you where you think it would get you.

    The really nice way to do it would be to have a two way, _configurable_ mode to navigate:
    – Most Recently Used, doc is the first to be changed to
    – Follow the graphical rappresentation, possibly jumping “closed” folders, where left-arrow move you up and right arrow move you down, in the exact order the tree is drawed.

    1. Yeah, the back/forward actions are tied to the file list, and not the tree. Which is not something I can do anything about. Most I can do is just add a new set of actions for back/forward for the plugin, or as a couple people have suggested, just replace the file list and its actions with the tree plugin and give it the file tree’s actions.

      I kind of like the idea of having a key short cut to switch to the first, or next “most recently used” file. That could be pretty handy, and since I added the item coloring, I can support that (it keeps a list of the last 10 edited, and viewed documents)

  5. This looks like a neat feature. I get confused sometimes with a lot of files open too. But I don’t think it should be the default. The simple list right now works great for quick access to 3-20 files. Having them in a tree would just be extra clutter and potentially extra clicks.

  6. just another +1 from me as this is one of the things that would make kate more useful to me. i can’t see the downside of it, either. with vim keyboarding, scripting, and this kind of UI, i might just be headed away from vim finally! :)

  7. I love it! Thanks a lot!
    A week ago I have been asking a friend of mine who is a kate power user if there is a way to separate files with the same name in one project.
    He didn’t have a real answer since that feature didn’t exist. And here you are blogging about it ;)
    Great news, I can’t wait to use it!

  8. Um… can I file a feature request? It would be nice to have an option “Create new file” in context menu after right-clicking on a folder item. I’m used to that from KDevelop and it comes quite handy. Generally speaking, there could be all the options from KDevelop Project View (rename, delete…), maybe code reuse?

    Then there could be also “switch” button, which displays all files in the subtree, not only the opened – for easy opening of another files. Or maybe I want too much :-)

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top