<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>emre şahin's digital garden 🍃 - lua</title>
    <link>https://emresahin.net/tags/lua/</link>
    <description>Posts in the lua tag</description>
    <language>en</language>
    <managingEditor>contact@emresahin.net (Emre Şahin)</managingEditor>
    <lastBuildDate>Tue, 15 Sep 2026 19:46:32 +0000</lastBuildDate>
    <atom:link href="https://emresahin.net/tags/lua/rss.xml" rel="self" type="application/rss+xml"/>
    <item>
      <title>bits 12</title>
      <published>2024-08-12T09:50:51+00:00</published>
      <updated>2024-08-12T09:50:51+00:00</updated>
      <author>Emre Şahin</author>
      <pubDate>Mon, 12 Aug 2024 09:50:51 +0000</pubDate>
      <link>https://emresahin.net/bits-12/</link>
      <guid isPermaLink="true">https://emresahin.net/bits-12/</guid>
      <description>I decided I needed a random colorscheme selector for those moments when you want to change things up but don’t want to make a specific choice. LazyVim already has &lt;leader&gt;uC for selecting a colorscheme, but it can be too mentally taxing as it requires you to manually select one. This script simpl...</description>
      <category>neovim</category>
      <category>productivity</category>
      <category>colorscheme</category>
      <category>random</category>
      <category>neovim</category>
      <category>lua</category>
      <category>vim</category>
      <content:encoded><![CDATA[<p>I decided I needed a random colorscheme selector for those moments when you want to change things up but don’t want to make a specific choice. LazyVim already has <code>&lt;leader&gt;uC</code> for selecting a colorscheme, but it can be too <em>mentally taxing</em> as it requires you to manually <em>select</em> one. This script simply switches to a random one.</p>
<p><code>RandomColorScheme</code> returns the name of a random colorscheme after searching through all available paths. <code>SetRandomColorScheme</code> sets the colorscheme to that choice. The keybinding is mapped to <code>&lt;leader&gt;uR</code>.</p>
<pre><code class="language-lua">function RandomColorScheme()
  local color_schemes = vim.fn.globpath(vim.o.rtp, "colors/*.vim", false, true)
  for i, fullpath in ipairs(color_schemes) do
    color_schemes[i] = fullpath:match(".*/(.*).vim$")
  end

  -- Generate a random index
  local index = math.random(#color_schemes)

  local random_color_scheme = color_schemes[index]

  vim.notify("Random Color Scheme: " .. random_color_scheme)
  -- Select a random color scheme
  return random_color_scheme
end

function SetRandomColorScheme()
  vim.cmd("colorscheme " .. RandomColorScheme())
end

vim.api.nvim_set_keymap("n", "&lt;leader&gt;uR", ":lua SetRandomColorScheme()&lt;CR&gt;", { noremap = true, silent = true })
</code></pre>]]></content:encoded>
    </item>
    <item>
      <title>bits 10</title>
      <published>2024-05-24T21:04:10+00:00</published>
      <updated>2024-05-24T21:04:10+00:00</updated>
      <author>Emre Şahin</author>
      <pubDate>Fri, 24 May 2024 21:04:10 +0000</pubDate>
      <link>https://emresahin.net/bits-10/</link>
      <guid isPermaLink="true">https://emresahin.net/bits-10/</guid>
      <description>I believe in the value of reducing friction when taking notes. Today, I added a function to my Neovim configuration to create a timestamped file and open it for editing. function CreateTimestampedFile() local zkdir = os.getenv("HOME") .. "/github.com/iesahin/garden/zk/" local timestamp = os.date(...</description>
      <category>tools</category>
      <category>productivity</category>
      <category>neovim</category>
      <category>lazyvim</category>
      <category>zettelkasten</category>
      <category>lua</category>
      <category>note-taking</category>
      <category>workflow</category>
      <content:encoded><![CDATA[<p>I believe in the value of reducing friction when taking notes. Today, I added a function to my Neovim configuration to create a timestamped file and open it for editing.</p>
<pre><code class="language-lua">function CreateTimestampedFile()
  local zkdir = os.getenv("HOME") .. "/github.com/iesahin/garden/zk/"
  local timestamp = os.date("%Y%m%d%H%M%S")
  local filename = zkdir .. "/" .. timestamp .. ".md"
  vim.cmd("edit " .. filename)
end

vim.api.nvim_set_keymap("n", "&lt;leader&gt;F", ":lua CreateTimestampedFile()&lt;CR&gt;", { noremap = true, silent = true })
</code></pre>
<p>Now, I can just hit <code>&lt;leader&gt;F</code> (which is <code>&lt;Space&gt;F</code> in my setup) and immediately start adding a note to my zettelkasten.</p>]]></content:encoded>
    </item>
    <item>
      <title>bits 7</title>
      <published>2024-05-23T16:33:49+00:00</published>
      <updated>2024-05-23T16:33:49+00:00</updated>
      <author>Emre Şahin</author>
      <pubDate>Thu, 23 May 2024 16:33:49 +0000</pubDate>
      <link>https://emresahin.net/bits-7/</link>
      <guid isPermaLink="true">https://emresahin.net/bits-7/</guid>
      <description>I noticed it’s not possible to unmap the F1 key in Neovim using vim.api.nvim_del_keymap if it’s not already registered. Instead, you can simply override it with something like: vim.keymap.set({ "n" }, "&lt;F1&gt;", ":Telescope buffers&lt;CR&gt;", { noremap = true, desc = "Find buffer" })</description>
      <category>bits</category>
      <category>neovim</category>
      <category>lua</category>
      <category>keymaps</category>
      <category>telescope</category>
      <category>config</category>
      <content:encoded><![CDATA[<p>I noticed it’s not possible to unmap the <code>F1</code> key in Neovim using
<code>vim.api.nvim_del_keymap</code> if it’s not already registered. Instead, you can
simply override it with something like:</p>
<pre><code class="language-lua">vim.keymap.set({ "n" }, "&lt;F1&gt;", ":Telescope buffers&lt;CR&gt;", { noremap = true, desc = "Find buffer" })
</code></pre>]]></content:encoded>
    </item>
    <item>
      <title>TIL 11: Unhide Markdown Code Block Types in LazyVim</title>
      <published>2024-02-26T10:22:29+00:00</published>
      <updated>2024-02-26T10:22:29+00:00</updated>
      <author>Emre Şahin</author>
      <pubDate>Mon, 26 Feb 2024 10:22:29 +0000</pubDate>
      <link>https://emresahin.net/til-11/</link>
      <guid isPermaLink="true">https://emresahin.net/til-11/</guid>
      <description>To unhide Markdown code block types in LazyVim, you can set the conceallevel to 0 . Add the following to your configuration: vim.opt.conceallevel = 0</description>
      <category>Software Development</category>
      <category>Vim</category>
      <category>LazyVim</category>
      <category>Markdown</category>
      <category>Lua</category>
      <category>Neovim</category>
      <content:encoded><![CDATA[<p>To unhide Markdown code block types in LazyVim, you can set the <code>conceallevel</code> to <code>0</code>.</p>
<p>Add the following to your configuration:</p>
<pre><code class="language-lua">vim.opt.conceallevel = 0
</code></pre>]]></content:encoded>
    </item>
  </channel>
</rss>
