Live data from Hacker News

Five lines I put in a blank .vimrc

swordandsignals.com

11–20 of 133 posts

Re: Five lines I put in a blank .vimrc

#11
post #3

I'm not going to set noswf . However, I run into the problem the writer mentions all the time where I'm opening an already opened file. Is it possible to just switch to the already opened file?

No, because it's open in a different instance. You can use one vim instance for all your editing needs and you'll never see that error again.

And you probably should, because vim is rightfully warning you, that you might lose changes made in the other instance.

Re: Five lines I put in a blank .vimrc

#12

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 no…

Interesting. The first thing I always do in a new is enable the line numbers. I pair-program a lot and find them to be invaluable when talking about the code.

Re: Five lines I put in a blank .vimrc

#13
Tastes differ; I would never set 'ignorecase' as a default, and instead of 'number', which is only occasionally necessary and most of the time is visually disturbing, I'd set 'ruler', or a slightly more fancy 'statusline'. The most important one, however, for me is 'set guicursor+=a:blinkon0'.

Re: Five lines I put in a blank .vimrc

#14

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 no…

Line number are super helpful for navigating in vim, though. :54 when you’re on line 20 is much faster than any alternative.

Re: Five lines I put in a blank .vimrc

#15

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 no…

Line number are super helpful for navigating in vim, though. :54 when you’re on line 20 is much faster than any alternative.

Some folk like `34d` so they don't need to press shift. And sometimes set relative line numbers so they don't need to do the subtraction.

Others just search for known text, which IMO is a habit I need to get into. I "got" hjkl after I disabled the cursor keys for a day, but I never followed up and disabled hjkl (or maybe even w and b!?) to get super efficient.

Re: Five lines I put in a blank .vimrc

#16

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 no…

Funny you say that about the visual noise because as someone who’s dyslexic, I find line numbers actually help with readability since it is easier for me to remember a number than it is text.

I also find it especially useful in vi when working with config files. I’m sure you are aware of this feature but in case others aren’t, in vi if you type numbers before a command, it runs that commend n times. So you can quickly copy or delete multiple lines.

It just goes to show how deeply personal a preference a persons code editor is.

Re: Five lines I put in a blank .vimrc

#18
It’s not enough. You should go all the way:

    set nobackup
    set nowritebackup
    set noundofile
    set noswapfile
I explain why at https://lee-phillips.org/badvim/

Also, it’s best to just have one instance of Vim running, in server mode, so you can send files to it from the command line.

Re: Five lines I put in a blank .vimrc

#19
post #13

Tastes differ; I would never set 'ignorecase' as a default, and instead of 'number', which is only occasionally necessary and most of the time is visually disturbing, I'd set 'ruler', or a slightly more fancy 'statusline'. The most important one, however, for me is 'set guicursor+=a:blinkon0'.

Usually smartcase does what I want. The only time it doesn't is when I really really want just lower-case characters, but it's a very good heuristic.

Re: Five lines I put in a blank .vimrc

#20

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 no…

Line number are super helpful for navigating in vim, though. :54 when you’re on line 20 is much faster than any alternative.

I see, I suppose it depends on one’s habits then. Personally I’m used to roughly approximating relative jumps or using search to arrive at the desired identifier, but then I wouldn’t call myself especially efficient.

The only time I find using :number is when I am exploring a codebase elsewhere, e.g. using GitHub’s web interface, and want to jump to a particular line in Vim to make edits—rarely happens.

Post reply on HN