summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--ranger/defaults/commands.py11
-rw-r--r--ranger/help/console.py188
2 files changed, 61 insertions, 138 deletions
diff --git a/ranger/defaults/commands.py b/ranger/defaults/commands.py
index acfbfffb..8005100c 100644
--- a/ranger/defaults/commands.py
+++ b/ranger/defaults/commands.py
@@ -20,7 +20,7 @@ Each command is a subclass of `Command'.  Several methods are defined
 to interface with the console:
 	execute: call this method when the command is executed.
 	tab: call this method when tab is pressed.
-	quick: call this method after each keypress in the QuickCommandConsole.
+	quick: call this method after each keypress.
 
 The return values for tab() can be either:
 	None: There is no tab completion
@@ -69,9 +69,6 @@ class cd(Command):
 
 	The cd command changes the directory.
 	The command 'cd -' is equivalent to typing ``.
-
-	In the quick console, the directory will be entered without the
-	need to press enter, as soon as there is one unambiguous match.
 	"""
 
 	def execute(self):
@@ -255,10 +252,8 @@ class find(Command):
 	:find <string>
 
 	The find command will attempt to find a partial, case insensitive
-	match in the filenames of the current directory.
-
-	In the quick command console, once there is one unambiguous match,
-	the file will be run automatically.
+	match in the filenames of the current directory and execute the
+	file automatically.
 	"""
 
 	count = 0
diff --git a/ranger/help/console.py b/ranger/help/console.py
index c830abfc..bc69f7fb 100644
--- a/ranger/help/console.py
+++ b/ranger/help/console.py
@@ -13,59 +13,33 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 """
-3. Basic movement and browsing
+3. The Console
 
-3.1. Overview of all the Console Modes
+3.1. General Information
 3.2. List of Commands
-3.3. The (Quick) Command Console
-3.4. The Open Console
-3.5. The Quick Open Console
-
+3.3. Macros
+3.4. The more complicated Commands in Detail
 
 ==============================================================================
-3.1. Overview of all the Console Modes:
-
-There are, as of now, five different types of consoles:
-
-3.1.1. The Command Console, opened by pressing ":"
-      Usable for entering commands like you know it from vim.
-      Use the tab key to cycle through all available commands
-      and press F1 to view the docstring of the current command.
-
-3.1.2. The Quick Command Console, opened with ">"
-      Works just like 3.1.1, but it saves you pressing <RETURN> by checking
-      whether the current input can be executed in a meaningful way
-      and doing so automatically.  (works with commands like cd, find.)
-
-3.1.3. The Search Console, opened with "/"
-      Very much like the console you get in vim after pressing "/".
-      The current directory will be searched for files whose names
-      match the given regular expression.
+3.1. General Information
 
-3.1.4. The Open Console, activated with "!"
-      Similar to ":!..." in vim.  The given command will be executed,
-      "%s" will be replaced with all the files in the selection,
-      "%f" is replaced with only the current highlighted file.
-      There are further options to tweak how the command is executed.
+The console is opened by pressing ":".  Press <TAB> to cycle through all
+available commands and press <F1> to view help about the current command.
 
-3.1.5. The Quick Open Console, opened by pressing "r"
-      Rather than having to enter the full command, this console gives
-      you a higher level interface to running files.
-      You can define the application, the mode and the flags separated
-      with spaces.
+All commands are defined in the file ranger/defaults/commands.py, which
+also contains a detailed specification.
 
 
 ==============================================================================
 3.2. List of Commands
 
-This is a list of the few commands which are implemented by default.
-All commands except for ":delete" can be abbreviated to the shortest
+All commands except for ":delete" can be abbreviated with the shortest
 unambiguous name, e.g. ":chmod" can be written as ":ch" but not as ":c" since
 it conflicts with ":cd".
 
 
 :cd <dirname>
-      Changes the directory to <dirname> *
+      Changes the directory to <dirname>
 
 :chmod <octal_number>
       Sets the permissions of the selection to the octal number.
@@ -86,10 +60,9 @@ it conflicts with ":cd".
 :filter <string>
       Displays only files which contain <string> in their basename.
 
-:find <string>
-      Look for a partial, case insensitive match in the filenames
-      of the current directory and execute it if there is only
-      one match. *
+:find <regexp>
+      Quickly find files that match the regexp and execute the first
+	  unambiguous match.
 
 :grep <string>
       Looks for a string in all marked files or directory.
@@ -104,65 +77,34 @@ it conflicts with ":cd".
 :mkdir <dirname>
       Creates a directory with the name <dirname>
 
+:open_with [<program>] [<flags>] [<mode>]
+      Open the current file with the program, flags and mode. |24?| |25?|
+      All arguments are optional.  If none is given, its equivalent to
+      pressing <Enter>
+
 :quit
       Exits ranger
 
 :rename <newname>
       Changes the name of the currently highlighted file to <newname>
 
+:search <regexp>
+      Search for a regexp in all file names, like the / key in vim.
+
+:shell [-<flags>] <command>
+      Run the command, optionally with some flags.  |25?|
+      Example: shell -d firefox -safe-mode %s
+      opens (detached from ranger) the selection in firefox' safe-mode
+
 :terminal
       Spawns "x-terminal-emulator" starting in the current directory.
 
 :touch <filename>
       Creates a file with the name <filename>
 
-* implements handler for the Quick Command Console.
-
-
-==============================================================================
-3.3. The (Quick) Command Console
-
-Open these consoles by pressing ":" or ">"
-
-The Command Console and the "Quick" Command Console are mostly identical
-since they share the commands.  As explained in 3.1.2, the point in using
-the Quick Command Console is that the command is executed without the
-need to press <RETURN> as soon as ranger thinks you want it executed.
-
-Take the "find" command, for example.  It will attempt to find a file
-or directory which matches the given input, and if there is one unambiguous
-match, that file will be executed or that directory will be entered.
-If you use the "find" command in the quick console, as soon as there is
-one unambiguous match, <RETURN> will be pressed for you, giving you a
-very fast way to browse your files.
-
-
-All commands are defined in ranger/defaults/commands.py.  You can refer to this
-file for a list of commands.  Implementing new commands should be intuitive:
-Create a new class, a subclass of Command, and define the execute method
-is usually enough.  For parsing command input, the command parser in
-ranger/ext/command_parser.py is used.  The tab method should return None,
-a string or an iterable sequence containing the strings which should be
-cycled through by pressing tab.
-
-Only those commands which implement the quick() method will be specially
-treated by the Quick Command Console.  For the rest, both consoles are equal.
-quick() is called after each key press and if it returns True, the
-command will be executed immediately.
-
-
-Pressing F1 inside the console displays the docstring of the current command
-in the pager if docstrings are available (i.e.  unless python is run with
-the flag "-OO" which removes all docstrings.)
-
 
 ==============================================================================
-3.4. The Open Console
-
-Open this console by pressing "!" or "s"
-
-The Open Console allows you to execute shell commands:
-!vim *         will run vim and open all files in the directory.
+3.3. Macros
 
 Like in similar filemanagers there are some macros.  Use them in
 commands and they will be replaced with a list of files.
@@ -184,56 +126,42 @@ between. Examples:
 are in different directories:
 
 	Yank the file A (type yy), move to the file B and use:
-	!p!diff %c %f
-
-There is a special syntax for more control:
-
-!d! mplayer    will run mplayer with flags (d means detached)
-!@ mplayer     will open the selected files with mplayer
-	       (equivalent to !mplayer %s)
-
-Those two can be combined:
-
-!d!@mplayer    will open the selection with a detached mplayer
-	       (again, this is equivalent to !d!mplayer %s)
-
-These keys open the console with a predefined text:
-	@	"!@"	Suffixes %s.  Good for things like "@mount"
-	#	"!p!"	Pipes output through a pager.  For commands with output.
-			Note: A plain "!p!" will be translated to "!p!cat %f"
-
-For a list of other flags than "d", check chapter 2.5 of the documentation
+	:shell -p diff %c %f
 
 
 ==============================================================================
-3.5. The Quick Open Console
-
-Open this console by pressing "r"
-
-The Quick Open Console allows you to open files with predefined programs
-and modes very quickly.  By adding flags to the command, you can specify
-precisely how the program is run, e.g. the d-flag will run it detached
-from the file manager.
-
-For a list of other flags than "d", check chapter 2.5 of the documentation
-
-The syntax is "open with: <application> <mode> <flags>".
-The parsing of the arguments is very flexible.  You can leave out one or
-more arguments (or even all of them) and it will fall back to default
-values.  You can switch the order as well.
-There is just one rule:
-
-If you supply the <application>, it has to be the first argument.
+3.4. The more complicated Commands in Detail
+
+3.3.1. "find"
+The find command is different than others: it doesn't require you to
+press <RETURN>.  To speed things up, it tries to guess when you're
+done typing and executes the command right away.
+The key "f" opens the console with ":find "
+
+3.3.2. "shell"
+The shell command accepts flags |25?| as the first argument if it starts
+with a "-". Example: ":shell -p cat somefile.txt" will use the "p"-flag,
+which pipes the output to the pager.
+There are some keys which open the console with the shell command:
+	"!" opens ":shell "
+	"@" opens ":shell  %s"
+	"#" opens ":shell -p "
+
+3.3.3. "open_with"
+The open_with command opens the current file with the specified program,
+mode |24?| and flags |25?|. 
+The programs and the meaning of modes can be defined in the apps.py,
+giving you a high level interface for running files.
+Pressing "r" will open the console with ":open_with "
 
 Examples:
 
-open with: mplayer D     open the selection in mplayer, but not detached
-open with: 1             open it with the default handler in mode 1
-open with: d             open it detached with the default handler
-open with: p             open it as usual, but pipe the output to "less"
-open with: totem 1 Ds    open in totem in mode 1, will not detach the
-			 process (flag D) but discard the output (flag s)
-
+:open_with mplayer D     open the selection in mplayer, but not detached
+:open_with 1             open it with the default handler in mode 1
+:open_with d             open it detached with the default handler
+:open_with p             open it as usual, but pipe the output to "less"
+:open_with totem 1 Ds    open in totem in mode 1, will not detach the
+                         process (flag D) but discard the output (flag s)
 
 ==============================================================================
 """
='#n631'>631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153