Open simonwjackson opened 5 years ago
This would be simple if we had FocusEnter / FocusLeave autocommands, so if anyone is interested in this I would suggest they attempted that first.
These autocommands would need to provide a way to tell the difference between an input field and a textarea/codemirror/contenteditable/ace element - firenvim used to take over these elements indiscriminately and it was slightly annoying. Input fields usually don't deserve to be edited in a real editor.
For those who stumble across this issue, I have found a solution that works well for my needs.
" Set terminal
set editorcmd kitty --class floatingAppFocus -- vim -c "set noshowmode | set noruler | set laststatus=0 | set noshowcmd | set cmdheight=1 | nnoremap <ESC><ESC> :q!<ENTER> | nnoremap <ENTER> :x<ENTER> | inoremap <ENTER> <ESC>:x!<ENTER>" %f
bind --mode=normal gi composite focusinput -l | editor
This gets rid of most of vim's HUD and, and allows for quick entry be remapping the <ENTER>
and <ESC>
keys to (accept or cancel)
This works well for single line inputs, but if you often use multi-line <textarea />
's you should probably remove the <Enter>
remappings (last two commands)
It would be nice to have the option to open vim automatically when the focus is placed on an text input field.