Staying the hell out of insert mode (vi)
cloudhead.io
cloudhead.io
I've remapped caps lock to ESC, which I think is a far better use of that useless button, and a hack i recommend to everybody i know who uses VIM.
I could never understand that VIM choose to put such an important button so far away from the homerow.
Moving it is easy, of course. Also, Ctrl-[ is usually the same key as Escape, and if you have CapsLock remapped to Ctrl, they're practically on the home row. (The article hints at this, but doesn't explicitly note that C-[ is Esc.) You could also remap CapsLock to Esc, of course.
Once in an effort to reach maximum typing efficiency, i attempted a switch to VIM+Dvorak. However, i quickly realized that i would have to use a Danish variant of Dvorak (there is no official standard..) and remap VIM to oblivion, which would make me too much of an oddball masochist.
I use the English/American Dvorak, but it takes me a second to switch back to qwerty as necessary. (I'm probably in the rare niche of mixed vi/emacs users, FWIW.) Vi + Dvorak isn't so bad, though I feel like Dvorak is (somehow) more compatible with Emacs.
http://www.engadget.com/2007/01/26/happy-hacking-keyboard-li...
Sorry. Had to get it out my system.
They have two thumbs, but within reach of their thumbs are extra keys. They need these extra keys because there are a lot of characters in their writing. They don't need more thumbs, because they only need to push one of these extra keys at a time.
Do I need more pointer fingers if I need to use one of the Y, H, N, B, T, G, and V keys?
I find that Mac keyboards are very difficult to remap. Is there any reason for that? Or maybe there's some utility that handles remapping I just can't find. Buggy as it is, I miss xmodmap.
If you want to map something to ESC, try PCKeyboardHack: http://pqrs.org/macosx/keyremap4macbook/extra.html
This was particularly unfortunate in a coding interview:
"I'm used to a different keyboard layout, seriously."
git clone $myserveraddy/homedirpublic .
which includes a relevant vimrc. Helps alot. (get permission first with explanation of why...)Incidentally, having been on the interviewing side, I do not see this often enough. Bringing your own laptop ought to be something you always do. I can provide "a" coding environment but it won't be "yours". Unless you always develop in a completely uncustomized standard Visual Studio environment, maybe (in which case frankly I'm still wondering a bit...).
As a code composing environment it leaves a lot to be desired until you've tacked on enough plugins that it looses a lot of it's vimmy goodness (imo obviously), as a result I tend to do my first draft in various places (FlashDevelop, the Factor Listener, Dr. Scheme etc...) and then use vim for all the follow up work.
I don't know that it's a failure of vim but I think it's part of the reason articles like this keep getting written. The people not already deeply invested in an editor/IDE (me for instance) are the ones who spend more time writing new code than maintaining or adding to a significant existing code base.
Just my thoughts, not really a comment on the article.
I try to keep my vim pretty vanilla outside of font and color preferences because I spent most of college jumping from one computer to the next and I didn't want to get used to relying on anything that wouldn't be there next week.
That said vim + screen kinda translates to vim + 'my entire computer' which doesn't prove my point really but also doesn't say much about the completeness of vim as an environment.
That said, I much prefer hex-editing with Emacs to using a combination of xxd and vim.
I've tinkered around with hacks that put shells in Vim windows but it wasn't really satisfactory.
Screen is basically a terminal multiplexer. This would work a little differently if you were using gVim instead of Vim (from within the same screen session that you're sending the test suite command to). If you were using gVim you'd need to use a named screen session (the -S option) and send the screen command to the named session (and possible have logic in the Vim/gVim function to start a named session if one doesn't already exist). Then you'd need a separate terminal window attached to that screen session to view the test suite output.
Do a search for vim and REPL or SLIME for articles like this: http://technotales.wordpress.com/2007/10/03/like-slime-for-v...
These articles use the vim+screen combo to send commands to an interpreter, but you can use the same concepts to send your test suite to a screen session.
Another trick that is useful for people who compulsively hit the Ctrl+s keybind from other editors; the following is from my vimrc:
" Map Control+s to save a file
nmap <C-s> :w<CR>
imap <C-s> <ESC>:w<CR>
This leaves you in normal mode which is usually what I want when I hit ctrl+s.http://www.vim.org/scripts/script.php?script_id=1879
http://vim.wikia.com/wiki/Omni_completion
C++ http://vim.wikia.com/wiki/C%2B%2B_code_completion
Python http://www.vim.org/scripts/script.php?script_id=1542
Objc http://www.vim.org/scripts/script.php?script_id=2674
Most people who use vim don't use it as an exercise in minimalism we're often caricatured as constantly undergoing. I mean, we don't chock it up to Visual Studio/Emacs level of plug-ins, but we definitely use some in our day to day on average.
How do you know that?
Even in unix shops, lots of the people end up trying to use stuff like kDevelop and stuff. Those of us who instead vim, we talk.
Good luck! The muscle memory you learn now will pay off in the future! :D
Edit: That should be close tab, not close window, c-shift-w is window.
(I've never really understood why there are keyboard shortcuts for things like "quit program" and "print". How often, if ever, do you want to do those things? Do they really need to be one keystroke away!?)
How is it not useful to have a keyboard shortcut to change focus between windows? Windows in vim refer to what I believe are called "splits" in emacs. The vim c-w stuff is analogous to c-x stuff in emacs.
As for close tab shortcuts in firefox -- I use it all the time. Standard work flow for me includes c-t, google.com, <misspelled word>, c-w, <correct spelling from "did you mean">.
This might be quicker: c-k, <misspelled word>, alt-enter, c-w
alt-enter opens a new tab with the search.
It's very useful in situations like this to know that Ctrl-Shift-T reopens the last closed tab, and you can press it repeatedly to continue opening less-recently closed tabs.
> sl
zsh: correct 'sl' to 'ls' [nyae]?
(edit: formatting)Of the hundreds of times this feature has popped up, I believe I've actually hit "y" twice.
Vim's indentation changes still require a mode change three obscure keys and an enter, and vim's discoverability still sucks.
vim has had code folding for years:
:help fold.txt
If you want to indent code, < and > are your friends. (Really? Indenting code with search/replace? What are we, barbarians?)"=" is the autoindent command. Vim recognizes many languages and you can give it plugins to understand more. Use "==" to autoindent the current line. My personal favorite, "gg=G", jumps to the top of the document and autoindents the entire thing. One time at work I was gently reminded how many spaces I was supposed to indent per the company's coding standard. I quickly set the relevant editor parameters and with four keystrokes my code was compliant.
I think there's a code-folding ability but I've never used it.
Edit: actually, its pretty good for any piece of software.
Incidentally, I sometimes use vim as $EDITOR when dealing with perforce, because if the editor dies (or fails to start) for any reason, all changes are committed by default with no commit message... and sometimes I don't have an emacs for emacsclient to connect to. (The result is 30 minutes of work trying to get perforce to uncommit my changes. Usually I fail and just comment out the tests, commit that, and fix the code later. Ah, perforce...)
Anyway, I recently discovered that C-p, C-n, C-b, and C-f work as they do in Emacs. They just need to add C-a, C-e, M-m, C-k, and C-y, and normal mode will become unnecessary. (And I won't need to install mg on so many machines.)
And then vim will almost have as many editing features as my bash prompt ;)
That said, if you really believe that vim can't do everything that emacs can do in editing, I have nothing else to say...
Look, if you're arguing this just to take potshots at "that thing you don't like" then we should end this conversation now. If you're open to the possibility that we can both be productive with different toolsets then I'd like to learn more about your setup and maybe share some of the benefits of mine.
I think the real solution is to make vim my main editor for working in C#. That's a pretty tall task unfortunately.
Of course for C++, VS intellisense is a lot weaker and probably not that much of a draw.