From c6543d13f4152c53e25cf75e141f72f8232436a2 Mon Sep 17 00:00:00 2001 From: Daniel Fichtinger Date: Mon, 12 May 2025 03:15:08 -0400 Subject: [PATCH] AutoYADM commit: 2025-05-12 03:15:08 --- .config/kak/autoload/nav.kak | 14 +++++++++++--- .config/kak/scripts/nav.py | 19 ++++++++++++------- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/.config/kak/autoload/nav.kak b/.config/kak/autoload/nav.kak index bbb64fe4..15160dc1 100644 --- a/.config/kak/autoload/nav.kak +++ b/.config/kak/autoload/nav.kak @@ -3,15 +3,23 @@ # 3. Split the logical line into chunks based on wrap width # 4. Move cursor to the same column offset on the wrapped line -define-command visual-down %{ - nop %sh{ +define-command visual-vertical -params 1 %{ + execute-keys %sh{ line="$kak_cursor_line" col="$kak_cursor_column" width="$kak_window_width" count="$kak_buf_line_count" path="$kak_buffile" - new_col=$($kak_config/scripts/nav.py "$line" "$col" "$width" "$count" "$path" "down") + session="$kak_session" + distance=$($kak_config/scripts/nav.py "$session" "$line" "$col" "$width" "$count" "$path" "$1") + echo "$distance" # TODO: figure out how to jump to this column? + } %sh{ + if [ "$1" = "up" ]; then + echo h + else + echo l + fi } } diff --git a/.config/kak/scripts/nav.py b/.config/kak/scripts/nav.py index b681d2fc..3c47315e 100755 --- a/.config/kak/scripts/nav.py +++ b/.config/kak/scripts/nav.py @@ -1,13 +1,15 @@ #!/usr/bin/env python import sys +# import subprocess -line_n = int(sys.argv[1]) -col = int(sys.argv[2]) -width = int(sys.argv[3]) -count = int(sys.argv[4]) -path = sys.argv[5] -direction = sys.argv[6] +session_id = sys.argv[1] +line_n = int(sys.argv[2]) +col = int(sys.argv[3]) +width = int(sys.argv[4]) +count = int(sys.argv[5]) +path = sys.argv[6] +direction = sys.argv[7] digits = len(str(count)) wrap_width = width - (digits + 3) line = "" @@ -25,4 +27,7 @@ if 0 <= new_visual_row < len(chunks): target_chunk = chunks[new_visual_row] new_col = min(visual_col, len(target_chunk) - 1) new_abs_col = new_visual_row * wrap_width + new_col - print(new_abs_col) + diff = abs(new_abs_col - col) + print(diff) + # _ = subprocess.run(args=["kak", "-c"]) +