todays function

今日の関数 searchit その5 (https://github.com/vim/vim)

/* With the SEARCH_END option move to the last character * of the match. Don't do it for an empty match, end * should be same as start then. */ if ((options & SEARCH_END) && !(options & SEARCH_NOOF) && !(matchpos.lnum == endpos.lnum && mat…

今日の関数 searchit その4 (https://github.com/vim/vim)

if (dir == BACKWARD) { /* * Now, if there are multiple matches on this line, * we have to get the last one. Or the last one before * the cursor, if we're on that line. * When putting the new cursor at the end, compare * relative to the end…

今日の関数 searchit その3 (https://github.com/vim/vim)

while (matchpos.lnum == 0 && ((options & SEARCH_END) && first_match ? (nmatched == 1 && (int)endpos.col - 1 < (int)start_pos.col + extra_col) : ((int)matchpos.col - (ptr[matchpos.col] == NUL) < (int)start_pos.col + extra_col))) { search.c …

今日の関数 searchit その2 (https://github.com/vim/vim)

search.c nmatched = vim_regexec_multi(&regmatch, win, buf, lnum, col, #ifdef FEAT_RELTIME tm #else NULL #endif ); /* Abort searching on an error (e.g., out of stack). */ if (called_emsg) break; if (nmatched > 0) { /* match may actually be …

今日の関数 searchit その1 (https://github.com/vim/vim)

search.c int searchit( win_T *win, /* window to search in; can be NULL for a buffer without a window! */ buf_T *buf, pos_T *pos, int dir, char_u *pat, long count, int options, int pat_use, /* which pattern to use when "pat" is empty */ lin…

今日の関数 do_search その2 (https://github.com/vim/vim)

search.c for (;;) { 複数の検索をループで処理していきます。 vimは;で複数の検索をすることができます。例えば/pat1/;/pat2とすればまずpat1を検索しそのカーソルの 位置からpat2を検索することができます。知ってました?私は知りませんでした。 searchst…

今日の関数 do_search その1 (https://github.com/vim/vim)

vimで検索されると呼ばれる関数です。 検索の実行はsearchitでされますがその前後にoffsetや複数回の検索の調整をこの関数では 行います。 search.c int do_search( oparg_T *oap, /* can be NULL */ int dirc, /* '/' or '?' */ char_u *pat, long count, i…

今日の関数 vim_chdirfile (https://github.com/vim)

misc2.c int vim_chdirfile(char_u *fname) { char_u dir[MAXPATHL]; vim_strncpy(dir, fname, MAXPATHL - 1); *gettail_sep(dir) = NUL; return mch_chdir((char *)dir) == 0 ? OK : FAIL; } ファイル名からそのファイルの親ディレクトリでchdirを呼ぶ関数…