3 ms·
This is such a weird article. " I mean, I knew about R but I thought that, surely, no one really ever uses it." How could someone use vim without using R? I l
by seanhunter 2y ago
This is such a weird article.
" I mean, I knew about R but I thought that, surely, no one really ever uses it."
How could someone use vim without using R? I literally use that every single time I use vim (multiple times per day) and have done for 20+ years at this point. Do people only use "change inside" and cw and things like that? I mean sure I use them but not to ever use replace is really weird to me.
- matejn 2y agoHmm I used Vim for about 10 years and I never used R. I preferred one of the c- variants, usually ct and cas. I guess it depends on acquired muscle memory?
- zem 2y agolikewise, I use `r` all the time but I never even knew about `R`
- mrgoldenbrown 2y agoWhat is a typical R use case for you? R doesn't feel worth it to me. If I'm changing a word, cw is almost always better, unless maybe the new word has the exact same number of chars as the old word.
- o11c 2y agoIt's practically mandatory when editing cells of hand-written table-likes. It's faster than `ct<somechar>` for replacing part of a word. Using `<Insert>` to toggle the mode is also something I do fairly regularly ... I'm past the point of consciously doing these things so I probably use it more than this.
- cwbriscoe 2y agoI just use 'a' or 'i'. I don't think I have ever used 'Insert'.
- o11c 2y agoThat requires pressing <Esc> or whatever to leave insert mode first. I'll do it if I need to do some nontrivial motions first (because i_^O is just awkward outside of mappings), but otherwise no.
- ddfs123 2y agoI would just cw and space it back to correct alignment. I too edit ascii table by hand, and quite often and just find R not very useful in even this case.
- setopt 2y agoOr use cw, and then use a plugin like e.g. junegunn/vim-easy-align.
- wruza 2y agoAlso table_format.vim.
- gpvos 2y agoIn the original vi, if you use cw to change it into a longer word, you can't just use <DEL> to remove spaces after the word, but have to use <ESC> and x. So R is often more practical, and it got into my muscle memory before vim existed.
- seanhunter 2y agoYeah exactly. So if I'm editing text that is somehow quasi fixed width like a table cell but doesn't fit the classic vim definition of a word or a neatly delimited thing that I can use ci/ca with. So for example this morning I was editing cells in a latex array. They are delimited by "&" and each one is some sort of equation that doesn't fit a normal vim word definition. R to the rescue. If I need more characters than are there in the cell then I go <esc>I to carry on but this morning, R was perfect. I never toggle insert mode with an ins key because I got in the habit of using minimalist keyboards with weird custom mappings that didn't have that key (or not that readily available) often.
- zogrodea 2y agoI'm usually faster at retyping a word that has a typo, than moving to the exact locations that need edits within a word. So the c-varianta are better for me.
- arp242 2y agoAlso, I find it's usually just easier for my brain to just retype a word from the start, rather than edit and fix the typo. And R is annoying if the length doesn't match. A lot of my Vim usage is optimized to reduce the amount of time I need to spend thinking about what to do, rather than minimizing the number of keystrokes or whatnot.
- floxy 2y agoNow I must really be in the minority. I use 'r' all the time, but never 'R'.
- ddfs123 2y agoIsn't `R` only useful if your new string is exactly as long as the old string ? I always reach for cw.
- setopt 2y agoI’ve used Vim for ~2 decades, and never use R. I use r daily though.
- cassepipe 2y agoSame, there are so many ways to do the same thing. I'd have used R had I learned about it sooner but sed-like command for search and replace really makes it obsolete for me. I personnally find it weird that parent can't fathom that some people are doing otherwise.
- mejutoco 2y agoC (until end of line) or cw, ce or similar can be quicker sometimes than thinking exactly where the char is, or an alternative that fits your brain better.
- q7xvh97o2pDhNrh 2y agoOne time, I paired with a guy that used `R` all the time. It was an eye-opener for me, too. I use `R` a little more often ever since then, but -- like a lot of others here -- my mental model defaulted to more of a `cw` approach. Maybe there's just two types of vim users. This could be the latest new Silicon Valley personality test.
- NikkiA 2y agoI'm mostly an emacs user, but when I vi(m) I use 'R' all the time, pressing escape when I've finished changing stuff.
- EdwardDiego 2y ago> How could someone use vim without using R? I press I, I add my commit message, then I press :wq and I'm done.
- sva_ 2y agoAnd then realize you wrote :wq into the commit msg
- eska 2y agoI wrote :wq in the final version of my bachelor thesis. It was marked with a squiggly line ending with a ?
- chongli 2y agoJust use ZZ. It performs :wq<enter> for you, saving 2 keystrokes, and it’s fast because shift and z are adjacent.
- verticalscaler 2y agoI'd just like to point out to the vim curios Emacs users lurking in here (hi guys, you will succumb eventually) that he doesn't mean the R programming language. Definitely nobody uses that, true. And we aren't going to make you when you decide to switch over, it isn't like a prerequisite to use the editor. Nor is some weird shitty lisp from the 80s. There was an abomination called Vimscript until Neovim decided to murder it. Praise be. It is now scriptable with Lua, Python, Ruby, JS if you're a satanist (who am I kidding, you probably are), whatever you want. So honestly you're running out of excuses at this point. ;) P.S. - Since a vim-mode will always only support the subset of Vim the authors care about it is rather pointless. Also, Neovim has a robust ecosystem of plugins this Zed thing is leaving behind. There is no escape no matter how hard novelty editors will try to fix what isn't broken. There can be only one! /Sean Connery accent
- wruza 2y agoI have a repeating memory of using R in C-v context, but can’t think of an example. Vim is really reflective. I suspect r doesn’t work in block visuals, which I use often. Need to test. Nonetheless, normal R is a useful function for editing tables and other ascii art-y texts. How can you not need it? For non-vimers who haven’t read tfa: R turns on overwrite mode akin to pressing Ins in command line. r uses temporary replace mode for a single character. Rtext<Esc> replaces four chars, rt replaces current char to t. In both cases we start and end in normal mode.
- from-nibly 2y agoMy brain is slower than my fingers so my edits are never that surgical. If I goofed a few letters in a word I just ciw and retype the whole thing. I never use insert mode when bot using vim either. My fingers just aren't capable of typing individual letters at any useful speed. They always want to type whole words.
- aodonnell2536 2y agoBeen awhile since I’ve accidentally pressed r during visual-block editing but vim will gladly replace every cell under your selection with whatever character you choose after hitting r
- BaculumMeumEst 2y agoWhoops, I've used vim on and off for a long time and did not know about R. I usually either did cw, or ci, or switched to visual mode, jumped to wherever, c, then enter new stuff.
- deleted 2y ago[deleted]
- addicted 2y agoI have used VIM for a very long time and I didn’t even know R was a thing. Now that I do know what it is I’m still not sure why I’d use it. The reality is that VIM allows you to do the same thing in many different ways and people tend to pick a style and rarely use anything outside that style. So, for me, ciw, cw, ct<char>, cf<char>, ci<text object>, c$ are pretty much all the editing commands I use. I’m partial to ‘c’ for my editing needs.