|
Not to troll -- indeed, I am attempting to be constructive -- but in case anyone was interested in (what I know of) vim's equivalent functionality, here's what I have so far: 1) Several options: :help <something>
:h <something>
Shift-K to run a program to lookup the keyword currently under the cursor (the program defaults to man). On that note, you could just :! man <whatever>
if so compelled.2) qq = record macro to register q. @q = replay macro at register q. 100@q = repeat macro q 100 times. @@ = repeat the previous @<whatever>. The author notes that you can tell Emacs to "please repeat this macro until it would cause Emacs to start beeping", which I found interesting. I'm not sure if there's a specific way to do this in vim; I often just go with, e.g., 1000@q (or whatever arbitrarily large number you want. You can check how many lines are in a file, among other statistics, with g<ctrl-g>). So long as the macro ended with a j (or whatever motion you wanted, technically) it would continue carrying down the lines. It seems as though you could be able to execute macros on some chunk of text, perhaps with visual line select. Hm... Another interesting feature the author notes is "counters let you insert a different number every time a macro is run." I've had some annoying experiences bending over backwards for this, so I'd like to know an easier way, but it's certainly possible using the C-A and C-X keys, which increment and decrement a number under the cursor, respectively. 3) Ctrl-v for visual block mode (remapped to Ctrl-q for :behave mswin, since Windows captures this as Paste); then, simply move around with the regular keys and perform fancy editing to your heart's content. I use this often, for instance, to insert comment marks in a chunk of text. Go to the first column & line of the block, ctrl-v, hold down j till the region reaches the last line you'd like, then shift-I, type your comment characters (e.g., "//" or ";" or "#"), then <esc> and the insert takes effect on all lines of the previous region. Also useful during the many adventures in the different visual-select modes, use gv to re-select the previous visual area, should it happen to become deselected. For instance, when I am holding down j in the previous example and prematurely hit Shift before letting go of j, it joins the lines up. Argh! u (undo) then gv to continue on my way. 4) When I first read about this, I was immediately interested. For similar functionality (couldn't claim whether or not it was the SAME, strictly, as I don't actually use Emacs), there's the extension that I now adore: YankRing. http://www.vim.org/scripts/script.php?script_id=1234 5) I tend to use :diffsplit, though there are other ways to work with this. As per item 1, :help diff. 6) Sad to say I'm at a loss here -- not to say vim couldn't do this, but rather I've never needed to do this in my range of experiences (clearly limited compared to that of the author's). If anyone could fill this in, I'd be interested. 7) The few times I work with a language that doesn't have a shell: :make
Though there are parameters and options to tweak with. For instance, which program to use by default, whether or not to create a temp file for the errors, jumping to the first line containing an error, etc. As stated, I do most of my work in languages with shells anyways, so I'm not an expert with this command. :help make, for more info.8) Admittedly not built-in (being against vim's Do One Thing Right philosophy, I suppose), but the plugin I use for this is vcscommand: http://www.vim.org/scripts/script.php?script_id=90 with a Mercurial backend, since the base plugin is for CVS, SVN, SVK and git: http://www.vim.org/scripts/script.php?script_id=1898 Then, it's a matter of :VCSVimDiff, :VCSCommit, :VCSAdd, which you can remap to whatever keystrokes you like by editing your .vimrc (see item 10). 9) Again, I've never done such things, so if anyone could step in for our fellow vimmers, that'd be great. 10) You can edit your .vimrc to remap keys as you'd like -- including binding them differently per mode you're in. Taking some silly examples from my .vimrc: "Maps ctrl-enter in insert mode to open a line below your current line:
imap <C-CR> <esc>o
"Maps ctrl-enter in normal mode to simply o, in case my muscle memory goofs and
"doesn't notice I'm in normal mode:
nmap <C-CR> o
You can also set abbreviations, which will expand as you type: "Fix typo
abbr teh the
"automatically expand {{ into a curly-brace block, the idea being to hit Enter
"after typing the {{
ab {{ {<cr>}<esc>kA
|
Does anyone have significant experience in both, enough to know the peculiarities and such of each editor? I'd love to hear what you have to say on how they compare. Is learning Emacs worth it any more than learning everything Vim has to offer? Since I plan on using this for many years, I'd like to choose the optimal tool, even if it means wasting a year of experience.