Giter Site home page Giter Site logo

vmux's Introduction

vim/neovim/kakoune session handler within tmux

Demo

asciicast

Features

  • Each tmux session has its own editor session
  • One global editor session can be started
  • Suports gvim, vim, neovim and kakoune
  • Seamless integration with gvim, vim, nvim, kak through wrapper scripts that directly call vmux - keep your muscle's memory :-)
  • Once a session has been started in one editor, e.g. nvim, the session will be reused even if another editor is called, e.g. vim or kak
  • A new session is started if the old session doesn't exist anymore
  • Automatically select tmux pane running the local or global vim session

Installation

Python3 is required as well as tmux and vim, gvim or nvim.

Via PyPI

Install vmux using pip:

pip install vmux

From Source

Clone the repository and install vmux:

git clone https://github.com/jceb/vmux.git
cd vmux
make DESTDIR=~/.local install

# if wrapper scripts are desired, install them as well
make DESTDIR=~/.local all

# add ~/.local/bin to PATH variable
export PATH="${HOME}/.local/bin:${PATH}"

Usage

Start editor session through vmux or vim.vmux, nvim.vmux and gvim.vmux wrapper scripts:

tmux
vmux MYFILE
# split tmux window
vmux MY_OTHERFILE

Once a session has been started, it doesn't matter anymore which editor has been used. vmux will open every file in the existing session even if a wrapper script of a different editor is used.

Customization

Define default editor:

# export environment variable VMUX_EDITOR, either vim or nvim
export VMUX_EDITOR=nvim

Define path to the real editor executables. This is required if the wrapper scripts are used that will hide the real editors in $PATH.

export VMUX_REALEDITOR_GNVIM=/usr/bin/gnvim
export VMUX_REALEDITOR_GVIM=/usr/bin/gvim
export VMUX_REALEDITOR_KAK=/usr/bin/kak
export VMUX_REALEDITOR_NVIM=/usr/bin/nvim
export VMUX_REALEDITOR_NVIM_QT=/usr/bin/nvim-qt
export VMUX_REALEDITOR_NVR=/usr/bin/nvr
export VMUX_REALEDITOR_VIM=/usr/bin/vim

Define that a global session should be started. One global and multiple local sessions can exists next to one another:

export VMUX_GLOBAL=1

Define that the tmux pane shall not be selected automatically:

export VMUX_NOT_SELECT_PANE=1

Define socket path for nvim:

export VMUX_NVIM_SESSION_DIR=~/.cache/nvim_sessions

Turn on debugging:

export VMUX_DEBUG=1

How it works

When vmux is called, it defines a variable VMUX_SESSION_<ID> that is unique to the current tmux session. The value of the variable is set to <ID> that is used as session name for vim.vmux and nvim.vmux. Furthermore, the global session that is started through gvim.vmux is stored in the environment variables VMUX_SESSION and VMUX_GLOBAL_PANE. The session name is set to global.

Known issues

I noticed with neovim that the session socket doesn't always get removed when it ends. This might causes vmux to permanently fail to start a new session. It can be manually resolved by deleting the stalled socket file in neovim's session folder.

Similar projects

  • tmux-omnivim creates one global session while vmux creates one session per tmux session and it also supports one global session next to multiple local sessions.
  • creates one global
  • neovim-remote tmux-nvr creates one global session while vmux creates one session per tmux session and it also supports one global session next to multiple local sessions.

vmux's People

Contributors

jceb avatar joshbode 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

Watchers

 avatar  avatar  avatar

vmux's Issues

No such group or event: TermOpen

Hi, I'm seeing this error when I open a file:

rror detected while processing /home/farzad/.vim/plugged/vmux.vim/plugin/vmux.vim:
line  125:
E216: No such group or event: TermOpen  * call vmux#term_open()

For now, I've only noticed this issue when opening a .zsh file.
Is there something I can do about this?

Install Error

Hello, Good Afternon

Thanks for your efforts for such a plugin, I think it will help me a lot with my workflow.

During installation It gave the following error, the command I typed is make DESTDIR=~/.local install

cp: illegal option -- t
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
       cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
make: *** [install] Error 64
zsh: exit 2     make DESTDIR=~/.local install

As well with make DESTDIR=~/.local all

make: *** No rule to make target `install-wrapper', needed by `all'.  Stop.
zsh: exit 2     make DESTDIR=~/.local all

Operating System : Mac OS
Directory of installation : ~/

Thanks,
Khalid

Neovim pyenv issues

I've set up virtual environments for neovim's python compatibility. Opening the first nvim instance works fine, filename argument or not. The second call to vmux without a filename opens a new nvim, but if I tack a filename on as an argument it tries to attach to nvim, but the module is missing because its using the default environment Python as opposed to neovim's environment.

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.