Skip to content

Instantly share code, notes, and snippets.

View windwp's full-sized avatar
💭
I may be slow to respond.

windwp

💭
I may be slow to respond.
View GitHub Profile
@numToStr
numToStr / au.lua
Last active August 20, 2023 05:15
Neovim autocmd in lua
--
-- Move this file to your neovim lua runtime path ie. ~/.config/nvim/lua/au.lua
--
local cmd = vim.api.nvim_command
local function autocmd(this, event, spec)
local is_table = type(spec) == 'table'
local pattern = is_table and spec[1] or '*'
local action = is_table and spec[2] or spec
if type(action) == 'function' then
@hrsh7th
hrsh7th / parallel.lua
Last active October 23, 2022 07:59
neovim lua parallel
-- You can also use require('mpack') for data serialization between server and client.
local uv = require "luv"
local SOCK = string.format("/tmp/server-%s.sock", os.clock())
uv.new_thread(function(sock)
local uv = require "luv"
local server = uv.new_pipe(false)
server:bind(sock)
@romainl
romainl / grep.md
Last active November 3, 2024 17:56
Instant grep + quickfix

FOREWORDS

I don't mean the snippet at the bottom of this gist to be a generic plug-n-play solution to your search needs. It is very likely to not work for you or even break things, and it certainly is not as extensively tested and genericised as your regular third-party plugin.

My goal, here and in most of my posts, is to show how Vim's features can be leveraged to build your own high-level, low-maintenance, workflows without systematically jumping on the plugins bandwagon or twisting Vim's arm.


Instant grep + quickfix

@ScottIsAFool
ScottIsAFool / Style.xaml
Created August 18, 2014 14:27
EmptyButtonStyle with Tilt
<Style x:Key="EmptyButtonStyle"
TargetType="ButtonBase">
<Setter Property="Background"
Value="Transparent" />
<Setter Property="Padding"
Value="0" />
<Setter Property="HorizontalContentAlignment"
Value="Stretch" />
<Setter Property="HorizontalAlignment"
Value="Stretch" />
@eerohele
eerohele / swaparrayelements.js
Last active November 2, 2021 16:01
Swap two array elements (JavaScript)
/**
* Swap the elements in an array at indexes x and y.
*
* @param (a) The array.
* @param (x) The index of the first element to swap.
* @param (y) The index of the second element to swap.
* @return {Array} The input array with the elements swapped.
*/
var swapArrayElements = function (a, x, y) {
if (a.length === 1) return a;