Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
globals.h File Reference
#include <inttypes.h>
#include <stdbool.h>
#include "nvim/ascii.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


#define IOSIZE   (1024 + 1)
#define MSG_BUF_LEN   480
#define MSG_BUF_CLEN   (MSG_BUF_LEN / 6)
#define _PATHSEPSTR   "/"
#define FILETYPE_FILE   "filetype.lua 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 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 MODE_MAX_LENGTH   4
#define STL_IN_ICON   1
#define STL_IN_TITLE   2
#define MIN_CD_SCOPE   kCdScopeWindow
#define MAX_CD_SCOPE   kCdScopeGlobal


typedef off_t off_T


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...


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


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_Tcurtab
EXTERN tabpage_Tlastused_tabpage
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 linenr_T resel_VIsual_line_count
EXTERN colnr_T resel_VIsual_vcol
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


#define _PATHSEPSTR   "/"


#define CONT_ADDING   1


#define CONT_INTRPT   (2 + 4)


#define CONT_LOCAL   32


#define CONT_N_ADDS   4


#define CONT_S_IPOS   8


#define CONT_SOL   16


#define DBCS_2BYTE   1


#define DBCS_CHS   936


#define DBCS_CHSU   9936


#define DBCS_CHT   950


#define DBCS_CHTU   9950


#define DBCS_DEBUG   (-1)


#define DBCS_JPN   932


#define DBCS_JPNU   9932


#define DBCS_KOR   949


#define DBCS_KORU   9949


#define DFLT_COLS   80


#define DFLT_ERRORFILE   "errors.err"




#define DFLT_ROWS   24


#define EXRC_FILE   ".exrc"


#define FILETYPE_FILE   "filetype.lua filetype.vim"


#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_FRAMES (   frp,
)    for ((frp) = first_frame; (frp) != NULL; (frp) = (frp)->fr_next)


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


#define FOR_ALL_TAB_WINDOWS (   tp,


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


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


#define FTOFF_FILE   "ftoff.vim"


#define FTPLUGIN_FILE   "ftplugin.vim"


#define FTPLUGOF_FILE   "ftplugof.vim"

◆ globvarht

#define globvarht   globvardict.dv_hashtab

g: value


#define INDENT_FILE   "indent.vim"


#define INDOFF_FILE   "indoff.vim"


#define IOSIZE   (1024 + 1)


#define MAX_CD_SCOPE   kCdScopeGlobal


#define MIN_CD_SCOPE   kCdScopeWindow


#define MODE_MAX_LENGTH   4


#define MSG_BUF_CLEN   (MSG_BUF_LEN / 6)


#define MSG_BUF_LEN   480


#define NO_BUFFERS   1


#define NO_SCREEN   2


#define ONE_WINDOW   (firstwin == lastwin)


#define PROF_NONE   0

profiling not started


#define PROF_PAUSED   2

profiling paused


#define PROF_YES   1

profiling busy


#define SEA_DIALOG   1


#define SEA_NONE   0


#define SEA_QUIT   2


#define SEA_RECOVER   3


#define SID_API_CLIENT   (-9)


#define SID_CARG   (-3)


#define SID_CMDARG   (-2)


#define SID_ENV   (-4)


#define SID_ERROR   (-5)


#define SID_LUA   (-8)


#define SID_MODELINE   (-1)


#define SID_NONE   (-6)


#define SID_STR   (-10)


#define SID_WINLAYOUT   (-7)


#define STL_IN_ICON   1


#define STL_IN_TITLE   2




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

◆ vim_fseek

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

◆ vim_ftell

#define vim_ftell   ftell

◆ vim_lseek

#define vim_lseek   lseek


#define VIMRC_FILE   ".nvimrc"

Typedef Documentation

◆ off_T

typedef off_t off_T

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

wildmenu showing


wildmenu showing with scroll


cmdline CTRL-D

◆ CdCause

enum CdCause

What caused the current directory to change.


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


Switching to another window.


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.


Affects one window.


Affects one tab page.


Affects the entire Nvim instance.

◆ WorkingStatus

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


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

start insert mode soon

set when :argdo, :windo or :bufdo is executing

set when :global is executing

set after swap write error msg

set after out of memory msg

Stream to write script to.

Selected "quit" at the dialog.

For dialog when swap file already exists.

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

true when redoing Visual.

Type of Visual mode.

Restart Select mode when next cmd finished.

Register name for Select mode.

Whether Select mode is active.

Whether Visual mode is active.

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

filedesc set by embedder for reading first buffer like cmd | nvim -

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 MODE_NORMAL or MODE_INSERT. finish_op : When State is MODE_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

◆ resel_VIsual_line_count

EXTERN linenr_T resel_VIsual_line_count

◆ resel_VIsual_vcol

EXTERN colnr_T resel_VIsual_vcol

◆ 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]
Definition: buffer_defs.h:1173
EXTERN tabpage_T * curtab
Definition: globals.h:462
EXTERN win_T * firstwin
Definition: globals.h:431
#define FOR_ALL_TABS(tp)
Definition: globals.h:467
return NULL
Definition: eval.c:9968