change cd function names to lfcd

This commit is contained in:
Gokcehan committed 2017-10-21 22:14:58 +03:00
1 parent fd2d3a0f86
commit 7d47436a35
5 files changed
+59 -50

No files matched your search

-22
View File
@@ -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
-24
View File
@@ -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
View File
@@ -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()
+26
View File
@@ -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
View File
@@ -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
}