AutoYADM commit: 2025-05-12 03:15:08

This commit is contained in:
Daniel Fichtinger 2025-05-12 03:15:08 -04:00
parent dc8ac7f4cb
commit c6543d13f4
2 changed files with 23 additions and 10 deletions

View file

@ -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
}
}

View file

@ -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"])