# Introduction The purpose of this plugin is to mainly be a quick and easy way to send text from a buffer into an active terminal session. The plugin converts leading tabs to spaces so that bash doesn't try to interpret it via its readline for autocompletion. It comes with a help file so be sure to consult it when something isn't clear. ## Reasoning I found that I really just needed to be able to quickly evaluate some PSQL functions and commands. Mainly to test things inside a `chroot`. After some testing though, I realized that it just worked for other repls too. For example, this can be also easily used with sbcl (lisp), python, ocaml, bash, and pretty much any repl capable of multiline input processing. It is a very small and handy plugin. Your vim installation must be compiled with the +perl flag since it uses perl to accomplish some formating. # Demo https://www.youtube.com/watch?v=j8QnTPhQMKo # Installation ## Manual installation Copy `plugin/fancyterm.vim` and `doc/fancyterm.txt` and `doc/tags` into a plugin directory in your runtime path ## Pathogen Clone the repo into `~/.vim/bundle/` Run `:Helptags` to generate the tags for the help file. ## Vim bulit-in packages Clone the repository to path like ``` git clone ~/.vim/pack/plugins/opt/fancyterm/` ``` Replace the actuall url of this repository. And add the following to your `.vimrc` file ``` packadd fancyterm ``` If you don't want the default bindings you can also write right before ``` let g:fancyterm_map_keys = 0 packadd fancyterm ``` Make sure to read the help file with `:help fancyterm` to understand how to configure your bindings or consult this READMEs **Rebinding keys** section. # Usage Type `:Term` into your vim command line to spawn a terminal. Then use the provided keybindings to send the buffer, line, or visual selection into the terminal to be evaluated. Typing `:Term` after a terminal has already been started, will cause the new terminal to be associated with the commands and the previous one abandoned. For example, to send the whole buffer, switch to normal mode and press `a` This sends the whole buffer into the active terminal session. Pressing `.` sends only the current line from the cursors position. Doing `v` sends the selected visual text into the terminal. These are just the default keybindings and can be disabled by setting `let g:fancyterm_map_keys = 0` in your `.vimrc` file If you do this, you have to map the keys manually or call the functions directly. ## Rebinding keys The following are the default key bindings, you can bind these functions to any key you wish. ``` nnoremap . :call TermSendCurrentLine() nnoremap a :call TermSendBuffer() vnoremap v :call TermSendVisual() ``` # LICENSE MIT, see LICENSE file for more information. .