Giter Club home page Giter Club logo

neoterm's Introduction

neoterm

Use the same terminal for everything. The main reason for this plugin is reuse the terminal easily. All commands opens a terminal if it's not open or reuse the open terminal. REPL commands, opens a terminal and the proper REPL, if it's not opened.

  • NeoVim terminal helper functions/commands.
  • Wraps some REPL to receive current line or selection.
  • Many terminals support:
    • many-terms

Installation

To install this plugin, you should use one of the following methods. For Windows users, replace usage of the Unix ~/.vim directory with %USERPROFILE%\_vim, or another directory if you have configured Vim differently. On Windows, your ~/.vimrc file will be similarly stored in %USERPROFILE%\_vimrc.

i. Installation with Vundle/Plug.vim/minpac/any other

You can install this plugin using any vim plugin manager by using the path on GitHub for this repository:

[Plugin|Plug|...] 'kassio/neoterm'

See the your plugin manager documentation for more information.

ii. Manual Installation

For installation without a package manager, you can clone this git repository into a bundle directory as with pathogen, and add the repository to your runtime path yourself. First clone the repository.

cd ~/.vim/bundle
git clone https://github.com/kassio/neoterm.git

Then, modify your ~/.vimrc file to add this plugin to your runtime path.

set nocompatible
filetype off

let &runtimepath.=',~/.vim/bundle/neoterm'

filetype plugin on

You can add the following line to generate documentation tags automatically, if you don't have something similar already, so you can use the :help command to consult neoterm's online documentation:

silent! helptags ALL

Because the author of this plugin is a weird nerd, this is his preferred installation method.

test libs (removed on 05/Feb/2017)

This feature was removed on 05/Feb/2017, please consider to use the vim-test with neoterm strategy to replace this feature

REPL

  • TREPLSend: sends the current line or the selection to a REPL in a terminal.
  • TREPLSendFile: sends the current file to a REPL in a terminal.

REPLs supported

  • Ruby: pry and irb
  • Rails: bundle exec rails console
  • Python: ipython and python
  • JavaScript: node
  • Elixir: iex
  • Julia: julia
  • R / R Markdown: R
  • Haskell: ghci
  • Idris: idris
  • GNU Octave: octave
    • For Octave 4.0.0 and later, you can enable Qt widgets (dialogs, plots, etc.) using g:neoterm_repl_octave_qt = 1
  • MATLAB: matlab -nodesktop -nosplash
  • PARI/GP: gp
  • PHP: psysh and php

Troubleshooting

Most standard file extensions for the above REPLs are picked up by Neovim's default filetype plugins. However, there are two exceptions:

  • Julia .jl files, which are detected as filetipe=lisp
  • Idris .idr, .lidr files which are not recognised as any filetype To fix this, either install a suitable plugin for the language or add something like the following to your init.vim:
au VimEnter,BufRead,BufNewFile *.jl set filetype=julia
au VimEnter,BufRead,BufNewFile *.idr set filetype=idris
au VimEnter,BufRead,BufNewFile *.lidr set filetype=lidris

other useful commands:

  • :T <command>: Opens a terminal, or use an opened terminal, and runs the given command within a terminal.
  • :Tmap <command>: maps a the given command to ,tt.

Contributing

Open a pull request, repls and other features to this plugin. ๐Ÿ˜ƒ

example config file:

let g:neoterm_position = 'horizontal'
let g:neoterm_automap_keys = ',tt'

nnoremap <silent> <f10> :TREPLSendFile<cr>
nnoremap <silent> <f9> :TREPLSendLine<cr>
vnoremap <silent> <f9> :TREPLSendSelection<cr>

" Useful maps
" hide/close terminal
nnoremap <silent> ,th :call neoterm#close()<cr>
" clear terminal
nnoremap <silent> ,tl :call neoterm#clear()<cr>
" kills the current job (send a <c-c>)
nnoremap <silent> ,tc :call neoterm#kill()<cr>

" Rails commands
command! Troutes :T rake routes
command! -nargs=+ Troute :T rake routes | grep <args>
command! Tmigrate :T rake db:migrate

" Git commands
command! -nargs=+ Tg :T git <args>

neoterm's People

Contributors

kassio avatar fokoid avatar leonardt avatar bitboxer avatar tdy avatar icholy avatar ararslan avatar alok avatar npbee avatar jodosha avatar rtwo avatar majjoha avatar pcaneill avatar randy3k avatar stephanvd avatar tomasv avatar ukuloskit avatar vhakulinen avatar will avatar zegervdv avatar lis2 avatar bicycle1885 avatar ianks avatar gravndal avatar dangalipo avatar codyjroberts avatar christian-schulze avatar arnaud-lb avatar aw3i avatar abaldwin88 avatar

Watchers

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