Data Structures | Macros | Typedefs | Functions | Variables
normal.c File Reference
#include <assert.h>
#include <inttypes.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include "nvim/api/private/helpers.h"
#include "nvim/ascii.h"
#include "nvim/buffer.h"
#include "nvim/change.h"
#include "nvim/charset.h"
#include "nvim/cursor.h"
#include "nvim/diff.h"
#include "nvim/digraph.h"
#include "nvim/edit.h"
#include "nvim/eval/userfunc.h"
#include "nvim/event/loop.h"
#include "nvim/ex_cmds.h"
#include "nvim/ex_cmds2.h"
#include "nvim/ex_docmd.h"
#include "nvim/ex_getln.h"
#include "nvim/fileio.h"
#include "nvim/fold.h"
#include "nvim/getchar.h"
#include "nvim/indent.h"
#include "nvim/indent_c.h"
#include "nvim/keymap.h"
#include "nvim/log.h"
#include "nvim/main.h"
#include "nvim/mark.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/ops.h"
#include "nvim/option.h"
#include "nvim/os/input.h"
#include "nvim/os/time.h"
#include "nvim/plines.h"
#include "nvim/quickfix.h"
#include "nvim/screen.h"
#include "nvim/search.h"
#include "nvim/spell.h"
#include "nvim/spellfile.h"
#include "nvim/state.h"
#include "nvim/strings.h"
#include "nvim/syntax.h"
#include "nvim/tag.h"
#include "nvim/ui.h"
#include "nvim/undo.h"
#include "nvim/vim.h"
#include "nvim/window.h"

Data Structures

struct  normal_state
 
struct  nv_cmd
 

Macros

#define NV_NCH   0x01
 
#define NV_NCH_NOP   (0x02|NV_NCH)
 
#define NV_NCH_ALW   (0x04|NV_NCH)
 
#define NV_LANG   0x08
 
#define NV_SS   0x10
 
#define NV_SSS   0x20
 
#define NV_STS   0x40
 
#define NV_RL   0x80
 
#define NV_KEEPREG   0x100
 
#define NV_NCW   0x200
 
#define NV_CMDS_SIZE   ARRAY_SIZE(nv_cmds)
 
#define SHOWCMD_BUFLEN   SHOWCMD_COLS + 1 + 30
 

Typedefs

typedef struct normal_state NormalState
 
typedef void(* nv_func_T) (cmdarg_T *cap)
 

Functions

void init_normal_cmds (void)
 
void normal_enter (bool cmdwin, bool noexmode)
 
void do_pending_operator (cmdarg_T *cap, int old_col, bool gui_yank)
 
bool do_mouse (oparg_T *oap, int c, int dir, long count, bool fixindent)
 
void end_visual_mode (void)
 
void reset_VIsual_and_resel (void)
 
void reset_VIsual (void)
 
size_t find_ident_under_cursor (char_u **text, int find_type) FUNC_ATTR_NONNULL_ARG(1)
 
size_t find_ident_at_pos (win_T *wp, linenr_T lnum, colnr_T startcol, char_u **text, int *textcol, int find_type) FUNC_ATTR_NONNULL_ARG(1
 
 for (i=(find_type &FIND_IDENT) ? 0 :1;i< 2;i++)
 
 if (ptr[col]==NUL||(i==0 &&this_class !=2))
 
 if (textcol !=NULL)
 
 while (ptr[col] !=NUL &&((i==0 ? mb_get_class(ptr+col)==this_class :mb_get_class(ptr+col) !=0)||((find_type &FIND_EVAL) &&col<=(int) startcol &&find_is_eval_item(ptr+col, &col, &bn, FORWARD))))
 
 assert (col >=0)
 
 return (size_t)
 
void clear_showcmd (void)
 
bool add_to_showcmd (int c)
 
void add_to_showcmd_c (int c)
 
void push_showcmd (void)
 
void pop_showcmd (void)
 
void do_check_scrollbind (bool check)
 
void check_scrollbind (linenr_T topline_diff, long leftcol_diff)
 
bool find_decl (char_u *ptr, size_t len, bool locally, bool thisblock, int flags_arg)
 
void scroll_redraw (int up, long count)
 
void do_nv_ident (int c1, int c2)
 
bool get_visual_text (cmdarg_T *cap, char_u **pp, size_t *lenp)
 
void start_selection (void)
 
void may_start_select (int c)
 
void set_cursor_for_append_to_line (void)
 
void normal_cmd (oparg_T *oap, bool toplevel)
 

Variables

size_t int i
 
int this_class = 0
 
int prev_class
 
int prevcol
 
int bn = 0
 
char_uptr = ml_get_buf(wp->w_buffer, lnum, false)
 
text = ptr
 
 startcol = col
 
 col = 0
 

Macro Definition Documentation

◆ NV_CMDS_SIZE

#define NV_CMDS_SIZE   ARRAY_SIZE(nv_cmds)

◆ NV_KEEPREG

#define NV_KEEPREG   0x100

◆ NV_LANG

#define NV_LANG   0x08

◆ NV_NCH

#define NV_NCH   0x01

◆ NV_NCH_ALW

#define NV_NCH_ALW   (0x04|NV_NCH)

◆ NV_NCH_NOP

#define NV_NCH_NOP   (0x02|NV_NCH)

◆ NV_NCW

#define NV_NCW   0x200

◆ NV_RL

#define NV_RL   0x80

◆ NV_SS

#define NV_SS   0x10

◆ NV_SSS

#define NV_SSS   0x20

◆ NV_STS

#define NV_STS   0x40

◆ SHOWCMD_BUFLEN

#define SHOWCMD_BUFLEN   SHOWCMD_COLS + 1 + 30

Typedef Documentation

◆ NormalState

typedef struct normal_state NormalState

◆ nv_func_T

typedef void(* nv_func_T) (cmdarg_T *cap)

Function Documentation

◆ add_to_showcmd()

bool add_to_showcmd ( int  c)

◆ add_to_showcmd_c()

void add_to_showcmd_c ( int  c)

◆ assert()

assert ( col >=  0)

◆ check_scrollbind()

void check_scrollbind ( linenr_T  topline_diff,
long  leftcol_diff 
)

◆ clear_showcmd()

void clear_showcmd ( void  )

◆ do_check_scrollbind()

void do_check_scrollbind ( bool  check)

◆ do_mouse()

bool do_mouse ( oparg_T oap,
int  c,
int  dir,
long  count,
bool  fixindent 
)

Do the appropriate action for the current mouse click in the current mode. Not used for Command-line mode.

Normal Mode: event modi- position visual change action fier cursor window left press - yes end yes left press C yes end yes "^]" (2) left press S yes end yes "*" (2) left drag - yes start if moved no left relse - yes start if moved no middle press - yes if not active no put register middle press - yes if active no yank and put right press - yes start or extend yes right press S yes no change yes "#" (2) right drag - yes extend no right relse - yes extend no

Insert or Replace Mode: event modi- position visual change action fier cursor window left press - yes (cannot be active) yes left press C yes (cannot be active) yes "CTRL-O^]" (2) left press S yes (cannot be active) yes "CTRL-O*" (2) left drag - yes start or extend (1) no CTRL-O (1) left relse - yes start or extend (1) no CTRL-O (1) middle press - no (cannot be active) no put register right press - yes start or extend yes CTRL-O right press S yes (cannot be active) yes "CTRL-O#" (2)

(1) only if mouse pointer moved since press (2) only if click is in same buffer

Parameters
oapoperator argument, can be NULL
cK_LEFTMOUSE, etc
dirDirection to 'put' if necessary
fixindentPUT_FIXINDENT if fixing indent necessary
Returns
true if start_arrow() should be called for edit mode.

◆ do_nv_ident()

void do_nv_ident ( int  c1,
int  c2 
)

◆ do_pending_operator()

void do_pending_operator ( cmdarg_T cap,
int  old_col,
bool  gui_yank 
)

◆ end_visual_mode()

void end_visual_mode ( void  )

◆ find_decl()

bool find_decl ( char_u ptr,
size_t  len,
bool  locally,
bool  thisblock,
int  flags_arg 
)

Search for variable declaration of "ptr[len]". When "locally" is true in the current function ("gd"), otherwise in the current file ("gD").

Parameters
thisblockwhen true check the {} block scope.
flags_argflags passed to searchit()
Returns
fail when not found.

◆ find_ident_at_pos()

size_t find_ident_at_pos ( win_T wp,
linenr_T  lnum,
colnr_T  startcol,
char_u **  text,
int *  textcol,
int  find_type 
)

Like find_ident_under_cursor(), but for any window and any position. However: Uses 'iskeyword' from the current window!.

Parameters
textcolcolumn where "text" starts, can be NULL

◆ find_ident_under_cursor()

size_t find_ident_under_cursor ( char_u **  text,
int  find_type 
)

◆ for()

for ( )

◆ get_visual_text()

bool get_visual_text ( cmdarg_T cap,
char_u **  pp,
size_t *  lenp 
)

Get visually selected text, within one line only.

Parameters
ppreturn: start of selected text
lenpreturn: length of selected text
Returns
false if more than one line selected.

◆ if() [1/2]

if ( ptr  [col] = NUL || (i == 0 && this_class != 2))

◆ if() [2/2]

if ( textcol !  = NULL)

◆ init_normal_cmds()

void init_normal_cmds ( void  )

◆ may_start_select()

void may_start_select ( int  c)

◆ normal_cmd()

void normal_cmd ( oparg_T oap,
bool  toplevel 
)

◆ normal_enter()

void normal_enter ( bool  cmdwin,
bool  noexmode 
)

◆ pop_showcmd()

void pop_showcmd ( void  )

◆ push_showcmd()

void push_showcmd ( void  )

◆ reset_VIsual()

void reset_VIsual ( void  )

◆ reset_VIsual_and_resel()

void reset_VIsual_and_resel ( void  )

◆ return()

return ( size_t  )

◆ scroll_redraw()

void scroll_redraw ( int  up,
long  count 
)

◆ set_cursor_for_append_to_line()

void set_cursor_for_append_to_line ( void  )

◆ start_selection()

void start_selection ( void  )

◆ while()

while ( ptr [col] = NUL && ((i == 0              ? mb_get_class(ptr + col) == this_class              : mb_get_class(ptr + col) != 0)             || ((find_type & FIND_EVAL)                 && col <= (int)startcol                 && find_is_eval_item(ptr + col, &col, &bnFORWARD))))

Variable Documentation

◆ bn

bn = 0

◆ col

col = 0

◆ i

size_t int i
Initial value:
{
int col = 0

◆ prev_class

int prev_class

◆ prevcol

int prevcol

◆ ptr

ptr = ml_get_buf(wp->w_buffer, lnum, false)

◆ startcol

startcol = col

◆ text

* text = ptr

◆ this_class

this_class = 0
col
col
Definition: normal.c:3238