Git Product home page Git Product logo

intim's Introduction

Intim

interactively interface vim with interpreters


This plugin makes you open, from within Vim, an interactive interpreter in another terminal. This interpreter may be a shell, python, R or anything you want. You feed input to this terminal via predefined or custom Vim mappings: like sending commands, interrupting, restarting, analyzing variables etc.

This plugin is mostly inspired from vim-R plugin, a great plugin dedicated do this with R.
The intent is to extend the idea to any interpreter and to offer more configuration options.

Major features, as for today:

  • Launch interpreter session without leaving Vim.
  • Send lines, words, visual selections, chunks and whole files to your interpreter.
  • Dynamically update your syntax file to get your script variables colored as they get declared in your interpreter.
  • Use custom hotkeys to send very specific expressions built from the variables currently under cursor.
  • Bonus hotkeys edit your very script with these specific expressions.
  • Access and read the interpreter help from within a vim buffer.
  • Detect and handle debug modes.
  • Enter loops to get into their execution contexts.
  • Quit and restart Vim without exiting the session.
  • Easy configuration.
  • Easy extension to other languages.
    • Full-support yet for:
      • python, (Pdb) (2, 3, ipython, bpython, ...)
      • R
    • A few utilities already implemented for:
      • bash
      • LaTeX
      • Rust, C++ (gdb)

Installation

Intim uses tmux to open a multiplexed interactive shell session. Then Intim uses it to launch and communicate with your favourite interpreter. Tmux is typically installed on debian-based systems with:

sudo apt-get install tmux

on Arch, try:

sudo pacman -S tmux

Once done, install Intim with any Vim package manager you like.

Typically

cd ~/.vim/bundle
git clone https://github.com/iago-lito/intim

With Vundle

Add the following line to your .vimrc:

Plugin 'iago-lito/intim'

Then run :PluginInstall.

First steps

Launch and close an Intim session with these default mappings.

nmap <F10> <Plug>IntimLaunchSession
nmap <F2>  <Plug>IntimEndSession  

They should be automatically defined by Intim, unless you wish changing them to something you like better. Intim will try never to override a mapping you had before. In this case, you will have to pick another mapping yourself.

Then, start communicating with your interpreter with these default mappings:

  • <space>: send the current line to your interpreter.
  • ,<space>: send the word under cursor.
  • ,uc: update syntax coloring as your variables and functions get declared.
  • ,mx-hotkey: ask python for the max() of the variable under cursor.
    • ;mx-edition-hotkey: actually wrap your variable in max().
  • ,sm-hotkey: ask R for the summary() of the variable under cursor.
    • ;sm-edition-hotkey: actually wrap your variable in summary().
  • <F1>: ask your interpreter for help about the item under cursor.

Configure

Remap anything you want.

Enjoy hooks to manipulate, tile, bring focus to your terminal, play sounds or anything you like, for instance:

call IntimLaunchCommand('python', ['cd ~'])     " first commands to tmux
call IntimInvokeCommand('python', 'python3 -B') " invoke your interpreter the way you like

Create any new hotkey you like, for instance:

call Intim_prefixedExpression('python', 'sf', 'self = ')
call Intim_headedExpression('R', 'ac', 'as.character')
call Intim_hotkeys('R', 'ii', '* <- * + 1')

Find more in :help intim<cr>.

Contribute

Intim code is open. It comes with no guarantees. But it also comes with extension points, and complete documentation to encourage development of any new feature. Feel free to contribute of course: share, comment, report bugs, ask for features, help in development, anything's good :)

License

This package is licensed under the GPL v3 license. © 2020 Intim contributors

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.