Live data from Hacker News

Five lines I put in a blank .vimrc

swordandsignals.com

91–100 of 133 posts

Re: Five lines I put in a blank .vimrc

#91
post #21

The swap file saved my work a number of times. If you never use recover and use Vim regularly, then go ahead and disable it; if you haven't used it because you don't know how to use it or you only rarely use Vim, then I'd encourage you to either try it first or leave it enabled (as it is by default) until it becomes a nuisance. And like u/strogonoff, I also disable line numbers, but that's just personal preference of…

inoremap jk

inoremap kj

are essential to me... press both at the same time and you exit insert mode regardless of which one gets pressed slightly faster and you never leave the home row and if you press it when you are not in insert mode it's basically a nop unless you are at the start or end of the file. even if you are you might move down or up a line accidentally but i've never had that happen personally.

Re: Five lines I put in a blank .vimrc

#92
post #21

The swap file saved my work a number of times. If you never use recover and use Vim regularly, then go ahead and disable it; if you haven't used it because you don't know how to use it or you only rarely use Vim, then I'd encourage you to either try it first or leave it enabled (as it is by default) until it becomes a nuisance. And like u/strogonoff, I also disable line numbers, but that's just personal preference of…

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 hit :w so reflexively and regularly in working files that swap files only occasionally saves my butt

I'm definitely one of those people too, and while I don't disable swap files I do depend heavily on `persistent-undo`. It literally changed the way I work when it was introduced. To some extent I treat it as an extension to swapfile functionality as it also operates across broken sessions(intentional or not).

> [...] the user experience with them

Christian Brabandt's Recover.vim¹ is a huge improvement for those few times when you do actually want to work with a swap file. General recommendation to poke around in his other repositories too, as he has written a heap of extremely useful vim things.

Edit: Especially unicode.vim² which improves `ga` no end, csv.vim³ which feels like magic, NrrwRgn⁴ for fellow emacs refugees, and ...

¹ https://github.com/chrisbra/Recover.vim

² https://github.com/chrisbra/unicode.vim

³ https://github.com/chrisbra/csv.vim

https://github.com/chrisbra/NrrwRgn

Re: Five lines I put in a blank .vimrc

#93
post #21

The swap file saved my work a number of times. If you never use recover and use Vim regularly, then go ahead and disable it; if you haven't used it because you don't know how to use it or you only rarely use Vim, then I'd encourage you to either try it first or leave it enabled (as it is by default) until it becomes a nuisance. And like u/strogonoff, I also disable line numbers, but that's just personal preference of…

> relative lines might also be worth checking out: "set relativenumber".

I really like the behaviour of `set number relativenumber`, where it shows me my actual line number of the current line and relative numbers on the lines I'm going to operate on.

Re: Five lines I put in a blank .vimrc

#94

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.

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

I actually use VSC in Vim mode for TypeScript work as I couldn’t get Vim to nicely show verbose deeply nested typing hints (maybe someone knows a way?). There is a “mono white” theme, it still shades a few keywords in grey but otherwise is pretty good.

Re: Five lines I put in a blank .vimrc

#95
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 am looking forward to smart highlighting that does what you say (marking errors and inconsistencies, like perhaps a truthiness check being used with a variable that could be both null and undefined in case of a typed language) and otherwise is based on context (for example, highlighting a variable that was defined in outer scope is something that could be legitimately useful).

Colouring human language by tokens is a very fitting analogy.

Re: Five lines I put in a blank .vimrc

#96
post #4

I'd prefer one line it and use the "long" names and add nocompatible set nocompatible hlsearch incsearch ignorecase number then sane tabs set et sts=4 sw=4

I switch between enough different projects with different coding styles that I have shortcuts to change between them: set expandtab set shiftwidth=4 set softtabstop=4 function Spaces(...) if a:0 == 1 let l:width = a:1 else let l:width = 4 endif setlocal expandtab let &l:shiftwidth = l:width let &l:softtabstop = l:width endfunction command! T setlocal noexpandtab shiftwidth=8 softtabstop=0 command! -nargs=? S call Spa…

I use vim-sleuth to auto-detect indentation settings.

https://github.com/tpope/vim-sleuth

Re: Five lines I put in a blank .vimrc

#97
post #93
post #21

The swap file saved my work a number of times. If you never use recover and use Vim regularly, then go ahead and disable it; if you haven't used it because you don't know how to use it or you only rarely use Vim, then I'd encourage you to either try it first or leave it enabled (as it is by default) until it becomes a nuisance. And like u/strogonoff, I also disable line numbers, but that's just personal preference of…

> relative lines might also be worth checking out: "set relativenumber". I really like the behaviour of `set number relativenumber`, where it shows me my actual line number of the current line and relative numbers on the lines I'm going to operate on.

Yes, I resent that this is for newbies some how. It's a small visual aid and unless you're using a tiny terminal it's hard to be able to do a 78d by sight.
Post reply on HN