Live data from Hacker News

Efficient Editing With vim

jmcpherson.org

31–40 of 125 posts

Re: Efficient Editing With vim

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

It's gotten to the point now where the first thing I say about any editor is, "That's cool and all... but does it have vim key bindings?" If it doesn't.... :q

I don't care how many built-in debuggers your IDE has; if I can't navigate it like I can vim, it's infinitely less productive for me.

Re: Efficient Editing With vim

#32
post #4

See, this is one of the things I love about Vim: there's always something new to learn! Somehow I had overlooked "K" to go to man pages. The other thing I love about Vim is the excellent documentation! I wanted to know more about "K" so I typed ":help K" and learned that, for example, if you're editing Ruby and would rather use 'ri' in place of 'man', all you have to do is add ":set keywordprg=ri" to your .vimrc (and…

Just a note, but ':help' doesn't always go to what you want. For example the option 'smartindent' (set with ':set smartindent') can be abbreviated as ':set si', but ':help si' takes you to the help for the ':sim[alt]' command.

It's useful to note that when searching through help you type something like:

  :help 'si'
To get help on a variable and:

  :help :si
To get help on a command. The first form would take you to the help entry for 'smartindent' and the second would take you to the entry for :simalt. If you just use:

  :help si
It will just find the first match for 'si', which in this case is the tag :si and not the tag 'si'.

Other possible confusions with :help are:

  :help tab
Will take to the help for (the tab key/tab character), whereas the help page for all the things related to Vim tabs is:

  :help tabpage
(though :help tabs will take you to the :tabs command which is part of the tabpage help doc)

Re: Efficient Editing With vim

#33
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 created this bash alias cause I was typing it so much at the the command line.

    alias :e=vim

Re: Efficient Editing With vim

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

Re: Efficient Editing With vim

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

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

Re: Efficient Editing With vim

#36
post #21
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.

20-year user of vi here... yes, once you get used to vi, going back to an editor for humans is hard.

I am still waiting for Vim FPS style (WSAD navigation keys, sniper scopes to skip words and all... sure it might need 3d graphics but hey, its the price you pay).

Re: Efficient Editing With vim

#37
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…

Instead of a literal ^M in the file, just use .

And I think you mean "set hidden".

And regarding E173: You can :qa, which won't lose any unsaved changes.

And the proper vim package for Debian or Ubuntu is "vim". "vim-full" is the old name and it just installs "vim".

Re: Efficient Editing With vim

#38
post #32
post #4

See, this is one of the things I love about Vim: there's always something new to learn! Somehow I had overlooked "K" to go to man pages. The other thing I love about Vim is the excellent documentation! I wanted to know more about "K" so I typed ":help K" and learned that, for example, if you're editing Ruby and would rather use 'ri' in place of 'man', all you have to do is add ":set keywordprg=ri" to your .vimrc (and…

Just a note, but ':help' doesn't always go to what you want. For example the option 'smartindent' (set with ':set smartindent') can be abbreviated as ':set si', but ':help si' takes you to the help for the ':sim[alt]' command. It's useful to note that when searching through help you type something like: :help 'si' To get help on a variable and: :help :si To get help on a command. The first form would take you to the…

":help help-context" explains this. And :h 'si' is for an option, not a variable.

And what's up with highlighting the most abused and misunderstood option ever? 'cindent' replaced 'smartindent', and usually you want "filetype indent on" in your .vimrc, not "set si" or "set cin".

Re: Efficient Editing With vim

#40
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. :)

I've hit ctrl-w and closed a window while taking a test in class.
Post reply on HN