Data Structures | Macros | Typedefs | Enumerations | Functions
option.c File Reference
#include <assert.h>
#include <inttypes.h>
#include <limits.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include "nvim/ascii.h"
#include "nvim/buffer.h"
#include "nvim/charset.h"
#include "nvim/cursor.h"
#include "nvim/cursor_shape.h"
#include "nvim/diff.h"
#include "nvim/digraph.h"
#include "nvim/edit.h"
#include "nvim/eval.h"
#include "nvim/eval/typval.h"
#include "nvim/ex_cmds2.h"
#include "nvim/ex_docmd.h"
#include "nvim/ex_getln.h"
#include "nvim/ex_session.h"
#include "nvim/fileio.h"
#include "nvim/fold.h"
#include "nvim/garray.h"
#include "nvim/getchar.h"
#include "nvim/hardcopy.h"
#include "nvim/highlight.h"
#include "nvim/indent_c.h"
#include "nvim/keymap.h"
#include "nvim/macros.h"
#include "nvim/mbyte.h"
#include "nvim/memfile.h"
#include "nvim/memline.h"
#include "nvim/memory.h"
#include "nvim/message.h"
#include "nvim/misc1.h"
#include "nvim/mouse.h"
#include "nvim/move.h"
#include "nvim/normal.h"
#include "nvim/option.h"
#include "nvim/os/os.h"
#include "nvim/os_unix.h"
#include "nvim/path.h"
#include "nvim/popupmnu.h"
#include "nvim/regexp.h"
#include "nvim/runtime.h"
#include "nvim/screen.h"
#include "nvim/spell.h"
#include "nvim/spellfile.h"
#include "nvim/strings.h"
#include "nvim/syntax.h"
#include "nvim/ui.h"
#include "nvim/ui_compositor.h"
#include "nvim/undo.h"
#include "nvim/vim.h"
#include "nvim/window.h"
#include "nvim/api/private/helpers.h"
#include "nvim/lua/executor.h"
#include "nvim/os/input.h"
#include "nvim/os/lang.h"
#include "nvim/quickfix.h"

Data Structures

struct  vimoption
 
struct  langmap_entry_T
 

Macros

#define IN_OPTION_C
 
#define PV_BOTH   0x1000
 
#define PV_WIN   0x2000
 
#define PV_BUF   0x4000
 
#define PV_MASK   0x0fff
 
#define OPT_WIN(x)   (idopt_T)(PV_WIN + (int)(x))
 
#define OPT_BUF(x)   (idopt_T)(PV_BUF + (int)(x))
 
#define OPT_BOTH(x)   (idopt_T)(PV_BOTH + (int)(x))
 
#define VAR_WIN   ((char_u *)-1)
 
#define P_BOOL   0x01U
 
#define P_NUM   0x02U
 
#define P_STRING   0x04U
 
#define P_ALLOCED   0x08U
 
#define P_EXPAND   0x10U
 
#define P_NODEFAULT   0x40U
 
#define P_DEF_ALLOCED   0x80U
 
#define P_WAS_SET   0x100U
 
#define P_NO_MKRC   0x200U
 
#define P_RSTAT   0x1000U
 redraw status lines More...
 
#define P_RWIN   0x2000U
 redraw current window and recompute text More...
 
#define P_RBUF   0x4000U
 redraw current buffer and recompute text More...
 
#define P_RALL   0x6000U
 redraw all windows More...
 
#define P_RCLR   0x7000U
 clear and redraw all More...
 
#define P_COMMA   0x8000U
 comma separated list More...
 
#define P_ONECOMMA   0x18000U
 commas More...
 
#define P_NODUP   0x20000U
 don't allow duplicate strings More...
 
#define P_FLAGLIST   0x40000U
 list of single-char flags More...
 
#define P_SECURE   0x80000U
 cannot change in modeline or secure mode More...
 
#define P_GETTEXT   0x100000U
 expand default value with _() More...
 
#define P_NOGLOB   0x200000U
 do not use local value for global vimrc More...
 
#define P_NFNAME   0x400000U
 only normal file name chars allowed More...
 
#define P_INSECURE   0x800000U
 option was set from a modeline More...
 
#define P_PRI_MKRC   0x1000000U
 has side effects) More...
 
#define P_NO_ML   0x2000000U
 not allowed in modeline More...
 
#define P_CURSWANT   0x4000000U
 when there is a redraw flag More...
 
#define P_NO_DEF_EXP   0x8000000U
 Do not expand default value. More...
 
#define P_RWINONLY   0x10000000U
 only redraw current window More...
 
#define P_NDNAME   0x20000000U
 only normal dir name chars allowed More...
 
#define P_UI_OPTION   0x40000000U
 send option to remote ui More...
 
#define P_MLE   0x80000000U
 under control of 'modelineexpr' More...
 
#define HIGHLIGHT_INIT
 
#define PARAM_COUNT   ARRAY_SIZE(options)
 
#define TCO_BUFFER_SIZE   8
 
#define INC   20
 
#define GAP   3
 
#define COL_RULER   17
 

Typedefs

typedef struct vimoption vimoption_T
 

Enumerations

enum  idopt_T { PV_NONE = 0, PV_MAXVAL = 0xffff }
 

Functions

void set_init_1 (bool clean_arg)
 
void set_number_default (char *name, long val)
 
void set_init_2 (bool headless)
 Initialize the options, part two: After getting Rows and Columns. More...
 
void set_init_3 (void)
 Initialize the options, part three: After reading the .vimrc. More...
 
void set_helplang_default (const char *lang)
 
void set_title_defaults (void)
 
int do_set (char_u *arg, int opt_flags)
 
void set_options_bin (int oldval, int newval, int opt_flags)
 
int get_shada_parameter (int type)
 
char_ufind_shada_parameter (int type)
 
void check_options (void)
 Check for string options that are NULL (normally only termcap options). More...
 
void check_buf_options (buf_T *buf)
 Check string options in a buffer for NULL value. More...
 
void free_string_option (char_u *p)
 
void clear_string_option (char_u **pp)
 
int was_set_insecurely (win_T *const wp, char *opt, int opt_flags)
 
void set_string_option_direct (const char *name, int opt_idx, const char_u *val, int opt_flags, int set_sid)
 
bool valid_spelllang (const char_u *val) FUNC_ATTR_NONNULL_ALL FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
 Return true if "val" is a valid 'spelllang' value. More...
 
int check_signcolumn (char_u *val)
 
char * check_colorcolumn (win_T *wp)
 
void check_blending (win_T *wp)
 
char * check_stl_option (char_u *s)
 
int findoption_len (const char *const arg, const size_t len)
 
bool is_tty_option (const char *name) FUNC_ATTR_NONNULL_ALL FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
 
bool get_tty_option (const char *name, char **value)
 
bool set_tty_option (const char *name, char *value)
 
int get_option_value (const char *name, long *numval, char_u **stringval, int opt_flags)
 
int get_option_value_strict (char *name, int64_t *numval, char **stringval, int opt_type, void *from)
 
char * set_option_value (const char *const name, const long number, const char *const string, const int opt_flags) FUNC_ATTR_NONNULL_ARG(1)
 
int find_key_option_len (const char_u *arg_arg, size_t len, bool has_lt)
 
void ui_refresh_options (void)
 Send update to UIs with values of UI relevant options. More...
 
int makeset (FILE *fd, int opt_flags, int local_only)
 
int makefoldset (FILE *fd)
 
void comp_col (void)
 
void unset_global_local_option (char *name, void *from)
 
char_uget_equalprg (void)
 Get the value of 'equalprg', either the buffer-local one or the global one. More...
 
void win_copy_options (win_T *wp_from, win_T *wp_to)
 
void copy_winopt (winopt_T *from, winopt_T *to)
 
void check_win_options (win_T *win)
 Check string options in a window for a NULL value. More...
 
void clear_winopt (winopt_T *wop)
 Free the allocated memory inside a winopt_T. More...
 
void didset_window_options (win_T *wp)
 
void buf_copy_options (buf_T *buf, int flags)
 
void reset_modifiable (void)
 Reset the 'modifiable' option and its default value. More...
 
void set_iminsert_global (void)
 Set the global value for 'iminsert' to the local value. More...
 
void set_imsearch_global (void)
 Set the global value for 'imsearch' to the local value. More...
 
void set_context_in_set_cmd (expand_T *xp, char_u *arg, int opt_flags)
 
int ExpandSettings (expand_T *xp, regmatch_T *regmatch, int *num_file, char_u ***file)
 
void ExpandOldSetting (int *num_file, char_u ***file)
 
int langmap_adjust_mb (int c)
 Apply 'langmap' to multi-byte character "c" and return the result. More...
 
bool has_format_option (int x) FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
 
bool shortmess (int x)
 
void vimrc_found (char *fname, char *envname)
 
bool option_was_set (const char *name)
 
void reset_option_was_set (const char *name)
 
bool can_bs (int what)
 
void save_file_ff (buf_T *buf)
 
bool file_ff_differs (buf_T *buf, bool ignore_empty) FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT
 
int check_ff_value (char_u *p)
 return OK if "p" is a valid fileformat name, FAIL otherwise. More...
 
bool tabstop_set (char_u *var, long **array)
 
int tabstop_padding (colnr_T col, long ts_arg, long *vts)
 
int tabstop_at (colnr_T col, long ts, long *vts)
 
colnr_T tabstop_start (colnr_T col, long ts, long *vts)
 
void tabstop_fromto (colnr_T start_col, colnr_T end_col, long ts_arg, long *vts, int *ntabs, int *nspcs)
 
bool tabstop_eq (long *ts1, long *ts2)
 
int * tabstop_copy (long *oldts)
 
int tabstop_count (long *ts)
 
int tabstop_first (long *ts)
 
int get_sw_value (buf_T *buf)
 
long get_sw_value_indent (buf_T *buf)
 
long get_sw_value_pos (buf_T *buf, pos_T *pos)
 
long get_sw_value_col (buf_T *buf, colnr_T col)
 
int get_sts_value (void)
 
unsigned int get_bkc_value (buf_T *buf)
 
char_uget_showbreak_value (win_T *const win) FUNC_ATTR_WARN_UNUSED_RESULT
 
int get_fileformat (const buf_T *buf) FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_ALL
 Return the current end-of-line type: EOL_DOS, EOL_UNIX or EOL_MAC. More...
 
int get_fileformat_force (const buf_T *buf, const exarg_T *eap) FUNC_ATTR_NONNULL_ARG(1)
 
int default_fileformat (void)
 Return the default fileformat from 'fileformats'. More...
 
void set_fileformat (int eol_style, int opt_flags)
 
char_uskip_to_option_part (const char_u *p)
 Skip to next part of an option argument: skip space and comma. More...
 
size_t copy_option_part (char_u **option, char_u *buf, size_t maxlen, char *sep_chars)
 
int csh_like_shell (void)
 Return true when 'shell' has "csh" in the tail. More...
 
bool fish_like_shell (void)
 Return true when 'shell' has "fish" in the tail. More...
 
int win_signcol_count (win_T *wp)
 
int win_signcol_configured (win_T *wp, int *is_fixed)
 Return the number of requested sign columns, based on user / configuration. More...
 
dict_Tget_winbuf_options (const int bufopt) FUNC_ATTR_WARN_UNUSED_RESULT
 Get window or buffer local options. More...
 
long get_scrolloff_value (win_T *wp)
 
long get_sidescrolloff_value (win_T *wp)
 
Dictionary get_vimoption (String name, Error *err)
 
Dictionary get_all_vimoptions (void)
 

Macro Definition Documentation

◆ COL_RULER

#define COL_RULER   17

Compute columns for ruler and shown command. 'sc_col' is also used to decide what the maximum length of a message on the status line can be. If there is a status line for the last window, 'sc_col' is independent of 'ru_col'.

◆ GAP

#define GAP   3

◆ HIGHLIGHT_INIT

#define HIGHLIGHT_INIT
Value:
"8:SpecialKey,~:EndOfBuffer,z:TermCursor,Z:TermCursorNC,@:NonText,d:Directory,e:ErrorMsg," \
"i:IncSearch,l:Search,m:MoreMsg,M:ModeMsg,n:LineNr,a:LineNrAbove,b:LineNrBelow,N:CursorLineNr," \
"r:Question,s:StatusLine,S:StatusLineNC,c:VertSplit,t:Title,v:Visual,V:VisualNOS,w:WarningMsg," \
"W:WildMenu,f:Folded,F:FoldColumn,A:DiffAdd,C:DiffChange,D:DiffDelete,T:DiffText,>:SignColumn," \
"-:Conceal,B:SpellBad,P:SpellCap,R:SpellRare,L:SpellLocal,+:Pmenu,=:PmenuSel,x:PmenuSbar," \
"X:PmenuThumb,*:TabLine,#:TabLineSel,_:TabLineFill,!:CursorColumn,.:CursorLine,o:ColorColumn," \
"q:QuickFixLine,0:Whitespace,I:NormalNC"

◆ IN_OPTION_C

#define IN_OPTION_C

◆ INC

#define INC   20

◆ OPT_BOTH

#define OPT_BOTH (   x)    (idopt_T)(PV_BOTH + (int)(x))

◆ OPT_BUF

#define OPT_BUF (   x)    (idopt_T)(PV_BUF + (int)(x))

◆ OPT_WIN

#define OPT_WIN (   x)    (idopt_T)(PV_WIN + (int)(x))

◆ P_ALLOCED

#define P_ALLOCED   0x08U

◆ P_BOOL

#define P_BOOL   0x01U

◆ P_COMMA

#define P_COMMA   0x8000U

comma separated list

◆ P_CURSWANT

#define P_CURSWANT   0x4000000U

when there is a redraw flag

update curswant required; not needed

◆ P_DEF_ALLOCED

#define P_DEF_ALLOCED   0x80U

◆ P_EXPAND

#define P_EXPAND   0x10U

◆ P_FLAGLIST

#define P_FLAGLIST   0x40000U

list of single-char flags

◆ P_GETTEXT

#define P_GETTEXT   0x100000U

expand default value with _()

◆ P_INSECURE

#define P_INSECURE   0x800000U

option was set from a modeline

◆ P_MLE

#define P_MLE   0x80000000U

under control of 'modelineexpr'

◆ P_NDNAME

#define P_NDNAME   0x20000000U

only normal dir name chars allowed

◆ P_NFNAME

#define P_NFNAME   0x400000U

only normal file name chars allowed

◆ P_NO_DEF_EXP

#define P_NO_DEF_EXP   0x8000000U

Do not expand default value.

◆ P_NO_MKRC

#define P_NO_MKRC   0x200U

◆ P_NO_ML

#define P_NO_ML   0x2000000U

not allowed in modeline

◆ P_NODEFAULT

#define P_NODEFAULT   0x40U

◆ P_NODUP

#define P_NODUP   0x20000U

don't allow duplicate strings

◆ P_NOGLOB

#define P_NOGLOB   0x200000U

do not use local value for global vimrc

◆ P_NUM

#define P_NUM   0x02U

◆ P_ONECOMMA

#define P_ONECOMMA   0x18000U

commas

P_COMMA and cannot have two consecutive

◆ P_PRI_MKRC

#define P_PRI_MKRC   0x1000000U

has side effects)

priority for :mkvimrc (setting option

◆ P_RALL

#define P_RALL   0x6000U

redraw all windows

◆ P_RBUF

#define P_RBUF   0x4000U

redraw current buffer and recompute text

◆ P_RCLR

#define P_RCLR   0x7000U

clear and redraw all

◆ P_RSTAT

#define P_RSTAT   0x1000U

redraw status lines

◆ P_RWIN

#define P_RWIN   0x2000U

redraw current window and recompute text

◆ P_RWINONLY

#define P_RWINONLY   0x10000000U

only redraw current window

◆ P_SECURE

#define P_SECURE   0x80000U

cannot change in modeline or secure mode

◆ P_STRING

#define P_STRING   0x04U

◆ P_UI_OPTION

#define P_UI_OPTION   0x40000000U

send option to remote ui

◆ P_WAS_SET

#define P_WAS_SET   0x100U

◆ PARAM_COUNT

#define PARAM_COUNT   ARRAY_SIZE(options)

◆ PV_BOTH

#define PV_BOTH   0x1000

◆ PV_BUF

#define PV_BUF   0x4000

◆ PV_MASK

#define PV_MASK   0x0fff

◆ PV_WIN

#define PV_WIN   0x2000

◆ TCO_BUFFER_SIZE

#define TCO_BUFFER_SIZE   8

◆ VAR_WIN

#define VAR_WIN   ((char_u *)-1)

Typedef Documentation

◆ vimoption_T

typedef struct vimoption vimoption_T

Enumeration Type Documentation

◆ idopt_T

enum idopt_T
Enumerator
PV_NONE 
PV_MAXVAL 

Function Documentation

◆ buf_copy_options()

void buf_copy_options ( buf_T buf,
int  flags 
)

Copy global option values to local options for one buffer. Used when creating a new buffer and sometimes when entering a buffer. flags: BCO_ENTER We will enter the buf buffer. BCO_ALWAYS Always copy the options, but only set b_p_initialized when appropriate. BCO_NOHELP Don't copy the values to a help buffer.

◆ can_bs()

bool can_bs ( int  what)

Check if backspacing over something is allowed.

Parameters
whatBS_INDENT, BS_EOL, BS_START, or BS_NOSTOP

◆ check_blending()

void check_blending ( win_T wp)

◆ check_buf_options()

void check_buf_options ( buf_T buf)

Check string options in a buffer for NULL value.

◆ check_colorcolumn()

char* check_colorcolumn ( win_T wp)

Handle setting 'colorcolumn' or 'textwidth' in window "wp".

Returns
error message, NULL if it's OK.

◆ check_ff_value()

int check_ff_value ( char_u p)

return OK if "p" is a valid fileformat name, FAIL otherwise.

◆ check_options()

void check_options ( void  )

Check for string options that are NULL (normally only termcap options).

◆ check_signcolumn()

int check_signcolumn ( char_u val)

Handle setting 'signcolumn' for value 'val'

Returns
OK when the value is valid, FAIL otherwise

◆ check_stl_option()

char* check_stl_option ( char_u s)

Check validity of options with the 'statusline' format. Return error message or NULL.

◆ check_win_options()

void check_win_options ( win_T win)

Check string options in a window for a NULL value.

◆ clear_string_option()

void clear_string_option ( char_u **  pp)

◆ clear_winopt()

void clear_winopt ( winopt_T wop)

Free the allocated memory inside a winopt_T.

◆ comp_col()

void comp_col ( void  )

◆ copy_option_part()

size_t copy_option_part ( char_u **  option,
char_u buf,
size_t  maxlen,
char *  sep_chars 
)

Isolate one part of a string option separated by sep_chars.

Parameters
[in,out]optionadvanced to the next part
[in,out]bufcopy of the isolated part
[in]maxlenlength of buf
[in]sep_charschars that separate the option parts
Returns
length of *option

◆ copy_winopt()

void copy_winopt ( winopt_T from,
winopt_T to 
)

Copy the options from one winopt_T to another. Doesn't free the old option values in "to", use clear_winopt() for that. The 'scroll' option is not copied, because it depends on the window height. The 'previewwindow' option is reset, there can be only one preview window.

◆ csh_like_shell()

int csh_like_shell ( void  )

Return true when 'shell' has "csh" in the tail.

◆ default_fileformat()

int default_fileformat ( void  )

Return the default fileformat from 'fileformats'.

◆ didset_window_options()

void didset_window_options ( win_T wp)

◆ do_set()

int do_set ( char_u arg,
int  opt_flags 
)

Parse 'arg' for option settings.

'arg' may be IObuff, but only when no errors can be present and option does not need to be expanded with option_expand(). "opt_flags": 0 for ":set" OPT_GLOBAL for ":setglobal" OPT_LOCAL for ":setlocal" and a modeline OPT_MODELINE for a modeline OPT_WINONLY to only set window-local options OPT_NOWIN to skip setting window-local options

Parameters
argoption string (may be written to!)
Returns
FAIL if an error is detected, OK otherwise

◆ ExpandOldSetting()

void ExpandOldSetting ( int *  num_file,
char_u ***  file 
)

◆ ExpandSettings()

int ExpandSettings ( expand_T xp,
regmatch_T regmatch,
int *  num_file,
char_u ***  file 
)

◆ file_ff_differs()

bool file_ff_differs ( buf_T buf,
bool  ignore_empty 
)

Return true if 'fileformat' and/or 'fileencoding' has a different value from when editing started (save_file_ff() called). Also when 'endofline' was changed and 'binary' is set, or when 'bomb' was changed and 'binary' is not set. Also when 'endofline' was changed and 'fixeol' is not set. When "ignore_empty" is true don't consider a new, empty buffer to be changed.

◆ find_key_option_len()

int find_key_option_len ( const char_u arg_arg,
size_t  len,
bool  has_lt 
)

◆ find_shada_parameter()

char_u* find_shada_parameter ( int  type)

Find the parameter represented by the given character (eg ''', ':', '"', or '/') in the 'shada' option and return a pointer to the string after it. Return NULL if the parameter is not specified in the string.

◆ findoption_len()

int findoption_len ( const char *const  arg,
const size_t  len 
)

Find index for named option

Parameters
[in]argOption to find index for.
[in]lenLength of the option.
Returns
Index of the option or -1 if option was not found.

◆ fish_like_shell()

bool fish_like_shell ( void  )

Return true when 'shell' has "fish" in the tail.

◆ free_string_option()

void free_string_option ( char_u p)

Free the string allocated for an option. Checks for the string being empty_option. This may happen if we're out of memory, vim_strsave() returned NULL, which was replaced by empty_option by check_options(). Does NOT check for P_ALLOCED flag!

◆ get_all_vimoptions()

Dictionary get_all_vimoptions ( void  )

◆ get_bkc_value()

unsigned int get_bkc_value ( buf_T buf)

Get the local or global value of 'backupcopy'.

Parameters
bufThe buffer.

◆ get_equalprg()

char_u* get_equalprg ( void  )

Get the value of 'equalprg', either the buffer-local one or the global one.

◆ get_fileformat()

int get_fileformat ( const buf_T buf)

Return the current end-of-line type: EOL_DOS, EOL_UNIX or EOL_MAC.

◆ get_fileformat_force()

int get_fileformat_force ( const buf_T buf,
const exarg_T eap 
)

Like get_fileformat(), but override 'fileformat' with "p" for "++opt=val" argument.

Parameters
eapcan be NULL!

◆ get_option_value()

int get_option_value ( const char *  name,
long *  numval,
char_u **  stringval,
int  opt_flags 
)

Gets the value for an option.

Parameters
stringvalNULL when only checking existence
Returns
: Number or Toggle option: 1, *numval gets value. String option: 0, *stringval gets allocated string. Hidden Number or Toggle option: -1. hidden String option: -2. unknown option: -3.

◆ get_option_value_strict()

int get_option_value_strict ( char *  name,
int64_t *  numval,
char **  stringval,
int  opt_type,
void from 
)

◆ get_scrolloff_value()

long get_scrolloff_value ( win_T wp)

Return the effective 'scrolloff' value for the current window, using the global value when appropriate.

◆ get_shada_parameter()

int get_shada_parameter ( int  type)

Find the parameter represented by the given character (eg ', :, ", or /), and return its associated value in the 'shada' string. Only works for number parameters, not for 'r' or 'n'. If the parameter is not specified in the string or there is no following number, return -1.

◆ get_showbreak_value()

char_u* get_showbreak_value ( win_T *const  win)

Get the local or global value of 'showbreak'.

Parameters
winIf not NULL, the window to get the local option from; global otherwise.

◆ get_sidescrolloff_value()

long get_sidescrolloff_value ( win_T wp)

Return the effective 'sidescrolloff' value for the current window, using the global value when appropriate.

◆ get_sts_value()

int get_sts_value ( void  )

Return the effective softtabstop value for the current buffer, using the shiftwidth value when 'softtabstop' is negative.

◆ get_sw_value()

int get_sw_value ( buf_T buf)

Return the effective shiftwidth value for current buffer, using the 'tabstop' value when 'shiftwidth' is zero.

◆ get_sw_value_col()

long get_sw_value_col ( buf_T buf,
colnr_T  col 
)

◆ get_sw_value_indent()

long get_sw_value_indent ( buf_T buf)

◆ get_sw_value_pos()

long get_sw_value_pos ( buf_T buf,
pos_T pos 
)

◆ get_tty_option()

bool get_tty_option ( const char *  name,
char **  value 
)
Parameters
nameTUI-related option
[out,allocated]value option string value

◆ get_vimoption()

Dictionary get_vimoption ( String  name,
Error err 
)

◆ get_winbuf_options()

dict_T* get_winbuf_options ( const int  bufopt)

Get window or buffer local options.

◆ has_format_option()

bool has_format_option ( int  x)

Return true if format option 'x' is in effect. Take care of no formatting when 'paste' is set.

◆ is_tty_option()

bool is_tty_option ( const char *  name)

◆ langmap_adjust_mb()

int langmap_adjust_mb ( int  c)

Apply 'langmap' to multi-byte character "c" and return the result.

◆ makefoldset()

int makefoldset ( FILE *  fd)

Generate set commands for the local fold options only. Used when 'sessionoptions' or 'viewoptions' contains "folds" but not "options".

◆ makeset()

int makeset ( FILE *  fd,
int  opt_flags,
int  local_only 
)

Write modified options as ":set" commands to a file.

There are three values for "opt_flags": OPT_GLOBAL: Write global option values and fresh values of buffer-local options (used for start of a session file). OPT_GLOBAL + OPT_LOCAL: Idem, add fresh values of window-local options for curwin (used for a vimrc file). OPT_LOCAL: Write buffer-local option values for curbuf, fresh and local values for window-local options of curwin. Local values are also written when at the default value, because a modeline or autocommand may have set them when doing ":edit file" and the user has set them back at the default or fresh value. When "local_only" is true, don't write fresh values, only local values (for ":mkview"). (fresh value = value used for a new buffer or window for a local option).

Return FAIL on error, OK otherwise.

◆ option_was_set()

bool option_was_set ( const char *  name)

Check whether global option has been set

Parameters
[in]nameOption name.
Returns
True if it was set.

◆ reset_modifiable()

void reset_modifiable ( void  )

Reset the 'modifiable' option and its default value.

◆ reset_option_was_set()

void reset_option_was_set ( const char *  name)

Reset the flag indicating option "name" was set.

Parameters
[in]nameOption name.

◆ save_file_ff()

void save_file_ff ( buf_T buf)

Save the current values of 'fileformat' and 'fileencoding', so that we know the file must be considered changed when the value is different.

◆ set_context_in_set_cmd()

void set_context_in_set_cmd ( expand_T xp,
char_u arg,
int  opt_flags 
)
Parameters
opt_flagsOPT_GLOBAL and/or OPT_LOCAL

◆ set_fileformat()

void set_fileformat ( int  eol_style,
int  opt_flags 
)

Set the current end-of-line type to EOL_UNIX, EOL_MAC, or EOL_DOS.

Sets 'fileformat'.

Parameters
eol_styleEnd-of-line style.
opt_flagsOPT_LOCAL and/or OPT_GLOBAL

◆ set_helplang_default()

void set_helplang_default ( const char *  lang)

When 'helplang' is still at its default value, set it to "lang". Only the first two characters of "lang" are used.

◆ set_iminsert_global()

void set_iminsert_global ( void  )

Set the global value for 'iminsert' to the local value.

◆ set_imsearch_global()

void set_imsearch_global ( void  )

Set the global value for 'imsearch' to the local value.

◆ set_init_1()

void set_init_1 ( bool  clean_arg)

Initialize the options, first part.

Called only once from main(), just after creating the first buffer. If "clean_arg" is true, Nvim was started with –clean.

NOTE: ELOG() etc calls are not allowed here, as log location depends on env var expansion which depends on expression evaluation and other editor state initialized here. Do logging in set_init_2 or later.

◆ set_init_2()

void set_init_2 ( bool  headless)

Initialize the options, part two: After getting Rows and Columns.

◆ set_init_3()

void set_init_3 ( void  )

Initialize the options, part three: After reading the .vimrc.

◆ set_number_default()

void set_number_default ( char *  name,
long  val 
)

Set the Vi-default value of a number option. Used for 'lines' and 'columns'.

◆ set_option_value()

char* set_option_value ( const char *const  name,
const long  number,
const char *const  string,
const int  opt_flags 
)

Set the value of an option

Parameters
[in]nameOption name.
[in]numberNew value for the number or boolean option.
[in]stringNew value for string option.
[in]opt_flagsFlags: OPT_LOCAL, OPT_GLOBAL, or 0 (both).
Returns
NULL on success, error message on error.

◆ set_options_bin()

void set_options_bin ( int  oldval,
int  newval,
int  opt_flags 
)

set_options_bin - called when 'bin' changes value.

Parameters
opt_flagsOPT_LOCAL and/or OPT_GLOBAL

◆ set_string_option_direct()

void set_string_option_direct ( const char *  name,
int  opt_idx,
const char_u val,
int  opt_flags,
int  set_sid 
)

Set a string option to a new value (without checking the effect). The string is copied into allocated memory. if ("opt_idx" == -1) "name" is used, otherwise "opt_idx" is used. When "set_sid" is zero set the scriptID to current_sctx.sc_sid. When "set_sid" is SID_NONE don't set the scriptID. Otherwise set the scriptID to "set_sid".

Parameters
opt_flagsOPT_FREE, OPT_LOCAL and/or OPT_GLOBAL

◆ set_title_defaults()

void set_title_defaults ( void  )

'title' and 'icon' only default to true if they have not been set or reset in .vimrc and we can read the old value. When 'title' and 'icon' have been reset in .vimrc, we won't even check if they can be reset. This reduces startup time when using X on a remote machine.

◆ set_tty_option()

bool set_tty_option ( const char *  name,
char *  value 
)

◆ shortmess()

bool shortmess ( int  x)
Returns
true if "x" is present in 'shortmess' option, or 'shortmess' contains 'a' and "x" is present in SHM_ALL_ABBREVIATIONS.

◆ skip_to_option_part()

char_u* skip_to_option_part ( const char_u p)

Skip to next part of an option argument: skip space and comma.

◆ tabstop_at()

int tabstop_at ( colnr_T  col,
long  ts,
long *  vts 
)

◆ tabstop_copy()

int* tabstop_copy ( long *  oldts)

◆ tabstop_count()

int tabstop_count ( long *  ts)

◆ tabstop_eq()

bool tabstop_eq ( long *  ts1,
long *  ts2 
)

◆ tabstop_first()

int tabstop_first ( long *  ts)

◆ tabstop_fromto()

void tabstop_fromto ( colnr_T  start_col,
colnr_T  end_col,
long  ts_arg,
long *  vts,
int *  ntabs,
int *  nspcs 
)

◆ tabstop_padding()

int tabstop_padding ( colnr_T  col,
long  ts_arg,
long *  vts 
)

◆ tabstop_set()

bool tabstop_set ( char_u var,
long **  array 
)

◆ tabstop_start()

colnr_T tabstop_start ( colnr_T  col,
long  ts,
long *  vts 
)

◆ ui_refresh_options()

void ui_refresh_options ( void  )

Send update to UIs with values of UI relevant options.

◆ unset_global_local_option()

void unset_global_local_option ( char *  name,
void from 
)

◆ valid_spelllang()

bool valid_spelllang ( const char_u val)

Return true if "val" is a valid 'spelllang' value.

◆ vimrc_found()

void vimrc_found ( char *  fname,
char *  envname 
)

vimrc_found() - Called when a vimrc or "VIMINIT" has been found.

Set the values for options that didn't get set yet to the defaults. When "fname" is not NULL, use it to set $"envname" when it wasn't set yet.

◆ was_set_insecurely()

int was_set_insecurely ( win_T *const  wp,
char *  opt,
int  opt_flags 
)

Return true when option "opt" was set from a modeline or in secure mode. Return false when it wasn't. Return -1 for an unknown option.

◆ win_copy_options()

void win_copy_options ( win_T wp_from,
win_T wp_to 
)

Copy options from one window to another. Used when splitting a window.

◆ win_signcol_configured()

int win_signcol_configured ( win_T wp,
int *  is_fixed 
)

Return the number of requested sign columns, based on user / configuration.

◆ win_signcol_count()

int win_signcol_count ( win_T wp)

Return the number of requested sign columns, based on current buffer signs and on user configuration.