Kitty: `edit_config_file` in new tab/window instead of `new_os_window` ?

Created on 15 Oct 2019  路  8Comments  路  Source: kovidgoyal/kitty

Is it possible to open edit_config_file in a new tab/window instead of a new_os_window ?

Most helpful comment

Well with my latests commit, all you need is:

kitty +edit-config

All 8 comments

No, but feel free to define your own keyboard shortcut to do that, with

map whatever new_tab kitty +runpy "from kitty.config import *; p = prepare_config_file_for_editing(); import os; os.execvp(get_editor(), [p])"

or similar

Since I looked into this too there's also a (maybe) easier way to achieve it exploiting launch and --type and paying the "price" of specifying an editor and the full config path:

Open on a new kitty window:
map whatever launch --type=window vim ~/.config/kitty/kitty.conf
Open on a new kitty tab:
map whatever launch --type=tab vim ~/.config/kitty/kitty.conf
Open on a new kitty overlay:
map whatever launch --type=overlay vim ~/.config/kitty/kitty.conf

Replace the vim invocation above with

kitty +runpy "from kitty.config import *; p = prepare_config_file_for_editing(); import os; os.execvp(get_editor(), [p])"

and you dont need to pay any price at all.

Replace the vim invocation above with

kitty +runpy "from kitty.config import *; p = prepare_config_file_for_editing(); import os; os.execvp(get_editor(), [p])"

and you dont need to pay any price at all.

That line fixed would do the job. I find it a bit more elaborate but thanks!

map whatever launch --type=overlay kitty +runpy "from kitty.config import *; from kitty.utils import *; p = prepare_config_file_for_editing(); import os; os.execvp(get_editor()[0], [get_editor()[0], p])"

Well with my latests commit, all you need is:

kitty +edit-config

That's seem much more usable :+1: Too bad I want it pack managed but I'm on Ubuntu Focal which is still at 0.15.0 for some reason. @jamessan any chance you'll be releasing a newer version?

I keep Debian Sid pretty up to date, but once an actual stable release is made for Debian/Ubuntu, packages don't get updated without good reason. If that's not what you want, then you should run Sid. Otherwise, you're definitely going to be out of date to varying degrees (less if you're not stuck to an LTS release) unless someone starts maintaining a PPA.

I'd like to keep on the LTS for the moment. From what I've seen the most recent PPA is stuck at 0.17. I'll just clone the repo and manage the binaries manually, occasionally auto-pulling the updates with some script like the oh-my-zsh fashion. Sorry for the little OT anyway.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Nudin picture Nudin  路  3Comments

RedBeard0531 picture RedBeard0531  路  4Comments

bewzaalex picture bewzaalex  路  3Comments

jasminabasurita picture jasminabasurita  路  3Comments

keyofnight picture keyofnight  路  3Comments