7 ms·
Vim Croquet
- aaronem 13y agoThe keyboard heatmap code is nifty enough to justify this being on the front page of HN all by itself, which is not to say the rest is without value -- quite the converse; I hadn't thought of doing this sort of usage analysis with Emacs, but I think that's going to be my next weekend project once I'm done updating weatherline-mode.
- mkdir 13y agoJudging by the heatmap, it appears the author isn't familiar with Vim's c verb. It works just like d, except it puts you in insert mode after you've completed your command. For example, to replace the text within a set of quotation marks with You don't like Vim?, move your cursor on or within those quotation marks and use: ci"You don't like Vim?<esc> To replace the text up to (but not including) the next exclamation point with I would never drink orange juice, use: ct!I would never drink orange juice<esc> EDIT: Gah. He explicitly mentioned his use of cib. I'll leave this here in case it helps anyone.
- nbouscal 13y agoJudging from his discussion of cib in the Data Acquisition section, it seems like he's familiar with it.
- falcolas 13y agoPerhaps familiar, but not ingrained in his muscle memory to used instead of d<motion>i.
- nbouscal 13y agoTo be fair, I'll often do that as well, but just looking at the keys misses that there's a pause between the d<motion> and the i. I don't like sitting in insert mode, so if I don't know what I'm going to replace a thing with, I'd rather delete it, then insert something else after I've figured it out.
- nbouscal 13y agoggvG$"zy can be replaced with ggVG"zy Visual line mode is often very convenient. Also, kana's text-object-entire plugin may come in handy here (many of her text-object plugins are very useful).
- eggoa 13y agoOr :%yz
- nbouscal 13y agoGood call! But you'll need a space: :%y z
- falcolas 13y agoIf I can recall the file name, :r <file name> might be a better choice than gg...y
- saidajigumi 13y agoBetter still, I'll recommend @kana's vim-textobj-entire[1]. This adds 'e' as an 'everything' text object, with 'ae' (around everything) and 'ie' (inside everything) bindings by default. Thus 'vie' would select everything in the buffer in visual mode. Likewise for 'Vie' (Visual line select) or 'cie' (change everything). [1] https://github.com/kana/vim-textobj-entire https://github.com/kana/vim-textobj-entire
- kolme 13y agoAlso you don't need any visual mode if you don't need visual feedback. Yanking everything: gg"zyG
- mateuszf 13y agoThis guy should definitely start using caps lock as control.
- nbouscal 13y agoIf you read more closely, he mentions that he uses a Kinesis Advantage where his control key is quite convenient. The heatmap is just plotted on a standard keyboard.
- rjzzleep 13y agohttp://www.drbunsen.org/an-affray-with-rsi/ http://www.drbunsen.org/an-affray-with-rsi/ his end key is escape. on his keyboard i think it translates to being on a thumb
- jbeja 13y agoEven if not related to it and my get some downvoted for saying this. Something that strike me in this post is how cooler haskell code looks vs python.
- skywhopper 13y agoFor values of "cool" meaning "undecipherable", sure.
- joehillen 13y agoThis is a common misconception. Haskell is extremely readable. You just have to learn it. Python reads like pseudo-code where as Haskell reads like math. Both are readable, they are just different. I suspect it's easier to teach someone Haskell if they have never done imperative programming before because they have a lot less hang ups.
- skywhopper 13y agoThe "joke" was that Haskell looks very different from most popular programming languages, and that folks who think it "looks cooler than Python" are likely reacting to its indecipherability combined with the fact that it's clearly doing something interesting. At least Python programmers have a sense of humor.
- sea6ear 13y agoI think this is a fairly insightful analysis. Haskell seems to be semantically very dense - each symbol or function packs a lot of meaning. Reading Haskell for me is like when I had to do math proofs in Real Analysis or Abstract Algebra - it takes a fair amount of time to get into the mode where I can understand what is written very concisely in front of me. To me it seems that Haskell suffers from some of the same problem that mathematics does - it is very concise notation for someone already familiar with the concepts, and a lot faster to write if you are familiar, but reading requires unpacking all the meaning of the notation, so ultimately is far more time consuming unless you are already familiar with the concepts that are in the code.
- 13y ago
- tnorthcutt 13y agoThis is very cool. Can anyone point me in the general direction of how to implement this on my machine? I understand logging keystrokes in Vim, but I'm not sure how to use the source code given for the lexer, or that given for the Makefile.
- ajanuary 13y agoUsing a language that eschews state to try and process the state in a modal editor tickles me.
- mercurial 13y agoIt doesn't. You can't run a program made of only pure functions. What it does it manage it.
- nbouscal 13y agoTo elaborate on the other reply, Haskell actually takes a very in-depth and principled approach to managing state. State is necessary for many applications, so rather than eschew it entirely, the idea is to isolate it and make it as explicit as possible. Frequently in complex stateful applications this is done by use of the State monad, with lenses to handle mutation of that state. There's a lot of theory behind it, but in practice it ends up being pretty similar in difficulty level to managing state in more popular languages, just a hell of a lot safer.
- codygman 13y agoI know others have said it, but I would like to echo the "please don't say that Haskell eschews state" message :)
- efnx 13y agoParsing and lexing in Haskell is one of its shining glories.
- nathan_long 13y agoAwesome! I'd love to see something like this as a standalone project. "Vim Critic" or "Vim Coach" - something to say "these are the inefficient things you personally do." Probably some low-hanging fruit would be "any keystroke in Normal mode that's repeated." Eg, if I'm doing 'jjjj' to move down or even 'wwww' to hop from word to word, I could be searching or using a movement combo like '4j'.
- sdegutis 13y agoPersonally, the main reason I moved from vim to emacs is because I don't want to have to think about my editor, I want it to be pure muscle memory. I'm okay with hitting "jjjjk" to go 3 lines down rather than trying to guess that it's exactly 3 down and typing "3j". Emacs-style navigating/editing is great for this kind of error-tolerant navigation/editing. It leaves my brain mostly free to focus on whatever I'm actually coding at the time.
- vectorpush 13y agoI think most experienced vim users will tell you that it is pure muscle memory for them. Also, vim supports jjjjk as well as 3j. Anyway, I just realized I am debating vim vs emacs so I'll stop here.
- pekk 13y agoNothing about vim forces you not to type jjjjk, or better yet use motions or whatever fits your brain. But keep up the good emacs-vs-vim-troll fight
- 13y ago
- weavie 13y agoLooking at the heat map, what does surprise me is how he never uses Escape or ^[. How does he managed to move out of Insert mode? My [ key is starting to wear out due to such heavy use..
- nbouscal 13y agoHe may have it set up the way I do: if I tap Ctrl rather than holding it, it sends Escape. If that's the case, his heatmap might be lumping Escape and Ctrl together.
- mercurial 13y agoRemapping?
- Timothee 13y agoI don't know about him but I have 'kj' mapped to <Esc>. I highly recommend it. (or any variation around it)
- indiefan 13y agoI use ctrl+c. It's easy to hit than esc, and it's built in, so it always works, even on servers i haven't set my config for, etc.
- aaronem 13y agoI don't use vim, but from the parsing example he gives in the post, I'm guessing he uses C-c: `Mihere's some text^Cyyp$bimore ^C0~A.^C:w^M:q […] > The lexer correctly determined that I started in normal mode by navigating to a specific buffer using the `M mark, then typed here's some text in insert mode, then[…]
- weavie 13y agoWow. I never knew about that one.
- exDM69 13y ago> Looking at the heat map, what does surprise me is how he never uses Escape or ^[. How does he managed to move out of Insert mode? His 3rd most used command is jj. This is popular among some vim users to be remapped as Esc in insert mode (:inoremap jj <Esc>). I do not personally use this but when writing this comment, I quickly tested it out and it actually feels quite comfortable. I re-map my caps lock as Escape. It works suprisingly well even outside of Vim.
- vsviridov 13y agoThis needs to be a standalone tool. Is it on github somewhere? Or do I have to copy/paste from the article?
- a-b 13y agoBay area folks, please join Vim meetups http://www.meetup.com/vim-ed/ http://www.meetup.com/vim-ed/
- atmosx 13y agoAwesome stuff!!!!