Include sample conf files
This commit is contained in:
parent
3983953e72
commit
7b1449ba46
29
docs/conf.py
29
docs/conf.py
@ -70,8 +70,10 @@ language = None
|
|||||||
# List of patterns, relative to source directory, that match files and
|
# List of patterns, relative to source directory, that match files and
|
||||||
# directories to ignore when looking for source files.
|
# directories to ignore when looking for source files.
|
||||||
# This pattern also affects html_static_path and html_extra_path .
|
# This pattern also affects html_static_path and html_extra_path .
|
||||||
exclude_patterns = ['_build', 'Thumbs.db',
|
exclude_patterns = [
|
||||||
'.DS_Store', 'generated/cli-*', 'generated/conf-*']
|
'_build', 'Thumbs.db', '.DS_Store',
|
||||||
|
'generated/cli-*.rst', 'generated/conf-*.rst'
|
||||||
|
]
|
||||||
|
|
||||||
# The name of the Pygments (syntax highlighting) style to use.
|
# The name of the Pygments (syntax highlighting) style to use.
|
||||||
pygments_style = 'sphinx'
|
pygments_style = 'sphinx'
|
||||||
@ -300,6 +302,8 @@ class ConfLexer(RegexLexer):
|
|||||||
tokens = {
|
tokens = {
|
||||||
'root': [
|
'root': [
|
||||||
(r'#.*?$', Comment.Single),
|
(r'#.*?$', Comment.Single),
|
||||||
|
(r'\s+$', Whitespace),
|
||||||
|
(r'\s+', Whitespace),
|
||||||
(r'(include)(\s+)(.+?)$', bygroups(Comment.Preproc, Whitespace, Name.Namespace)),
|
(r'(include)(\s+)(.+?)$', bygroups(Comment.Preproc, Whitespace, Name.Namespace)),
|
||||||
(r'(map)(\s+)(\S+)(\s+)', bygroups(
|
(r'(map)(\s+)(\S+)(\s+)', bygroups(
|
||||||
Keyword.Declaration, Whitespace, String, Whitespace), 'action'),
|
Keyword.Declaration, Whitespace, String, Whitespace), 'action'),
|
||||||
@ -522,18 +526,27 @@ def write_conf_docs(app, all_kitten_names):
|
|||||||
sc_role.warn_dangling = True
|
sc_role.warn_dangling = True
|
||||||
sc_role.process_link = process_shortcut_link
|
sc_role.process_link = process_shortcut_link
|
||||||
|
|
||||||
from kitty.config_data import all_options
|
def generate(all_options, name='kitty'):
|
||||||
with open('generated/conf-kitty.rst', 'w', encoding='utf-8') as f:
|
from kitty.conf.definition import as_conf_file
|
||||||
|
from textwrap import indent
|
||||||
|
with open(f'generated/conf-{name}.rst', 'w', encoding='utf-8') as f:
|
||||||
print('.. highlight:: conf\n', file=f)
|
print('.. highlight:: conf\n', file=f)
|
||||||
f.write(render_conf('kitty', all_options.values()))
|
f.write(render_conf(name, all_options.values()))
|
||||||
|
|
||||||
|
with open(f'generated/conf-{name}-literal.rst', 'w', encoding='utf-8') as f:
|
||||||
|
print('.. code-block:: conf\n', file=f)
|
||||||
|
text = '\n'.join(as_conf_file(all_options.values()))
|
||||||
|
text = indent(text, ' ', lambda l: True)
|
||||||
|
print(text, file=f)
|
||||||
|
|
||||||
|
from kitty.config_data import all_options
|
||||||
|
generate(all_options)
|
||||||
|
|
||||||
from kittens.runner import get_kitten_conf_docs
|
from kittens.runner import get_kitten_conf_docs
|
||||||
for kitten in all_kitten_names:
|
for kitten in all_kitten_names:
|
||||||
all_options = get_kitten_conf_docs(kitten)
|
all_options = get_kitten_conf_docs(kitten)
|
||||||
if all_options:
|
if all_options:
|
||||||
with open(f'generated/conf-kitten-{kitten}.rst', 'w', encoding='utf-8') as f:
|
generate(all_options, f'kitten-{kitten}')
|
||||||
print('.. highlight:: conf\n', file=f)
|
|
||||||
f.write(render_conf(kitten, all_options.values()))
|
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -30,3 +30,11 @@ expanded, so :code:`${USER}.conf` becomes :file:`name.conf` if
|
|||||||
|
|
||||||
|
|
||||||
.. include:: /generated/conf-kitty.rst
|
.. include:: /generated/conf-kitty.rst
|
||||||
|
|
||||||
|
|
||||||
|
Sample kitty.conf
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
Below is a sample :file:`kitty.conf` with all default settings.
|
||||||
|
|
||||||
|
.. include:: /generated/conf-kitty-literal.rst
|
||||||
|
|||||||
@ -140,3 +140,11 @@ of code needed (the entire implementation is under 2000 lines of code).
|
|||||||
|
|
||||||
And fundamentally, it's kitty only because I wrote it for myself, and I am
|
And fundamentally, it's kitty only because I wrote it for myself, and I am
|
||||||
highly unlikely to use any other terminals :)
|
highly unlikely to use any other terminals :)
|
||||||
|
|
||||||
|
|
||||||
|
Sample diff.conf
|
||||||
|
-----------------
|
||||||
|
|
||||||
|
Below is a sample :file:`diff.conf` with all default settings.
|
||||||
|
|
||||||
|
.. include:: /generated/conf-kitten-diff-literal.rst
|
||||||
|
|||||||
@ -636,7 +636,7 @@ probably better off just hiding the titlebar with :opt:`macos_hide_titlebar`.
|
|||||||
'''))
|
'''))
|
||||||
|
|
||||||
o('macos_hide_titlebar', False, long_text=_('''
|
o('macos_hide_titlebar', False, long_text=_('''
|
||||||
# Hide the kitty window's title bar on macOS.'''))
|
Hide the kitty window's title bar on macOS.'''))
|
||||||
|
|
||||||
o('macos_option_as_alt', True, long_text=_('''
|
o('macos_option_as_alt', True, long_text=_('''
|
||||||
Use the option key as an alt key. With this set to no, kitty will use
|
Use the option key as an alt key. With this set to no, kitty will use
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user