init: initial helix notebook setup
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
.direnv
|
||||
3
.helix/config.toml
Normal file
3
.helix/config.toml
Normal file
@@ -0,0 +1,3 @@
|
||||
[keys.normal]
|
||||
"C-r" = [":write", ":sh kitty @ send-text --match cmdline:python '%%run \"%{buffer_name}\"\n'"]
|
||||
"C-a" = [":write", ":sh python .state_manager.py \"%{buffer_name}\"", "select_all", "delete_selection"]
|
||||
19
.state_manager.py
Normal file
19
.state_manager.py
Normal file
@@ -0,0 +1,19 @@
|
||||
from pathlib import Path
|
||||
from sys import argv
|
||||
state = Path(".state")
|
||||
|
||||
if len(argv) < 2:
|
||||
exit()
|
||||
|
||||
cell_path = Path(argv[1])
|
||||
|
||||
state_bytes = 0
|
||||
|
||||
if state.exists():
|
||||
state_bytes = state.read_bytes()
|
||||
state_bytes = int.from_bytes(state_bytes) + 1
|
||||
state.write_bytes(state_bytes.to_bytes())
|
||||
|
||||
save_path = cell_path.with_stem(cell_path.stem + '_' + str(state_bytes))
|
||||
cell_path.rename(save_path)
|
||||
|
||||
Reference in New Issue
Block a user