Live data from Hacker News

Efficient Editing With vim

jmcpherson.org

81–90 of 125 posts

Re: Efficient Editing With vim

#81

A decent intro; I'd add to the movement section these: g$ - move cursor to last displayed character of line Tx - move cursor backward and to the right of the first occurrence of x (reverse of tx) And get started with split views: ^ws - horizontal split view ^wv - vertical split view ^w{h,j,k,l} - move to window in respective direction Some decent scripts to get started with: minibufexpl.vim: http://www.vim.org/script…

Another nice script I discovered recently is Nerd Tree : http://www.vim.org/scripts/script.php?script_id=1658

Nerd Tree is indeed a good one, and I'll add to this vimfs, which isn't a Vim plugin but rather a CLI file system browser with Vim bindings. I hardly ever actually browse my file system (zfs, grep, and locate do all of the work for me), so I'm not sure how much mileage one can get out of this (especially compared to something like Midnight Commander).

Re: Efficient Editing With vim

#82

Earlier quoted context omitted.

I would kill for GMail to add vim-like text editing.

Try Vimperator. opens gvim for the currently-focused text box.

You have made my day.

To make this work with MacVim on a Mac:

    :set editor="/Applications/MacVim.app/Contents/MacOS/Vim -g -f"

Re: Efficient Editing With vim

#83
post #66
post #6

I feel silly for only recently discovering tabs in vim. :tabnew file Opens up a new tab, :tabn Goes to the next tab, and :tabp Goes to the previous tab. Works great in both gui and non-gui mode.

You can always open files as tabs at startup too with -p, like this: vim -p foo.c foo.h

Thanks, I've made frequent use of doing that with -o (horizontal split) and -O (vertical split).

Re: Efficient Editing With vim

#84
post #17
post #5

I think it's the first time that I want to install vim to try it. As a Windows user, I always found NotePad++ and other text editor an easier choice but I can now see some powerfull utilities to vim now. Very clear article.

(I'm just throwing tips in comments where I see opportunities to help people who find any of the same niggles I've had over the years.) Users who want to run Windows vim with no titlebar, create a file _vimrc in your base vim directory (on my windows desktop it's C:\Program Files\Vim). In this, put this line: set guioptions-=T

You mean toolbar?

Re: Efficient Editing With vim

#85
post #19
post #14

Warning: learning Vim makes you look for Vim like commands in any program you interact with using the keyboard. Everything else will be frustrating.

By force of habit, when I wanted to close an IM window, I have typed :q Instead of switching to the mouse and hitting the "x". Then I had to explain to the person that I wasn't sticking my tongue out at them.

We see a lot of ":q" messages in #vim.

Re: Efficient Editing With vim

#86
post #23

Earlier quoted context omitted.

I would kill for GMail to add vim-like text editing.

Have you heard of the "It's All Text" Firefox extension? It copies the content of any textarea to a tempfile and opens it up in an external editor of your choice. Writes to the tempfile are copied back to the textarea. It's not quite in-browser vim, but it's pretty close. https://addons.mozilla.org/en-US/firefox/addon/4125

There is also ViewSourceWith which allows the use of different editors.

Re: Efficient Editing With vim

#87

Earlier quoted context omitted.

I once wrote ":tabnew something.js" in my IM window and sent it before I realized that the wrong window had focus. The person replied with, "bash: :tabnew: command not found." I told him, "I was hoping you were vim, actually".

HA! Also using vim will cause your escape key to be heavily hit constantly after typing anything especially if you are not sure what mode you are in, then only realizing you are not in vim period.

ctrl+c is much better than esc :) but I use emacs more than vi[m]

Re: Efficient Editing With vim

#88

Earlier quoted context omitted.

I've found it easy to avoid misusing Ctrl-w because of the fact I use it so much to close tabs in Firefox. You just need to have two different uses for something, both of which you use very regularly, to get used to not accidentally misusing them, I've found.

Vimperator will break that habit, for sure.

Alas, I think you may be right. I haven't been using it very long.

Once I actually buckled down and started learning how to use it, I was surprised by how quickly and easily a natural feeling of "this is how it should be" developed while using Vimperator. Of course, there's a lot of positive transference of knowledge from my heavy use of Vim itself, but still -- I didn't expect to find it this easy.

I think part of the reason may be that every single keyboard-driven browser I have ever used before (Lynx, W3m, Links, et cetera, ad infinitum) was so awful as a Web interface that I became convinced Web browsers were a uniquely GUI-suited type of application. Vimperator is definitely changing my mind.

Thank goodness.

Re: Efficient Editing With vim

#89

Earlier quoted context omitted.

I would kill for GMail to add vim-like text editing.

Try Vimperator. opens gvim for the currently-focused text box.

I had no idea this feature existed. I was still using the View Source With extension to open Vim in a terminal emulator window when editing text in a text area, even though I have Vimperator. Now I can do away with the extra extension.

Thank you.

Re: Efficient Editing With vim

#90
post #86
post #23

Earlier quoted context omitted.

Have you heard of the "It's All Text" Firefox extension? It copies the content of any textarea to a tempfile and opens it up in an external editor of your choice. Writes to the tempfile are copied back to the textarea. It's not quite in-browser vim, but it's pretty close. https://addons.mozilla.org/en-US/firefox/addon/4125

There is also ViewSourceWith which allows the use of different editors.

. . . but Vimperator also Vimperates the entire browser, instead of just the text areas. Unless you're an Emacs zealot, I don't see the downside.
Post reply on HN