Live data from Hacker News

Five lines I put in a blank .vimrc

swordandsignals.com

1–10 of 133 posts

Re: Five lines I put in a blank .vimrc

#2
Keeping the swapfile on is really helpful when I accidentally open the same file in two different vim editors. But I do recommend configuring vim to place swapfiles in a different location, so you’re not scattering them all over your disk.

Re: Five lines I put in a blank .vimrc

#5
Why not one line?

    set hls ic is nu noswf
On a serious note, personally disabling line numbers is the first thing I do in a new editor. Reduces visual noise—status line usually shows current line number anyway, jumping to a line might take a second and I found I don’t need to know my line numbers more frequently than once per month or so.

What I do like to enable in an editor is visible whitespace characters (helps notice levels of indent, for example). In Vim that can be accomplished with:

    set list listchars+=space:•
(Might take some tweaking to make whitespace appear subtly enough, depending on your color scheme.)

Re: Five lines I put in a blank .vimrc

#6
In Firefox on macOS, the font fallback to "Apple Color Emoji" is doing really weird things on my machine (like cutting off the top of the number "5").

With that said, thanks for the tips—`set noswapfile` definitely fits my workflow more than not.

Re: Five lines I put in a blank .vimrc

#9
post #2

Keeping the swapfile on is really helpful when I accidentally open the same file in two different vim editors. But I do recommend configuring vim to place swapfiles in a different location, so you’re not scattering them all over your disk.

I actually went full on in the other direction and often have multiple vim instances working on the same file. It feels so much better than having to deal with swap file error messages. With the below it reloads the file when the window gets into focus. Super helpful when working in lots of terminal tabs. You just have to get into a habit of saving after every change as it conflicts otherwise.

    " check for and load file changes when a window is focused. Together with
    " `noswapfile` this allows to edit the same file in multiple nvim instances and
    " have the changes reloaded whenever the focus is changed.
    autocmd WinEnter,BufWinEnter,FocusGained * checktime
Post reply on HN