Skip to content

Instantly share code, notes, and snippets.

View delphinus's full-sized avatar

JINNOUCHI Yasushi delphinus

View GitHub Profile
@delphinus
delphinus / config.fish
Last active February 17, 2025 13:01
Notify when slow commands finished in background (v2)
set -gx NOTIFY_ON_COMMAND_DURATION 5000
function fish_right_prompt
set -f check_neovim
if test -n "$CMD_DURATION"; and test $CMD_DURATION -gt $NOTIFY_ON_COMMAND_DURATION
if type -q wezterm; and test -n "$WEZTERM_PANE"
set -l active_pid (osascript -e 'tell application "System Events" to get the unix id of first process whose frontmost is true')
set -l active_pane (wezterm cli list-clients | perl -anle 'print $F[$#F] if $F[2] == '$active_pid)
if test -n "$active_pane"; and test $WEZTERM_PANE -eq $active_pane
set -f check_neovim 1
end
@delphinus
delphinus / bench-nvim.pl
Last active December 18, 2024 04:17
Alternative vim-startuptime
#!/usr/bin/env perl
=head1 DESCRIPTION
Alternative vim-startuptime
=head1 SYNOPSIS
bench-nvim
# Run nvim 10 times after 1 warmup
@delphinus
delphinus / lazy_semver.lua
Created December 10, 2024 08:33
Check semver in lazy.nvim
vim.api.nvim_create_user_command("LazySemver", function(opts)
if #opts.fargs ~= 2 then
vim.notify("needs 2 args: spec and version", vim.log.levels.ERROR)
return
end
local sv = require("lazy.manage.semver")
local matched = sv.range(opts.fargs[1]):matches(opts.fargs[2])
vim.notify(matched and "OK" or "NG", vim.log.levels[matched and "info" or "WARN"])
end, { nargs = "*" })
@delphinus
delphinus / config.fish
Last active January 26, 2025 13:50
Notify when slow commands finished in background
set -gx NOTIFY_ON_COMMAND_DURATION 5000
function fish_right_prompt
if test -n "$CMD_DURATION"; and test $CMD_DURATION -gt $NOTIFY_ON_COMMAND_DURATION
if type -q wezterm; and test -n "$WEZTERM_PANE"
set -l active_pid (osascript -e 'tell application "System Events" to get the unix id of first process whose frontmost is true')
set -l active_pane (wezterm cli list-clients | perl -anle 'print $F[$#F] if $F[2] == '$active_pid)
if test -n "$active_pane"; and test $WEZTERM_PANE -eq $active_pane
return
end
end
@delphinus
delphinus / telescope-kensaku.lua
Created April 27, 2024 04:03
ローマ字で :Telescope live_grep する
require("telescope.builtin").live_grep {
---@param prompt string
---@return { prompt?: string, updated_finder?: TelescopeFinder }
on_input_filter_cb = function(prompt)
return {
prompt = vim.fn["kensaku#query"](prompt, {
rxop = vim.g["kensaku#rxop#javascript"],
}),
}
end,
@delphinus
delphinus / lua-ls-lint.sh
Last active July 28, 2023 09:22
Dump diagnostics from lua-language-server with errorformat
#!/bin/bash
DIR=${1:-lua}
TMP=$(mktemp -d)
lua-language-server --check "$DIR" --configpath "$PWD/.luarc.json" --logpath "$TMP"
RESULT="$TMP/check.json"
if [[ -r $RESULT ]]; then
jq --arg pwd "$PWD" -r '
to_entries[] |
(.key | gsub("^file://\($pwd)/"; "")) as $filename |
.value[] |
# syntax = docker/dockerfile:1.3-labs
FROM ubuntu:latest
RUN yes | unminimize
RUN apt-get update && apt-get install -y tzdata
# https://sleepless-se.net/2018/07/31/docker-build-tzdata-ubuntu/
ENV TZ=Asia/Tokyo
RUN apt-get install -y ninja-build gettext libtool libtool-bin autoconf automake cmake g++ \
pkg-config unzip git man-db libsqlite3-dev \
@delphinus
delphinus / ititaro.lua
Created August 23, 2022 03:27
hydra.nvim で一太郎する
vim.keymap.set("n", "<Esc>", function()
local Hydra = require "hydra"
local hint = [[
_A_• 入力 _T_•ファイル _P_•印刷 _F_•書式 _D_•削除 _B_•消去
_M_• 移動 _C_•コピ- _L_•クリップ _Y_•ペ-スト _X_•枠 _W_•画面
_K_• 罫線 _E_•飾り _N_•サイズ _R_•フォント _S_•検索 _J_•ジャンプ
_U_• 特殊 _V_•ツ-ル _Z_•マクロ _H_•補助 _O_•オプション _Q_•終了
]]
Hydra {
@delphinus
delphinus / Dockerfile
Created December 29, 2021 02:34
skkeleton testing
# syntax = docker/dockerfile:1.3-labs
FROM ubuntu:22.04
RUN yes | unminimize
RUN apt-get update && apt-get install -y tzdata
# https://sleepless-se.net/2018/07/31/docker-build-tzdata-ubuntu/
ENV TZ=Asia/Tokyo
RUN apt-get install -y ninja-build gettext libtool libtool-bin autoconf automake cmake g++ \
pkg-config unzip git man-db libsqlite3-dev \
@delphinus
delphinus / Dockerfile
Last active October 19, 2021 05:39
ddc-nvim-lsp testing
# syntax = docker/dockerfile:1.3-labs
FROM ubuntu:21.04
RUN yes | unminimize
RUN apt-get update && apt-get install -y tzdata
# https://sleepless-se.net/2018/07/31/docker-build-tzdata-ubuntu/
ENV TZ=Asia/Tokyo
RUN apt-get install -y ninja-build gettext libtool libtool-bin autoconf automake cmake g++ \
pkg-config unzip git man-db libsqlite3-dev \