neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

register_defs.h (2967B)


      1 #pragma once
      2 
      3 #include "nvim/api/private/defs.h"
      4 #include "nvim/normal_defs.h"
      5 #include "nvim/os/time_defs.h"
      6 
      7 /// flags for do_put()
      8 enum {
      9  PUT_FIXINDENT    = 1,   ///< make indent look nice
     10  PUT_CURSEND      = 2,   ///< leave cursor after end of new text
     11  PUT_CURSLINE     = 4,   ///< leave cursor on last line of new text
     12  PUT_LINE         = 8,   ///< put register as lines
     13  PUT_LINE_SPLIT   = 16,  ///< split line for linewise register
     14  PUT_LINE_FORWARD = 32,  ///< put linewise register below Visual sel.
     15  PUT_BLOCK_INNER  = 64,  ///< in block mode, do not add trailing spaces
     16 };
     17 
     18 /// Registers:
     19 ///      0 = register for latest (unnamed) yank
     20 ///   1..9 = registers '1' to '9', for deletes
     21 /// 10..35 = registers 'a' to 'z'
     22 ///     36 = delete register '-'
     23 ///     37 = selection register '*'
     24 ///     38 = clipboard register '+'
     25 enum {
     26  DELETION_REGISTER   = 36,
     27  NUM_SAVED_REGISTERS = 37,
     28  // The following registers should not be saved in ShaDa file:
     29  STAR_REGISTER       = 37,
     30  PLUS_REGISTER       = 38,
     31  NUM_REGISTERS       = 39,
     32 };
     33 
     34 /// Flags for get_reg_contents().
     35 enum GRegFlags {
     36  kGRegNoExpr  = 1,  ///< Do not allow expression register.
     37  kGRegExprSrc = 2,  ///< Return expression itself for "=" register.
     38  kGRegList    = 4,  ///< Return list.
     39 };
     40 
     41 /// structure used by block_prep, op_delete and op_yank for blockwise operators
     42 /// also op_change, op_shift, op_insert, op_replace - AKelly
     43 struct block_def {
     44  int startspaces;           ///< 'extra' cols before first char
     45  int endspaces;             ///< 'extra' cols after last char
     46  int textlen;               ///< chars in block
     47  char *textstart;           ///< pointer to 1st char (partially) in block
     48  colnr_T textcol;           ///< index of chars (partially) in block
     49  colnr_T start_vcol;        ///< start col of 1st char wholly inside block
     50  colnr_T end_vcol;          ///< start col of 1st char wholly after block
     51  int is_short;              ///< true if line is too short to fit in block
     52  int is_MAX;                ///< true if curswant==MAXCOL when starting
     53  int is_oneChar;            ///< true if block within one character
     54  int pre_whitesp;           ///< screen cols of ws before block
     55  int pre_whitesp_c;         ///< chars of ws before block
     56  colnr_T end_char_vcols;    ///< number of vcols of post-block char
     57  colnr_T start_char_vcols;  ///< number of vcols of pre-block char
     58 };
     59 
     60 /// Definition of one register
     61 typedef struct {
     62  String *y_array;          ///< Pointer to an array of Strings.
     63  size_t y_size;            ///< Number of lines in y_array.
     64  MotionType y_type;        ///< Register type
     65  colnr_T y_width;          ///< Register width (only valid for y_type == kBlockWise).
     66  Timestamp timestamp;      ///< Time when register was last modified.
     67  AdditionalData *additional_data;  ///< Additional data from ShaDa file.
     68 } yankreg_T;
     69 
     70 /// Modes for get_yank_register()
     71 typedef enum {
     72  YREG_PASTE,
     73  YREG_YANK,
     74  YREG_PUT,
     75 } yreg_mode_t;