update doc

This commit is contained in:
Gokcehan committed 2021-05-19 22:25:26 +03:00
1 parent 06a30eda19
commit d6acf4a6ec
3 files changed
+64 -95

No files matched your search

+13 -24
View File
@@ -185,6 +185,11 @@ Configuration files should be located at:
unix /etc/lf/lfrc ~/.config/lf/lfrc
windows C:\ProgramData\lf\lfrc C:\Users\<user>\AppData\Local\lf\lfrc
Selection file should be located at:
unix ~/.local/share/lf/files
windows C:\Users\<user>\AppData\Local\lf\files
Marks file should be located at:
unix ~/.local/share/lf/marks
@@ -786,7 +791,7 @@ Command 'map' is used to bind a key to a command which can be builtin command, c
map gh cd ~ # builtin command
map D trash # custom command
map i $less $f # shell command
map U !du -sh # waiting shell command
map U !du -csh * # waiting shell command
Command 'cmap' is used to bind a key to a command line command which can only be one of the builtin commands:
@@ -1001,10 +1006,11 @@ This is the recommended way of using remote commands since it is shorter and imm
In this command 'send' is used to send the rest of the string as a command to all connected clients.
You can optionally give it an id number to send a command to a single client:
lf -remote 'send 1000 echo hello world'
lf -remote 'send 1234 echo hello world'
All clients have a unique id number but you may not be aware of the id number when you are writing a command.
For this purpose, an '$id' variable is exported to the environment for shell commands.
The value of this variable is set to the process id of the client.
You can use it to send a remote command from a client to the server which in return sends a command back to itself.
So now you can display a message in the current client by calling the following in a shell command:
@@ -1024,27 +1030,10 @@ For example, you can configure the number of columns in the ui with respect to t
fi
}}
Besides 'send' command, there are also two commands to get or set the current file selection.
Two possible modes 'copy' and 'move' specify whether selected files are to be copied or moved.
File names are separated by newline character.
Setting the file selection is done with 'save' command:
lf -remote "$(printf 'save\ncopy\nfoo.txt\nbar.txt\nbaz.txt\n')"
Getting the file selection is similarly done with 'load' command:
load=$(lf -remote 'load')
mode=$(echo "$load" | sed -n '1p')
list=$(echo "$load" | sed '1d')
if [ $mode = 'copy' ]; then
# do something with $list
elif [ $mode = 'move' ]; then
# do something else with $list
fi
There is a 'quit' command to close client connections and quit the server:
Besides 'send' command, there is a 'quit' command to quit the server when there are no connected clients left, and a 'quit!' command to force quit the server by closing client connections first:
lf -remote 'quit'
lf -remote 'quit!'
Lastly, there is a 'conn' command to connect the server as a client.
This should not be needed for users.
@@ -1062,7 +1051,7 @@ For cross-device moving, lf falls back to copying and then deletes the original
Operation errors are shown in the message line as well as the log file and they do not preemptively finish the corresponding file operation.
File operations can be performed on the current selected file or alternatively on multiple files by selecting them first.
When you 'copy' a file, lf doesn't actually copy the file on the disk, but only records its name to memory.
When you 'copy' a file, lf doesn't actually copy the file on the disk, but only records its name to a file.
The actual file copying takes place when you 'paste'.
Similarly 'paste' after a 'cut' operation moves the file.
@@ -1071,7 +1060,7 @@ This is a special command that is called when it is defined instead of the built
You can use the following example as a starting point:
cmd paste %{{
load=$(lf -remote 'load')
load=$(cat ~/.local/share/lf/files)
mode=$(echo "$load" | sed -n '1p')
list=$(echo "$load" | sed '1d')
if [ $mode = 'copy' ]; then
@@ -1079,7 +1068,7 @@ You can use the following example as a starting point:
elif [ $mode = 'move' ]; then
mv $list .
fi
lf -remote 'send load'
rm ~/.local/share/lf/files
lf -remote 'send clear'
}}
+26 -35
View File
@@ -190,6 +190,11 @@ Configuration files should be located at:
unix /etc/lf/lfrc ~/.config/lf/lfrc
windows C:\ProgramData\lf\lfrc C:\Users\<user>\AppData\Local\lf\lfrc
Selection file should be located at:
unix ~/.local/share/lf/files
windows C:\Users\<user>\AppData\Local\lf\files
Marks file should be located at:
unix ~/.local/share/lf/marks
@@ -851,7 +856,7 @@ command, custom command, or shell command:
map gh cd ~ # builtin command
map D trash # custom command
map i $less $f # shell command
map U !du -sh # waiting shell command
map U !du -csh * # waiting shell command
Command 'cmap' is used to bind a key to a command line command which can
only be one of the builtin commands:
@@ -1100,11 +1105,12 @@ In this command 'send' is used to send the rest of the string as a command
to all connected clients. You can optionally give it an id number to send a
command to a single client:
lf -remote 'send 1000 echo hello world'
lf -remote 'send 1234 echo hello world'
All clients have a unique id number but you may not be aware of the id
number when you are writing a command. For this purpose, an '$id' variable
is exported to the environment for shell commands. You can use it to send a
is exported to the environment for shell commands. The value of this
variable is set to the process id of the client. You can use it to send a
remote command from a client to the server which in return sends a command
back to itself. So now you can display a message in the current client by
calling the following in a shell command:
@@ -1126,27 +1132,12 @@ with respect to the terminal width as follows:
fi
}}
Besides 'send' command, there are also two commands to get or set the
current file selection. Two possible modes 'copy' and 'move' specify whether
selected files are to be copied or moved. File names are separated by
newline character. Setting the file selection is done with 'save' command:
lf -remote "$(printf 'save\ncopy\nfoo.txt\nbar.txt\nbaz.txt\n')"
Getting the file selection is similarly done with 'load' command:
load=$(lf -remote 'load')
mode=$(echo "$load" | sed -n '1p')
list=$(echo "$load" | sed '1d')
if [ $mode = 'copy' ]; then
# do something with $list
elif [ $mode = 'move' ]; then
# do something else with $list
fi
There is a 'quit' command to close client connections and quit the server:
Besides 'send' command, there is a 'quit' command to quit the server when
there are no connected clients left, and a 'quit!' command to force quit the
server by closing client connections first:
lf -remote 'quit'
lf -remote 'quit!'
Lastly, there is a 'conn' command to connect the server as a client. This
should not be needed for users.
@@ -1171,7 +1162,7 @@ corresponding file operation.
File operations can be performed on the current selected file or
alternatively on multiple files by selecting them first. When you 'copy' a
file, lf doesn't actually copy the file on the disk, but only records its
name to memory. The actual file copying takes place when you 'paste'.
name to a file. The actual file copying takes place when you 'paste'.
Similarly 'paste' after a 'cut' operation moves the file.
You can customize copy and move operations by defining a 'paste' command.
@@ -1179,18 +1170,18 @@ This is a special command that is called when it is defined instead of the
builtin implementation. You can use the following example as a starting
point:
cmd paste %{{
load=$(lf -remote 'load')
mode=$(echo "$load" | sed -n '1p')
list=$(echo "$load" | sed '1d')
if [ $mode = 'copy' ]; then
cp -R $list .
elif [ $mode = 'move' ]; then
mv $list .
fi
lf -remote 'send load'
lf -remote 'send clear'
}}
cmd paste %{{
load=$(cat ~/.local/share/lf/files)
mode=$(echo "$load" | sed -n '1p')
list=$(echo "$load" | sed '1d')
if [ $mode = 'copy' ]; then
cp -R $list .
elif [ $mode = 'move' ]; then
mv $list .
fi
rm ~/.local/share/lf/files
lf -remote 'send clear'
}}
Some useful things to be considered are to use the backup ('--backup')
and/or preserve attributes ('-a') options with 'cp' and 'mv' commands if
+25 -36
View File
@@ -210,6 +210,13 @@ Configuration files should be located at:
windows C:\eProgramData\elf\elfrc C:\eUsers\e<user>\eAppData\eLocal\elf\elfrc
.EE
.PP
Selection file should be located at:
.PP
.EX
unix ~/.local/share/lf/files
windows C:\eUsers\e<user>\eAppData\eLocal\elf\efiles
.EE
.PP
Marks file should be located at:
.PP
.EX
@@ -950,7 +957,7 @@ Command 'map' is used to bind a key to a command which can be builtin command, c
map gh cd ~ # builtin command
map D trash # custom command
map i $less $f # shell command
map U !du -sh # waiting shell command
map U !du -csh * # waiting shell command
.EE
.PP
Command 'cmap' is used to bind a key to a command line command which can only be one of the builtin commands:
@@ -1177,10 +1184,10 @@ Since such a client may not be available everywhere, lf comes bundled with a com
In this command 'send' is used to send the rest of the string as a command to all connected clients. You can optionally give it an id number to send a command to a single client:
.PP
.EX
lf -remote 'send 1000 echo hello world'
lf -remote 'send 1234 echo hello world'
.EE
.PP
All clients have a unique id number but you may not be aware of the id number when you are writing a command. For this purpose, an '$id' variable is exported to the environment for shell commands. You can use it to send a remote command from a client to the server which in return sends a command back to itself. So now you can display a message in the current client by calling the following in a shell command:
All clients have a unique id number but you may not be aware of the id number when you are writing a command. For this purpose, an '$id' variable is exported to the environment for shell commands. The value of this variable is set to the process id of the client. You can use it to send a remote command from a client to the server which in return sends a command back to itself. So now you can display a message in the current client by calling the following in a shell command:
.PP
.EX
lf -remote "send $id echo hello world"
@@ -1201,52 +1208,34 @@ Since lf does not have control flow syntax, remote commands are used for such ne
}}
.EE
.PP
Besides 'send' command, there are also two commands to get or set the current file selection. Two possible modes 'copy' and 'move' specify whether selected files are to be copied or moved. File names are separated by newline character. Setting the file selection is done with 'save' command:
.PP
.EX
lf -remote "$(printf 'save\encopy\enfoo.txt\enbar.txt\enbaz.txt\en')"
.EE
.PP
Getting the file selection is similarly done with 'load' command:
.PP
.EX
load=$(lf -remote 'load')
mode=$(echo "$load" | sed -n '1p')
list=$(echo "$load" | sed '1d')
if [ $mode = 'copy' ]; then
# do something with $list
elif [ $mode = 'move' ]; then
# do something else with $list
fi
.EE
.PP
There is a 'quit' command to close client connections and quit the server:
Besides 'send' command, there is a 'quit' command to quit the server when there are no connected clients left, and a 'quit!' command to force quit the server by closing client connections first:
.PP
.EX
lf -remote 'quit'
lf -remote 'quit!'
.EE
.PP
Lastly, there is a 'conn' command to connect the server as a client. This should not be needed for users.
.SH FILE OPERATIONS
lf uses its own builtin copy and move operations by default. These are implemented as asynchronous operations and progress is shown in the bottom ruler. These commands do not overwrite existing files or directories with the same name. Instead, a suffix that is compatible with '--backup=numbered' option in GNU cp is added to the new files or directories. Only file modes are preserved and all other attributes are ignored including ownership, timestamps, context, and xattr. Special files such as character and block devices, named pipes, and sockets are skipped and links are not followed. Moving is performed using the rename operation of the underlying OS. For cross-device moving, lf falls back to copying and then deletes the original files if there are no errors. Operation errors are shown in the message line as well as the log file and they do not preemptively finish the corresponding file operation.
.PP
File operations can be performed on the current selected file or alternatively on multiple files by selecting them first. When you 'copy' a file, lf doesn't actually copy the file on the disk, but only records its name to memory. The actual file copying takes place when you 'paste'. Similarly 'paste' after a 'cut' operation moves the file.
File operations can be performed on the current selected file or alternatively on multiple files by selecting them first. When you 'copy' a file, lf doesn't actually copy the file on the disk, but only records its name to a file. The actual file copying takes place when you 'paste'. Similarly 'paste' after a 'cut' operation moves the file.
.PP
You can customize copy and move operations by defining a 'paste' command. This is a special command that is called when it is defined instead of the builtin implementation. You can use the following example as a starting point:
.PP
.EX
cmd paste %{{
load=$(lf -remote 'load')
mode=$(echo "$load" | sed -n '1p')
list=$(echo "$load" | sed '1d')
if [ $mode = 'copy' ]; then
cp -R $list .
elif [ $mode = 'move' ]; then
mv $list .
fi
lf -remote 'send load'
lf -remote 'send clear'
}}
cmd paste %{{
load=$(cat ~/.local/share/lf/files)
mode=$(echo "$load" | sed -n '1p')
list=$(echo "$load" | sed '1d')
if [ $mode = 'copy' ]; then
cp -R $list .
elif [ $mode = 'move' ]; then
mv $list .
fi
rm ~/.local/share/lf/files
lf -remote 'send clear'
}}
.EE
.PP
Some useful things to be considered are to use the backup ('--backup') and/or preserve attributes ('-a') options with 'cp' and 'mv' commands if they support it (i.e. GNU implementation), change the command type to asynchronous, or use 'rsync' command with progress bar option for copying and feed the progress to the client periodically with remote 'echo' calls.