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"
|
[ -f $file ] && lf -remote "send $id select $file"
|
||||||
}}
|
}}
|
||||||
cmd fzfgrep ${{
|
cmd fzfgrep ${{
|
||||||
|
set +ue
|
||||||
RG_PREFIX="rg --hidden --column --line-number --no-heading --color=always --smart-case "
|
RG_PREFIX="rg --hidden --column --line-number --no-heading --color=always --smart-case "
|
||||||
res="$(
|
res="$(
|
||||||
FZF_DEFAULT_COMMAND="$RG_PREFIX ''" \
|
FZF_DEFAULT_COMMAND="$RG_PREFIX ''" \
|
||||||
|
@ -144,15 +145,15 @@ cmd fzfgrep ${{
|
||||||
--ansi --layout=reverse --header 'Searching file contents' |\
|
--ansi --layout=reverse --header 'Searching file contents' |\
|
||||||
grep -iv -e 'Trash/files' -e 'Trash/info'
|
grep -iv -e 'Trash/files' -e 'Trash/info'
|
||||||
)"
|
)"
|
||||||
file="$(echo $res | cut -d':' -f1 | sed 's/\\/\\\\/g;s/"/\\"/g')"
|
file="$(realpath $(echo "$res" | cut -d':' -f1 | sed 's/\\/\\\\/g;s/"/\\"/g'))"
|
||||||
row="$(echo $res | cut -d':' -f2)"
|
row="$(echo "$res" | cut -d':' -f2)"
|
||||||
column="$(echo $res | cut -d':' -f3)"
|
column="$(echo "$res" | cut -d':' -f3)"
|
||||||
if [ -n "$res" ]; then
|
if [ -n "$res" ]; then
|
||||||
lf -remote "send $id select '$file'"
|
lf -remote "send $id select '$file'"
|
||||||
if [ -n "$VIM" ]; then
|
if [ -n "$VIM" ]; then
|
||||||
lf -remote "send $id open '$file'"
|
lf -remote "send $id open '$file'"
|
||||||
elsif [ "$EDITOR" = "nvim" ] || [ "$EDITOR" = "vim" ]; then
|
elif ([ "$EDITOR" = "nvim" ] || [ "$EDITOR" = "vim" ]) && [ -n "$EMBEDDED" ]; then
|
||||||
lf -remote "send $id \$$EDITOR '$file' +'call cursor($row, $column)'"
|
lf -remote "send $id \$$EDITOR +'call cursor($row, $column)' -- $([ -n "$EMBEDDED" ] && echo "--") '$file'"
|
||||||
else
|
else
|
||||||
lf -remote "send $id \$$EDITOR '$file'"
|
lf -remote "send $id \$$EDITOR '$file'"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -16,7 +16,7 @@ local autocmds = {
|
||||||
{ -- Use 'q' to quit from common plugins
|
{ -- Use 'q' to quit from common plugins
|
||||||
"FileType",
|
"FileType",
|
||||||
{
|
{
|
||||||
pattern = { "qf", "help", "man", "lspinfo", "spectre_panel", "lir" },
|
pattern = { "help", "man" },
|
||||||
callback = function()
|
callback = function()
|
||||||
vim.cmd([[
|
vim.cmd([[
|
||||||
nnoremap <silent> <buffer> q :close<CR>
|
nnoremap <silent> <buffer> q :close<CR>
|
||||||
|
@ -48,6 +48,13 @@ local autocmds = {
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{ -- Trigger shortcuts script
|
||||||
|
"BufWritePost",
|
||||||
|
{
|
||||||
|
pattern = { "directories", "files" },
|
||||||
|
command = "!shortcuts"
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
vim.api.nvim_create_augroup("user_config", { clear = true })
|
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 reset_beam() { echo -ne '\e[5 q'; }
|
||||||
|
|
||||||
function lfwrap () {
|
function lfwrap () {
|
||||||
export EMBEDDED=true
|
|
||||||
LF_DIRFILE="/tmp/lfdir.$(uuidgen)"
|
LF_DIRFILE="/tmp/lfdir.$(uuidgen)"
|
||||||
lfX -last-dir-path="$LF_DIRFILE"
|
env EMBEDDED=true lfX -last-dir-path="$LF_DIRFILE"
|
||||||
dir="$(cat "$LF_DIRFILE")"
|
dir="$(cat "$LF_DIRFILE")"
|
||||||
rm "$LF_DIRFILE"
|
rm "$LF_DIRFILE"
|
||||||
if [ -d "$dir" ]; then
|
if [ -d "$dir" ]; then
|
||||||
|
|
Loading…
Add table
Reference in a new issue