Re: VIM Enhancement (intendation)

From: Evaldsson Martin <martin.evaldsson_at_nyahnyahspammersnyahnyah>
Date: Wed Aug 29 2012 - 14:45:51 MDT

Hi Carl,
There is an emacs lisp script that, among other things, indents NCL-scripts at,,

You can use it from vim by running emacs batch-mode as an external command. In my setup I run ':!indentfile %' where indentfile is,

$ cat ~/bin/indentfile
 emacs -batch $1 -l ~/bin/emacs-format-file -l ~/.emacs.d/ncl.el -f emacs-format-function-ncl


$cat ~/bin/emacs-format-file
(defun emacs-format-function-ncl ()
   "Format the whole buffer."
   (indent-region (point-min) (point-max) nil)
   (untabify (point-min) (point-max))

If anyone has a native vim solution I'd be interested as well...

Martin Evaldsson, PhD 
SMHI / Swedish Meteorological and Hydrological Institute, 
SE-601 76 Norrköping, 
Besöksadress/Street address: Folkborgsvägen 1 
Tel: +46-11-495 8068 
Fax: +46-11-495 8001 
> Hi Daran,
> Thanks for your comments. Maybe you know more about vim syntax files
> than I
> do--this is the first time I've worked with one. Do you know how to get vim
> to automatically indent within blocks (e.g., ifs, do loops, etc)?
> Right now, it automatically indents as in the previous line, and it does
> some special indentation for lines extend by "\", but that's it.
> What I want:
>   if (x.eq.0) then
>     print(x)
>   end if
> What I have:
>   if (x.eq.0) then
>   print(x)
>   end if
> Thanks!
> Carl
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
Received on Wed Aug 29 14:46:00 2012

This archive was generated by hypermail 2.1.8 : Mon Jan 14 2013 - 14:31:38 MST