Vim Intermediate Tutorial Videos
One Vim… Just One
See it straight from Vimeo at One Vim… Just One.
What we’ll cover
This one’s about running one GUI Vim session and commanding it from an external command shell using the command “gvim --remote-silent” from that external command shell.
Destruction is Good
See it straight from Vimeo at Destruction is Good.
What we’ll cover
In this video we’re going to look at an editing technique that involves getting to where you want to be by destroying contents, not by creating them. The idea here is that we want to “copy” a few lines from a file and “paste” them somewhere else so we can work with them. It turns out that doing such a thing is usually very annoying and not very productive, so instead of doing that we destroy the contents of the file that we don’t want and keep the rest.
- :help :vglobal shows us how to perform an operation on all lines that don’t match the given pattern. In this case we delete lines that don’t match what we’re looking for.
- :help :substitute shows us how to substitute one piece of text for another. In this case we’ve given it a range of ‘%’ that is synonymous with a range of “1,$” (:help :%).
- :help regexp is a reference to regular expressions. These are very complex things but considering that I used them, I figured I’d point you at them. If you aren’t familiar with regular expressions, stay tuned… we’ll be covering them eventually.
Using a Vim Macro to Edit Many Files
See it straight from Vimeo at Using a Vim Macro to Edit Many Files.
What we’ll cover
In this video we show how to use a cleverly crafted Vim macro to do a pretty cool edit to some C++ source code across a lot of different header files. The general trick is to avoid “position oriented” kind of things, such as “move down to the next line ‘cuz that’s where the function is” because in the next file, the function may be two lines down.
- :help q is how we record a macro. It’s used for both starting and stopping the recording.
- :help yank is somewhat synonymous with (crappy) Notepad’s
File->Copy“feature”. - :help % is the operator we use to move the cursor to the brace that is the partner of the one that the cursor is currently on.
- :help / is what let’s us search for things in a file.
- :help O opens a line above the cursor.
- :help p let’s us put (paste) the text that we previously yanked.
- :help :wnext is the command we use to both write the current file and move on to the next one in the :args list.
- :help @ lets us run the macro that we recorded.
Vim Macros and Global Commands (one)
See it straight from Vimeo at Vim Macros and Global Commands (one).
What we’ll cover
Here we edit a file using two different methods – a recorded macro and a global command.
Page 2 of 3 | Previous page | Next page