Alright guys, back to another feature that vim has to offer!
Recently, I’ve been using :vert term <command>
for some short commands to run instead of using :sh
command and found that they have a mapping known as tnoremap
which basically stands for Terminal Normal Remap
.
I dived into the help for tnoremap
and found a much more awesome option vim had which was onoremap
!
It basically allows vimmers to define their own test objects, as an example:
instead of doing:
nnoremap ciq ci'
we can do:
onoremap iq i'
The onoremap
automatically makes it so that you can run diq
, ciq
, yiq
and so on! Super fluent way of having a shortcut for the quote/'
! It basically allows you to self-define your text objects which is kind of sweet!
In my .vimrc
right now, I have:
onoremap iq i'
onoremap iQ i"
onoremap aq a'
onoremap aQ a"
onoremap , t,
This brings a whole lot of new functionalities that I never knew before this! so, d,
gives the command of dt,
or y,
gives yt,
It is a little bit useful but overall the quote onoremap
is the best use I have of it so far!
Try it out and let me know your onoremaps
!