⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vim.c

📁 ctags的最新版5.7,可以比较5.6版看看,免费下载
💻 C
📖 第 1 页 / 共 2 页
字号:
	/* 	 * Found a user-defined command 	 *	 * They can have many options preceeded by a dash	 * command! -nargs=+ -complete Select  :call s:DB_execSql("select " . <q-args>)	 * The name of the command should be the first word not preceeded by a dash	 *	 */	const unsigned char *cp = line;	if ( (int) *cp == '\\' ) 	{		/*		 * We are recursively calling this function is the command		 * has been continued on to the next line		 *		 * Vim statements can be continued onto a newline using a \		 * to indicate the previous line is continuing.		 *		 * com -nargs=1 -bang -complete=customlist,EditFileComplete		 * 			\ EditFile edit<bang> <args>		 *		 * If the following lines do not have a line continuation		 * the command must not be spanning multiple lines and should		 * be synatically incorrect.		 */		if ((int) *cp == '\\')			++cp;		while (*cp && isspace ((int) *cp))			++cp; 	}	else if ( (!strncmp ((const char*) line, "comp", (size_t) 4) == 0) && 		     (!strncmp ((const char*) line, "comc", (size_t) 4) == 0) && 				(strncmp ((const char*) line, "com", (size_t) 3) == 0) )	{		cp += 2;		if ((int) *++cp == 'm' && (int) *++cp == 'a' &&				(int) *++cp == 'n' && (int) *++cp == 'd')			++cp;		if ((int) *cp == '!')			++cp;		while (*cp && isspace ((int) *cp))			++cp; 	} 	else 	{		/*		 * We are recursively calling this function.  If it does not start		 * with "com" or a line continuation character, we have moved off		 * the command line and should let the other routines parse this file.		 */		cmdProcessed = FALSE;		goto cleanUp;	}	/*	 * Strip off any spaces and options which are part of the command.	 * These should preceed the command name.	 */	do	{		if (isspace ((int) *cp))		{			++cp;		}		else if (*cp == '-')		{			/* 			 * Read until the next space which sparates options or the name			 */			while (*cp && !isspace ((int) *cp))				++cp; 		}	} while ( *cp &&  !isalnum ((int) *cp) );	if ( ! *cp )	{		/*		 * We have reached the end of the line without finding the command name.		 * Read the next line and continue processing it as a command.		 */		line = readVimLine();		parseCommand(line);		goto cleanUp;	}	do	{		vStringPut (name, (int) *cp);		++cp;	} while (isalnum ((int) *cp)  ||  *cp == '_');	vStringTerminate (name);	makeSimpleTag (name, VimKinds, K_COMMAND);	vStringClear (name);cleanUp:	vStringDelete (name);	return cmdProcessed;}static void parseLet (const unsigned char *line){	vString *name = vStringNew ();	/* we've found a variable declared outside of a function!! */	const unsigned char *cp = line + 3;	const unsigned char *np = line;	/* get the name */	if (isspace ((int) *cp))	{		while (*cp && isspace ((int) *cp))			++cp;		/* 		 * Ignore lets which set:		 *    &  - local buffer vim settings		 *    @  - registers		 *    [  - Lists or Dictionaries		 */		if (!*cp || *cp == '&' || *cp == '@' || *cp == '[' )			goto cleanUp;		/* 		 * Ignore vim variables which are read only		 *    v: - Vim variables.		 */		np = cp;		++np;		if ((int) *cp == 'v' && (int) *np == ':' )			goto cleanUp;		/* deal with spaces, $, @ and & */		while (*cp && *cp != '$' && !isalnum ((int) *cp))			++cp;		if (!*cp)			goto cleanUp;		/* cp = skipPrefix (cp, &scope); */		do		{			if (!*cp)				break;			vStringPut (name, (int) *cp);			++cp;		} while (isalnum ((int) *cp)  ||  *cp == '_'  ||  *cp == '#'  ||  *cp == ':'  ||  *cp == '$');		vStringTerminate (name);		makeSimpleTag (name, VimKinds, K_VARIABLE);		vStringClear (name);	}cleanUp:	vStringDelete (name);}static boolean parseMap (const unsigned char *line){	vString *name = vStringNew ();	const unsigned char *cp = line;	/* Remove map */	while (*cp && isalnum ((int) *cp))		++cp;	if ((int) *cp == '!')		++cp;	/*	 * Maps follow this basic format	 *     map      *    nnoremap <silent> <F8> :Tlist<CR>     *    map <unique> <Leader>scdt <Plug>GetColumnDataType     *    inoremap ,,, <esc>diwi<<esc>pa><cr></<esc>pa><esc>kA     *    inoremap <buffer> ( <C-R>=PreviewFunctionSignature()<LF> 	 *	 * The Vim help shows the various special arguments available to a map:	 * 1.2 SPECIAL ARGUMENTS					*:map-arguments*     *    <buffer>	 *    <silent>	 *    <script>	 *    <unique>	 *    <special>	 *    <expr>	 *	 * Strip the special arguments from the map command, this should leave	 * the map name which we will use as the "name".	 */		do	{		while (*cp && isspace ((int) *cp))			++cp; 		if (strncmp ((const char*) cp, "<Leader>", (size_t) 8) == 0)			break;			if (				strncmp ((const char*) cp, "<buffer>", (size_t) 8) == 0 ||				strncmp ((const char*) cp, "<silent>", (size_t) 8) == 0 ||				strncmp ((const char*) cp, "<script>", (size_t) 8) == 0 ||				strncmp ((const char*) cp, "<unique>", (size_t) 8) == 0		   )		{			cp += 8;			continue;		}			if (strncmp ((const char*) cp, "<expr>", (size_t) 6) == 0)		{			cp += 6;			continue;		}			if (strncmp ((const char*) cp, "<special>", (size_t) 9) == 0)		{			cp += 9;			continue;		}			break;	} while (*cp);	do	{		vStringPut (name, (int) *cp);		++cp;	} while (*cp && *cp != ' ');	vStringTerminate (name);	makeSimpleTag (name, VimKinds, K_MAP);	vStringClear (name);	vStringDelete (name);	return TRUE;}static boolean parseVimLine (const unsigned char *line){	boolean readNextLine = TRUE;	if ( (!strncmp ((const char*) line, "comp", (size_t) 4) == 0) && 			(!strncmp ((const char*) line, "comc", (size_t) 4) == 0) && 			(strncmp ((const char*) line, "com", (size_t) 3) == 0) )	{		readNextLine = parseCommand(line);		/* TODO - Handle parseCommand returning FALSE */	}	if (isMap(line))	{		parseMap(line);	}	if (strncmp ((const char*) line, "fu", (size_t) 2) == 0)	{		parseFunction(line);	}	if	(strncmp ((const char*) line, "aug", (size_t) 3) == 0)	{		parseAutogroup(line);	}	if ( strncmp ((const char*) line, "let", (size_t) 3) == 0 )	{		parseLet(line);	}	return readNextLine;}static void parseVimFile (const unsigned char *line){	boolean readNextLine = TRUE;	line = readVimLine();	while (line != NULL)	{		readNextLine = parseVimLine(line);		if ( readNextLine )			line = readVimLine();	}}static void findVimTags (void){	const unsigned char *line;		/* TODO - change this into a structure */	line = '\0';	parseVimFile (line);}extern parserDefinition* VimParser (void){	static const char *const extensions [] = { "vim", NULL };	parserDefinition* def = parserNew ("Vim");	def->kinds		= VimKinds;	def->kindCount	= KIND_COUNT (VimKinds);	def->extensions = extensions;	def->parser		= findVimTags;	return def;}/* vi:set tabstop=4 shiftwidth=4 noexpandtab: */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -