Code Monkey home page Code Monkey logo

vscode-filtertext's Introduction

Filter Text extension for Visual Studio Code

This extension filters selected text through an external shell command inplace or into temp file. It brings the power of Unix commands such as sort and uniq into your VS Code editor.

https://marketplace.visualstudio.com/items?itemName=yhirose.FilterText

Usage

  • Select text that you want to filter.
  • Press Ctrl+K Ctrl+F (โŒ˜K โŒ˜F on macOS).
    • Alternatively, press F1 and run the command named Filter Text Inplace.
  • Type shell command like sort -r and press enter.
  • It replaces the selected text with the text from stdout of the command.

NOTE

  • If you didn't select anything, it simply inserts the result text at the current cursor position.
  • If you selected Filter Text command it opens temp editor with the result.

Filter selected text

Keybindings

It is possible to map specific commands to key bindings. Example usage in keybindings.json:

{
    "key": "shift+alt+l",
    "command": "extension.filterTextInplace",
    "args": { "cmd": "sort" }
}

Configuration

Commands can be predefined in the settings.json as follows:

"filterText.commandList": [
    {
        "name": "Sort unique",
        "description": "Sorts and find the unique entries",
        "command": "sort | uniq"
    },
    {
        "name": "Columnize CSV",
        "description": "Columnize comma separated values",
        "command": "column -s \",\" -t"
    },
    {
        "name": "XML lint",
        "description": "Run the command through xmllint",
        "command": "xmllint --format -"
    }
]

Changes

  • 07/24/2019: v0.0.15 - Predefined commands via settings.json. Add macOS keybinding to fix Delete All Right
  • 03/31/2019: v0.0.14 - Fix used document filter flag when false
  • 03/16/2019: v0.0.13 - Implemented passing in the command as an argument
  • 03/14/2019: v0.0.12 - Improvement: Add option to always use a file's dir as current working
  • 08/30/2018: v0.0.11 - Better working directry handling.
  • 07/28/2018: v0.0.10 - Better error reporting. In case command exited with failure status, and leave only error messages without stdout, don't change text selection but pop an error message instead. When filter on empty document (zero bytes), need to close stdin to avoid child process reading stdin never terminate (dangling).
  • 07/22/2018: v0.0.9 - Added support and settings for using bash's commands or scripts
  • 01/25/2018: v0.0.8 - Set current working directory for the command to match the opened directory
  • 01/14/2018: v0.0.7 - Set current working directory for the command to match the opened directory
  • 12/25/2017: v0.0.6 - Pipe support
  • 07/20/2017: v0.0.5 - Make temp buffer a vscode tmp doc instead of system tmp file
  • 07/19/2017: v0.0.4 - Allow filter buffer if no selection
  • 04/01/2017: v0.0.3 - Added ability to feed result into temp file
  • 11/24/2015: v0.0.2 - Changed the keybindg from Ctrl+Shift+F to Ctrl+K Ctrl+F.
  • 11/23/2015: v0.0.1 - Initial release.

License

MIT

vscode-filtertext's People

Contributors

yhirose avatar johnnytemp avatar mwick83 avatar krpors avatar brandt avatar karomine 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.