Giter Club home page Giter Club logo

vim-tmuxify's Introduction

vim-tmuxify

This is a shiny Vim plugin for handling tmux panes from within Vim!

Features:

  • create/kill associated panes
  • associate tmuxify to already existing panes
  • send visually highlighted lines to the associated pane
  • send to pane by prompting for input
  • send to pane by setting a run command for the current filetype
  • once set, run commands are remembered, but can easily be reset
  • all the plugin configuration happens in one dictionary that holds filetypes as keys and run commands as values

NOTE: This plugin needs tmux 1.6 with a certain patch level. You're safe with versions 1.7+.

Feedback, please!

If you use any of my plugins, star it on github. This is a great way of getting feedback! Same for issues or feature requests.

Thank you for flying mhi airlines. Get the Vim on!

Installation

If you have no preferred installation method, I suggest using tpope's pathogen:

  1. git clone https://github.com/tpope/vim-pathogen ~/.vim/bundle/vim-pathogen
  2. mkdir -p ~/.vim/autoload && cd ~/.vim/autoload
  3. ln -s ../bundle/vim-pathogen/autoload/pathogen.vim

Afterwards, installing tmuxify is as easy as pie:

  1. git clone https://github.com/mhinz/vim-tmuxify ~/.vim/bundle/vim-tmuxify
  2. start Vim
  3. :Helptags
  4. :h tmuxify

Options

Put these variables into your vimrc for great enjoyment. The shown examples are also the default values.

let g:tmuxify_custom_command = 'tmux split-window -d'

Use this option if you want to overwrite that default command for creating a new pane.

(Examples are given in :h tmuxify-options)

let g:tmuxify_map_prefix = '<leader>m'

What to start mappings with. Set it to '' to disable mappings.

let g:tmuxify_run = {}

Set run commands for specific filetypes. '%' will be replaced by the full path to the current buffer.

Example:

let g:tmuxify_run = {
    \ 'sh': 'bash %',
    \ 'go': 'go build %',
    \}

Mappings

<leader>mn

Executes TxCreate. Creates a new pane and associates with it.

<leader>mq

Executes TxKill. Closes the associated pane.

<leader>ms

Executes TxSend. Prompts for input and sends it to the associated pane. This mapping also works on visual selections.

<leader>mr

Executes TxSendKey. Prompts for input and sends it to the associated pane as keys.

<leader>mk

Executes TxRun. Prompts for input if there is no entry in g:tmuxify_run for the current filetype. '%' will be replaced by the full path to the current buffer.

<leader>mt

Executes TxSetRunCmd. Change the run command for the current filetype.

<leader>mp

Executes TxSetPane. Associate an already existing pane with tmuxify. Note: You can use tab completion here.

<leader>mc

Executes TxClear. Sends ctrl+l to the associated pane.

<leader>mb

Executes TxSigInt. Sends ctrl+c to the associated pane.

Documentation

:h tmuxify

Author

Marco Hinz <[email protected]>

James Baumgarten (current maintainer)

License

Copyright © Marco Hinz. Distributed under the same terms as Vim itself. See :help license.

vim-tmuxify's People

Contributors

greenyouse avatar jebaum avatar mattboehm avatar mhinz avatar phongnh avatar tommcdo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vim-tmuxify's Issues

Maintenance?

There's a couple untriaged issues and pull requests. Need an extra hand managing the repo?

Problem when attaching to named sessions

Hi,

If I have a sessions with a window inside, named as DEV/2 and has a single pane named CONSOLE, I am not able to connect to those using the :TxSetPane command.

I get the following error.

Session:Window.Pane> DEV/2:0.0Error detected while processing function tmuxify#pane_set:
line   20:
E687: Less targets than List items

Is there a way to fix that? If the window is not named, then the index is 0:0.1 and it works.

Incompatible with tmux 1.8?

Hi, I get an error when trying to do <leader>ms:

Error detected while processing function tmuxify#pane_send:                                                         
line   22:
tmuxify: A certain version of tmux 1.6 or higher is needed. Consider updating to 1.7+.

I'm using the latest version of vim-tmuxify from this repo, and tmux is version 1.8:

$ tmux -V
tmux 1.8

Did tmux 1.8 break your plugin?

Thanks,
Brendan

Non-interactive send command to pane

I'd like to make a hotkey to send a command to the current pane. I don't want to be prompted for this command nor do I want it to change the 'current run' command. Is this possible?

Name of the active buffer does not update when switching between files of the same filetype

% in tmuxify_run does not expand to the name of the active buffer but to the first buffer of each filetype. Even killing that buffer with :bd will result in the first one to be returned.

Basically the active buffer is fetched only once for each filetype.

buf
The pane association works fine (first echos via <Leader>ms),
but switching between the splits and running <Leader>mr always executes the first script.

let g:tmuxify_run = {
\ 'sh': 'bash %',
\ 'fortune': 'strfile %'
\ }

Semi-colons are not sent by :TxSend

When sending a visual selection through :TxSend (using the mapping), trailing semi-colons seem to be ignored. Adding whitespace after the semi-colon causes it to be sent, however.

When using :TxSend (from the mapping) in normal mode, it seems that a line ending in a semi-colon is entirely ignored, again, unless there is trailing whitespace.

Error detected for pane_send: E117: Unknown function: systemlist

I just installed vim-tmuxify on vim 7.4 patch 1-52 on Ubuntu 14.04. However, when I run TxSend, I get an error saying the function 'systemlist' is unknown. I'm assuming 'systemlist' is a function in newer versions of vim. Is it possible to have support for older versions of vim?
tmuxify-error

Conflict with vim-tmux-navigator

Hello there :)

First of all thank you for the plugin. It's working really well!!

Unfortunately it stops functioning when I install vim-tmux-navigator...

I think vim-tmux-navigator is kind of a hack but it does work quite nicely and would, in my opinion, compliment tmuxify if the two could work together.

best wishes,

Dionysis

Associate panes in other sessions/windows

Associating a pane with :TxSetPane prompts for session and window, but seems to ignore it. It would be nice to be able to associate to an existing pane in another window.

new pane per file

Hi! Thank for the great plugin!

Anyway, I have this issue with it. when I send a command with ms, it creates a pane and runs the command well. But when I go to another file, without closing that pane (mq) and try to repeat this motion, the plugin creates new pane instead of send second command to the prev pane.
Sometimes, when the pane was closed, I get this error 'the associated pane was already closed!' on ms.

Maybe I don't understand correctly the behavior of the plugin and try to use it wrong way, but I need this functionality: I have several mappings m1-m9 with a command per one. for example m1 - runs tests, m4 - runs build, etc.
So I try this:
nmap <leader>m1 <leader>ms <c-r>r/gradlew test<cr>

Is there a way to handle this with your plugin? Thanks for an answer!

Make mappings configurable

Make an option like g:tmuxify_mapping_prefix="<leader>m" that allows users to change tmuxify mappings.

If you agree that this is a reasonable feature, I'm happy to implement it myself and submit a PR.

Allow to specify size of tmux window as a percentage

Currently window sizes seem to be specified using -l option, which specify the size in either lines or cells depending on if you split horizontally or vertically. This isn't optimal, at least not for me. Using the -p option allow one to specify the size as a percentage, i.e., -p 50 would be 50% of the screen size.

:TxSetPane doesn't take arguments

I think it would be really helpful if :TxSetPane would accept arguments in the form of paneids like :TxSetPane %2 or :TxSetPane 1:1.1 rather than forcing the user to user vim's menu

conflict with NerdTree

everything is work perfectly when you use only one tab, if you open another tab with NERDTee tabnew, TxSend and others won't work in the second tab. It shows some errores in vim:
"E121: Undefined variable: b:tmuxified" and
"E15: Invalide expression: !b:tmuxified || !exists('b:pane_id) || (b:pane_id != s:pane_get_id(b:pane_num)).

You've done the great job, this is a great plugin for vim, I like it so much BTW.

:TxSend with tabs invokes tab-completion

If :TxSend is invoked with text containing tabs, since the tabs are sent literally to the associated pane, they invoke tab-completion (where applicable). I'm not sure if this is considered desired behaviour or not.

I think a decent solution would be converting tabs to spaces before sending it to tmux.

:TxSend(@m) failing on tmux 1.6

Calling :TxSend("foo") results in the following system call:

tmux send-keys -t 1 -l 'foo' && tmux send-keys -t '. pane_num .' C-m'

The :TxSend fails silently, but by running this command in a shell, I see the error:

tmux: unknown option -- l

I'm running tmux 1.6 on ubuntu 12.04. I suspect that this is a bug/invalid flag for this version of tmux.

A few suggestions:

  • look for a workaround or add a minimum required version number for tmux in the docs
  • commands shouldn't fail silently

I'm happy to take a stab at this but wanted your feedback first.

Easier way to integrate with an existing tmux pane

I open vim. I setup a tmux-pane which Vim can talk to with <Leader>mn and run a command using <Leader>mr. I then go ahead and create a split (in Vim) and run <Leader>mr which result in a new tmux-pane being created unless I bind to it using <Leader>mp first.

Could we improve this in some way? I think it's more natural to assume that you want to talk to the current tmux-pane and that you should specify otherwise if not.

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.