All Projects → d630 → fzf-contrib

d630 / fzf-contrib

Licence: other
[Discontinued] 🌸 Organize useful code snippets around https://github.com/junegunn/fzf

Programming Languages

shell
77523 projects
Vim Script
2826 projects

Labels

Projects that are alternatives of or similar to fzf-contrib

Enhancd
🚀 A next-generation cd command with your interactive filter
Stars: ✭ 2,049 (+7780.77%)
Mutual labels:  fzf
Black Void Zsh
🔮 Awesome, Customable Zsh Starter Kit 🌠🌠
Stars: ✭ 206 (+692.31%)
Mutual labels:  fzf
nvim-contabs
contextual tabs for vim/neovim
Stars: ✭ 20 (-23.08%)
Mutual labels:  fzf
Tmux 1password
🔑 Access your 1Password login items within tmux!
Stars: ✭ 167 (+542.31%)
Mutual labels:  fzf
Twf
Standalone tree view file explorer, inspired by fzf.
Stars: ✭ 196 (+653.85%)
Mutual labels:  fzf
Dotfiles
🐧 Simple, fast, productivity-increaser dotfiles
Stars: ✭ 213 (+719.23%)
Mutual labels:  fzf
Kube Fzf
Shell commands using kubectl and fzf for command-line fuzzy searching of Kubernetes Pods.
Stars: ✭ 153 (+488.46%)
Mutual labels:  fzf
lazy-connect
Shell function to fuzzy search an IPSec VPN by name and connect to it automatically.
Stars: ✭ 56 (+115.38%)
Mutual labels:  fzf
Zoxide
A smarter cd command. Supports all major shells.
Stars: ✭ 4,422 (+16907.69%)
Mutual labels:  fzf
dotfiles
My doots. Changes are frequent, stability not guaranteed. Supports Arch, CentOS and Darwin.
Stars: ✭ 27 (+3.85%)
Mutual labels:  fzf
Psfzf
A PowerShell wrapper around the fuzzy finder fzf
Stars: ✭ 187 (+619.23%)
Mutual labels:  fzf
Init.nvim
An Opinionated Neovim Config for the Minimalists
Stars: ✭ 194 (+646.15%)
Mutual labels:  fzf
Tmux Fzf Url
🚀 Quickly open urls on your terminal screen!
Stars: ✭ 227 (+773.08%)
Mutual labels:  fzf
Z.lua
⚡ A new cd command that helps you navigate faster by learning your habits.
Stars: ✭ 2,164 (+8223.08%)
Mutual labels:  fzf
zeno.zsh
zsh fuzzy completion and utility plugin with Deno.
Stars: ✭ 119 (+357.69%)
Mutual labels:  fzf
Fzf Scripts
a collection of scripts that rely on https://github.com/junegunn/fzf
Stars: ✭ 158 (+507.69%)
Mutual labels:  fzf
Ansible Role Zsh
Setup antigen with oh-my-zsh, powerlevel10k theme, fzf, autosuggestions, syntax-highlighting
Stars: ✭ 210 (+707.69%)
Mutual labels:  fzf
clifm
The shell-like, command line terminal file manager: simple, fast, extensible, and lightweight as hell
Stars: ✭ 825 (+3073.08%)
Mutual labels:  fzf
dotfiles
No description or website provided.
Stars: ✭ 20 (-23.08%)
Mutual labels:  fzf
fzf.aws
🌀 Using fuzzy finder to perform AWS operations on the command line
Stars: ✭ 63 (+142.31%)
Mutual labels:  fzf

fzf-contrib

fzf-contrib(1) stores and organizes useful code snippets around the general-purpose fuzzy finder fzf.

Project Structure

fzf-contrib(5) repo

# tree  -a -P "*" -n --noreport -L 20 --charset=ascii "$PWD"
/home/user1/var/code/projects/fzf-contrib
|-- INFO.csv
|-- README.md
|-- fzf-contrib
`-- src
    |-- .gitkeep
    |-- ag-results.vim
    |-- cd-dir-file.sh
    |-- cd-dir-hidden.sh
    |-- cd-dir.sh
    |-- completion-cmdl.vim
    |-- ctags-search.bash
    |-- edit-file.sh
    |-- git-checkout-branch.sh
    |-- git-checkout-commit.sh
    |-- grep-file-contents.sh
    |-- history-repeat-edit.bash
    |-- history-repeat.bash
    |-- history-repeat2.bash
    |-- history-repeat3.bash
    |-- kill-process.sh
    |-- locate.tmux
    |-- mru.vim
    |-- open-file.sh
    |-- search-buffer-lines.vim
    |-- tags-jump.vim
    |-- tmux-pane-switch.sh
    |-- tmux-session-select.sh
    |-- z.bash
    `-- z1.bash

Any src file needs to have an accurate filename with a filename extension, and a shebang formed like this:

#!/usr/bin/env <COMMAND WITHOUT ARGS>
#!/usr/bin/env sh
#!/usr/bin/env vim

Further, it should be recorded in the file called INFO.csv. The fields are:

name
applications
tags
description

fzf-custom dir

It is intended to use selected code snippets in a second directory, independently from the fzf-contrib repo. The environment variable FZF_CONTRIB_DIR points to ${XDG_DATA_HOME:-${HOME}/.local/share}/fzf-custom by default:

# tree  -a -P "*" -n --noreport -L 20 --charset=ascii "$PWD"
/home/user1/share/fzf-custom
|-- INFO.csv
|-- LINKS.txt
|-- rc
|   |-- .gitkeep
|   |-- bash
|   |   |-- .gitkeep
|   |   |-- z.bash
|   |   `-- z1.bash
|   |-- fish
|   |   `-- .gitkeep
|   |-- mksh
|   |   `-- .gitkeep
|   |-- tmux
|   |   `-- .gitkeep
|   |-- vim
|   |   `-- .gitkeep
|   `-- zsh
|       `-- .gitkeep
`-- src
    |-- ag-results.vim
    |-- cd-dir-file.sh
    |-- cd-dir-hidden.sh
    |-- cd-dir.sh
    |-- completion-cmdl.vim
    |-- ctags-search.bash
    |-- edit-file.sh
    |-- git-checkout-branch.sh
    |-- git-checkout-commit.sh
    |-- grep-file-contents.sh
    |-- history-repeat-edit.bash
    |-- history-repeat.bash
    |-- history-repeat2.bash
    |-- history-repeat3.bash
    |-- kill-process.sh
    |-- locate.tmux
    |-- mru.vim
    |-- open-file.sh
    |-- search-buffer-lines.vim
    |-- tags-jump.vim
    |-- tmux-pane-switch.sh
    |-- tmux-session-select.sh
    |-- z.bash
    `-- z1.bash

Files are stored in src/ and will be manually loaded (hard linked) into several rc/ subdirectories. LINKS.txt tracks all linking; it may be used if fzf-custom is a git repository and we need to relink into rc/ in a git hook post script.

fzf-contrib(1) command

fzf-contrib(1) follows the Shell and Utilities portion of the POSIX specification. It is written to copy files from fzf-contrib to fzf-custom and to maintain several code snippets inside fzf-custom.

Install

  • Do git clone https://github.com/D630/fzf-contrib.git
  • Copy the shell script fzf-contrib elsewhere into <PATH>
  • cd fzf-contrib/ && ./fzf-contrib init

Help

Usage: fzf-contrib [add|help|info|init|load|reload|uload|version]

Subcommands:
add <src> [d=<dest>]            Force a copy of a src file from
                                <FZF_CONTRIB_ROOT/src> to <FZF_CONTRIB_DIR/src>
help                            Show this instruction
info [<pattern>]                Output records from INFO.csv
init                            Initialize local src dir from the
                                <FZF_CONTRIB_ROOT/src>; copy its contents to
                                <FZF_CONTRIB_DIR/src>
load <src> [a=<app>] [d=<dest>] Hard link a src file from
                                <FZF_CONTRIB_DIR/src> into
                                <FZF_CONTRIB_DIR/rc>
reload                          Remove all hardlinks in <FZF_CONTRIB_DIR/rc>
                                and source <FZF_CONTRIB_DIR/LINKS.txt>.
                                Use this command in a hook script like
                                <.git/hooks/post-merge>
uload [<src>] [a=<app>]         Remove hard link from <FZF_CONTRIB_DIR/rc>

Arguments:
<app>                           Name of application and subdirectory in
                                <FZF_CONTRIB_DIR/rc>. Delimite apps with
                                comma: 'zsh,mksh,bash'
<dest>                          New name of the current script in
                                <FZF_CONTRIB_DIR/rc>
<pattern>                       Grep BRE pattern
<src>                           Basename of the script in the current src dir

Environment variables:
FZF_CONTRIB_DIR
    ${XDG_DATA_HOME:-${HOME}/.local/share}/fzf-custom

Examples

To initialize fzf-custom/ and add new snippets to fzf-custom/src/:

% cd fzf-contrib/
% ./fzf-contrib info | less
% ./fzf-contrib init
> Create '/home/user1/share/fzf-custom/src'
> Copy '/home/user1/var/code/projects/fzf-contrib/INFO.csv' -> '/home/user1/share/fzf-custom/INFO.csv'
> Copy '/home/user1/var/code/projects/fzf-contrib/src/ag-results.vim' -> '/home/user1/share/fzf-custom/src/ag-results.vim'
> Copy '/home/user1/var/code/projects/fzf-contrib/src/cd-dir-file.sh' -> '/home/user1/share/fzf-custom/src/cd-dir-file.sh'
> Copy '/home/user1/var/code/projects/fzf-contrib/src/cd-dir-hidden.sh' -> '/home/user1/share/fzf-custom/src/cd-dir-hidden.sh'
> [...]
% ./fzf-contrib info z.bash | less
% ./fzf-contrib add z.bash
> Copy '/home/user1/var/code/projects/fzf-contrib/src/z.bash' -> '/home/user1/share/fzf-custom/src/z.bash'
% ./fzf-contrib add z.bash d=Z
> Copy '/home/user1/var/code/projects/fzf-contrib/src/z.bash' -> '/home/user1/share/fzf-custom/src/Z'

Edit z.bash:

% cd
% ls ~/share/fzf-custom/
> INFO.csv  rc  src
% <EDITOR> ~/share/fzf-custom/src/z.bash

Load z.bash based on shebang:

% fzf-contrib load z.bash
> Create '/home/user1/share/fzf-custom/src/z.bash' -> '/home/user1/share/fzf-custom/rc/bash/z.bash'

Load z.bash based on shebang and rename it to Z:

% fzf-contrib load z.bash d=Z
> Create '/home/user1/share/fzf-custom/src/z.bash' -> '/home/user1/share/fzf-custom/rc/bash/Z'

Load kill-process.sh based on shebang. Since bash(1), mksh(1) and zsh(1) are sh-compatible, the script is loaded three times:

% fzf-contrib load kill-process.sh
> Create '/home/user1/share/fzf-custom/src/kill-process.sh' -> '/home/user1/share/fzf-custom/rc/bash/kill-process.sh'
> Create '/home/user1/share/fzf-custom/src/kill-process.sh' -> '/home/user1/share/fzf-custom/rc/mksh/kill-process.sh'
> Create '/home/user1/share/fzf-custom/src/kill-process.sh' -> '/home/user1/share/fzf-custom/rc/zsh/kill-process.sh'

Unload/Remove kill-process.sh from fzf-custom/rc/{mksh,zsh}/:

% fzf-contrib uload kill-process.sh a=mksh,zsh
> Remove '/home/user1/share/fzf-custom/src/kill-process.sh' -> '/home/user1/share/fzf-custom/rc/mksh/kill-process.sh'
> Remove '/home/user1/share/fzf-custom/src/kill-process.sh' -> '/home/user1/share/fzf-custom/rc/zsh/kill-process.sh'

Load kill-process.sh into fzf-custom/rc/mksh/:

% fzf-contrib load kill-process.sh a=mksh
> Create '/home/user1/share/fzf-custom/src/kill-process.sh' -> '/home/user1/share/fzf-custom/rc/mksh/kill-process.sh'

Load kill-process.sh into fzf-custom/rc/zsh/ and rename it into KILL.zsh:

% fzf-contrib load kill-process.sh a=zsh d=KILL.zsh
> Create '/home/user1/share/fzf-custom/src/kill-process.sh' -> '/home/user1/share/fzf-custom/rc/zsh/KILL.zsh'

Unload/Remove all links inside fzf-custom/rc/:

% fzf-contrib uload
> rm: remove regular file ‘/home/user1/share/fzf-custom/LINKS.txt’?
> Remove '/home/user1/share/fzf-custom/LINKS.txt'
> Remove '/home/user1/share/fzf-custom/rc/zsh/KILL.zsh'
> Remove '/home/user1/share/fzf-custom/rc/mksh/kill-process.sh'
> Remove '/home/user1/share/fzf-custom/rc/bash/kill-process.sh'
> Remove '/home/user1/share/fzf-custom/rc/bash/z.bash'
> Remove '/home/user1/share/fzf-custom/rc/bash/Z'

Using selected code snippets

Source the scripts inside fzf-custom/rc/<APP>/ into your configuration file. For example, you may put the following into .bashrc:

declare snippet=
for snippet in "${FZF_CONTRIB_DIR}"/rc/bash/?*
do
    source "$snippet"
done
unset -v snippet

To do

  • better fzf-contrib info
  • update INFO.csv after fzf-contrib load and fzf-contrib uload
  • nicer names of arguments
  • example how to use fzf-contrib reload

Bugs & Requests

Report it on https://github.com/D630/fzf-contrib/issues

LICENCE

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].