forked from Archives/vimux
Compare commits
228 Commits
Author | SHA1 | Date |
---|---|---|
|
a62c16c8c3 | 2 years ago |
|
3c0a1708dc | 2 years ago |
|
616fcb4799 | 2 years ago |
|
2344b96fed | 2 years ago |
|
076e13b77c | 2 years ago |
|
740320b798 | 2 years ago |
|
3daa0e91f0 | 2 years ago |
|
89604a4464 | 3 years ago |
|
028897b6fb | 3 years ago |
|
031cc6208e | 3 years ago |
|
853646aef3 | 3 years ago |
|
55a470dc0d | 3 years ago |
|
a1650d5f9b | 3 years ago |
|
ee0dfae330 | 3 years ago |
|
ee3075ad30 | 3 years ago |
|
96a47f7895 | 3 years ago |
|
708ce200d5 | 3 years ago |
|
a70218b30c | 3 years ago |
|
59b1d28f80 | 3 years ago |
|
784b2834c7 | 3 years ago |
|
29d46f6bc1 | 3 years ago |
|
7d977a2954 | 3 years ago |
|
c4adf57f6e | 3 years ago |
|
54d24d1694 | 3 years ago |
|
5b1791673c | 3 years ago |
|
3bfe0ea285 | 3 years ago |
|
9dd1b68b59 | 3 years ago |
|
f02fa9c161 | 3 years ago |
|
fb43fcbc16 | 3 years ago |
|
1b38911c40 | 3 years ago |
|
9214bf9578 | 3 years ago |
|
f293536dd5 | 3 years ago |
|
f1c27deeaa | 3 years ago |
|
cac9d11158 | 3 years ago |
|
8cc4fe9678 | 3 years ago |
|
f4df4c9b5b | 3 years ago |
|
29c5b39545 | 3 years ago |
|
576b24c7a0 | 3 years ago |
|
992d525ef9 | 3 years ago |
|
566833e291 | 3 years ago |
|
43681e9f91 | 3 years ago |
|
601749152e | 3 years ago |
|
b13568ea1b | 3 years ago |
|
748b54b885 | 3 years ago |
|
5f999f4dc4 | 3 years ago |
|
3a1aad8752 | 3 years ago |
|
a2ab8880a1 | 3 years ago |
|
ed12df373a | 3 years ago |
|
efe04f05dc | 3 years ago |
|
486ac1bd6e | 3 years ago |
|
0e3ebca98b | 3 years ago |
|
bde8b4cb37 | 3 years ago |
|
c212352f93 | 3 years ago |
|
f589e21472 | 3 years ago |
|
a5a17b8e32 | 3 years ago |
|
e6fb662bf1 | 3 years ago |
|
925ae23b42 | 3 years ago |
|
3693ec6f12 | 3 years ago |
|
af602e362d | 3 years ago |
|
0f5fd2ce49 | 3 years ago |
|
57bbdc4478 | 3 years ago |
|
cce8466613 | 3 years ago |
|
71f28c8296 | 3 years ago |
|
48b541b1a4 | 3 years ago |
|
ef5622f225 | 3 years ago |
|
7f15726b07 | 3 years ago |
|
9c05307141 | 3 years ago |
|
46377b8ab9 | 3 years ago |
|
8fa6ca92c0 | 3 years ago |
|
1dec7164ca | 3 years ago |
|
fff2f1a686 | 3 years ago |
|
f48360cea6 | 3 years ago |
|
02315b02c4 | 3 years ago |
|
67bd945586 | 5 years ago |
|
556a2d692b | 5 years ago |
|
3fdafcfd60 | 5 years ago |
|
37f41195e6 | 7 years ago |
|
020a5eed02 | 7 years ago |
|
1adbef72d2 | 7 years ago |
|
212a34e5f9 | 7 years ago |
|
198c8ea8ca | 7 years ago |
|
9c3195a0be | 7 years ago |
|
9f81329f60 | 7 years ago |
|
0a560ba419 | 7 years ago |
|
ca96cac46b | 7 years ago |
|
edc24ff4d3 | 7 years ago |
|
f3a919e86f | 7 years ago |
|
8cb0416401 | 7 years ago |
|
bbe6a597cd | 7 years ago |
|
1b847e6d6a | 8 years ago |
|
2285cefee9 | 9 years ago |
|
1b9db6392f | 9 years ago |
|
1d652fdc0c | 9 years ago |
|
770ae77092 | 9 years ago |
|
bc11e401f1 | 9 years ago |
|
5e760def05 | 9 years ago |
|
40d9f74db6 | 9 years ago |
|
8c332d9919 | 9 years ago |
|
21d7a34172 | 9 years ago |
|
4153ba4987 | 9 years ago |
|
863e813928 | 9 years ago |
|
a1db73079f | 9 years ago |
|
70e16b73f5 | 9 years ago |
|
24e9d354a4 | 10 years ago |
|
a991ce8abd | 10 years ago |
|
7b655a7b5c | 10 years ago |
|
50254fad43 | 10 years ago |
|
01c0679223 | 10 years ago |
|
be6b83cfa4 | 10 years ago |
|
d21337e01a | 10 years ago |
|
c56e3f79e1 | 10 years ago |
|
5a530ca8e4 | 10 years ago |
|
a772fce3e2 | 10 years ago |
|
d78cd0f8e1 | 10 years ago |
|
ab6941c2c5 | 10 years ago |
|
1c3ca9e267 | 10 years ago |
|
e5a9eb74da | 10 years ago |
|
3135ab5e30 | 10 years ago |
|
b437d32c1b | 10 years ago |
|
b60a52d36c | 10 years ago |
|
fbb873a265 | 10 years ago |
|
54858144f9 | 10 years ago |
|
cf6b8c08db | 10 years ago |
|
a04b07992d | 10 years ago |
|
6594afdcd0 | 10 years ago |
|
905e002c81 | 10 years ago |
|
4cea1a1b84 | 10 years ago |
|
cae215041d | 10 years ago |
|
602b2bc39c | 10 years ago |
|
3f3ef11f40 | 10 years ago |
|
d306d43a59 | 11 years ago |
|
8ff22883bd | 11 years ago |
|
94b8b938b2 | 11 years ago |
|
17358e51ab | 11 years ago |
|
ba2b2050b0 | 11 years ago |
|
ff54646761 | 11 years ago |
|
efa6a9aa4b | 11 years ago |
|
dfe4fa0b9e | 11 years ago |
|
9855936bd1 | 11 years ago |
|
2e9b00b276 | 11 years ago |
|
e7c2413f30 | 11 years ago |
|
f56788990d | 11 years ago |
|
1e30ed8065 | 11 years ago |
|
6a7fcccb6b | 11 years ago |
|
40e93b511f | 11 years ago |
|
53477b16c9 | 11 years ago |
|
a74b089c92 | 11 years ago |
|
6fb5977ef7 | 11 years ago |
|
3cada36538 | 11 years ago |
|
7212ae4ee8 | 11 years ago |
|
aa8a444609 | 11 years ago |
|
49a048e94e | 11 years ago |
|
635b800f22 | 11 years ago |
|
be0a60ec70 | 11 years ago |
|
0228508f54 | 11 years ago |
|
42772b79d3 | 11 years ago |
|
71b2ac31de | 11 years ago |
|
1a0a8abe71 | 11 years ago |
|
70433ed91b | 11 years ago |
|
7c54b7af6a | 11 years ago |
|
064ca8693a | 11 years ago |
|
d99e30cc9b | 11 years ago |
|
6dd26fe7c3 | 11 years ago |
|
b409314c80 | 11 years ago |
|
3f930159a2 | 11 years ago |
|
a6889b4bf4 | 11 years ago |
|
6e909a2439 | 11 years ago |
|
173fcda85d | 11 years ago |
|
e729607de6 | 11 years ago |
|
35c54c0801 | 11 years ago |
|
e5602b90a5 | 11 years ago |
|
63ad5424d8 | 11 years ago |
|
8e091d6d5e | 11 years ago |
|
51ee1a3c6d | 11 years ago |
|
9a410c5158 | 12 years ago |
|
46634b7bf7 | 12 years ago |
|
eab15dc06e | 12 years ago |
|
81426978b4 | 12 years ago |
|
06d75cb797 | 12 years ago |
|
d6d88a4fce | 12 years ago |
|
56bcbb0a5f | 12 years ago |
|
8fb2563918 | 12 years ago |
|
c4eccfcaff | 12 years ago |
|
dd1c213e4d | 12 years ago |
|
201964f046 | 12 years ago |
|
d6eb9e5f04 | 12 years ago |
|
908358a09a | 12 years ago |
|
c5216bb345 | 12 years ago |
|
e0146a05fd | 12 years ago |
|
ea99609f56 | 12 years ago |
|
4f13e27deb | 12 years ago |
|
a221eb2f79 | 12 years ago |
|
539580e5fe | 12 years ago |
|
dc4a45dcbf | 12 years ago |
|
4a8e31f8b9 | 12 years ago |
|
6b8d484dfe | 12 years ago |
|
81b73a9639 | 12 years ago |
|
9a0739b117 | 12 years ago |
|
e4da4bb5f8 | 12 years ago |
|
ffc2185cb9 | 12 years ago |
|
f476177ad1 | 12 years ago |
|
a91e177801 | 12 years ago |
|
0eefeff876 | 12 years ago |
|
90129466fa | 12 years ago |
|
8402015a9e | 12 years ago |
|
ec898ca9b5 | 12 years ago |
|
642ea420ba | 12 years ago |
|
dbdee1c224 | 12 years ago |
|
1bc5f5ba85 | 12 years ago |
|
8a20aec379 | 12 years ago |
|
346f67906c | 12 years ago |
|
7f65c9c3aa | 12 years ago |
|
c57660b8ad | 12 years ago |
|
0cf661c5f4 | 12 years ago |
|
39678261e9 | 12 years ago |
|
597581715c | 12 years ago |
|
c853343e6f | 12 years ago |
|
06ba414a32 | 12 years ago |
|
b9684aa6d8 | 12 years ago |
|
e925b0e127 | 12 years ago |
|
252693ec57 | 12 years ago |
|
de99c54046 | 12 years ago |
|
62ded6f281 | 12 years ago |
|
f0bdd95be3 | 12 years ago |
|
4f90d43915 | 12 years ago |
|
d75780aa84 | 12 years ago |
|
64a5ebe875 | 12 years ago |
|
55f6c1f393 | 12 years ago |
@ -0,0 +1,43 @@
|
|||||||
|
name: Check
|
||||||
|
on: [push, pull_request]
|
||||||
|
jobs:
|
||||||
|
check:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
osFlavor: [ubuntu-20.04, ubuntu-18.04]
|
||||||
|
vimFlavor: [neovim, vim]
|
||||||
|
vimVersion: [stable, unstable]
|
||||||
|
exclude:
|
||||||
|
- vimFlavor: vim
|
||||||
|
vimVersion: unstable
|
||||||
|
runs-on: ${{ matrix.osFlavor }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Enable Universe package repository
|
||||||
|
run: |
|
||||||
|
sudo add-apt-repository ${{ matrix.vimVersion == 'stable' && 'universe' || 'ppa:neovim-ppa/unstable' }}
|
||||||
|
sudo apt-get update
|
||||||
|
- name: Install tmux and ${{ matrix.vimFlavor }}
|
||||||
|
run: |
|
||||||
|
sudo apt-get install tmux ${{ matrix.vimFlavor }}
|
||||||
|
- name: Review versions
|
||||||
|
run: |
|
||||||
|
tmux -V
|
||||||
|
${{ matrix.vimFlavor == 'neovim' && 'nvim' || 'vim' }} --version
|
||||||
|
# This tests looks for two thigs:
|
||||||
|
# * That VIM doesn't hang. If it succedes it will quit quickly. If 5
|
||||||
|
# seconds later the tmux session is still running either the runner pane
|
||||||
|
# didn't get closed or (more likely) we threw some error and VIM is
|
||||||
|
# sitting there expecting us to acknowledge the message(s).
|
||||||
|
# * That VIM exited normally. This check isn't very useful since :qa
|
||||||
|
# never bubbles up an error, but if someday we use :cq for a test being
|
||||||
|
# ready to check the exit code seems like a good thing.
|
||||||
|
- name: "Try Vimux"
|
||||||
|
run: |
|
||||||
|
ec="$(mktemp)"
|
||||||
|
tmux new -s ci -d "${{ matrix.vimFlavor == 'neovim' && 'nvim -u /dev/null --headless' || 'vim' }} -i NONE \"+so plugin/vimux.vim\" \"+VimuxRunCommand('date')\" \"+VimuxCloseRunner | qa\"; echo \$? > '$ec'"
|
||||||
|
sleep 5
|
||||||
|
tmux kill-session -t ci && exit 1
|
||||||
|
exit "$(cat $ec)"
|
@ -0,0 +1,13 @@
|
|||||||
|
name: Reviewdog
|
||||||
|
on: [pull_request]
|
||||||
|
jobs:
|
||||||
|
vint:
|
||||||
|
name: vint
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: vint
|
||||||
|
uses: reviewdog/action-vint@v1
|
||||||
|
with:
|
||||||
|
github_token: ${{ secrets.github_token }}
|
||||||
|
reporter: github-pr-review
|
@ -0,0 +1,15 @@
|
|||||||
|
name: Vint
|
||||||
|
on: [push]
|
||||||
|
jobs:
|
||||||
|
vint:
|
||||||
|
name: vint
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Set up Python
|
||||||
|
uses: actions/setup-python@v2
|
||||||
|
- name: Setup dependencies
|
||||||
|
run: pip install vim-vint
|
||||||
|
- name: Lint Vimscript
|
||||||
|
run: vint .
|
@ -0,0 +1 @@
|
|||||||
|
doc/tags
|
@ -0,0 +1,5 @@
|
|||||||
|
cmdargs:
|
||||||
|
severity: style_problem
|
||||||
|
color: true
|
||||||
|
env:
|
||||||
|
neovim: false
|
@ -0,0 +1,21 @@
|
|||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2012-2021 Benjamin Mills
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
@ -0,0 +1,40 @@
|
|||||||
|
# Vimux: easily interact with tmux from vim
|
||||||
|
|
||||||
|
[![Vint](https://github.com/preservim/vimux/workflows/Vint/badge.svg)](https://github.com/preservim/vimux/actions?workflow=Vint)
|
||||||
|
[![Check](https://github.com/preservim/vimux/workflows/Check/badge.svg)](https://github.com/preservim/vimux/actions?workflow=Check)
|
||||||
|
|
||||||
|
![vimux](https://www.braintreepayments.com/blog/content/images/blog/vimux3.png)
|
||||||
|
|
||||||
|
Vimux was originally inspired by [tslime.vim](https://github.com/jgdavey/tslime.vim/network), a plugin that lets you send input to tmux. While tslime.vim works well, it wasn't optimized for the use case of having a smaller tmux pane used to run tests or play with a REPL. The goal of Vimux is to make interacting with tmux from vim effortless.
|
||||||
|
|
||||||
|
By default, when you call `VimuxRunCommand` vimux will create a 20% tall horizontal pane under your current tmux pane and execute a command in it without losing the focus on vim. Once that pane exists, whenever you call `VimuxRunCommand` again the command will be executed in that pane. A frequent use case is wanting to rerun commands over and over. An example of this is running the current file through rspec. Rather than typing that over and over `VimuxRunLastCommand` will execute the last command called with `VimuxRunCommand`.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
With **[vim-bundle](https://github.com/preservim/vim-bundle)**: `vim-bundle install preservim/vimux`
|
||||||
|
With **[Vundle](https://github.com/gmarik/Vundle.vim)**: `Plugin 'preservim/vimux'` in your .vimrc
|
||||||
|
|
||||||
|
Otherwise download the latest [tarball](https://github.com/preservim/vimux/tarball/master), extract it and move `plugin/vimux.vim` inside `~/.vim/plugin`. If you're using [pathogen](https://github.com/tpope/vim-pathogen), then move the entire folder extracted from the tarball into `~/.vim/bundle`.
|
||||||
|
|
||||||
|
_Notes:_
|
||||||
|
|
||||||
|
* Vimux assumes a reasonably new version of tmux. Some older versions might work but it is recommended to use the latest stable release.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
The full documentation is available [online](https://raw.github.com/preservim/vimux/master/doc/vimux.txt) and accessible inside vim via `:help vimux`
|
||||||
|
|
||||||
|
## Platform-specific Plugins
|
||||||
|
|
||||||
|
* [vim-vroom](https://github.com/skalnik/vim-vroom) runner for rspec, cucumber and test/unit; vimux support via `g:vroom_use_vimux`
|
||||||
|
* [vimux-ruby-test](https://github.com/pgr0ss/vimux-ruby-test) a set of commands to easily run ruby tests
|
||||||
|
* [vimux-cucumber](https://github.com/cloud8421/vimux-cucumber) run Cucumber Features through Vimux
|
||||||
|
* [vim-turbux](https://github.com/jgdavey/vim-turbux) Turbo Ruby testing with tmux
|
||||||
|
* [vimux-pyutils](https://github.com/julienr/vimux-pyutils) A set of functions for vimux that allow to run code blocks in ipython
|
||||||
|
* [vimux-nose-test](https://github.com/pitluga/vimux-nose-test) Run nose tests in vimux
|
||||||
|
* [vimux-golang](https://github.com/benmills/vimux-golang) Run go tests in vimux
|
||||||
|
* [vimux-zeus](https://github.com/jingweno/vimux-zeus) Run zeus commands in vimux
|
||||||
|
* [vimix](https://github.com/spiegela/vimix) Run Elixir mix commands in vimux
|
||||||
|
* [vimux-cargo](https://github.com/jtdowney/vimux-cargo) run rust tests and projects using cargo and vimux
|
||||||
|
* [vimux-bazel-test](https://github.com/pgr0ss/vimux-bazel-test) Run bazel tests in vimux
|
||||||
|
* [vimux-jest-test](https://github.com/tyewang/vimux-jest-test) Run jest tests in vimux
|
@ -1,132 +0,0 @@
|
|||||||
# vimux
|
|
||||||
|
|
||||||
Easily interact with tmux from vim. This project is still in development, so some features are still missing.
|
|
||||||
|
|
||||||
What inspired me to write vimux was [tslime.vim](https://github.com/kikijump/tslime.vim), a plugin that lets you send input to tmux. While tslime.vim works well, I felt it wasn't optimized for my primary use case which was having a smaller tmux pane that I would use to run tests or play with a REPL.
|
|
||||||
|
|
||||||
My goal with vimux is to make interacting with tmux from vim effortless. By default when you call `RunVimTmuxCommand` vimux will create a 20% tall horizontal pane under your current tmux pane and execute a command in it without losing focus of vim. Once that pane exists whenever you call `RunVimTmuxCommand` again the command will be executed in that pane. As I was using vimux myself I wanted to rerun commands over and over. An example of this was running the current file through rspec. Rather than typing that over and over I wrote `RunLastVimTmuxCommand` that will execute the last command you called with `RunVimTmuxCommand`.
|
|
||||||
|
|
||||||
Other auxiliary functions and the ones I talked about above can be found bellow with a full description and example key binds for your vimrc.
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
With **[vim-bundle](https://github.com/benmills/vim-bundle)**: `vim-bundle install benmills/vimux`
|
|
||||||
|
|
||||||
Otherwise download the latest [tarball](https://github.com/benmills/vimux/tarball/master), extract it and move `plugin/vimux.vim` inside `~/.vim/plugin`. If you're using [pathogen](https://github.com/tpope/vim-pathogen), then move the entire folder extracted from the tarball into `~/.vim/bundle`.
|
|
||||||
|
|
||||||
## Platform-specific Plugins
|
|
||||||
|
|
||||||
* [vimux-ruby-test](https://github.com/pgr0ss/vimux-ruby-test) a set of commands to easily run ruby tests
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
### RunVimTmuxCommand
|
|
||||||
Run a system command in a small horizontal split bellow the current pane vim is in.
|
|
||||||
|
|
||||||
```viml
|
|
||||||
" Run the current file with rspec
|
|
||||||
map <Leader>rb :call RunVimTmuxCommand("clear; rspec " . bufname("%"))<CR>
|
|
||||||
```
|
|
||||||
|
|
||||||
### PromptVimTmuxCommand
|
|
||||||
Prompt for a command and run it in a small horizontal split bellow the current pane.
|
|
||||||
|
|
||||||
```viml
|
|
||||||
" Prompt for a command to run
|
|
||||||
map <Leader>rp :PromptVimTmuxCommand<CR>
|
|
||||||
```
|
|
||||||
|
|
||||||
### RunLastVimTmuxCommand
|
|
||||||
Run the last command executed by `RunVimTmuxCommand`
|
|
||||||
|
|
||||||
```viml
|
|
||||||
" Run last command executed by RunVimTmuxCommand
|
|
||||||
map <Leader>rl :RunLastVimTmuxCommand<CR>
|
|
||||||
```
|
|
||||||
|
|
||||||
### InspectVimTmuxRunner
|
|
||||||
Move into the tmux runner pane created by `RunVimTmuxCommand` and enter copy mode (scroll mode).
|
|
||||||
|
|
||||||
```viml
|
|
||||||
" Inspect runner pane
|
|
||||||
map <Leader>ri :InspectVimTmuxRunner<CR>
|
|
||||||
```
|
|
||||||
|
|
||||||
### CloseVimTmuxPanes
|
|
||||||
Close all other tmux panes in the current window.
|
|
||||||
|
|
||||||
```viml
|
|
||||||
" Close all other tmux panes in current window
|
|
||||||
map <Leader>rx :CloseVimTmuxPanes<CR>
|
|
||||||
```
|
|
||||||
|
|
||||||
### InterruptVimTmuxRunner
|
|
||||||
Interrupt any command that is running inside the runner pane.
|
|
||||||
|
|
||||||
```viml
|
|
||||||
" Interrupt any command running in the runner pane
|
|
||||||
map <Leader>rs :InterruptVimTmuxRunner<CR>
|
|
||||||
```
|
|
||||||
|
|
||||||
### Full Keybind Example
|
|
||||||
|
|
||||||
```viml
|
|
||||||
" Run the current file with rspec
|
|
||||||
map <Leader>rb :call RunVimTmuxCommand("clear; rspec " . bufname("%"))<CR>
|
|
||||||
|
|
||||||
" Prompt for a command to run
|
|
||||||
map <Leader>rp :PromptVimTmuxCommand<CR>
|
|
||||||
|
|
||||||
" Run last command executed by RunVimTmuxCommand
|
|
||||||
map <Leader>rl :RunLastVimTmuxCommand<CR>
|
|
||||||
|
|
||||||
" Inspect runner pane
|
|
||||||
map <Leader>ri :InspectVimTmuxRunner<CR>
|
|
||||||
|
|
||||||
" Close all other tmux panes in current window
|
|
||||||
map <Leader>rx :CloseVimTmuxPanes<CR>
|
|
||||||
|
|
||||||
" Interrupt any command running in the runner pane
|
|
||||||
map <Leader>rs :InterruptVimTmuxRunner<CR>
|
|
||||||
```
|
|
||||||
|
|
||||||
### tslime replacement
|
|
||||||
|
|
||||||
Here is how to use vimux to send code to a REPL. This is similar to tslime. First, add some helpful mappings.
|
|
||||||
|
|
||||||
```viml
|
|
||||||
|
|
||||||
" Prompt for a command to run
|
|
||||||
map <LocalLeader>vp :PromptVimTmuxCommand<CR>
|
|
||||||
|
|
||||||
" If text is selected, save it in the v buffer and send that buffer it to tmux
|
|
||||||
vmap <LocalLeader>vs "vy :call RunVimTmuxCommand(@v)<CR>
|
|
||||||
|
|
||||||
" Select current paragraph and send it to tmux
|
|
||||||
nmap <LocalLeader>vs vip<LocalLeader>vs<CR>
|
|
||||||
```
|
|
||||||
|
|
||||||
Now, open a clojure file. Let's say your leader is backslash (\). Type \vp, and then type lein repl at the prompt. This opens a tmux split running a REPL. Then, select text or put the cursor on a function and type \vs. This will send it to the REPL and evaluate it.
|
|
||||||
|
|
||||||
## Options
|
|
||||||
|
|
||||||
### VimuxHeight
|
|
||||||
Set the percent height of the runner pane opened by `RunVimTmuxCommand`.
|
|
||||||
**Default: `"20"`**
|
|
||||||
|
|
||||||
```viml
|
|
||||||
let VimuxHeight = "50"
|
|
||||||
```
|
|
||||||
|
|
||||||
### VimuxOrientation
|
|
||||||
Set the default position of the runner pane.
|
|
||||||
|
|
||||||
**Acceptable Values:**
|
|
||||||
`"v"` Vertical
|
|
||||||
`"h"` Horizontal
|
|
||||||
|
|
||||||
**Default: `"v"`**
|
|
||||||
|
|
||||||
```viml
|
|
||||||
let VimuxOrientation = "h"
|
|
||||||
```
|
|
@ -1,6 +0,0 @@
|
|||||||
VimuxConfiguration vimux.txt /*VimuxConfiguration*
|
|
||||||
VimuxConfiguration_height vimux.txt /*VimuxConfiguration_height*
|
|
||||||
VimuxConfiguration_oriengation vimux.txt /*VimuxConfiguration_oriengation*
|
|
||||||
VimuxUsage vimux.txt /*VimuxUsage*
|
|
||||||
vimux-contents vimux.txt /*vimux-contents*
|
|
||||||
vimux.txt vimux.txt /*vimux.txt*
|
|
@ -1,198 +1,321 @@
|
|||||||
if exists("g:loaded_vimux") || &cp
|
if exists('g:loaded_vimux') || &compatible
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
let g:loaded_vimux = 1
|
let g:loaded_vimux = 1
|
||||||
|
|
||||||
if !has("ruby")
|
" Set up all global options with defaults right away, in one place
|
||||||
finish
|
let g:VimuxDebug = get(g:, 'VimuxDebug', v:false)
|
||||||
end
|
let g:VimuxHeight = get(g:, 'VimuxHeight', 20)
|
||||||
|
let g:VimuxOpenExtraArgs = get(g:, 'VimuxOpenExtraArgs', '')
|
||||||
|
let g:VimuxOrientation = get(g:, 'VimuxOrientation', 'v')
|
||||||
|
let g:VimuxPromptString = get(g:, 'VimuxPromptString', 'Command? ')
|
||||||
|
let g:VimuxResetSequence = get(g:, 'VimuxResetSequence', 'q C-u')
|
||||||
|
let g:VimuxRunnerName = get(g:, 'VimuxRunnerName', '')
|
||||||
|
let g:VimuxRunnerType = get(g:, 'VimuxRunnerType', 'pane')
|
||||||
|
let g:VimuxRunnerQuery = get(g:, 'VimuxRunnerQuery', {})
|
||||||
|
let g:VimuxTmuxCommand = get(g:, 'VimuxTmuxCommand', 'tmux')
|
||||||
|
let g:VimuxUseNearest = get(g:, 'VimuxUseNearest', v:true)
|
||||||
|
let g:VimuxExpandCommand = get(g:, 'VimuxExpandCommand', v:false)
|
||||||
|
let g:VimuxCloseOnExit = get(g:, 'VimuxCloseOnExit', v:false)
|
||||||
|
let g:VimuxCommandShell = get(g:, 'VimuxCommandShell', v:true)
|
||||||
|
|
||||||
|
function! VimuxOption(name) abort
|
||||||
|
return get(b:, a:name, get(g:, a:name))
|
||||||
|
endfunction
|
||||||
|
|
||||||
command RunLastVimTmuxCommand :call RunLastVimTmuxCommand()
|
if !executable(VimuxOption('VimuxTmuxCommand'))
|
||||||
command CloseVimTmuxPanes :call CloseVimTmuxPanes()
|
echohl ErrorMsg | echomsg 'Failed to find executable '.VimuxOption('VimuxTmuxCommand') | echohl None
|
||||||
command CloseVimTmuxWindows :call CloseVimTmuxWindows()
|
finish
|
||||||
command InspectVimTmuxRunner :call InspectVimTmuxRunner()
|
endif
|
||||||
command InterruptVimTmuxRunner :call InterruptVimTmuxRunner()
|
|
||||||
command PromptVimTmuxCommand :call PromptVimTmuxCommand()
|
|
||||||
|
|
||||||
function RunVimTmuxCommand(command)
|
command -nargs=* VimuxRunCommand :call VimuxRunCommand(<args>)
|
||||||
let g:_VimTmuxCmd = a:command
|
command -bar VimuxRunLastCommand :call VimuxRunLastCommand()
|
||||||
ruby CurrentTmuxSession.new.run_shell_command(Vim.evaluate("g:_VimTmuxCmd"))
|
command -bar VimuxOpenRunner :call VimuxOpenRunner()
|
||||||
|
command -bar VimuxCloseRunner :call VimuxCloseRunner()
|
||||||
|
command -bar VimuxZoomRunner :call VimuxZoomRunner()
|
||||||
|
command -bar VimuxInspectRunner :call VimuxInspectRunner()
|
||||||
|
command -bar VimuxScrollUpInspect :call VimuxScrollUpInspect()
|
||||||
|
command -bar VimuxScrollDownInspect :call VimuxScrollDownInspect()
|
||||||
|
command -bar VimuxInterruptRunner :call VimuxInterruptRunner()
|
||||||
|
command -nargs=? VimuxPromptCommand :call VimuxPromptCommand(<args>)
|
||||||
|
command -bar VimuxClearTerminalScreen :call VimuxClearTerminalScreen()
|
||||||
|
command -bar VimuxClearRunnerHistory :call VimuxClearRunnerHistory()
|
||||||
|
command -bar VimuxTogglePane :call VimuxTogglePane()
|
||||||
|
|
||||||
|
augroup VimuxAutocmds
|
||||||
|
au!
|
||||||
|
autocmd VimLeave * call s:autoclose()
|
||||||
|
augroup END
|
||||||
|
|
||||||
|
function! VimuxRunCommandInDir(command, useFile) abort
|
||||||
|
let l:file = ''
|
||||||
|
if a:useFile ==# 1
|
||||||
|
let l:file = shellescape(expand('%:t'), 1)
|
||||||
|
endif
|
||||||
|
call VimuxRunCommand('(cd '.shellescape(expand('%:p:h'), 1).' && '.a:command.' '.l:file.')')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function RunLastVimTmuxCommand()
|
function! VimuxRunLastCommand() abort
|
||||||
if exists("g:_VimTmuxCmd")
|
if exists('g:VimuxLastCommand')
|
||||||
ruby CurrentTmuxSession.new.run_shell_command(Vim.evaluate("g:_VimTmuxCmd"))
|
call VimuxRunCommand(g:VimuxLastCommand)
|
||||||
else
|
else
|
||||||
echo "No last command"
|
echo 'No last vimux command.'
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function ClearVimTmuxWindow()
|
function! VimuxRunCommand(command, ...) abort
|
||||||
if exists("g:_VimTmuxRunnerPane")
|
if !exists('g:VimuxRunnerIndex') || s:hasRunner(g:VimuxRunnerIndex) ==# -1
|
||||||
unlet g:_VimTmuxRunnerPane
|
call VimuxOpenRunner()
|
||||||
end
|
endif
|
||||||
|
let l:autoreturn = 1
|
||||||
|
if exists('a:1')
|
||||||
|
let l:autoreturn = a:1
|
||||||
|
endif
|
||||||
|
let resetSequence = VimuxOption('VimuxResetSequence')
|
||||||
|
let g:VimuxLastCommand = a:command
|
||||||
|
call VimuxSendKeys(resetSequence)
|
||||||
|
call VimuxSendText(a:command)
|
||||||
|
if l:autoreturn ==# 1
|
||||||
|
call VimuxSendKeys('Enter')
|
||||||
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function CloseVimTmuxWindows()
|
function! VimuxSendText(text) abort
|
||||||
ruby CurrentTmuxSession.new.close_other_panes
|
call VimuxSendKeys(shellescape(substitute(a:text, '\n$', ' ', '')))
|
||||||
call ClearVimTmuxWindow()
|
|
||||||
echoerr "CloseVimTmuxWindows is deprecated, use CloseVimTmuxPanes"
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function CloseVimTmuxPanes()
|
function! VimuxSendKeys(keys) abort
|
||||||
ruby CurrentTmuxSession.new.close_other_panes
|
if exists('g:VimuxRunnerIndex')
|
||||||
call ClearVimTmuxWindow()
|
call VimuxTmux('send-keys -t '.g:VimuxRunnerIndex.' '.a:keys)
|
||||||
|
else
|
||||||
|
echo 'No vimux runner pane/window. Create one with VimuxOpenRunner'
|
||||||
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function InterruptVimTmuxRunner()
|
function! VimuxOpenRunner() abort
|
||||||
ruby CurrentTmuxSession.new.interrupt_runner
|
let existingId = s:existingRunnerId()
|
||||||
|
if existingId !=# ''
|
||||||
|
let g:VimuxRunnerIndex = existingId
|
||||||
|
else
|
||||||
|
let extraArguments = VimuxOption('VimuxOpenExtraArgs')
|
||||||
|
if VimuxOption('VimuxRunnerType') ==# 'pane'
|
||||||
|
call VimuxTmux('split-window '.s:vimuxPaneOptions().' '.extraArguments)
|
||||||
|
elseif VimuxOption('VimuxRunnerType') ==# 'window'
|
||||||
|
call VimuxTmux('new-window '.extraArguments)
|
||||||
|
endif
|
||||||
|
let g:VimuxRunnerIndex = s:tmuxIndex()
|
||||||
|
call s:setRunnerName()
|
||||||
|
call VimuxTmux('last-'.VimuxOption('VimuxRunnerType'))
|
||||||
|
sleep 100m
|
||||||
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function InspectVimTmuxRunner()
|
function! VimuxCloseRunner() abort
|
||||||
ruby CurrentTmuxSession.new.inspect_runner
|
if exists('g:VimuxRunnerIndex')
|
||||||
|
call VimuxTmux('kill-'.VimuxOption('VimuxRunnerType').' -t '.g:VimuxRunnerIndex)
|
||||||
|
unlet g:VimuxRunnerIndex
|
||||||
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function PromptVimTmuxCommand()
|
function! VimuxTogglePane() abort
|
||||||
let l:command = input("Command? ")
|
if exists('g:VimuxRunnerIndex')
|
||||||
call RunVimTmuxCommand(l:command)
|
if VimuxOption('VimuxRunnerType') ==# 'window'
|
||||||
|
call VimuxTmux('join-pane -s '.g:VimuxRunnerIndex.' '.s:vimuxPaneOptions())
|
||||||
|
let g:VimuxRunnerType = 'pane'
|
||||||
|
let g:VimuxRunnerIndex = s:tmuxIndex()
|
||||||
|
call VimuxTmux('last-'.VimuxOption('VimuxRunnerType'))
|
||||||
|
elseif VimuxOption('VimuxRunnerType') ==# 'pane'
|
||||||
|
let g:VimuxRunnerIndex=substitute(
|
||||||
|
\ VimuxTmux('break-pane -d -s '.g:VimuxRunnerIndex." -P -F '#{window_id}'"),
|
||||||
|
\ '\n',
|
||||||
|
\ '',
|
||||||
|
\ ''
|
||||||
|
\)
|
||||||
|
let g:VimuxRunnerType = 'window'
|
||||||
|
endif
|
||||||
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
ruby << EOF
|
function! VimuxZoomRunner() abort
|
||||||
class TmuxSession
|
if exists('g:VimuxRunnerIndex')
|
||||||
def initialize(session, window, pane)
|
if VimuxOption('VimuxRunnerType') ==# 'pane'
|
||||||
@session = session
|
call VimuxTmux('resize-pane -Z -t '.g:VimuxRunnerIndex)
|
||||||
@window = window
|
elseif VimuxOption('VimuxRunnerType') ==# 'window'
|
||||||
@pane = pane
|
call VimuxTmux('select-window -t '.g:VimuxRunnerIndex)
|
||||||
@runner_pane = vim_cached_runner_pane
|
endif
|
||||||
end
|
endif
|
||||||
|
endfunction
|
||||||
def vim_cached_runner_pane
|
|
||||||
if Vim.evaluate('exists("g:_VimTmuxRunnerPane")') != 0
|
|
||||||
Vim.evaluate('g:_VimTmuxRunnerPane')
|
|
||||||
else
|
|
||||||
nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def vim_cached_runner_pane=(runner_pane)
|
function! VimuxInspectRunner() abort
|
||||||
Vim.command("let g:_VimTmuxRunnerPane = '#{runner_pane}'")
|
call VimuxTmux('select-'.VimuxOption('VimuxRunnerType').' -t '.g:VimuxRunnerIndex)
|
||||||
end
|
call VimuxTmux('copy-mode')
|
||||||
|
endfunction
|
||||||
|
|
||||||
def clear_vim_cached_runner_pane
|
function! VimuxScrollUpInspect() abort
|
||||||
Vim.command("unlet g:_VimTmuxRunnerPane")
|
call VimuxInspectRunner()
|
||||||
end
|
call VimuxTmux('last-'.VimuxOption('VimuxRunnerType'))
|
||||||
|
call VimuxSendKeys('C-u')
|
||||||
|
endfunction
|
||||||
|
|
||||||
def height
|
function! VimuxScrollDownInspect() abort
|
||||||
if Vim.evaluate('exists("g:VimuxHeight")') != 0
|
call VimuxInspectRunner()
|
||||||
Vim.evaluate('g:VimuxHeight')
|
call VimuxTmux('last-'.VimuxOption('VimuxRunnerType'))
|
||||||
else
|
call VimuxSendKeys('C-d')
|
||||||
20
|
endfunction
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def orientation
|
function! VimuxInterruptRunner() abort
|
||||||
if Vim.evaluate('exists("g:VimuxOrientation")') != 0 && ["h", "v"].include?(Vim.evaluate('g:VimuxOrientation'))
|
call VimuxSendKeys('^c')
|
||||||
"-#{Vim.evaluate('g:VimuxOrientation')}"
|
endfunction
|
||||||
else
|
|
||||||
"-v"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def inspect_runner
|
function! VimuxClearTerminalScreen() abort
|
||||||
_run("select-pane -t #{target(:pane => runner_pane)}")
|
if exists('g:VimuxRunnerIndex')
|
||||||
_run("copy-mode")
|
call VimuxSendKeys('C-l')
|
||||||
Vim.command("let g:_VimTmuxInspecting = 1")
|
endif
|
||||||
end
|
endfunction
|
||||||
|
|
||||||
def stop_inspecting_runner
|
function! VimuxClearRunnerHistory() abort
|
||||||
if Vim.evaluate('exists("g:_VimTmuxInspecting")') != 0
|
if exists('g:VimuxRunnerIndex')
|
||||||
_run("send-keys -t #{target(:pane => runner_pane)} q")
|
call VimuxTmux('clear-history -t '.g:VimuxRunnerIndex)
|
||||||
Vim.command("unlet g:_VimTmuxInspecting")
|
endif
|
||||||
end
|
endfunction
|
||||||
end
|
|
||||||
|
|
||||||
def current_panes
|
function! VimuxPromptCommand(...) abort
|
||||||
_run('list-panes').split("\n").map do |line|
|
let command = a:0 ==# 1 ? a:1 : ''
|
||||||
line.split(':').first
|
if VimuxOption('VimuxCommandShell')
|
||||||
end
|
let l:command = input(VimuxOption('VimuxPromptString'), command, 'shellcmd')
|
||||||
end
|
else
|
||||||
|
let l:command = input(VimuxOption('VimuxPromptString'), command)
|
||||||
|
endif
|
||||||
|
if VimuxOption('VimuxExpandCommand')
|
||||||
|
let l:command = join(map(split(l:command, ' '), 'expand(v:val)'), ' ')
|
||||||
|
endif
|
||||||
|
call VimuxRunCommand(l:command)
|
||||||
|
endfunction
|
||||||
|
|
||||||
def active_pane_id
|
function! VimuxTmux(arguments) abort
|
||||||
_run('list-panes').split("\n").map do |line|
|
if VimuxOption('VimuxDebug')
|
||||||
return line.split[-2] if line =~ /\(active\)/
|
echom VimuxOption('VimuxTmuxCommand').' '.a:arguments
|
||||||
end
|
endif
|
||||||
end
|
if has_key(environ(), 'TMUX')
|
||||||
|
return system(VimuxOption('VimuxTmuxCommand').' '.a:arguments)
|
||||||
|
else
|
||||||
|
throw 'Aborting, because not inside tmux session.'
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
def target(args={})
|
function! s:tmuxSession() abort
|
||||||
"#{args.fetch(:session, @session)}:#{args.fetch(:window, @window)}.#{args.fetch(:pane, @pane)}"
|
return s:tmuxProperty('#S')
|
||||||
end
|
endfunction
|
||||||
|
|
||||||
def runner_pane
|
function! s:tmuxIndex() abort
|
||||||
if @runner_pane.nil?
|
if VimuxOption('VimuxRunnerType') ==# 'pane'
|
||||||
type = Vim.evaluate('exists("g:_VimTmuxInspecting")') != 0
|
return s:tmuxPaneId()
|
||||||
_run("split-window -p #{height} #{orientation}")
|
else
|
||||||
@runner_pane = active_pane_id
|
return s:tmuxWindowId()
|
||||||
Vim.command("let g:_VimTmuxRunnerPane = '#{@runner_pane}'")
|
|
||||||
end
|
|
||||||
|
|
||||||
_run('list-panes').split("\n").map do |line|
|
|
||||||
return line.split(':').first if line =~ /#{@runner_pane}/
|
|
||||||
end
|
|
||||||
|
|
||||||
@runner_pane = nil
|
|
||||||
clear_vim_cached_runner_pane
|
|
||||||
runner_pane
|
|
||||||
end
|
end
|
||||||
|
endfunction
|
||||||
|
|
||||||
def interrupt_runner
|
function! s:tmuxPaneId() abort
|
||||||
stop_inspecting_runner
|
return s:tmuxProperty('#{pane_id}')
|
||||||
_run("send-keys -t #{target(:pane => runner_pane)} ^c")
|
endfunction
|
||||||
end
|
|
||||||
|
|
||||||
def run_shell_command(command)
|
function! s:tmuxWindowId() abort
|
||||||
stop_inspecting_runner
|
return s:tmuxProperty('#{window_id}')
|
||||||
_send_command(command, target(:pane => runner_pane))
|
endfunction
|
||||||
_move_up_pane
|
|
||||||
end
|
|
||||||
|
|
||||||
def close_other_panes
|
function! s:vimuxPaneOptions() abort
|
||||||
stop_inspecting_runner
|
let height = VimuxOption('VimuxHeight')
|
||||||
if _run("list-panes").split("\n").length > 1
|
let orientation = VimuxOption('VimuxOrientation')
|
||||||
_run("kill-pane -a")
|
return '-l '.height.'% -'.orientation
|
||||||
end
|
endfunction
|
||||||
end
|
|
||||||
|
|
||||||
def _move_up_pane
|
""
|
||||||
_run("select-pane -t #{target}")
|
" @return a string of the form '%4', the ID of the pane or window to use,
|
||||||
end
|
" or '' if no nearest pane or window is found.
|
||||||
|
function! s:existingRunnerId() abort
|
||||||
|
let runnerType = VimuxOption('VimuxRunnerType')
|
||||||
|
let query = get(VimuxOption('VimuxRunnerQuery'), runnerType, '')
|
||||||
|
if empty(query)
|
||||||
|
if empty(VimuxOption('VimuxUseNearest'))
|
||||||
|
return ''
|
||||||
|
else
|
||||||
|
return s:nearestRunnerId()
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
" Try finding the runner using the provided query
|
||||||
|
let currentId = s:tmuxIndex()
|
||||||
|
let message = VimuxTmux('select-'.runnerType.' -t '.query.'')
|
||||||
|
if message ==# ''
|
||||||
|
" A match was found. Make sure it isn't the current vim pane/window
|
||||||
|
" though!
|
||||||
|
let runnerId = s:tmuxIndex()
|
||||||
|
if runnerId !=# currentId
|
||||||
|
" Success!
|
||||||
|
call VimuxTmux('last-'.runnerType)
|
||||||
|
return runnerId
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
return ''
|
||||||
|
endfunction
|
||||||
|
|
||||||
def _send_command(command, target)
|
function! s:nearestRunnerId() abort
|
||||||
_run("send-keys -t #{target} '#{command.gsub("'", "\'")}'")
|
" Try finding the runner in the current window/session, optionally using a
|
||||||
_run("send-keys -t #{target} Enter")
|
" name/title filter
|
||||||
end
|
let runnerType = VimuxOption('VimuxRunnerType')
|
||||||
|
let filter = s:getTargetFilter()
|
||||||
|
let views = split(
|
||||||
|
\ VimuxTmux(
|
||||||
|
\ 'list-'.runnerType.'s'
|
||||||
|
\ ." -F '#{".runnerType.'_active}:#{'.runnerType."_id}'"
|
||||||
|
\ .filter),
|
||||||
|
\ '\n')
|
||||||
|
" '1:' is the current active pane (the one with vim).
|
||||||
|
" Find the first non-active pane.
|
||||||
|
for view in views
|
||||||
|
if match(view, '1:') ==# -1
|
||||||
|
return split(view, ':')[1]
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
return ''
|
||||||
|
endfunction
|
||||||
|
|
||||||
def _run(command)
|
function! s:getTargetFilter() abort
|
||||||
`tmux #{command}`
|
let targetName = VimuxOption('VimuxRunnerName')
|
||||||
end
|
if targetName ==# ''
|
||||||
end
|
return ''
|
||||||
|
endif
|
||||||
|
let runnerType = VimuxOption('VimuxRunnerType')
|
||||||
|
if runnerType ==# 'window'
|
||||||
|
return " -f '#{==:#{window_name},".targetName."}'"
|
||||||
|
elseif runnerType ==# 'pane'
|
||||||
|
return " -f '#{==:#{pane_title},".targetName."}'"
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
class CurrentTmuxSession < TmuxSession
|
function! s:setRunnerName() abort
|
||||||
def initialize
|
let targetName = VimuxOption('VimuxRunnerName')
|
||||||
session = self.get_session
|
if targetName ==# ''
|
||||||
window = self.get_property(:active, :window)
|
return
|
||||||
pane = self.get_property(:active, :pane)
|
endif
|
||||||
|
let runnerType = VimuxOption('VimuxRunnerType')
|
||||||
|
if runnerType ==# 'window'
|
||||||
|
call VimuxTmux('rename-window '.targetName)
|
||||||
|
elseif runnerType ==# 'pane'
|
||||||
|
call VimuxTmux('select-pane -T '.targetName)
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
super(session, window, pane)
|
function! s:tmuxProperty(property) abort
|
||||||
end
|
return substitute(VimuxTmux("display -p '".a:property."'"), '\n$', '', '')
|
||||||
|
endfunction
|
||||||
|
|
||||||
def get_property(match, type)
|
function! s:hasRunner(index) abort
|
||||||
_run("list-#{type.to_s}").split("\n").each do |line|
|
let runnerType = VimuxOption('VimuxRunnerType')
|
||||||
return line.split(':').first if line =~ /\(#{match.to_s}\)/
|
return match(VimuxTmux('list-'.runnerType."s -F '#{".runnerType."_id}'"), a:index)
|
||||||
end
|
endfunction
|
||||||
end
|
|
||||||
|
|
||||||
def get_session
|
function! s:autoclose() abort
|
||||||
_run("list-panes -F '\#\{session_name\}'").split("\n").first.strip
|
if VimuxOption('VimuxCloseOnExit')
|
||||||
end
|
call VimuxCloseRunner()
|
||||||
end
|
endif
|
||||||
EOF
|
endfunction
|
||||||
|
Loading…
Reference in New Issue