Skip to content

Instantly share code, notes, and snippets.

-- Automatically enter insert mode when entering a terminal buffer window
vim.api.nvim_create_autocmd({ "BufEnter", "WinEnter" }, {
pattern = "term://*",
callback = function()
vim.cmd("startinsert")
end,
desc = "Enter insert mode when entering terminal buffer window",
})
-- Set up terminal-specific keymaps for window navigation in terminal mode
-- Shared function to create GitHub gists
local function create_gist(opts, is_public)
local lines
local filetype = vim.bo.filetype
-- Check if command was called with a range (visual selection)
if opts.range > 0 then
-- Get visual selection
lines = vim.fn.getline(opts.line1, opts.line2)
else
-- Create a Neovim command to run the function
vim.api.nvim_create_user_command("RunBigQuery", function(opts)
run_bigquery(opts.args ~= "" and opts.args or nil)
end, { nargs = "?" })
-- Shared function to create GitHub gists
local function create_gist(opts, is_public)
local lines
local filetype = vim.bo.filetype
-- Check if command was called with a range (visual selection)
if opts.range > 0 then
-- Get visual selection
lines = vim.fn.getline(opts.line1, opts.line2)
else
@Velrok
Velrok / 1.lua
Created November 20, 2025 22:03
-- Shared function to create GitHub gists
local function create_gist(opts, is_public)
local lines
local filetype = vim.bo.filetype
-- Check if command was called with a range (visual selection)
if opts.range > 0 then
-- Get visual selection
lines = vim.fn.getline(opts.line1, opts.line2)
else
-- Written with Claude
-- dbt ref() jump to definition
local function extract_ref_model_name()
local line = vim.api.nvim_get_current_line()
local ref_pattern = "ref%(%s*['\"]([^'\"]+)['\"]%s*%)"
return line:match(ref_pattern)
end
local function find_model_files(model_name)

The scenario

At a certain point in time we want to lock a CMI period to a forecasted amount.

possible business outcomes:

  1. A lock already exists
  2. We lock in the same CMI
  3. We lock in a different CMI

Other issues are possible:

@Velrok
Velrok / app.rb
Created May 16, 2024 22:47
ruby in the browser
require "js"
# access to the html document, so we can add visual elements like buttons
document = JS.global[:document]
# jq is a library which provides easer to read function to add elements
jq = JS.global['$']
# write the initial html, we give every element an ID so we can address them later
jq.apply("#main").html(
<<HTML
@Velrok
Velrok / kitty.conf
Created August 30, 2023 10:40
symbol_map config for kitty terminal using Symbols Nerd Font Mon as fallback font for icons
# https://github.com/ryanoasis/nerd-fonts/wiki/Glyph-Sets-and-Code-Points
symbol_map U+E5FA-U+E62B Symbols Nerd Font Mono
# Devicons
symbol_map U+e700-U+e7c5 Symbols Nerd Font Mono
# Font Awesome
symbol_map U+f000-U+f2e0 Symbols Nerd Font Mono
# Font Awesome Extension
symbol_map U+e200-U+e2a9 Symbols Nerd Font Mono
# Material Design Icons
symbol_map U+f0001-U+f1af0 Symbols Nerd Font Mono
@Velrok
Velrok / tuis.md
Created July 25, 2022 08:20
presentation on text UIs

The power of command line tools

Topics

  1. modern fast replacements for established use cases
  2. new more powerful tools
  3. interactive command line tools aka text UI or TUI