change cd function names to lfcd
This commit is contained in:
1 parent
fd2d3a0f86
commit
7d47436a35
5 files changed
+59
-50
No files matched your search
-22
@@ -1,22 +0,0 @@
|
||||
# Change working dir in fish to last dir in lf on exit (adapted from ranger).
|
||||
#
|
||||
# You need to either copy the content of this file to ~/.config/fish/config.fish
|
||||
# or put the file to ~/.config/fish/functions using something like:
|
||||
#
|
||||
# mkdir -p ~/.config/fish/functions
|
||||
# ln -s "$GOPATH/src/github.com/gokcehan/lf/etc/lf.fish" ~/.config/fish/functions
|
||||
#
|
||||
|
||||
function lf
|
||||
set tmp (mktemp)
|
||||
command lf -last-dir-path=$tmp $argv
|
||||
if test -f "$tmp"
|
||||
set dir (cat $tmp)
|
||||
if test -n "$dir"
|
||||
if test "$dir" != (pwd)
|
||||
cd $dir
|
||||
end
|
||||
end
|
||||
end
|
||||
rm -f $tmp
|
||||
end
|
||||
@@ -1,24 +0,0 @@
|
||||
# Change working dir in shell to last dir in lf on exit (adapted from ranger).
|
||||
#
|
||||
# You need to either copy the content of this file to your shell rc file
|
||||
# (e.g. ~/.bashrc) or source this file directly using something like:
|
||||
#
|
||||
# LFSH="$GOPATH/src/github.com/gokcehan/lf/etc/lf.sh"
|
||||
# if [ -f "$LFSH" ]; then
|
||||
# source "$LFSH"
|
||||
# fi
|
||||
#
|
||||
# You may also like to assign a key to this command:
|
||||
#
|
||||
# bind '"\C-o":"\C-ulf\C-m"'
|
||||
#
|
||||
|
||||
lf () {
|
||||
tmp="$(mktemp)"
|
||||
command lf -last-dir-path="$tmp" "$@"
|
||||
if [ -f "$tmp" ]; then
|
||||
dir="$(cat "$tmp")"
|
||||
[ "$dir" != "$(pwd)" ] && cd "$dir"
|
||||
fi
|
||||
rm -f "$tmp"
|
||||
}
|
||||
+4
-4
@@ -1,16 +1,16 @@
|
||||
" Use lf to select and open a file in vim (adapted from ranger).
|
||||
" Use lf to select and open file(s) in vim (adapted from ranger).
|
||||
"
|
||||
" You need to either copy the content of this file to your ~/.vimrc or source
|
||||
" this file directly using something like:
|
||||
" this file directly:
|
||||
"
|
||||
" let lfvim = $GOPATH . "/src/github.com/gokcehan/lf/etc/lf.vim"
|
||||
" let lfvim = "/path/to/lf.vim"
|
||||
" if filereadable(lfvim)
|
||||
" exec "source " . lfvim
|
||||
" endif
|
||||
"
|
||||
" You may also like to assign a key to this command:
|
||||
"
|
||||
" nnoremap <leader>l :<c-u>LF<cr>
|
||||
" nnoremap <leader>l :LF<cr>
|
||||
"
|
||||
|
||||
function! LF()
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
# Change working dir in fish to last dir in lf on exit (adapted from ranger).
|
||||
#
|
||||
# You may put this file to a directory in $fish_function_path variable:
|
||||
#
|
||||
# mkdir -p ~/.config/fish/functions
|
||||
# ln -s "/path/to/lfcd.fish" ~/.config/fish/functions
|
||||
#
|
||||
# You may also like to assign a key to this command:
|
||||
#
|
||||
# bind \co 'lfcd; commandline -f repaint'
|
||||
#
|
||||
# You need to put this in a function called fish_user_key_bindings.
|
||||
|
||||
function lfcd
|
||||
set tmp (mktemp)
|
||||
lf -last-dir-path=$tmp $argv
|
||||
if test -f "$tmp"
|
||||
set dir (cat $tmp)
|
||||
rm -f $tmp
|
||||
if test -d "$dir"
|
||||
if test "$dir" != (pwd)
|
||||
cd $dir
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
# Change working dir in shell to last dir in lf on exit (adapted from ranger).
|
||||
#
|
||||
# You need to either copy the content of this file to your shell rc file
|
||||
# (e.g. ~/.bashrc) or source this file directly:
|
||||
#
|
||||
# LFCD="/path/to/lfcd.sh"
|
||||
# if [ -f "$LFCD" ]; then
|
||||
# source "$LFCD"
|
||||
# fi
|
||||
#
|
||||
# You may also like to assign a key to this command:
|
||||
#
|
||||
# bind '"\C-o":"lfcd\C-m"' # bash
|
||||
# bindkey -s '^o' 'lfcd\n' # zsh
|
||||
#
|
||||
|
||||
lfcd () {
|
||||
tmp="$(mktemp)"
|
||||
lf -last-dir-path="$tmp" "$@"
|
||||
if [ -f "$tmp" ]; then
|
||||
dir="$(cat "$tmp")"
|
||||
rm -f "$tmp"
|
||||
if [ -d "$dir" ]; then
|
||||
if [ "$dir" != "$(pwd)" ]; then
|
||||
cd "$dir"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
Reference in new issue
Block a user