GithubHelp home page GithubHelp logo

jeebak / vis-fzf-open Goto Github PK

View Code? Open in Web Editor NEW

This project forked from guillaumecherel/vis-fzf-open

1.0 1.0 0.0 19 KB

Open files in vis with fzf

License: GNU Affero General Public License v3.0

Lua 100.00%

vis-fzf-open's Introduction

Fuzzy find and open files in vis

Use fzf to open files in vis.

Usage

In vis:

  • :fzf: search all files in the current sub-tree.
  • You can pass arguments to fzf, e.g. : :fzf -p !.class

While in fzf:

  • <Enter> to open the selected file in current window
  • <C-s> to open the selected file in a horizontal split
  • <C-v> to open the selected file in a vertical split

Configuration

In visrc.lua:

plugin_vis_open = require('plugins/vis-fzf-open/fzf-open')

-- Path to the fzf executable (default: "fzf")
plugin_vis_open.fzf_path = (
    "FZF_DEFAULT_COMMAND='ag --hidden --ignore .git -g \"\"' fzf"
)
-- Arguments passed to fzf (default: "")
plugin_vis_open.fzf_args = "-q '!.class ' --height=40%"

-- Mapping configuration example
vis.events.subscribe(vis.events.INIT, function()
    vis:command('map! normal <C-p> :fzf<Enter>')
end)

Complex example for plugin_vis_open.fzf_args:

my_fzf_args = string.gsub([[
    --bind=$my_fzf_key_bindings \
    --color fg:242,bg:236,hl:65,fg+:15,bg+:239,hl+:108 \
    --color info:108,prompt:109,spinner:108,pointer:168,marker:168 \
    --delimiter / --nth -1 \
    --height=70% \
    --inline-info \
    --no-mouse \
    --preview-window=up:70% \
    --preview="(
        bat --style=changes,grid,numbers --color=always {} ||
        highlight -O ansi -l {} ||
        coderay {} ||
        rougify {} ||
        cat {}
    ) 2> /dev/null | head -1000"
]], '%$([%w_]+)', {
    my_fzf_key_bindings=table.concat({
        "alt-j:preview-down",
        "alt-k:preview-up",
        "ctrl-f:preview-page-down",
        "ctrl-b:preview-page-up",
        "?:toggle-preview",
        "alt-w:toggle-preview-wrap",
        "ctrl-z:clear-screen"
    }, ",")
})

-- Arguments passed to fzf (default: "")
plugin_vis_open.fzf_args = my_fzf_args

vis-fzf-open's People

Contributors

guillaumecherel avatar jeebak avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.