Code Monkey home page Code Monkey logo

vargs's Introduction

vargs

Open given files / Call vim function with given strings using Terminal API (xargs for vim)

Usage

vargs [-0] [-s {separators (comma-separated)}] [-I {replstr}] [-t] [{vim terminal-api arguments (default: "drop")} ...]

vargs sends given arguments to Vim using Terminal API.
If no arguments were given, "drop" is specified implicitly (default).

See below about Vim Terminal API.

Options

  -0    Change separator to NUL character. This is same as "-s nul"
  -I string
        If this replacement string was given, replace arguments by this with each item
  -s string
        Change separators with these comma-separated values (available values are "space", "tab", "newline", "nul") (default "newline")
  -t    Print JSON command to standard error before printing with escape sequence (verbose print)

Why you created this?

I wanted a way to quickly open selected file using file fuzzy finder UI, like gof.
I sent a pull request to gof that adds -t option to open selected file using Vim Terminal API.
After that, I got an idea that creating generic command for Vim Terminal API.

Vim Terminal API is very handy to communicate from processes inside Vim terminal window to outer Vim.

Other Vim plugin examples using Terminal API:

Examples

Open the selected file (peco, gof)

Using peco

$ ls | peco | vargs

Using gof (recurse subdirectories)

$ gof | vargs

However, gof already has -t option to open in Vim ๐Ÿ˜

$ gof -t

Open all files under repository

$ find . -path ./.git -prune -o -type f | vargs

More safe way...

$ find . -path ./.git -prune -o -type f -print0 | vargs -0

Open project under $GOPATH

$ ls -d $GOPATH/src/github.com/*/* | peco | vargs

You may prefer project-guide.vim.

vargs's People

Contributors

tyru avatar

Watchers

James Cloos avatar  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.