From 421560771ad837f07bccfb22a470ee33a40d5848 Mon Sep 17 00:00:00 2001 From: Luca Bilke Date: Thu, 1 Feb 2024 20:17:42 +0100 Subject: [PATCH] small fixes --- .config/lf/lfrc | 11 ++++++----- .config/nvim/lua/config/autocmds.lua | 9 ++++++++- .config/zsh/configs/widgets | 3 +-- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/.config/lf/lfrc b/.config/lf/lfrc index defe814a..509bf2d3 100644 --- a/.config/lf/lfrc +++ b/.config/lf/lfrc @@ -137,6 +137,7 @@ cmd fzfshortcut ${{ [ -f $file ] && lf -remote "send $id select $file" }} cmd fzfgrep ${{ + set +ue RG_PREFIX="rg --hidden --column --line-number --no-heading --color=always --smart-case " res="$( FZF_DEFAULT_COMMAND="$RG_PREFIX ''" \ @@ -144,15 +145,15 @@ cmd fzfgrep ${{ --ansi --layout=reverse --header 'Searching file contents' |\ grep -iv -e 'Trash/files' -e 'Trash/info' )" - file="$(echo $res | cut -d':' -f1 | sed 's/\\/\\\\/g;s/"/\\"/g')" - row="$(echo $res | cut -d':' -f2)" - column="$(echo $res | cut -d':' -f3)" + file="$(realpath $(echo "$res" | cut -d':' -f1 | sed 's/\\/\\\\/g;s/"/\\"/g'))" + row="$(echo "$res" | cut -d':' -f2)" + column="$(echo "$res" | cut -d':' -f3)" if [ -n "$res" ]; then lf -remote "send $id select '$file'" if [ -n "$VIM" ]; then lf -remote "send $id open '$file'" - elsif [ "$EDITOR" = "nvim" ] || [ "$EDITOR" = "vim" ]; then - lf -remote "send $id \$$EDITOR '$file' +'call cursor($row, $column)'" + elif ([ "$EDITOR" = "nvim" ] || [ "$EDITOR" = "vim" ]) && [ -n "$EMBEDDED" ]; then + lf -remote "send $id \$$EDITOR +'call cursor($row, $column)' -- $([ -n "$EMBEDDED" ] && echo "--") '$file'" else lf -remote "send $id \$$EDITOR '$file'" fi diff --git a/.config/nvim/lua/config/autocmds.lua b/.config/nvim/lua/config/autocmds.lua index 19ee27b8..2cd2636a 100644 --- a/.config/nvim/lua/config/autocmds.lua +++ b/.config/nvim/lua/config/autocmds.lua @@ -16,7 +16,7 @@ local autocmds = { { -- Use 'q' to quit from common plugins "FileType", { - pattern = { "qf", "help", "man", "lspinfo", "spectre_panel", "lir" }, + pattern = { "help", "man" }, callback = function() vim.cmd([[ nnoremap q :close @@ -48,6 +48,13 @@ local autocmds = { end, }, }, + { -- Trigger shortcuts script + "BufWritePost", + { + pattern = { "directories", "files" }, + command = "!shortcuts" + }, + }, } vim.api.nvim_create_augroup("user_config", { clear = true }) diff --git a/.config/zsh/configs/widgets b/.config/zsh/configs/widgets index 77c4887d..3a1a8216 100644 --- a/.config/zsh/configs/widgets +++ b/.config/zsh/configs/widgets @@ -15,9 +15,8 @@ function write_title_wd() { echo -ne "\033]0;$(print -P "%n@%m [%3~]")\007"; } function reset_beam() { echo -ne '\e[5 q'; } function lfwrap () { - export EMBEDDED=true LF_DIRFILE="/tmp/lfdir.$(uuidgen)" - lfX -last-dir-path="$LF_DIRFILE" + env EMBEDDED=true lfX -last-dir-path="$LF_DIRFILE" dir="$(cat "$LF_DIRFILE")" rm "$LF_DIRFILE" if [ -d "$dir" ]; then