# -*- coding: utf-8 -*- # Copyright (C) 2009, 2010 Roman Zimbelmann # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . """ This is the default key configuration file of ranger. Syntax for binding keys: map(*keys, fnc) Examples for keys: "x", "gg", "", "", "" fnc is a function which is called with the CommandArgs object. The CommandArgs object has these attributes: arg.fm: the file manager instance arg.wdg: the current widget arg.n: the number typed before the key combination (if allowed) arg.direction: the direction object (if applicable) arg.keys: the string representation of the used key combination arg.keybuffer: the keybuffer instance Direction keys are special. They must be mapped with: map.dir(*keys, **args) where args is a dict of values such as up, down, to, absolute, relative... Example: map.dir('gg', to=0) Direction keys can be accessed in a mapping that contians "". Other special keys are "" which matches any single key and "" which will run the function passively, without clearing the keybuffer. Additionally, there are shortcuts for accessing methods of the current file manager and widget instance: map('xyz', fm.method(foo=bar)) will be translated to: map('xyz', lamdba arg: arg.fm.method(foo=bar)) If possible, arg.n and arg.direction are automatically inserted. Example scenario ---------------- If this keys are defined: map("dd", "d", fm.cut(foo=bar)) map.dir("gg", to=0) Type in the keys on the left and the function on the right will be executed: dd => fm.cut(foo=bar) 5dd => fm.cut(foo=bar, narg=5) dgg => fm.cut(foo=bar, dirarg=Direction(to=0)) 5dgg => fm.cut(foo=bar, narg=5, dirarg=Direction(to=0)) 5d3gg => fm.cut(foo=bar, narg=5, dirarg=Direction(to=3)) Example ~/.config/ranger/keys.py ------------------------- from ranger.api.keys import * keymanager.map("browser", "d", fm.move(down=0.5, pages=True)) # Add less-like d/u keys to the "browser" context: map = keymanager.get_context('browser') map("d", fm.move(down=0.5, pages=True)) map("u", fm.move(up=0.5, pages=True)) # Add keys to all contexts map = KeyMapWithDirections() # create new empty keymap. map("q", fm.exit()) map.dir("", down=3) # I'm quick, I want to move 3 at once! keymanager.merge_all(map) # merge the new map into all existing ones. """ from ranger.api.keys import * # =================================================================== # == Define keys for everywhere: # =================================================================== map = global_keys = KeyMapWithDirections() map('Q', fm.exit()) map('', fm.redraw_window()) map('', alias='') # Backspace is bugged sometimes #map('', wdg.move()) @map('') # move around with direction keys def move(arg): arg.wdg.move(narg=arg.n, **arg.direction) # -------------------------------------------------- direction keys map.dir('', down=1) map.dir('', up=1) map.dir('', left=1) map.dir('', right=1) map.dir('', down=0, absolute=True) map.dir('', down=-1, absolute=True) map.dir('', down=1, pages=True) map.dir('', down=-1, pages=True) map.dir('%', down=50, percentage=True, absolute=True) # =================================================================== # == Define aliases # =================================================================== map = vim_aliases = KeyMapWithDirections() map.dir('j', alias='') map.dir('k', alias='') map.dir('h', alias='') map.dir('l', alias='') map.dir('gg', alias='') map.dir('G', alias='') map.dir('', alias='') map.dir('', alias='') map = readline_aliases = KeyMapWithDirections() map.dir('', alias='') map.dir('', alias='') map.dir('', alias='') map.dir('', alias='') map.dir('', alias='') map.dir('', alias='') map = midnight_commander_fkeys = KeyMapWithDirections() map('', fm.display_help()) map('', fm.display_file()) map('', fm.edit_file()) map('', fm.copy()) map('', fm.cut()) map('', fm.open_console('mkdir ')) map('', fm.open_console(DELETE_WARNING)) map('', fm.exit()) # =================================================================== # == Define keys in "browser" context: # =================================================================== map = keymanager.get_context('browser') map.merge(global_keys) map.merge(vim_aliases) map.merge(midnight_commander_fkeys) # -------------------------------------------------------- movement map('gg', fm.move(to=0)) map('', wdg.move(right=0)) # run with mode=0 map('', 'J', fm.move(down=0.5, pages=True)) map('', 'K', fm.move(up=0.5, pages=True)) map(']', fm.move_parent(1)) map('[', fm.move_parent(-1)) map('}', fm.traverse()) map('{', fm.history_go(-1)) # --------------------------------------------------------- history map('H', fm.history_go(-1)) map('L', fm.history_go(1)) # ----------------------------------------------- tagging / marking map('t', fm.tag_toggle()) map('T', fm.tag_remove()) for key in ALLOWED_TAGS_KEYS: map('"' + key, fm.tag_toggle(tag=key)) map(' ', fm.mark(toggle=True)) map('v', fm.mark(all=True, toggle=True)) map('V', 'uv', fm.mark(all=True, val=False)) map('', fm.mark_in_direction(val=True)) map('u', fm.mark_in_direction(val=False)) # ------------------------------------------ file system operations map('y', fm.hint('*copy:* cop*y* *a*dd *r*emove ' \ '*p*ath_to_xsel *d*irpath_to_xsel base*n*ame_to_xsel')) map('yy', 'y', fm.copy()) map('ya', fm.copy(mode='add')) map('yr', fm.copy(mode='remove')) map('yp', fm.execute_console('shell -d echo -n %d/%f | xsel -i')) map('yd', fm.execute_console('shell -d echo -n %d | xsel -i')) map('yn', fm.execute_console('shell -d echo -n %f | xsel -i')) map('d', fm.hint('disk_*u*sage *cut:* *d*:cut *a*dd *r*emove')) map('dd', 'd', fm.cut()) map('da', fm.cut(mode='add')) map('dr', fm.cut(mode='remove')) map('p', fm.hint('*paste:* *p*aste *o*verwrite sym*l*inks ' \ '*h*ardlinks relative_sym*L*inks')) map('pp', fm.paste()) map('po', fm.paste(overwrite=True)) map('pl', fm.paste_symlink(relative=False)) map('pL', fm.paste_symlink(relative=True)) map('ph', fm.hint('*paste:* hard*l*inks')) map('phl', fm.paste_hardlink()) map('u', fm.hint("un*y*ank, unbook*m*ark, unselect:*v*")) map('ud', 'uy', fm.uncut()) # ------------------------------------ changing of file permissions # type "+ow" for "chmod o+w %s" and so on from itertools import product octal_help = 'Enter the octal mode number for chmod' symbolic_help = '%s %s to *r*ead, *w*rite, e*x*ecute' for mode in product('ugoa', 'rwxXst'): map('-%s%s' % mode, fm.execute_console('shell chmod %s-%s %%s' % mode)) map('+%s%s' % mode, fm.execute_console('shell chmod %s+%s %%s' % mode)) for n in product(range(8), range(8), range(8)): map('=%d%d%d' % n, fm.execute_console('shell chmod %d%d%d %%s' % n)) map('=%d' % n[0], fm.hint(octal_help)) map('=%d%d' % (n[0], n[1]), fm.hint(octal_help)) # hints: for who, name in zip('ugoa', ('user', 'group', 'others', 'all')): map('-%s' % who, fm.hint(symbolic_help % ('forbid', name))) map('+%s' % who, fm.hint(symbolic_help % ('allow', name))) map('-', '+', '=', fm.hint('change permission for *u*ser, ' '*g*roup, *o*thers, *a*ll')) map('=', fm.hint(octal_help)) # ---------------------------------------------------- run programs map('S', fm.execute_command(os.environ['SHELL'])) map(
/**
 * This file has no copyright assigned and is placed in the Public Domain.
 * This file is part of the w64 mingw-runtime package.
 * No warranty is given; refer to the file DISCLAIMER within this package.
 */
#ifndef _INC_STDIO_S
#define _INC_STDIO_S

#include <stdio.h>

#if defined(MINGW_HAS_SECURE_API)

#ifdef __cplusplus
extern "C" {
#endif

#ifndef _STDIO_S_DEFINED
#define _STDIO_S_DEFINED
  _CRTIMP errno_t __cdecl clearerr_s(FILE *_File);
  int __cdecl fprintf_s(FILE *_File,const char *_Format,...);
  size_t __cdecl fread_s(void *_DstBuf,size_t _DstSize,size_t _ElementSize,size_t _Count,FILE<