Live data from Hacker News

Efficient Editing With vim

jmcpherson.org

71–80 of 125 posts

Re: Efficient Editing With vim

#71
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

Man this is awesome! I've just written this comment in vim. Thanks a lot.

Ugh... I decided to edit some more.. Hm.... ughh... more....

Re: Efficient Editing With vim

#72
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.

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

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

Re: Efficient Editing With vim

#73
post #35

Earlier quoted context omitted.

I've hit Ctrl-W to try to delete a word, and ended up closing an IRC window. It's not exclusive to vim. :)

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.

Re: Efficient Editing With vim

#74
vi is my favorite Rogue-like, with NetHack in close second, and my own http://DeadByZombie.com in third.

vi is the only Rogue-like where you can get real work done with it. And every time you learn a new trick it's like your XP level or attribs go up, or you've descended down to a new more evil level of the dungeon, with more powerful monsters to fight with your enhanced vi-fu.

Re: Efficient Editing With vim

#75
post #13

Earlier quoted context omitted.

also #gt will go that tab number. I've changed my tab text to show the number in parenthesis before the name.

That's a neat idea. How do you change it to show tab number in the tab header?

    :help setting-tabline

Re: Efficient Editing With vim

#77
post #35
post #19

Earlier quoted context omitted.

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.

I've hit Ctrl-W to try to delete a word, and ended up closing an IRC window. It's not exclusive to vim. :)

OS X:

Put the following in ~/Library/KeyBindings/DefaultKeyBindings.dict

{ "^w" = "deleteWordBackward:"; }

GTK:

echo 'gtk-key-theme-name = "Emacs"' >>~/.gtkrc-2.0

gconftool -t string --set /desktop/gnome/interface/gtk_key_theme Emacs

Windows:

... uh ...

Re: Efficient Editing With vim

#78
post #15
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.

Similar to this, you can open up multiple files at the same time without saving. set bufhidden nmap :bp nmap :bn If you put this in your .vimrc file, you'll need to put a '^M' at the end of the nmap lines. You do this by doing and it puts in a special character that means newline. Then you can switch between open buffers with ctrl+l and ctrl+h even if you have unsaved changes. it will end up looking like this: set bu…

I rely on buffers rather than tabs, too, and find minibufexplorer.vim to be a great addition: http://www.vim.org/scripts/script.php?script_id=159

Re: Efficient Editing With vim

#79
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/scripts/script.php?script_id=159

surround.vim: http://www.vim.org/scripts/script.php?script_id=1697

More of a full-fledge suite, a frontend to a head{ed,less} Eclipse server: http://eclim.sourceforge.net

Re: Efficient Editing With vim

#80

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
Post reply on HN