aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/vim_defs.h
blob: f6b348e0095a7f322a2d19504243eb743bad6708 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#pragma once

// Some defines from the old feature.h
#define SESSION_FILE "Session.vim"
#define MAX_MSG_HIST_LEN 200
#define SYS_OPTWIN_FILE "$VIMRUNTIME/optwin.vim"
#define RUNTIME_DIRNAME "runtime"

enum {
  /// length of a buffer to store a number in ASCII (64 bits binary + NUL)
  NUMBUFLEN = 65,
};

#define MAX_TYPENR 65535

/// Directions.
typedef enum {
  kDirectionNotSet = 0,
  FORWARD = 1,
  BACKWARD = -1,
  FORWARD_FILE = 3,
  BACKWARD_FILE = -3,
} Direction;

/// Used to track the status of external functions.
/// Currently only used for iconv().
typedef enum {
  kUnknown,
  kWorking,
  kBroken,
} WorkingStatus;

/// The scope of a working-directory command like `:cd`.
///
/// Scopes are enumerated from lowest to highest. When adding a scope make sure
/// to update all functions using scopes as well, such as the implementation of
/// `getcwd()`. When using scopes as limits (e.g. in loops) don't use the scopes
/// directly, use `MIN_CD_SCOPE` and `MAX_CD_SCOPE` instead.
typedef enum {
  kCdScopeInvalid = -1,
  kCdScopeWindow,   ///< Affects one window.
  kCdScopeTabpage,  ///< Affects one tab page.
  kCdScopeGlobal,   ///< Affects the entire Nvim instance.
} CdScope;

#define MIN_CD_SCOPE  kCdScopeWindow
#define MAX_CD_SCOPE  kCdScopeGlobal

/// What caused the current directory to change.
typedef enum {
  kCdCauseOther = -1,
  kCdCauseManual,  ///< Using `:cd`, `:tcd`, `:lcd` or `chdir()`.
  kCdCauseWindow,  ///< Switching to another window.
  kCdCauseAuto,    ///< On 'autochdir'.
} CdCause;

// return values for functions
#if !(defined(OK) && (OK == 1))
// OK already defined to 1 in MacOS X curses, skip this
# define OK                     1
#endif
#define FAIL                    0
#define NOTDONE                 2   // not OK or FAIL but skipped