Kitty: Common configuration file for OSX and Linux with Platform Conditioning

Created on 22 Jun 2020  路  8Comments  路  Source: kovidgoyal/kitty

Is your feature request related to a problem? Please describe.
Is there anyway to condition lines in the configuration file based on the platform?
I prefer to have

Describe the solution you'd like

on osx
map cmd+c copy_to_clipboard
map cmv+v paste_from_clipboard

and

on linux
map ctrl+c copy_to_clipboard
map ctrl+v paste_from_clipboard
enhancement

All 8 comments

The include directive accepts environemnt variables.

@kovidgoyal I tried ${USER}.conf and it seems to work fine.

However, when I tried ${OSTYPE}, ${OSTYPE:0:6}, or $(uname), nothing works. The include file didn't load.

uname is not an environment variable. And presumably OSTYPE is not set
in whatever environment you are launching kitty from.

True. I checked and it seems ${OSTYPE} is not environment variable.
I guess I have to go around the bush, like using ${HOSTNAME} or something like that.

Thank you for your immediate reply.

Also see #811.

In the end, I used this solution to solve the issue with softlink on each machine.

In my humble opinion, since this is designed as cross-platform, it could be nice if it support this automatically without user intervention.

If you have ideas on how to incorporate this, I could help to dig around when I have time and make a PR.
I searched a bit and it seem ${OSTYPE}, or ${HOME} is not considered environment variable that python can read.

On Wed, Jun 24, 2020 at 01:47:13AM -0700, pvmilk wrote:

In the end, I used this solution to solve the issue with linked list on each machine.

In my humble opinion, since this is designed as cross-platform, it could be nice if it support this automatically without user intervention.

This has nothing to do with cross-platform support. You could in general
want to specialize configuration based on various environmental
considerations. Different hosts, different settings, etc. Supporting
inclusion of config via environment variables is the most general
solution for this, short of allow arbitrary code/shelling out.

Oh and if for some reason you want to nly distinguish between macos and linux and nothing else, use https://sw.kovidgoyal.net/kitty/faq.html#how-do-i-specify-command-line-options-for-kitty-on-macos to specify things that will only apply to macOS with the -o command line flag.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

wavexx picture wavexx  路  3Comments

keyofnight picture keyofnight  路  3Comments

Nudin picture Nudin  路  3Comments

crocket picture crocket  路  4Comments

jasminabasurita picture jasminabasurita  路  3Comments