Skip to content

A vim plugin that mimics the actions of tmux. Control buffers and tabs like tmux panes.

License

Notifications You must be signed in to change notification settings

Karmenzind/vim-tmuxlike

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vim-tmuxlike

Add tmux operating habits to vim.

If you are quite addicted to tmux, you might need this plugin to make your vim work a bit like tmux.

TOC

Intro

Prefix key

Just like <prefix>(usually CTRL-B) in tmux, there's a prefix key in vim-tmuxlike.
I use <c-a>(CTRL-A) as the default prefix key. You need to change it if you have the same keymap in tmux.

Features

Tmux users may be familiar with these basic operation.

Every keymap should start with <prefix>.

  • h j k l Left Down Up Right change buffer
  • H J K L enter resize-mode and smoothly resize current window with direction key (vim only; nvim version still WIP)
  • ? open vim-tmuxlike's helppage
  • z toggle buffer zoom mode
  • % split window; open new buffer oh the right side
  • | split current buffer oh the right side (custom: g:tmuxlike_key_vsplit)
  • " vertically split window; open new buffer downside
  • _ split current buffer downside (custom: g:tmuxlike_key_hsplit)
  • c open a new tab with an empty window after the last tab
  • <c-h> <c-p> select previous tab n <c-n> <c-l> select next tab
  • x forcely close current buffer
  • & forcely close current tab
  • ~ show history messages
  • ! break current buffer (move current buffer to new tabpage)
  • d detach/suspend vim (the same as CTRL-Z)
  • r redraw current buffer
  • ] paste [from register *]
  • ; choose last buffer

These keymaps need t9md/vim-choosewin installed.

  • q s = enter choosewin mode choose_win

Installation

  • use vim-plug:
    Plug 'karmenzind/vim-tmuxlike'
    

Configuration

prefix key

Feel free to change the prefix key. I recommend using a 'CTRL-' key combination which will be really convenient (e.g. with default prefix <c-a>, you just need to hold CTRL and type 'ah' for <prefix><c-h>).

" use CTRL-A (default)
nmap <c-a> <Plug>(tmuxlike-prefix)
" use CTRL-\
nmap <c-\> <Plug>(tmuxlike-prefix)
" use double leader (it will be `\\` if you haven't change the mapleader)
nmap <Leader><Leader> <Plug>(tmuxlike-prefix)

operation keymaps

" use <prefix> + <key> to split current buffer
let g:tmuxlike_key_vsplit = '\'  " default value: \| (slash is for escaping)
let g:tmuxlike_key_hsplit = '-'  " default value: _

others

" View :messages in a scratch buffer or a floating window. Options: float, scratch(default)
let g:tmuxlike_messages_container = 'scratch'

Others

TODO:

  • (WIP) list and search tab/win with fzf/floating
  • all keymaps configurable

If you have any problem or advice, please create an issue and I'll fix it ASAP.

About

A vim plugin that mimics the actions of tmux. Control buffers and tabs like tmux panes.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published