summaryrefslogtreecommitdiff
path: root/mut
diff options
context:
space:
mode:
authorMike Vink <mike@pionative.com>2024-02-28 17:34:59 +0100
committerMike Vink <mike@pionative.com>2024-02-28 17:34:59 +0100
commit3efd97e5ada5ed8ccfe1ba624a5d346e55cafcb2 (patch)
tree79efca52eeb36e6dabc611fb3b3b2c4c18b7cafc /mut
parentb9775e104fc278e77d8bd6b4a5fffc119c438c72 (diff)
some zsh and kitty stuff
Diffstat (limited to 'mut')
-rwxr-xr-xmut/bin/vremote39
-rw-r--r--mut/neovim/fnl/conf/init.fnl2
2 files changed, 29 insertions, 12 deletions
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 :<leader>x<cr> #(vim.cmd "b #"))
- (map :n :<leader><bs>
+ (map :n :<C-w>d
#(do
(local uis (vim.iter (vim.api.nvim_list_uis)))
(uis:map (fn [ui] (vim.fn.chanclose ui.chan))))))