Live data from Hacker News

History and Effective Use of Vim

begriffs.com

201–210 of 226 posts

Re: History and Effective Use of Vim

#201

After years of a love/hate relationship with Vim (I love what it does, but have configuring it), I had an epiphany: by sticking with the defaults, whether they are my preferred choices or not, I can instantly understand how to use Vim in any environment. Once you get used to biting the bullet and hitting escape instead of jj, or ctrl+c, it just works, everywhere. If you abandon the urge to pimp out your Vim with a bi…

I’m a long time VI(m) user, who started with emacs. I’m proficient in both editors, but use vim as my daily driver.

When I started my career, my mentor was an emacs user, and the reason I started with emacs. I became very proficient with the editor, learning how to handle multiple buffers, window splits, rectangle selects, etc. At that time, I didn’t know vi. Until I started working on another project, where the project manager made a statement to me that started my migration to vim. I was logged into a machine that didn’t have emacs, and I was complaining about it. “Just use vi”, he said. “I don’t know vi”, I said. Then came the statement that stuck with me, “Son, you got to know vi just enough so you don’t look stupid.”

So I learned vi, just enough to not look stupid, and eventually, as proficiency set in, turned to vi more often than emacs.

Now vim is my primary editor, and I can use emacs just enough to not look stupid. ;)

Back to defaults. I customize my vim with colorized syntax highlighting, and several plugins. But at its core my vim is still default with respect to key bindings. These are the defaults that matter. If you leave key bindings alone, then the core of vim use is identical anywhere you use vim, with or without your personal vimrc. You can a make “stick to the core defaults” argument for just about any editor. Just keep the core defaults, and customize away on systems you use daily. Then when you use the editor without your personalizations, the editor still behaves as usual.

My editor life is also easy, but with some more creature comforts for daily use.

Re: History and Effective Use of Vim

#202
post #95

Been using vim since 1998 and rarely stray unless I'm typing notes for something unimportant and them I use Nano. Back in the day when I was a Unix admin, we often worked in full screen terminals and when editing a config file didn't like having to close the vim instance to go look at something, so learned about this little gem: :sh (go back to shell and do your thing and leave vim running) Ctrl-d to return to intact…

You can also do :! ls -a to execute a shell command and see the results from within Vim.

[deleted]

Re: History and Effective Use of Vim

#203

After years of a love/hate relationship with Vim (I love what it does, but have configuring it), I had an epiphany: by sticking with the defaults, whether they are my preferred choices or not, I can instantly understand how to use Vim in any environment. Once you get used to biting the bullet and hitting escape instead of jj, or ctrl+c, it just works, everywhere. If you abandon the urge to pimp out your Vim with a bi…

I'm left-handed and depend on lefty vim nav, but otherwise I agree

Re: History and Effective Use of Vim

#204
post #106

Earlier quoted context omitted.

There's an interesting reason for this related to the ASCII table and bit shifting, but I can't find a description of the exact mechanism for it. H and [ are in the same column as escape and delete respectively, and control shifts the bits in the character codes by some amount. Maybe someone smarter than me can elucidate.

This table might help explain: 00 01 10 11 00000 NUL Spc @ ` 00001 SOH ! A a 00010 STX " B b 00011 ETX # C c 00100 EOT $ D d 00101 ENQ % E e 00110 ACK & F f 00111 BEL ' G g 01000 BS ( H h 01001 TAB ) I i 01010 LF * J j 01011 VT + K k 01100 FF , L l 01101 CR - M m 01110 SO . N n 01111 SI / O o 10000 DLE 0 P p 10001 DC1 1 Q q 10010 DC2 2 R r 10011 DC3 3 S s 10100 DC4 4 T t 10101 NAK 5 U u 10110 SYN 6 V v 10111 ETB 7 W…

Right, I was trying to figure out what bitwise operation the control key performed specifically, but my google-fu was failing. Is it key ^ 0b10?

Re: History and Effective Use of Vim

#205
I don't think I'll ever be able to internalise all the features of Vim.

I've been using it for > 10 years now but I still find myself learning (and sadly forgetting) new features when reading articles like these.

Re: History and Effective Use of Vim

#206
post #133

Earlier quoted context omitted.

People need to stop editing directly on servers. Vim's netrw can write out over scp, use your configured vim on your desktop to edit the files on the server.

The problem is browsing files, for me. I can't use fzf, nerdtree, nnn.vim, whatever. I much prefer sshfs and treating the remote file system like a local one. But I'm not really familiar with netrw other than just: :e scp://host/path/file

I've never used any of those plugins, but the built in netrw has a directory browser that works.

On vanilla vim if you :e scp://host// you should get the built in netrw browser working over scp.

Re: History and Effective Use of Vim

#207
post #201

After years of a love/hate relationship with Vim (I love what it does, but have configuring it), I had an epiphany: by sticking with the defaults, whether they are my preferred choices or not, I can instantly understand how to use Vim in any environment. Once you get used to biting the bullet and hitting escape instead of jj, or ctrl+c, it just works, everywhere. If you abandon the urge to pimp out your Vim with a bi…

I’m a long time VI(m) user, who started with emacs. I’m proficient in both editors, but use vim as my daily driver. When I started my career, my mentor was an emacs user, and the reason I started with emacs. I became very proficient with the editor, learning how to handle multiple buffers, window splits, rectangle selects, etc. At that time, I didn’t know vi. Until I started working on another project, where the proj…

Oh, but you should know enough Emacs to avoid such embarrassing situations: TRAMP!

Re: History and Effective Use of Vim

#208
post #133

Earlier quoted context omitted.

People need to stop editing directly on servers. Vim's netrw can write out over scp, use your configured vim on your desktop to edit the files on the server.

The problem is browsing files, for me. I can't use fzf, nerdtree, nnn.vim, whatever. I much prefer sshfs and treating the remote file system like a local one. But I'm not really familiar with netrw other than just: :e scp://host/path/file

This is one of the reasons my preferred implementation of Vi is Evil -- the TRAMP network layer in Emacs does exactly what you want: let you treat any remote file system as local. It even does multi-hop access through e.g. bastion machines. It is great.

Re: History and Effective Use of Vim

#209

Earlier quoted context omitted.

+1 for Tramp. You can connect to SMB, ssh, and even docker containers from within Emacs. It's strictly better than using a remote ssh session with vim because you don't need to configure anything server-side. It would be a huge hassle to setup plugins like autocompletion on a remote machine for vim, but Emacs lets you use all your regular plugins while ssh'ing, which is a huge bonus.

Vim can also edit remote files, with its built-in netrw module. It can do ssh, ftp, dav, fetch, http, rcp, rsync. vim scp://remoteuser@server.tld//absolute/path/to/document :help netrw-start

But will every other Vim plugin (like fuzzy-finding file browsers or whatnot) work with netrw-accessed files as if they were local? Does it trivially do multi-hop SSH through e.g. bastion machines?

I have yet to see something as powerful as tramp for this.

Re: History and Effective Use of Vim

#210

Earlier quoted context omitted.

https://vimvalley.com/ isn't cheap, but you get what you pay for.

wow good for them if they're getting people to pay $99. It does look well-designed, but the course outline seems a bit elementary. If anyone is thinking about buying this, you could probably just google the items in the course outline and try watching a youtube video on it.

Absolutely.

The courseware runs entirely in the browser; gives great feedback; and helped me level up in a jiffy.

Such that I have no qualms mentioning it here.

Post reply on HN