caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: David Powers <david@grayskies.net>
To: Raphael Proust <raphlalou@gmail.com>
Cc: Niki Yoshiuchi <aplusbi@gmail.com>, caml-list@inria.fr
Subject: Re: [Caml-list] ocp-indent 1.0.0 release
Date: Sun, 17 Feb 2013 13:37:48 -0500	[thread overview]
Message-ID: <4DDE2B89DE10452FB01251C852E29C2B@grayskies.net> (raw)
In-Reply-To: <CAAmHUAkZ=rwRcqFXgv_7a7Bgr+wePR5PYf10uECMFXXAEipCeQ@mail.gmail.com>

A nice binding might be something like  

nnoremap == gg=G''

which will rebind the normal == (which isn't that useful here) to reinvent the whole file and return he cursor to the line and column it was on.

-David  


On Sunday, February 17, 2013 at 1:05 PM, Raphael Proust wrote:

> On Sat, Feb 16, 2013 at 8:34 PM, Niki Yoshiuchi <aplusbi@gmail.com (mailto:aplusbi@gmail.com)> wrote:
> > I've started using this with vim and I've noticed a few things. I'm not
> > sure if it's by design or if they are bugs.
> >  
> > First, I have vim setup to use 4 spaces for indentation. When editing an
> > OCaml file, it continues to respect the 4 space indent while writing code.
> > In other words, while writing code I'll end up with something like this
> > (dots represent spaces):
> >  
> > let my_fun f =
> > . . . . let nested_fun g =
> > . . . . . . . . (* content *)
> >  
> > However if I then select the text and and hit "=" it re-indents it using two
> > spaces per nesting level.
>  
>  
>  
> This is not a bug in either vim nor ocp-indent. It is a bug in your
> configurations (they are not in sync). You can either setup ocp-indent
> to use 4 spaces or vim to use 2. See `ocp-indent --config help` for
> the former, and `:h tabstop` and `:h softtabstop` for the latter.
>  
> >  
> > The second thing I've noticed is that "=" indents only relative to the
> > selected text. In other words, if I have
> >  
> >  
> > let my_fun f =
> > . . let nested_fun g =
> > . . . . (* content *)
> > . . . . (* more content *)
> >  
> > and I hit "=" while the cursor is on the third line I end up with:
> >  
> > let my_fun f =
> > . . let nested_fun g =
> > (* content *)
> > . . . . (* more content *)
> >  
> > Doing something like "ggVG=" will properly indent the text.
>  
> This is the expected behaviour. ocp-indent is only given the selected
> text and thus can only work correctly when receiving complete blocks.
> (Indentation is relative to the first line of the chunk that is
> passed.)
>  
> You can pass a full paragraph using `=ap` ("ap" stands for "a
> paragraph", see `:h ap` for help). You can also use blocks. For more
> information on these, see `:h text-objects`.
>  
> Note that you can do `gg=G` (move, action, move) instead of `ggvG=`
> (move, mode, move, action). It is only marginally shorter but, more
> importantly, it will preserve your `'<` and `'>` marks (see, `:h '>`
> for more explanations). (And dually, you can replace `=ap` (action,
> object) by `vap=` (mode, object, action).)
>  
> >  
> > Thanks for the great work on making OCaml more usable! My code has never
> > looked cleaner.
> >  
> > -Niki Yoshiuchi
> >  
> >  
> > On Fri, Feb 15, 2013 at 8:57 AM, Louis Gesbert <louis.gesbert@ocamlpro.com (mailto:louis.gesbert@ocamlpro.com)>
> > wrote:
> > >  
> > > Thanks for all the feedback and few bug reports during the past week of
> > > beta-
> > > test.
> > >  
> > > We can now announce the 1.0.0 release of ocp-indent, available on opam.
> > >  
> > > Enjoy!
> > >  
> > > --
> > > Louis, OCamlPro
> > >  
> > > Le vendredi 8 février 2013 16:25:29, Louis Gesbert a écrit :
> > > > OCamlPro is proud to announce the beta-release of ocp-indent.
> > > >  
> > > > Ocp-indent is a simple tool, entirely written in OCaml, which sole
> > > > purpose
> > > > is to indent OCaml code. It can plug-in seamlessly into emacs' tuareg
> > > > mode, or be run from vim.
> > > >  
> > > > You can try it now with:
> > > >  
> > > > $ opam install ocp-indent
> > > >  
> > > > $ INSTDIR="$(opam config var prefix)/share/typerex/ocp-indent"
> > > >  
> > > > $ echo '(load-file "'"$INSTDIR/ocp-indent.el"'")' >>~/.emacs
> > > >  
> > > > $ echo 'autocmd FileType ocaml source '"$INSTDIR"'/ocp-indent.vim'
> > > > > > ~/.vimrc
> > > > >  
> > > >  
> > > >  
> > > >  
> > > >  
> > > > Or check it out at https://github.com/OCamlPro/ocp-indent
> > > >  
> > > >  
> > > >  
> > > > It presents many improvements over the tuareg indentation engine, a much
> > > > better understanding of the syntax, linear complexity, specific handling
> > > > for many cases. Also, it was intentionally provided with much less
> > > > customisation options.
> > > >  
> > > > Feel free to submit any code snippet that is not indented to your taste,
> > > > to
> > > > help us improve ocp-indent further.
> > > >  
> > > >  
> > > > Some comparison with tuareg on a few big OCaml projects can be seen at
> > > > http://htmlpreview.github.com/?https://github.com/AltGr/ocp-indent-
> > > > tests/blob/master/status.html
> > > >  
> > > >  
> > > > --
> > > > Louis Gesbert, OCamlPro
> > >  
> > >  
> > >  
> > > --
> > > Caml-list mailing list. Subscription management and archives:
> > > https://sympa.inria.fr/sympa/arc/caml-list
> > > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> > > Bug reports: http://caml.inria.fr/bin/caml-bugs
> >  
>  
>  
>  
>  
>  
> --  
> ______________
> Raphaël Proust
>  
> --  
> Caml-list mailing list. Subscription management and archives:
> https://sympa.inria.fr/sympa/arc/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs




  parent reply	other threads:[~2013-02-17 18:37 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-08 15:25 [Caml-list] ocp-indent beta release Louis Gesbert
2013-02-08 15:55 ` Gabriel Kerneis
2013-02-08 16:09   ` Louis Gesbert
2013-02-08 16:02 ` Daniel Bünzli
2013-02-08 16:22   ` Louis Gesbert
2013-02-08 17:50 ` Romain Bardou
2013-02-12 11:33   ` Louis Gesbert
2013-02-08 18:10 ` Ashish Agarwal
2013-02-08 18:19   ` Ashish Agarwal
2013-02-12 10:42 ` Didier Remy
2013-02-12 11:20   ` Louis Gesbert
2013-02-14 16:18     ` Daniel Bünzli
2013-02-15  0:00       ` Daniel Bünzli
2013-02-15 11:01         ` Louis Gesbert
2013-02-15 11:30           ` Daniel Bünzli
2013-02-13  3:48 ` Ivan Gotovchits
2013-02-13  9:00   ` Louis Gesbert
2013-02-15 13:57 ` [Caml-list] ocp-indent 1.0.0 release Louis Gesbert
2013-02-16 20:34   ` Niki Yoshiuchi
2013-02-17 18:05     ` Raphael Proust
2013-02-17 18:30       ` Török Edwin
2013-02-18  9:50         ` Louis Gesbert
2013-02-17 18:37       ` David Powers [this message]
2013-02-17 23:51       ` Niki Yoshiuchi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4DDE2B89DE10452FB01251C852E29C2B@grayskies.net \
    --to=david@grayskies.net \
    --cc=aplusbi@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=raphlalou@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).