markdown · 5110 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
  • 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 - `ctrl-r` - find and replace
79
80 ### Special
81 - `alt-'` - cycle quotes: " → ' → ` → "
82 - `alt-shift-'` - remove surrounding brackets/quotes
83 - `ctrl-z` - undo
84 - `ctrl-]` / `ctrl-shift-z` - redo (use ctrl-] if terminal intercepts ctrl-shift-z)
85 - `ctrl-l` - clear/redraw screen
86
87 ### File
88 - `ctrl-s` - save
89 - `ctrl-q` - quit
90 - `ctrl-b` - toggle file tree (fuss mode)
91
92 ### Tab Management
93 - `ctrl-t` - create new tab
94 - `tab` / `shift-tab` - switch between tabs
95
96 ### Pane Management
97 Split your view into multiple panes for side-by-side editing of the same file.
98
99 **Creating Panes:**
100 - `alt-v` - split pane vertically (creates pane to the right)
101 - `alt-s` - split pane horizontally (creates pane below)
102
103 **Navigating Panes:**
104 - `alt-h` / `ctrl-shift-left` - move to left pane
105 - `alt-l` / `ctrl-shift-right` - move to right pane
106 - `alt-k` / `ctrl-shift-up` - move to pane above
107 - `alt-j` / `ctrl-shift-down` - move to pane below
108
109 **Managing Panes:**
110 - `alt-q` - close current pane only
111 - `ctrl-w` - close current pane (closes tab when last pane)
112
113 **Features:**
114 - Each pane has independent viewport and cursor
115 - Line numbers display in all panes
116 - Active pane shows with visible cursor
117 - Inactive panes have subtle dark background
118 - Minimum pane size enforced (20 columns)
119
120 ### File Tree (Fuss Mode)
121 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%).
122
123 **Navigation:**
124 - `j` / `↓` - move down in tree
125 - `k` / `↑` - move up in tree
126
127 **Opening Files:**
128 - `enter` or `o` - open file in new tab
129
130 **Display Options:**
131 - `.` - toggle hiding dotfiles and gitignored files
132 - When enabled, both dotfiles and gitignored files are hidden from view
133 - Directories containing only hidden files are greyed out but remain visible
134 - Uses `git check-ignore` to detect gitignored files
135
136 **Git Operations:**
137 - `a` - stage file (git add)
138 - `u` - unstage file (git restore --staged)
139
140 **Status Indicators:**
141 - Green `↑` - staged changes
142 - Red `✗` - modified tracked files
143 - Gray `✗` - untracked files
144
145 **Exit:**
146 - `esc` - exit fuss mode back to editor
147 - `ctrl-b` - toggle fuss mode off
148
149 ### Help
150 - `ctrl-/` or `ctrl-?` - show keybindings (ctrl-/ is more reliable)
151
152 ## Terminal Compatibility Notes
153
154 Some keybindings may be intercepted by your terminal emulator:
155 - **Ctrl+A**: Often intercepted by tmux/screen (use `Home` instead)
156 - **Ctrl+Shift+Z**: Intercepted by WezTerm in multi-pane mode (use `Ctrl+]` instead)
157 - **Ctrl+'**: Most terminals send plain apostrophe (use `Alt+'` instead)
158 - **Ctrl+Alt+Backspace**: Most terminals send alt-backspace (use `Alt+Shift+'` instead)
159
160 For WezTerm users, add to `~/.wezterm.lua` to enable Ctrl+Shift+Z:
161 ```lua
162 config.keys = {
163 { key = 'Z', mods = 'CTRL|SHIFT', action = wezterm.action.DisableDefaultAssignment },
164 }
165 ```
166
167 ## Implementation
168
169 Gap buffer for text storage. Pure Fortran with ANSI escape sequences.
170
171 ## License
172
173 MIT