Skip to content

Instantly share code, notes, and snippets.

@craigmac
Created May 16, 2023 23:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save craigmac/81aa8f5c67f7ebf8995d497a8cc0a02f to your computer and use it in GitHub Desktop.
Save craigmac/81aa8f5c67f7ebf8995d497a8cc0a02f to your computer and use it in GitHub Desktop.
after/plugin/firenvim.lua
if not vim.g.started_by_firenvim == true then return end
vim.o.colorcolumn = '50,80,100'
vim.o.cursorline = true
vim.o.spell = true
vim.o.guifont = 'Iosevka Fixed:h24'
vim.o.laststatus = 1
vim.o.background = 'light'
vim.cmd.colorscheme('quiet')
vim.g.firenvim_config = {
localSettings = {
['.*'] = {
cmdline = 'neovim',
content = 'text',
priority = 0,
selector = "textarea:not([readonly]), div[role='textbox']",
takeover = 'once',
},
['https?://.*github.com.*$'] = {
content = 'markdown',
priority = 1,
takeover = 'once',
},
['https?://.*atlassian.*$'] = {
content = 'markdown',
priority = 1,
takeover = 'once',
},
}
}
-- throttle syncing with page to every 3 seconds
vim.api.nvim_create_autocmd({'TextChanged', 'TextChangedI'}, {
callback = function(_)
if vim.g.timer_started == true then
return
end
vim.g.timer_started = true
vim.fn.timer_start(3000, function()
vim.g.timer_started = false
vim.cmd[[silent! write]]
end)
end
})
-- TODO: toggle focus from page/editor in one
vim.keymap.set('n', '<Esc><Esc>', '<Cmd>call firenvim#focus_page()<CR>')
-- TODO: on certain sites where we know what 'submit' is mapped to like a s-cr by default have a mapping like this:
vim.keymap.set('i', '<S-CR>', '<Esc>:w<CR>:call firenvim#press_keys("<lt>CR>")<CR>ggdGa')
vim.o.guicursor = 'n-v-c-i-sm-i-ci-ve-r-cr-o:block'
vim.cmd.startinsert()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment