View keys.go
package main
import (
"fmt"
"os"
"syscall"
)
func GetBytes() []byte {
_in, _ := os.OpenFile("/dev/tty", syscall.O_RDONLY, 0)
View notes.sh
#!/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"
export NORENAME=1
cd "$NOTE_DIR"
View gstash.sh
gstash() {
local out k reflog
out=(
$(git stash list --pretty='%C(yellow)%gd %>(14)%Cgreen%cr %C(blue)%gs' |
fzf --ansi --no-sort --header='enter:show, ctrl-d:diff, ctrl-o:pop, ctrl-y:apply, ctrl-x:drop' \
--preview='git stash show --color=always -p $(cut -d" " -f1 <<< {}) | head -'$LINES \
--preview-window=down:50% --reverse \
--bind='enter:execute(git stash show --color=always -p $(cut -d" " -f1 <<< {}) | less -r > /dev/tty)' \
--bind='ctrl-d:execute(git diff --color=always $(cut -d" " -f1 <<< {}) | less -r > /dev/tty)' \
--expect=ctrl-o,ctrl-y,ctrl-x))
View fzf_history_dir.patch
diff --git a/README.md b/README.md
index a36a60a..65804e6 100644
--- a/README.md
+++ b/README.md
@@ -122,6 +122,12 @@ let g:fzf_colors =
\ 'marker': ['fg', 'Keyword'],
\ 'spinner': ['fg', 'Label'],
\ 'header': ['fg', 'Comment'] }
+
+" Enable per-command history.
View functions.sh
# GIT heart FZF
# -------------
is_in_git_repo() {
git rev-parse HEAD > /dev/null 2>&1
}
gf() {
is_in_git_repo || return
git -c color.status=always status --short |
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
autocmd VimEnter *
\ if !empty(filter(copy(g:plugs), '!isdirectory(v:val.dir)'))
\| PlugInstall
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))