From e7a944950aa96a36b3846de705ad734c699ca360 Mon Sep 17 00:00:00 2001 From: Okan Esen Date: Sun, 22 Jul 2018 00:43:09 +0200 Subject: [PATCH] Enable syntax highlighting for snippets. --- Examples-(fish).md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Examples-(fish).md b/Examples-(fish).md index 284cd48..def03a9 100644 --- a/Examples-(fish).md +++ b/Examples-(fish).md @@ -3,7 +3,7 @@ Examples for fish shell ### Navigation -``` +```fish function fzf-bcd-widget -d 'cd backwards' pwd | awk -v RS=/ '/\n/ {exit} {p=p $0 "/"; print p}' | tac | eval (__fzfcmd) +m --select-1 --exit-0 $FZF_BCD_OPTS | read -l result [ "$result" ]; and cd $result @@ -11,7 +11,7 @@ function fzf-bcd-widget -d 'cd backwards' end ``` -``` +```fish function fzf-cdhist-widget -d 'cd to one of the previously visited locations' # Clear non-existent folders from cdhist. set -l buf @@ -31,7 +31,7 @@ end ### Commandline The following is useful to manipulate the commandline from the result of jobs. For instance, calling `fzf-select` over `pacman -Qlq fzf` will allow you to select files in the `fzf` package and print them bck to commandline for further manipulation. -``` +```fish function fzf-select -d 'fzf commandline job and print unescaped selection back to commandline' set -l cmd (commandline -j) [ "$cmd" ]; or return @@ -45,7 +45,7 @@ end The following can replace fish completion menu with fzf. Because of a [fish bug](https://github.com/fish-shell/fish-shell/issues/3469) this will fail on variables and other elements that need escaping (or not). -``` +```fish function fzf-complete -d 'fzf completion and print selection back to commandline' # As of 2.6, fish's "complete" function does not understand # subcommands. Instead, we use the same hack as __fish_complete_subcommand and @@ -95,7 +95,7 @@ end ### Git -``` +```fish function fco -d "Fuzzy-find and checkout a branch" git branch --all | grep -v HEAD | string trim | fzf | xargs git checkout end @@ -106,21 +106,21 @@ end ``` ### SSH -``` +```fish function fssh -d "Fuzzy-find ssh host and ssh into it" ag '^host [^*]' ~/.ssh/config | cut -d ' ' -f 2 | fzf | xargs -o ssh end ``` ### Tmux -``` +```fish function fs -d "Switch tmux session" tmux list-sessions -F "#{session_name}" | fzf | xargs tmux switch-client -t end ``` ### LastPass CLI -``` +```fish function fpass -d "Fuzzy-find a Lastpass entry and copy the password" if not lpass status -q lpass login $EMAIL