config/nvim/init/pluginConfig: improve firenvim reaction

This commit is contained in:
xeruf 2022-01-17 20:53:52 +01:00
parent 4bc606de0a
commit 1fb47e4565
1 changed files with 53 additions and 47 deletions

View File

@ -23,55 +23,61 @@ xmap <silent> ib <Plug>CamelCaseMotion_ib
omap <silent> ie <Plug>CamelCaseMotion_ie omap <silent> ie <Plug>CamelCaseMotion_ie
xmap <silent> ie <Plug>CamelCaseMotion_ie xmap <silent> ie <Plug>CamelCaseMotion_ie
" firenvim " FIRENVIM {{{1
" textarea.inputbox is for phpBB
let g:firenvim_config = { let g:firenvim_config = {
\ 'globalSettings': { \ 'globalSettings': {
\ 'alt': 'all', \ 'alt': 'all',
\ }, \ },
\ 'localSettings': { \ 'localSettings': {
\ '.*': { \ '.*': {
\ 'cmdline': 'firenvim', \ 'cmdline': 'firenvim',
\ 'priority': 0, \ 'priority': 0,
\ 'selector': 'textarea:not([readonly]):not([class="handsontableInput"]):not([wrap="off"]):not([rows="1"]):not([title="Replace"]):not([title="Search"]):not([name="message"]), \ 'selector': 'textarea:not([readonly]):not([class="handsontableInput"]):not([wrap="off"]):not([rows="1"]):not([title="Replace"]):not([title="Search"]):not([name="message"]),
\ div[role="textbox"]:not([aria-label="Search"])', \ div[role="textbox"]:not([aria-label="Search"])',
\ 'takeover': 'always', \ 'takeover': 'always',
\ }, \ },
\ '.*mail\.protonmail\.com.*': { 'priority': 9, 'takeover': 'empty', }, \ '.*com.*': {
\ '.*church\.tools.*': { 'priority': 9, 'takeover': 'empty', }, \ 'priority': 1,
\ '.*element\.io.*': { 'priority': 9, 'takeover': 'empty', }, \ 'selector': 'textarea.inputbox',
\ '.*openstreetmap\.org.*': { 'priority': 9, 'takeover': 'once', }, \ 'takeover': 'once',
\ '.*openstreetmap\.de.*': { 'priority': 9, 'takeover': 'once', }, \ },
\ '.*github\.com.*': { 'priority': 9, 'takeover': 'once', }, \ '.*church\.tools.*': { 'priority': 9, 'takeover': 'empty', },
\ \ '.*element\.io.*': { 'priority': 9, 'takeover': 'empty', },
\ '.*discord\.com.*': { 'priority': 9, 'takeover': 'never', }, \ '.*openstreetmap\.org.*': { 'priority': 9, 'takeover': 'once', },
\ '.*twitter\.com.*': { 'priority': 9, 'takeover': 'never', }, \ '.*openstreetmap\.de.*': { 'priority': 9, 'takeover': 'once', },
\ '.*wiki.*\.org.*': { 'priority': 9, 'takeover': 'never', }, \ '.*github\.com.*': { 'priority': 9, 'takeover': 'once', },
\ \
\ '.*calendar\.google\.com.*': { 'priority': 9, 'takeover': 'empty', }, \ '.*discord\.com.*': { 'priority': 9, 'takeover': 'never', },
\ '.*docs\.google\.com.*': { 'priority': 9, 'takeover': 'never', }, \ '.*twitter\.com.*': { 'priority': 9, 'takeover': 'never', },
\ '.*contacts\.google\.com.*': { 'priority': 9, 'takeover': 'never', }, \ '.*wiki.*\.org.*': { 'priority': 9, 'takeover': 'never', },
\ '.*notion\.so.*': { 'priority': 9, 'takeover': 'never', }, \
\ '.*cloud\.atomtoast\.xyz.*': { 'priority': 9, 'takeover': 'never', }, \ '.*calendar\.google\.com.*': { 'priority': 9, 'takeover': 'empty', },
\ 'https://bigbluebutton.*': { 'priority': 9, 'takeover': 'never', }, \ '.*docs\.google\.com.*': { 'priority': 9, 'takeover': 'never', },
\ 'https://dhall-lang.org.*': { 'priority': 9, 'takeover': 'never', }, \ '.*contacts\.google\.com.*': { 'priority': 9, 'takeover': 'never', },
\ 'https://aur.archlinux.org/account.*': { 'priority': 9, 'takeover': 'never', }, \ '.*notion\.so.*': { 'priority': 9, 'takeover': 'never', },
\ \ '.*cloud\.atomtoast\.xyz.*': { 'priority': 9, 'takeover': 'never', },
\ '.*stackexchange\.com.*': { 'priority': 9, 'takeover': 'never', }, \ 'https://bigbluebutton.*': { 'priority': 9, 'takeover': 'never', },
\ '.*stackoverflow\.com.*': { 'priority': 9, 'takeover': 'never', }, \ 'https://dhall-lang.org.*': { 'priority': 9, 'takeover': 'never', },
\ '.*com/questions/[0-9]+/.*': { 'priority': 9, 'takeover': 'never', }, \ 'https://aur.archlinux.org/account.*': { 'priority': 9, 'takeover': 'never', },
\ '.*com/posts/[0-9]+/.*': { 'priority': 9, 'takeover': 'never', }, \
\ } \ '.*stackexchange\.com.*': { 'priority': 9, 'takeover': 'never', },
\ '.*stackoverflow\.com.*': { 'priority': 9, 'takeover': 'never', },
\ '.*com/questions/[0-9]+/.*': { 'priority': 9, 'takeover': 'never', },
\ '.*com/posts/[0-9]+/.*': { 'priority': 9, 'takeover': 'never', },
\ }
\ } \ }
if exists('g:started_by_firenvim') if exists('g:started_by_firenvim')
nnoremap <Esc><Esc> :call firenvim#focus_page()<CR> nnoremap <Esc><Esc> :call firenvim#focus_page()<CR>
autocmd FocusLost,InsertLeave,BufLeave * ++nested call WriteSilent() autocmd FocusLost,InsertLeave,BufLeave * ++nested call WriteSilent()
function WriteSilent() function WriteSilent()
let was_enabled=b:strip_whitespace_on_save let was_enabled=b:strip_whitespace_on_save
DisableStripWhitespaceOnSave DisableStripWhitespaceOnSave
write write
if was_enabled if was_enabled
EnableStripWhitespaceOnSave EnableStripWhitespaceOnSave
endif endif
endfunction endfunction
endif endif