Compare commits

...

5 commits

Author SHA1 Message Date
nadrad eb1fec66f0 '(?)' is styled like '???' now. 2023-07-23 16:57:17 +02:00
nadrad 35a6bae112 added pbcopy to acceptable clipboard applications 2023-07-23 11:31:08 +02:00
nadrad aa54cac1c0 auto_save added 2023-07-23 11:22:48 +02:00
nadrad 9e049112f4 pressing '?' shows the key bindings 2023-07-23 11:09:17 +02:00
nadrad 566e292ef8 made key bindings configurable 2023-07-23 10:45:10 +02:00
3 changed files with 653 additions and 231 deletions

785
h-m-m

File diff suppressed because it is too large Load diff

View file

@ -1,7 +1,7 @@
#!/bin/sh
HMM_PATH=$(dirname "$0")/h-m-m
MINIMUM_REQUIREMENTS="MINIMUM REQUIREMENTS: PHP 7+ and one of these three must exist on PATH: xclip, xsel or wl-clipboard."
MINIMUM_REQUIREMENTS="MINIMUM REQUIREMENTS: PHP 7+ and one of these three must exist on PATH: xclip, xsel, wl-clipboard, or pbcopy."
DESTINATION_DIR=/usr/local/bin
# Test if /usr/local/bin exists. If not fallback to /usr/bin
@ -28,9 +28,14 @@ if ! command -v php > /dev/null 2>&1;then
exit 1
fi
# Test if xclip, xsel or wl-clipboard are on PATH
if ! command -v xclip > /dev/null 2>&1 && ! command -v xsel > /dev/null 2>&1 && ! command -v wl-clipboard > /dev/null 2>&1 ;then
printf "ERROR: xclip, xsel or wl-clipboard must exist on PATH. Installation cancelled.\n";
# Test if a clipboard application is available
if \
! command -v xclip > /dev/null 2>&1 && \
! command -v xsel > /dev/null 2>&1 && \
! command -v wl-clipboard > /dev/null 2>&1 \
! command -v pbcopy > /dev/null 2>&1
then
printf "ERROR: xclip, xsel, wl-clipboard, or pbcopy must exist on PATH. Installation cancelled.\n";
printf "%s\n" "$MINIMUM_REQUIREMENTS"
exit 1
fi

View file

@ -6,7 +6,7 @@
![screenshot](screenshot.png)
# Key bindings
# Default key bindings
Adding, removing, and editing nodes:
@ -23,7 +23,6 @@ Adding, removing, and editing nodes:
* `e`, `i`, or `a` - edits the active node
* `E`, `I`, or `A` - edits the active node, ignoring the existing text
* `u` - undo
* `Ctrl+r` - redo
Marks:
@ -73,7 +72,7 @@ Collapsing and expanding:
Search:
* `/`, `?`, or `Ctrl+f` - searches for a phrase
* `/` or `Ctrl+f` - searches for a phrase
* `n` - goes to the next search result
* `N` - goes to the previous search result
@ -87,6 +86,10 @@ Save, export, quit, etc.:
* `Q` - quits, ignoring the changes
* `Ctrl+o` - open the active node as a file or URL using xdg-open
Misc:
* `?` - show the key bindings
In the text editor:
* `↓` - moves the cursor to the end of the line
@ -103,6 +106,8 @@ In the text editor:
* `Esc` - cancels editing
* `Enter` - wanna guess? ;)
Other than the text editor key bindings, you can change all in your config file.
# Configuration
@ -125,10 +130,83 @@ The following are the settings in h-m-m:
post_export_command = ""
symbol1 = ✓
symbol2 = ✗
auto_save = false
The colors are ASCII escape codes.
You have 3 different ways of setting those values:
You can also change key bindings with a `bind x = command` syntax. The following are the commands:
append
center_active_node
collapse_all
collapse_children
collapse_inner
collapse_level_1
collapse_level_2
collapse_level_3
collapse_level_4
collapse_level_5
collapse_level_6
collapse_level_7
collapse_level_8
collapse_level_9
collapse_other_branches
decrease_line_spacing
decrease_negative_rank
decrease_positive_rank
decrease_text_width
delete_children
delete_node
delete_node_without_clipboard
edit_node_append
edit_node_replace
expand_all
export_html
export_text
focus
go_down
go_left
go_right
go_to_bottom
go_to_root
go_to_top
go_up
increase_line_spacing
increase_negative_rank
increase_positive_rank
increase_text_width
insert_new_child
insert_new_sibling
move_node_down
move_node_up
next_search_result
open_link
paste_as_children
paste_as_siblings
previous_search_result
quit
save
save_as
search
shutdown
sort_siblings
toggle_align
toggle_center_lock
toggle_focus_lock
toggle_hide
toggle_node
toggle_numbers
toggle_show_hidden
toggle_symbol
undo
yank_children
yank_node
Keys can be `x`, `X` (shift+x), `ctrl_x`, `alt_x`, or special keys: `arr_down`, `arr_left`, `arr_right`, `arr_up`, `back_space`, `ctrl_arr_left`, `ctrl_arr_right`, `ctrl_back_space`, `ctrl_del`, `del`, `end`, `enter`, `equal`, `esc`, `home`, `shift_arr_left`, `shift_arr_right`, `space`, `tab`
Note: Not every possible key is defined because I'm going to replace this whole system with one that supports key sequences.
Key bindings can only be set in a config file. There are 3 ways of changing settings:
1. Pass them as arguments when running the program; e.g., `h-m-m --focus-lock=true --line-spacing=0 filename`
1. Set them as environment variables with `hmm_` as prefix; e.g., `hmm_line_spacing=0`