Skip to content

Vim plugin for Mplus statistical software — syntax highlighting, folding, formatting, completion, and snippets

License

Notifications You must be signed in to change notification settings

li-ruijie/vim-mplus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vim-mplus

Vim plugin for Mplus statistical software files (.inp and .out).

Features

  • Syntax highlighting for keywords, commands, model operators, section headers, and comments
  • Syntax-based folding for input sections and output blocks
  • Indentation (section headers at column 0, body indented)
  • Omni-completion (<C-x><C-o>) for all Mplus keywords via syntaxcomplete
  • UltiSnips snippets for common analyses (CFA, SEM, LGM, LCA, and more)

Formatter (gq)

Mplus is case-insensitive and allows keywords to be abbreviated to four or more characters, IS/ARE to be used in place of =, and section headers to share a line with their content. This flexibility means input files written by different people—or pasted from different sources—can look wildly inconsistent. The gq formatter normalises a selection (or the whole file with gggqG) into a canonical style:

  • Uppercase all code — Mplus convention; makes keywords stand out from variable names.
  • Expand abbreviations — e.g. ANAL:ANALYSIS:, ESTIESTIMATOR. Only unambiguous 4+ character abbreviations are expanded.
  • Split section headersDATA: FILE = ex.dat; becomes two lines (DATA: on its own line, body indented below) so each section is clearly delimited and folds correctly.
  • Replace IS/ARE with = — all three are interchangeable in Mplus; = is shorter and more common.
  • Normalise whitespace — tabs → 4 spaces, trailing whitespace removed.
  • Re-indent — section headers at column 0, body at one shiftwidth.

TITLE sections and comments are left alone (whitespace cleanup only). The formatter also sets fileformat=unix and fileencoding=utf-8 to avoid encoding issues across platforms.

Installation

vim-plug:

Plug 'li-ruijie/vim-mplus'

lazy.nvim:

{ 'li-ruijie/vim-mplus', ft = { 'mplus-inp', 'mplus-out' } }

Or copy the contents to your Vim runtime directory.

Commands

Command Description
:Mout Open corresponding .out file in vertical split
:Mrun Run Mplus on current file (Windows/Linux)

Snippets

Requires UltiSnips. Type the trigger and press <Tab> to expand.

Trigger Description
inp Full input file skeleton
sec Generic section header
cfa Confirmatory factor analysis
sem Structural equation model
lgm Latent growth model
lca Latent class analysis
gmm Growth mixture model
mlm Multilevel (TWOLEVEL) model
efa Exploratory factor analysis
mc Monte Carlo simulation
mi Multiple imputation

License

GPL-3.0

About

Vim plugin for Mplus statistical software — syntax highlighting, folding, formatting, completion, and snippets

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published