105 | | again when finished. You can then assign the macro to any key you like |
106 | | by pressing that key. The macro is executed when you press |
107 | | .B Ctrl\-A |
108 | | and then the assigned key. The macro is also executed if you press |
109 | | Meta, Ctrl, or Esc and the assigned key, provided that the key is not |
110 | | used for any other function. The macro commands are stored in the file |
111 | | .BR ~/.local/share/mc/mcedit/mcedit.macros . |
112 | | Do NOT edit this file if you are going to use macros again in the same |
113 | | editing session, because |
114 | | .B mcedit |
115 | | caches macro key defines in memory. |
116 | | .B mcedit |
117 | | now overwrites a macro if a macro with the same key already exists, |
118 | | so you won't have to edit this file. You will also have to restart |
119 | | other running editors for macros to take effect. |
120 | | .P |
121 | | .B F19 |
122 | | will format C, C++, Java or HTML code when it is highlighted. An executable |
123 | | file called |
124 | | .B ~/.local/share/mc/mcedit/edit.indent.rc |
125 | | will be created for you from the default template. Feel free to edit it |
126 | | if you need. |
127 | | .PP |
128 | | .B C\-p |
129 | | will run ispell on a block of text in a similar way. The script file |
130 | | will be called |
131 | | .BR ~/.local/share/mc/mcedit/edit.spell.rc . |
| 106 | again when finished. The macro can be assigned to any key by pressing that key. |
| 107 | The macro is executed when you press the assigned key. |
| 108 | .PP |
| 109 | The macro commands are stored in section |
| 110 | .B [editor] |
| 111 | it the file |
| 112 | .BR ~/.local/share/macros.mc . |
| 113 | .PP |
| 114 | External scripts (filters) can be assigned into the any hotkey by edit |
| 115 | .B macros.mc |
| 116 | like following: |
| 117 | .PP |
| 118 | .nf |
| 119 | [editor] |
| 120 | ctrl\-W=EditPipeBlock:25; |
| 121 | .fi |
| 122 | .PP |
| 123 | This means that ctrl\-W hotkey initiates the |
| 124 | .I EditPipeBlock(25) |
| 125 | action, next the editor handler translates this into execution of |
| 126 | .B ~/.local/share/mc/mcedit/macros.d/macro.25.sh |
| 127 | shell script. |
| 128 | .PP |
| 129 | External scripts stored into |
| 130 | .B ~/.local/share/mc/mcedit/macros.d/ |
| 131 | directory and must named |
| 132 | .B macro.XXXX.sh |
| 133 | where |
| 134 | .B XXXX |
| 135 | is the number from 0 to 9999. |
| 136 | See |
| 137 | .B Menu File Edit |
| 138 | for more detail about format of the script. |
| 139 | .PP |
| 140 | Next macro definition can be used: |
| 141 | .TP |
| 142 | .I %c |
| 143 | The cursor column position number. |
| 144 | .TP |
| 145 | .I %i |
| 146 | The indent of blank space, equal the cursor column. |
| 147 | .TP |
| 148 | .I %y |
| 149 | The syntax type of current file. |
| 150 | .TP |
| 151 | .I %b |
| 152 | The block file name. |
| 153 | .TP |
| 154 | .I %f |
| 155 | The current file name. |
| 156 | .TP |
| 157 | .I %n |
| 158 | Only the current file name without extension. |
| 159 | .TP |
| 160 | .I %x |
| 161 | The extension of current file name. |
| 162 | .TP |
| 163 | .I %d |
| 164 | The current directory name. |
| 165 | .TP |
| 166 | .I %F |
| 167 | The current file in the unselected panel. |
| 168 | .TP |
| 169 | .I %D |
| 170 | The directory name of the unselected panel. |
| 171 | .TP |
| 172 | .I %t |
| 173 | The currently tagged files. |
| 174 | .TP |
| 175 | .I %T |
| 176 | The tagged files in the unselected panel. |
| 177 | .TP |
| 178 | .I %u |
| 179 | and |
| 180 | .I %U |
| 181 | Similar to the |
| 182 | .I %t |
| 183 | and |
| 184 | .I %T |
| 185 | macros, but in addition the files are untagged. You can use this macro |
| 186 | only once per menu file entry or extension file entry, because next time |
| 187 | there will be no tagged files. |
| 188 | .TP |
| 189 | .I %s |
| 190 | and |
| 191 | .I %S |
| 192 | The selected files: The tagged files if there are any. Otherwise the |
| 193 | current file. |
| 194 | .PP |
| 195 | Feel free to edit this files, if you need. |
| 196 | Here is a sample external script: |
| 197 | .PP |
| 198 | .nf |
| 199 | l comment selection |
| 200 | TMPFILE=`mktemp ${MC_TMPDIR:\-/tmp}/up.XXXXXX` || exit 1 |
| 201 | echo #if 0 > $TMPFILE |
| 202 | cat %b >> $TMPFILE |
| 203 | echo #endif >> $TMPFILE |
| 204 | cat $TMPFILE > %b |
| 205 | rm \-f $TMPFILE |
| 206 | .fi |