Kate: Default folder

Is there a way to define default folder different from /home/user?
Thank you!

What do you mean by default folder? The default selection in the file browser after clicking Open Folder... ?

Hmm, I start Kate with a new document, type some stuff. Now I want to save it and Kate proposes /home/user as location. I want it (in all cases) in /mnt/Data/ …
This definition (if possible) for me also would be perfect for Open Folder ...

Not sure this would be a good setting but you can do either of the following to make it easy to save into that folder:

  1. Add your /mnt/Data/… location to your Dolphin sidebar as a shortcut and that will show in the Save As dialog
  2. Add a symlink to /mnt/Data/… in your home folder and use that to easily access the folder.

Thank you:

I have this and can manage it. But it’s a pain, to do this for each new file of mine, and I create about more than five per day. Not even on will land up in /home/username …
So I’d like to propose an enhancement for the Settings > KATE settings > Open/Save Files.

I’ve tried a couple and just can’t get it right. I’d say the only option is to create an external tool with a toolbar entry. But no matter what I’ve tried, I just can’t seem to get it to work with, for example, kdialog --getsavefilename /whatever/path. I’m sure there are other options, but in case of this kdialog, which by no means is “click-key-to-save” edit, it just won’t work. It would be a whole lot easier if kate had a save-command, which it doesn’t.

1 Like

I gave this a try. I created a desktop entry like: cd /whatever/path/ && kate -s ‘’
This will always open the chosen directory when you hit the save button in Kate.

1 Like

Thanks a lot for your effort! The main thing is:

May be we could put it on the wish list?

That’s a good idea. The bad thing: My user-defined directory would be /mnt/Data but this is a starting for sub-selections like /mnt/Data/work, /mnt/Data/sport, /mnt/Data/hobby. So, having your solution I need two steps:

  1. Save the file to /mnt/Data/
  2. Move that file to /mnt/Data/...

I prefer the wish list …

Well um…

Just an idea. Just keep in mind the particular kate command. You might wanna try different commands, dunno ( run kate --help-all for more info or something). Like I said, just something I quickly put together. As a sidenote, you can make a similar dolphin servicemenu if you like. But again, check if maybe there’s a better way, better commands to do it. I dunno. Personally I simply use the default file picker dialog for the few times I use Kate.

I almost always run Kate from Konsole. I use an alias:

alias kate="setsid /usr/bin/kate >/dev/null 2>&1"

So, for me, the current working directory is the one that shows up in Kate’s file dialogs.

1 Like

Yep. Kate’s file picker location depends on the directory it was started in in the first place. By default it’s set to ~/. CD-ing or a bash alias to a specific directory solves it.

1 Like

Great, thank you!

This is what I did:

  • Copied the starter to have an override-file (source here)
    /usr/share/applications/org.kde.kate.desktop
    /home/myname/.local/share/applications/org.kde.kate.desktop
  • Edited the copied starter ad added:
    # Override for '/usr/share/applications/org.kde.kate.desktop' to run KATE with an user-defined data-directory
    # Exec=kate -b %U # the original line, now 'cd ...' first
    Exec=cd /mnt/myDirectoryStartingPoint/ && kate -b %U
  • Started KATE by kRunner, from Konsole and it worked as expected.

Looking forward your opinions.

Kate. Aaaaaaarghrgh…I tried a couple of things and there seems to be going on some weirdness with kate.

  1. The cd-to-directory works just fine. However, it doesn’t if you use it in a desktop application. I tried several commands for the submenus…nogo. Which is weird, cause the commands work just fine if you launch them from a kate-terminal. It’s a first timer for me, never happened before and I couldn’t find anything on why this is happening. So, as far as launching Kate with a given directory as a desktop application works for one, but does nothing if you want a second kate window/tab in a DIFFERENT directory. You can open as many windows you like cd ~/wherever && kate -b %U all you want, NOT with another directory. PS: you can’t add any - if you want it to open in tabs, which is also weird. I could only open a new tab if the command was launched from the kate terminal.
  2. So I tried it with a dolphin servicemenu. That one works fine. No tabs though, only separate windows.
  3. I also tried to launch Kate with several directory tabs. But apparently, unlike, say, konsole, it doesn’t support it.

I deleted the screenshots cause of hypothetical violations to this…forum and I don’t feel like blurring every single screenshot I post.