miércoles, 6 de mayo de 2020

Recreational vimming


When I have to do some sort of development or file editing inside a container, I usually have vim there but not emacs. docker-tramp is very useful but sometimes I just want to edit there.
The .vimrc I have in my container has only one line (I can't function without it):
imap jk 
Let's say I'm editing a lua script. After I've saved and c-z and run the file several times, I realize what I want is to have is:
:nore ,rr :!lua %
Then I can test it much quicker. But I realize I'm always :w before,rr. Colon, up, and modify the line to:
:nore ,rr :w:!lua %
Accidentally I quit vim and realize I have to set that again, so I go to my vimrc and add this:
nore ,rr :w:!lua %
nore ,vimrc :e ~/.vimrc
nore ,so :source ~/.vimrc
With this I have a pretty nice way to iteratively finetune my config. After some lua editing, the only thing I need to do often (and not provided by the excellent vim default functionality) is to comment and uncomment code.
nore ,cc :s/^/--/
nore ,cu :s/^\( *\)--/\1/
This gives normal and visual comment/uncomment functionality, and enough interactivity to build your ad-hoc shortcuts as you go.
This is an example that just happened yesterday, and the nice thing is that it grows and flows from 0. I couldn't get to this amount of functionality from an emacs -Q in such a small time. It has such a different feeling to configuring emacs. It reminds me of my Perl days, it's fun and quick. And the language is very orthogonal, with very few abstractions. It's the APL of text editing.

This is my take on this reddit thread. 

No hay comentarios: