mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-22 16:28:19 +02:00
Update in response to feedback
- one configuration option: ignore_paths - use shlex to parse option to support whitespace and in-line comments - change option type to Tuple[str, ...] - remove ignored directories from dirnames to prevent scanning
This commit is contained in:
@@ -48,14 +48,11 @@ opt('replace_tab_by', '\\x20\\x20\\x20\\x20',
|
||||
long_text='The string to replace tabs with. Default is to use four spaces.'
|
||||
)
|
||||
|
||||
opt('file_ignores', '',
|
||||
option_type='pattern_list',
|
||||
long_text='List of file patterns that are ignored when directories are compared'
|
||||
)
|
||||
|
||||
opt('ignore_paths', '',
|
||||
option_type='pattern_list',
|
||||
long_text='List of directory patterns that are ignored when directories are compared'
|
||||
long_text='''List of patterns that are matched against directory and file
|
||||
names and ignored when directories are compared.
|
||||
''',
|
||||
)
|
||||
|
||||
egr() # }}}
|
||||
|
||||
5
kittens/diff/options/parse.py
generated
5
kittens/diff/options/parse.py
generated
@@ -86,10 +86,7 @@ class Parser:
|
||||
for k in parse_map(val):
|
||||
ans['map'].append(k)
|
||||
|
||||
def file_ignores(self, val: str, ans: typing.Dict[str, typing.List[str]]):
|
||||
ans['file_ignores'] = pattern_list(val)
|
||||
|
||||
def ignore_paths(self, val: str, ans: typing.Dict[str, typing.List[str]]):
|
||||
def ignore_paths(self, val: str, ans: typing.Dict[str, typing.Any]):
|
||||
ans['ignore_paths'] = pattern_list(val)
|
||||
|
||||
|
||||
|
||||
4
kittens/diff/options/types.py
generated
4
kittens/diff/options/types.py
generated
@@ -14,7 +14,6 @@ option_names = ( # {{{
|
||||
'added_margin_bg',
|
||||
'background',
|
||||
'diff_cmd',
|
||||
'file_ignores',
|
||||
'filler_bg',
|
||||
'foreground',
|
||||
'highlight_added_bg',
|
||||
@@ -45,14 +44,13 @@ class Options:
|
||||
added_margin_bg: Color = Color(205, 255, 216)
|
||||
background: Color = Color(255, 255, 255)
|
||||
diff_cmd: str = 'auto'
|
||||
file_ignores: typing.List[str] = ['']
|
||||
filler_bg: Color = Color(250, 251, 252)
|
||||
foreground: Color = Color(0, 0, 0)
|
||||
highlight_added_bg: Color = Color(172, 242, 189)
|
||||
highlight_removed_bg: Color = Color(253, 184, 192)
|
||||
hunk_bg: Color = Color(241, 248, 255)
|
||||
hunk_margin_bg: Color = Color(219, 237, 255)
|
||||
ignore_paths: typing.List[str] = ['']
|
||||
ignore_paths: typing.Tuple[str, ...] = ()
|
||||
margin_bg: Color = Color(250, 251, 252)
|
||||
margin_fg: Color = Color(170, 170, 170)
|
||||
margin_filler_bg: typing.Optional[kitty.fast_data_types.Color] = None
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
# License: GPLv3 Copyright: 2021, Kovid Goyal <kovid at kovidgoyal.net>
|
||||
|
||||
|
||||
import shlex
|
||||
from typing import Any, Dict, Iterable, List, Tuple, Union
|
||||
|
||||
from kitty.conf.utils import (
|
||||
@@ -58,8 +59,8 @@ def syntax_aliases(raw: str) -> Dict[str, str]:
|
||||
return ans
|
||||
|
||||
|
||||
def pattern_list(raw: str) -> List[str]:
|
||||
return raw.split(' ')
|
||||
def pattern_list(raw: str) -> Tuple[str, ...]:
|
||||
return tuple(shlex.split(raw, comments=True))
|
||||
|
||||
|
||||
def parse_map(val: str) -> Iterable[KittensKeyDefinition]:
|
||||
|
||||
Reference in New Issue
Block a user