cmdme.vi

来自「开放源码的编译器open watcom 1.6.0版的源代码」· VI 代码 · 共 65 行

VI
65
字号
#
# Cmdhook script - this script will parse the command line and
#		   execute commands separated by a ';' one at a time
#
    #
    # starting variables
    #
    assign %c = 0 
    assign %q = 0 
    assign %a = %(Com) 
    
    loop
	#
	# get length of command line
	#
	assign %(len) = strlen %a 
	quif %(len) <= 0
	
	#
	# find the next ;
	#
	assign %f = strchr %a ; 
	if %f == 0
	    #
	    # no ; found, if we haven't found at least one yet, quit
	    #
	    if %c == 0
		break
	    endif
	    #
	    # we've found at least one, so flag it
	    #
	    assign %f = %(len) 
	    assign %q = 1 
	else
	    expr %f = %f - 1
	endif
	
	#
	# execute command
	#
	assign %(cmd) = substr %a 1 %f 
	%(cmd)
	if lastrc != 0
	    return DO_NOT_CLEAR_MESSAGE_WINDOW
	endif
	
	#
	# quit if we got to the end of the line
	#
	quif %q == 1
	
	#
	# remove the command up to the ;
	#
	expr %f = %f + 2
	assign %a = substr %a %f %(len) 
	assign %c = 1 
	
    endloop
    
    if %c == 1
	return DO_NOT_CLEAR_MESSAGE_WINDOW
    endif

⌨️ 快捷键说明

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