Skip to content

Instantly share code, notes, and snippets.

View jeebak's full-sized avatar
🏠
Working from home

Jeebak Kim jeebak

🏠
Working from home
View GitHub Profile
@jeebak
jeebak / windows-bindings.lua
Last active December 28, 2017 20:09
Personalized keybindings for jasonrudolph/keyboard/hammerspoon WindowLayout Mode Raw
-- Personalized keybindings for jasonrudolph/keyboard/hammerspoon WindowLayout Mode
--
-- To customize the key bindings for WindowLayout Mode, create a copy of this
-- file, save it as `windows-bindings.lua`, and edit the table below to
-- configure your preferred shortcuts.
--------------------------------------------------------------------------------
-- Define WindowLayout Mode
--
-- In addition to the default keybindings:
@jeebak
jeebak / test-drive-vimacs
Last active September 5, 2019 06:37
Test Drive Vim / Emacs Distributions
#!/usr/bin/env bash
# -----------------------------------------------------------------------------
# This is a stoopid simple wrapper script to conveniently test drive different
# vim/emacs distributions w/out messing up your own vim/emacs environment.
# It accomplishes this by "installing" them in their own isolated "$HOME"
# environment (under their own "$HOME/.cache/test-drive-vimacs/$DISTRO"
# folder.) We save and export the real "$HOME" value as "$REAL_HOME" making it
# available during the editing session, in case its needed.
@jeebak
jeebak / zsh-prompt.zsh
Last active August 13, 2023 19:08
A three line ZSH prompt, with emacs and vim keybindings
# -----------------------------------------------------------------------------
# https://gist.github.com/jeebak/2fb31f964669892f6ef457508916bdb3
#
# A three line ZSH prompt, with emacs and vim keybindings:
# 1. At-a-glance: ┌─($USER@$HOST:$TTY─(shlvl:$SHLVL)─(jobs:0)─(exit:$?)
# 2. VCS/vim mode: │░(«git/vim mode»)↔[master↔origin↕◇◇◇]░》
# 3. [r]prompt: └─(«zsh»)% [~]
#
# NOTE: SHLVL on macOS seems to be > 1 (it is correctly 1, under Linux.) The
# quick workaround is to: export SHLVL=1 (before starting tmux, for example.)
@jeebak
jeebak / lesspipe.sh-1.83.patch
Last active October 16, 2019 20:14
Patch wofr06/lesspipe 1.83 to use bat
diff --git a/lesspipe.sh b/lesspipe.sh
index dc8c594..379cc12 100755
--- a/lesspipe.sh
+++ b/lesspipe.sh
@@ -527,8 +527,8 @@ isfinal() {
lang=${3#$sep}
lang="-l ${lang#.}"
lang=${lang%%-l }
- if cmd_exist code2color; then
- code2color $PPID ${in_file:+"$in_file"} $lang "$2"
@jeebak
jeebak / ctrl-key-zle-widgets.zsh
Last active March 25, 2022 22:30
Overload zsh / zle keybindings
__dotmatrix::ctrl-key() {
# Run: zsh -f -c 'set -o emacs; bindkey'
# to get a list of default keybindings.
# Some keybindings, like those for cursor movements: ^a, ^e, ^f, ^b, etc. are
# meaningful when there is text on the command line. If the command line is
# empty, then these keybindings are essentially no-ops.
# Using the $CURSOR and $BUFFER zle variables, we can take advantage of this
# and assign custom behavior to these bindings when the command line is empty.
@jeebak
jeebak / visrc.lua
Last active September 27, 2021 06:36
Example $HOME/.config/vis/visrc.lua for the vis editor, with a simple "Plug()" (plugin manager) implementation
-- load standard vis module, providing parts of the Lua API
require('vis')
function FilterRange(file, range, pos, filter)
-- Based on: http://martanne.github.io/vis/doc/#Vis:operator_new
local status, out, err = vis:pipe(file, range, filter)
if not status then
vis:info(err)
else
file:delete(range)