Live data from Hacker News

Five lines I put in a blank .vimrc

swordandsignals.com

81–90 of 133 posts

Re: Five lines I put in a blank .vimrc

#81
post #23
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?

Yes, it is (at least on Mac in 2013): https://youtu.be/aHm36-na4-4?t=749

That pretty much looks like what I want. I use VimR on the Mac with its multiple windows as opposed to multiple terminal window and vim. But this is close and I'll see if it work with VimR.

Re: Five lines I put in a blank .vimrc

#82
post #43

Earlier quoted context omitted.

I don’t copy and paste, I just don’t see the need for line numbers. But then I also code with syntax highlighting off about half of the time.

Very interesting, I don't think I've ever talked to someone who would choose to disable syntax highlighting. Do the colors actively annoy you or is it just that you don't care?

I grew up without it and I think my brain is wired to recognize visual structure instead of colors.

Switching it off is the first I do.

Re: Five lines I put in a blank .vimrc

#83

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 use H, M, L to move the cursor to the top, middle and bottom of the screen, and ctrl-f and ctr-b to scroll half a page, which drags the cursor along for the ride if it would otherwise be offscreen.

Re: Five lines I put in a blank .vimrc

#84
post #43

Earlier quoted context omitted.

I don’t copy and paste, I just don’t see the need for line numbers. But then I also code with syntax highlighting off about half of the time.

Very interesting, I don't think I've ever talked to someone who would choose to disable syntax highlighting. Do the colors actively annoy you or is it just that you don't care?

I tried both ends of the spectrum.

There’s definitely something real about too much colours; the archetypal example of colouring our human language tokens by type (verbs, nouns, etc) making no sense sure rings home after a while.

But I found very much use of “colour”+ themeing for two things:

- comments vs code, one toned down vs the other, ideally swappable with a hotkey

- delimited content such as strings. It sure saves a lot of time when you get an imbalanced delimiter nested in a forest and the whole of your file changes colour starting near the imbalance.

I’m very much of the opinion that a lot of syntax highlighting is just dumbed down token matching and badly designed (if at all designed), when it should be much smarter in alerting you of inconsistencies, and putting relevant content forward.

+ by colour I don’t necessarily mean literally in colour, bold or italics can serve well.

Re: Five lines I put in a blank .vimrc

#85
post #76

Earlier quoted context omitted.

I hit :w so reflexively and regularly in working files that swap files only occasionally saves my butt: when I've done substantial work in a new buffer that I haven't figured out how to name yet and there's a crash. This happens just often enough that I have to regard it as useful, but it's also less common than crashes that leave me with swaps to contend with across a dozen files that really were pretty much fine. T…

> I don't think the problem is actually swap files themselves, though, but the user experience with them. Agreed, the UX is 99% the reason of me hating swap files. More often than not I choose recover, only to discover the diff is literally null. Come on, you could not check for that before interrupting? And then in any case you have double the annoyance with that recovered buffer as the old swap remains and you have…

> only to discover the diff is literally null.

Note that you can save the trouble of running diff by watching for the message "Buffer contents equals file contents." Only when they're different, you'll want to write the file to another place and diff it.

What bugs me a lot is that, even if the contents are equal, it doesn't cleanup the swap file... is there maybe a command for that so I don't have to go back to my terminal, manually remove ..swp, and open up vim again?

Re: Five lines I put in a blank .vimrc

#86
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.

Like scooble mentioned, you can add \C to the front of the search to force it to be case sensitive.

Re: Five lines I put in a blank .vimrc

#87

Earlier quoted context omitted.

Line numbers are great, until you try to cut and paste. But then again, VI/M wasn't designed for GUIs.

I don’t copy and paste, I just don’t see the need for line numbers. But then I also code with syntax highlighting off about half of the time.

> But then I also code with syntax highlighting off about half of the time.

Wow, don't ever use VSCode then! There are hovering diacritics and proofing marks everywhere!

It does real-time syntax checking and quick compilation to check interfaces (at least with TypeScript, JS, HTML, pug, css, Vue, and NodeJS).

I resisted fancy editors for years, as I found them crazy annoying, but over the past few months I've grown to adore VSCode because it has made me about 50% more efficient: I don't have to run the app to find errors, the IDE finds them for me, and it works on Win10, macOS and Linux. It is extremely context aware of my project.

It's like JetBrains but free (or Android Developer Studio, also made by JetBrains...).

Re: Five lines I put in a blank .vimrc

#88
post #61

Earlier quoted context omitted.

Line numbers are great, until you try to cut and paste. But then again, VI/M wasn't designed for GUIs.

If your vim is compiled with the correct flag for GUI operations (I forget which), you can yank/delete text into the * or + registers to make it available to the system clipboards. This won't bring the line numbers, and lets you avoid using the mouse.

I use vim in a terminal, the way the gods intended, not gvim. ;-P

But apparently according to peer comments, there are ways to yank into clipboards, which is pretty cool.

Re: Five lines I put in a blank .vimrc

#89
post #43

Earlier quoted context omitted.

I don’t copy and paste, I just don’t see the need for line numbers. But then I also code with syntax highlighting off about half of the time.

Very interesting, I don't think I've ever talked to someone who would choose to disable syntax highlighting. Do the colors actively annoy you or is it just that you don't care?

Count me as another. I find syntax highlighting to be distracting unless it is done with some restraint (which it rarely is), and not helpful enough for me to bother with coming up with my own scheme or searching for one that I like.

I am sure there are corner-cases where I would want to enable it, such as were someone has been in the habit of commenting-out parts of a line.

I don't know anyone who uses syntax highlighting for natural-language prose, though I suppose there are some who do.

Re: Five lines I put in a blank .vimrc

#90
post #84
post #43

Earlier quoted context omitted.

Very interesting, I don't think I've ever talked to someone who would choose to disable syntax highlighting. Do the colors actively annoy you or is it just that you don't care?

I tried both ends of the spectrum. There’s definitely something real about too much colours; the archetypal example of colouring our human language tokens by type (verbs, nouns, etc) making no sense sure rings home after a while. But I found very much use of “colour”+ themeing for two things: - comments vs code, one toned down vs the other, ideally swappable with a hotkey - delimited content such as strings. It sure…

I have seen some C code so heavily #ifdef'ed that toning down the parts that are excluded in the current build would be helpful.
Post reply on HN