I am attempting to disable my touchpad whenever I enter “insert” mode. I believe this can be done with map and can be done by using a command like:
map i :silent !synclient TouchpadOff=1 <i> <CR>
map <ESC> :silent !synclient TouchpadOff=0 <ESC> <CR>
But this obviously doesn’t work because map is not going to recurse to a previous definition, rather it just ignores it. How would one go about doing this?
You can setup autocommands using the events fired when insert mode is entered or left:
There may be other events you want to act upon, as well you can get a list of the known events with
:help autocmd-events.