1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 17:40:06 +08:00

Improve tmux layer (#1970)

* Merge tmux and lang#tmux layer
This commit is contained in:
Wang Shidong 2018-08-04 20:34:14 +08:00 committed by GitHub
parent 9d1a6f8de8
commit b94438516f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 135 additions and 42 deletions

View File

@ -1,22 +0,0 @@
"=============================================================================
" tmux.vim --- SpaceVim tmux layer
" Copyright (c) 2016-2017 Wang Shidong & Contributors
" Author: Wang Shidong < wsdjeg at 163.com >
" URL: https://spacevim.org
" License: GPLv3
"=============================================================================
""
" @section lang#tmux, layer-lang-tmux
" @parentsection layers
" @subsection Intro
" The lang#tmux layer provides syntax highlighting, commenting, man page navigation
" and ability to execute lines as tmux commands.
" @section(layer-checkers)
function! SpaceVim#layers#lang#tmux#plugins() abort
let plugins = []
call add(plugins, ['tmux-plugins/vim-tmux', {'on_ft' : 'tmux'}])
return plugins
endfunction

View File

@ -10,7 +10,8 @@
" @section tmux, layer-tmux
" @parentsection layers
" Adds integration between tmux and vim panes. Switch between panes
" seamlessly.
" seamlessly.syntax highlighting, commenting, man page navigation
" and ability to execute lines as tmux commands.
" This layer is not added by default. To include it, add
" `SpaceVim#layers#load('tmux')` to your `~/.SpaceVim.d/init.vim`.
" If you are having issues with <C-h> in a neovim buffer, see
@ -32,7 +33,8 @@ function! SpaceVim#layers#tmux#plugins() abort
\ 'TmuxNavigateLeft', 'TmuxNavigateDown', 'TmuxNavigateUp',
\ 'TmuxNavigateRight'] }],
\ ]
call add(plugins, ['tmux-plugins/vim-tmux', {'on_ft' : 'tmux'}])
call add(plugins, ['edkolev/tmuxline.vim', {'merged' : 0}])
return plugins
endfunction
@ -49,5 +51,76 @@ function! SpaceVim#layers#tmux#config() abort
nnoremap <silent> <C-j> :TmuxNavigateDown<CR>
nnoremap <silent> <C-k> :TmuxNavigateUp<CR>
nnoremap <silent> <C-l> :TmuxNavigateRight<CR>
let g:neomake_tmux_enabled_makers = ['tmux']
let g:neomake_tmux_tmux_maker = {
\ 'exe': 'tmux',
\ 'args': ['source-file', '-q'],
\ 'errorformat': '%f:%l:%m,%+Gunknown command: %s',
\ }
let g:tmuxline_separators = {
\ 'left' : s:separators[s:tmuxline_separators][0],
\ 'left_alt': s:i_separators[s:tmuxline_separators_alt][0],
\ 'right' : s:separators[s:tmuxline_separators][1],
\ 'right_alt' : s:i_separators[s:tmuxline_separators_alt][1],
\ 'space' : ' '}
let g:tmuxline_preset = {
\'a' : '#S',
\'b' : '#W',
\'win' : ['#I', '#W'],
\'cwin' : ['#I', '#W'],
\'x' : '%a',
\'y' : '%R',
\'z' : '#H'}
if !empty(g:spacevim_custom_color_palette)
let t = g:spacevim_custom_color_palette
else
let name = g:spacevim_colorscheme
try
let t = SpaceVim#mapping#guide#theme#{name}#palette()
catch /^Vim\%((\a\+)\)\=:E117/
let t = SpaceVim#mapping#guide#theme#gruvbox#palette()
endtry
endif
let g:tmuxline_theme = {
\ 'a' : [ t[0][3], t[0][2], 'bold' ],
\ 'b' : [ t[1][2], t[1][3] ],
\ 'c' : [ t[2][2], t[2][3] ],
\ 'z' : [ t[0][3], t[0][2] ],
\ 'y' : [ t[1][2], t[1][3] ],
\ 'x' : [ t[2][2], t[2][3] ],
\ 'win' : [ t[1][2], t[1][3] ],
\ 'cwin' : [ t[0][3], t[0][2] ],
\ 'bg' : [ t[3][1], t[3][1] ],
\ }
endfunction
" init
let s:separators = {
\ 'arrow' : ["\ue0b0", "\ue0b2"],
\ 'curve' : ["\ue0b4", "\ue0b6"],
\ 'slant' : ["\ue0b8", "\ue0ba"],
\ 'brace' : ["\ue0d2", "\ue0d4"],
\ 'fire' : ["\ue0c0", "\ue0c2"],
\ 'nil' : ['', ''],
\ }
let s:i_separators = {
\ 'arrow' : ["\ue0b1", "\ue0b3"],
\ 'bar' : ['|', '|'],
\ 'nil' : ['', ''],
\ }
let s:tmuxline_separators = g:spacevim_statusline_separator
let s:tmuxline_separators_alt = g:spacevim_statusline_inactive_separator
function! SpaceVim#layers#tmux#set_variable(var) abort
let s:tmuxline_separators = get(a:var,
\ 'tmuxline_separators',
\ g:spacevim_statusline_separator)
let s:tmuxline_separators_alt = get(a:var,
\ 'tmuxline_separators_alt',
\ g:spacevim_statusline_inactive_separator)
endfunction

View File

@ -68,12 +68,11 @@ CONTENTS *SpaceVim-contents*
24. lang#python.............................|SpaceVim-layer-lang-python|
25. lang#rust.................................|SpaceVim-layer-lang-rust|
26. lang#scala...............................|SpaceVim-layer-lang-scala|
27. lang#tmux.................................|SpaceVim-layer-lang-tmux|
28. lang#xml...................................|SpaceVim-layer-lang-xml|
29. operator...................................|SpaceVim-layer-operator|
30. shell.........................................|SpaceVim-layer-shell|
31. tmux...........................................|SpaceVim-layer-tmux|
32. tools#dash...............................|SpaceVim-layer-tools-dash|
27. lang#xml...................................|SpaceVim-layer-lang-xml|
28. operator...................................|SpaceVim-layer-operator|
29. shell.........................................|SpaceVim-layer-shell|
30. tmux...........................................|SpaceVim-layer-tmux|
31. tools#dash...............................|SpaceVim-layer-tools-dash|
7. API........................................................|SpaceVim-api|
1. cmdlinemenu................................|SpaceVim-api-cmdlinemenu|
2. data#list....................................|SpaceVim-api-data-list|
@ -1244,14 +1243,6 @@ MAPPINGS
==============================================================================
LANG#SCALA *SpaceVim-layer-lang-scala*
==============================================================================
LANG#TMUX *SpaceVim-layer-lang-tmux*
INTRO
The lang#tmux layer provides syntax highlighting, commenting, man page
navigation and ability to execute lines as tmux commands.
|SpaceVim-layer-checkers|
==============================================================================
LANG#XML *SpaceVim-layer-lang-xml*
@ -1277,10 +1268,11 @@ default_shell
==============================================================================
TMUX *SpaceVim-layer-tmux*
Adds integration between tmux and vim panes. Switch between panes seamlessly.
This layer is not added by default. To include it, add
`SpaceVim#layers#load('tmux')` to your `~/.SpaceVim.d/init.vim`. If you are
having issues with <C-h> in a neovim buffer, see
Adds integration between tmux and vim panes. Switch between panes
seamlessly.syntax highlighting, commenting, man page navigation and ability to
execute lines as tmux commands. This layer is not added by default. To include
it, add `SpaceVim#layers#load('tmux')` to your `~/.SpaceVim.d/init.vim`. If
you are having issues with <C-h> in a neovim buffer, see
`https://github.com/neovim/neovim/issues/2048#issuecomment-78045837`
MAPPINGS

View File

@ -90,7 +90,9 @@ enable = false
| [lsp](language-server-protocol/) | This layers provides language server protocol for vim and neovim |
| [leaderf](leaderf/) | This layers provide a heavily customized LeaderF centric work-flow |
| [shell](shell/) | This layer provide shell support in SpaceVim |
| [sudo](sudo/) | sudo layer provides ability to read and write file elevated privileges in SpaceVim |
| [tags](tags/) | This layer provide tags manager for project |
| [tmux](tmux/) | This layers adds extensive support for tmux |
| [tools#dash](tools/dash/) | This layer provides Dash integration for SpaceVim |
| [tools](tools/) | This layer provides some tools for vim |
| [ui](ui/) | Awesome UI layer for SpaceVim, provide IDE-like UI for neovim and vim in both TUI and GUI |

46
docs/layers/tmux.md Normal file
View File

@ -0,0 +1,46 @@
---
title: "SpaceVim tmux layer"
description: "This layers adds extensive support for tmux"
---
# [Available Layers](../) >> tmux
<!-- vim-markdown-toc GFM -->
- [Description](#description)
- [Install](#install)
- [Layer options](#layer-options)
- [Key bindings](#key-bindings)
<!-- vim-markdown-toc -->
## Description
This layer adds integration between tmux and vim panes. Switch between panes
seamlessly.colored tmuxline, Syntax highlighting, commenting, man page navigation
and ability to execute lines as tmux commands.
## Install
To use this configuration layer, update custom configuration file with:
```toml
[[layers]]
name = "tmux"
```
## Layer options
- `tmuxline_separators`: default value is same as SpaceVim options `statusline_separator`, available
values include: `arrow`, `curve`, `slant`, `barce`, `fire`, `nil`.
- `tmuxline_separators_alt`: default value is same as SpaceVim options `statusline_inactive_separator`
available values include: `arrow`, `bar`, `nil`.
## Key bindings
| Key bindings | Description |
| ------------ | ------------------------------------------ |
| `Ctrl-h` | Switch to vim/tmux pane in left direction |
| `Ctrl-j` | Switch to vim/tmux pane in down direction |
| `Ctrl-k` | Switch to vim/tmux pane in up direction |
| `Ctrl-l` | Switch to vim/tmux pane in right direction |

View File

@ -27,6 +27,7 @@ The next release is v0.9.0.
- Add go def function for python ([#1969](https://github.com/SpaceVim/SpaceVim/pull/1969), [#1999](https://github.com/SpaceVim/SpaceVim/pull/1999))
- neovim +py and +py3 support ([#1988](https://github.com/SpaceVim/SpaceVim/pull/1988))
- Improve debug info ([#1991](https://github.com/SpaceVim/SpaceVim/pull/1991))
- Improve tmux layer ([#1970](https://github.com/SpaceVim/SpaceVim/pull/1970))
### Changed
@ -73,6 +74,7 @@ The next release is v0.9.0.
- Add doc for sudo layer ([#2011](https://github.com/SpaceVim/SpaceVim/pull/2011))
- Update key notations ([#1940](https://github.com/SpaceVim/SpaceVim/pull/1940))
### Others
- Fix ci lint ([#1946](https://github.com/SpaceVim/SpaceVim/pull/1946), [#1945](https://github.com/SpaceVim/SpaceVim/pull/1945), [#1944](https://github.com/SpaceVim/SpaceVim/pull/1944), [#1942](https://github.com/SpaceVim/SpaceVim/pull/1942))