Hacker News new | ask | show | jobs
by dwyer 2909 days ago
There's a command for that.

    " Use Unix line feeds.
    :set fileformat=unix

    " Use Windows line feeds.
    :set fileformat=dos

    " Shortcut
    :set ff=unix

    " See the current format
    :set ff
1 comments

Yes, I was aware of that (but thanks), and that's why I had written above:

>a) many modern editors will do it for you

although I tend not to use those particular vim options much.

And for anyone else who does not know, many other vim set commands also have shortcuts, like:

:se ai (for :set autoindent)

and ts for tabstop, sw for shiftwidth, ic for ignorecase, wm for wrapmargin and many others, probably.

I tend to do this in my .vimrc or .exrc as soon as I start using any new instance (on a new machine) of vi/vim:

:se ai ts=4 sw=4 showmode showmatch ignorecase expandtab report=0

Also, like:

>" See the current format

> :set ff

you can do this for any boolean setting, like readonly, ignorecase, etc.:

:se readonly?

:se ic?

to query their values.