nvim: add firenvim and set up socket
This commit is contained in:
parent
a7ed98d874
commit
f90442a3ef
48
.config/nvim/lua/my/net.lua
Normal file
48
.config/nvim/lua/my/net.lua
Normal file
|
@ -0,0 +1,48 @@
|
|||
if not vim.g.started_by_firenvim then
|
||||
-- create socket for local clients to connect to
|
||||
local sockdir = (vim.env['XDG_RUNTIME_DIR']
|
||||
or vim.env['XDG_STATE_HOME'] or vim.env['HOME'] .. '/.local/state')
|
||||
vim.fn.mkdir(sockdir, 'p')
|
||||
if vim.fn.filereadable(sockdir .. '/nvim.sock') == 0 then
|
||||
vim.fn.serverstart(sockdir .. '/nvim.sock');
|
||||
end
|
||||
else
|
||||
-- never take over text areas automatically
|
||||
vim.g.firenvim_config = {
|
||||
localSettings = {
|
||||
[".*"] = {
|
||||
priority = 0,
|
||||
takeover = 'never',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
vim.o.wrap = true
|
||||
vim.o.guifont = 'Source_Code_Pro:h10'
|
||||
vim.o.textwidth = 0
|
||||
|
||||
local fv_fileprefix = vim.env['XDG_RUNTIME_DIR'] .. '/firenvim/'
|
||||
vim.api.nvim_create_augroup('firenvim', { clear = true })
|
||||
vim.api.nvim_create_autocmd({ 'BufEnter' }, {
|
||||
group = 'firenvim',
|
||||
pattern = {
|
||||
fv_fileprefix .. 'schlomp.space_*',
|
||||
fv_fileprefix .. 'codeberg.org_*',
|
||||
fv_fileprefix .. 'gitlab.com_*',
|
||||
fv_fileprefix .. 'github.com_*',
|
||||
fv_fileprefix .. 'very.tastytea.de_*',
|
||||
fv_fileprefix .. 'bookwyrm.social_*',
|
||||
fv_fileprefix .. 'openlibrary.org_*',
|
||||
fv_fileprefix .. 'bugs.gentoo.org_*',
|
||||
},
|
||||
command = [[set filetype=markdown | set tw=0]]
|
||||
})
|
||||
vim.api.nvim_create_autocmd({ 'BufEnter' }, {
|
||||
group = 'firenvim',
|
||||
pattern = {
|
||||
fv_fileprefix .. 'wiki.gentoo.org_*',
|
||||
fv_fileprefix .. '*.wikipedia.org_*',
|
||||
},
|
||||
command = [[set filetype=mediawiki | set tw=0]]
|
||||
})
|
||||
end
|
7
.config/nvim/lua/my/plugins/net.lua
Normal file
7
.config/nvim/lua/my/plugins/net.lua
Normal file
|
@ -0,0 +1,7 @@
|
|||
return {
|
||||
-- embed nvim in browsers
|
||||
{ 'https://github.com/glacambre/firenvim',
|
||||
version = '*',
|
||||
build = [[:call firenvim#install(0)]]
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user