Yes, as is having a keyboard with more than 64 keys, a pointing device, software that allows character insertion, deletion and cursor motion all without changing modes, or any computer designed after 1980. We must all fight against this rising tide of convenience and efficiency by insisting that everyone use vim and its descendants.
Being "anti-vim" is perfectly alright with me. I use vim because it's the fastest thing I've ever used by a very wide margin. I also respect others who find it too hard to learn or find they're more productive elsewhere.
But a comment that essentially boils down to "vim is archaic" in a post about vim usage habits is totally ridiculous, so in the nicest way possible, get lost.
> This comment is ridiculous.
Yes. However, I would point out that eventually this productivity thing matters i.e. more productive developers will be able to effect more change in the world faster than less productive developers.
While I'm all for sharing knowledge, if my competition is putting creative effort into hobbling themselves, then I say leave them to it.
> I use vim because it's the fastest thing I've ever used by a very wide margin.
I used to think this, but then I paired with someone who was eye-wateringly fast with TextMate (that person has since converted to using vim full-time). Rather than speed, for me at least, its always been about fluency (how little cognitive load is there between thinking and the code appearing). I happen to be a lot faster than most IDE clowns I happen to be working with, but I believe that's a happy side-effect.
And entirely topical. Young programmers who read such posts may not realize how many more efficient options are now available. Speaking about vim as though it's an obvious choice in 2013 would be like insisting that everyone code in Fortran in 2013.
I had this problem when I used to play Counter Strike Source. I was weapon switching with the scroll wheel which is just terrible, and since it is a shooting game I was getting shot because in a tight spot I couldn't pull out my pistol fast enough. So I just unbound the scroll wheel for a couple weeks and then using the number keys instead was natural, and now it doesn't matter if the scroll wheel is connected or not, I reach for the numbers first.
So after you fix the habit you can put the mapping back and still have it available.
Totally Unrelated: I read most of your book about sailing (most I think, you're in the Mediterranean,) and I've enjoyed it, cheers.
Yes, but in modern times, the habit of navigating with arrow keys is a more transferable habit to develop. Assuming we use more than one program in our work.
And almost no programs retain the archaic i/j/k/m navigation scheme -- not surprising, since those are letter keys and most modern programs don't require the operator to switch modes in order to move the cursor -- and why should they? A modern keyboard has dedicated keys for that purpose.
> I read most of your book about sailing (most I think, you're in the Mediterranean,) ...
Thanks -- well, I did have to sail the remaining half distance around the world from there. :)
The above refers to my free world sail book: http://arachnoid.com/sailbook
I have a pointing device that I like a lot for some purposes, but I don't use it for core work, since that revolves around manipulating a bunch of symbols found on the aforementioned keys, and not found on the pointing device. I call this convenience and efficiency.
vi and its descendants — actually TECO and its descendants — don't actually have ‘modes’ in the sense suggested. They have functions with arguments, and certain rules for combining these functions. What this article is trying to point out is that some of these functions take advantage of the correspondence between the symbols being manipulated and the symbols literally at the user's fingertips. I call this convenience and efficiency.
The article isn't about not using h,j,k,l completely but encouraging people to use those other keys for movement.
I for one welcome touch screens for programming, which are even better than a mouse (touch screens are of course not a good replacement for a keyboard, they are however a good replacement for a mouse for many tasks).
Mouse works, scroll wheel, arrow keys work even in terminal.
It's really about switching files, navigating by class/definition, and 0 latency GUIs. ZERO. No excuse for having to wait for your computer when you are just editing text files.
Sublime Text is pretty fast but still I'm often waiting for it to build a new tab or format search results. Eclipse is unusable.
More importantly, why don't we have eye tracking so we can just look and start typing ? Maybe leap motion can get us there.
But, I had to deal with hjkl on dumb terminals either without arrows, or with arrows that didn't work. I always hated it. The arrow keys I find very obvious, simple and effective.
"hjkl is faster than reaching for the cursor keys". Holy frigging crap! Really? You are so good as a developer that MILLISECONDS make a difference? It does not take you hours to come up with algorithms or program structures to solve problems. And, when you do, you write code at blinding speeds (using vim) with NO BUGS, therefore MILLISECONDS matter because you are not one of those programmers who will need to spend HOURS hunting down and fixing bugs. Oh, yes, and 100% of your time is spent coding. You don't lookup documentation and you don't do any file management at all. You are a damn coding machine who can actually measure productivity by the millisecond and who must absolutely use the shittiest possible UI in the context of modern hardware to shave milliseconds from your every keystroke. You never reach for your iPod to look for music or read through HN, Facebook or even your email throughout the day because that wastes minutes. You never take a break, shoot the shit or theorize and ponder with your coworkers because you measure your life by the MILLISECONDS of flight time difference between the hjkl keys and the up, down, left, right keys 12cm away.
Right. The reality is that this is just a "I belong to the club" delusion that has nothing whatsoever to do with being a good programmer, writing good, clean, usable, extensible, reusable, fast, efficient and bug-free code. It has nothing whatsoever to do with delivering a product anyone wants and doing that on time and on budget. It has nothing whatsoever to do with being an entrepreneur, building a company, paying the bills and delivering value to users and investors alike.
It has everything to do with being a complete child and refusing to understand that there are places where you could optimize your time and energy that represent, without exaggeration, PRODUCTIVITY GAINS IN THE ORDER OF MILLIONS TO BILLIONS OF TIMES GREATER than the time required to reach for arrow keys or, Darwin forgive, the MOUSE (yes, he used that word) a few hundred times per day.
Grow up!
A religious attachment to vim? No friggin way. No editor has ever caused one of my projects to come in late (or early). The factors that affect real projects are so far removed from the software one uses to edit code that it is incredible some people evangelize something like vim to such an extent.
The other really funny thing is to see articles and blog posts describing how to add trees, tabs and all manner of other things to vim and how this makes it even cooler. Really funny.
There are plenty of legitimate gripes to be made about vim, but you really should consider taking the time to learn a serious programmers editor like Vim or Emacs. That would at least help you avoid looking like a fool by ranting about things you clearly don't understand.
You may even find (god forbid) that you enjoy it.
Let's talk about being a fool and talking about things I don't understand.
I have started (and self-funded) at more than three technology businesses in my life. I am in the process of starting two more.
In all cases these businesses started in my garage (one actually in my closet, before I had a garage) and managed to grow to the point where I got them out of the garage and actually hired many people.
Some of these businesses shipped product internationally, all over the world.
All of these businesses were hardware and software businesses.
Some succeeded and others failed.
And, in every single case, different technologies and tools came into the fold.
In no case whatsoever --not one-- across THIRTY YEARS of entrepreneurship did a fucking text editor have anything whatsoever to do with the success or failure of the enterprise or project.
Across a wide range of languages and technologies: machine language (actually typed-in code with a hex keypad), assembler (various processors), Forth, C, APL, C++, Fortran, Visual Basic, Lisp, Python, PHP, JavaScript, Objective-C, Verilog, 8080, 8085, 80x86, PDP1104, 6502, MC68K, PowerPC, Xilinx FPGA's, PC, Mac, Linux, embedded, workstation and server software and a few other things I probably don't remember doing.
Not once. Not ONE TIME. Have I experienced a situation where using something like vim would provide any advantage whatsoever.
And, yes, I use vim on my Linux servers because it's there. I don't have to think about it. It's the tool that comes with the box and I use it. From there to actually CHOOSE to use vim everywhere for coding our projects and to go past that and evangelize vim? That would be insane. There far more moving parts and issues in a business or in any piece of software for a text editor to make any real difference whatsoever. You can go on believing it does. And that's fine. That's not going to make it any real than believing in the tooth fairy.
Show me a real project and a real business that came in on-time, bug-free, profitably and ahead of schedule BECAUSE OF vim and I'll gladly eat my words. Because I actually happen to know what I am talking about I can say with absolute confidence that the whole thing is a big smelly pile of bullshit. If the authors had the tools, keyboards and peripherals we have today vim would have been completely and utterly different. Do you honestly believe that these guys CHOSE to have modes because of some divine revelation? No, they didn't have the friggin keys and needed to come-up with a solution. The same reason Wordstar had shit like Ctrl-K-X.
As for myself, I don't really care much about speed while coding, however, I do care much about being efficient at doing things. Why should I have to move my hands up to reach the arrow keys, if I can use the home row instead? I do think it is very tiresome to move my hands around (maybe because I'm lazy?). This of course applies to the mouse/trackpad as well. Again, you need to move your hand to away. Again. Not necessarily about speed, more about efficiency and convenience.
Today. Sure. Imagine my surprise when I see yet another bullshit vim article on HN, this one now saying "don't use the hjkl" keys. When will the madness stop?
Newbie programmers reading HN actually need to hear from someone who clearly sees that the emperor has no clothes. Some look at HN as the reference by which they ought to shape their learning and careers. There's a definite pro-vim bend here. And it's all bullshit.
If your goal is to be an entrepreneur, focus on the stuff that actually matters and is many orders of magnitude more signifiant than a ridiculous text editor from an era when keyboards had letters, numbers and three or four extra buttons.
If you want to be a fast data entry operator, definitely spend months getting good at vim.
Better yet, buy one of those single-hand chord-based text entry keypads and modify vim to work with it. You'll be able to type faster and with only one hand. Not sure if the work will have any quality at all or if it will be bug free or if you will be building anything anyone wants or if it will be profitable, but it will be awesome to behold.
Vim is making a 5 seconds difference on every edit. Each edit can be defined as commenting out blocks of code, insert/delete text, or moving blocks of code. If your IDE provides convenient key combo to do these tasks, then great, you have no reason to use Vim. But as soon as you reach for your mouse, you just wasted 1 seconds. Dragging your mouse to select the text you want to change takes another 5 to 10 seconds.
> Oh, yes, and 100% of your time is spent coding. You don't lookup documentation and you don't do any file management at all.
Documentation lookup is much faster through terminal :) Man page is easier to navigate than JavaDoc because of that no mouse needed.
File management is easier and faster through terminal. Think about the process that you move/copy file in GUI. 1) You open one Window, then navigate through folder tree with mouse double clicks; 2) You issue a copy command to the file you want to copy/move; 3) You mouse click to destination folder then paste it. Terminal based file management is just `cp /source/folder/autocompleted/with/tab/key /destination/folder`
I think the true argument here is not Vim or not Vim. It's about mouse or no mouse.
Please. I'm on the floor laughing. Five seconds. I'm not 12 years old any more. I learned to use a stop watch a long time ago. If you want to believe your own folklore that's fine with me.
In any non-trivial software project far more time --ORDERS OF MAGNITUDE MORE TIME-- is spent (or wasted) on planning, executing and, yes, fixing bugs, on software. The speed of your text editor is a rounding error in the balance sheet.
Like you say when your jumping around a lot then it matters less. When you're typing a lot then it does matter to keep your fingers on the home row.
And my point is that it does not matter. Use the mouse. Use the arrow keys. Use the function keys. Use a GUI. Use multiple monitors.
If we are talking about productivity and code quality, the editor is orders of magnitude less significant than a huge list of other things. It does not matter.
Then we have someone now saying "don't use the hjkl" keys. Really? How far is the idiocy going to go?
If I am building a business or a product the last thing on my mind is what text editor we will be using. It is so ridiculously insignificant in the grand scheme of things that seeing people focus on it is beyond comprehension.
I have never, in THIRTY years of designing hardware and writing software, been slowed down by a text editor of nearly any kind (other than the first time I used VI). And, yes, I can use vi and vim. And yes, I think it is total horse-shit. The things that have slowed me and others down, caused projects to fail, caused robots to crash and damage something or caused the success or failure of a business have been orders of magnitude removed from any advantage that could be had via a text editor, even if it was wired into my brain.
It is OK to make oneself believe that this is really useful stuff. Some people believe in all kinds of invisible things. And, in that context, anyone going against those beliefs is a lunatic. I am, on more than one front. I prefer to focus on what is real and what is significant.
It isn't only about shaving milliseconds off your coding. I realize this is mostly anecdotal, but I find when I'm editing in vim or any good IDE, I can focus more on the algorithm and less on the act of typing, and a deeper focus on your program (i.e. data structures, control flow, etc) rather than on typing, does have an advantage.
Holding down the left or right arrow key while waiting for the cursor to move to the end of a line, or reaching for the end key is distracting and interrupts concentration, even if it is brief. Waiting for a cursor to move puts a greater strain on working memory because it means maintaining state information, in memory, for a longer period of time. While these distractions are somewhat minor for a single line of code, they really add up when you're' coding for 8 or 10 hours a day. In fact, I find these distractions add up to the point where I need to be editing in Vim or a good IDE to get in a state of flow.
Now, before someone calls me out on it, I'd also suggest that I don't believe using vim or an IDE increases the load on working short term memory. When you're initially starting out with a new tool, obviously it does increase the working load on memory, but once the key bindings are committed to muscle memory then, almost by definition, you're no relying on working memory.
I am no stranger to 16 hour coding marathons. In fact, about 15 years ago I launched a company out of my garage. For the first nine months or so I nearly locked myself in the garage for 16 to 18 hours a day coding. The work required a combination of Verilog for the FPGA, C for the embedded processor and Visual C++ for Windows. Three different editor/IDE's: Xilinx ISE, Keil uVision and MS Visual Studio. Over the nearly nine months of intense 12+ hours of straight solid coding in that environment I could not give you one example of situation where having to reach for the "END" key, the mouse, the arrow keys or "Ctrl-F5" or whatever bothered me in any way imaginable. The IDE's and the text editors, for the most part, were relegated to background noise.
The things that slowed me down, caused grief and broke my short or long term concentration and my ability to maintain state have never, in my thirty years of programming, had anything whatsoever to do with the editor and the keystrokes I might have to use running it.
Anecdotally I will make a blanket statement and say that this is exactly the case for the vast majority of programmers. No, I don't have data other than to say that I have worked with lots of people over my career. Across platforms, languages, tool chains and editors I have never heard anyone complain about loosing state or concentration due to the editor. Until I started reading HN.
Is there a type of personality, a type of programmer that can loose state from something as insignificant to some of us as reaching for the mouse or the arrow keys constantly? Maybe, I don't know. I have yet to meet someone like that in person. If the answer is "yes", I'll have to simply take your word for it. I don't know.
It might be also important to consider for a moment that those who have NOT forced themselves to use vi/vim are perfectly comfortable with the keystrokes and commands typical modern editors use.
If you stick to Windows and even Linux GUI the vast majority of the navigational commands are the same that you might find in MS Word, Excel, Outlook and your web browser. The "Ctrl-C", "Ctrl-V", "Ctrl-X", "Shift-[down arrow]", "Shift-[end]", "[home]", "[end]", "Ctrl-[left arrow]", "Ctrl-F", "Ctrl-H", "Ctrl-S", "F3", "Shift-F3", mouse scrolling modes and other commands are part and parcel of this "muscle memory" a lot of vim proponents mention.
In other words, nobody thinks "oh crap, I have to reach for Ctrl-F again", it just happens. And, it happens with great uniformity across platforms, applications and tools. Various tools introduce a few (or a lot) of specialize commands, like "Ctrl-F5" for "compile and go" on an IDE, "Ctrl-B" to "build" or "F12" to launch your site on a browser on something like Dreamweaver. These are not and have not been problems for anyone with whom I have ever worked.
Here's what I find interesting. I was using real terminals and 300 to 9600 BAUD teletypes over real leased lines talking to mainframes towards the very tail of that era in the 80's. I even had a little bit of experience using Tektronix storage tube terminals (one of the few ways you could render APL characters at the time). All of these had crippled keyboards with half the keys we have today. Editors at the time were weird and had shit user interfaced due to the limitations of the hardware. Every single one was different. Either you had modal editors or editors with weird Ctrl-<something>-<something> keystrokes. When CPM and S100 computers came along you could get WordStar and eight inch floppies. Ctrl-K-X brother! I even owned a real DEC VT-100 terminal.
I think I can safely say that those of us who came up that route were GLAD to get rid of these shitty UI's and crappy contorted-command editors that were a pain in the ass to use and learn. As keyboards and peripherals evolved and we got things like "standard" keyboard with expanded key sets (Thanks, mostly to IBM and the PC revolution) things began to standardize around the newly available keyboards. No programmer in their right mind would write a text editor at the time and IGNORE all those extra keys. The only way you could even consider writing something like vi is if you didn't have any option but to write vi due to hardware limitations.
And so, what I find very interesting is that here we are, so many years later with better hardware, software, multi-monitor GUI's and computers with gigabytes of memory and direct DVI connections to the monitors and we have a class of programmers that insists that --to be effective and to be considered a professional programmer-- you have to use a tool who's only reason for being designed as it was thirty years ago is that the writer had a keyboard with half the keys, over a 300 BAUD modem, a crippled terminal, limited memory, no graphics, 80 x 25 characters and no screen buffers. Please understand how someone like me could see this as being nothing less than ridiculous. Even vi's author relates the story of having gone down the path of adding windows to vi but loosing the code in a crash and never going back to re-creating it (the implication being that vi was already on a path to become a totally different product).
Anyhow, at some level, of course, to each his/her own. My problem is with vim zealots who in places like HN tend to give newbies the idea that there are magical qualities attached to adopting the "cult of vim". From my perspective nothing could be farther from the truth. And, as I have stated, from a business perspective, there are far more important and significant levers and knobs in a business to focus on than which editor you are using.
:nnoremap k gk
:nnoremap j gj
These move up/down one character, even if it is the same line wrapped over. Really beneficial for things like LaTeX editing.
Much of the time, I want to go to a specific part of the next line. In which case, let's say I want to go to the parse function, I'll do "/par<enter>".
and - to move 1 line up. Combine with a number, 4+ to move down 4 lines, complementing 4G or :4<CR> to move to 4th line.
What vim user does all their movement with hjkl only anyway? If you're going to deliberately cripple your editing habits like that, or if you're not even bother to learn other movement command at the same time as getting used to hjkl, you might as well stick to notepad.exe.
Having used vim for nearly two decades now, my primary movement routine seems to be start with "/" and "?". In other words, jump to the approximate location using a word search and "W" or "w" as needed to the specific word, then use the hjkl or other commands to further refine the cursor's location.
Young programmers should be made aware that there are now programming editors that do away with the need to think of a way to trick the program into moving the cursor where you want it to go. Modern editors respond to direct, concise keyboard entries to move the editing cursor to the desired destination. Like pressing the arrow keys. Or pointing at the destination with a mouse and clicking -- things like that.
Even ubiquitous command-line editors like Pico are easier to use than vi/vim. The reason is that Pico doesn't have vim's history to contend with, and its consequent rearward compatibility issues.
I have even see a guy at a ruby conf who were using only keystrokes to browse the web. I wonder how it deal with flash animation. Anyway so now, he can replace his trackpad with a swimming pool for worms of smugueness. That's pretty cool.
Try pentadactyl for a couple days. Once you get used to it you will not want to go back to being a mouse-pointer sharpshooter.
The pdf version can be found here: http://www.glump.net/howto/vim_graphical_cheat_sheet
When using a cheat sheet like that I waste a lot of time scouring the image looking for text relating to the type of operation I want. I'd rather have a list of options grouped by operation type.
The flashcards are designed so the front is a description of some operation (ex. "motion cursor to end of the line" or "backward find word under cursor") and the back is the key combo to make that operation happen.
It works really well for me and I've noticed a huge improvement to my productivity in vim. If you're interested: https://github.com/MrPants888/vim_flashcards
This is definitely not the best cheatsheet for hanging above your computer, but more to be read as a tutorial. (Calling it a cheatsheet would be a stretch in this case.)
For your purposes (and what I do quite a bit anyway), google is the best cheatsheet.
Then when I read the rest of the post, it definitely makes sense. I do use w, b quite frequently, and I don't use f, but I've found the vim-seek[1] plugin recently, and it seems to make more sense to use. It matches two rather than one character, which makes it much more precise.
I think the bottom line is to move around to the right place and that going one character at a time is less efficient. Not so much whether this movement is via hjkl or the arrow keys.
However, I like to fiddle with the cursor while I'm thinking. Might be just me. I don't like feeling like I'm completely constrained. It's nice to casually move around when I'm pondering something deeply.
When I'm seriously coding though, I almost exclusively use move forward/backword by word or expression, and then use ace-jump to arbitrarily jump to specific points (http://www.emacsrocks.com/e10.html). I use Emacs of course.
That's a good point - I do that too. Also, if I've switched my attention somewhere else, then back to vim, I find myself doing "hlhlhl" to get my attention back to the cursor immediately.
If I have to pay that fraction of time for the convenient arrangement of keys. I will pay it happily.
1. This is not a productive comment, and this thread isn't here for you to start an argument on something rooted in personal taste. Your're entitled to your view, but this post was written as a suggestion for Vim users, for Vim users. Please, refrain from posting if that's all you have to say.
2. That's great that you've found more efficient ways to navigate, but did you read the article? Though it's impossible to tell from the extremely-misleading post title, the article isn't polemicizing - it's trying to suggest tools that a user might not already know/be familiar with.
3. These comments are the only ones discussing the actual article text, and are the minority. Let's discuss the merits of what the post was actually talking about, as the comments are meant to do!
So when I press j once it moves down one line, and if I press any other command it's reset so I can press j once again next time (so it allows going down a line and pressing . repeatedly). But from the second consecutive press each single j press will be doing another thing. This is helping me a lot with retraining to using other methods to get around instead of spamming j. Wait, that's a good wordplay, restraining, retraining. Hmm..
Even as a Vim fan, this isn't better than mousing, this is similarly annoying to proxy movement through other things.
For what is worth, I use vim and visual studio in daily basis, and love both. I love vim experience over a console and the fact that I can code in a remote machine without any perceptive latency.
I love visual studio goodies (mostly intellisense) and being a keyword guy I just learnt VS shortcuts.
So, Is there something wrong with me? for me those are just tools not religions.
Edit/PS: I know am comparing an IDE and a editor, but in this case I think the analogy is valid
Using <leader><leader>f <char> will display all available options to jump to. This way you don't have to continue to use f<char> over and over if there are many of the same character in the line you are on. It is also a great way to jump to a very specific spot in your code.
Note, it also has other motions besides just f. Here is the link:
Using those keys once or twice is, of course, perfectly fine. One could set up some mechanism that limits the number of repetitions in a row.
However, after using vim for a long time, I still use the arrows! Not all the time, but a lot. I find that my fingers are always darting around on the margins using $ an ^ and ~ and ... my argument is what's wrong with traveling a little to get to those equally distant arrow keys? I don't really consider the hjkl to be my home position for my hands much. Thumb on space bar is home, if I had to define it.