nysor 0.4__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.
- nysor-0.4/LICENSE +201 -0
- nysor-0.4/PKG-INFO +170 -0
- nysor-0.4/README.md +139 -0
- nysor-0.4/nysor/__main__.py +11 -0
- nysor-0.4/nysor/logical_lines.py +107 -0
- nysor-0.4/nysor/logtools.py +46 -0
- nysor-0.4/nysor/main.py +288 -0
- nysor-0.4/nysor/nvim_interface.py +233 -0
- nysor-0.4/nysor/nvim_notifications.py +214 -0
- nysor-0.4/nysor/text_display.py +748 -0
- nysor-0.4/nysor/utils.py +44 -0
- nysor-0.4/nysor.egg-info/PKG-INFO +170 -0
- nysor-0.4/nysor.egg-info/SOURCES.txt +19 -0
- nysor-0.4/nysor.egg-info/dependency_links.txt +1 -0
- nysor-0.4/nysor.egg-info/entry_points.txt +2 -0
- nysor-0.4/nysor.egg-info/requires.txt +10 -0
- nysor-0.4/nysor.egg-info/top_level.txt +1 -0
- nysor-0.4/pyproject.toml +56 -0
- nysor-0.4/setup.cfg +4 -0
- nysor-0.4/tests/test_infra.py +91 -0
- nysor-0.4/tests/test_logical_lines.py +261 -0
nysor-0.4/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
nysor-0.4/PKG-INFO
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: nysor
|
|
3
|
+
Version: 0.4
|
|
4
|
+
Summary: A PyQt GUI for Neovim
|
|
5
|
+
Author-email: Facundo Batista <facundo@taniquetil.com.ar>
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/facundobatista/nysor
|
|
8
|
+
Project-URL: Repository, https://github.com/facundobatista/nysor
|
|
9
|
+
Project-URL: Issues, https://github.com/facundobatista/nysor/issues
|
|
10
|
+
Keywords: neovim,gui,pyqt,editor
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Environment :: X11 Applications :: Qt
|
|
13
|
+
Classifier: Intended Audience :: End Users/Desktop
|
|
14
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Topic :: Text Editors
|
|
18
|
+
Requires-Python: >=3.12
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
License-File: LICENSE
|
|
21
|
+
Requires-Dist: PyQt6==6.9.1
|
|
22
|
+
Requires-Dist: foffinf==0.1
|
|
23
|
+
Requires-Dist: msgpack==1.1.1
|
|
24
|
+
Requires-Dist: qasync==0.27.1
|
|
25
|
+
Provides-Extra: dev
|
|
26
|
+
Requires-Dist: codespell; extra == "dev"
|
|
27
|
+
Requires-Dist: flake8; extra == "dev"
|
|
28
|
+
Requires-Dist: pydocstyle; extra == "dev"
|
|
29
|
+
Requires-Dist: pytest; extra == "dev"
|
|
30
|
+
Dynamic: license-file
|
|
31
|
+
|
|
32
|
+
# Welcome to Nysor
|
|
33
|
+
|
|
34
|
+
Yet another graphical interface for Neovim.
|
|
35
|
+
|
|
36
|
+
Written in Python, with Qt.
|
|
37
|
+
|
|
38
|
+
Pronounced similar to "organizer", but without the "orga" and changing the "e" for an "o".
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
# Why another GUI for Neovim?
|
|
42
|
+
|
|
43
|
+
It's basically a pet project: one aimed to learn about Neovim and how to use it programmatically. But at the same time the idea is to provide a high quality interface for the everyday usage.
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
# What it offers?
|
|
47
|
+
|
|
48
|
+
Nysor is mainly a GUI with an editor inside. You run it, optionally indicating a file to load, and will edit it using Neovim as backend.
|
|
49
|
+
|
|
50
|
+
In other words, Nysor does not really *edit* the file, it's Neovim, and Neovim is the one that handlers all your keystrokes and (most of) the mouse actions. Nysor is not an *emulation* of Neovim.
|
|
51
|
+
|
|
52
|
+
Currently, version 0.1, it's just a window with the editor inside. There is nothing extra so far, but all the basics should work. It may have rough edges, though (there are even two buttons for debugging purposes); see below what to expect in the future.
|
|
53
|
+
|
|
54
|
+
<div align="center">
|
|
55
|
+
<img src="media/sshot1.png" alt="Screenshot showing a simple GUI" width="600"/>
|
|
56
|
+
<p><em>Default init message (the clear background is because of my Neovim config, not a GUI decision)</em></p>
|
|
57
|
+
</div>
|
|
58
|
+
|
|
59
|
+
## How to run it?
|
|
60
|
+
|
|
61
|
+
You call it from the project (no packaging yet), but previously you need to create a virtualenv; e.g.:
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
…/nysor$ python3 -m venv env
|
|
65
|
+
…/nysor$ source env/bin/activate
|
|
66
|
+
(env) …/nysor$ pip install -r requirements.txt
|
|
67
|
+
(env) …/nysor$ python -m nysor
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
You can indicate it to open a file to edit:
|
|
71
|
+
```
|
|
72
|
+
(env) …/nysor$ python -m nysor myfile.txt
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
By default, currently, some INFO is sent to the terminal, you can reduce the logs verbosity with `-q/--quiet`, increase it with `-v/--verbose`, or even use `-t/--trace` to see everything that is going one under the hood (specially the interaction with Neovim through the socket).
|
|
76
|
+
|
|
77
|
+
Nysor will use `nvim` if it's in the PATH, but you can always specify the binary location using `--nvim`.
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
# Roadmap
|
|
81
|
+
|
|
82
|
+
These are the plans for the future. They are quite informal, the idea is to follow this list, but we can reorder stuff if needed, of if something is requested.
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
## The path to 1.0
|
|
86
|
+
|
|
87
|
+
The idea is to have a solid editor in one window for version 1.0; there will be not much more functionality than it currently exists, but it should improve in quality.
|
|
88
|
+
|
|
89
|
+
These are the items lousely grouped to get there:
|
|
90
|
+
|
|
91
|
+
**For 0.5:**
|
|
92
|
+
|
|
93
|
+
- present an error window if a `nvim` executable is not Found
|
|
94
|
+
- include instructions to install it
|
|
95
|
+
- not yet configurable, but run it with `--nvim`
|
|
96
|
+
- Include the icon, so it's shown in the window decoration
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
**For 0.6:**
|
|
100
|
+
|
|
101
|
+
- complete "GUI window"
|
|
102
|
+
- add a very clean menu
|
|
103
|
+
- File: Exit, About
|
|
104
|
+
- the About should present name, icon, and versions for Nysor *and* the nvim it's using
|
|
105
|
+
- remove the two debug buttons
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
**For 1.0:**
|
|
109
|
+
|
|
110
|
+
- Think about "distribution"
|
|
111
|
+
- upload it to PyPI and check `uvx` and `fades` work to run it
|
|
112
|
+
- package it with `pyempaq`
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
## After 1.0
|
|
117
|
+
|
|
118
|
+
The path after that is less descriptive. The following are the big items I want to add to the editor in the following versions:
|
|
119
|
+
|
|
120
|
+
**For version 2:**
|
|
121
|
+
- try to separate, if possible, the command bar from Neovim's grid itself
|
|
122
|
+
- add better history and ways to search/filter previous commands
|
|
123
|
+
- try to separate, if possible, the windows for messages from the editor
|
|
124
|
+
- not only from the Neovim *itself* (like `myfile.txt 23L, 10023B written`) but also from plugins, like linters
|
|
125
|
+
- these windows should be easily resizeable, and with buttons somewhere to turn them on/off
|
|
126
|
+
- improve error management around "opening a file that was left open previously because of crashing or similar"
|
|
127
|
+
- add a treeview in the left of the window
|
|
128
|
+
- simple, showing the directory where the process is run
|
|
129
|
+
- if double click in a file, it should open a new window/tab with the new buffer
|
|
130
|
+
- support multiple buffers open
|
|
131
|
+
- FIXME.90
|
|
132
|
+
- switch back and forward clicking on tabs
|
|
133
|
+
- when going back to a tab, it should check if underneath file changed
|
|
134
|
+
- support closing properly, each tab or the whole program, asking for the buffers that are not properly saved
|
|
135
|
+
- remove the "debug buttons"
|
|
136
|
+
- FIXME.91
|
|
137
|
+
|
|
138
|
+
**For version 3:**
|
|
139
|
+
- it should open more than a file if it's given in the command line
|
|
140
|
+
- each file should be a separate window in the "right pane zone"
|
|
141
|
+
- double clicking in the tree view should also edit the file
|
|
142
|
+
- when open from a terminal, the layout should change according to the indicated parameters
|
|
143
|
+
- if it's one or more files, open them as (multiple) windows, without a treeview
|
|
144
|
+
- if it's a directory, open it with a treeview based in that directory
|
|
145
|
+
- if this is not the first time the directory is "opened", it should remember which files were previosly open
|
|
146
|
+
- if nothing is indicated, open it empty, with no treeview
|
|
147
|
+
- if "`-`" is the parameter, it should handle `stdin`
|
|
148
|
+
- let's see if Neovim supports through API telling it to open stdin
|
|
149
|
+
- otherwise just make it work: open a temporary file with content retrieved from `stdin` and tell Neovim to use that
|
|
150
|
+
- no treeview
|
|
151
|
+
- FIXME.92
|
|
152
|
+
|
|
153
|
+
**For version 4:**
|
|
154
|
+
- different Nysor runs should be different processes, but aware of them
|
|
155
|
+
- if you're trying to open the same file twice, it should not, the other editor should get focus
|
|
156
|
+
- add functionality to the contextual window (when you right click on a word)
|
|
157
|
+
- FIXME.93
|
|
158
|
+
- to search that token in all the proyect ... maybe also in the project's virtual env?
|
|
159
|
+
- to jump to the definition of that word (function, class, module, etc)
|
|
160
|
+
|
|
161
|
+
**For version 5:**
|
|
162
|
+
- automatically run linters
|
|
163
|
+
- if the standard ones are in the virtual environment, use them, add decorations for their results
|
|
164
|
+
- minimum github support
|
|
165
|
+
- decoration of lines added/removed/changed
|
|
166
|
+
- support minimal configuration
|
|
167
|
+
- overrid automatic detections, like virtualenv directories, linters to run, etc
|
|
168
|
+
- placement of decoration for line length
|
|
169
|
+
- scrollbars behaviour (never, always, dynamic)
|
|
170
|
+
- nvim exec path
|
nysor-0.4/README.md
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# Welcome to Nysor
|
|
2
|
+
|
|
3
|
+
Yet another graphical interface for Neovim.
|
|
4
|
+
|
|
5
|
+
Written in Python, with Qt.
|
|
6
|
+
|
|
7
|
+
Pronounced similar to "organizer", but without the "orga" and changing the "e" for an "o".
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
# Why another GUI for Neovim?
|
|
11
|
+
|
|
12
|
+
It's basically a pet project: one aimed to learn about Neovim and how to use it programmatically. But at the same time the idea is to provide a high quality interface for the everyday usage.
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
# What it offers?
|
|
16
|
+
|
|
17
|
+
Nysor is mainly a GUI with an editor inside. You run it, optionally indicating a file to load, and will edit it using Neovim as backend.
|
|
18
|
+
|
|
19
|
+
In other words, Nysor does not really *edit* the file, it's Neovim, and Neovim is the one that handlers all your keystrokes and (most of) the mouse actions. Nysor is not an *emulation* of Neovim.
|
|
20
|
+
|
|
21
|
+
Currently, version 0.1, it's just a window with the editor inside. There is nothing extra so far, but all the basics should work. It may have rough edges, though (there are even two buttons for debugging purposes); see below what to expect in the future.
|
|
22
|
+
|
|
23
|
+
<div align="center">
|
|
24
|
+
<img src="media/sshot1.png" alt="Screenshot showing a simple GUI" width="600"/>
|
|
25
|
+
<p><em>Default init message (the clear background is because of my Neovim config, not a GUI decision)</em></p>
|
|
26
|
+
</div>
|
|
27
|
+
|
|
28
|
+
## How to run it?
|
|
29
|
+
|
|
30
|
+
You call it from the project (no packaging yet), but previously you need to create a virtualenv; e.g.:
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
…/nysor$ python3 -m venv env
|
|
34
|
+
…/nysor$ source env/bin/activate
|
|
35
|
+
(env) …/nysor$ pip install -r requirements.txt
|
|
36
|
+
(env) …/nysor$ python -m nysor
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
You can indicate it to open a file to edit:
|
|
40
|
+
```
|
|
41
|
+
(env) …/nysor$ python -m nysor myfile.txt
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
By default, currently, some INFO is sent to the terminal, you can reduce the logs verbosity with `-q/--quiet`, increase it with `-v/--verbose`, or even use `-t/--trace` to see everything that is going one under the hood (specially the interaction with Neovim through the socket).
|
|
45
|
+
|
|
46
|
+
Nysor will use `nvim` if it's in the PATH, but you can always specify the binary location using `--nvim`.
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
# Roadmap
|
|
50
|
+
|
|
51
|
+
These are the plans for the future. They are quite informal, the idea is to follow this list, but we can reorder stuff if needed, of if something is requested.
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
## The path to 1.0
|
|
55
|
+
|
|
56
|
+
The idea is to have a solid editor in one window for version 1.0; there will be not much more functionality than it currently exists, but it should improve in quality.
|
|
57
|
+
|
|
58
|
+
These are the items lousely grouped to get there:
|
|
59
|
+
|
|
60
|
+
**For 0.5:**
|
|
61
|
+
|
|
62
|
+
- present an error window if a `nvim` executable is not Found
|
|
63
|
+
- include instructions to install it
|
|
64
|
+
- not yet configurable, but run it with `--nvim`
|
|
65
|
+
- Include the icon, so it's shown in the window decoration
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
**For 0.6:**
|
|
69
|
+
|
|
70
|
+
- complete "GUI window"
|
|
71
|
+
- add a very clean menu
|
|
72
|
+
- File: Exit, About
|
|
73
|
+
- the About should present name, icon, and versions for Nysor *and* the nvim it's using
|
|
74
|
+
- remove the two debug buttons
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
**For 1.0:**
|
|
78
|
+
|
|
79
|
+
- Think about "distribution"
|
|
80
|
+
- upload it to PyPI and check `uvx` and `fades` work to run it
|
|
81
|
+
- package it with `pyempaq`
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
## After 1.0
|
|
86
|
+
|
|
87
|
+
The path after that is less descriptive. The following are the big items I want to add to the editor in the following versions:
|
|
88
|
+
|
|
89
|
+
**For version 2:**
|
|
90
|
+
- try to separate, if possible, the command bar from Neovim's grid itself
|
|
91
|
+
- add better history and ways to search/filter previous commands
|
|
92
|
+
- try to separate, if possible, the windows for messages from the editor
|
|
93
|
+
- not only from the Neovim *itself* (like `myfile.txt 23L, 10023B written`) but also from plugins, like linters
|
|
94
|
+
- these windows should be easily resizeable, and with buttons somewhere to turn them on/off
|
|
95
|
+
- improve error management around "opening a file that was left open previously because of crashing or similar"
|
|
96
|
+
- add a treeview in the left of the window
|
|
97
|
+
- simple, showing the directory where the process is run
|
|
98
|
+
- if double click in a file, it should open a new window/tab with the new buffer
|
|
99
|
+
- support multiple buffers open
|
|
100
|
+
- FIXME.90
|
|
101
|
+
- switch back and forward clicking on tabs
|
|
102
|
+
- when going back to a tab, it should check if underneath file changed
|
|
103
|
+
- support closing properly, each tab or the whole program, asking for the buffers that are not properly saved
|
|
104
|
+
- remove the "debug buttons"
|
|
105
|
+
- FIXME.91
|
|
106
|
+
|
|
107
|
+
**For version 3:**
|
|
108
|
+
- it should open more than a file if it's given in the command line
|
|
109
|
+
- each file should be a separate window in the "right pane zone"
|
|
110
|
+
- double clicking in the tree view should also edit the file
|
|
111
|
+
- when open from a terminal, the layout should change according to the indicated parameters
|
|
112
|
+
- if it's one or more files, open them as (multiple) windows, without a treeview
|
|
113
|
+
- if it's a directory, open it with a treeview based in that directory
|
|
114
|
+
- if this is not the first time the directory is "opened", it should remember which files were previosly open
|
|
115
|
+
- if nothing is indicated, open it empty, with no treeview
|
|
116
|
+
- if "`-`" is the parameter, it should handle `stdin`
|
|
117
|
+
- let's see if Neovim supports through API telling it to open stdin
|
|
118
|
+
- otherwise just make it work: open a temporary file with content retrieved from `stdin` and tell Neovim to use that
|
|
119
|
+
- no treeview
|
|
120
|
+
- FIXME.92
|
|
121
|
+
|
|
122
|
+
**For version 4:**
|
|
123
|
+
- different Nysor runs should be different processes, but aware of them
|
|
124
|
+
- if you're trying to open the same file twice, it should not, the other editor should get focus
|
|
125
|
+
- add functionality to the contextual window (when you right click on a word)
|
|
126
|
+
- FIXME.93
|
|
127
|
+
- to search that token in all the proyect ... maybe also in the project's virtual env?
|
|
128
|
+
- to jump to the definition of that word (function, class, module, etc)
|
|
129
|
+
|
|
130
|
+
**For version 5:**
|
|
131
|
+
- automatically run linters
|
|
132
|
+
- if the standard ones are in the virtual environment, use them, add decorations for their results
|
|
133
|
+
- minimum github support
|
|
134
|
+
- decoration of lines added/removed/changed
|
|
135
|
+
- support minimal configuration
|
|
136
|
+
- overrid automatic detections, like virtualenv directories, linters to run, etc
|
|
137
|
+
- placement of decoration for line length
|
|
138
|
+
- scrollbars behaviour (never, always, dynamic)
|
|
139
|
+
- nvim exec path
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Copyright 2025-2026 Facundo Batista
|
|
2
|
+
# Licensed under the Apache v2 License
|
|
3
|
+
# For further info, check https://github.com/facundobatista/nysor
|
|
4
|
+
|
|
5
|
+
"""Init file to allow project's execution as a module."""
|
|
6
|
+
|
|
7
|
+
import sys
|
|
8
|
+
|
|
9
|
+
from nysor import main
|
|
10
|
+
|
|
11
|
+
sys.exit(main.start())
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# Copyright 2025-2026 Facundo Batista
|
|
2
|
+
# Licensed under the Apache v2 License
|
|
3
|
+
# For further info, check https://github.com/facundobatista/nysor
|
|
4
|
+
|
|
5
|
+
"""Logical lines."""
|
|
6
|
+
|
|
7
|
+
import logging
|
|
8
|
+
from dataclasses import dataclass
|
|
9
|
+
|
|
10
|
+
from PyQt6.QtGui import QColor
|
|
11
|
+
|
|
12
|
+
logger = logging.getLogger(__name__)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@dataclass
|
|
16
|
+
class CharUnderline:
|
|
17
|
+
"""Represent the underlyne style of a single char."""
|
|
18
|
+
color: QColor
|
|
19
|
+
style: str # "underline", "undercurl", "underdouble", "underdotted", "underdashed"
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@dataclass
|
|
23
|
+
class CharFormat:
|
|
24
|
+
"""Represent the overall format of a single char."""
|
|
25
|
+
foreground: QColor
|
|
26
|
+
background: QColor
|
|
27
|
+
strikethrough: bool = False
|
|
28
|
+
italic: bool = False
|
|
29
|
+
bold: bool = False
|
|
30
|
+
underline: CharUnderline | None = None
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
@dataclass
|
|
34
|
+
class LogicalChar:
|
|
35
|
+
"""Represent a logical character with its format and wide indication."""
|
|
36
|
+
|
|
37
|
+
char: str
|
|
38
|
+
format: CharFormat
|
|
39
|
+
is_wide: bool = False
|
|
40
|
+
|
|
41
|
+
def __hash__(self):
|
|
42
|
+
return hash((self.char, self.is_wide))
|
|
43
|
+
|
|
44
|
+
def __eq__(self, other):
|
|
45
|
+
return (self.char, self.is_wide) == (other.char, other.is_wide)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
class LogicalLines:
|
|
49
|
+
"""Hold the lines to show in the grid."""
|
|
50
|
+
|
|
51
|
+
def __init__(self, q_rows, q_cols, fmt):
|
|
52
|
+
self._lines = {
|
|
53
|
+
idx: [LogicalChar(" ", fmt) for _ in range(q_cols)] for idx in range(q_rows)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@classmethod
|
|
57
|
+
def empty(cls):
|
|
58
|
+
"""Return an empty line."""
|
|
59
|
+
return cls(0, 0, None)
|
|
60
|
+
|
|
61
|
+
def get(self, row):
|
|
62
|
+
"""Return the logical line for the indicated row."""
|
|
63
|
+
return self._lines.get(row)
|
|
64
|
+
|
|
65
|
+
def add(self, row, col, textinfo):
|
|
66
|
+
"""Add text info to the grid."""
|
|
67
|
+
# expand the textinfo so we have one format per character, to keep our logical grid
|
|
68
|
+
expanded = []
|
|
69
|
+
for text, fmt in textinfo:
|
|
70
|
+
if text is None:
|
|
71
|
+
# special "char" that comes after others to indicate those are width: we flag
|
|
72
|
+
# the previous item and keep the position with None for the slice assignment
|
|
73
|
+
# below to work correctly
|
|
74
|
+
expanded[-1].is_wide = True
|
|
75
|
+
expanded.append(None)
|
|
76
|
+
else:
|
|
77
|
+
expanded.extend(LogicalChar(char, fmt) for char in text)
|
|
78
|
+
|
|
79
|
+
# it's fine to create new lines in the map, because gaps are created when scrolling
|
|
80
|
+
prvline = self._lines.setdefault(row, [])
|
|
81
|
+
|
|
82
|
+
if col > len(prvline):
|
|
83
|
+
raise ValueError("Trying to write outside the line; needs to rethink model!!!")
|
|
84
|
+
prvline[col: col + len(expanded)] = expanded
|
|
85
|
+
|
|
86
|
+
def scroll_vertical(self, top, bottom, delta):
|
|
87
|
+
"""Scroll vertically some lines in the grid."""
|
|
88
|
+
if abs(delta) >= bottom - top:
|
|
89
|
+
raise ValueError("Overflow scrolling; not supported yet")
|
|
90
|
+
|
|
91
|
+
if delta > 0:
|
|
92
|
+
# goes up; move N lines up and then remove "hole"
|
|
93
|
+
for idx in range(top + delta, bottom):
|
|
94
|
+
self._lines[idx - delta] = self._lines[idx]
|
|
95
|
+
for idx in range(bottom - delta, bottom):
|
|
96
|
+
del self._lines[idx]
|
|
97
|
+
|
|
98
|
+
elif delta < 0:
|
|
99
|
+
# goes down; move N lines down and then remove "hole"
|
|
100
|
+
for idx in reversed(range(top, bottom + delta)):
|
|
101
|
+
self._lines[idx - delta] = self._lines[idx]
|
|
102
|
+
for idx in range(top, top - delta):
|
|
103
|
+
del self._lines[idx]
|
|
104
|
+
|
|
105
|
+
else:
|
|
106
|
+
logger.warning("Called scroll vertical with delta=0, shouldn't happen")
|
|
107
|
+
return
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Copyright 2026 Facundo Batista
|
|
2
|
+
# Licensed under the Apache v2 License
|
|
3
|
+
# For further info, check https://github.com/facundobatista/nysor
|
|
4
|
+
|
|
5
|
+
"""Tools related to logging."""
|
|
6
|
+
|
|
7
|
+
import logging
|
|
8
|
+
import sys
|
|
9
|
+
|
|
10
|
+
import foffinf
|
|
11
|
+
|
|
12
|
+
logger = logging.getLogger(__name__)
|
|
13
|
+
|
|
14
|
+
_TRACE_LEVEL = 5
|
|
15
|
+
LOG_LEVELS = {
|
|
16
|
+
"quiet": (logging.WARNING, "Set logging to be quiet."),
|
|
17
|
+
"verbose": (logging.DEBUG, "Set logging to verbose."),
|
|
18
|
+
"trace": (_TRACE_LEVEL, "Set logging for tracing (beware, there may be too many messages)."),
|
|
19
|
+
None: (logging.INFO, None), # default no-option-set
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def logsetup(selected_level):
|
|
24
|
+
"""Prepare all logging."""
|
|
25
|
+
# add trace level to logging
|
|
26
|
+
logging.addLevelName(_TRACE_LEVEL, "TRACE")
|
|
27
|
+
logging.TRACE = _TRACE_LEVEL
|
|
28
|
+
|
|
29
|
+
# config
|
|
30
|
+
logging.basicConfig(
|
|
31
|
+
format='%(asctime)s.%(msecs)03d %(levelname)-5s %(message)s',
|
|
32
|
+
datefmt='%H:%M:%S', stream=sys.stdout)
|
|
33
|
+
|
|
34
|
+
# set proper level to the whole app
|
|
35
|
+
level, _ = LOG_LEVELS[selected_level]
|
|
36
|
+
logging.getLogger("nysor").setLevel(level)
|
|
37
|
+
|
|
38
|
+
# use new format styles
|
|
39
|
+
foffinf.formatize("nysor", scatter=True)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def log_notdone(msg, **items):
|
|
43
|
+
"""Nicely log a not implemented error."""
|
|
44
|
+
reprs = [f"{k}={{!r}}" for k in items.keys()]
|
|
45
|
+
fullmsg = f"Not Implemented! {msg}: {' '.join(reprs)}"
|
|
46
|
+
logger.error(fullmsg, *items.values())
|