Firenvim configuration

This commit is contained in:
Curt Spark 2024-11-29 10:44:20 +00:00
parent 16c2210de4
commit e501f89822
2 changed files with 60 additions and 2 deletions

View File

@ -110,6 +110,64 @@ vim.api.nvim_create_autocmd({ 'TermRequest' }, {
end
})
-- Firenvim Configuration
vim.g.firenvim_config = {
globalSettings = { alt = "all" },
localSettings = {
[".*"] = {
cmdline = "firenvim",
content = "text",
priority = 0,
selector = "textarea",
takeover = "always"
}
}
}
vim.api.nvim_create_autocmd({'BufEnter'}, {
pattern = "github.com_*.txt",
command = "set filetype=markdown"
})
-- Only settings that will be configured if started by firenvim
if vim.g.started_by_firenvim == true then
-- Press escape 2 times to leave editor
vim.keymap.set("n", "<Esc><Esc>", "<Cmd>call firenvim#focus_page()<CR>", {})
-- Press shift enter to save and attempt to submit form on page
local function saveAndEnter()
vim.fn['firenvim#eval_js']('setTimeout (function() { document.activeElement.closest("form").submit(); }, 100)', 'MyFunction')
--vim.fn['firenvim#eval_js']('setTimeout (function() { const event = new KeyboardEvent("keydown", { key: "Enter", code: "Enter", which: 13, keyCode: 13,}); document.activeElement.dispatchEvent(event); }, 100)', 'MyFunction')
vim.cmd("wq")
end
vim.keymap.set("n", "<S-Enter>", saveAndEnter, {})
vim.keymap.set("i", "<S-Enter>", saveAndEnter, {})
-- Automatically save changes back to textbox every 1 second on detected write
vim.api.nvim_create_autocmd({'TextChanged', 'TextChangedI'}, {
callback = function(e)
if vim.g.timer_started == true then
return
end
vim.g.timer_started = true
vim.fn.timer_start(1000, function()
vim.g.timer_started = false
vim.cmd('silent write')
end)
end
})
vim.api.nvim_create_autocmd({'VimEnter'}, {
pattern = "*",
command = "startinsert"
})
--vim.api.nvim_create_autocmd({'VimLeave'}, {
-- pattern = "*",
-- callback = function ()
-- vim.fn['firenvim#focus_page']()
-- end
--})
end
-- LSP Configuration
local lsp_zero = require('lsp-zero')
-- https://lsp-zero.netlify.app/v3.x/language-server-configuration.html#default-keybindings

View File

@ -9,10 +9,10 @@
"mini.statusline": { "branch": "main", "commit": "813854243156472c9d0bc9c64ea0af159b9b37ca" },
"nvim-cmp": { "branch": "main", "commit": "ed31156aa2cc14e3bc066c59357cc91536a2bc01" },
"nvim-dap": { "branch": "master", "commit": "3c00a6016892625b4477bd95be4d5d0cebc7d9c5" },
"nvim-lspconfig": { "branch": "master", "commit": "e8f9c46c99e1901167a92ab13e2357158e5aabdb" },
"nvim-lspconfig": { "branch": "master", "commit": "6a5ed22255bbe10104ff9b72c55ec2e233a8e571" },
"nvim-web-devicons": { "branch": "master", "commit": "edbe0a65cfacbbfff6a4a1e98ddd60c28c560509" },
"plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" },
"telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
"vim-jsdoc": { "branch": "master", "commit": "6e5bc2a1f98a69e4902081c9f5969b228a7a5fd6" },
"which-key.nvim": { "branch": "main", "commit": "b9684c6ec54d8a8452bdcf0d613c7ad0223fc3fe" }
"which-key.nvim": { "branch": "main", "commit": "9b365a6428a9633e3eeb34dbef1b791511c54f70" }
}