News for hackers. Stuff that matters.
Re:Ask HN: What is one Vim trick most people don't know? by dwyer on Friday June 29, 2018 @12:46PM (#17425677)
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
Re:Ask HN: What is one Vim trick most people don't know? by vram22 on Friday June 29, 2018 @01:48PM (#17426175)
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.