GithubHelp home page GithubHelp logo

jayvn / vimcmdline Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jalvesaq/vimcmdline

0.0 2.0 0.0 24 KB

Send code to command line interpreter

License: GNU General Public License v2.0

Vim Script 100.00%

vimcmdline's Introduction

vimcmdline: Send lines to interpreter

This plugin sends lines from either Vim or Neovim to a command line interpreter. Supported file types are haskell, julia, lisp, matlab, prolog, python, ruby and sh. The interpreter may run in a Tmux pane or in a Neovim built-in terminal. The main advantage of running the interpreter in a Neovim terminal is that the output is colorized, as in the screenshot below:

nvim_running_octave

How to install

Copy the directories ftplugin, plugin and syntax and their files to your ~/.vim or ~/.config/nvim directory, or use a plugin manager like Vim-Plug, Vundle, Pathogen, Neobundle, or other.

Usage

If you are editing one of the supported file types, in Normal mode do:

  • <LocalLeader>s to start the interpreter.

  • <Space> to send the current line to the interpreter.

  • <LocalLeader>q to send the quit command to the interpreter.

For languages that can source chunks of code:

  • In Visual mode, press:

    • <Space> to send a selection of text to the interpreter.
  • And, in Normal mode, press:

    • <LocalLeader>p to send from the line to the end of paragraph.

    • <LocalLeader>b to send block of code between two closest marks.

    • <LocalLeader>f to send the entire file to the interpreter.

Options

Below are examples of how to set the options in your vimrc:

let cmdline_vsplit = 1        " Split the window vertically
let cmdline_esc_term = 1      " Remap <Esc> to :stopinsert in Neovim terminal
let cmdline_in_buffer = 0     " Start the interpreter in a Neovim buffer
let cmdline_term_height = 15  " Initial height of interpreter window or pane
let cmdline_term_width = 80   " Initial width of interpreter window or pane
let cmdline_tmp_dir = '/tmp'  " Temporary directory to save files
let cmdline_outhl = 1         " Syntax highlight the output

If you are using Neovim, you can use its syntax highlight capabilities to colorize the interpreter output, and you can customize the colors in your vimrc. The example of customization below is for a terminal emulator that supports 256 colors (see in Neovim :h highlight-ctermfg):

if &t_Co == 256
    let cmdline_color_input = 247
    let cmdline_color_normal = 39
    let cmdline_color_number = 51
    let cmdline_color_integer = 51
    let cmdline_color_float = 51
    let cmdline_color_complex = 51
    let cmdline_color_negnum = 183
    let cmdline_color_negfloat = 183
    let cmdline_color_date = 43
    let cmdline_color_true = 78
    let cmdline_color_false = 203
    let cmdline_color_inf = 39
    let cmdline_color_constant = 75
    let cmdline_color_string = 79
    let cmdline_color_stderr = 33
    let cmdline_color_error = 15
    let cmdline_color_warn = 1
    let cmdline_color_index = 186
endif

If you prefer that the output is highlighted using you current colorscheme, put in your vimrc:

let cmdline_follow_colorscheme = 1

vimcmdline's People

Contributors

ahovgaard avatar jalvesaq avatar nad2000 avatar

Watchers

 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.