markdown · 5192 bytes Raw Blame History

facsimile

(noun) : something clever, trevor

Terminal text editor written in Fortran. VSCode-style keybindings.

Build

The Makefile provides optimized, platform-specific builds:

  • macOS arm64: Uses flang-new for better apple silicon support
  • macOS Intel/Linux: Uses gfortran with standard optimization flags
make
./fac [filename]

Using fpm (Development)

fpm build
./build/gfortran_*/app/fac [filename]
or 
fpm run -- [filename]

Keybindings

  • arrows - move cursor
  • ctrl-a / home - smart home (toggle between first non-whitespace and column 1)
  • ctrl-e / end - end of line
  • alt-left/right - jump by word/punctuation group
  • pageup/pagedown - page scroll
  • mouse click - position cursor
  • mouse wheel/trackpad - scroll viewport
  • alt-[ / alt-] - jump to matching bracket

Selection

  • shift-arrows - character selection
  • shift-alt-left/right - word selection
  • shift-ctrl-a/e - select to line start/end
  • shift-home/end - select to line boundaries
  • shift-pageup/pagedown - page selection
  • mouse drag - select text
  • esc - clear selection / exit multi-cursor mode

Editing

  • backspace / ctrl-h - delete backward
  • delete - delete forward
  • tab - insert 4 spaces (or indent selection)
  • shift-tab - dedent selection or current line
  • ctrl-k - kill line forward (yank stack)
  • ctrl-u - kill line backward (yank stack)
  • ctrl-y - yank from stack
  • ctrl-w / alt-backspace - delete word backward
  • alt-d / alt-delete / fn-alt-backspace - delete word forward
  • ctrl-t - transpose characters
  • ctrl-j - join lines

Clipboard

  • ctrl-x - cut line/selection
  • ctrl-c - copy line/selection
  • ctrl-v - paste

Lines

  • alt-up/down - move line up/down
  • alt-shift-up/down - duplicate line up/down

Multiple Cursors

  • ctrl-d - select next match (creates selections + cursors)
  • alt-click - add/remove cursor at position
  • ctrl-alt-up - add cursor on line above
  • ctrl-alt-down - add cursor on line below
  • esc - exit multi-cursor mode (keep active cursor only)
  • ctrl-f - search forward
  • n - next match (only after search)
  • N - previous match (only after search)
  • ctrl-r - find and replace

Special

  • alt-' - cycle quotes: " → ' → ` → "
  • alt-shift-' - remove surrounding brackets/quotes
  • ctrl-z - undo
  • ctrl-] / ctrl-shift-z - redo (use ctrl-] if terminal intercepts ctrl-shift-z)
  • ctrl-l - clear/redraw screen

File

  • ctrl-s - save
  • ctrl-q - quit
  • ctrl-b - toggle file tree (fuss mode)

Tab Management

  • ctrl-t - create new tab
  • tab / shift-tab - switch between tabs

Pane Management

Split your view into multiple panes for side-by-side editing of the same file.

Creating Panes:

  • alt-v - split pane vertically (creates pane to the right)
  • alt-s - split pane horizontally (creates pane below)

Navigating Panes:

  • alt-h / ctrl-shift-left - move to left pane
  • alt-l / ctrl-shift-right - move to right pane
  • alt-k / ctrl-shift-up - move to pane above
  • alt-j / ctrl-shift-down - move to pane below

Managing Panes:

  • alt-q - close current pane only
  • ctrl-w - close current pane (closes tab when last pane)

Features:

  • Each pane has independent viewport and cursor
  • Line numbers display in all panes
  • Active pane shows with visible cursor
  • Inactive panes have subtle dark background
  • Minimum pane size enforced (20 columns)

File Tree (Fuss Mode)

When in fuss mode (ctrl-b), you get a split view with a git-aware file tree on the left (30%) and editor on the right (70%).

Navigation:

  • j / - move down in tree
  • k / - move up in tree

Opening Files:

  • enter or o - open file in new tab

Display Options:

  • . - toggle hiding dotfiles and gitignored files
    • When enabled, both dotfiles and gitignored files are hidden from view
    • Directories containing only hidden files are greyed out but remain visible
    • Uses git check-ignore to detect gitignored files

Git Operations:

  • a - stage file (git add)
  • u - unstage file (git restore --staged)

Status Indicators:

  • Green - staged changes
  • Red - modified tracked files
  • Gray - untracked files

Exit:

  • esc - exit fuss mode back to editor
  • ctrl-b - toggle fuss mode off

Help

  • ctrl-/ or ctrl-? - show keybindings (ctrl-/ is more reliable)

Terminal Compatibility Notes

Some keybindings may be intercepted by your terminal emulator:

  • Ctrl+A: Often intercepted by tmux/screen (use Home instead)
  • Ctrl+Shift+Z: Intercepted by WezTerm in multi-pane mode (use Ctrl+] instead)
  • Ctrl+': Most terminals send plain apostrophe (use Alt+' instead)
  • Ctrl+Alt+Backspace: Most terminals send alt-backspace (use Alt+Shift+' instead)

For WezTerm users, add to ~/.wezterm.lua to enable Ctrl+Shift+Z:

config.keys = {
  { key = 'Z', mods = 'CTRL|SHIFT', action = wezterm.action.DisableDefaultAssignment },
}

Implementation

Gap buffer for text storage. Pure Fortran with ANSI escape sequences.

License

MIT

View source
1 # facsimile
2 (noun) : something clever, trevor
3
4 Terminal text editor written in Fortran. VSCode-style keybindings.
5
6 ## Build
7
8 ### Using Make (Recommended)
9 The Makefile provides optimized, platform-specific builds:
10 - **macOS arm64**: Uses flang-new for better apple silicon support
11 - **macOS Intel/Linux**: Uses gfortran with standard optimization flags
12
13 ```bash
14 make
15 ./fac [filename]
16 ```
17
18 ### Using fpm (Development)
19 ```bash
20 fpm build
21 ./build/gfortran_*/app/fac [filename]
22 or
23 fpm run -- [filename]
24 ```
25
26 ## Keybindings
27
28 ### Navigation
29 - `arrows` - move cursor
30 - `ctrl-a` / `home` - smart home (toggle between first non-whitespace and column 1)
31 - `ctrl-e` / `end` - end of line
32 - `alt-left/right` - jump by word/punctuation group
33 - `pageup/pagedown` - page scroll
34 - `mouse click` - position cursor
35 - `mouse wheel/trackpad` - scroll viewport
36 - `alt-[` / `alt-]` - jump to matching bracket
37
38 ### Selection
39 - `shift-arrows` - character selection
40 - `shift-alt-left/right` - word selection
41 - `shift-ctrl-a/e` - select to line start/end
42 - `shift-home/end` - select to line boundaries
43 - `shift-pageup/pagedown` - page selection
44 - `mouse drag` - select text
45 - `esc` - clear selection / exit multi-cursor mode
46
47 ### Editing
48 - `backspace` / `ctrl-h` - delete backward
49 - `delete` - delete forward
50 - `tab` - insert 4 spaces (or indent selection)
51 - `shift-tab` - dedent selection or current line
52 - `ctrl-k` - kill line forward (yank stack)
53 - `ctrl-u` - kill line backward (yank stack)
54 - `ctrl-y` - yank from stack
55 - `ctrl-w` / `alt-backspace` - delete word backward
56 - `alt-d` / `alt-delete` / `fn-alt-backspace` - delete word forward
57 - `ctrl-t` - transpose characters
58 - `ctrl-j` - join lines
59
60 ### Clipboard
61 - `ctrl-x` - cut line/selection
62 - `ctrl-c` - copy line/selection
63 - `ctrl-v` - paste
64
65 ### Lines
66 - `alt-up/down` - move line up/down
67 - `alt-shift-up/down` - duplicate line up/down
68
69 ### Multiple Cursors
70 - `ctrl-d` - select next match (creates selections + cursors)
71 - `alt-click` - add/remove cursor at position
72 - `ctrl-alt-up` - add cursor on line above
73 - `ctrl-alt-down` - add cursor on line below
74 - `esc` - exit multi-cursor mode (keep active cursor only)
75
76 ### Search
77 - `ctrl-f` - search forward
78 - `n` - next match (only after search)
79 - `N` - previous match (only after search)
80 - `ctrl-r` - find and replace
81
82 ### Special
83 - `alt-'` - cycle quotes: " → ' → ` → "
84 - `alt-shift-'` - remove surrounding brackets/quotes
85 - `ctrl-z` - undo
86 - `ctrl-]` / `ctrl-shift-z` - redo (use ctrl-] if terminal intercepts ctrl-shift-z)
87 - `ctrl-l` - clear/redraw screen
88
89 ### File
90 - `ctrl-s` - save
91 - `ctrl-q` - quit
92 - `ctrl-b` - toggle file tree (fuss mode)
93
94 ### Tab Management
95 - `ctrl-t` - create new tab
96 - `tab` / `shift-tab` - switch between tabs
97
98 ### Pane Management
99 Split your view into multiple panes for side-by-side editing of the same file.
100
101 **Creating Panes:**
102 - `alt-v` - split pane vertically (creates pane to the right)
103 - `alt-s` - split pane horizontally (creates pane below)
104
105 **Navigating Panes:**
106 - `alt-h` / `ctrl-shift-left` - move to left pane
107 - `alt-l` / `ctrl-shift-right` - move to right pane
108 - `alt-k` / `ctrl-shift-up` - move to pane above
109 - `alt-j` / `ctrl-shift-down` - move to pane below
110
111 **Managing Panes:**
112 - `alt-q` - close current pane only
113 - `ctrl-w` - close current pane (closes tab when last pane)
114
115 **Features:**
116 - Each pane has independent viewport and cursor
117 - Line numbers display in all panes
118 - Active pane shows with visible cursor
119 - Inactive panes have subtle dark background
120 - Minimum pane size enforced (20 columns)
121
122 ### File Tree (Fuss Mode)
123 When in fuss mode (ctrl-b), you get a split view with a git-aware file tree on the left (30%) and editor on the right (70%).
124
125 **Navigation:**
126 - `j` / `↓` - move down in tree
127 - `k` / `↑` - move up in tree
128
129 **Opening Files:**
130 - `enter` or `o` - open file in new tab
131
132 **Display Options:**
133 - `.` - toggle hiding dotfiles and gitignored files
134 - When enabled, both dotfiles and gitignored files are hidden from view
135 - Directories containing only hidden files are greyed out but remain visible
136 - Uses `git check-ignore` to detect gitignored files
137
138 **Git Operations:**
139 - `a` - stage file (git add)
140 - `u` - unstage file (git restore --staged)
141
142 **Status Indicators:**
143 - Green `↑` - staged changes
144 - Red `✗` - modified tracked files
145 - Gray `✗` - untracked files
146
147 **Exit:**
148 - `esc` - exit fuss mode back to editor
149 - `ctrl-b` - toggle fuss mode off
150
151 ### Help
152 - `ctrl-/` or `ctrl-?` - show keybindings (ctrl-/ is more reliable)
153
154 ## Terminal Compatibility Notes
155
156 Some keybindings may be intercepted by your terminal emulator:
157 - **Ctrl+A**: Often intercepted by tmux/screen (use `Home` instead)
158 - **Ctrl+Shift+Z**: Intercepted by WezTerm in multi-pane mode (use `Ctrl+]` instead)
159 - **Ctrl+'**: Most terminals send plain apostrophe (use `Alt+'` instead)
160 - **Ctrl+Alt+Backspace**: Most terminals send alt-backspace (use `Alt+Shift+'` instead)
161
162 For WezTerm users, add to `~/.wezterm.lua` to enable Ctrl+Shift+Z:
163 ```lua
164 config.keys = {
165 { key = 'Z', mods = 'CTRL|SHIFT', action = wezterm.action.DisableDefaultAssignment },
166 }
167 ```
168
169 ## Implementation
170
171 Gap buffer for text storage. Pure Fortran with ANSI escape sequences.
172
173 ## License
174
175 MIT