From 3efd97e5ada5ed8ccfe1ba624a5d346e55cafcb2 Mon Sep 17 00:00:00 2001 From: Mike Vink Date: Wed, 28 Feb 2024 17:34:59 +0100 Subject: some zsh and kitty stuff --- mut/bin/vremote | 39 ++++++++++++++++++++++++++++----------- mut/neovim/fnl/conf/init.fnl | 2 +- 2 files changed, 29 insertions(+), 12 deletions(-) (limited to 'mut') diff --git a/mut/bin/vremote b/mut/bin/vremote index 6db06eb..f6a04a7 100755 --- a/mut/bin/vremote +++ b/mut/bin/vremote @@ -1,14 +1,31 @@ #!/bin/bash +PATH="/etc/profiles/per-user/$USER/bin:/run/current-system/sw/bin:/usr/bin" server_pipe="$XDG_CACHE_HOME/nvim/server.pipe" -if ! [ -e "$server_pipe" ]; then - nohup nvim --listen "$server_pipe" --headless >/dev/null 2>&1 & -fi +( + if ! [ -e "$server_pipe" ]; then + nohup nvim --listen "$server_pipe" --headless >/dev/null 2>&1 & + fi -if nvim --headless --server ~/.cache/nvim/server.pipe --remote-expr 'luaeval("vim.json.encode(vim.iter(vim.api.nvim_list_uis()):map(function(v) return v.chan end):totable())")' | jq -r '.[]' | while read -r chan; do - echo "already existing ui($chan)..." - exit 1 -done -then - nvim --server "$server_pipe" --remote "${@}" - exec nvim --server "$server_pipe" --remote-ui -fi + if nvim --headless --server ~/.cache/nvim/server.pipe --remote-expr 'luaeval("vim.json.encode(vim.iter(vim.api.nvim_list_uis()):map(function(v) return v.chan end):totable())")' \ + | jq -r '.[]' \ + | while read -r chan; do + osascript -e 'display notification "already existing ui('"$chan"')..." with title "vremote"' + exit 1 + done + then + if [ -n "$1" ]; then + file_names=() + for file_name in "${@}"; do + if [[ "${file_name:0:1}" == / || "${file_name:0:2}" == ~[/a-zA-Z0-9] ]] + then + file_names+=("$file_name") + else + file_names+=("${PWD}/$file_name") + fi + done + echo "got file_names: ${file_names[*]}" + nvim --server "$server_pipe" --remote "${file_names[@]}" >/dev/tty + fi + exec nvim --server "$server_pipe" --remote-ui >/dev/tty + fi +) > ~/vremote_logs 2>&1 diff --git a/mut/neovim/fnl/conf/init.fnl b/mut/neovim/fnl/conf/init.fnl index 53e82df..0cd1b8e 100644 --- a/mut/neovim/fnl/conf/init.fnl +++ b/mut/neovim/fnl/conf/init.fnl @@ -91,7 +91,7 @@ {:keymap {:fzf {"alt-a" "toggle-all"}} :actions {:default {:fn action.buf_edit_or_qf}}})) (map :n :x #(vim.cmd "b #")) - (map :n : + (map :n :d #(do (local uis (vim.iter (vim.api.nvim_list_uis))) (uis:map (fn [ui] (vim.fn.chanclose ui.chan)))))) -- cgit v1.2.3