Live data from Hacker News

History and Effective Use of Vim

begriffs.com

71–80 of 226 posts

Re: History and Effective Use of Vim

#71
This video of a talk that Bram Moolenaar (the author of vim) gave at Google in 2007 has some pretty good advice.

https://www.youtube.com/watch?v=eX9m3g5J-XA

Mainly the idea is to not try and learn everything about vim, but instead pay attention to how you use it, and find things that are inefficient or could be easier, and then go figure out how to make vim do that thing more efficiently.

Re: History and Effective Use of Vim

#72
post #25

Earlier quoted context omitted.

I despise and hate with passion the Capslock key. On linux I always run setxkbmpap -option caps:escape. I wish the same could be done on Windows. I got used to it so much that I find myself from time to time writing catpital letters when I'm on Windows or foreign setup. My hate for the key came years before I thought about the possibility of remapping it. Similarly, I hate the F1, a key that when accidentally pressed…

> I wish the same could be done on Windows You can:) https://vim.fandom.com/wiki/Map_caps_lock_to_escape_in_Windo...

That page mentions the 'uncap' tool which I have been using for a while. It is excellent. Download the few kb executable from GitHub, launch it once, place it in your startup folder, and it just works forever.

If you don't have admin then you'll need to launch it every boot since you can't put it into the startup folder.

To get to the startup folder, open the start menu, right click on an application (might have to be a windows-included app, like Edge, instead of a 3rd party one), and do 'open in folder', then go up to the Start Menu folder if necessary and then into the startup folder. Google says the path of that is this, but I haven't verified:

C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup

Programs / links in there get autorun at boot :)

I haven't tried it but it appears there's a user-specific startup folder which might work without admin: C:\Users\Username\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

Re: History and Effective Use of Vim

#73

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 find that the muscle memory for my personal config is keyed off the visual appearance of my preferred color scheme. So I have no problem context switching between personal config and default config, provided the color schemes are right for each.

(Or anyway, that was the case until recently when I switched to evil-mode. I'm totally helpless in default config emacs.)

Re: History and Effective Use of Vim

#74
Everyone is missing the most important contribution of vi[m].

Vim defines an ergonomic set of rules for text navigation and manipulation, often implemented by very simple key bindings. This is wonderful.

The Vim editor implements all these rules, but the Vim's plugin ecosystem is a disaster. Hacks pile upon hacks. Noone understand Vim scripts. Vim scripts are easily broken and do not interoperate well with other scripts.

These set of rules can be easily implemented by other editors, as evidenced by many IDEs supporting Vim key bindings. Although these editors may not support all the above rules, they are pretty close (see the evil plugin in Emacs) and can replace Vim in daily usage.

The editor war is over. Vim's keybinding is superior. But the longevity of a text editor lies in its extensibility. For this, Emacs wins in the long run.

Re: History and Effective Use of Vim

#75
I very recently set out to start bringing my vimrc with me when logging into remote hosts and came up with this.

  Host * !github.com
    RemoteCommand echo -e "syntax enable\nset ts=2\nset sw=2\n" > ~/.tmp_vimrc && bash -c 'set -a; vi() { vim -u ~/.tmp_vimrc "$@"; }; set +a;bash -l'
    RequestTTY yes
It gets ugly when you get a lot of options in there.

It's possible to just curl or scp something in place via RemoteCommand above, or `source: https://foo.io/vimrc` but my security paranoia lead me to this instead.

Re: History and Effective Use of Vim

#76
post #66

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 use a bunch of plugins and I've never had trouble remembering the defaults in the odd case I'm unable to use my own config. I don't get why the top comment on all vim threads is always recommending using poor defaults your whole life so you can avoid learning to configure it or avoid a second of confusion when you're ssh'd somewhere. Maybe everyone else besides me spends all their time ssh'd into random servers.

Nah, I've seen people downloading their preferred configs right to the production server, because they, understandably, feel more comfy with that.

But, it may not be for everyone.

Where I work, we are in the process of reaching some compliance targets, and all this downloading unknown stuff from unknown servers is out the window. For the best, I think.

Re: History and Effective Use of Vim

#77

I very recently set out to start bringing my vimrc with me when logging into remote hosts and came up with this. Host * !github.com RemoteCommand echo -e "syntax enable\nset ts=2\nset sw=2\n" > ~/.tmp_vimrc && bash -c 'set -a; vi() { vim -u ~/.tmp_vimrc "$@"; }; set +a;bash -l' RequestTTY yes It gets ugly when you get a lot of options in there. It's possible to just curl or scp something in place via RemoteCommand ab…

Curl it, check the sha256 of the download vs a hardcoded one and then source it if they match?

The URL you curl could be a GitHub blob URL (theoretically immutable) but if you check the hash you’re not trusting GH for anything other than availability.

Re: History and Effective Use of Vim

#79
post #47
post #41

I used vim for years, but then Sublime appeared.. although I miss the snappiness of vim, and wouldn't mind to come back. Specifically, I'd miss these nice features of Sublime: 1. Multiple cursors!! (and how easy is to use them) 2. Real-time preview of regex search 3. Package Manager (easy installation and discoverability of plugins) 4. Jump to file, jump to function, jump to css selector.. (ctrl+p, ctrl+r, using fuzz…

I've grown quite dependent on multiple cursors myself. Supposedly, Kakoune is a vim-like editor with good multiple cursors support. http://kakoune.org/

Mmm.. I see there are also vim plugins for multiple cursors, like https://github.com/terryma/vim-multiple-cursors ..

Re: History and Effective Use of Vim

#80
post #43

I rarely ever use actual vim, mostly when I'm in the terminal. But I have vim plugins for most IDEs I use (VS code, intellij, XCode). It makes editing so much faster. When I have to get by without it I feel as if someone put weights around my wrists. The reason I don't use Vim is because it's frankly not a smooth experience for most languages (unless you fiddle around a lot, and even then I found Ide+vim plug-in supe…

After a several month effort to learn vim bindings and use them full-time, I eventually ended up weaning myself back off because the plugins for the editors I actually use all seemed to come with considerable downsides. vscode-vim caused odd performance issues, and I encountered significant bugs with the undo stack (namely hitting 'u' would sometimes take out the last 10-15 changes instead of just one). IDEAvim would…

Reading about that undo bug gave me a knot in my tummy. Damn.
Post reply on HN