Restore curses after running external command
[ncmpcpp.git] / doc / bindings
blobab21cbf6660be164de54098b43169f51ff6a6e4e
1 ##############################################################
2 ## This is the example bindings file. Copy it to            ##
3 ## ~/.ncmpcpp/bindings or $XDG_CONFIG_HOME/ncmpcpp/bindings ##
4 ## and set up your preferences                              ##
5 ##############################################################
6 ##
7 ##### General rules #####
8 ##
9 ## 1) Because each action has runtime checks whether it's
10 ##    ok to run it, a few actions can be bound to one key.
11 ##    Actions will be bound in order given in configuration
12 ##    file. When a key is pressed, first action in order
13 ##    will test itself whether it's possible to run it. If
14 ##    test succeeds, action is executed and other actions
15 ##    bound to this key are ignored. If it doesn't, next
16 ##    action in order tests itself etc.
18 ## 2) It's possible to bind more that one action at once
19 ##    to a key. It can be done using the following syntax:
21 ##    def_key "key"
22 ##      action1
23 ##      action2
24 ##      ...
26 ##    This creates a chain of actions. When such chain is
27 ##    executed, each action in chain is run until the end of
28 ##    chain is reached or one of its actions fails to execute
29 ##    due to its requirements not being met. If multiple actions
30 ##    and/or chains are bound to the same key, they will be
31 ##    consecutively run until one of them gets fully executed.
33 ## 3) When ncmpcpp starts, bindings configuration file is
34 ##    parsed and then ncmpcpp provides "missing pieces"
35 ##    of default keybindings. If you want to disable some
36 ##    bindings, there is a special action called 'dummy'
37 ##    for that purpose. Eg. if you want to disable ability
38 ##    to crop playlists, you need to put the following
39 ##    into configuration file:
41 ##    def_key "C"
42 ##      dummy
44 ##    After that ncmpcpp will not bind any default action
45 ##    to this key.
47 ## 4) To let you write simple macros, the following special
48 ##    actions are provided:
50 ##    - push_character "character" - pushes given special
51 ##      character into input queue, so it will be immediately
52 ##      picked by ncmpcpp upon next call to readKey function.
53 ##      Accepted values: mouse, up, down, page_up, page_down,
54 ##      home, end, space, enter, insert, delete, left, right,
55 ##      tab, ctrl-a, ctrl-b, ..., ctrl-z, ctrl-[, ctrl-\\,
56 ##      ctrl-], ctrl-^, ctrl-_, f1, f2, ..., f12, backspace.
57 ##      In addition, most of these names can be prefixed with
58 ##      alt-/ctrl-/shift- to be recognized with the appropriate
59 ##      modifier key(s).
61 ##    - push_characters "string" - pushes given string into
62 ##      input queue.
64 ##    - require_runnable "action" - checks whether given action
65 ##      is runnable and fails if it isn't. This is especially
66 ##      useful when mixed with previous two functions. Consider
67 ##      the following macro definition:
69 ##      def_key "key"
70 ##        push_characters "custom_filter"
71 ##        apply_filter
73 ##      If apply_filter can't be currently run, we end up with
74 ##      sequence of characters in input queue which will be
75 ##      treated just as we typed them. This may lead to unexpected
76 ##      results (in this case 'c' will most likely clear current
77 ##      playlist, 'u' will trigger database update, 's' will stop
78 ##      playback etc.). To prevent such thing from happening, we
79 ##      need to change above definition to this one:
81 ##      def_key "key"
82 ##        require_runnable "apply_filter"
83 ##        push_characters "custom_filter"
84 ##        apply_filter
86 ##      Here, first we test whether apply_filter can be actually run
87 ##      before we stuff characters into input queue, so if condition
88 ##      is not met, whole chain is aborted and we're fine.
90 ##    - require_screen "screen" - checks whether given screen is
91 ##      currently active. accepted values: browser, clock, help,
92 ##      media_library, outputs, playlist, playlist_editor,
93 ##      search_engine, tag_editor, visualizer, last_fm, lyrics,
94 ##      selected_items_adder, server_info, song_info,
95 ##      sort_playlist_dialog, tiny_tag_editor.
97 ##    - run_external_command "command" - runs given command using
98 ##      system() function.
100 ## 5) In addition to binding to a key, you can also bind actions
101 ##    or chains of actions to a command. If it comes to commands,
102 ##    syntax is very similar to defining keys. Here goes example
103 ##    definition of a command:
105 ##      def_command "quit" [deferred]
106 ##        stop
107 ##        quit
109 ##    If you execute the above command (which can be done by
110 ##    invoking action execute_command, typing 'quit' and pressing
111 ##    enter), ncmpcpp will stop the player and then quit. Note the
112 ##    presence of word 'deferred' enclosed in square brackets. It
113 ##    tells ncmpcpp to wait for confirmation (ie. pressing enter)
114 ##    after you typed quit. Instead of 'deferred', 'immediate'
115 ##    could be used. Then ncmpcpp will not wait for confirmation
116 ##    (enter) and will execute the command the moment it sees it.
118 ##    Note: while command chains are executed, internal environment
119 ##    update (which includes current window refresh and mpd status
120 ##    update) is not performed for performance reasons. However, it
121 ##    may be desirable to do so in some situration. Therefore it's
122 ##    possible to invoke by hand by performing 'update enviroment'
123 ##    action.
125 ## Note: There is a difference between:
127 ##         def_key "key"
128 ##           action1
130 ##         def_key "key"
131 ##           action2
133 ##       and
135 ##         def_key "key"
136 ##           action1
137 ##           action2
139 ##      First one binds two single actions to the same key whilst
140 ##      second one defines a chain of actions. The behavior of
141 ##      these two is different and is described in (1) and (2).
143 ## Note: Function def_key accepts non-ascii characters.
145 ##### List of unbound actions #####
147 ## The following actions are not bound to any key/command:
149 ##  - set_volume
152 #def_key "mouse"
153 #  mouse_event
155 #def_key "up"
156 #  scroll_up
158 #def_key "shift-up"
159 #  select_item
160 #  scroll_up
162 #def_key "down"
163 #  scroll_down
165 #def_key "shift-down"
166 #  select_item
167 #  scroll_down
169 #def_key "["
170 #  scroll_up_album
172 #def_key "]"
173 #  scroll_down_album
175 #def_key "{"
176 #  scroll_up_artist
178 #def_key "}"
179 #  scroll_down_artist
181 #def_key "page_up"
182 #  page_up
184 #def_key "page_down"
185 #  page_down
187 #def_key "home"
188 #  move_home
190 #def_key "end"
191 #  move_end
193 #def_key "insert"
194 #  select_item
196 #def_key "enter"
197 #  enter_directory
199 #def_key "enter"
200 #  toggle_output
202 #def_key "enter"
203 #  run_action
205 #def_key "enter"
206 #  play_item
208 #def_key "space"
209 #  add_item_to_playlist
211 #def_key "space"
212 #  toggle_lyrics_update_on_song_change
214 #def_key "space"
215 #  toggle_visualization_type
217 #def_key "delete"
218 #  delete_playlist_items
220 #def_key "delete"
221 #  delete_browser_items
223 #def_key "delete"
224 #  delete_stored_playlist
226 #def_key "right"
227 #  next_column
229 #def_key "right"
230 #  slave_screen
232 #def_key "right"
233 #  volume_up
235 #def_key "+"
236 #  volume_up
238 #def_key "left"
239 #  previous_column
241 #def_key "left"
242 #  master_screen
244 #def_key "left"
245 #  volume_down
247 #def_key "-"
248 #  volume_down
250 #def_key ":"
251 #  execute_command
253 #def_key "tab"
254 #  next_screen
256 #def_key "shift-tab"
257 #  previous_screen
259 #def_key "f1"
260 #  show_help
262 #def_key "1"
263 #  show_playlist
265 #def_key "2"
266 #  show_browser
268 #def_key "2"
269 #  change_browse_mode
271 #def_key "3"
272 #  show_search_engine
274 #def_key "3"
275 #  reset_search_engine
277 #def_key "4"
278 #  show_media_library
280 #def_key "4"
281 #  toggle_media_library_columns_mode
283 #def_key "5"
284 #  show_playlist_editor
286 #def_key "6"
287 #  show_tag_editor
289 #def_key "7"
290 #  show_outputs
292 #def_key "8"
293 #  show_visualizer
295 #def_key "="
296 #  show_clock
298 #def_key "@"
299 #  show_server_info
301 #def_key "s"
302 #  stop
304 #def_key "p"
305 #  pause
307 #def_key ">"
308 #  next
310 #def_key "<"
311 #  previous
313 #def_key "ctrl-h"
314 #  jump_to_parent_directory
316 #def_key "ctrl-h"
317 #  replay_song
319 #def_key "backspace"
320 #  jump_to_parent_directory
322 #def_key "backspace"
323 #  replay_song
325 #def_key "f"
326 #  seek_forward
328 #def_key "b"
329 #  seek_backward
331 #def_key "r"
332 #  toggle_repeat
334 #def_key "z"
335 #  toggle_random
337 #def_key "y"
338 #  save_tag_changes
340 #def_key "y"
341 #  start_searching
343 #def_key "y"
344 #  toggle_single
346 #def_key "R"
347 #  toggle_consume
349 #def_key "Y"
350 #  toggle_replay_gain_mode
352 #def_key "T"
353 #  toggle_add_mode
355 #def_key "|"
356 #  toggle_mouse
358 #def_key "#"
359 #  toggle_bitrate_visibility
361 #def_key "Z"
362 #  shuffle
364 #def_key "x"
365 #  toggle_crossfade
367 #def_key "X"
368 #  set_crossfade
370 #def_key "u"
371 #  update_database
373 #def_key "ctrl-s"
374 #  sort_playlist
376 #def_key "ctrl-s"
377 #  toggle_browser_sort_mode
379 #def_key "ctrl-s"
380 #  toggle_media_library_sort_mode
382 #def_key "ctrl-r"
383 #  reverse_playlist
385 #def_key "ctrl-f"
386 #  apply_filter
388 #def_key "ctrl-_"
389 #  select_found_items
391 #def_key "/"
392 #  find
394 #def_key "/"
395 #  find_item_forward
397 #def_key "?"
398 #  find
400 #def_key "?"
401 #  find_item_backward
403 #def_key "."
404 #  next_found_item
406 #def_key ","
407 #  previous_found_item
409 #def_key "w"
410 #  toggle_find_mode
412 #def_key "e"
413 #  edit_song
415 #def_key "e"
416 #  edit_library_tag
418 #def_key "e"
419 #  edit_library_album
421 #def_key "e"
422 #  edit_directory_name
424 #def_key "e"
425 #  edit_playlist_name
427 #def_key "e"
428 #  edit_lyrics
430 #def_key "i"
431 #  show_song_info
433 #def_key "I"
434 #  show_artist_info
436 #def_key "g"
437 #  jump_to_position_in_song
439 #def_key "l"
440 #  show_lyrics
442 #def_key "ctrl-v"
443 #  select_range
445 #def_key "v"
446 #  reverse_selection
448 #def_key "V"
449 #  remove_selection
451 #def_key "B"
452 #  select_album
454 #def_key "a"
455 #  add_selected_items
457 #def_key "c"
458 #  clear_playlist
460 #def_key "c"
461 #  clear_main_playlist
463 #def_key "C"
464 #  crop_playlist
466 #def_key "C"
467 #  crop_main_playlist
469 #def_key "m"
470 #  move_sort_order_up
472 #def_key "m"
473 #  move_selected_items_up
475 #def_key "n"
476 #  move_sort_order_down
478 #def_key "n"
479 #  move_selected_items_down
481 #def_key "M"
482 #  move_selected_items_to
484 #def_key "A"
485 #  add
487 #def_key "S"
488 #  save_playlist
490 #def_key "o"
491 #  jump_to_playing_song
493 #def_key "G"
494 #  jump_to_browser
496 #def_key "G"
497 #  jump_to_playlist_editor
499 #def_key "~"
500 #  jump_to_media_library
502 #def_key "E"
503 #  jump_to_tag_editor
505 #def_key "U"
506 #  toggle_playing_song_centering
508 #def_key "P"
509 #  toggle_display_mode
511 #def_key "\\"
512 #  toggle_interface
514 #def_key "!"
515 #  toggle_separators_between_albums
517 #def_key "L"
518 #  toggle_lyrics_fetcher
520 #def_key "F"
521 #  fetch_lyrics_in_background
523 #def_key "alt-l"
524 #  toggle_fetching_lyrics_in_background
526 #def_key "ctrl-l"
527 #  toggle_screen_lock
529 #def_key "`"
530 #  toggle_library_tag_type
532 #def_key "`"
533 #  refetch_lyrics
535 #def_key "`"
536 #  add_random_items
538 #def_key "ctrl-p"
539 #  set_selected_items_priority
541 #def_key "q"
542 #  quit