A small tool to view real-world ActivityPub objects as JSON! Enter a URL
or username from Mastodon or a similar service below, and we'll send a
request with
the right
Accept
header
to the server to view the underlying object.
{
"@context": [
"https://join-lemmy.org/context.json",
"https://www.w3.org/ns/activitystreams"
],
"type": "Page",
"id": "https://lemmy.pt/post/709125",
"attributedTo": "https://lemmy.pt/u/CjkOvPDwQW",
"to": [
"https://sopuli.xyz/c/neovim",
"https://www.w3.org/ns/activitystreams#Public"
],
"name": "Change makeprg only if makefile doesn't exist",
"cc": [],
"content": "<p>Hi everyone long time vim/neovim user, currently for my latex I have in\n<code>~/.config/nvim/after/ftplugin.lua</code> the following line:</p>\n<pre style=\"background-color:#ffffff;\">\n<span style=\"color:#323232;\">vim.opt_local.makeprg="pdflatex -output-format pdf -output-directory /tmp %"\n</span></pre>\n<p>I am now working in a latex project that has a makefile, is it possible to create something in the lines of:</p>\n<pre style=\"background-color:#ffffff;\">\n<span style=\"font-weight:bold;color:#a71d5d;\">if</span><span style=\"color:#323232;\"> ! makefile_exists </span><span style=\"font-weight:bold;color:#a71d5d;\">then\n</span><span style=\"color:#323232;\"> vim.opt_local.makeprg</span><span style=\"font-weight:bold;color:#a71d5d;\">=</span><span style=\"color:#183691;\">"pdflatex -output-format pdf -output-directory /tmp %"\n</span><span style=\"font-weight:bold;color:#a71d5d;\">end\n</span></pre>\n<p>Ended up with this and it seems to work fine:</p>\n<p><code>~/.config/nvim/after/ftplugin/tex.lua</code></p>\n<pre style=\"background-color:#ffffff;\">\n<span style=\"font-weight:bold;color:#a71d5d;\">local</span><span style=\"color:#323232;\"> makefile_exists </span><span style=\"font-weight:bold;color:#a71d5d;\">=</span><span style=\"color:#323232;\"> vim.fs.find(</span><span style=\"color:#183691;\">'makefile'</span><span style=\"color:#323232;\">, {\n</span><span style=\"color:#323232;\"> upward </span><span style=\"font-weight:bold;color:#a71d5d;\">= </span><span style=\"color:#0086b3;\">true</span><span style=\"color:#323232;\">,\n</span><span style=\"color:#323232;\"> stop </span><span style=\"font-weight:bold;color:#a71d5d;\">=</span><span style=\"color:#323232;\"> vim.uv.os_homedir(),\n</span><span style=\"color:#323232;\"> path </span><span style=\"font-weight:bold;color:#a71d5d;\">=</span><span style=\"color:#323232;\"> vim.fs.dirname(vim.api.nvim_buf_get_name(</span><span style=\"color:#0086b3;\">0</span><span style=\"color:#323232;\">)),\n</span><span style=\"color:#323232;\">})\n</span><span style=\"color:#323232;\">\n</span><span style=\"font-weight:bold;color:#a71d5d;\">if #</span><span style=\"color:#323232;\">makefile_exists </span><span style=\"font-weight:bold;color:#a71d5d;\">== </span><span style=\"color:#0086b3;\">0 </span><span style=\"font-weight:bold;color:#a71d5d;\">then\n</span><span style=\"color:#323232;\">\tvim.opt_local.makeprg </span><span style=\"font-weight:bold;color:#a71d5d;\">= </span><span style=\"color:#183691;\">"pdflatex -output-format pdf -output-directory /tmp %"\n</span><span style=\"font-weight:bold;color:#a71d5d;\">end\n</span></pre>\n",
"mediaType": "text/html",
"source": {
"content": "Hi everyone long time vim/neovim user, currently for my latex I have in \n`~/.config/nvim/after/ftplugin.lua` the following line:\n\n```\nvim.opt_local.makeprg=\"pdflatex -output-format pdf -output-directory /tmp %\"\n```\n\nI am now working in a latex project that has a makefile, is it possible to create something in the lines of:\n\n```lua\nif ! makefile_exists then\n vim.opt_local.makeprg=\"pdflatex -output-format pdf -output-directory /tmp %\"\nend\n```\n\n\nEnded up with this and it seems to work fine:\n\n`~/.config/nvim/after/ftplugin/tex.lua`\n\n```lua\nlocal makefile_exists = vim.fs.find('makefile', {\n upward = true,\n stop = vim.uv.os_homedir(),\n path = vim.fs.dirname(vim.api.nvim_buf_get_name(0)),\n})\n\nif #makefile_exists == 0 then\n\tvim.opt_local.makeprg = \"pdflatex -output-format pdf -output-directory /tmp %\"\nend\n```\n",
"mediaType": "text/markdown"
},
"attachment": [],
"sensitive": false,
"published": "2023-07-15T17:08:08.300792Z",
"updated": "2023-07-16T08:40:26.350230Z",
"audience": "https://sopuli.xyz/c/neovim",
"tag": [
{
"href": "https://lemmy.pt/post/709125",
"name": "#neovim",
"type": "Hashtag"
}
]
}