Skip to content

Instantly share code, notes, and snippets.

View junegunn's full-sized avatar
🐷
Please be kind to animals

Junegunn Choi junegunn

🐷
Please be kind to animals
View GitHub Profile
@junegunn
junegunn / gist:f4fca918e937e6bf5bad
Last active May 4, 2024 05:07
Browsing git commit history with fzf
# fshow - git commit browser (enter for show, ctrl-d for diff, ` toggles sort)
fshow() {
local out shas sha q k
while out=$(
git log --graph --color=always \
--format="%C(auto)%h%d %s %C(black)%C(bold)%cr" "$@" |
fzf --ansi --multi --no-sort --reverse --query="$q" \
--print-query --expect=ctrl-d --toggle-sort=\`); do
q=$(head -1 <<< "$out")
k=$(head -2 <<< "$out" | tail -1)
@junegunn
junegunn / b.rb
Last active January 26, 2023 14:34
b - browse Chrome bookmarks with fzf
#!/usr/bin/env bash
# vim: set filetype=ruby:
# b - browse Chrome bookmarks with fzf
[ $(uname) = Darwin ] || exit 1
which fzf > /dev/null 2>&1 || brew reinstall --HEAD fzf || exit 1
/usr/bin/ruby -x "$0" |
fzf-tmux -u 30% --ansi --multi --no-hscroll --tiebreak=begin |
awk 'BEGIN { FS = "\t" } { print $2 }' |
@junegunn
junegunn / gist:d779dff10a3d0a708cb7
Last active August 29, 2015 14:19
Managing notes with fzf
#!/usr/bin/env bash
#
# Managing notes with fzf (https://github.com/junegunn/fzf)
# - CTRL-L: List txt files in descending order by their modified time
# - CTRL-F: Search file contents
NOTE_DIR="${NOTE_DIR:-$(dirname "${BASH_SOURCE[0]}")}"
TRASH_DIR="$NOTE_DIR/trash"
cd "$NOTE_DIR"
@junegunn
junegunn / vimawesome.vim
Last active May 10, 2023 15:50
Plugin completion using VimAwesome API
" ----------------------------------------------------------------------------
" vimawesome.com
" ----------------------------------------------------------------------------
function! VimAwesomeComplete() abort
let prefix = matchstr(strpart(getline('.'), 0, col('.') - 1), '[.a-zA-Z0-9_/-]*$')
echohl WarningMsg
echo 'Downloading plugin list from VimAwesome'
echohl None
ruby << EOF
require 'json'
plug.txt plug Last change: May 20 2015
PLUG - TABLE OF CONTENTS *plug* *plug-toc*
==============================================================================
vim-plug
Pros.
Usage
Commands
Plug options
Global options
@junegunn
junegunn / tmux-24.diff
Last active August 29, 2015 14:26
tmux-24.diff
diff --git a/colour.c b/colour.c
index b5efd6f..8098f83 100644
--- a/colour.c
+++ b/colour.c
@@ -29,12 +29,6 @@
* of the 256 colour palette.
*/
-/* An RGB colour. */
-struct colour_rgb {
@junegunn
junegunn / README.md
Last active February 23, 2022 10:08 — forked from steve-jansen/README.md
Stop and start Symantec Endpoint Protection on OS X

This script enables you stop and start Symantec Endpoint Protection on OS X

Installation

sudo curl https://gist.githubusercontent.com/steve-jansen/61a189b6ab961a517f68/raw/sep -o /usr/local/bin/sep
sudo chmod 755 /usr/local/bin/sep
sudo chown root:staff /usr/local/bin/sep
@junegunn
junegunn / nyan_compressed.sh
Last active November 6, 2015 02:52 — forked from wting/nyan.sh
Nyan cat in bash shell (OS X)
#!/usr/bin/env bash
METANYAN="$(cat <<'EOT'
H4sIAHQtVlECA+2dS5rjJhCA93OK7CY5RBa5QPZZFu1uu2UQ99/FFCDQCwEq2bRVfI5bZMb/1AOw
VF0U//73z79///lbZDeV+LPfv/7A9ruApihxxNIlG+Nqm2oaR6msUi1LdypXMK5VnCLFKRLeUdI9
zxUwbXm4D9f8n7ku3KcNtnEfa83QZNxSvCycxdzwhbws3KdrHmR7cPeYIN827nOtQaQqAKIfuBV/
FOGg68BKZ662cF+uDaBH+/qCYLoHBHl3vEjivubNiABfY+nM/wL7sxiHPMTdAs63TdzFNY+7WJ6X
7jaiLfMG3GWpIe/ux4nBKctUUIO7AATprCfwrYMM3LdrnoUdj0PH9v2gat8ncd9rzUwy74kHzohl
Xjtw95G2YIdK2rOPD15dUw6EHWO8sDJtjJOAuy63SKCcJTQD9/jooBterGk6wflnGqPv1fWtIEEa
132fmwr1o75nGcc4Ypxi2zHuCJxqGGdCJeosyhZ4Vmc0he8i8TcKcEqZ14MmSHDE0nmcpsJpxgWb
(defn recreate-table!
[]
(doto C
(admin/drop-table! :test-table)
(admin/create-table :test-table :d)))
(defn increment
[max]
(core/with-table C [t :test-table]
(core/inc t (rand-int max) {:d:foo 1})))
function! s:with_git_root()
let root = systemlist('git rev-parse --show-toplevel')[0]
return v:shell_error ? {} : {'dir': root}
endfunction
command! -nargs=* Rag
\ call fzf#vim#ag(<q-args>, extend(s:with_git_root(), g:fzf#vim#default_layout))