Compare commits

...

3 commits

Author SHA1 Message Date
nadrad 1266938001 fixed typo! 2023-04-19 18:00:59 +02:00
nadrad 43b76efaf9 new feature for opening the active node with xdg-open 2023-04-19 17:58:56 +02:00
nadrad 17b9cec51b name fix for non-existing filename as argument 2023-04-19 17:22:49 +02:00
2 changed files with 20 additions and 3 deletions

20
h-m-m
View file

@ -180,6 +180,7 @@ const ctrl_r = "\022";
const ctrl_f = "\006";
const ctrl_v = "\026";
const ctrl_h = "\010";
const ctrl_o = "\017";
const arr_down = "\033\133\102";
const arr_right = "\033\133\103";
@ -470,7 +471,6 @@ function load_file(&$mm)
$lines = file($mm['filename'], FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
else
{
unset($mm['filename']);
load_empty_map($mm);
return;
}
@ -2528,9 +2528,13 @@ function load_empty_map(&$mm)
]
;
$title = basename( $mm['filename'] ?? 'root' );
if (substr($title,-4)=='.hmm')
$title = substr($title,0,-4);
$mm['nodes'][1] =
[
'title'=> basename( $mm['filename'] ?? 'root' )
'title'=> $title
,'is_leaf'=>true
,'children'=>[]
,'collapsed'=>false
@ -3058,6 +3062,17 @@ function rank(&$mm, $add_positive, $add_negative)
}
// }}}
// {{{ open link
function open_link(&$mm)
{
message($mm,'Opening the node with xdg-open...');
exec('xdg-open "'.$mm['nodes'][ $mm['active_node'] ]['title'].'" >/dev/null 2>&1 &', $output, $result);
display($mm);
}
// }}}
// {{{ sort
@ -3166,6 +3181,7 @@ function monitor_key_presses(&$mm)
case 'n': next_search_result($mm); break;
case 'N': previous_search_result($mm); break;
case ctrl_o: open_link($mm); break;
case 'o': insert_new_node($mm, insert_sibling); break;
case 'O': insert_new_node($mm, insert_child); break;

View file

@ -77,7 +77,7 @@ Search:
* `n` - goes to the next search result
* `N` - goes to the previous search result
Save, export, and quit:
Save, export, quit, etc.:
* `s` - saves with the previous file name (or asks for one if there's none)
* `S` - saves with a new file name
@ -85,6 +85,7 @@ Save, export, and quit:
* `X` - export as a text map into clipboard
* `q` - quits (if the changes were already saved)
* `Q` - quits, ignoring the changes
* `Ctrl+o` - open the active node as a file or URL using xdg-open
In the text editor: