Macros | Functions
misc1.c File Reference
#include <assert.h>
#include <inttypes.h>
#include <stdbool.h>
#include <string.h>
#include <limits.h>
#include "nvim/vim.h"
#include "nvim/ascii.h"
#include "nvim/misc1.h"
#include "nvim/charset.h"
#include "nvim/cursor.h"
#include "nvim/diff.h"
#include "nvim/edit.h"
#include "nvim/eval.h"
#include "nvim/ex_cmds.h"
#include "nvim/ex_docmd.h"
#include "nvim/ex_getln.h"
#include "nvim/fileio.h"
#include "nvim/func_attr.h"
#include "nvim/fold.h"
#include "nvim/getchar.h"
#include "nvim/indent.h"
#include "nvim/indent_c.h"
#include "nvim/buffer_updates.h"
#include "nvim/main.h"
#include "nvim/mark.h"
#include "nvim/mbyte.h"
#include "nvim/memline.h"
#include "nvim/memory.h"
#include "nvim/message.h"
#include "nvim/garray.h"
#include "nvim/move.h"
#include "nvim/mouse.h"
#include "nvim/option.h"
#include "nvim/os_unix.h"
#include "nvim/quickfix.h"
#include "nvim/regexp.h"
#include "nvim/screen.h"
#include "nvim/search.h"
#include "nvim/state.h"
#include "nvim/strings.h"
#include "nvim/tag.h"
#include "nvim/ui.h"
#include "nvim/undo.h"
#include "nvim/window.h"
#include "nvim/os/os.h"
#include "nvim/os/shell.h"
#include "nvim/os/signal.h"
#include "nvim/os/input.h"
#include "nvim/os/time.h"
#include "nvim/event/stream.h"
#include "nvim/buffer.h"


#define BREAKCHECK_SKIP   32


int open_line (int dir, int flags, int second_line_indent)
int get_leader_len (char_u *line, char_u **flags, int backward, int include_space)
int get_last_leader_offset (char_u *line, char_u **flags)
int plines (const linenr_T lnum)
int plines_win (win_T *const wp, const linenr_T lnum, const bool winheight)
int plines_nofill (const linenr_T lnum)
int plines_win_nofill (win_T *const wp, const linenr_T lnum, const bool winheight)
int plines_win_nofold (win_T *wp, linenr_T lnum)
int plines_win_col (win_T *wp, linenr_T lnum, long column)
int plines_m_win (win_T *wp, linenr_T first, linenr_T last)
void ins_bytes (char_u *p)
void ins_bytes_len (char_u *p, size_t len)
void ins_char (int c)
void ins_char_bytes (char_u *buf, size_t charlen)
void ins_str (char_u *s)
int del_char (bool fixpos)
int del_chars (long count, int fixpos)
int del_bytes (colnr_T count, bool fixpos_arg, bool use_delcombine)
void truncate_line (int fixpos)
void del_lines (long nlines, int undo)
int gchar_pos (pos_T *pos)
void changed (void)
void changed_int (void)
void changed_bytes (linenr_T lnum, colnr_T col)
void appended_lines (linenr_T lnum, long count)
void appended_lines_mark (linenr_T lnum, long count)
void deleted_lines (linenr_T lnum, long count)
void deleted_lines_mark (linenr_T lnum, long count)
void changed_lines (linenr_T lnum, colnr_T col, linenr_T lnume, long xtra, bool do_buf_event)
void changed_lines_buf (buf_T *buf, linenr_T lnum, linenr_T lnume, long xtra)
void unchanged (buf_T *buf, int ff)
void check_status (buf_T *buf)
void change_warning (int col)
int ask_yesno (const char *const str, const bool direct)
int is_mouse_key (int c)
int get_keystroke (void)
int get_number (int colon, int *mouse_used)
int prompt_for_number (int *mouse_used)
void msgmore (long n)
void beep_flush (void)
void vim_beep (unsigned val)
char_uget_users (expand_T *xp, int idx)
int match_user (char_u *name)
void preserve_exit (void)
void line_breakcheck (void)
void fast_breakcheck (void)
int call_shell (char_u *cmd, ShellOpts opts, char_u *extra_shell_arg)
char_uget_cmd_output (char_u *cmd, char_u *infile, ShellOpts flags, size_t *ret_len)
void FreeWild (int count, char_u **files)
int goto_im (void)

Macro Definition Documentation

#define BREAKCHECK_SKIP   32

Function Documentation

void appended_lines ( linenr_T  lnum,
long  count 
void appended_lines_mark ( linenr_T  lnum,
long  count 
int ask_yesno ( const char *const  str,
const bool  direct 

Ask for a reply from the user, 'y' or 'n'

No other characters are accepted, the message is repeated until a valid reply is entered or <C-c> is hit.

[in]strPrompt: question to ask user. Is always followed by " (y/n)?".
[in]directDetermines what function to use to get user input. If true then ui_inchar() will be used, otherwise vgetc(). I.e. when direct is true then characters are obtained directly from the user without buffers involved.
'y' or 'n'. Last is also what will be returned in case of interrupt.
void beep_flush ( void  )
int call_shell ( char_u cmd,
ShellOpts  opts,
char_u extra_shell_arg 

os_call_shell() wrapper. Handles 'verbose', :profile, and v:shell_error. Invalidates cached tags.

shell command exit code
void change_warning ( int  col)
void changed ( void  )
void changed_bytes ( linenr_T  lnum,
colnr_T  col 
void changed_int ( void  )
void changed_lines ( linenr_T  lnum,
colnr_T  col,
linenr_T  lnume,
long  xtra,
bool  do_buf_event 
void changed_lines_buf ( buf_T buf,
linenr_T  lnum,
linenr_T  lnume,
long  xtra 

Mark line range in buffer as changed.

bufthe buffer where lines were changed
lnumfirst line with change
lnumeline below last changed line
xtranumber of extra lines (negative when deleting)
void check_status ( buf_T buf)
int del_bytes ( colnr_T  count,
bool  fixpos_arg,
bool  use_delcombine 

Delete "count" bytes under the cursor. If "fixpos" is true, don't leave the cursor on the NUL after the line. Caller must have prepared for undo.

countnumber of bytes to be deleted
fixpos_argleave the cursor on the NUL after the line
use_delcombine'delcombine' option applies
FAIL for failure, OK otherwise
int del_char ( bool  fixpos)
int del_chars ( long  count,
int  fixpos 
void del_lines ( long  nlines,
int  undo 
void deleted_lines ( linenr_T  lnum,
long  count 
void deleted_lines_mark ( linenr_T  lnum,
long  count 
void fast_breakcheck ( void  )
void FreeWild ( int  count,
char_u **  files 
int gchar_pos ( pos_T pos)
char_u* get_cmd_output ( char_u cmd,
char_u infile,
ShellOpts  flags,
size_t *  ret_len 

Get the stdout of an external command. If "ret_len" is NULL replace NUL characters with NL. When "ret_len" is not NULL store the length there.

cmdcommand to execute
infileoptional input file name
flagscan be kShellOptSilent or 0
ret_lenlength of the stdout
an allocated string, or NULL for error.
int get_keystroke ( void  )
int get_last_leader_offset ( char_u line,
char_u **  flags 
int get_leader_len ( char_u line,
char_u **  flags,
int  backward,
int  include_space 
int get_number ( int  colon,
int *  mouse_used 
char_u* get_users ( expand_T xp,
int  idx 
int goto_im ( void  )
void ins_bytes ( char_u p)
void ins_bytes_len ( char_u p,
size_t  len 

Insert string "p" with length "len" at the cursor position. Handles Replace mode and multi-byte characters.

void ins_char ( int  c)

Insert or replace a single character at the cursor position. When in REPLACE or VREPLACE mode, replace any existing character. Caller must have prepared for undo. For multi-byte characters we get the whole character, the caller must convert bytes to a character.

void ins_char_bytes ( char_u buf,
size_t  charlen 
void ins_str ( char_u s)
int is_mouse_key ( int  c)
void line_breakcheck ( void  )
int match_user ( char_u name)
void msgmore ( long  n)
int open_line ( int  dir,
int  flags,
int  second_line_indent 
int plines ( const linenr_T  lnum)
int plines_m_win ( win_T wp,
linenr_T  first,
linenr_T  last 
int plines_nofill ( const linenr_T  lnum)
int plines_win ( win_T *const  wp,
const linenr_T  lnum,
const bool  winheight 
int plines_win_col ( win_T wp,
linenr_T  lnum,
long  column 
int plines_win_nofill ( win_T *const  wp,
const linenr_T  lnum,
const bool  winheight 
int plines_win_nofold ( win_T wp,
linenr_T  lnum 
void preserve_exit ( void  )

Preserve files and exit.

IObuff must contain a message.
This may be called from deadly_signal() in a signal handler, avoid unsafe functions, such as allocating memory.
int prompt_for_number ( int *  mouse_used)
void truncate_line ( int  fixpos)
void unchanged ( buf_T buf,
int  ff 
void vim_beep ( unsigned  val)