aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ops.h
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2023-11-29 22:39:54 +0000
committerJosh Rahm <joshuarahm@gmail.com>2023-11-29 22:39:54 +0000
commit21cb7d04c387e4198ca8098a884c78b56ffcf4c2 (patch)
tree84fe5690df1551f0bb2bdfe1a13aacd29ebc1de7 /src/nvim/ops.h
parentd9c904f85a23a496df4eb6be42aa43f007b22d50 (diff)
parent4a8bf24ac690004aedf5540fa440e788459e5e34 (diff)
downloadrneovim-colorcolchar.tar.gz
rneovim-colorcolchar.tar.bz2
rneovim-colorcolchar.zip
Merge remote-tracking branch 'upstream/master' into colorcolcharcolorcolchar
Diffstat (limited to 'src/nvim/ops.h')
-rw-r--r--src/nvim/ops.h146
1 files changed, 80 insertions, 66 deletions
diff --git a/src/nvim/ops.h b/src/nvim/ops.h
index 75ea1853a0..67a613cbca 100644
--- a/src/nvim/ops.h
+++ b/src/nvim/ops.h
@@ -1,78 +1,82 @@
-#ifndef NVIM_OPS_H
-#define NVIM_OPS_H
+#pragma once
#include <stdbool.h>
#include <stddef.h>
-#include "nvim/ascii.h"
-#include "nvim/eval/typval.h"
+#include "nvim/ascii_defs.h"
#include "nvim/eval/typval_defs.h"
-#include "nvim/ex_cmds_defs.h"
-#include "nvim/extmark.h"
-#include "nvim/macros.h"
-#include "nvim/normal.h"
-#include "nvim/os/time.h"
-#include "nvim/pos.h"
-#include "nvim/types.h"
+#include "nvim/ex_cmds_defs.h" // IWYU pragma: keep
+#include "nvim/extmark_defs.h" // IWYU pragma: keep
+#include "nvim/func_attr.h"
+#include "nvim/macros_defs.h"
+#include "nvim/normal_defs.h"
+#include "nvim/option_defs.h" // IWYU pragma: keep
+#include "nvim/os/time_defs.h"
+#include "nvim/pos_defs.h"
+#include "nvim/types_defs.h"
typedef int (*Indenter)(void);
-// flags for do_put()
-#define PUT_FIXINDENT 1 // make indent look nice
-#define PUT_CURSEND 2 // leave cursor after end of new text
-#define PUT_CURSLINE 4 // leave cursor on last line of new text
-#define PUT_LINE 8 // put register as lines
-#define PUT_LINE_SPLIT 16 // split line for linewise register
-#define PUT_LINE_FORWARD 32 // put linewise register below Visual sel.
-#define PUT_BLOCK_INNER 64 // in block mode, do not add trailing spaces
+/// flags for do_put()
+enum {
+ PUT_FIXINDENT = 1, ///< make indent look nice
+ PUT_CURSEND = 2, ///< leave cursor after end of new text
+ PUT_CURSLINE = 4, ///< leave cursor on last line of new text
+ PUT_LINE = 8, ///< put register as lines
+ PUT_LINE_SPLIT = 16, ///< split line for linewise register
+ PUT_LINE_FORWARD = 32, ///< put linewise register below Visual sel.
+ PUT_BLOCK_INNER = 64, ///< in block mode, do not add trailing spaces
+};
-// Registers:
-// 0 = register for latest (unnamed) yank
-// 1..9 = registers '1' to '9', for deletes
-// 10..35 = registers 'a' to 'z'
-// 36 = delete register '-'
-// 37 = selection register '*'
-// 38 = clipboard register '+'
-#define DELETION_REGISTER 36
-#define NUM_SAVED_REGISTERS 37
-// The following registers should not be saved in ShaDa file:
-#define STAR_REGISTER 37
-#define PLUS_REGISTER 38
-#define NUM_REGISTERS 39
+/// Registers:
+/// 0 = register for latest (unnamed) yank
+/// 1..9 = registers '1' to '9', for deletes
+/// 10..35 = registers 'a' to 'z'
+/// 36 = delete register '-'
+/// 37 = selection register '*'
+/// 38 = clipboard register '+'
+enum {
+ DELETION_REGISTER = 36,
+ NUM_SAVED_REGISTERS = 37,
+ // The following registers should not be saved in ShaDa file:
+ STAR_REGISTER = 37,
+ PLUS_REGISTER = 38,
+ NUM_REGISTERS = 39,
+};
-// Operator IDs; The order must correspond to opchars[] in ops.c!
-#define OP_NOP 0 // no pending operation
-#define OP_DELETE 1 // "d" delete operator
-#define OP_YANK 2 // "y" yank operator
-#define OP_CHANGE 3 // "c" change operator
-#define OP_LSHIFT 4 // "<" left shift operator
-#define OP_RSHIFT 5 // ">" right shift operator
-#define OP_FILTER 6 // "!" filter operator
-#define OP_TILDE 7 // "g~" switch case operator
-#define OP_INDENT 8 // "=" indent operator
-#define OP_FORMAT 9 // "gq" format operator
-#define OP_COLON 10 // ":" colon operator
-#define OP_UPPER 11 // "gU" make upper case operator
-#define OP_LOWER 12 // "gu" make lower case operator
-#define OP_JOIN 13 // "J" join operator, only for Visual mode
-#define OP_JOIN_NS 14 // "gJ" join operator, only for Visual mode
-#define OP_ROT13 15 // "g?" rot-13 encoding
-#define OP_REPLACE 16 // "r" replace chars, only for Visual mode
-#define OP_INSERT 17 // "I" Insert column, only for Visual mode
-#define OP_APPEND 18 // "A" Append column, only for Visual mode
-#define OP_FOLD 19 // "zf" define a fold
-#define OP_FOLDOPEN 20 // "zo" open folds
-#define OP_FOLDOPENREC 21 // "zO" open folds recursively
-#define OP_FOLDCLOSE 22 // "zc" close folds
-#define OP_FOLDCLOSEREC 23 // "zC" close folds recursively
-#define OP_FOLDDEL 24 // "zd" delete folds
-#define OP_FOLDDELREC 25 // "zD" delete folds recursively
-#define OP_FORMAT2 26 // "gw" format operator, keeps cursor pos
-#define OP_FUNCTION 27 // "g@" call 'operatorfunc'
-#define OP_NR_ADD 28 // "<C-A>" Add to the number or alphabetic
- // character (OP_ADD conflicts with Perl)
-#define OP_NR_SUB 29 // "<C-X>" Subtract from the number or
- // alphabetic character
+/// Operator IDs; The order must correspond to opchars[] in ops.c!
+enum {
+ OP_NOP = 0, ///< no pending operation
+ OP_DELETE = 1, ///< "d" delete operator
+ OP_YANK = 2, ///< "y" yank operator
+ OP_CHANGE = 3, ///< "c" change operator
+ OP_LSHIFT = 4, ///< "<" left shift operator
+ OP_RSHIFT = 5, ///< ">" right shift operator
+ OP_FILTER = 6, ///< "!" filter operator
+ OP_TILDE = 7, ///< "g~" switch case operator
+ OP_INDENT = 8, ///< "=" indent operator
+ OP_FORMAT = 9, ///< "gq" format operator
+ OP_COLON = 10, ///< ":" colon operator
+ OP_UPPER = 11, ///< "gU" make upper case operator
+ OP_LOWER = 12, ///< "gu" make lower case operator
+ OP_JOIN = 13, ///< "J" join operator, only for Visual mode
+ OP_JOIN_NS = 14, ///< "gJ" join operator, only for Visual mode
+ OP_ROT13 = 15, ///< "g?" rot-13 encoding
+ OP_REPLACE = 16, ///< "r" replace chars, only for Visual mode
+ OP_INSERT = 17, ///< "I" Insert column, only for Visual mode
+ OP_APPEND = 18, ///< "A" Append column, only for Visual mode
+ OP_FOLD = 19, ///< "zf" define a fold
+ OP_FOLDOPEN = 20, ///< "zo" open folds
+ OP_FOLDOPENREC = 21, ///< "zO" open folds recursively
+ OP_FOLDCLOSE = 22, ///< "zc" close folds
+ OP_FOLDCLOSEREC = 23, ///< "zC" close folds recursively
+ OP_FOLDDEL = 24, ///< "zd" delete folds
+ OP_FOLDDELREC = 25, ///< "zD" delete folds recursively
+ OP_FORMAT2 = 26, ///< "gw" format operator, keeps cursor pos
+ OP_FUNCTION = 27, ///< "g@" call 'operatorfunc'
+ OP_NR_ADD = 28, ///< "<C-A>" Add to the number or alphabetic character
+ OP_NR_SUB = 29, ///< "<C-X>" Subtract from the number or alphabetic character
+};
/// Flags for get_reg_contents().
enum GRegFlags {
@@ -123,7 +127,17 @@ static inline int op_reg_index(const int regname)
}
}
+/// @see get_yank_register
+/// @return true when register should be inserted literally
+/// (selection or clipboard)
+static inline bool is_literal_register(const int regname)
+ FUNC_ATTR_CONST
+{
+ return regname == '*' || regname == '+';
+}
+
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "ops.h.generated.h"
#endif
-#endif // NVIM_OPS_H
+
+EXTERN LuaRef repeat_luaref INIT( = LUA_NOREF); ///< LuaRef for "."