Skip to content

Instantly share code, notes, and snippets.

Avatar
🍼
I may be slow to respond.

Junegunn Choi junegunn

🍼
I may be slow to respond.
View GitHub Profile
View functions.sh
# GIT heart FZF
# -------------
is_in_git_repo() {
git rev-parse HEAD > /dev/null 2>&1
}
fzf-down() {
fzf --height 50% --min-height 20 --border --bind ctrl-/:toggle-preview "$@"
}
View vader-given-path.diff
diff --git a/README.md b/README.md
index 6abc213..c02896a 100644
--- a/README.md
+++ b/README.md
@@ -69,6 +69,12 @@ Given [filetype] [(comment)]:
[input text]
```
+Alternatively, you can pass a file path to `Given` label as follows:
+
View vimrc
set nocompatible hidden laststatus=2
if !filereadable('/tmp/plug.vim')
silent !curl --insecure -fLo /tmp/plug.vim
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
endif
source /tmp/plug.vim
call plug#begin('/tmp/plugged')
Plug 'junegunn/fzf', { 'do': './install --bin' }
View vader-given-file.diff
diff --git a/autoload/vader/parser.vim b/autoload/vader/parser.vim
index dbf5da0..da7c7b8 100644
--- a/autoload/vader/parser.vim
+++ b/autoload/vader/parser.vim
@@ -58,6 +58,9 @@ function! s:flush_buffer(cases, case, fn, lnum, raw, label, newlabel, buffer, fi
if a:final ||
\ a:newlabel == 'given' ||
\ index(['before', 'after', 'do', 'execute'], a:newlabel) >= 0 && fulfilled
+ if !empty(a:case.file)
+ let a:case.given = remove(a:case, 'file')
View toggle-flow.patch
diff --git a/src/options.go b/src/options.go
index 962e516..6519d08 100644
--- a/src/options.go
+++ b/src/options.go
@@ -91,42 +91,43 @@ func defaultMargin() [4]string {
// Options stores the values of command-line options
type Options struct {
- Fuzzy bool
- Extended bool
View rag.vim
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))
View inc-perf.clj
(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})))
@junegunn
junegunn / nyan_compressed.sh
Last active Nov 6, 2015 — forked from wting/nyan.sh
Nyan cat in bash shell (OS X)
View nyan_compressed.sh
#!/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
@junegunn
junegunn / README.md
Last active Sep 18, 2015 — forked from steve-jansen/README.md
Stop and start Symantec Endpoint Protection on OS X
View README.md

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 / tmux-24.diff
Last active Aug 29, 2015
tmux-24.diff
View 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 {