neoterm
__ _ _______ _____ _______ _______ ______ _______, \, ______, ______, _____/, \_, ______, _____, ______, \_, ```
Use the same terminal for everything. The main reason for this plugin is to
reuse the terminal easily. All commands open a terminal if one does not already
exist. REPL commands open a terminal and the proper REPL if not already opened.
- Neovim/Vim terminal helper functions/commands.
- Wraps REPLs to receive current file, line or selection.
- Multiple terminal support:
- 
## Installation
### 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:
```vim
[Plugin, Plug, ...] 'kassio/neoterm'
See the your plugin manager documentation for more information.
Manual
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
Windows
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.
test libs (removed on 05/Feb/2017)
This feature was removed on 05/Feb/2017, please consider using vim-test with
neoterm strategy to replace this feature.
REPL
TREPLSendFile: sends the current file to a REPL in a terminal.TREPLSendLine: sends the current line to a REPL in a terminal.TREPLSendSelection: sends the selection 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.
Supported REPLs
- Clojure:
lein repl - Elixir:
iexandiex -S mix(ifconfig/config.exsexists) - GNU Octave:
octave- For Octave 4.0.0 and later, you can enable Qt widgets (dialogs, plots, etc.)
usingg:neoterm_repl_octave_qt = 1
- For Octave 4.0.0 and later, you can enable Qt widgets (dialogs, plots, etc.)
- Haskell:
ghci - Idris:
idris - JavaScript:
node - Julia:
julia - LFE:
lfe - Lua with
luaandluap. - MATLAB:
matlab -nodesktop -nosplash - PARI/GP:
gp - PHP:
g:neoterm_repl_phpandpsyshandphp - Python:
ipythonandpython - R / R Markdown:
R - Racket:
racket - Rails:
bundle exec rails console - Ruby:
pryandirb - SML:
rlwrap smlorsml - Scala:
sbt console - TCL:
tclsh
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
.jlfiles, which are detected asfiletipe=lisp - Idris
.idr,.lidrfiles which are not recognised as any filetype - LFE
.lfefiles, which are not recognized 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
au VimEnter,BufRead,BufNewFile *.lfe, set filetype=lfe
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 toneoterm-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 to add REPLs and other features to this plugin. :smiley:
Changelog
- 11/11/2019
- Fix bug with
g:neoterm_fixedsize. (#255)
- Fix bug with
- 07/11/2019
- 01/09/2019
- 20/08/2019
- Destroy managed neoterm buffer loaded from session
- Refactor the neoterm target function, the function the retrieves the desired
neoterm to act on, to its own autoload function set (neoterm#target#). - Only manage neoterm terminals with
TermOpen. (#243)
- 19/08/2019
- Only use
TermOpenwhen it' available. (#243)
- Only use
- 18/08/2019
- Enable neoterm to manage any terminal buffer. The TermOpen event is being
used to associate neovim terminal with neoterm. - Remove deprecated
g:neoterm_open_in_all_tabsand fix
g:neoterm_term_per_tab(#237). - Better message when trying to execute a command on an already closed
neoterm. Instead of show the error stacktrace just shows the message:
"neoterm-X not found (probably already closed)" (#242)
- Enable neoterm to manage any terminal buffer. The TermOpen event is being
- 21/06/2019
- Fix bug with window resizing for non-default mods (#239).
- 07/06/2019
g:neoterm_keep_term_openkeeps hidden terminals open even if they are
closed without using:Tclose
- 11/03/2019
- Make the
signcolumn=autoin neoterm buffer.
- Make the
- 29/01/2019
- Improve
g:neoterm_open_in_all_tabsdocumentation.
- Improve
- 21/12/2018
- Add
g:neoterm_term_per_tab, a way to send the commands to the term
associated to the vim tab. - fix
:Topenwithoutg:neoterm_default_modwasn't re-opening neoterm
buffer.
- Add
- 17/11/2018
- add
:Tclear!, this will clear the neoterm buffer scrollback (history)
- add
- 12/11/2018
- Use
chansendinstead ofjobsend, which was deprecated.
- Use
- 12/11/2018
- Fix
E119: Not enough arguments for function: <SNR>112_repl_result_handler
- Fix
- 09/11/2018
- Yet another work with '%' expandability.
- '%' will be expanded to the current file path, respect g:neoterm_use_relative_path;
- '%' will be expanded to '%', not the current file path, useful in Windows.
- Yet another work with '%' expandability.
- 20/07/2018
\%Will not expand the%. (Escaping the%)
- 03/03/2018
- DEPRECATE g:neoterm_split_on_tnew -
:Tnewnow accepts vim mods (:help mods). - Introduce
g:neoterm_tnew_modto set a default:Tnewmod (:help mods). - Revamp
:Topen. Now:[mods][N]Topenaccepts 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]Ttoggleand also make it accepts the neoterm id.
- DEPRECATE g:neoterm_split_on_tnew -
- 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.
- Revamp
- 07/03/2018
- Do not call
:bdelete!if buffer does not existterm#destroywas calling
neoterm#closewhich was causing a cyclic call to:bdelete! <neoterm.buffer_id>.
- Do not call
- 08/03/2018
- Add vim's terminal support! ???
- 15/03/2018
- Fix bug where
:[N]Twasn't accepting quoted arguments, like:
:T echo "ls". - Make handlers/callbacks work in vim. Destroy instance when destroying a
terminal.
- Fix bug where
- 18/03/2018
- Deprecate
g:neoterm_tnew_modandg:neoterm_positionin 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.
- Deprecate