If you have failed to grok vi[m], you need two things. First, to understand just a little of two other editors, ed and TECO. Second, to know that vi's real modes are not what the naïve user, and sadly most documentation, call ‘modes’; they are line mode (ed mode) and visual mode (TECO mode).
ed is a line editor based on search-and-replace using regular expressions. To edit existing text, you typically locate it with a search and change it with a replace. Sometimes you refer to nearby lines with .±n addressing, and sometimes by absolute line number (having printed a few lines with the ‘n’ command); and sometimes you change entire lines (with ‘c') rather than doing a replacement; but really, search-and-replace is where it's at. vi's line mode, which you enter with ‘Q’ or more commonly one-off with ‘:', is just ed on steroids.
TECO is a character stream oriented editor, or, if you prefer, a programming language for manipulating streams of text. http://scientopia.org/blogs/goodmath/2010/11/30/the-glorious... is a decent short introduction. TECO text manipulation functions have an optional count, a function name (one or two characters), and an optional argument terminated by ESC. That should already look familiar; vi's visual mode is watered-down TECO. Sure, many of the functions have different names — vim's ‘h’ and ‘l’ are TECO's ‘r’ and ‘c’ — but some are the same: ‘i’ followed by an argument (i.e. some text) terminated by ESC is the function that inserts its argument before the current editing point. It's counterproductive to think of vi as having an ‘insert mode’ and ‘append mode’ and ‘replace mode’ and ‘substitute mode’ and whatnot, just as it would be conterproductive to think of the x in sin(x)² + cos(x)² as being in ‘sine mode’ or ‘cosine mode’.
Spend an hour with ed and an hour with TECO, and you'll begin to grok vi.
Why not just use jikl instead if you don't want to lift your hand to move to the arrow keys. I am kind of tired of seeing this obsession with trying to get everyone to use hjkl which just doesn't make any actual sense. I totally get the point about the arrow keys requiring you to lift your hand but you can accomplish the same arrow key logic while keeping your hand in the same place.
My #1 trick/recommendation? Use Control-[ instead of the Esc key. It's less hand travel and keeps your fingers on the home keys. It's all about minimizing your arm movements.
The same goes for hkjl. The arrow keys are too far away, that's why you use hkjl. Embrace the lazy and you'll grok vim.
As someone who uses a custom variant of the Dvorak layout, one thing about Vim that I find annoying is the that the navigation keys only make sense for a Qwerty keyboard. I know that it is easy to do a custom remap but nevertheless I find that it is harder to learn the commands when the keyboard shortcuts are no longer intuitive (e.g not using d for delete, etc.)
I'm in the same boat. I don't use hjkl for this very reason. I haven't remapped my keyboard because I'm constantly having to use a coworker's keyboard (most of which use Qwerty), and it's just easier to remember keys instead of positions on the keyboard. Everything works except HJKL...
If you're spending a significant amount of time navigating with with arrows keys or hjkl, maybe you should switch on incremental search and start using /[FOO], ?[FOO], t[FOO], b, w, %, ^ and $ more. It's highly unlikely that character-by-character movement will be the fastest way to navigate.
Alt+character is the same as Esc followed by character if you want to speed up your escaping without using a non-standard keyboard layout.
I can't use vim effectively because I constantly try to navigate using WASD.
I know I can bind it, but the thought of rebinding every command and then being dependent on towing the configuration to every computer I'd ever use scares me.
So I use it on occasion with the same artfulness as someone on crutches trying to dance.
Maybe someday someone will default an 'FPS' control layout.
I have probably tried 3 times to ditch the arrows and use hjkl and I've failed each time. What is the trick to overcoming this? Perhaps it's that I've done it while at work that has caused the issue (ie. I need to be productive now!). Pick a weekend and force the switch?
i think work is the best place to do it. just stick with it knowing that it may take a few days to get back to your original pace. don't allow your self to use the arrow keys and you will pick them up much faster. just remind yourself that you will be able to make up all the lost time because you will easily be twice as fast once you stop picking your hands up from the home row.
i went through the same pains. the worst was copy and paste. what a pain! but in a week or two it will become mostly natural.
I am not even close to being able to do this yet, but I keep reminding myself to use other movement commands and search instead. Eventually it will be faster.
[+] [-] ominous_prime|13 years ago|reply
> Your problem with Vim is that you don't grok vi.
http://stackoverflow.com/questions/1218390/what-is-your-most...
[+] [-] kps|13 years ago|reply
ed is a line editor based on search-and-replace using regular expressions. To edit existing text, you typically locate it with a search and change it with a replace. Sometimes you refer to nearby lines with .±n addressing, and sometimes by absolute line number (having printed a few lines with the ‘n’ command); and sometimes you change entire lines (with ‘c') rather than doing a replacement; but really, search-and-replace is where it's at. vi's line mode, which you enter with ‘Q’ or more commonly one-off with ‘:', is just ed on steroids.
TECO is a character stream oriented editor, or, if you prefer, a programming language for manipulating streams of text. http://scientopia.org/blogs/goodmath/2010/11/30/the-glorious... is a decent short introduction. TECO text manipulation functions have an optional count, a function name (one or two characters), and an optional argument terminated by ESC. That should already look familiar; vi's visual mode is watered-down TECO. Sure, many of the functions have different names — vim's ‘h’ and ‘l’ are TECO's ‘r’ and ‘c’ — but some are the same: ‘i’ followed by an argument (i.e. some text) terminated by ESC is the function that inserts its argument before the current editing point. It's counterproductive to think of vi as having an ‘insert mode’ and ‘append mode’ and ‘replace mode’ and ‘substitute mode’ and whatnot, just as it would be conterproductive to think of the x in sin(x)² + cos(x)² as being in ‘sine mode’ or ‘cosine mode’.
Spend an hour with ed and an hour with TECO, and you'll begin to grok vi.
[+] [-] cdash|13 years ago|reply
[+] [-] enoch_r|13 years ago|reply
A: for use within vim (where "i" has another meaning already), or
B: for people who have a long history using vim and are already used to the hjkl paradigm, or
C: (most often) both.
I'm really not sure why you would get tired of this "obsession." No one is telling you to use hjkl unless you're using vim.
[+] [-] raylu|13 years ago|reply
[+] [-] vacri|13 years ago|reply
[+] [-] snarfy|13 years ago|reply
The same goes for hkjl. The arrow keys are too far away, that's why you use hkjl. Embrace the lazy and you'll grok vim.
[+] [-] nnnnni|13 years ago|reply
The #1 trick is to swap control and caps lock. The #2 trick is to use control-[
[+] [-] Tmmrn|13 years ago|reply
http://upload.wikimedia.org/wikipedia/commons/3/36/KB_German...
[+] [-] a_p|13 years ago|reply
[+] [-] beatgammit|13 years ago|reply
[+] [-] whatshisface|13 years ago|reply
http://webcache.googleusercontent.com/search?q=cache:h6o6.co...
[+] [-] bw2|13 years ago|reply
[+] [-] bw2|13 years ago|reply
[+] [-] mortehu|13 years ago|reply
Alt+character is the same as Esc followed by character if you want to speed up your escaping without using a non-standard keyboard layout.
http://i.stack.imgur.com/uq2M1.jpg
[+] [-] armored_mammal|13 years ago|reply
I know I can bind it, but the thought of rebinding every command and then being dependent on towing the configuration to every computer I'd ever use scares me.
So I use it on occasion with the same artfulness as someone on crutches trying to dance.
Maybe someday someone will default an 'FPS' control layout.
[+] [-] gnosis|13 years ago|reply
[+] [-] raylu|13 years ago|reply
[+] [-] CoffeeDregs|13 years ago|reply
[+] [-] nate00|13 years ago|reply
[+] [-] z92|13 years ago|reply
After a few days when you are confortable with it. Start using hl for side arrows.
I did it like that.
[+] [-] papaver|13 years ago|reply
i went through the same pains. the worst was copy and paste. what a pain! but in a week or two it will become mostly natural.
[+] [-] jfabre|13 years ago|reply
[+] [-] Kluny|13 years ago|reply
[+] [-] bcl|13 years ago|reply
I am not even close to being able to do this yet, but I keep reminding myself to use other movement commands and search instead. Eventually it will be faster.
[+] [-] aMoniker|13 years ago|reply
[deleted]