Live data from Hacker News

Five lines I put in a blank .vimrc

swordandsignals.com

51–60 of 133 posts

Re: Five lines I put in a blank .vimrc

#51

I find it odd that you would use the short version of a command in a config file. Brevity is important when you are doing repetitive tasks. In a config file (or code), clarity is more important that brevity. I know you could argue that you know VI so well that you know these commands off the top of your head.. even so, it's particularly pointless to list them this way in a blog where you have to turn around and expla…

On a new machine with a blank vimrc you’d probably just be piping in these commands in from the command line so it’s more convenient if they are short.

Re: Five lines I put in a blank .vimrc

#52
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 find that not having highlighting to rely on forces me to write more readable code. I might turn it on if I happen to work on a hairy codebase under time constraints.

Sometimes also colors in general can get distracting and I just turn on grayscale system-wide, which also doesn’t play with syntax highlighting as text ends up being varying shades of gray with not enough contrast against the background.

Re: Five lines I put in a blank .vimrc

#53

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 would type "8j8j8j8jjj". I type "8j" (and "8k") a lot.

Re: Five lines I put in a blank .vimrc

#54

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 numbers are great, until you try to cut and paste. But then again, VI/M wasn't designed for GUIs.

I set F12 to toggle line numbers off/on. Very quick and handy.

:nmap :set invnumber

Re: Five lines I put in a blank .vimrc

#55

I find it odd that you would use the short version of a command in a config file. Brevity is important when you are doing repetitive tasks. In a config file (or code), clarity is more important that brevity. I know you could argue that you know VI so well that you know these commands off the top of your head.. even so, it's particularly pointless to list them this way in a blog where you have to turn around and expla…

Yes, I definitely am much descriptive for the config file on my personal computer. The configs I'm recommending here is more for ephemeral machines that you are using just to look at files (such as sshing into a VM that was created to run integration tests). For those cases, being able to quickly type something into the .vimrc and improve your experience is nice.

I guess I don't see a lot of situations where I use systems so casually that I don't have config options set. Even when I was managing a bunch of systems I would push out the same config on them all.

Re: Five lines I put in a blank .vimrc

#57
Another approach to the swap file thing:

    view foo   # opens read-only, no swap file
    vi foo     # opens read-write
Another benefit of this habit is, if you know you're not going to want to modify a file, you can protect yourself against errors like accidentally changing something and then absentmindedly saving the file.

Re: Five lines I put in a blank .vimrc

#58
post #47

Kinda derailing the thread but might ask anyway, does anyone got recommendations on dot files synchronization through personal devices? I'm currently using a git+ss repo on a personal server. I wonder if there are more convenient ways to do this.

Not the simplest way of doing this, but ansible might be an option. IMO the advantage is being able to customize the configuration file depending on the host OS, IP address, attached filesystem, etc.

This is useful because sometimes you want to use the same configuration file on different systems and they usually need some customizations to adapt to each one, which can be done automatically by ansible based on jinja2 templates.

Re: Five lines I put in a blank .vimrc

#59

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 numbers are great, until you try to cut and paste. But then again, VI/M wasn't designed for GUIs.

I have the default register mapped to the system clipboard so doing yank in vim I can paste into anywhere else - no need to use the mouse or worry about line numbers

    " mac clipboard {{
    if has("clipboard")
      set clipboard=unnamed
    endif
    " }} mac clipboard

Re: Five lines I put in a blank .vimrc

#60

Earlier quoted context omitted.

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

I would type "8j8j8j8jjj". I type "8j" (and "8k") a lot.

I bind those commands to "shift-j" and "shift-k" and heavily abuse them.

It's not pretty, one could argue that the mouse is more efficient for such movements, but for me it's faster in practice than moving my hand to the mouse/trackpad, or than looking up a line number (either absolute or relative) and then typing it. And it has no mental burden.

Post reply on HN