jvim 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
jvim-0.1.0/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *.egg-info/
4
+ dist/
5
+ build/
6
+ .eggs/
7
+ *.egg
8
+ .venv/
9
+ .env
10
+ .pytest_cache/
11
+ .mypy_cache/
12
+ .ruff_cache/
jvim-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,193 @@
1
+ Metadata-Version: 2.4
2
+ Name: jvim
3
+ Version: 0.1.0
4
+ Summary: A modal JSON editor built with Textual, featuring vim-style keybindings
5
+ Project-URL: Homepage, https://github.com/k2hyun/jets
6
+ Project-URL: Repository, https://github.com/k2hyun/jets
7
+ Project-URL: Issues, https://github.com/k2hyun/jets/issues
8
+ Author-email: Kihyun Kim <k2hyun@gmail.com>
9
+ License-Expression: MIT
10
+ Keywords: cli,editor,json,jsonl,textual,tui,vim
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Topic :: Text Editors
21
+ Classifier: Topic :: Utilities
22
+ Requires-Python: >=3.10
23
+ Requires-Dist: textual>=0.70.0
24
+ Provides-Extra: dev
25
+ Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
26
+ Requires-Dist: pytest>=8.0; extra == 'dev'
27
+ Requires-Dist: textual-dev>=1.0; extra == 'dev'
28
+ Description-Content-Type: text/markdown
29
+
30
+ # jets
31
+
32
+ **J**SON **E**ditor in **T**extual with vim-**S**tyle keybindings.
33
+
34
+ [한국어](README.kr.md)
35
+
36
+ ## Features
37
+
38
+ - **Vim-style modal editing** - Normal, Insert, Command, and Search modes
39
+ - **Syntax highlighting** - JSON-aware colorization
40
+ - **JSON validation** - Real-time validation with error reporting
41
+ - **JSONPath search** - Search using JSONPath expressions (`$.foo.bar`)
42
+ - **JSONL support** - Edit JSON Lines files with smart formatting
43
+ - **Embedded JSON editing** - Edit JSON strings within JSON with nested level support
44
+ - **Bracket matching** - Jump to matching brackets with `%`
45
+ - **Undo/Redo** - Full undo history
46
+
47
+ ## Installation
48
+
49
+ ```bash
50
+ pip install vim-json-editor
51
+ ```
52
+
53
+ ## Usage
54
+
55
+ ```bash
56
+ # Open a file
57
+ vj data.json
58
+
59
+ # Open in read-only mode
60
+ vj -R data.json
61
+
62
+ # Create new file
63
+ vj newfile.json
64
+ ```
65
+
66
+ ## JSONL Support
67
+
68
+ vj provides special handling for JSON Lines (`.jsonl`) files:
69
+
70
+ - **Pretty-printed editing**: Each JSONL record is automatically formatted with indentation for easy reading and editing
71
+ - **Compact saving**: When you save, each record is minified back to a single line, preserving the JSONL format
72
+ - **Record numbers**: A second column shows the record number (1, 2, 3...) for easy navigation
73
+ - **Floating header**: When scrolling through a multi-line record, the physical line number stays visible at the top
74
+
75
+ Example: A JSONL file with two records:
76
+ ```
77
+ {"name": "Alice", "age": 30}
78
+ {"name": "Bob", "age": 25}
79
+ ```
80
+
81
+ Opens in vj as:
82
+ ```
83
+ {
84
+ "name": "Alice",
85
+ "age": 30
86
+ }
87
+ {
88
+ "name": "Bob",
89
+ "age": 25
90
+ }
91
+ ```
92
+
93
+ And saves back to the original compact format.
94
+
95
+ ## Embedded JSON Editing
96
+
97
+ JSON files often contain escaped JSON strings as values. vj lets you edit these nested JSON structures naturally.
98
+
99
+ ### How it works
100
+
101
+ 1. Position your cursor on a line containing a JSON string value
102
+ 2. Type `ej` in normal mode
103
+ 3. A new editor panel opens with the parsed and formatted JSON
104
+ 4. Edit the embedded JSON with full syntax highlighting and validation
105
+ 5. Save with `:w` to update the parent document (minified) or `:q` to cancel
106
+
107
+ ### Nested levels
108
+
109
+ You can edit embedded JSON within embedded JSON:
110
+ - The panel title shows the current nesting level: `Edit Embedded JSON (level 1)`
111
+ - A `[+]` indicator appears when you have unsaved changes
112
+ - `:w` saves and returns to the previous level
113
+ - `:q!` discards changes and returns to the previous level
114
+
115
+ ### Example
116
+
117
+ Given this JSON:
118
+ ```json
119
+ {
120
+ "config": "{\"host\": \"localhost\", \"port\": 8080}"
121
+ }
122
+ ```
123
+
124
+ Using `ej` on the config line opens:
125
+ ```json
126
+ {
127
+ "host": "localhost",
128
+ "port": 8080
129
+ }
130
+ ```
131
+
132
+ After editing and saving, the parent is updated with the minified result.
133
+
134
+ ## Keybindings
135
+
136
+ ### Movement
137
+ | Key | Action |
138
+ |-----|--------|
139
+ | `h j k l` | Left/Down/Up/Right |
140
+ | `w b` | Word forward/backward |
141
+ | `0 $ ^` | Line start/end/first char |
142
+ | `gg G` | File start/end |
143
+ | `%` | Jump to matching bracket |
144
+ | `PgUp PgDn` | Page up/down |
145
+ | `Ctrl+d/u` | Half page down/up |
146
+
147
+ ### Search
148
+ | Key | Action |
149
+ |-----|--------|
150
+ | `/` | Search forward |
151
+ | `?` | Search backward |
152
+ | `n N` | Next/previous match |
153
+ | `$.` `$[` | JSONPath search (auto-detect) |
154
+ | `\j` | JSONPath suffix for patterns |
155
+ | `\c \C` | Case insensitive/sensitive |
156
+
157
+ ### Insert Mode
158
+ | Key | Action |
159
+ |-----|--------|
160
+ | `i I` | Insert at cursor/line start |
161
+ | `a A` | Append after cursor/line end |
162
+ | `o O` | Open line below/above |
163
+
164
+ ### Editing
165
+ | Key | Action |
166
+ |-----|--------|
167
+ | `x` | Delete char |
168
+ | `dd` | Delete line |
169
+ | `dw d$` | Delete word/to end |
170
+ | `cw cc` | Change word/line |
171
+ | `r{c}` | Replace char |
172
+ | `J` | Join lines |
173
+ | `yy p P` | Yank/paste after/before |
174
+ | `u` | Undo |
175
+ | `Ctrl+r` | Redo |
176
+ | `.` | Repeat last edit |
177
+ | `ej` | Edit embedded JSON string |
178
+
179
+ ### Commands
180
+ | Command | Action |
181
+ |---------|--------|
182
+ | `:w` | Save |
183
+ | `:w {file}` | Save as |
184
+ | `:e {file}` | Open file |
185
+ | `:fmt` | Format JSON |
186
+ | `:q` | Quit |
187
+ | `:q!` | Quit (discard changes) |
188
+ | `:wq` | Save and quit |
189
+ | `:help` | Toggle help panel |
190
+
191
+ ## License
192
+
193
+ MIT
@@ -0,0 +1,164 @@
1
+ # jets
2
+
3
+ **J**SON **E**ditor in **T**extual with vim-**S**tyle keybindings.
4
+
5
+ [Textual](https://github.com/Textualize/textual) 기반의 vim 스타일 모달 JSON 편집기입니다.
6
+
7
+ ## 주요 기능
8
+
9
+ - **Vim 스타일 모달 편집** - Normal, Insert, Command, Search 모드 지원
10
+ - **구문 강조** - JSON 문법에 맞는 색상 표시
11
+ - **JSON 검증** - 실시간 유효성 검사 및 오류 표시
12
+ - **JSONPath 검색** - JSONPath 표현식으로 검색 (`$.foo.bar`)
13
+ - **JSONL 지원** - JSON Lines 파일을 스마트하게 포맷팅하여 편집
14
+ - **내장 JSON 편집** - JSON 내 문자열로 저장된 JSON을 중첩 레벨까지 편집
15
+ - **괄호 매칭** - `%`로 짝이 맞는 괄호로 이동
16
+ - **Undo/Redo** - 전체 실행 취소 기록 지원
17
+
18
+ ## 설치
19
+
20
+ ```bash
21
+ pip install vim-json-editor
22
+ ```
23
+
24
+ ## 사용법
25
+
26
+ ```bash
27
+ # 파일 열기
28
+ vj data.json
29
+
30
+ # 읽기 전용 모드로 열기
31
+ vj -R data.json
32
+
33
+ # 새 파일 생성
34
+ vj newfile.json
35
+ ```
36
+
37
+ ## JSONL 지원
38
+
39
+ vj는 JSON Lines (`.jsonl`) 파일을 특별하게 처리합니다:
40
+
41
+ - **포맷팅된 편집**: 각 JSONL 레코드를 자동으로 들여쓰기하여 읽고 편집하기 쉽게 표시
42
+ - **압축 저장**: 저장 시 각 레코드를 한 줄로 압축하여 JSONL 형식 유지
43
+ - **레코드 번호**: 두 번째 열에 레코드 번호(1, 2, 3...)를 표시하여 쉽게 탐색
44
+ - **플로팅 헤더**: 여러 줄에 걸친 레코드를 스크롤할 때 물리적 라인 번호가 상단에 표시
45
+
46
+ 예시: 두 개의 레코드가 있는 JSONL 파일:
47
+ ```
48
+ {"name": "Alice", "age": 30}
49
+ {"name": "Bob", "age": 25}
50
+ ```
51
+
52
+ vj에서 열면:
53
+ ```
54
+ {
55
+ "name": "Alice",
56
+ "age": 30
57
+ }
58
+ {
59
+ "name": "Bob",
60
+ "age": 25
61
+ }
62
+ ```
63
+
64
+ 저장하면 원래의 압축된 형식으로 복원됩니다.
65
+
66
+ ## 내장 JSON 편집 (ej 모드)
67
+
68
+ JSON 파일에는 종종 이스케이프된 JSON 문자열이 값으로 포함됩니다. vj는 이러한 중첩된 JSON 구조를 자연스럽게 편집할 수 있게 해줍니다.
69
+
70
+ ### 사용 방법
71
+
72
+ 1. JSON 문자열 값이 있는 라인에 커서를 위치
73
+ 2. Normal 모드에서 `ej` 입력
74
+ 3. 새 편집기 패널이 열리며 파싱되고 포맷팅된 JSON 표시
75
+ 4. 구문 강조와 유효성 검사가 적용된 상태로 내장 JSON 편집
76
+ 5. `:w`로 저장하여 부모 문서에 반영(압축됨) 또는 `:q`로 취소
77
+
78
+ ### 중첩 레벨
79
+
80
+ 내장 JSON 안의 내장 JSON도 편집할 수 있습니다:
81
+ - 패널 제목에 현재 중첩 레벨 표시: `Edit Embedded JSON (level 1)`
82
+ - 저장하지 않은 변경 사항이 있으면 `[+]` 표시
83
+ - `:w`로 저장하고 이전 레벨로 복귀
84
+ - `:q!`로 변경 사항을 버리고 이전 레벨로 복귀
85
+
86
+ ### 예시
87
+
88
+ 다음과 같은 JSON이 있을 때:
89
+ ```json
90
+ {
91
+ "config": "{\"host\": \"localhost\", \"port\": 8080}"
92
+ }
93
+ ```
94
+
95
+ config 라인에서 `ej`를 사용하면:
96
+ ```json
97
+ {
98
+ "host": "localhost",
99
+ "port": 8080
100
+ }
101
+ ```
102
+
103
+ 편집 후 저장하면, 부모 문서에 압축된 결과가 반영됩니다.
104
+
105
+ ## 키 바인딩
106
+
107
+ ### 이동
108
+ | 키 | 동작 |
109
+ |-----|--------|
110
+ | `h j k l` | 왼쪽/아래/위/오른쪽 |
111
+ | `w b` | 단어 앞으로/뒤로 |
112
+ | `0 $ ^` | 줄 시작/끝/첫 문자 |
113
+ | `gg G` | 파일 시작/끝 |
114
+ | `%` | 짝 괄호로 이동 |
115
+ | `PgUp PgDn` | 페이지 위/아래 |
116
+ | `Ctrl+d/u` | 반 페이지 아래/위 |
117
+
118
+ ### 검색
119
+ | 키 | 동작 |
120
+ |-----|--------|
121
+ | `/` | 앞으로 검색 |
122
+ | `?` | 뒤로 검색 |
123
+ | `n N` | 다음/이전 매치 |
124
+ | `$.` `$[` | JSONPath 검색 (자동 감지) |
125
+ | `\j` | 패턴에 JSONPath 접미사 추가 |
126
+ | `\c \C` | 대소문자 무시/구분 |
127
+
128
+ ### 삽입 모드
129
+ | 키 | 동작 |
130
+ |-----|--------|
131
+ | `i I` | 커서 위치/줄 시작에 삽입 |
132
+ | `a A` | 커서 뒤/줄 끝에 추가 |
133
+ | `o O` | 아래/위에 새 줄 추가 |
134
+
135
+ ### 편집
136
+ | 키 | 동작 |
137
+ |-----|--------|
138
+ | `x` | 문자 삭제 |
139
+ | `dd` | 줄 삭제 |
140
+ | `dw d$` | 단어/줄 끝까지 삭제 |
141
+ | `cw cc` | 단어/줄 변경 |
142
+ | `r{c}` | 문자 교체 |
143
+ | `J` | 줄 합치기 |
144
+ | `yy p P` | 복사/뒤에 붙여넣기/앞에 붙여넣기 |
145
+ | `u` | 실행 취소 |
146
+ | `Ctrl+r` | 다시 실행 |
147
+ | `.` | 마지막 편집 반복 |
148
+ | `ej` | 내장 JSON 문자열 편집 |
149
+
150
+ ### 명령어
151
+ | 명령어 | 동작 |
152
+ |---------|--------|
153
+ | `:w` | 저장 |
154
+ | `:w {file}` | 다른 이름으로 저장 |
155
+ | `:e {file}` | 파일 열기 |
156
+ | `:fmt` | JSON 포맷팅 |
157
+ | `:q` | 종료 |
158
+ | `:q!` | 변경 사항 버리고 종료 |
159
+ | `:wq` | 저장하고 종료 |
160
+ | `:help` | 도움말 패널 토글 |
161
+
162
+ ## 라이선스
163
+
164
+ MIT
jvim-0.1.0/README.md ADDED
@@ -0,0 +1,164 @@
1
+ # jets
2
+
3
+ **J**SON **E**ditor in **T**extual with vim-**S**tyle keybindings.
4
+
5
+ [한국어](README.kr.md)
6
+
7
+ ## Features
8
+
9
+ - **Vim-style modal editing** - Normal, Insert, Command, and Search modes
10
+ - **Syntax highlighting** - JSON-aware colorization
11
+ - **JSON validation** - Real-time validation with error reporting
12
+ - **JSONPath search** - Search using JSONPath expressions (`$.foo.bar`)
13
+ - **JSONL support** - Edit JSON Lines files with smart formatting
14
+ - **Embedded JSON editing** - Edit JSON strings within JSON with nested level support
15
+ - **Bracket matching** - Jump to matching brackets with `%`
16
+ - **Undo/Redo** - Full undo history
17
+
18
+ ## Installation
19
+
20
+ ```bash
21
+ pip install vim-json-editor
22
+ ```
23
+
24
+ ## Usage
25
+
26
+ ```bash
27
+ # Open a file
28
+ vj data.json
29
+
30
+ # Open in read-only mode
31
+ vj -R data.json
32
+
33
+ # Create new file
34
+ vj newfile.json
35
+ ```
36
+
37
+ ## JSONL Support
38
+
39
+ vj provides special handling for JSON Lines (`.jsonl`) files:
40
+
41
+ - **Pretty-printed editing**: Each JSONL record is automatically formatted with indentation for easy reading and editing
42
+ - **Compact saving**: When you save, each record is minified back to a single line, preserving the JSONL format
43
+ - **Record numbers**: A second column shows the record number (1, 2, 3...) for easy navigation
44
+ - **Floating header**: When scrolling through a multi-line record, the physical line number stays visible at the top
45
+
46
+ Example: A JSONL file with two records:
47
+ ```
48
+ {"name": "Alice", "age": 30}
49
+ {"name": "Bob", "age": 25}
50
+ ```
51
+
52
+ Opens in vj as:
53
+ ```
54
+ {
55
+ "name": "Alice",
56
+ "age": 30
57
+ }
58
+ {
59
+ "name": "Bob",
60
+ "age": 25
61
+ }
62
+ ```
63
+
64
+ And saves back to the original compact format.
65
+
66
+ ## Embedded JSON Editing
67
+
68
+ JSON files often contain escaped JSON strings as values. vj lets you edit these nested JSON structures naturally.
69
+
70
+ ### How it works
71
+
72
+ 1. Position your cursor on a line containing a JSON string value
73
+ 2. Type `ej` in normal mode
74
+ 3. A new editor panel opens with the parsed and formatted JSON
75
+ 4. Edit the embedded JSON with full syntax highlighting and validation
76
+ 5. Save with `:w` to update the parent document (minified) or `:q` to cancel
77
+
78
+ ### Nested levels
79
+
80
+ You can edit embedded JSON within embedded JSON:
81
+ - The panel title shows the current nesting level: `Edit Embedded JSON (level 1)`
82
+ - A `[+]` indicator appears when you have unsaved changes
83
+ - `:w` saves and returns to the previous level
84
+ - `:q!` discards changes and returns to the previous level
85
+
86
+ ### Example
87
+
88
+ Given this JSON:
89
+ ```json
90
+ {
91
+ "config": "{\"host\": \"localhost\", \"port\": 8080}"
92
+ }
93
+ ```
94
+
95
+ Using `ej` on the config line opens:
96
+ ```json
97
+ {
98
+ "host": "localhost",
99
+ "port": 8080
100
+ }
101
+ ```
102
+
103
+ After editing and saving, the parent is updated with the minified result.
104
+
105
+ ## Keybindings
106
+
107
+ ### Movement
108
+ | Key | Action |
109
+ |-----|--------|
110
+ | `h j k l` | Left/Down/Up/Right |
111
+ | `w b` | Word forward/backward |
112
+ | `0 $ ^` | Line start/end/first char |
113
+ | `gg G` | File start/end |
114
+ | `%` | Jump to matching bracket |
115
+ | `PgUp PgDn` | Page up/down |
116
+ | `Ctrl+d/u` | Half page down/up |
117
+
118
+ ### Search
119
+ | Key | Action |
120
+ |-----|--------|
121
+ | `/` | Search forward |
122
+ | `?` | Search backward |
123
+ | `n N` | Next/previous match |
124
+ | `$.` `$[` | JSONPath search (auto-detect) |
125
+ | `\j` | JSONPath suffix for patterns |
126
+ | `\c \C` | Case insensitive/sensitive |
127
+
128
+ ### Insert Mode
129
+ | Key | Action |
130
+ |-----|--------|
131
+ | `i I` | Insert at cursor/line start |
132
+ | `a A` | Append after cursor/line end |
133
+ | `o O` | Open line below/above |
134
+
135
+ ### Editing
136
+ | Key | Action |
137
+ |-----|--------|
138
+ | `x` | Delete char |
139
+ | `dd` | Delete line |
140
+ | `dw d$` | Delete word/to end |
141
+ | `cw cc` | Change word/line |
142
+ | `r{c}` | Replace char |
143
+ | `J` | Join lines |
144
+ | `yy p P` | Yank/paste after/before |
145
+ | `u` | Undo |
146
+ | `Ctrl+r` | Redo |
147
+ | `.` | Repeat last edit |
148
+ | `ej` | Edit embedded JSON string |
149
+
150
+ ### Commands
151
+ | Command | Action |
152
+ |---------|--------|
153
+ | `:w` | Save |
154
+ | `:w {file}` | Save as |
155
+ | `:e {file}` | Open file |
156
+ | `:fmt` | Format JSON |
157
+ | `:q` | Quit |
158
+ | `:q!` | Quit (discard changes) |
159
+ | `:wq` | Save and quit |
160
+ | `:help` | Toggle help panel |
161
+
162
+ ## License
163
+
164
+ MIT
@@ -0,0 +1,53 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "jvim"
7
+ version = "0.1.0"
8
+ description = "A modal JSON editor built with Textual, featuring vim-style keybindings"
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = "MIT"
12
+ authors = [
13
+ { name = "Kihyun Kim", email = "k2hyun@gmail.com" }
14
+ ]
15
+ keywords = ["json", "editor", "vim", "tui", "textual", "jsonl", "cli"]
16
+ classifiers = [
17
+ "Development Status :: 4 - Beta",
18
+ "Environment :: Console",
19
+ "Intended Audience :: Developers",
20
+ "License :: OSI Approved :: MIT License",
21
+ "Operating System :: OS Independent",
22
+ "Programming Language :: Python :: 3",
23
+ "Programming Language :: Python :: 3.10",
24
+ "Programming Language :: Python :: 3.11",
25
+ "Programming Language :: Python :: 3.12",
26
+ "Topic :: Text Editors",
27
+ "Topic :: Utilities",
28
+ ]
29
+ dependencies = [
30
+ "textual>=0.70.0",
31
+ ]
32
+
33
+ [project.optional-dependencies]
34
+ dev = [
35
+ "pytest>=8.0",
36
+ "pytest-asyncio>=0.23",
37
+ "textual-dev>=1.0",
38
+ ]
39
+
40
+ [project.scripts]
41
+ vj = "jets.app:main"
42
+
43
+ [project.urls]
44
+ Homepage = "https://github.com/k2hyun/jets"
45
+ Repository = "https://github.com/k2hyun/jets"
46
+ Issues = "https://github.com/k2hyun/jets/issues"
47
+
48
+ [tool.hatch.build.targets.wheel]
49
+ packages = ["src/jets"]
50
+
51
+ [tool.pytest.ini_options]
52
+ testpaths = ["tests"]
53
+ asyncio_mode = "auto"
@@ -0,0 +1,6 @@
1
+ """jets: JSON Editor in Textual."""
2
+
3
+ from .editor import EditorMode, JsonEditor
4
+
5
+ __all__ = ["EditorMode", "JsonEditor"]
6
+ __version__ = "0.1.0"
@@ -0,0 +1,5 @@
1
+ """Allow running with `python -m jets`."""
2
+
3
+ from .app import main
4
+
5
+ main()