15 ms·
Vim is touch-typing on steroids
- behnamoh 4y agoMy Vim experience got much better when I added this to my config: vim.keymap.set("n", "<leader>sr", ":%s//") It search-and-replaces all occurrences of the word under the cursor. I also added the following to remove the highlights that appear (e.g., when pressing *): vim.cmd("nnoremap <silent> <c-c> :nohl<CR><C-l>")
- Graziano_M 4y agoTry mapping it to `:set hlsearch!`. That way you can use the same mapping to toggle it on and off as you wish. EDIT: Also, you can use vim.keymap.set, no need for a vim command, just `vim.keymap.set("n", "<c-c>", "<cmd>set hlsearch!<CR>", {silent = true})`
- stevebmark 4y agoTouch typing is one way to put it. I would say Vim is an imperative editor. You need to tell the computer how to edit text by glueing together chains of small painful commands. IDEs are declarative editors, you say you want to refactor a variable, and the IDE handles it. Vim is a text editor, not a code editor, and I keep forgetting how weird it is. "Ctrl-X Ctrl-D completes a C preprocessor macro by default" - there is no reason this should be in the core of any editor. And finally, whatever you think of Vim, it's not worth using unless you've read Practical Vim. Without the knowledge of that book, you're too limited to approach efficient (imperative) editing.
- bradrn 4y ago> I would say Vim is an imperative editor. It’s interesting you say this, since I’ve always thought of it in precisely the opposite way! A traditional editor is thoroughly imperative: all editing operations are built up by sequencing basic commands, almost exclusively ‘insert/delete a character’, ‘move to this line/column’, and ‘select from line/column position X to position Y’. By contrast, Vim gives me an entire declarative language to work with text: if I want to ‘delete a word’, or ‘change the next 10 lines’, or ‘move to the previous occurrence of the identifier under the cursor’, I can just do that, without having to mentally break it up into sequences of smaller editing operations. I suppose this all goes to reinforce a point I’ve made several times before, which is that ‘declarativity’ is more of a continuum rather than a state. Calling something ‘declarative’ without context isn’t very helpful, but it’s entirely valid to say that most text editors are less declarative than Vim, and Vim is in turn less declarative than the refactoring operations in a full-featured IDE.
- GavinMcG 4y agoMy dream, as someone who writes text rather than code, is to move that next step along the continuum. I want a motion for "change sentence to future perfect tense."
- packetlost 4y agoThat actually sounds somewhat reasonably attainable with recent advancements in natural language AI models.
- pxc 4y ago> I suppose this all goes to reinforce a point I’ve made several times before, which is that ‘declarativity’ is more of a continuum rather than a state. To me, it seems clear that editing an existing body of code is always imperative— you're literally manipulating the state of the text iteratively, no matter what you do! Code generation can be declarative. But you're still going to imperatively edit your declarations somewhere, in that case. :-P
- AlchemistCamp 4y agoIt’s not an either or. In fact, any IDE (or any coding environment) lacking VIM bindings is broken. As long as my computer is beefy enough, I’m perfectly happy using Jetbrains or VS Code or whatever IDE, but I always use VIM bindings and it’s been a key piece of my recovery from severe RSI. It’s been a nice productivity boost, too.
- stevebmark 4y agoYou exhibit the “Vim mode paradox.” If you’re comfortable using the limited “Vim mode” in other editors, you don’t know Vim well enough to justify using it.
- pxc 4y agoYou've forgotten that nobody has to justify using the tools they like :) But also, some Vi emulation modes are much, much more complete than others.
- phowat 4y agoNo vim mode is perfect, but they do make other editors bearable. I think vs code’s is the closest one I tried. Though I never really used it as my daily driver.
- eloisius 4y agoTo me vim mode is just enough to keep me from ragequitting something like Xcode when using vim is practically not an option, but “vim” mode would never be enough to make me use another editor by choice. Vim isn’t just hjkl.
- bnralt 4y agoI tried Vim mode in XCode. When I move by paragraph, XCode crashes when it gets to the bottom of the screen. I understand that XCode Vim mode is lacking a lot of the functionality of Vim, coming nowhere close to even the free XVim plugin. But you think they could at least make sure the few features they do include aren't completely broken.
- urthor 4y agoPractical Vim is worthwhile. Unfortunately, I had to put it down to read the 695,378 word Vim manual. Or at least, the 33,807 word core essentials. Approachability is... not Vim. Especially when both the manual and Practical Vim to absorb "how to use it" are a such a necessity.
- alwillis 4y agoI didn’t read either Practical Vim or the docs before becoming pretty proficient with Vim. Some good blog posts and some videos did it for me. I had enough knowledge to make diving into the docs more meaningful. Besides once you understand the language of Vim, it’s not hard to make strives.
- rcoveson 4y ago> Without the knowledge of [Practical Vim], you're too limited to approach efficient (imperative) editing. Are you the publisher or something? What a weird thing to say. I haven't read it, so I guess I'll go back to using nano--after 15 years of vim--and just suffer?
- stevebmark 4y agoI have no affiliation with the book nor author. I’ve also been using Vim for about 15 years.
- unsignedchar 4y agoYeah that was weird. How were we using vim for 20 years before that book ?
- ARandomerDude 4y ago> And finally, whatever you think of Vim, it's not worth using unless you've read Practical Vim. Uh, what? I find it absolutely painful to watch my coworkers click around in their IDEs. It takes them forever to get things done. Of the handful of hard core Vim users in the office, I’m the least sophisticated. But I’m WAY faster than all the non-Vim users.
- calvinmorrison 4y agoEvery few years I trot out some vim command new to me and it falls to the wayside. I don't even use buffers right, I use tabs. Which are apparently a bastardized version but I digress. F f g G jkl; ESC i r R yy p and control A and control E probably cover 90% of my cases. However. I use a nub on my ThinkPad so I have sort of instant mouse access for location things, I mostly use jumping for inside a line
- doix 4y agoBuffers and tabs serve different purposes. I think a lot of people dismiss tabs because they don't understand their purpose. It's not just about switching to different buffers quickly. Tabs are an organized collection of windows, and you can quickly switch between them. I might organize my windows so half the screen is one buffer and on the other half, is split 3 times horizontally. Then I edit some code and realize I need to edit some other part of the codebase. I make a new tab instead of changing buffer, so I can go back to the view I setup already without having to recreate it. Tabs are the true power of vim, I don't have that functionality in any other editor (apart from Emacs?) and I miss it constantly. Buffers aren't really a novel concept, they work the same in VS code and JetBrains IDEs.
- pxc 4y ago> Tabs are the true power of vim, I don't have that functionality in any other editor (apart from Emacs?) Yeah, Emacs also lets you do that! You can achieve similar workflows via tmux or a tiling window manager as well. It's my favorite way to work! For whatever reason I've never gone down the tiling WM rabbit hole, but I use this kind of thing in Emacs and tmux all the time.
- cdogl 4y agoWhat a peculiar statement. I’ve been using vim as my go-to editor for most of my 10-year career as a software developer. I am very productive. I haven’t read said book.
- idontwantthis 4y agoI haven't read it and I use Vim every day. Like any skill, just learn as you go. A couple of times a week I google for how to do something I figure is possible, then I save the link in a bookmarks folder. I might read it at this point and learn a lot, but I'm still happy and productive with what I do know.
- narrator 4y agoYou can get vim keybindings for Intellij so you get all the IDE stuff too.
- voidhorse 4y agoPretty much. I tried using vim as my sole driver for a long time then finally saw the light that modern IDE + Vim mode plugin is the one true holy path. Vim is wonderful but a massive waste of time and the quality of plugins is just lower jn general (obv. there are several exceptions, zig language support, for instance is much better than a lot of other vim language support plugins out of the box). The modal editing can't be beat, but frankly it's just way more painful to do sophisticated things in Vim than it is in a modern IDE. At best you need to produce a write once vimscript and hook it up to a command. Contrarily the ecosystems of modern IDEs are so large there's actually a greater chance someone already solved you problem and provides it with one click/hotkey. For me, vim is nothing but a constant distraction generator. Instead of being able to focus on what I actually intended to get done I'm ever tempted to go off writing some vimscript to solve some edge case I just encountered while editing or to automate something--much better to just make it a nonoption, at least for me. I'm sure there are vim gods out there that have an entirely different experience.
- Aperocky 4y agoI am no vim god but I have a different experience. I've installed quite a few plugins (e.g. nerdtree, airline etc) but they are mostly cosmetic and I myself don't do much vimscript other than some basic .vimrc. But I do have most of the content of any vim cheatsheet burned into muscle memory and can come up with combination of them on the fly. I also use :norm extensively when I need to quickly batch edit anything. I never really did encounter scenarios where the logic are so complex that I'd rather write vimscript to solve it - at worst, I'd do a macro, but combination of modal keys are usually enough. I think I find a sweet spot between using vim to its maximum utility and less about using vim for the sake of vim. I have a quick install script for everything I depend on and one thing I found extremely valuable is the ability to pull, install and have the same editor customized and familiar in any computer, virtual or real, it even works on Windows (WSL).
- xwdv 4y agoVim is neither a text editor nor a code editor. Vim is a language. To speak Vim is to speak in a way with your hands that turns words into action and moves text at the speed of thought. I have long mastered Vim after over a decade of experience. I can barely tell you what keys I’m pressing, but when I imagine some text in my head and how I’d want to change it, I feel the force at the ends of my fingers that guides my hands until the modification is done. Much like how you can speak to express an idea without having to think about the way your mouth moves, I can easily edit blocks of code without really knowing how my hands will move, I simply trust they will do what I need and it happens. Vim has become the interface by which my mind can directly immerse itself into the conversation of code on a screen. Most will never understand the feeling of this power unless they deliberately pursue deep mastery of Vim, but once you’ve gotten a taste of it, it becomes intoxicating. Vim is well worth investing your time in. I guarantee it is one technology that will exist for the rest of your career. The year will be 2100, and Vim will still be around and in use by the best engineers.
- probablynish 4y agoWhat do you think of using vim plugins inside an IDE, such as IdeaVIM? How much of the benefits of what you describe do you think would remain? I've been trying to spend more time in vim since last year because I can imagine a world with the benefits you describe, and I want to put in the long-run investment to get there. But at the same time, Vim naturally lacks the feature set of an IDE, and setting up a bunch of plug-ins so that they all work together is somewhat time consuming and brittle. I've been wondering if I should stick to Jetbrains/VS Code and use Vim as a text manipulation language, and whether I'd still attain that editing fluency you describe.
- xwdv 4y agoPlug-ins are always a personal choice. For me the most essential is fuzzy finder with ctrl-P. With this I can arrive at any file or line in a massive codebase damn near instantly. I find vim with the right plugins is as capable as any IDE, you can at least have the basics like autocomplete and various syntax highlighters and linters. Personally I think developers who lean heavily on the IDE features of more common tools are using it as a crutch for not knowing the codebase very well or language features. Part of the journey to vim mastery is the configuration of vim until it fits you like a glove, once you’ve configured it well you rarely need to touch the config files again.
- jatins 4y agoWith LSP support VIM can do most of what you'd do in VSCode in terms of language specific refactoring. The plugin ecosystem is pretty rich. Setting it up is still a nightmare, there are pre-made Neovim configs that I found helpful to start with (Nvchad, astrovim) but even then adding support for a new language is too much effort at times (as compared to VSCode where VSCode will suggest to download extensions the first time you open, say, a .go file and you just have to click) VSCode with Vim bindings seems like a decent middle ground.
- pseufaux 4y agoI recently discovered the neovim plugin for VSCode. It’s fantastic. A step up over the built in key-bindings.
- redtriumph 4y agoAnyone who wants to get started with LSP in Vim8/9, I've found following plugins useful. a. https://github.com/yegappan/lsp https://github.com/yegappan/lsp [this is newer plugin and hence there few issues] b. https://github.com/prabirshrestha/vim-lsp https://github.com/prabirshrestha/vim-lsp
- jzelinskie 4y agoI've struggled with this since basically nvim started supporting LSP and few months back switched to Helix. LSP just works the way it should in vim. Sure, I am slowly rebuilding muscle memory for the Kakoune-style bindings, but it's honestly not much of a leap for having the plugins you'd install built into the editor in a cohesive way (e.g. LSP, bufferline, git gutters, unimpaired bindings). I'm honestly shocked at how fantastic Helix is and it makes me wonder if all the toil of inheriting vim was worth it for the neovim project.
- jatins 4y agoGave Helix a try recently and liked it. Much better out of box experience. Something like a readymade nvim config should ideally be able to provide similar experience but it's hard to not get caught up in the the quest to get it _just right_ Plus Vim keybindings are widely available in popular editors/IDEs but I think Helix bindings will take a while to get there.
- tomrod 4y agoStill complex for me, even after reading the author's tutorial and suggestions. Between hjkl, w, l, d, dd, esc, :command, and more modes I feel like I'll never grok vim. After how many years do I throw in the towel and just stick with VS Code? Been at it since 2008 in some form or another :(
- JenrHywy 4y agoI use vim in VS Code - best of both worlds :)
- tmtvl 4y agoI tried from 2013 to 2018, even going so far as to change zsh to using vim bindings and then I threw in the towel and switched to Emacs. While Elisp isn't the nicest Lisp around it's a lot nicer than vimscript, lua, or javascript.
- hyperhopper 4y agoCheck out spacemacs or doom emacs! Vim has the best interface, but it's built on a pretty awful program. Emacs is a pretty awful interface built on a pretty great program. Combine the two!
- makeitdouble 4y agoUsing both when it makes sense should be the best ? I've seen many coworkers(me included) switch from vim to IDEs, but still use it here and there. I think vim alone makes less sense in our current environments where we're constantly interfacing with many different systems: In my case I need SCM status, a command prompt at any time, docker container status and commands, quick local to remote file transfer, local and remote linting (don't use the same rules) and image previewing. I could probably make a vim + terminal setup that brings me 99% there, but it just doesn't make sense as a time investment TBH. And buttons to click are nice, really.
- memorable 4y agoI have been using Vim since almost day 1 of learning how to code and I honestly have never used 90% of Vim's features. For hjkl I just used arrow keys since they are nicer and I dont find much difference between them. For modes I only learned about Normal, Insert and Visual. No more than that. You could say my Vim editing is extremely ineffective, but it is effective enough for me.
- makeitdouble 4y agoIf the overall "on steroid" metaphor is on how Vim will improve typing performance and give an edge over organically growing your keyboard commanding abilities but lead to early health problems...I totally agree with the title (also a good piece with good advices otherwise). Vim was my primary editor for a bunch of years, and it's definitely fast and helps to utilize keyboard commands to the maximum extent. That's also the years I started getting RSI, changed a lot of habits, keyboards, postures etc. to come to the conclusion that the real issue was plainly doing the same movements over and over. As a data point of n=1, optimizing workflows for maximal productivity meant doing the same optimized actions again and again, and do them fast. Which wasn't good. Reducing "productivity" and introducing more input methods that I can switch to here and there when I feel like it helped a lot. So less touch typing marathons, less shortcuts, more GUI and more variety overall.
- stainforth 4y agoJust curious, would/do you do a lot of pinkie stretch movements i.e. to hit ctrl? I've remapped using autohotkey ctrl to caps lock on my personal computer and its a godsend to bypass this. I seriously think this should've been the convention. I wish I could enable it on my locked down work laptop.
- TylerE 4y agoIt was, then as usual IBM mucked it up. The only thing worse might be the Amiga layout… letter width capslock to the left of A, and then a 1.25 width ctrl directly to the left of that.
- makeitdouble 4y agoI did a lot of changes, so which one would have sufficed is hard to tell (in exchange I have absolutely no RSI left). I use keyboards with extra keys so the esc key was always mapped pretty near. With IME languages an ESC+language switch shortcuts is absolutely needed anyway (at least for vim users)
- hbn 4y agoWorth noting Microsoft actually distributes an "official" (quotes cause it was made by an employee seemingly out of their own desire, but it's distributed on MS's website) program that maps ctrl to capslock. Aptly named, Ctrl2cap [1] Thought they really ought to just let you do this out of the box already. macOS lets you map modifier keys to other functions just in the regular old system settings. [1] https://learn.microsoft.com/en-us/sysinternals/downloads/ctrl2cap https://learn.microsoft.com/en-us/sysinternals/downloads/ctr...
- SapporoChris 4y agoVim use can cause increased irritability and aggression? Yes, that makes sense. https://nida.nih.gov/publications/research-reports/steroids-other-appearance-performance-enhancing-drugs-apeds/how-does-anabolic-steroid-misuse-affect-behavior https://nida.nih.gov/publications/research-reports/steroids-...
- zabzonk 4y agojust me - i've been using all the vi-derived editors as my favourites since the mid to late 80s. never learned to touch type.
- memorable 4y agoKind of the same here. I never actually learned to touch type correctly on QWERTY, though I do it when learning other keyboard layouts.
- charcircuit 4y agoVim isn't a CLI based editor. An editor like ed is. Vim isn't the only editor with shortcuts. Many of the IDEs listed come with pretty of shortcuts and you can configure more if you want. Those editors also let you use shortcuts without having to switch through different modes making you more efficient.
- gsinclair 4y agoWithout wanting to sound condescending, you don’t understand modal editing. Working in different modes accelerates rather than retards efficiency. It’s worth knowing about for intellectual curiosity, even if you don’t care to use it. Google “you don’t grok vi” for a quick and interesting read.
- charcircuit 4y ago>Google “you don’t grok vi” for a quick and interesting read. None of this requires a separate mode to do. Modifier keys have been shown to be enough to give commands for doing operations other than inserting characters.
- throwaway_au_1 4y ago>Those editors also let you use shortcuts without having to switch through different modes making you more efficient. The modes are what makes editing in Vim efficient.. you don't think Vim users are out here swapping through modes looking for the one that lets them paste a line do you?
- charcircuit 4y agoYes. Instead of just control + v they have to switch out of insert mode and into normal mode, then do a command to paste their clipboard, then have to do a command to go back to insert mode. It's overcomplicated.
- jonas-w 4y agoThey just press ctrl+alt+v in insert mode or if they are in normal mode they will press p.
- chrismarlow9 4y agoVim is an REPL stacked on a real time database that is a buffer.
- p-e-w 4y agoWhen engineers report that switching to Vim has massively improved their productivity, I can't help but think that the way they work must be very, very different from my own. When I "program", 95% of what I do is read documentation and other technical resources, conceptualize what I want to happen, and construct the corresponding logic flow, while trying to anticipate potential problems and corner cases. In other words, most of what I do doesn't involve touching the keyboard at all. If Vim magically tripled the speed at which I'm able to edit text, I doubt it would have a noticeable impact on my overall productivity. In fact, even if you gave me a brain-computer interface that allowed me to manipulate text at the speed of thought, it wouldn't matter much. I touch-type at around 70 WPM, which is very average, but if I two-finger typed at 15 WPM instead I would still be able to produce exactly as much code as I do today. Simply put, text manipulation is not at all a productivity bottleneck for me. I need much more time for thinking about code than I need for writing it. Is this really unusual? How do people operate for whom Vim gives a productivity boost? Does code just flow from their brains into their fingers? I don't get it.
- Panzer04 4y agoI think it's rarely a productivity bottleneck, but that doesn't mean that Vim keybindings and navigation aren't superior in the vast majority of cases to what most people are doing - which is scrolling, mousing about, etc. Vim keybindings significantly accelerate the editing and browsing of existing code in-editor. It also has the convenience of being a fairly common set of keybindings in editors nowadays, as many have an extension that gives Vim keybindings without having to go all-in on a CLI-style Vim editor.
- p-e-w 4y agoEvery modern code editor has character-, word-, subword-, line-, and page-based navigation, as well as "jump to symbol" functionality. Bookmarks, paragraph navigation, and similar are also very common. I fail to see how Vim is supposed to be superior to that. It has essentially the same navigation features, with different keybindings. And the idea that those different keybindings are somehow "better" is a big [citation needed].
- probablynish 4y agoThis is a timely post as I've been trying to use Vim more since last year, and recently started a new project with the aim of working exclusively in Vim. And I'm torn. On the one hand I want to significantly increase how fast I can manipulate and edit text without reaching for my mouse, a state which many commentors here seem to have attained. On the other, I miss the way that a Jetbrains IDE cohesively integrates a lot of features with non-conflicting hotkeys, without requiring me to fiddle around with a vimrc - great code analysis, Git, database schemas, etc. I'm tempted by the promise of a plugin like IdeaVIM, which seems like it's 90% of the experience - but that'd still sacrifice the easy integration with my terminal setup, fzf, being able to switch between panes with my keyboard, etc. Does getting 90% of the way to being keyboard-free really give you 90% of the benefits? Any tips appreciated :)
- aezart 4y agoI've been using vim for the last 6 years because most of my early projects at my job involved PuTTY-ing directly to Solaris and RHEL servers to do dev work (mostly shell scripting and PHP). I don't do anything particularly sophisticated with it; recording macros to repeat the same transformation on multiple lines is about my limit. But I love being able to work with my hands permanently on the home row of the keyboard, and having to switch between keyboard and mouse with other software feels like a chore now. Sadly these days I mostly make Mulesoft applications using Anypoint Studio. I still use it for most of my text editing at home at least.
- swah 4y agoI'm one of those that knows a good deal of Vim and Emacs, and moved to VSCode and felt things just work better there. The pattern nowadays for me always goes like this: 1. Let me try Vim again. I do miss that kind of efficiency 2. This is so fun, I really missed it (for a few minutes or hours) 3. And then *one little comfort* from VSCode is missing... and I'm back on VSCode for months. Maybe if my brain could just accept that one can edit the same set of files on two editors at the same time, it would be the best way to work.
- ts0000 4y agoFor anyone not understanding why (neo)vim exists, or why some developers prefer it to IDEs, I suggest watching "PDE: A different take on editing code" [1]. It reframes (neo)vim as a "Personalized Development Environment". I've been using (neo)vim for years, and don't want to use anything else. It isn't just about productivity (I would probably be as productive in an IDE). It's because its _mine_. It's a highly customized environment, catered to my needs. [1] https://www.youtube.com/watch?v=QMVIJhC9Veg& https://www.youtube.com/watch?v=QMVIJhC9Veg&
- eterps 4y agoVim keybindings are like a Huffman encoding for expressing text manipulation operations.
- synergy20 4y agodie hard vim user here, can't live without it, keyboard is all I need these days, I only use my mouse every 1 minute per hour these days, on ubuntu, productivity is higher than IDE for sure. and yes vimium for browering.
- H4ZB7 4y ago[dead]
- crossroadsguy 4y agoNaah. I gave up on Vim years ago. I think I’d rather like to do other things than dealing with ikljhploxty :g or whatever those commands are et cetera. I realised for my use-case and the work I do, and for the time I actually spent writing/typing code, those trillions of IDEs and gui text editors are not only enough, they are absolutely better. I am sure it would be some revolutionary tool, but I have no use for it other than using vi when I ssh into somewhere for few minutes once in a blue moon. This realisation has been very useful. In the past I kept trying to “get” vim. On the other hand a lot of people I know like vim as a “hobby”. Yes, liking vim and doing vim thingies is the hobby.
- deleted 4y ago[deleted]