To help make writing MOOSE input files easier on
a common editor found on almost all remote computation resources, I want to
make a Vim plugin that does the style right, highlights keywords, does folding,
and does section movement correctly. Vim style documentation also included and
accessed by :help moose_fw
.
Inside the user's home Vim directory (on Linux .vim
) copy the contents of
each subdirectory into the corresponding subdirectory. If a subdirectory does
not exist then create that subdirectory. Ensure that syntax, indentation, and
folding are on or enabled by filetype.
Vim has a native package manager loader for plugins (:help packages
). Within
the pack
directory create a folder structure ending with a start
directory
and place the plugin inside its own directory, such as:
~/.vim/pack/github/start/moosefw_vim
, then following the manual installation
method placing the contents in moosefw_vim
OR clone the repository into the
directory
(git clone https://github.com/elementx54/moosefw_vim.git moosefw_vim
).
The plugin should usually not be placed in an optionally loaded (opt
)
directory due to the filetype detection being part of the plugin.
Vundle Method
Assuming you have already set up
Vundle, place this plugin line in
the .vimrc
to install:
Plugin 'elementx54/moosefw_vim.git'
Then update your plugins with the command :PluginInstall
when running vim
.
To include the plugin's Vim style documentation, use the command :PluginDocs
.
vim-plug Method
Assuming you have already set up
vim-plug, place this plugin line in
the .vimrc
to install:
Plug 'elementx54/moosefw_vim'
Then update your plugins with the command :PlugInstall
when running vim
.
The Vim style documentation should be updated as well.
NOTE: Customization with Plug requires a specific order of operation. (See
this closed issue.)
Feel free to change highlighting colors in the syntax/moose_fw.vim
file or
place a custom syntax file in the Vim after
directory. Actually, feel free to
change anything.
I've also found it handy to syntax highlight the dump files (--dump
) when
output into a file. You can either make the file extension match an input file
extension or tell Vim directly the filetype.
To tell Vim the filetype, place # vi:filetype=moose_fw
at either the top or
bottom of the file.
MOOSE input format is loosely based off a
GetPot input structure. The MOOSE input
parser now allows for more flexibility between parent and child pairs.
The syntax coloring is provided specifically for MOOSE keywords and
can be customized. Syntax highlighting works best with the old MOOSE input
structure. MOOSE input files traditionally end with *.i
, but any
ending may be used as this plugin can search the input file's beginning
lines looking for a [*Opening*]
and []
closing pair. This plugin identifies
MOOSE input files as being filetype=moose_fw
. The moose_fw
stands for
MOOSE Framework.
Although indentation formatting is not required, this plugin includes
indentation formatting based on user indentation settings. Auto-indentation
occurs as text is entered, both forward and backward indents. To fix indents on
an entire input file, use the Vim command in normal mode gg=G
.
The style of folding is left up to each individual user. Folding by syntax or
indent can be set locally with an autocommand place in the .vimrc
file.
autocmd FileType moose_fw setlocal foldmethod=syntax|indent
For many of the configuration values to work properly, the location of the
command filetype plugin on
in the .vimrc
file MUST come after user defined
configuration values.
The number of lines to search the beginning of a file for a section pair of
bracket sets []
identifying the file as a moose_fw
filetype.
let g:moo_fw_search_lines = 50 " Defaults to 50 lines.
To disable searching files for bracket pairs identifying the file as a
moose_fw
filetype, create the global variable.
let g:moo_fw_search_file_disable = 1 " Defaults to being enabled.
The input file extensions which could identify moose_fw
filetype may be set
with the global variable. The '*.' part is automatically applied to the list.
let g:moo_fw_extensions = ["i"] " Defaults to ["i"] for '*.i' file names.
To disable file extension assignment of moose_fw
filetype, set the global
variable to an empty string.
let g:moo_fw_extensions = [] " Automatic detection still searches unless disabled.
To disable the insertion of closing pairs when an opening pair has been typed, create the global variable.
let g:moo_fw_no_insert_pairs = 1 " Defaults to being enabled.
To disable the key maps for commenting, create the global variable.
let g:moo_fw_no_commenting = 1 " Defaults to being enabled.