Little-known keys are 'g+' and 'g-'. They move you through vim's undo-tree forwards or backwards. With them you can move quite smoothly through the undo-tree branches without plugins. ( 'U' and 'CTRL+R' move you in linear history like most editors do )
If you did not save the changes by writing to the file, you can just use `:earlier 1f` to go back to the state when it was written. To go to a specific changes first use `:undolist` command to see the list of changes and corresponding times and then use `:undo` with a count to jump to a change or g+ and g- normal mode command to travel through history or :earlier and :later commands with times or count.
you can also yank and paste from an earlier version of the document into the later version. Can come in handy, especially when writing prose. Does still work after you saved (:w) the file, but not after you closed it, though you might find the text in a swap file.
I feel so freaking enlightened by the ":norm" command on a few selected lines... What I would normally do is either write a macro to operate on each line, or do one edit and repeatedly press "j." to apply the same change to subsequent lines, but ":norm" is so elegant! Thanks
The Vim undo tree stores the full lines in question for every change, even if a change only removed one character. Literally bloat! Gone are the days when one could get by on 4kb of RAM and well written software.
g- and g+ are much simpler and easiear to use than `:earliear` and `:later`. When you undo (u) and can't find a missing branch with undo, don't you get very frustrated and say to yourself "where is that history, and why dosent undo track it?" The branch you can't find is there, and it is tracked, but `u` won't find it becasue `u` does not track undo / re-do branches. There are simple equivalent commands that do track all changes including your branches, u --> g - , also known as `:earliear` ctrl+r --> g+ , also known as `:later` If you can't find what you're looking for with u and ctrl+r go backwards and forwards again with g- and g+ and you will find it. 10g- will take you back 10 changes, including any branches, this is the same as `:earliear 10` 10g+ will take you forward 10 changes, including any branches, this is the same as `:later 10` g- and g+ is a much easiear notation than :earliear and :later and without the need of the `:` command line. Here is a very short tutorial that gives a very simple worked example demonstrating 'tracked branches', it explains all & takes only 5 mins vim.fandom.com/wiki/Using_undo_branches
This is really useful for programming. Lets say you don't need a set of functions anymore, so you delete them. Then later you realise that "oh, I actually needed that 1 complicated line from one of the functions" (this happens all the time), you ca just travel back in time to the start of the document, copy the line, then zip back again to where you were. No git checkout nonesense!
I have a friend who is Emacs Team while I'm Vim Team, so every so often we talk about features in or another editor comparing them, now I can use "time traveler card" haha, thanks His latest Emacs' feature that I envy is "region undo".
Similar to norm, I think you can ctrl+V to select the lines (cursor is highlighted only at the first character), and press I, then type stuff normally in insert mode, and when you exit and move the cursor, all changes will be edited, like when using :norm.
Yep! But if you're in a fortunate situation when your line is in between something, say a curly braces, then using vi{ and then the norm is very helpful and time efficient :D But to each task their own
Can you travel to the future with Vim? From the present where the thesis is not yet written, to the future where the thesis is written. That'd be a neat feature. :D
Hey luke! Could you make a video on how LARBS works, its general structure and maybe even how to personalize it? I watched your "linux in the wild" talk and you mentioned that this is also something that LARBS encourages.
I see some academic references. Do you use any special note-taking methods like Zettelkasten? What is your academic workflow like for research and reading papers?
I can go into command mode and i can say "run the normie command" and what the normie command does is just re-runs a sequences of normie mode buttons... key presses for normal people who just want things to run.
Still hoping that I thus far only was too stupid to find the equivalent function in Emacs. Not gonna switch because of time travel but I gotta admit it's pretty damn cool.
hey, i just wanna thank you for the idea of remapping caps to escape it's a great idea it made my life much easier but when i use your script (remaps) it works for like 5 min then i no longer able to use caps as escape all the other stuff in the script work (mappin the menu button to right super ...) is there any workaround or solution ? btw i'm using arch
It's basically the same but newer and faster xd You dont need to relearn anything, unlike the transition of Vi to Vim, which did require getting used to some major changes :)
It was like any other day.. whispers: ...this june... ... but he did not know whispers: ... 2020 .... ...that this day, his life will change forever! V I M D I E S E L: Back to the future 5: The movie IN THEATERS * screen fades, silence * vim diesel: Who am I * dramatic music *
Right, this is weird. Windows pleb uses (imagine using two characters to code a newline lol) and old MacOSes used , but every unix-like system there is uses
It's Vim but better, lighter, faster, and somehow still gas more features. Use a search engine and look up the differences. But really, if you really ought to ask or if you're just learning... don't sweat that detail. Basically the same thing when it's down to it.