No description
- C 98.9%
- Makefile 1.1%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
A leafpad-style editor in one C file: one window, one text view, and no menu bar -- everything lives in the right-click menu. - File/Search/Options submenus, then Undo/Redo, the clipboard actions, Select All, and Quit last. - Hand-rolled undo/redo, since GTK3's GtkTextBuffer has none: a run of typing collapses into one step, and Replace All undoes in one. - Line-number gutter drawn into the text view's left border window. - Find/replace with wrap-around, jump-to-line, font chooser, word wrap and auto indent, all remembered in ~/.config/nib/settings.conf. - UTF-8 with a locale then ISO-8859-1 fallback for files that aren't. - Accelerators are drawn by hand so the key reads "Ctrl+n", not "Ctrl+N". - Cut/Copy/Delete follow the selection; Paste follows the clipboard, queried asynchronously so the menu never blocks on its owner. Runs natively on Wayland. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01D45fg5oFXet4sjafytaaaW |
||
| .gitignore | ||
| Makefile | ||
| nib.c | ||
| README.md | ||
nib
A simple GTK+3 text editor in the spirit of leafpad:
one window, one text view, and nothing else. There is no menu bar — everything
lives in the right-click menu. Runs natively on Wayland (GTK picks the backend
automatically; force it with GDK_BACKEND=wayland).
Build
make
Requires gtk+-3.0 and a C compiler. To install:
make install # ~/.local/bin/nib, no root needed
sudo make install PREFIX=/usr/local
make uninstall # removes it again
make install defaults to PREFIX=$HOME/.local; pass PREFIX to put it
elsewhere, and DESTDIR to stage it for packaging.
Use
nib [FILE]
If FILE does not exist, it becomes the name of a new document.
Right-click anywhere in the text (or press Menu / Shift+F10) for everything:
File > New Ctrl+n, Open Ctrl+o, Save Ctrl+s, Save As Shift+Ctrl+s
Search > Find Ctrl+f, Find Next Ctrl+g, Replace Ctrl+h, Jump To Ctrl+j
Options > Font, Word Wrap, Line Numbers, Auto Indent
Undo Ctrl+z
Redo Ctrl+y
Cut Ctrl+x
Copy Ctrl+c
Paste Ctrl+v
Delete
Select All Ctrl+a
Quit Ctrl+q
The keyboard shortcuts work whether or not the menu is open.
Notes:
- Files are read and written as UTF-8. A file that is not valid UTF-8 is decoded using the locale encoding, falling back to ISO-8859-1; it is always saved back as UTF-8.
- Undo is home-grown (GTK3's
GtkTextBufferhas none): a run of typing collapses into one step, and a Replace All undoes in one step. - Search wraps around the end of the buffer.
- Cut, Copy and Delete are greyed out when nothing is selected, and Paste when the clipboard holds no text. The clipboard is queried asynchronously, so the menu never blocks on an unresponsive clipboard owner.
- Closing with unsaved changes asks first.
Configuration
Font and the three Options toggles are remembered in
~/.config/nib/settings.conf, written on a clean exit.
Files
nib.c— the whole editorMakefile