Пример #1
0
Sheet.addCommand('zy', 'copy-cell', 'copyCells(cursorCol, [cursorRow])',
                 'yank (copy) current cell to clipboard')
Sheet.addCommand('zp', 'paste-cell',
                 'cursorCol.setValuesTyped([cursorRow], vd.clipcells[0])',
                 'set contents of current cell to last clipboard value')
Sheet.addCommand(
    'zd', 'delete-cell',
    'vd.clipcells = [cursorDisplay]; cursorCol.setValues([cursorRow], None)',
    'delete (cut) current cell and move it to clipboard')
Sheet.addCommand(
    'gzd', 'delete-cells',
    'vd.clipcells = list(vd.sheet.cursorCol.getDisplayValue(r) for r in selectedRows); cursorCol.setValues(selectedRows, None)',
    'delete (cut) contents of current column for selected rows and move them to clipboard'
)

Sheet.bindkey('BUTTON2_PRESSED', 'go-mouse')
Sheet.addCommand(
    'BUTTON2_RELEASED', 'syspaste-cells',
    'pasteFromClipboard(visibleCols[cursorVisibleColIndex:], rows[cursorRowIndex:])',
    'paste into VisiData from system clipboard')
Sheet.bindkey('BUTTON2_CLICKED', 'go-mouse')

Sheet.addCommand(
    'gzy', 'copy-cells', 'copyCells(cursorCol, selectedRows)',
    'yank (copy) contents of current column for selected rows to clipboard')
Sheet.addCommand(
    'gzp', 'setcol-clipboard',
    'for r, v in zip(selectedRows, itertools.cycle(vd.clipcells)): cursorCol.setValuesTyped([r], v)',
    'set cells of current column for selected rows to last clipboard value')

Sheet.addCommand(
Пример #2
0
Sheet.addCommand('gy', 'copy-selected', 'vd.cliprows = list((None, i, r) for i, r in enumerate(selectedRows)); status("%d %s to clipboard" % (len(vd.cliprows), rowtype))')

Sheet.addCommand('zy', 'copy-cell', 'vd.clipcells = [cursorDisplay]')
Sheet.addCommand('zp', 'paste-cell', 'cursorCol.setValuesTyped([cursorRow], vd.clipcells[0])')
Sheet.addCommand('zd', 'delete-cell', 'vd.clipcells = [cursorDisplay]; cursorCol.setValues([cursorRow], None)')
Sheet.addCommand('gzd', 'delete-cells', 'vd.clipcells = list(sheet.cursorCol.getDisplayValue(r) for r in selectedRows); cursorCol.setValues(selectedRows, None)')

Sheet.addCommand('gzy', 'copy-cells', 'vd.clipcells = [sheet.cursorCol.getDisplayValue(r) for r in selectedRows]; status("%d values to clipboard" % len(vd.clipcells))')
Sheet.addCommand('gzp', 'paste-cells', 'for r, v in zip(selectedRows or rows, itertools.cycle(vd.clipcells)): cursorCol.setValuesTyped([r], v)')

Sheet.addCommand('Y', 'syscopy-row', 'saveToClipboard(sheet, [cursorRow], input("copy current row to system clipboard as filetype: ", value=options.save_filetype))')
Sheet.addCommand('gY', 'syscopy-selected', 'saveToClipboard(sheet, selectedRows or rows, input("copy rows to system clipboard as filetype: ", value=options.save_filetype))')
Sheet.addCommand('zY', 'syscopy-cell', 'copyToClipboard(cursorDisplay)')
Sheet.addCommand('gzY', 'syscopy-cells', 'copyToClipboard("\\n".join(sheet.cursorCol.getDisplayValue(r) for r in selectedRows))')

Sheet.bindkey('KEY_DC', 'delete-cell'),
Sheet.bindkey('gKEY_DC', 'delete-cells'),


option('clipboard_copy_cmd', '', 'command to copy stdin to system clipboard')

__clipboard_commands = [
    ('win32',  'clip', ''),                                      # Windows Vista+
    ('darwin', 'pbcopy', 'w'),                                   # macOS
    (None,     'xclip', '-selection clipboard -filter'),         # Linux etc.
    (None,     'xsel', '--clipboard --input'),                   # Linux etc.
]

def detect_command(cmdlist):
    '''Detect available clipboard util and return cmdline to copy data to the system clipboard.
    cmddict is list of (platform, progname, argstr).'''
Пример #3
0
BaseSheet.bindkey('KEY_UP', 'go-up')
BaseSheet.bindkey('KEY_RIGHT', 'go-right')
BaseSheet.bindkey('KEY_HOME', 'go-leftmost')
BaseSheet.bindkey('KEY_END', 'go-rightmost')
BaseSheet.bindkey('KEY_NPAGE', 'go-pagedown')
BaseSheet.bindkey('KEY_PPAGE', 'go-pageup')

BaseSheet.bindkey('kHOM5', 'go-top')  # Ctrl+Home
BaseSheet.bindkey('KEY_EOL', 'go-bottom')  # Ctrl+End

BaseSheet.bindkey('gKEY_LEFT', 'go-leftmost'),
BaseSheet.bindkey('gKEY_RIGHT', 'go-rightmost'),
BaseSheet.bindkey('gKEY_UP', 'go-top'),
BaseSheet.bindkey('gKEY_DOWN', 'go-bottom'),

Sheet.bindkey('BUTTON1_CLICKED', 'go-mouse')
Sheet.bindkey('BUTTON3_PRESSED', 'go-mouse')

# vim-style scrolling with the 'z' prefix
Sheet.addCommand('zz', 'scroll-middle',
                 'sheet.topRowIndex = cursorRowIndex-int(nScreenRows/2)',
                 'scroll current row to center of screen')

Sheet.addCommand(
    None, 'go-right-page',
    'sheet.cursorVisibleColIndex = sheet.leftVisibleColIndex = rightVisibleColIndex',
    'scroll cursor one page right')
Sheet.addCommand(None, 'go-left-page', 'pageLeft()',
                 'scroll cursor one page left')
Sheet.addCommand('zh', 'scroll-left',
                 'sheet.cursorVisibleColIndex -= options.scroll_incr',