It is a similar pitfall that developers step into when they optimize their code before profiling where the bottlenecks are at.
But of course you should still do all of this, because it is a lot of fun and Vim rocks.
Author here. For reference I've made 5 courses over the last 4 years and have written over a million words. I also have 200+ blog posts and have hundreds of thousands of lines of code written across a bunch of projects.
In other words, I hope I know what my bottlenecks are with my environment. It's not specifically editing text, but it is managing a shit load of words across many hundreds of files and also switching between projects.
With no real prior Vim knowledge (I looked at it once many years ago) it took a solid weekend, and when I say solid, I mean I spent 10 hours both days researching Vim features, watching tutorials, following along with tutorials and slowly introducing a couple of plugins I knew I wanted (based on exact problems I had).
That got me to the point where I had the environment mostly working with a decent enough config file. Then I spent days floundering around like an idiot while I hardcore failed to even do simple things like "move to the 2nd to last word in a sentence and then wrap the last 2 words to a new line". Doing that without arrow keys and no mouse almost killed me initially.
After about a week of immersing myself I got to the point where I didn't feel like I was completely destroyed by a foreign environment. During this week I wrote about 10,000 words and worked on a couple of freelance programming gigs.
In my opinion, it was worth the 20 hours of set up + 20ish hours of not being as productive to set me up for the next 5+ years.
Plus as you mentioned, a side effect is it happens to be a fun too. That's a win win!
Also, consider checking out this blog post that describes a somewhat similar journey to incorporating vim (and vimwiki) in one's workflows:
I think another way to look at it is that humans are terrible at perceiving reality over time. Our understanding of what problems are most pressing are often only accurate to criteria that we aren't aware of judging. Ie, psychological biases built around your world view can have material impact on what you perceive as the most pressing problems - especially when trying to boil down thousands of hours of data points.
That's not to dismiss your findings - it's simply to say I distrust human perception, benchmarks are needed. Hah :)
I do it more with emacs and self-made CLIs, but I think the person choosing the path is the right way. It melds it perfectly to your tasks and mind.
I'm pretty content with this current set up but I'm always learning, so I have to ask, what made you choose Emacs in the end?
Was it org mode exclusively, a general disinterest in Vim keybindings or something else?
I heard this many times and believed it, but after some time I think this is bad advice.
There are two kinds of performance optimizations: free optimizations and optimizations with a cost.
The free ones are things that don't really take any extra complexity to implement, just a little thought. Using a hashed data structure instead of an array when you'll be accessing items randomly by id. Breaking early from a loop.
If you never think about these things unless you're explicitly on a profiling task, your code base will be full of "easy wins" that you have to go back and find and fix. Which will be time consuming and error prone if you do it after all your code is written.
The other group of performance fixes is ones with a complexity cost: adding a cache layer, rewriting an algorithm in a slightly more confusing way, etc.
My advice is: always pause when you are designing a new feature and think about whether there are "free" performance wins. You can implement them now with no cost, and you should. It often helps with your data design anyway, getting code that more closely matches the actual processing domain.
It doesn't have to take more than a minute. Anything bigger than that, yes: punt it til after you have profiled.
As GP is saying, at any given complexity and readability level, you can write the code in a more and less performant way. Writing more efficient code takes just a) willingness to consider performance, and b) willingness to actually learn your toolset as you use it.
To me the advice means don't belabor the choice of data structure of its not obvious to you.
If you're writing a quad nested for loop to solve a problem, don't get distracted trying to refractor all the work leading up to that wart... Just get it down first.
Get a passing test first then optimize later if the code is a bottleneck.
In that case, totally get that test passing and then maybe add few more tests around that solution - so that when I come to the project half a year later, and see the application consing like crazy because you used lists instead of arrays, and this now powers half of the business logic, I can tear this up and fix the data structure with confidence I won't break things badly.
(Totally not a real case I had.)
Not to mention the aesthetic pleasure of making your tools a joy to use.
Imagine changing jobs. At your new job, you'll be able to go faster because you have a well optimized workflow.
It doesn't matter to your new bosses that you previously spent an ungodly amount of time optimizing your workflow and learning advanced tools, the only thing they're seeing is a productive employee.
Sure...but how long will they stay bald? :)
There's also many legends of people going mad trying to shave this particular yak so...
Heh, probably. You should also compile your own kernel once (maybe even go for a LFS setup), configure FVWM with bells and whistles and probably a few other things I'm forgetting now :)
It's being happy. It's knowing you're using tools that let you get things done in a way that works best for you.
Something like this has infinite value because it's the difference between waking up and dreading doing something because of the upcoming million paper cuts VS waking up really excited to do your task. That's the difference between writing nothing one day vs writing 5,000 top quality words.
So you have a task that takes X time. What's say optimizing it is a net loss time-wise because it doesn't in aggregate save you more than you spent to perform the optimization. Say after optimization it only costs 0.8X time but it took 0.2X time to do the optimization so all benefit cancels out. But the difference being now happiness is 1.5 multiplier so you feel 50% better and the same aggregate amount of time is spent but it's much more enjoyable and therefore more valuable to you.
Maybe I'm not explaining it well, but I totally feel this way about plenty of stuff.
Doesn't that just mean you've selected VIM's syntax for all your IDE's? Most IDE's seem to have plugins for other popular editors.
Maybe this is a mindset issue, but I'm having a hard time imagining how one would want to just get the work done, without trying to pick up a skill in the process.
Despite the current UX trends of dumbing down software, it's rare you'll use a tool just once in your lifetime.
My wife has used SublimeText and Notepad++ for total of maybe 10 hours in her entire life. I'm not suggesting her to learn Vim (or Emacs), because the kinds of tasks she does with computers don't benefit that much from a proper text editor. However, most developers spent inordinate amount of time editing plain text files, and a lot of tasks they do in other tools - like task management, time tracking, documentation writing, drawing diagrams, commenting on StackOverflow - could receive stupidly huge efficiency improvements by being done in plain text too. Vim and Emacs are the two tools that are dedicated for precisely this class of problems. In my opinion, the couple dozen hours one has to invest over the course of a month to get some basic proficiency in them is worth the across-the-board payoff in work speed and comfort.
One trick I've learned is being explicit and deliberate about learning. To things like learning a new piece of software, recursive Pareto rule applies - 20% of time gives you 80% of value. 4% of time gives you 64% of value. So, say you're willing to entertain the thought of learning a little bit of Vim. Allocate a single pomodoro to it right now, and fire up vimtutor. 25 minutes, full focus. You'll notice it only takes a few minutes to break through your own habits and learn the basics of a new interface. You'll be impressed by how much you've learned in just 25 minutes. Next step: commit to 5 hours over a week. 10 pomodoros. Find some introductory tutorials, and work through them this way.
Personally, I did above trick a couple of times to learn new Emacs features. Getting comfortable with multiple cursors, or with paredit, are things that turned out to take 1 or 2 pomodoros, and have been improving my editing speed and comfort for the past couple years.
WRT. mindset, a proper one can smooth out the learning curve quite well. The most basic trick that I see even developers not recognizing is this: every time you click on a button in your program, figure out if there's a keyboard shortcut for it. If there is, try to use it instead. Soon, you'll find yourself working much faster and comfortable than before.
 - though you'll lose half of it in a day. Committing new skills to long-term memory takes more time and exposure; muscle memory takes even more. Good news is, this happens pretty much by itself, as you apply the new skills to the tasks you're doing.
Most people don't want to put in anything more than 40 hour work week these days. Which also means no time to learn and upgrade your skill set. That is for doing their everyday tasks.
Now selling vim or emacs to this set of people would never work for one reason. They just can't get themselves to spend that time.
That's also a big reason why people hate Nerds. These people spend to get better at things in a way we don't want to.
And truthfully, the productivity wins for me weren't so much tied into being able to input text at a faster rate with Vim.
It was being able to leverage Vim itself to help me rethink and reshape how I organize large amounts of structured text, which saves a lot of time and headaches when dealing with files. Plus there's other wins too with limelight and video editing (an added bonus).
I'm still not 100% as fast as I was with VSCode for inputting and editing text but after 2 weeks of using Vim, it's not a complete train wreck anymore. It was brutal for days, but it's slowly getting better.
Bonus points for using it in mutt for all electronic correspondence.
Also, why the Dickens are you using Windows when your heart clearly yearns for a nice native i3 setup?
That was explained a few weeks ago in this post:
Ah OK. Haven't had that myself, even using USB audio interfaces in a similar fashion, so I wouldn't put that down to Linux. I use monitor speakers and have good hearing and definitely not getting those issues with a simple pulseaudio setup. I flick between youtube, cmus, recording on my old Zoom H2, audio from a VM etc. so have run the gamut of opportunities for it to pop and click.
Sounds like you had to spend a lot of time troubleshooting and in the end thought it wasn't worth the fight. I hear you, but I would see if I could borrow another audio interface from a store or contact of yours before giving up on OS-freedom for good. The Scarlett is an entry-level device anyway, known to have dubious build quality. I'd also take it up with the manufacturer before looking for more fixes.
After I finish this next course I will try again with a different distro, and then see if my other USB mic that worked on the Chromebook (running native Linux) also works on my main machine.
It's a lot of fun and I really can't go back.
Some people find even an iPhone too complicated, others don't mind reading the manual for a minute. For some users Vim just makes sense, while certain people will struggle with saving files in Notepad because they think a specific button is at the wrong place and refuse to learn it any other way than they imagined.
> I still get frustrated setting up a new computer
Why is that? Setting up Vim is the easiest task for me, it's literally just a matter of copying some files.
A mindset that is suspiciously similar to an engineer's. :P For example, you need the user to memorize the fact that all the configs are in a ".vimrc" file in their home directory. Oh and since it's a dotfile they might not see it immediately. And then if they want to add custom shortcuts they need to learn exactly how the syntax works, the different "modes", the types of remaps, etc. It's a horrible experience for a non-engineer.
> Why is that? Setting up Vim is the easiest task for me, it's literally just a matter of copying some files.
I have a lot of plugins (e.g. syntax highlighting, linting, and autocomplete for different languages), and each of those can have their own dependencies that they require you to install before they'll work.
I tend to use the example of a car in these topics, but I have a better one: a coffee maker. There are numerous non-obvious things one has to learn about coffee makers - like how to apply a water filter, and what kind to buy. Like the symbols that mean "not enough water", "not enough coffee", "dredge drawer full", and what to do when they show up. Somehow, I never see anyone complaining about this - because there's a social expectation that people can and should figure this out. The coffee machine comes with a small booklet explaining all of this in pictures and a dozen languages.
Yet somehow, with software people think that the UI should just have a button labeled "get my job done", pressing which will get their job done. It's a really broken mindset, because it's impossible (or rather, it's an AI-complete problem) to have software like that.
People complain about that, because they think things should be handled and explained within the machine itself. I don't complain about coffee machines, but I agree with the principle. If I have to go searching through manuals to figure out what actions I need to take to get something working, that piece of software has failed at user interface design.
Sometimes it's ok to fail at UI. I don't expect everything handed to me on a silver platter when I'm writing a bootloader for an 8051, but I do expect my tools to be reasonably user friendly. Vim isn't user friendly, and that understandably drives people away. Hell, even emacs can be a pain to work with.
A HUGE problem with developers learning VIM is that they think they have to go from 0 - 100 immediately when you can adopt VIM gradually and still see noticeable efficiency increases.
That iterative process is exactly what I'm talking about. It's taken years to develop my vimrc, because starting with a "prebuilt vimrc" means that you don't really understand what is pure vim, what's custom, and what issues you might run into because of those custom settings conflicting with new plugins.
Obviously there can be snags on the road and things get more difficult the more complicated things you want to do, but learning the basic keybindings and being able to efficiently edit files with vim just isn't that hard.
I would say vim is easier to configure than, for example emacs
But still, I have a lot jotted down. Mainly the hotkeys, but also things just to remind myself that a feature exists (like * to highlight the current word).
The premise of the article is that the VIM is better enough than alternatives that it's worth the learning curve. Just like a drill is better enough than a screwdriver to learn ho to use it. If you want to contest that, that's a different discussion.
If your argument is, "some people don't have the energy to use the best tool for the job"... idk how to respond to that.
If you go far enough, you can cause the analogy to break down, but that's true of any analogy. This breaks down because the ROI for a drill is too short to compare with Vim.
And trends go around in IT just like any other field. So before someone jumps into vim to save themselves hours of work they should know that it requires practice use to use well.
I wouldn't say I am learning Vim due to it being a trend. I'm learning and using it based on problems I discovered using other editors to write books and courses.
You can use it to visually warn you that your git commit is going past a certain amount of characters. Basically it can help you create better git commit messages.
But if you hate it and are on a Unix-like environment you can export EDITOR="nano" in your profile and now git should use nano instead. I think there's a git specific setting you can set too if you don't want to do it system wide.
This approach is especially nice when there are great vim keybindings for things like Visual Studio. The only thing you have to learn to start using vim is to always pay attention to if the cursor is a block or not, and if it is, remember to hit "i" before you mash keys if that's not what you want.
It not only has menus, but the shortcuts on the right side of each menu item aren't special - the they're the same commands you'd just type into vim normally. I picked up a bunch from those, but in particular I remember folding being one I didn't even know existed in vim until using it in one of the menus.
Anything you're not good at it is going to slow you down. The question is that even tho you might be slow, if you put in the effort, learn it then get good, will the savings and speed up make up for the initial slow down?
I'm a vim fan and won't try to convince others. But I personally believe that the answer is yes. One of the secret to being successful with vi is that of mindset. You need to have a positive mindset that it's worth learning, you need to commit to learning it. I learned vi when network speed was very slow and systems didn't have enough memory. It was faster than any other editor. So I had the mindset that I needed to learn it. if I was starting out today, it probably would be hard when you have editors like vscode.
I have typed and used computers everyday for 25 years non stop and I have no issue with my fingers and I believe a major part of it is using vim and my fingers not having to travel and move out to find a mouse or hitting Ctrl+ keys.
And even if we're talking about 20% of your time, improving that 2-10x is nothing to shake a stick at. 20% of 10 hours is 2 hours, if Vim makes you edit 2x faster, that's 1h saved, per day. And that's without accounting for other work you could move to your suddenly more efficient plaintext mode, and the work you don't even consider doing because your editing experience is too painful (it sometimes work the other way too; there are things I won't do in Emacs, but I will in IntelliJ, where project-wide, language-aware refactors can be done with two clicks in full confidence that nothing will break).
Vim still isn't my exclusive dev editor, but it has almost become my exclusive terminal editor. Learning older technologies may not always be top priority, but it can do a large amount to enrich your personal perspective- particularly if you discover the niche where its usefulness is best utilized (and like you mentioned, if the amount of time to get up to speed will save you proportionate future time).
The main downside is that you don't learn things like window managing, file exploration, etc - mostly because other editors are already good at that, and it's not something plugins focus on.
The thing is, vim forces you to do a lot of stuff that the machine could do for you. E.G: you need to remember states and how to transition between those states. Plus the human mind sucks at context switching.
All in all, this adds up, and there is a limit to the cognitive load you can accumulate. You only have one brain and you need to share it between all tasks, including solving the problem at hand and using tools to do so.
Half of my income comes from training professionals on site. Experience taugh me that every time somebody uses vim, 4 things will happen:
- the person will be one of the best of the team
- the person will have some weird bug/config problem/compat issue at some point and will waste time fixing it at least once during the training, swearing it never happens (also the person with vim usually has a very custom setup so this compounds)
- at the end of each day, the person will be one of the most exhausted, and will make way more mistakes than the others compare to the morning baseline
- at equal technical level, the person with vscode/sublime/jetbrain will be faster on average. Maybe not the first hour. But it will come.
So, yes. Vim may be fun. It may suit your workflow and ecosystem, and even your sense of aesthetic. But I don't buy the productivity boost.
For example, let's say you want to put the cursor next to a specific word in a sentence.
If you use the mouse, now you need to stop writing, goto the mouse, find your mouse pointer, look at the mouse pointer, then move the mouse to the word you want to be at, click the mouse and start typing again.
I'm an avid gamer. I'm super used to this. I can move my mouse at pixel precision and do it very quickly, but even if it's fast, it's still a context switch.
With Vim, it almost feels like Vim itself is another input device that's almost a mind control device. I can just direct my eyes to the word I want to move to, hit 3 keys and then have my cursor jump directly to it (by using vim-sneak and pressing any 2 characters of the word).
Even if doing this is only equal speed to the mouse, it's still a win in my book because it feels less of a context switch. Plus if you want to talk about mistakes, looking at the word you want to jump to instead of your mouse cursor forces you to look at the word, so you have 1 more chance of avoiding a spelling mistake -- although to be fair, most editors including Vim can visually show you these errors.
wow, that's pretty cool!
With vim being on every system, i don't really carry much baggage around. I have my vim settings file in cloud storage. And maybe one pluggin (NERDTree) on my main machine.
I'm not even waiting on people with Vim problems anymore during the lectures. I just go on, they will catch up.
I believe that there may be some post hoc, ergo propter hoc at play here.
For instance did you include the age of the persons in your observations? It wouldn't be surprising that the persons choosing vim are a bit older on average, and then one could think that they have a bit less stamina and are exhaust faster?
Or maybe they are actually doing more, like spending part of their energy helping others? That's also a pattern you can see often in group training sessions.
Also, you mentioned that you won't help them with the "weird issues" they usually have with vim. Do you apply the same treatment to non-vim users?
That being said one person's anecdote supporting a highly subjective opinion deserves to be torn to shreds without ample evidence or at least better context.
I don't think that makes any sense at all. If anything Vim does a lot for me because it's programmable. When doing heavy editing, the whole point is the automation does the heavy lifting.
Switching modes doesn't have any cognitive load effects that I can notice. The cursor changes the shape for example, so you instantly know what to do. It's pretty much second nature.
What you're describing is a novice or clumsy Vim user. I don't know what "compatibility problems" should have a text editor, but I haven't had any in many years.
> So, yes. Vim may be fun. [...] But I don't buy the productivity boost.
Kind of condescending, really. Thinking that Vim is a toy and all users are using it for the heck of it, when they could be more productive otherwise.
Even if the correlation is real, there's just no way that difference between using vim and using something else is so great that it's causing people to exhaust themselves, so best case scenario there's some hidden variable causing it.
Give me VS Code with the Vim plugin and I'll code circles around someone using the standard controls simply because it takes so little effort to do most complex things and if a mouse actually makes things faster, I can use that too.
The right education is: vimtutor (type it in your CLI and within 30 minutes you're done).
I deleted my rant but I dare anyone to take my challenge: do vimtutor for 30 minutes and then answer the following question twice (before vimtutor and after it) in a comment.
I perceive vim to be difficult:
(1) strongly disagree, (2) disagree, (3) agree, (4) strongly agree.
Once you know the basics of vim, then it won't slow you donw.
Well I just discovered a new thing to do over the next 25-30 minutes
Beyond this, see also the tour over the basics here: https://www.gnu.org/software/emacs/tour/.
That's what it did on my first run. It indeed wasn't perfect, but there were already a couple of tricks that I've learned that I really liked and that's what you get out of it.
I'm not saying you work faster, I'm saying after vimtutor you won't work slower.
I suppose you still work slower if you compare it to your favorite text editor, I'm not very strongly proficient in any text editor, which is why I'm not noticing slow downs.
Buffers, windows, autocomplete, files browsing, all of that requires you to dig around the help files and the web.
You have to get down to hunt-and-peck until you see typing ability actually affect productivity (and I have seen those people). If you can touch type using any keyboard layout, though, then typing speed won't be a meaningful limitation for you.
That being said if I anybody reading this is tempted to switch away from QWERTY towards a more ergonomic layout I'd suggest looking into Colemak, it's supposed to be at least as ergonomic as Dvorak while being closer to the standard QWERTY layout.
I suspect Colemak is better, but it's a much smaller gain going from Dvorak to Colemak than from Qwerty to Dvorak, so I'll stick to what I have. Otherwise I suspect Colemak is better than Dvorak when switching from QWERTY.
Yeah I'm in the same boat, that's why I was mainly aiming my comment at people using QWERTY and looking to switch to a better layout. Even the Colemak people acknowledge that:
> The Colemak keyboard layout fixes all the issues mentioned above, and wins in virtually every criterion, but the difference will be less noticeable than the difference between QWERTY and Dvorak. The switch won't be as easy for veteran Dvorak users. If you're generally happy with Dvorak, you should probably stick with it.
The FAQ also has an interesting list of "what's wrong with the Dvorak layout" which might be of interest for people looking to learn it: https://colemak.com/FAQ#What.27s_wrong_with_the_Dvorak_layou...
Layout switchers have some bias here because they don’t type as well in QWERTY anymore or they didn’t touch type QWERTY.
When I'm writing something that doesn't require a lot of cognitive overhead (typically chatting online, when I may have a lot to say but it's not particularly intellectually demanding and doesn't require a lot of precision or proofreading) I can reach pretty high WPMs.
I'm not convinced that typing speed is always brain-bound outside of typing tests. If I'm telling you about my day at work I'm pretty sure I can just "stream-of-consciousness" directly through the keyboard with very little overhead, especially if I do it in my native French.
I was trying to talk about comfort difference between keyboard layouts anyhow, not the speed difference.
Given the same proficiency level of QWERTY and Dvorak/Colemak, comfort difference would be more noticeable for high intensity / little breaks / long duration activity like typing tests.
Are alternative keyboard layouts significantly more comfortable for practical tasks? I’m skeptical. (Most enthusiasts already agree they aren’t really faster).
It's not about speed. Sure, some people say it's about speed, on either side of the debate, but I'm not a faster typist, nor a faster editor, nor would it matter in my profession (coding.)
It's about ease of use.
Once you're used to them, these tools save you (cognitive) overhead. Dvorak doesn't tire out my wrists (subjective, but I switched away from Qwerty&Emacs after developing RSI when writing larger technical documentation. Never had the same problem with Vim&Dvorak, even when writing frantically day and night on my thesis.) And Vim allows me to navigate text easily. It's not about speed. It's about intuitively navigating to something quickly, without having to think about it, and to stop and completely upend my current focus because I have to hunt & peck for something with my mouse.
I've changed my keyboard layouts in the past. My conclusion: there's value in standardization.
Colleagues have a switch. setxkbmap -option compose:ralt or whatever your DE wants you to use.
From the person you replied to
> Never had the same problem with Vim&Dvorak, even when writing frantically day and night on my thesis
Most of the graduate students I've knew spent a lot of time working alone, and had at some point to type a lot of things already clear in their head meaning ease and speed of typing was a very important factor, keyboard sharing not so much.
And then I've observed the same things as you, it's really annoying working at the desktop of my colleagues using non standards keyboards.
So, really, it's all dependent on context, and as usual there's a right tool for a given job. Kudos to both of you for coming to correct conclusions in your given environments :-)
I decided to stay with qwerty at work because I want a colleague to be able to work on my system, and switching keyboard layouts multiple times per day only causes me to type gibberish more often. And as you say, there is value in standardization.
If you switch machines so often you can't keep up with moving your customizations between them, by all means, learn just the defaults (but do learn them - e.g. whatever the "standard" editor IDE, learn the keyboard shortcuts). As for pair programming, switching keyboard layouts and opening a project in a different editor/IDE takes only a small fraction of the time your colleague will spend in front of your machine.
I'm not lying, co-workers think you are a god damn wizard. I try not to be a doosh, but I have one co-worker who loves VIM but doesnt really use it (insert mode ftw). Whenever I can i try to subtly drop hints. "Instead of hitting the arrows keys over and then backspacing, you can type cw to change the word" Just little things like that. Once you realize that vim is modular and chainable, you really start to take off!
All you do is learn how to write Elisp Macros. And then you automate your knowledge. Think of it like programming a text pad(s)(Like how excel is programming a list(s) of cells). You realize that the text buffer is your programming environment, with cursor movement as your basic control, and text output as your end goal. Then of course other programmatic facilities apply.
Only recently wrote a piece of Elisp code at work, that takes a file, does a bit of error analysis and gives me offending lines and other inputs like ids. I take them in a buffer and do all kinds of set operations(intersection etc) from inputs in other buffers(Elisp code for that too). Then take them and have Elisp generate a email message for me(Again Elisp code to do this). I just copy paste and send it to respective stake holders.
And I'm a novice who barely started with Emacs. I only imagine what I can do when I get fully proficient with it. It's like automating yourself.
I guess we are only lucky our work happens to be mostly in text and we get to use emacs and vim(vim macros are just insane), just like accountants can put spreadsheets to crazy use as their work happens to deal with tables.
For instance, for my freelancing I track both tasks and time spent in Org Mode. I wrote myself a little bit of Elisp that, when invoked with the name of a customer, turns my Org Mode agenda into a table with line items for an invoice. I've been copying that into my invoice LaTeX template for a while, but recently I've been working on finishing the Elisp code: the end goal is to have a three-step process:
1) Press a key to generate a table with invoice line items and another with all other data that goes into the invoice.
2) Review the table, adjusting as necessary (e.g. rounding off stray minutes).
3) Press a key for Emacs to take these tables, fill a LaTeX template according to their contents, generate an invoice and file it in appropriate location.
At this point I have 1) and 2) fully working, and 3) missing only the "fill template" and "refile result" steps, which are rather trivial to add.
I'll release this publicly when I'm done. The current solution is somewhat specific to invoicing for services according to my country's regulations, but it shouldn't be too hard to make it universal (I'd love some help here, especially in form of examples of invoices for other countries).
Did I spend more time on it that I would if I used a web tool for invoices? Yes. Do I expect to ultimately get ahead on this solution? Maybe. Is it worth it? The interface (read: an org-mode document invoking some elisp) is already more fluid than any web tool I've ever seen, and I don't need to be on-line - so a huge YES!
As a non-Emacs user I do something similar with a bit of Bash scripting. It doesn't go as far as generating a ready to send invoice, but it will sum up the hours worked and provide a $ amount as output so I know how much to invoice someone.
It parses a log.md file I keep for each client.
The file looks like this, and the first number after the # is the hours worked.
# 4 2019/01/28
- Made something cool
- Helped XYZ do ABC
# 1 2019/02/11
- Yada yada yada
# 8.5 2019/02/12
- Lots of good stuff!
From here it's just a couple of piped Unix commands to generate the output I'm interested in.
You got me to thinking though. I wonder if I can generate a 100% ready to go PDF invoice. That would save a lot of tedious and error prone steps where I manually create each invoice based off a template in Google docs.
> I wonder if I can generate a 100% ready to go PDF invoice. That would save a lot of tedious and error prone steps where I manually create each invoice based off a template in Google docs.
This is my goal too. In parallel comment, I pasted an example table with line items. I wrote the code making that table some 9 months ago, and I've been retyping values into a LaTeX invoice ever since. I finally decided this is too annoying and error-prone to continue, and for the past couple weeks I've been slowly building up an end-to-end system, but with an explicit review step (I don't trust my own code that much).
As for time tracking format, the standard org-mode clocking feature appends a block under your TODO tasks that looks like this:
CLOCK: [2019-02-07 Thu 10:44]--[2019-02-07 Thu 13:37] => 2:53
CLOCK: [2019-02-06 Wed 14:27]--[2019-02-06 Wed 15:00] => 0:33
| Tag | Invoice line name | Hours | Rate | Net | VAT % | VAT amount | Total |
| meeting | Meetings | 10 | 12.00 | 120.00 | NP | 0.00 | 120.00 |
| procrastinating | Important tasks | 20 | 13.00 | 260.00 | NP | 0.00 | 260.00 |
| hn | Other important tasks | 40 | 14.00 | 560.00 | NP | 0.00 | 560.00 |
| coding | Occasional code | 3 | 15.00 | 45.00 | NP | 0.00 | 45.00 |
| Totals | - | 73 | - | 985.00 | - | 0.00 | 985.00 |
#+TBLFM: @>$3=vsum(@2..@-1)::@>$5=vsum(@2..@-1);%.2f::@>$7=vsum(@2..@-1);%.2f::@>$8=vsum(@2..@-1);%.2f::$5=$3*$4;%.2f::$7=if(typeof($6) < 10, $5*$6, 0);%.2f::$8=$7+$5;%.2f
The code for generating above table is hand-crafted. While org-mode provides you a generator for agenda tables based on TODO item name - see , I had to write similar feature that aggregated time by org-mode tags. I used  as a reference, but essentially wrote my own implementation. Surprisingly, it turned out to be almost trivial.
Then, it's simply a matter of turning those two org-mode tables into an elisp list of keys and values. This I accomplish using a simple elisp that uses built-in Emacs calls:
(defun trc-invoicing--named-table-to-lisp (name)
"Convert a named org mode table in the current buffer into a list.
The function finds a table named `NAME', passes it through `ORG-TABLE-TO-LISP',
and return the result. Refer to the documentation of `ORG-TABLE-TO-LISP'
for info about result's shape."
(search-forward (format "#+NAME: %s" name))
It's the biggest piece of elisp I wrote since Nyan Mode, but all in all, I find it surprisingly easy to code for Emacs. Availability of source code, extensive in-editor documentation and built-in source-level debugger make this process pretty pleasant.
 - Org Mode has a concept of "dynamic blocks". You type in #+BEGIN: blockname some params, and then using C-c C-c on it causes Org Mode to invoke an elisp function named org-dblock-write:blockname. The called function is then responsible for outputting contents of the dynamic block.
 - http://orgmode.org/manual/The-clock-table.html
 - https://gist.github.com/tsu-nera/d9ffa6a51a6e7bdb957b
To be clear, the TBLFM there has a separate purpose. My implementation of  generates a table with appropriate shape and data items; TBLFM computes sums and products. This allows for manually modifying the table (e.g. adding a line item, rounding off hours, changing them to include tine you don't track in org mode) and having the sums and products recalculated.
(Also, for anyone scared by that TBLFM line noise, Emacs has a way to edit it in more readable form.)
Secondly the argument that lisp is better for text processing is not even relevant. You can install lisp compiler and use it with most editor if we are just passing the input into it.
Exactly. The difference between Emacs and Vim cultures is, in vim you use shell and programs(like sed, awk, perl etc) as a kind of assorted set of tools to build what you want. Emacs gives you all that in one nice integrated package. If I'm not wrong this was also originally a difference between Unix and Lisp cultures. In Lisp you had the operating system boot to a Lisp REPL. In unix you have it boot to a shell. Then one good thing about lisp is the list syntax helps you exchange code and data in a proper structure. Whereas in shell you have to understand the structure of what you are passing around(Text). Which is why after a while you just have to write a Perl script to get things done.
Error analysis is just one thing. Once you start building your utils, in Elisp, you just continue to use them together as a part of a larger workflow. In Unix you can do the same, but it will take you a lot of Perl and shell scripts.
>>I have 10s of keyboard shortcut in vim, but all of the steps are just combination of keys or passing selection to unix command.
Same in Emacs. When using vim you still have to commit a few things to Muscle memory, you have to learn movements, you have to learn modes. And then learn to use them with registers and macros. You do the same in Emacs.
>>I can do all of the things in most programmable editor.
Vim is a very nice editor. And I still use it a lot. But Emacs is a editor and beyond. I like to describe Emacs as an Editor and a very good programming system, which offers you way to program anything that comes in the domain of programmatically controlling a text buffer.
>>I know how extensible emacs is, but there are very very few examples that requires this.
I though the same way, but the use cases keep increasing once you start using it. It's really like saying spreadsheets are useless because you can iterate lists over a for loop and do what you like. Its only when you start using features like Pivot table, What-if, Vtables etc do you begin to see how powerful it can get. Some times it also requires changing the way you think about a tool to get it right. Once you start using it you begin to see all kinds of curious cases where it can be put to use.
I've even seen(in YouTube) cool uses of Elisp Macros and Clojure macros stitched together to make Emacs generate Clojure code. Then plugins like aggressive-indent-mode and paredit just make writing code a bit like uttering your thought at the speed it occurs. You can also use Elisp to make debugging easy, or generate templates of code or do various other things. These are just very basic things, the possibilities are endless.
>>Secondly the argument that lisp is better for text processing is not even relevant. You can install lisp compiler and use it with most editor if we are just passing the input into it.
So basically you are suggesting I re-invent emacs itself? Because that's what installing a Lisp compiler and building text manipulation APIs means. Why should I do it, when the community has spend more than 5 decades doing it for me.
Try the reverse sometimes :). I recently needed to view some data our product generates while working over an SSH connection, so I hacked together a bit of Elisp and Common Lisp code, so that I can invoke a function in Common Lisp REPL that renders its input as an ASCII histogram in a new Emacs buffer, perfect for working in terminal mode :).
You could do all of that with Python and any programming editor.
Most editors, even most of those with a programmable bent are not very malleable. I looked into improving indentation support for common lisp in other editors, and for editors not named "vim" or "emacs" the support was incredibly poor.
For most, indentation was 100% builtin, so the only way to change the indentation was to either modify the editor itself (i.e. not a plugin), or install a plugin that hooked into the return key. Usually this was only doable from C.
In addition, most of the elisp standard library is specifically for manipulating buffers of text; perl is the only language I've used that's could be argued to be better.
>>You could do all of that with Python and any programming editor.
Perl is better at these text manipulation things than Python.
Lisp will be around for a lot of time than these languages. Though I expect Perl to be around too. But then vim is literally a kind of VisualPerl. Emacs feels like VisualLisp.
Before learing Elisp I was writing tons of Perl scripts to tasks like these. Perl is just insanely good at all things text. But Perl doesn't have Lisp like Macros. And eventually you realize you can weaponize Macros to all kinds of things you can't do in Perl. In short Elisp is better at a few things than Perl.
Are you sure about that? Lisp is old, and it has survived many old languages. But many of those were from the Computer Science/IT early teens age... Now CS/IT is quite mature.
Mainstream languages, especially Open Source ones, will probably outlive us both.
Even Perl ^.^
Nah, that's when the maturing process happened; what we have today is mostly middle-age crisis, running in circles with occasional small step forward.
Lisp will survive because it's essentially the fundamental core of programming. When you're writing Lisp, you're essentially writing an AST. The elegance, flexibility and powerfulness of this is exactly why every new runtime that shows up gets a Lisp made for it.
This approach allows you to easily insert/remove/rearrange sections and doesn't require having a giant file open in your editor. It also makes viewing the compiled version easier, as you don't have to compile the entire document to see what the part you're working on looks like.
I need to be able to identify that lesson 'xyz' is lesson 50 so I can say to check out the code in folder 50 inside of a git repo.
This also makes it easier to do things like print out individual lessons if you need a hard copy but don't want the entire document.
Markdown + VSCode (for editing)
Pandoc to generate DOCX from Markdown
Calibre CLI to generate MOBI from DOCX (and to fill in the e-book metadata)
This seems to be the cleanest way I've discovered for generating nice Kindle books that have full table of contents, etc.
Formatting and theming is a bit of a pain, but I think with just a little more work, it'd be easy to recommend this path for anyone making technical books, courses, etc. Lightweight markup languages and vim feel like steampunk at first, but they're actually more productive than mainstream modern tools.
RST seems pretty interesting and versatile as well.
Also, table support and LaTeX commands bring far more functionality than all of Markdown in the first place, I wouldn't call that marginal.
Still, it's great to know org as a format fills your needs outside Emacs. Maybe I'm being too pessimistic about it's adoption potential.
(I may have forgotten to set the Title on that e-mail, sorry about that.)
I'm looking for alternate ways than just github-style-markdown+pandoc for creating ebooks for more features and polished look
I'm also looking into alternates like https://github.com/rstudio/bookdown, https://github.com/hplgit/doconce and https://www.methods.co.nz/asciidoc/index.html
I started with older links like this: https://pedrokroger.net/using-sphinx-write-technical-books/
This is inspiring but less useful: https://www.tompurl.com/2012-11-22-writing-a-book-with-vim.h...
This was useful for theming: https://github.com/FriendsOfEpub/eBookTricks
yeah, I'd like to know if your article is done - a reply to this comment would do, thanks again
some suggestions if I may:
* could you add your website to your HN profile? https://news.ycombinator.com/user?id=acidburnNSA - makes it easier to know about it, that was where I looked up first before commenting in this thread
* just saw about your book on the website... for the regex video showcase, I see that you are using double quotes - I'd suggest to always use single quotes unless you need double quotes (see https://mywiki.wooledge.org/Quotes and https://stackoverflow.com/questions/7680504/sed-substitution...) as double quotes are interpreted by the shell before it is passed to the command
the topics covered in your book are super interesting and make for a nice workshop, will check it out :)
Hey, maybe I should try to put on a little workshop as a book promotion. Thanks again.
"Which side of this does the underscore go on!?"
The author's solution (one big file created with Vim) is reasonable and seems to work well for him. However, it seems to trade modularity/reusability. I'd be interested to hear about a microcontent solution (and the attendant tooling) that doesn't make this tradeoff. Or if I'm wrong about the tradeoff, I'd like to hear why.
When it comes to creating a course, there really is no way to reuse those files in a way that makes sense. A course on Docker and Flask have nothing in common for example.
Also, a course's writing isn't the only aspect. There's video too. Each video is its own individual unit of output.
Once a course is delivered on video, you really can't go back and start adding in new lessons to the middle because your previously recorded videos depend on things being in the old order. When you record lesson 103 and it expects code to exist in folder 103/ in a git repo, you can't just add a new lesson after 57 because now 103 becomes 104 and it throws everything off.
So in my case, once I complete the course, its TOC is set in stone. Those numbers won't change, but I want the flexibility to change them as I actively make the course which is when they change a lot.
As far as I know the tech the OP uses is used almost nowhere where people work with large bodies of text, meaning the editing and typesetting industry.
I use Lyx for all my documentation or writing for which Markdown is insufficiently rich.
You literally drag and drop folders and chapters and sections, can view them as ordered or move around in cork board mode, etc.
That said, I used LaTeX for my PhD thesis.
I think the text editor is the most important tool of a developer and Vim outperforms any non-modal editor. My thoughts on Vim are summarized in this quote by Abraham Lincoln: "Give me six hours to chop down a tree and I will spend the first four sharpening the ax."
I can't have my course's lesson numbers be increments of 10. It's too confusing for end users, and they also can't be different than what I have on file because then it would be a nightmare to maintain (as the person who created the course).
Using gapped numbers is a great way to solve certain ordering problems though. That's a common thing to do with database position columns for ordered content.
I've stopped as soon as YouCompleteMe came into play. Instead of just git clone you have to do this and that just to have a damn autocomplete...
And after time wasted - vim segfaulted on me.
Sorry, but I really can't see how this can be better than, say, IDEA. Installed it once, git pushed my settings - and never had any problems with it.
Shortcuts are almost 100% universal these days.
>often packaged for distros...
I don't really care at this point. Vim is dead for me. And tbh most things that people describe here in the comments seem more like a form of autosuggestion. Losing context? What? All modern editors have command menu with everything you need. Fuzzy search, any command that the editor or and IDE can offer, including those provided by plugins installed. And you don't have to worry about pluging updates - it's automatic. All you have to do is to read a changelog if you are interested.
lang#go layer enabled - check.
I go to the first .go file I can remember of and... autocomplete works. But only for the packages provided by the go iteself. Not the 3rd party. Kind of... what the point really?
As a final word: I'm trully happy for people who have found their happiness in Vim. Nothing can be better that having a tool that satisfies your needs to the fullest. But I still can see it as a capable DE.
Navigation is great and I use it in Firefox everyday via Tridactyl.
All those hacky '3ytcvnsdg' whatever commands are super nice when you are working with some kind of csv dump of an oracle database via ssh (I had this moment!).
Editing some configs on my Raspbery Pi? Sure.
Writting books and such? Maybe, never had such experience.
But software development? Seems like a nightmare to me.
This is mainly because of 2 things:
1. 99% of the apps I develop are Dockerized and there's no editor that flawlessly handles that
2. I've tried PyCharm, RubyMine, etc. and the autocomplete never really saves me that much time. In my mind "pretty good autocomplete" is worse than no autocomplete. Pretty good autocomplete usually slows you down overall because it's good, but not good enough. I still always find myself referencing documentation which means autocomplete didn't really do anything except maybe save typing a few characters.
1. What's the problem with it being Dockerized? I have my current project Dockerized too. JI just have :volumes in my docker-compose for development. If source code access is what we are talkig about.
2. see the above
I don't type properly and I never rest my hands on the home row. My hands fly all over the place and I only use half the fingers on both hands. After 20 years of typing, that's what feels natural to me. It felt natural on day 1 and the same 20 years later. I can type at about 75 WPM using online tests with really high accuracy, so I haven't seen it as a real bottleneck.
Call me crazy but I think home row proper typing is the most non-ergonomic and painful layout possible. It's not natural at all to keep your hands completely stationary for hours and while making subtle finger movements. Even if I try that for 5 minutes straight I get all sorts of cramps and weird pains in areas of my hands and arms that I didn't even know existed.
Like, if I'm editing a block of text in a long paragraph that looks like a single line to vim, I don't have a mouse anymore, and up-down movements just leave the paragraph, so I usually find myself with awkward commands like `50w` to try and guess the number of words to move to the point where I'm trying to edit. Sadness.
Then again, this might just be because I don't have enough vim skillz yet. There's probably some command to make vim pretend a visual line is a real line...
- gj instead of j and gk instead of k to move up and down by visual line instead of line number.
- Just go where I want by using / and then typing the word I want to navigate to. No need to guess how many words in it is.
It's also worth learning the sentence and paragraph text objects (s and p).
Also you can research on soft and hard line breaks, so you can move easily within the paragraph VimPencil could help you with that.
IMO, this makes it a lot easier to work with. You always know where your line ends because it matches up with the break.
You can even configure Vim to input the breaks for you so you don't need to worry about micro-managing them as you reword and edit sentences.
Long live command line editors!
Why mess with filenames and sequence numbers, when any basic word processor handles this for you?
1. Version control
2. Simple text files that are easy to maintain and convert into different formats
There are other reasons I can think of but those are the biggest two. Personally, I hate using word processors and would love to never have to use one again. Their GUIs and learning this and that shortcut key (which usually don't transfer to other apps) used to be tolerable but I can't stand them now.
2. You have all kinds of open formats such as MS Word, RTF, OpenOffice, that can basically export to anything you want.
The only reason I do see is that you can use the tools that you already know, such as code version control and your code editor. But other than that, it seems strange to try to do this thing in plain text files. Because then you have all these problems that shouldn't be problems in the first place.
I work mostly with ASM, C, C#, and a bit of VB. Even with 3 separate folders open, intelligence running, a couple larger files (of order 100mb) open, ~20 tabs with source and CSV, and a few plugins to help readability, VSC is taking up "only" 700MB.
Not exactly sleek compared to old-school editors, but not quite as bloated as your example.
It's well worth noting that plugins like the C/C++ extension run separate instances for each relevant tab on every workspace. When you have many tabs and many plugins, it starts to eat up a significant amount of space.
I don't have a 500k word text file laying around, but I tried an 80k line SQL script. FWIW, it's 8.5mb and the Atom wordcount plugin claims it's about 1.5 million "words".
Atom opened this file in 3-4 seconds and memory usage only increased about 30mb.
Navigation grinds to a halt with the wordcount plugin enabled. Once I disable its "always on" feature (normally it doesn't pay attention to .sql), navigation and editing seem snappy.
Just a data point. VS Code should be able to get much better...
Also, notepad++ is all over the place.
Which editor would you consider that is better with large files? Not really interested in switching, but really curious.
I have a similar workflow as the author of this blog, often writing a book manuscript in markdown while working on code examples for the book that I am working on.
I'm not so sure nowadays. I had to work on big prose document in Libre Office. I hated every second of it. It might be because I used to modal editing. It felt like typing with one finger when you are used to touch typing...
I got question. It here anyone who learned Vim editing model and decided it's worse than „traditional” Cua, mouse oriented editors?
I can't remember seeing any blog posts like „I used Vim for X years but I switched to Cua editor”.
: well, I switched to Kakoune from Spacemacs but that's another modal editor (not Vi clone tho) so it doesn't count ;)
- select to given character
- select to begging/end of the line/whole line
- select sentence/paragraph/text with the same indentation
Beside this ctrl+f search is not as good as / in Vim. It has no regex support for example (you can open dialog that has option to enable regex but that's more than one shortcut away).
Actions in Cua editor cannot be composed and reused, that's also an issue for me.
I was editing a traditional document on a processor called Scrivener, and my worst fear is an errant change unknown to me after saving the file. Going strictly on something like vim might be too hardcore, but if I started out with something like Scrivener, then port to .txt and commit my edits, and bring it back out to Scrivener for compiling, it may make sense.
I haven't looked into too many of my options, but if anyone else doing a decent amount of writing can share their tips, please do!