Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
globals.h File Reference
#include <inttypes.h>
#include <stdbool.h>
#include "nvim/event/loop.h"
#include "nvim/ex_eval.h"
#include "nvim/iconv.h"
#include "nvim/macros.h"
#include "nvim/mbyte.h"
#include "nvim/menu.h"
#include "nvim/os/os_defs.h"
#include "nvim/syntax_defs.h"
#include "nvim/types.h"

Go to the source code of this file.

Data Structures

struct  nvim_stats_s
 
struct  caller_scope
 

Macros

#define IOSIZE   (1024+1)
 
#define MSG_BUF_LEN   480
 
#define MSG_BUF_CLEN   (MSG_BUF_LEN / 6)
 
#define _PATHSEPSTR   "/"
 
#define FILETYPE_FILE   "filetype.vim"
 
#define FTPLUGIN_FILE   "ftplugin.vim"
 
#define INDENT_FILE   "indent.vim"
 
#define FTOFF_FILE   "ftoff.vim"
 
#define FTPLUGOF_FILE   "ftplugof.vim"
 
#define INDOFF_FILE   "indoff.vim"
 
#define DFLT_ERRORFILE   "errors.err"
 
#define SYS_VIMRC_FILE   "$VIM" _PATHSEPSTR "sysinit.vim"
 
#define DFLT_HELPFILE   "$VIMRUNTIME" _PATHSEPSTR "doc" _PATHSEPSTR "help.txt"
 
#define SYNTAX_FNAME   "$VIMRUNTIME" _PATHSEPSTR "syntax" _PATHSEPSTR "%s.vim"
 
#define EXRC_FILE   ".exrc"
 
#define VIMRC_FILE   ".nvimrc"
 
#define NO_SCREEN   2
 
#define NO_BUFFERS   1
 
#define DFLT_COLS   80
 
#define DFLT_ROWS   24
 
#define vim_lseek   lseek
 
#define vim_ftell   ftell
 
#define vim_fseek(a, b, c)   fseek(a, (long)b, c)
 
#define CONT_ADDING   1
 
#define CONT_INTRPT   (2 + 4)
 
#define CONT_N_ADDS   4
 
#define CONT_S_IPOS   8
 
#define CONT_SOL   16
 
#define CONT_LOCAL   32
 
#define globvarht   globvardict.dv_hashtab
 g: value More...
 
#define PROF_NONE   0
 profiling not started More...
 
#define PROF_YES   1
 profiling busy More...
 
#define PROF_PAUSED   2
 profiling paused More...
 
#define SID_MODELINE   -1
 
#define SID_CMDARG   -2
 
#define SID_CARG   -3
 
#define SID_ENV   -4
 
#define SID_ERROR   -5
 
#define SID_NONE   -6
 
#define SID_WINLAYOUT   -7
 
#define SID_LUA   -8
 
#define SID_API_CLIENT   -9
 
#define SID_STR   -10
 
#define ONE_WINDOW   (firstwin == lastwin)
 
#define FOR_ALL_FRAMES(frp, first_frame)   for (frp = first_frame; frp != NULL; frp = frp->fr_next)
 
#define FOR_ALL_TAB_WINDOWS(tp, wp)
 
#define FOR_ALL_WINDOWS_IN_TAB(wp, tp)
 
#define FOR_ALL_TABS(tp)   for (tabpage_T *tp = first_tabpage; tp != NULL; tp = tp->tp_next)
 
#define FOR_ALL_BUFFERS(buf)   for (buf_T *buf = firstbuf; buf != NULL; buf = buf->b_next)
 
#define FOR_ALL_BUFFERS_BACKWARDS(buf)   for (buf_T *buf = lastbuf; buf != NULL; buf = buf->b_prev)
 
#define FOR_ALL_SIGNS_IN_BUF(buf, sign)   for (sign = buf->b_signlist; sign != NULL; sign = sign->se_next)
 
#define DBCS_JPN   932
 
#define DBCS_JPNU   9932
 
#define DBCS_KOR   949
 
#define DBCS_KORU   9949
 
#define DBCS_CHS   936
 
#define DBCS_CHSU   9936
 
#define DBCS_CHT   950
 
#define DBCS_CHTU   9950
 
#define DBCS_2BYTE   1
 
#define DBCS_DEBUG   -1
 
#define SEA_NONE   0
 
#define SEA_DIALOG   1
 
#define SEA_QUIT   2
 
#define SEA_RECOVER   3
 
#define STL_IN_ICON   1
 
#define STL_IN_TITLE   2
 
#define MIN_CD_SCOPE   kCdScopeWindow
 
#define MAX_CD_SCOPE   kCdScopeGlobal
 

Typedefs

typedef off_t off_T
 

Enumerations

enum  { WM_SHOWN = 1, WM_SCROLLED = 2, WM_LIST = 3 }
 
enum  WorkingStatus { kUnknown, kWorking, kBroken }
 
enum  CdScope { kCdScopeInvalid = -1, kCdScopeWindow, kCdScopeTabpage, kCdScopeGlobal }
 
enum  CdCause { kCdCauseOther = -1, kCdCauseManual, kCdCauseWindow, kCdCauseAuto }
 What caused the current directory to change. More...
 

Functions

EXTERN struct nvim_stats_s INIT (=PROF_NONE)
 PROF_ values. More...
 

Variables

int64_t fsync
 
int64_t redraw
 
EXTERN int cmdline_row
 
EXTERN hlf_T edit_submode_highl
 
EXTERN int msg_col
 
EXTERN int msg_row
 
EXTERN int msg_scrolled
 
EXTERN dict_T vimvardict
 
EXTERN dict_T globvardict
 
EXTERN int did_emsg
 
EXTERN bool called_vim_beep
 
EXTERN bool did_emsg_syntax
 
EXTERN int called_emsg
 
EXTERN except_Tcurrent_exception
 
EXTERN struct caller_scope provider_caller_scope
 
EXTERN linenr_T search_match_lines
 
EXTERN colnr_T search_match_endcol
 
EXTERN int modified_was_set
 
EXTERN int mouse_grid
 
EXTERN int mouse_row
 
EXTERN int mouse_col
 
EXTERN win_Tfirstwin
 
EXTERN win_Tlastwin
 
EXTERN win_Tcurwin
 
EXTERN win_Taucmd_win
 
EXTERN frame_Ttopframe
 
EXTERN tabpage_Tfirst_tabpage
 
EXTERN tabpage_Tlastused_tabpage
 
EXTERN tabpage_Tcurtab
 
EXTERN alist_T global_alist
 
EXTERN int ru_col
 
EXTERN int ru_wid
 
EXTERN int sc_col
 
EXTERN pos_T VIsual
 Start position of active Visual selection. More...
 
EXTERN int VIsual_reselect
 Whether to restart the selection after a Select-mode mapping or menu. More...
 
EXTERN pos_T where_paste_started
 
EXTERN pos_T Insstart
 
EXTERN pos_T Insstart_orig
 
EXTERN int arrow_used
 
EXTERN cmdmod_T cmdmod
 
EXTERN char_u IObuff [IOSIZE]
 Buffer for sprintf, I/O, etc. More...
 
EXTERN char_u NameBuff [MAXPATHL]
 Buffer for expanding file names. More...
 
EXTERN char msg_buf [MSG_BUF_LEN]
 Small buffer for messages. More...
 
EXTERN char os_buf [IOSIZE]
 
EXTERN int stop_insert_mode
 
EXTERN bool KeyTyped
 
EXTERN int KeyStuffed
 
EXTERN int searchcmdlen
 
EXTERN char_u langmap_mapchar [256]
 
EXTERN long sub_nsubs
 
EXTERN linenr_T sub_nlines
 
EXTERN char_u wim_flags [4]
 
EXTERN linenr_T printer_page_num
 
EXTERN time_t starttime
 
EXTERN int vim_ignored
 

Macro Definition Documentation

◆ _PATHSEPSTR

#define _PATHSEPSTR   "/"

◆ CONT_ADDING

#define CONT_ADDING   1

◆ CONT_INTRPT

#define CONT_INTRPT   (2 + 4)

◆ CONT_LOCAL

#define CONT_LOCAL   32

◆ CONT_N_ADDS

#define CONT_N_ADDS   4

◆ CONT_S_IPOS

#define CONT_S_IPOS   8

◆ CONT_SOL

#define CONT_SOL   16

◆ DBCS_2BYTE

#define DBCS_2BYTE   1

◆ DBCS_CHS

#define DBCS_CHS   936

◆ DBCS_CHSU

#define DBCS_CHSU   9936

◆ DBCS_CHT

#define DBCS_CHT   950

◆ DBCS_CHTU

#define DBCS_CHTU   9950

◆ DBCS_DEBUG

#define DBCS_DEBUG   -1

◆ DBCS_JPN

#define DBCS_JPN   932

◆ DBCS_JPNU

#define DBCS_JPNU   9932

◆ DBCS_KOR

#define DBCS_KOR   949

◆ DBCS_KORU

#define DBCS_KORU   9949

◆ DFLT_COLS

#define DFLT_COLS   80

◆ DFLT_ERRORFILE

#define DFLT_ERRORFILE   "errors.err"

◆ DFLT_HELPFILE

#define DFLT_HELPFILE   "$VIMRUNTIME" _PATHSEPSTR "doc" _PATHSEPSTR "help.txt"

◆ DFLT_ROWS

#define DFLT_ROWS   24

◆ EXRC_FILE

#define EXRC_FILE   ".exrc"

◆ FILETYPE_FILE

#define FILETYPE_FILE   "filetype.vim"

◆ FOR_ALL_BUFFERS

#define FOR_ALL_BUFFERS (   buf)    for (buf_T *buf = firstbuf; buf != NULL; buf = buf->b_next)

◆ FOR_ALL_BUFFERS_BACKWARDS

#define FOR_ALL_BUFFERS_BACKWARDS (   buf)    for (buf_T *buf = lastbuf; buf != NULL; buf = buf->b_prev)

◆ FOR_ALL_FRAMES

#define FOR_ALL_FRAMES (   frp,
  first_frame 
)    for (frp = first_frame; frp != NULL; frp = frp->fr_next)

◆ FOR_ALL_SIGNS_IN_BUF

#define FOR_ALL_SIGNS_IN_BUF (   buf,
  sign 
)    for (sign = buf->b_signlist; sign != NULL; sign = sign->se_next)

◆ FOR_ALL_TAB_WINDOWS

#define FOR_ALL_TAB_WINDOWS (   tp,
  wp 
)
Value:
FOR_ALL_WINDOWS_IN_TAB(wp, tp)

◆ FOR_ALL_TABS

#define FOR_ALL_TABS (   tp)    for (tabpage_T *tp = first_tabpage; tp != NULL; tp = tp->tp_next)

◆ FOR_ALL_WINDOWS_IN_TAB

#define FOR_ALL_WINDOWS_IN_TAB (   wp,
  tp 
)
Value:
for (win_T *wp = ((tp) == curtab) \
? firstwin : (tp)->tp_firstwin; wp != NULL; wp = wp->w_next)

◆ FTOFF_FILE

#define FTOFF_FILE   "ftoff.vim"

◆ FTPLUGIN_FILE

#define FTPLUGIN_FILE   "ftplugin.vim"

◆ FTPLUGOF_FILE

#define FTPLUGOF_FILE   "ftplugof.vim"

◆ globvarht

#define globvarht   globvardict.dv_hashtab

g: value

◆ INDENT_FILE

#define INDENT_FILE   "indent.vim"

◆ INDOFF_FILE

#define INDOFF_FILE   "indoff.vim"

◆ IOSIZE

#define IOSIZE   (1024+1)

◆ MAX_CD_SCOPE

#define MAX_CD_SCOPE   kCdScopeGlobal

◆ MIN_CD_SCOPE

#define MIN_CD_SCOPE   kCdScopeWindow

◆ MSG_BUF_CLEN

#define MSG_BUF_CLEN   (MSG_BUF_LEN / 6)

◆ MSG_BUF_LEN

#define MSG_BUF_LEN   480

◆ NO_BUFFERS

#define NO_BUFFERS   1

◆ NO_SCREEN

#define NO_SCREEN   2

◆ ONE_WINDOW

#define ONE_WINDOW   (firstwin == lastwin)

◆ PROF_NONE

#define PROF_NONE   0

profiling not started

◆ PROF_PAUSED

#define PROF_PAUSED   2

profiling paused

◆ PROF_YES

#define PROF_YES   1

profiling busy

◆ SEA_DIALOG

#define SEA_DIALOG   1

◆ SEA_NONE

#define SEA_NONE   0

◆ SEA_QUIT

#define SEA_QUIT   2

◆ SEA_RECOVER

#define SEA_RECOVER   3

◆ SID_API_CLIENT

#define SID_API_CLIENT   -9

◆ SID_CARG

#define SID_CARG   -3

◆ SID_CMDARG

#define SID_CMDARG   -2

◆ SID_ENV

#define SID_ENV   -4

◆ SID_ERROR

#define SID_ERROR   -5

◆ SID_LUA

#define SID_LUA   -8

◆ SID_MODELINE

#define SID_MODELINE   -1

◆ SID_NONE

#define SID_NONE   -6

◆ SID_STR

#define SID_STR   -10

◆ SID_WINLAYOUT

#define SID_WINLAYOUT   -7

◆ STL_IN_ICON

#define STL_IN_ICON   1

◆ STL_IN_TITLE

#define STL_IN_TITLE   2

◆ SYNTAX_FNAME

#define SYNTAX_FNAME   "$VIMRUNTIME" _PATHSEPSTR "syntax" _PATHSEPSTR "%s.vim"

◆ SYS_VIMRC_FILE

#define SYS_VIMRC_FILE   "$VIM" _PATHSEPSTR "sysinit.vim"

◆ vim_fseek

#define vim_fseek (   a,
  b,
 
)    fseek(a, (long)b, c)

◆ vim_ftell

#define vim_ftell   ftell

◆ vim_lseek

#define vim_lseek   lseek

◆ VIMRC_FILE

#define VIMRC_FILE   ".nvimrc"

Typedef Documentation

◆ off_T

typedef off_t off_T

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
WM_SHOWN 

wildmenu showing

WM_SCROLLED 

wildmenu showing with scroll

WM_LIST 

cmdline CTRL-D

◆ CdCause

enum CdCause

What caused the current directory to change.

Enumerator
kCdCauseOther 
kCdCauseManual 

Using :cd, :tcd, :lcd or chdir().

kCdCauseWindow 

Switching to another window.

kCdCauseAuto 

On 'autochdir'.

◆ CdScope

enum CdScope

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.

Enumerator
kCdScopeInvalid 
kCdScopeWindow 

Affects one window.

kCdScopeTabpage 

Affects one tab page.

kCdScopeGlobal 

Affects the entire Nvim instance.

◆ WorkingStatus

Used to track the status of external functions. Currently only used for iconv().

Enumerator
kUnknown 
kWorking 
kBroken 

Function Documentation

◆ INIT()

EXTERN struct nvim_stats_s INIT ( )

PROF_ values.

cmdline recursion level

result of cmdline window or 0

type of cmdline window or 0

key value of 'cedit' option

Stream to write script to.

Encoding used when 'fencs' is set to "default".

true when redoing Visual.

Type of Visual mode.

Restart Select mode when next cmd finished.

Whether Select mode is active.

Whether Visual mode is active.

Batch-mode: "-es" or "-Es" commandline argument was given.

the previous argument list id

Lines left before a "more" message. Ex mode needs to be able to reset this after you type something.

Set when a throw that cannot be handled in do_cmdline() must be propagated to the cstack of the previously called do_cmdline().

Set when a ":finish" or ":return" that cannot be handled in do_cmdline() must be propagated to the cstack of the previously called do_cmdline().

Number of nested try conditionals (across function calls and ":source" commands).

When "force_abort" is true, always skip commands after an error message, even after the outermost ":endif", ":endwhile" or ":endfor" or for a function without the "abort" flag. It is set to true when "trylevel" is non-zero (and ":silent!" was not used) or an exception is being thrown at the time an error is detected. It is set to false when "trylevel" gets zero again and there was no error or interrupt or throw.

"msg_list" points to a variable in the stack of do_cmdline() which keeps the list of arguments of several emsg() calls, one of which is to be converted to an error exception immediately after the failing command returns. The message to be used for the exception value is pointed to by the "throw_msg" field of the first element in the list. It is usually the same as the "msg" field of that element, but can be identical to the "msg" field of a later list element, when the "emsg_severe" flag was set when the emsg() call was made.

When set, don't convert an error to an exception. Used when displaying the interrupt message or reporting an exception that is still uncaught at the top level (which has already been discarded then). Also used for the error message when no exception can be thrown.

The stack of all caught and not finished exceptions. The exception on the top of the stack is the one got by evaluation of v:exception. The complete stack of all caught and pending exceptions is embedded in the various cstacks; the pending exceptions, however, are not on the caught stack.

Garbage collection can only take place when we are sure there are no Lists or Dictionaries being used internally. This is flagged with "may_garbage_collect" when we are at the toplevel. "want_garbage_collect" is set by the garbagecollect() function, which means we do garbage collection before waiting for a char at the toplevel. "garbage_collect_at_exit" indicates garbagecollect(1) was called.

Non-zero when only "safe" commands are allowed, e.g. when sourcing .exrc or .vimrc in current directory.

Non-zero when changing text and jumping to another window/buffer is not allowed.

Non-zero when no buffer name can be changed, no buffer can be deleted and current directory can't be changed. Used for SwapExists et al.

Non-zero when evaluating an expression in a "sandbox". Several things are not allowed then.

"State" is the main state of Vim. There are other variables that modify the state: Visual_mode: When State is NORMAL or INSERT. finish_op : When State is NORMAL, after typing the operator and before typing the motion command. motion_force: Last motion_force from do_pending_operator() debug_mode: Debug mode

Variable Documentation

◆ arrow_used

EXTERN int arrow_used

◆ aucmd_win

EXTERN win_T* aucmd_win

◆ called_emsg

EXTERN int called_emsg

◆ called_vim_beep

EXTERN bool called_vim_beep

◆ cmdline_row

EXTERN int cmdline_row

◆ cmdmod

EXTERN cmdmod_T cmdmod

◆ current_exception

EXTERN except_T* current_exception

Exception currently being thrown. Used to pass an exception to a different cstack. Also used for discarding an exception before it is caught or made pending.

◆ curtab

EXTERN tabpage_T* curtab

◆ curwin

EXTERN win_T* curwin

◆ did_emsg

EXTERN int did_emsg

◆ did_emsg_syntax

EXTERN bool did_emsg_syntax

◆ edit_submode_highl

EXTERN hlf_T edit_submode_highl

◆ first_tabpage

EXTERN tabpage_T* first_tabpage

◆ firstwin

EXTERN win_T* firstwin

◆ fsync

int64_t fsync

◆ global_alist

EXTERN alist_T global_alist

◆ globvardict

EXTERN dict_T globvardict

◆ Insstart

EXTERN pos_T Insstart

◆ Insstart_orig

EXTERN pos_T Insstart_orig

◆ IObuff

EXTERN char_u IObuff[IOSIZE]

Buffer for sprintf, I/O, etc.

◆ KeyStuffed

EXTERN int KeyStuffed

◆ KeyTyped

EXTERN bool KeyTyped

◆ langmap_mapchar

EXTERN char_u langmap_mapchar[256]

◆ lastused_tabpage

EXTERN tabpage_T* lastused_tabpage

◆ lastwin

EXTERN win_T* lastwin

◆ modified_was_set

EXTERN int modified_was_set

◆ mouse_col

EXTERN int mouse_col

◆ mouse_grid

EXTERN int mouse_grid

◆ mouse_row

EXTERN int mouse_row

◆ msg_buf

EXTERN char msg_buf[MSG_BUF_LEN]

Small buffer for messages.

◆ msg_col

EXTERN int msg_col

◆ msg_row

EXTERN int msg_row

◆ msg_scrolled

EXTERN int msg_scrolled

◆ NameBuff

EXTERN char_u NameBuff[MAXPATHL]

Buffer for expanding file names.

◆ os_buf

EXTERN char os_buf[ IOSIZE]

◆ printer_page_num

EXTERN linenr_T printer_page_num

◆ provider_caller_scope

EXTERN struct caller_scope provider_caller_scope

◆ redraw

int64_t redraw

◆ ru_col

EXTERN int ru_col

◆ ru_wid

EXTERN int ru_wid

◆ sc_col

EXTERN int sc_col

◆ search_match_endcol

EXTERN colnr_T search_match_endcol

◆ search_match_lines

EXTERN linenr_T search_match_lines

◆ searchcmdlen

EXTERN int searchcmdlen

◆ starttime

EXTERN time_t starttime

◆ stop_insert_mode

EXTERN int stop_insert_mode

◆ sub_nlines

EXTERN linenr_T sub_nlines

◆ sub_nsubs

EXTERN long sub_nsubs

◆ topframe

EXTERN frame_T* topframe

◆ vim_ignored

EXTERN int vim_ignored

◆ vimvardict

EXTERN dict_T vimvardict

◆ VIsual

EXTERN pos_T VIsual

Start position of active Visual selection.

◆ VIsual_reselect

EXTERN int VIsual_reselect

Whether to restart the selection after a Select-mode mapping or menu.

◆ where_paste_started

EXTERN pos_T where_paste_started

When pasting text with the middle mouse button in visual mode with restart_edit set, remember where it started so we can set Insstart.

◆ wim_flags

EXTERN char_u wim_flags[4]
window_S
Definition: buffer_defs.h:1158
curtab
EXTERN tabpage_T * curtab
Definition: globals.h:451
firstwin
EXTERN win_T * firstwin
Definition: globals.h:420
FOR_ALL_TABS
#define FOR_ALL_TABS(tp)
Definition: globals.h:455
NULL
return NULL
Definition: eval.c:10355