small fixes
This commit is contained in:
parent
e8ea24149a
commit
421560771a
3 changed files with 15 additions and 8 deletions
|
@ -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
|
||||
|
|
|
@ -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 <silent> <buffer> q :close<CR>
|
||||
|
@ -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 })
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue