Skip to content
 
 

Latest commit

 

History

325 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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/Vim 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

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.
  • <Plug>(neoterm-repl-send): sends with text-objects or motions, or sends the selection to a REPL in a terminal.
  • <Plug>(neoterm-repl-send-line): sends the current line 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/Vim'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.

dynamic commands:

  • :3T {command}: Will send the command to neoterm-3.

useful mappings:

I like to set some mappings to make me more productive.

" 3<leader>tl will clear neoterm-3.
nnoremap <leader>tl :<c-u>exec v:count.'Tclear'<cr>

Contributing

Open a pull request, repls and other features to this plugin. 😃

Changelog

  • 03/03/2018
    • DEPRECATE g:neoterm_split_on_tnew - :Tnew now accepts vim mods (:help mods).
    • Introduce g:neoterm_tnew_mod to set a default :Tnew mod (:help mods).
    • Revamp :Topen. Now :[mods][N]Topen accepts vim mods (:h mods) and a target, so if one wants to open the neoterm with id 2 in vertical, one can do :vert 2Topen.
    • Revamp :Tclose. Now :[N]Tclose[!] accepts a target, so one can close any neoterm by its id.
    • Fix a bug with :[N]Ttoggle and also make it accepts the neoterm id.
  • 04/03/2018
    • Revamp :[N]Ttoggle, now it accepts vim mods (:help mods) when the toggle is opening the neoterm.
    • Revamp :[N]T, now it accepts the target, so one can send the command for any neoterm by id, like, to send commands to the neoterm 3, one can do :3T ls.
    • DEPRECATE T[N], Topen[N], Tclose[N], Tclear[N], Tkill[N] - The neoterm id was moved to the beginning of the command, so instead of :T2, for example, one must use :2T.
  • 07/03/2018
    • Do not call :bdelete! if buffer does not exist term#destroy was calling neoterm#close which was causing a cyclic call to :bdelete! <neoterm.buffer_id>.
  • 08/03/2018
    • Add vim's terminal support! 🎉🎉🎉
  • 15/03/2018
    • Fix bug where :[N]T wasn't accepting quoted arguments, like: :T echo "ls".
    • Make handlers/callbacks work in vim. Destroy instance when destroying a terminal.
  • 18/03/2018
    • Deprecate g:neoterm_tnew_mod and g:neoterm_position in favor of g:neoterm_default_mod, which will be used for every new neoterm window.
    • Add the feature of the last active neoterm. When sending a command or navigating among neoterms the last one will be marked as the last active and it'll be used by default in the next commands.

About

Wrapper of some vim/neovim's :terminal functions.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages