12 ms·
Porn, Zen, and .vimrc
- Bud 6y agoI don't even use vi anymore, and haven't for a long time, and never was fluent in it, but this was still a joy to read.
- softwaredoug 6y agoFor me Vim productivity gains have more to do with never leaving the shell. Desktop environments are maddeningly rife with distractions
- ysavir 6y agoSame. My normal set up is having a shell window with 4 tabs: 1. Text editing 2. Command Line 3. Program logs 4. Code console Flipping through them is a breeze, and I never have to leave Terminal. The displays are always simple, straight forward, and focused. No distractions. I'm able to just get in the zone with the code and forget anything else exists.
- mod 6y agoIf you can move your tabs to tmux, you will greatly improve your situation. It's easy. Then you can, for instance, make your development machine a dedicated cloud server, like digital Ocean etc. This is what I do and it's very nice to be able to use any hardware I want, including cheap underpowered stuff, since it's just a window to my real machine.
- gregjor 6y agoExactly my setup, except I still use screen.
- timc3 6y agoWhat language(s) do you develop in though. I found this was fine for certain languages, but others such as C#, swift or perhaps Java really suit having a fat IDE. Or perhaps its me?
- Timpy 6y agoI also use a digitalocean droplet for my development, but I'm programming in Python, bash, JavaScript/HTML/CSS, PHP, MySQL. I wouldn't do this if I were using Java, Java without an IDE is painful.
- dllthomas 6y agoI use tmux to group shells by context, setting a shell variable that various things in my bashrc respond to. The biggest win is a separate bash history per context, so my commands related to project A don't get mixed up with my commands related to project B or my sysadmin commands or ... It's very nice!
- Quarrel 6y agoOmg that was a ride. I'm so glad it ended back in a place of sanity. I was like, wtf, remapping all this stuff?!! argh!
- haecceity 6y agoI went through the same journey. My use default to minimal configs now.
- rustyminnow 6y agoGood read. My strategy for avoiding all the vim porn and "plugin-madness" is to never install a plugin or mapping/override without learning to do the thing manually in vanilla vim. This way you'll KNOW if that plugin is really worth the bloat, and if you do end up away from your config on a remote server you're just mildly uncomfortable instead of dead in the water.
- rapferreira 6y agoThank you that didn't take 6 minutes to read, very good and informative and helpful.
- ducktective 6y agoWhat's with this attitude? The guy wrote a blog post and by definition he can write what's in his mind at his desired level of length and verbiage. It's not like he was asked to write the eject procedure manual of a spacecraft...
- d10y3vh5 6y ago> This article describes my Vim journey, starting from heavy personal customization and ending with a renewed love for defaults this exact pattern is found in so many vi|m articles and is touted as a triumph of vim's default patterns, when it is really a failure of vim to support whole ranges of functionality. as a daily user of neovim, i know that vscode is a superior alternative and am waiting for a month off to transfer all my vim customizations to a real ide
- xwdv 6y agoIt is not superior, you just have not reached enlightenment.
- smoyer 6y agoThis pattern is also seen in almost every enterprise application purchase I've seen over the last 10-15 years. The process is as follows: 1) RFP, RFQ then purchase your ideal enterprise application. 2) Start customizing it to meet your old way of working (and before you really understand it) while ignoring the fact that X's 10000 customers seem to do fine with the default configuration. 3) Complain that it won't really let you work the way you did a) on the mainframe which was designed based on b) the way you did it with paper and pen. 4) Throw in the towel or force your users to adopt some practice that was neither a) your original process or b) the vendors optimized process. I've seen this pattern with: 1) Oracle ERP 2) SAP 3) Jira (twice) 4) PeopleSoft (twice) 5) Workday 6) ServiceNow 7) Remedy (twice) One of the most solid recommendations I can give is that when you purchase a software system, don't do any customization for the first 12-18 months. P.S. Okay ... go ahead and put your logo on it.
- bobbylarrybobby 6y agoThen should vim be the only editor used in vim mode?
- sharkjacobs 6y agoDo you disagree in only this specific case or do you disagree in general and cite this specific case as being emblematic of why they're wrong? It's not clear to me what your point is.
- zests 6y agoHere is my only remapping: map Q <nop> Whenever I use vim without my config I wind up hitting Q and entering ex mode and wishing I had my config. I've used vim on and off for at least 6 years and have never installed a plugin. Vim is great for quick edits, arranging text in temporary files (control x + control e in the terminal, quit without saving), moving chunks of code around, running macros. Its also great to use the keybindings in your favorite electron IDE. I'm just not a "plugins" person. I've been trying to set up a python environment in emacs for a while and it hasn't been fun. Its an iterative process of installing a few plugins, getting something buggy and slow to use, and eventually getting fed up and restarting from a minimal config file. Emacs has been amazing for magit alone, I just wish I was good enough at it to use it for more things. Vim? Its my barebones text mover that has keybindings in countless apps. That's all it needs to be.
- Kaze404 6y agoHave you tried using Doom Emacs? The process of installing everything you need for a particular language only involves uncommenting a line on your config and running "doom sync". It's really good.
- zests 6y agoI haven't tried Doom/Spacemacs yet. The same thing that keeps me from installing vim plugins probably keeps me from installing large "frameworks" for emacs. Doom does seem relatively lightweight and I'll give it a try at some point this weekend.
- airstrike 6y agoI can't help remapping ; to : and vice-versa. Can't think of the last time I needed the default ; and sparing my pinky from having to hit shift every time I want to ;q is a game changer. Obviously, that's annoying to change in every vim install but I just have a very light .vimrc that I curl in every new box
- __m 6y agoI use a git repository for my configs that also includes scripts to install the configs and packages for different environments from the bare minimum to a desktop environment. I’ll try remapping :, sounds like a good idea
- deleted 6y ago[deleted]
- paledot 6y agoThe only map that I would say is an absolute improvement over the default is map ; : Using : is a waste of a keystroke (ie. shift) in an editor that I chose specifically to reduce chorded key combos.
- jhvkjhk 6y agoI used to map like this, but then I found ; is to repeat f{char}. How do you repeat f command? Map it to another key? Use / instead?
- tomjakubowski 6y agoYou could instead use F{char},, and then keep hitting , ;)
- paledot 6y agoThe answer is I don't. I make heavy use of /, but for navigating within a line I make do with *#^$w. It's kind of cool how you can get two Vim power users (not a group I count myself among, mind) in a room together and find they use a completely different subset of features.
- ryannevius 6y agonnoremap ; : nnoremap : ; Allows me to use : for repeating.
- esaym 6y agoMy journey started when someone just dropped their .vimrc and I tried it out... So I'll do the same: https://tinyurl.com/y4d7rx6f https://tinyurl.com/y4d7rx6f Typically I clone that into my home directory. Then I link everything to it with: ln -s ~/vim/.vimrc ~/.vimrc && ln -s ~/vim ~/.vim The .vimrc is kind of documented, but a quick version is: tt: select a file name to open into a new buffer fr and fR: go forward or backward through buffers (open files) fd: close buffer f2: if the needed commands are installed, reformat code There's a few other remappings, but those are the most frequent ones I use, hence making it easier. <tab> completion works everywhere as well. There's a bunch of other stuff for navigating windows and tabs, but once I realized that "buffers" are actually the "vim way" of file navigation, I stopped using those short cuts. Edit: Yes I realize this is probably what the article is complaining about, but oh well.
- netik 6y agoIt's 2020, I feel like this is some sort of fresh hell that I managed to somehow miss.
- nocman 6y agoYou feel like what is "some sort of fresh hell" that you managed to miss?
- klhugo 6y agoIf your .vimrc is minimal, you will have a pretty good time using systems that implement "vim like" text editing. Take Overleaf for example, no vimrc is available, but I'm quite happy with what I got, and sometimes I even forget I'm in the browser.
- dllthomas 6y ago> If your .vimrc is minimal, you will have a pretty good time using systems that implement "vim like" text editing. This has not been my experience, fwiw. Everywhere implements "most" of what I do, but I still wind up hitting something in the unimplemented portions pretty frequently.
- hackerbrother 6y agoI agree that defaults are good! I have to at least "set number" in my vimrc, and most importantly get rid of those horrible swap files. Here's my minimal vimrc if anyone is curious https://gitlab.com/jane314/settings-and-scripts/-/blob/master/vimrc https://gitlab.com/jane314/settings-and-scripts/-/blob/maste...
- imron 6y agoAll it’s missing is ‘set expandtab’ ;-)
- hackerbrother 6y agoNoo I like tabs! Maybe you can explain to me, I genuinely do not get why people are religious about spaces instead of tabs. You have to backspace more times to get rid of an indent!
- aidenn0 6y ago<< to get rid of an indent. People are religious about this because if you use a shiftwidth (or sts) different than your ts, you end up with a mixture of tabs and spaces. If you change your ts to something other than 8, then you end up with code that looks weird on everybody else's screen.
- freshhawk 6y agoTabs are better in theory, obviously. However people insist on using spaces. Like between words in sentences or between tokens in a line of code. Spaces are better than mixing tabs and spaces, especially with "modern" (newer than 30 years old) tools. Especially if you use these editors enough that you are never indenting manually with backspace or tab/spacebar. So the options are tabs+spaces mixed together or just spaces unless you are dealing with tab delimited files with no spaces in them, which is rare. The tradeoff is you lose the ability for different people working on the same thing to see different indentation levels. In exchange you don't regularly get your formatting confusing messed up because of some kind of invisible control character confusion.
- dflock 6y agoChesterton's Fence: https://en.wikipedia.org/wiki/Wikipedia:Chesterton's_fence https://en.wikipedia.org/wiki/Wikipedia:Chesterton's_fence
- ed25519FUUU 6y ago> "If you don't see the use of it, I certainly won't let you clear it away. Go away and think. Then, when you can come back and tell me that you do see the use of it, I may allow you to destroy it."
- watt 6y agoI can't stand this. If Chesterton thinks he has all the power, why doesn't the onus to know "the use of it" fall on him? He should be responsible for documenting the purpose and motivations behind the fence, if he thinks he's such a protector. Anyway, this stance seems to be what separates conservative from a liberal. Conservative want to protect something that exists but he has no knowledge of reason - such as people protecting slavery, racism, etc. Putting up barriers against people trying to change world for the better.
- aidenn0 6y ago1. Wanting to remove the fence is a statement of "this fence does more harm than good" and if you say "there never was any reason for this fence to be built" it's very strong evidence that you did not spend sufficient time investigating the fence's benefits. Chesterton doesn't care about the protecting the fence, he cares that the person who wants to remove the fence thinks it through all the way first. 2. It's not hard to come up with reasons for slavery and racism to exist; that's all you need to do to satisfy Chesterton. I'll even go a step further and say that for societal issues if you don't have at least a basic understanding of the forces that caused them to exist (and cause them to continue to exist), then you will probably fail to change them anyways. 3. Fences take time to build. It's very rare that you get eccentric people putting fences up randomly (rare enough that discovering that to be the cause of a fence should be pretty easy because it would be so notable!) 4. Because of all of the above, I'm going to say that it's not really the difference between a conservative and a liberal, but it is part of the reason why younger people tend to be more liberal and older people tend to be more conservative. Understanding the lesson of unintended consequences puts pressure on the "conservative" side of the scale, and it can be an excuse for conservatism. However, Chesterton's fence is an important engineering principle that should be taken into account when making policy regardless of your political leanings.
- OJFord 6y ago> Now, after all the struggle, my vimrc is around 50 lines in length. It only includes simple and frequently used commands, like this map to toggle search highlighting with ctrl-/ Isn't the usual one (perhaps it's even default) leader (default \)-l? I used to use Esc, which honestly I really do prefer (intuitivly - I'm in 'search mode', ESC to get back to normal), but it's somewhere between painful and impossible to portably implement without weird bugs, so I eventually gave in.
- amelius 6y agoI wonder, what is the preferred way to install configuration files such as .vimrc, .bashrc etc. across all the machines a user logs into?
- francis-io 6y agoFor me, the only machines I log into and use are my own, so I use ansible to manage local configs.
- kyleee 6y agoi just keep a repo of public configs and curl them to any new machines and have a simple script to symlink the various configs to their expected locations
- jessaustin 6y agoThere's a standard tool for that: https://www.gnu.org/software/stow/ https://www.gnu.org/software/stow/
- kyleee 6y agothank you, i was not aware and I will investigate it
- syntheticnature 6y agoI once decided to try an online vim profile generator when setting up after a disk crash, to save time re-creating my simplistic .vimrc. It was awful. All sorts of things I never used normally in Vim, forced down my throat. Manpage-reading plugins, bizarre brace handling, different buffer control, and a Day-Glo colorscheme implemented in some annoying-to-override fashion.
- roland35 6y agoI have followed a similar vim path, although my vimrc file never was close to 1,000 lines long! I used to use many plugins though including nerdtree, airline, and surround. But in the end it was always difficult to maintain that setup long term. I do try to add a few shortcuts to my .vimrc file though which is pretty minor: - jk maps to escape - oo and OO map to create a new line below/above but stay in normal mode - leader \ to clear highlights and that is about it!
- freshhawk 6y agoI think everyone knows the rabbit hole problem that this kind of article is warning against. Especially for beginners. But as a counter-example: I've done most of those "types of vim porn" I guess, then moved to spacemacs, then my own custom emacs/evil setup. Always with some similar window manager and command line tweaking as well. Probably spent a hundred hours on all this kind of thing easily, in a small number of big bursts. Over 20 years. During which time I've had a very comfortable, understandable, debuggable and pleasant dev environment that made development, testing, documenting, debugging and planning a thing I can just work on without really thinking about the tools. Switching between the files, the command line, the failed tests, the docs, the repls and the browser tabs as fast as my eyes move. I don't need to break out that one efficiency-tradeoff XKCD either because while it was definitely mathematically worth it time-wise, there is no question the wins were happiness-wise and not-swearing-at-my-tools-wise (just the project code). Learning to type was probably a better ROI, can't think of what else is in the ballpark though.
- tadasv 6y agoIt's been a while since I started using vim. I can see some similarities. Though, I didn't really do much configuration in the early days. Currently, I have pretty much no configs when it comes to key maps or some custom or shortcuts. I only add plugins for code completion and highlighting. Nothing else.
- xvector 6y agoThe added benefit of this is portability, as in your weird shortcuts aren’t burnt into muscle memory, so you can easily use Vim on any computer.
- tadasv 6y agoExactly! I like being able to log in to any server and use vim/vi without any issues. I've noticed similar pattern with other tools, e.g. git. I've seen coworkers add all kinds off aliases to simplify git commands, and I'm very much against it since I prefer portability.
- curryst 6y agoThe portability aspect seems overstated, or perhaps your use cases are just different. I can already log in to any server with my custom configs; Ansible is what configures my user already, so I just have it dump out my configs. If I can access it, it has my configs. Admittedly, it does get annoying when I'm sudo-ed to another user, but it's vanishingly rare for me that I am both sudo-ed to another user, and doing enough editing that I really want those configs. Usually a sudo-ed vi for me is just updating a couple lines in a config, I don't need a full config for that
- Snarwin 6y agoInstead of `sudo vi`, you can use `sudo -e` (or its equivalent, `sudoedit`) to run the editor as your user.
- Ar-Curunir 6y ago
- fortran77 6y agoI can't imagine remapping any of the standard commands. What if you have to edit something as a guest on someone else's system? Just get used to it and deal. I've been using it (in "vi" form) daily since 1985 or so and doing any of those remappings would drive me nuts.
- Ar-Curunir 6y agoCan’t you ssh from vim? I’ve done it in the past.
- deleted 6y ago[deleted]
- thealienthing 6y agoI personally find vin to be a good tool for editing text without leaving the terminal. But when I’m writing a lot of code, I’ve found the vim ide concept to be far more trouble than its worth. Modern IDEs like VSCode + Vim bindings is my preferred platform
- javitury 6y agoCoc.nvim provides VSCode equivalent plugins in vim.
- m_mueller 6y agoOne thing I never understood is why Vim bindings are a big gain when you have a mouse. I see a single edit, it takes me all of one second to click for a large jump, even less for cursor key combos in case of a small jump. For mass edits there is find/replace and find+multi cursor. 80% of my time in the editor I spend thinking about the code anyways - I have zero interest to optimize deciseconds of my time, or worse, optimize my perceived productivity vs. my actual productivity (e.g. forcing myself away from the mouse by ways of pattern matching that increases both mental overhead and time required).
- the_gipsy 6y agoThe gain is less frustration. If you don't mind moving back and forth between mouse and keyboard, or smashing ctrl-arrow to move, then it's fine.
- erklik 6y ago> I have zero interest to optimize deciseconds of my time, or worse, optimize my perceived productivity vs. my actual productivity (e.g. forcing myself away from the mouse by ways of pattern matching that increases both mental overhead and time required). I think you just said it. Its not interesting/nor a priority for you to optimize things to that level. Those using vim properly and trying to move away from the mouse consider it better for efficiency and ergonomics (debatable). Its not that you fail to understand. Its more so that you don't care that much.
- emptyparadise 6y agoCounterpoint: it's my editor on my computer, the most important thing is me understanding my own tools and being able to use them comfortably. So while I try to not deviate too much from standard shortcuts, I'm not afraid to make mappings for things I rely on more. At the same time I also dislike complex plugins that add crazy amounts of extra complexity.
- fouc 6y ago> I started to look at Vim as a line editor first and a text editor second. Indeed, if you look into it, the original intention of Vi was to serve as a visual front for a line editor called ex. And I think it shows. What it means in practice is that Vim encourages you to start your edits with the cursor placed at the start of the line. When you are in this place everything goes smoothly. And when you go against the grain all kinds of bad things start happening.
- rapferreira 6y agoBro I don't mean to make you the shining example of what I'm talking about but can we please try to be succinct with write-ups? The whole first half of the article could've been summarized with a single sentence: "As is typical with newbie vim enthusiasm, I spent many hours producing a 1000+ line vimrc over a long time that I eventually realized complicates my word editing process more than it helps." I mean come on..
- john4532452 6y agoAlso drop the first word of the title. Click bait
- phist_mcgee 6y agoI think it makes sense in context, where many tech enthusiasts do almost fetishise their or other's configurations as nerd cred. Just look at /g/ board on 4chan, people post their neofetches and compare kernels.. Let's all just move on from this trend of things that are sexy in a category being regarded as 'porn': earthporn, cityporn, natureporn. Maybe I am getting old..
- pretendscholar 6y agoand the poorly named babyporn
- ObscureScience 6y agoAn article doesn't have to be a summerization. This is more of a personal story, albeit on a technical issue. And I'm pretty sure it's not just "noobs" that focus that much on customization, but of course their attempt will more likely be unproductive.
- KKPMW 6y agoThanks for the honest feedback, but I think everything you want summarized is in the summary at the top: > Vim is a highly customizable text editor geared towards writing code. But open-ended configuration possibilities often lure users into wasting time while chasing after perceived minute gains in productivity. This article describes my Vim journey, starting from heavy personal customization and ending with a renewed love for defaults. One can read it, take the message, and move on. However if another reader wants details, it's hard to know upfront what kinds of details he/she will care about. Hence, based on the premises in the summary, the article expands on: 1) the ways in which Vim can be over-configured; 2) some examples demonstrating the possibilities of changing default behaviour; 3) the benefits of scaling configuration down; 4) Summary and additional notes. You might only care about one or few of those. However this, I feel, is where you would have to selectively skip some sections, based on your own judgement.
- m1gu3l 6y agostyle for this is, um, questionable. but i did enjoy the content.
- KKPMW 6y agoWhat do you mean by "style is questionable" ?
- saulrh 6y agoThe simple truth was that, no matter how much energy I invested in my custom configuration, the people who built and designed Vim knew it a lot better than me. That would make sense if the defaults we were talking about had been carefully selected five or ten years ago or shown any signs of evolution since they were first laid down in 1975. If I was editing code in the languages they used in environments like theirs using underlying tools that performed like their tools in a codebase the size of `ex`'s, I'd certainly trust the defaults. But I'm not doing any of those things. Today, I work in a codebase whose human-readable source alone might be larger than any installed digital storage system that existed when vi's shortcuts were chosen. By necessity I navigate it with semantically-aware indexing and information-retrieval tools that would have been miraculous back then. My edits are guided by static analysis and effected with automated refactoring and code generation tools. My configuration doesn't suit my environment as well as vi's defaults suited their environment. It does, however, suit my environment better than vi's defaults do. And let's not even get into emacs configurations. :P
- formerly_proven 6y agoOne of these things that aged really badly is : for command mode. On the particular keyboard that vi was made on : was accessible without modifiers, but on virtually all other keyboards it needs shift and is not a good default. Comma (,) would make much more sense. I'm sure there are other instances where the keybind initially made sense on the keyboard the devs were using that nowadays makes less sense.
- raimue 6y agoRegarding to the remapping for Y, I also only memorized y$, c$, and d$ and they seem more natural to use for me. Therefore, I remap D to delete the whole line, but do not put it into any register. This allows me to cut a line with dd, while I can throw away a few other lines with D to clean up around the target location, before finally pasting with p. nmap D "_dd vmap D "_dd
- zarkowsky 6y agoThe three things I have in my .vimrc are se ts=4 #1 tab= 4 spaces se ic # ignore case when searching se nows # don't wrap to top when you reach end / beginning of file in a search. I could add a lot more, eg a json / xml formatter but never got around to it in 21 years.
- luord 6y agoEver since I started using vim exclusively for development a couple of years ago, I deliberately decided not to use plugins nor to edit the defaults unless strictly necessary. Nowadays, my .vimrc is just a few lines, all regarding indentation. It had worked for me so far and I never really felt any less productive than when I used IDEs or VS Code.
- dllthomas 6y agoI am slow to customize vim for some abstract notion of "my use". On the other hand, I am quick to customize vim for specific projects.
- fomine3 6y ago"Practical Vim" is good read.