Skip to content

Extended major mode for editing batch/windows dos scripts with indentation, completion-at-point, extended syntax, functions, etc.

Notifications You must be signed in to change notification settings

nverno/cmd-mode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cmd-mode - Major mode for editing DOS/Windows scripts

Version: 1
URL: http://github.com/nverno/cmd-mode

Extension of bat-mode, a major mode for editing DOS/Windows scripts (batch files). This verison is extended to provide indentation, completion at point functions, extra syntax, user functions, basic interactive shell.

See company-cmd for company autocompletion/quickhelp support.

Features include

  • Syntax highlighting
  • Indentation: using smie
  • Completion: completion-at-point for local/environment variables
  • Access DOS help pages
  • imenu/outline navigation
  • Compilation support / running scripts
  • Interactive shell modeled after sh-script.el, but needs work to be useful at this point: newlines need to be stripped and %% converted to %.

The syntax groups for highlighting are

;; Face					Example
;;
;;  cmd-label-face				:LABEL
;;  cmd-escaped-newline-face	    ^
;;  font-lock-comment-face		rem
;;  font-lock-builtin-face		copy
;;  font-lock-keyword-face		goto
;;  font-lock-warning-face		cp
;;  font-lock-constant-face		[call] prog
;;  font-lock-variable-name-face	%var%
;;  font-lock-type-face			-option

Usage

Just needs to be on the load-path and either explicitly required, or cmd-mode needs to be autoloaded. In the init file, to use this mode instead of builtin bat-mode:

(defalias 'bat-mode 'cmd-mode)

See documentation of function cmd-mode.

Acknowledgements

Extension of base bat-mode.el to include indentation, completion, modified syntax and font-locking, some extra user functions and basic interface for interactive shell. Mostly modeled after sh-script.el

Example using company-cmd with company-capf (completion-at-point), ie:

'(company-capf :with company-cmd)

as company-backend and company-quickhelp for dropdown help.

example


Converted from cmd-mode.el by el2markdown.

About

Extended major mode for editing batch/windows dos scripts with indentation, completion-at-point, extended syntax, functions, etc.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published