Skip to content

Instantly share code, notes, and snippets.

View weilbith's full-sized avatar
🏈

Thore Strassburg weilbith

🏈
  • Brainbot Technologies
  • Berlin
View GitHub Profile
@weilbith
weilbith / autoload_utils_location.vim
Last active July 26, 2019 22:50
Vim - Dynamic Location Lists
" Cache a possibly filled location list for a hiding buffer.
" Check if there is a non-empty list for the current buffer.
" Stores the list to the cache and empty the original one.
" The location window will be closed.
"
" Arguments:
" buffer - buffer to create the cache for
"
function! utils#location#cache_location_list(buffer) abort
if get(g:, 'dynamic_location_list_disable', v:false) | return | endif
@weilbith
weilbith / autoload_utils_layout.vim
Last active March 12, 2019 13:48
Dark Powered Vim - Fix The Broken Window Layout (file names are using '_' to simulate a '/', leveraging Vim's autload functionalities)
" Standard shape values when fail to retrieve a global variable.
let s:standard_width = 30
let s:standard_height = 10
" List of all windows, which should have a fixed size and/or position.
let g:layout_fixed_windows = [
\ {
\ 'buffer_name': 'Scratch',
@weilbith
weilbith / python.snippets
Created March 22, 2019 23:11
Secure empty lines before and after completed snippets with UltiSnips
global !p
def on_jump(snippet, positions, function, arguments=None):
if not isinstance(positions, list):
positions = [positions]
for position in positions:
if position == "last":
position = len(snippet.tabstops) - 1
if position == snippet.tabstop:
@weilbith
weilbith / keymap.c
Created November 1, 2019 14:20
QMK firmware Mod-Tab simulation with Tab-Dance for One-Shot-Modifier feature
typedef enum {
SINGLE_TAP,
SINGLE_HOLD,
} td_state_t;
static td_state_t td_state;
int cur_dance (qk_tap_dance_state_t *state);
void gui_control_finished (qk_tap_dance_state_t * state, void *user_data);
void gui_control_reset (qk_tap_dance_state_t* state, void *user_data);
@weilbith
weilbith / tap_dance_simulations.c
Created December 20, 2019 14:25
QMK keyboard firmware - simulate MT with tap dance
#include QMK_KEYBOARD_H
#include "tap_dance_simulations.h"
typedef enum {
SINGLE_TAP,
SINGLE_HOLD,
MULTI_TAP,
// TODO: Think about tap-hold case
} td_state_t;
@weilbith
weilbith / tmux-preview-image.sh
Last active March 6, 2021 14:17
Show image from URL in TMux pane with Ueberzeugt
#!/bin/bash
image_url=$1
download_path=$(mktemp --suffix "tmux-preview-image")
max_width=$(tmux display -p '#{pane_width}')
max_height=$(tmux display -p '#{pane_height}')
curl --output $download_path --silent $image_url
source $(ueberzug library)