Tridactyl: Feature: Option to auto open external editor on input focus

Created on 26 Sep 2019  路  3Comments  路  Source: tridactyl/tridactyl

It would be nice to have the option to open vim automatically when the focus is placed on an text input field.

Most helpful comment

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)

All 3 comments

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)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Chouhartem picture Chouhartem  路  5Comments

smoothchrome picture smoothchrome  路  4Comments

bovine3dom picture bovine3dom  路  5Comments

AJCastroChandri picture AJCastroChandri  路  3Comments

GianniGi picture GianniGi  路  5Comments