init: initial helix notebook setup

This commit is contained in:
Himadri Bhattacharjee
2026-03-31 10:43:28 +05:30
commit e2832cbe6c
4 changed files with 24 additions and 0 deletions

1
.envrc Normal file
View File

@@ -0,0 +1 @@
use flake

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
.direnv

3
.helix/config.toml Normal file
View 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
View 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)