A comprehensive Vim plugin for LS-DYNA input files, providing syntax highlighting, intelligent completion, abbreviations, and code snippets. Designed to streamline the creation and editing of LS-DYNA finite element analysis input files.
- Color-coded highlighting for LS-DYNA keywords, comments, and numbers
- Automatic detection of LS-DYNA file types (.k, .key, .dyn, .inc)
- Support for scientific notation and all standard LS-DYNA card types
- Customizable colors that adapt to your Vim color scheme
- Dropdown menu with 40+ card templates
- Type
lsdand pressCtrl-X Ctrl-Oto see all available templates - Descriptive hints for each card type
- Quick discovery of available abbreviations
- 43 built-in abbreviations for common LS-DYNA cards
- Expand templates by typing abbreviation + Space
- Includes field headers for easy data entry
- Covers elements, materials, contacts, controls, and more
- Compatible with UltiSnips and SnipMate
- Tab-triggered templates with field navigation
- Properly formatted according to LS-DYNA conventions
- Over 40 ready-to-use templates
- Automatic folding based on LS-DYNA keywords
- Each keyword section (NODE, ELEMENT, MAT, etc.) can be folded
- Custom fold text shows keyword name and preview
- Standard Vim folding commands:
zm,zr,zM,zR,za - Helps navigate large input files efficiently
- Open included files directly from
*INCLUDElines - Press
gfon an INCLUDE line to open file in new tab - Press
<C-w>fto open in horizontal split - Intelligent path resolution (relative and absolute paths)
- Seamless navigation between main file and includes
- Works with nested include structures
- Context-sensitive help system
- Automatic filetype detection
- Works with standard Vim without additional dependencies
- Tested on Linux systems
git clone https://github.com/YOUR_USERNAME/lsdyna-vim.git
cd lsdyna-vim
./install.shThe installation script will automatically:
- Create necessary Vim directories
- Copy syntax and filetype detection files
- Install snippets if UltiSnips or SnipMate is detected
- Configure your Vim environment
- Create Vim directories:
mkdir -p ~/.vim/syntax
mkdir -p ~/.vim/ftdetect- Copy core files:
cp lsdyna.vim ~/.vim/syntax/
cp lsdyna_ftdetect.vim ~/.vim/ftdetect/lsdyna.vim
cp lsdyna_abbrev.vim ~/.vim/ftplugin/lsdyna_abbrev.vim
cp lsdyna_complete.vim ~/.vim/autoload/lsdyna_complete.vim
cp lsdyna_help.vim ~/.vim/ftplugin/lsdyna_help.vim- Install snippets (optional):
For UltiSnips:
mkdir -p ~/.vim/UltiSnips
cp lsdyna.snippets ~/.vim/UltiSnips/For SnipMate:
mkdir -p ~/.vim/snippets
cp lsdyna.snippets ~/.vim/snippets/Add to your ~/.vimrc:
Plug 'YOUR_USERNAME/lsdyna-vim'Add to your ~/.vimrc:
Plugin 'YOUR_USERNAME/lsdyna-vim'cd ~/.vim/bundle
git clone https://github.com/YOUR_USERNAME/lsdyna-vim.git- Open a .k file in Vim
- Type
lsdin INSERT mode - Press
Ctrl-XthenCtrl-O(omni-completion) - Select from the dropdown menu using arrow keys
- Press Enter to insert, then Space to expand
Simply type the abbreviation and press Space:
lsdnode<Space> -> NODE card template
lsdmatelastic<Space> -> MAT_ELASTIC card template
lsdelsolid<Space> -> ELEMENT_SOLID card template
With UltiSnips or SnipMate installed:
node<Tab> -> NODE card with tab stops
matelastic<Tab> -> MAT_ELASTIC card with tab stops
lsdkeyword- Complete file with KEYWORD, TITLE, ENDlsdtitle- TITLE cardlsdcomment- Comment blocklsdend- END keyword
lsdnode- NODE definitionlsdelsolid- ELEMENT_SOLIDlsdelshell- ELEMENT_SHELLlsdelbeam- ELEMENT_BEAM
lsdmatelastic- MAT_ELASTIClsdmatpwl- MAT_PIECEWISE_LINEAR_PLASTICITYlsdmatrigid- MAT_RIGIDlsdmatjc- MAT_JOHNSON_COOK
lsdcontactss- CONTACT_AUTOMATIC_SURFACE_TO_SURFACElsdcontactauto- CONTACT_AUTOMATIC_SINGLE_SURFACE
lsdcontrolterm- CONTROL_TERMINATIONlsdcontroltime- CONTROL_TIMESTEPlsdcontrolenergy- CONTROL_ENERGYlsdcontrolhg- CONTROL_HOURGLASS
lsdd3plot- DATABASE_BINARY_D3PLOTlsddbglstat- DATABASE_GLSTATlsddbnodout- DATABASE_NODOUTlsddbelout- DATABASE_ELOUT
The plugin includes smart code folding that automatically detects LS-DYNA keyword sections. Each keyword block (like *NODE, *ELEMENT_SOLID, *MAT_ELASTIC, etc.) can be folded to help navigate large input files.
Use standard Vim folding commands:
zm- Fold more (close one level of folds)zr- Fold less (open one level of folds)zM- Close all foldszR- Open all foldsza- Toggle fold under cursorzo- Open fold under cursorzc- Close fold under cursor
## INCLUDE File Navigation
The plugin provides seamless navigation between INCLUDE files.
### Opening Include Files
When your cursor is on an `*INCLUDE` or `*INCLUDE_PATH` line:
- `gf` - Open the included file in a new tab
- `<C-w>f` - Open the included file in a horizontal split
- `<C-w>gf` - Open the included file in a new tab (alternative)
### Example
```lsdyna
*KEYWORD
*INCLUDE
materials.k
*INCLUDE
elements.k
*NODE
1 0.0 0.0 0.0
- Move cursor to the
*INCLUDEline - Press
gf - The file opens in a new tab
- Use
gtto switch between tabs
The plugin automatically resolves relative paths based on the current file's location, making it easy to navigate complex multi-file models.
- Open a large LS-DYNA file
- Press zM to fold all sections
- Use j/k to navigate between folded keywords
- Press za on a keyword to open just that section
- Press zm to close folds as you work
Each fold displays the keyword name and a preview of the first data line, plus the number of lines in the fold.
For a complete list of 40+ templates, see [ABBREVIATIONS_GUIDE.md](ABBREVIATIONS_GUIDE.md)
## Documentation
- [Complete Usage Guide](USAGE_GUIDE.md) - Detailed usage instructions and workflow examples
- [Code Folding Guide](FOLDING_GUIDE.md) - Comprehensive guide to using code folding features
- [INCLUDE Navigation Guide](INCLUDE_NAVIGATION_GUIDE.md) - Opening and navigating between include files
- [Installation Guide](INSTALL.md) - Step-by-step installation instructions
- [Abbreviations Guide](ABBREVIATIONS_GUIDE.md) - Complete list of all abbreviations
- [Technical Documentation](LSDYNA_VIM_README.md) - Syntax highlighting details and customization
## Supported File Extensions
The plugin automatically activates for:
- `.k` - Standard LS-DYNA input files
- `.key` - Alternative extension
- `.dyn` - Dynamic files
- `.inc` - Include files
- `.k.*` - Versioned files (e.g., .k.01, .k.backup)
- `.key.*` - Versioned key files
- Files starting with `*KEYWORD`
## Usage Example
*KEYWORD
$ Example LS-DYNA input file
*TITLE
Example Model
## Requirements
- Vim 7.0 or higher
- Linux, macOS, or Unix-like system (tested on Linux 4.18)
- Optional: UltiSnips or SnipMate for advanced snippet features
## Verification
Test the installation:
```bash
vim test.k
Type the following content:
*KEYWORD
*NODE
1 0.0 0.0 0.0
*END
You should see syntax highlighting automatically applied. Test completion by typing lsd and pressing Ctrl-X Ctrl-O.
Check filetype:
:set filetype?Should show filetype=lsdyna. If not:
:set filetype=lsdynaVerify omni-completion is set:
:set omnifunc?Should show omnifunc=LSDynaComplete
- Verify filetype is set to lsdyna
- Check abbreviations are loaded:
:iabbrev - Make sure you press Space or Enter after typing
For more troubleshooting help, see USAGE_GUIDE.md
Contributions are welcome! Please feel free to submit issues or pull requests.
- Fork the repository
- Create a feature branch (
git checkout -b feature/new-card-template) - Commit your changes (
git commit -am 'Add new card template') - Push to the branch (
git push origin feature/new-card-template) - Create a Pull Request
- Additional card templates
- Support for more LS-DYNA keywords
- Documentation improvements
- Bug fixes
- Color scheme enhancements
This project is licensed under the MIT License - see the LICENSE file for details.
- Developed for the LS-DYNA finite element analysis community
- Inspired by the need for efficient LS-DYNA input file creation
- Thanks to all contributors and users
Created and maintained for streamlining LS-DYNA workflow in Vim.
For questions, issues, or feature requests:
- Open an issue on GitHub
- Check the documentation files in this repository
- Review the troubleshooting section above
- v1.0.0 - Initial release with syntax highlighting, completion, abbreviations, and snippets
Made with care for the LS-DYNA community