0 Filetypes for websites & more
Sandro edited this page 2022-12-09 15:30:20 +01:00

Filetypes for websites

This is a list of buffer names for websites with a recommended filetype. Feel free to add new ones.

let l:bufname=expand('%:t')
if l:bufname =~? 'github.com'
    set ft=markdown
elseif l:bufname =~? 'cocalc.com' || l:bufname =~? 'kaggleusercontent.com'
    set ft=python
elseif l:bufname =~? 'localhost'
    " Jupyter notebooks don't have any more specific buffer information.
    " If you use some other locally hosted app you want editing function in, set it here.
    set ft=python
elseif l:bufname =~? 'reddit.com'
    set ft=markdown
elseif l:bufname =~? 'stackexchange.com' || l:bufname =~? 'stackoverflow.com'
    set ft=markdown
elseif l:bufname =~? 'slack.com' || l:bufname =~? 'gitter.com'
    set ft=markdown
endif

Other site specific settings

If you have other settings you think fit certain websites, feel free to suggest them here too.

let l:bufname=expand('%:t')
if l:bufname =~? 'github.com'
    colorscheme github
elseif l:bufname =~? 'riot.im'
    " for chat apps. Enter sends the message and deletes the buffer.
    " Shift enter is normal return. Insert mode by default.
    " Note that slack and gitter probably don't respond appropriately to press_keys. Workarounds might directly call javascript functions to send the messages.
    normal! i
    inoremap <CR> <Esc>:w<CR>:call firenvim#press_keys("<LT>CR>")<CR>ggdGa
    inoremap <s-CR> <CR>
endif