From c59b47c1ce62202f2f7e6fbdf344b828eb9a0fef Mon Sep 17 00:00:00 2001 From: Natsu Kagami Date: Sun, 23 Jun 2024 17:40:07 +0200 Subject: [PATCH] Fix texlab forward search --- home/kakoune/kak.nix | 2 +- home/kakoune/kaktex | 6 +++--- home/kakoune/kaktex.nix | 12 +----------- 3 files changed, 5 insertions(+), 15 deletions(-) diff --git a/home/kakoune/kak.nix b/home/kakoune/kak.nix index 8f5a475..da08b5c 100644 --- a/home/kakoune/kak.nix +++ b/home/kakoune/kak.nix @@ -153,7 +153,7 @@ in } else { executable = "${pkgs.zathura}/bin/zathura"; - args = [ "--synctex-forward" "%l:1:%f" "%p" "-x" "/home/nki/.bin/kaktex jump %{input} %{line}" ]; + args = [ "--synctex-forward" "%l:1:%f" "%p" "-x" "${./kaktex} jump %%{input} %%{line} %%{column}" ]; }); }; }; diff --git a/home/kakoune/kaktex b/home/kakoune/kaktex index 3abb961..bdcf722 100755 --- a/home/kakoune/kaktex +++ b/home/kakoune/kaktex @@ -3,11 +3,11 @@ function usage echo "Usage: " echo " kaktex set [client] [session]" - echo " kaktex jump [file] [line]" + echo " kaktex jump [file] [line] [column]" exit 1 end -if test (count $argv) -ne 3 +if test (count $argv) -lt 3 usage end @@ -19,7 +19,7 @@ switch $argv[1] echo " evaluate-commands -client $_kaktex_client %{ evaluate-commands -try-client $_kaktex_client %{ - edit -- $argv[2] $argv[3] + edit -existing -- $argv[2] $(math $argv[3] + 1) $(math $argv[4] + 1) } } " | kak -p $_kaktex_session diff --git a/home/kakoune/kaktex.nix b/home/kakoune/kaktex.nix index c446a6d..1256c79 100644 --- a/home/kakoune/kaktex.nix +++ b/home/kakoune/kaktex.nix @@ -1,22 +1,12 @@ { config, pkgs, lib, ... }: -let - kaktexScript = ./kaktex; -in { - # Create kak-tex executable - home.file.kaktex = { - source = kaktexScript; - executable = true; - target = ".bin/kaktex"; - }; - # Source kaktex whenever we have a tex file programs.my-kakoune.rc = '' hook global WinSetOption filetype=(tex|latex) %{ hook window WinDisplay '.*' %{ eval %sh{ - ${kaktexScript} set $kak_client $kak_session + ${./kaktex} set $kak_client $kak_session } } }