r/vim • u/GinormousBaguette • 14h ago
Tips and Tricks Are we slowly forgetting that you can just "speak" vi?
You don't need much more than the core grammar. You know how :source file executes Ex commands linewise from the file? Well, :source! file executes commands as if you were typing them and ends each line with a CR for you.
Opening vim to your favorite layout is just a matter of writing down the keystrokes you keep typing each time:
:e ~/.vimrc<CR><C-w>v:e ~/.tmux.conf
:term top<CR>ggVGy:ene<CR>:r!date<CR>p
<C-w>s<C-w>Hi"hello world"<Esc>
and `source!` it from somewhere. If you want to save all the `Shift+.,` typing, `<C-v><C-w>` would directly insert \^W`) in the buffer and keep it looking exactly like what you would.
Vi is a language. Even better, vi is a homoiconic language in that the code that is executed is identical to the representation of keys on your keyboard plus minimal syntax for control-characters.
You do not need to learn lisp to feel the power of '(insert-new-line) when you are a single o away from executing OR representing your intention to open a new line for insertion.
To grok further, hunt down the legendary StackOverflow answer and meditate for a little longer than usual.