Skip to content

Instantly share code, notes, and snippets.

Avatar
🏄‍♂️
Surfing

Folke Lemaitre folke

🏄‍♂️
Surfing
View GitHub Profile
View starmatch.ts
// eslint-disable-next-line import/no-commonjs
var assert = require('assert');
function starRegex(pattern: string) {
return RegExp(
pattern
.split('.')
.map(x => {
if (x === '**') return '[a-zA-Z\\.]*';
if (x.includes('**'))
@folke
folke / apropos.fish
Created Oct 1, 2020
Using `apropos` on macos rebuilds the whatis database every time. Fish shell uses apropos for command completion.
View apropos.fish
# Fixes extremely slow apropos command on macos
# Using `apropos` on macos rebuilds the whatis database every time.
# Fish shell uses apropos for command completion.
# Simply add the file below to `~/.config/fish/conf.d` to fix the issue
set db ~/.whatis.db
function apropos_update
echo "Updating apropos / whatis database at $db"
man --path | tr ":" " " | xargs /usr/libexec/makewhatis -o $db
@folke
folke / lua-lsp.lua
Last active Oct 17, 2021
Correct sumneko lua lsp setup for init.lua and plugin development
View lua-lsp.lua
-- put this file somewhere in your nvim config, like: ~/.config/nvim/lua/config/lua-lsp.lua
-- usage: require'lspconfig'.sumneko_lua.setup(require("config.lua-lsp"))
local library = {}
local path = vim.split(package.path, ";")
-- this is the ONLY correct way to setup your path
table.insert(path, "lua/?.lua")
table.insert(path, "lua/?/init.lua")