Giter Site home page Giter Site logo

vimcmdline's Introduction

vimcmdline: Send lines to interpreter

This plugin sends lines from either Vim or Neovim to a command line interpreter (REPL application). There is support for Clojure, Golang, Haskell, JavaScript, Julia, Jupyter, Kotlin, Lisp, Lua, Macaulay2, Matlab, Prolog, Python, R, Racket, Ruby, Sage, Scala, Shell script, Swift, Kdb/q and TypeScript (see Nvim-R for a more compreehsive support for R in Vim/Neovim). If the file type is quarto, vimcmdline will try to infer what interpreter should be started.

The interpreter runs in Neovim's built-in terminal. If Tmux is installed, the interpreter can also run in an external terminal emulator or in a tmux pane. The main advantage of running the interpreter in a Neovim terminal is that the output is colorized, as in the screenshot below, where we have different colors for general output, positive and negative numbers, and the prompt line:

nvim running octave

If running in either a Neovim built-in terminal or an external terminal, the plugin runs one instance of the REPL application for each file type. If running in a tmux pane, it runs one REPL application for Vim instance.

Support for running the interpreter in Vim's built-in terminal was not implemented. I have never adapted the plugin to run the interpreter within Vim's built-in terminal (as it does in Neovim) because Vim cannot colorize the output printed in its terminal.

How to install

Use a plugin manager to install vimcmdline.

You have to install Tmux if you either want to run the interpreter in an external terminal emulator or are using Vim.

Usage and options

Please, read the plugin's documentation for further instructions.

How to add support for a new language

  1. Look at the Vim scripts in the ftplugin directory and make a copy of the script supporting the language closer to the language that you want to support.

  2. Save the new script with the name "filetype_cmdline.vim" where "filetype" is the output of :echo &filetype when you are editing a script of the language that you want to support.

  3. Edit the new script and change the values of its variables as necessary.

  4. Test your new file-type script by running your application in either Vim or Neovim and using either the built-in terminal or a Tmux split pane.

  5. Look at the Vim scripts in the syntax directory and make a copy of the script supporting the language whose output is closer to the output of the language that you want to support.

  6. Save the new script with the name "cmdlineoutput_filetype.vim" where "filetype" is the output of :echo &filetype.

  7. Edit the new script and change both the pattern used to recognize the input line and the pattern used to recognize errors.

  8. Test your new syntax highlighting script by running your application in a Neovim built-in terminal.

See also

Plugins with similar functionality are vim-slime and neoterm.

vimcmdline's People

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.