add find_project function
This commit is contained in:
parent
41e2315c5d
commit
cb5adc6720
|
@ -194,6 +194,37 @@ cmd find_word ${{
|
|||
return 0
|
||||
}}
|
||||
|
||||
cmd find_project ${{
|
||||
dirs=$(echo $XDG_DOCUMENTS_DIR/dev/*/*)
|
||||
histfile="$XDG_DATA_HOME/lf/project_history"
|
||||
|
||||
clear
|
||||
project="$(echo $dirs | xargs -n1 basename | fzf \
|
||||
--cycle \
|
||||
--preview-window="right,33%" \
|
||||
--bind="space:accept,focus:transform-preview-label(echo {})" \
|
||||
--scheme='history' \
|
||||
--history="$histfile" \
|
||||
--header="Projects" \
|
||||
--preview='
|
||||
f={}
|
||||
file=$(echo $XDG_DOCUMENTS_DIR/dev/*/* | xargs -n1 | sed -n "/\/$f$/p")
|
||||
if [ -f "$file" ] && [ -r "$file" ]; then
|
||||
head -$LINES "$file"
|
||||
elif [ -d "$file" ] && [ -r "$file" ]; then
|
||||
ls -pLHAN1 --color=always --group-directories-first "$file"
|
||||
fi
|
||||
' |
|
||||
tr -d '\n'
|
||||
)"
|
||||
file=$(echo $dirs | xargs -n1 | sed -n "/\/$project$/p")
|
||||
[ -d "$file" ] && lf -remote "send $id cd $file"
|
||||
[ -f "$file" ] && lf -remote "send $id select $file"
|
||||
return 0
|
||||
|
||||
|
||||
}}
|
||||
|
||||
cmd extract ${{
|
||||
for f in $fx; do
|
||||
aunpack "$f"
|
||||
|
@ -247,10 +278,11 @@ map <space> :toggle; down
|
|||
map <enter> shell
|
||||
map <a-enter> shell-wait
|
||||
map <tab><tab> fzf 'Shortcuts' 'cat $XDG_DATA_HOME/lf/shortcuts 2>/dev/null' ':' '1' '2' '85%' '^'
|
||||
map <tab><space> find_project
|
||||
map <tab>t fzf 'Tags' 'cat $XDG_DATA_HOME/lf/tags 2>/dev/null' ':' '1' '1' '50%'
|
||||
map <tab>m fzf 'Marks' 'cat $XDG_DATA_HOME/lf/marks 2>/dev/null' ':' '1' '2' '85%' '^'
|
||||
map <tab>f fzf 'Files' 'find -L $PWD' ':' '1' '1' '50%'
|
||||
map <tab><space> find_word
|
||||
map <tab>g find_word
|
||||
map "'" mark-load
|
||||
map '"' mark-remove
|
||||
map "$" shell
|
||||
|
|
Loading…
Reference in New Issue