Git Product home page Git Product logo

nvimux's Introduction

NVIMUX

Chat on Matrix Sponsor me

Nvimux allows neovim to work as a tmux replacement.

It does so by mapping tmuxs keybindings to neovim, using its windows, buffers and terminals.

Support nvimux

Support nvimux development by sending me some bitcoins at 1P4iGMqrBcjdgicC1EdQFA4qF91LtRri1Y.

Configuring

Nvimux is built on lua, meaning that you must use a somewhat recent version of neovim.

For the older version, based on viml, refer to the legacy branch. The legacy branch won't be maintained but will be kept for those who prefer it.

To configure nvimux, you can use both lua and viml to configure, though the first is much preferred.

A lua-based configuration for nvimux is as follows:

lua << EOF
-- Nvimux configuration
local nvimux = require('nvimux')
nvimux.setup{
  config = {
    prefix = '<C-a>',
  },
  bindings = {
    {{'n', 'v', 'i', 't'}, 's', nvimux.commands.horizontal_split},
    {{'n', 'v', 'i', 't'}, 'v', nvimux.commands.vertical_split},
  }
}
EOF

In case you don't set configuration options, please do run the following for nvimux to work:

lua require('nvimux').setup{}

Credits & Stuff

This plugin is developed and maintained by Henry Kupty and it's completely free to use. The rationale behind the idea is described in this article. Consider helping by opening issues, Pull Requests or influencing your friends and colleagues to use!

nvimux's People

Contributors

akatrevorjay avatar bryant1410 avatar chino540off avatar cking avatar hkupty avatar jdelkins avatar mmlb avatar rickysaurav 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  avatar  avatar  avatar

nvimux's Issues

nvimux maps to default prefix as well as customized prefix

Hello again! First I'd like to say I appreciate your work on this plugin — I've been off tmux for about a month now and haven't missed it.

I'm on nvim and have a plugin file at plugin/nvimux.vim which defines my prefix as <c-space>. When I run verbose map <c-space>, everything looks peachy — all maps are set up correctly. However, when I run verbose map <c-b> (the default prefix), I find that it is also mapped to all of the nvimux commands. This is a bummer for me, as I dig the default behavior of <c-b>.

This seems like a bug, as when I run scriptnames, I see that the settings at plugin/nvimux.vim are being executed before the nvimux plugin. Unsure what's going on, but it seems to me that if the default prefix is overwritten, it should not be mapped to.

Bug: let g:nvimux_new_window = 'term' does nothing

I discovered that specifying let g:nvimux_new_window = 'term' in vimrc doesn't work, so I had to edit lua "vars" file instead. At the same time, let g:nvimux_new_tab = 'term' actually did work as expected (even before I edited "vars").

<C-b>[ does nothing

I commonly use <C-b>[ in tmux to view large bodies of text outputted by a command. However I seem to notice that using <C-b>[ does nothing.

Error when trying to use binding

Steps to reproduce:
Press prefix-" or prefix-%. May happen with other bindings too, I haven't checked.

Error:

E5108: Error executing lua ...e/nvim/site/pack/packer/start/nvimux/lua/nvimux/vars.lua:18: Expected lua t
able                                                                                                     
stack traceback:                                                                                         
        [C]: in function 'nvim_buf_set_lines'                                                            
        ...e/nvim/site/pack/packer/start/nvimux/lua/nvimux/vars.lua:18: in function 'singleton_buf'      
        ...e/nvim/site/pack/packer/start/nvimux/lua/nvimux/vars.lua:58: in function 'select_buffer'      
        ...e/nvim/site/pack/packer/start/nvimux/lua/nvimux/init.lua:83: in function <...e/nvim/site/pack/
packer/start/nvimux/lua/nvimux/init.lua:71>                                                              
        ...im/site/pack/packer/start/nvimux/lua/nvimux/bindings.lua:75: in function 'do_mapping'         
        [string ":lua"]:1: in main chunk

open-term-by-default not working

With config init.vim
nvimux works well, except that it does not seem to respect open-term-by-default = true.
When I type <C-a>c I just get an empty file buffer. Have I done something wrong?

Not sure where to begin

Trying to read the readme it's talking about a lua config file. Where do I put this? I would like to try this plugin but just not sure where to begin

Neovim version: 0.2.0

Rename terminal buffer <prefix>,

Or probably using a command like :NvimuxRename new-terminal-buffer-name-here.
I see that this plugin was able to change the buffer name.
Also, possibly preserving the prefix term:// in the name since some have auto commands to automatically enter insert mode when in a terminal buffer and they use the name to distinguish the terminal buffers.

More than 1 quickterm per tab

What do you think about the ability to have more than one tab-local term with the ability to specify location, orientation and corresponding hotkey?

Lua snippet errors on reload of init.vim

Hello again! It seems the lua configuration is not idempotent. Reloading my vimrc is a frequent workflow of mine since I add or change mappings frequently (perhaps too frequently.. but details). My current configuration is almost exactly what's in the docs.

lua << EOF
local nvimux = require('nvimux')

-- Nvimux configuration
nvimux.config.set_all{
  prefix = '<C-a>',
  new_window = 'term', -- Use 'term' if you want to open a new term for every new window
  new_tab = nil, -- Defaults to new_window. Set to 'term' if you want a new term for every new tab
  new_window_buffer = 'single',
  quickterm_direction = 'botright',
  quickterm_orientation = 'vertical',
  quickterm_scope = 't', -- Use 'g' for global quickterm
  quickterm_size = '80',
}

-- Nvimux custom bindings
nvimux.bindings.bind_all{
  {'-', ':NvimuxHorizontalSplit', {'n', 'v', 'i', 't'}},
  {'\\|', ':NvimuxVerticalSplit', {'n', 'v', 'i', 't'}},
}

-- Required so nvimux sets the mappings correctly
nvimux.bootstrap()
EOF

When I re-source my vimrc from within a running instance, I get the following error:

Error detected while processing /home/william/.dotfiles/vim/vimrc:
line  551:
E5105: Error while calling lua chunk: /home/william/.vim/bundle/nvimux//lua/nvimux.lua:112: bad argument #1 to 'sub' (string expected, got nil)

Thanks again in advance!

Last tab shortcut

Nice plugin :)

I'm exploring ditching tmux right now and am missing the <prefix>-l shortcut to go to the last tab I was at. Could that be supported in nvimux?

Note: this is different than :tablast which literally takes you to the last (endmost) tab in the list of tabs. Tmux's interpretation of "last" means switching to the tab you were previously at, e.g. switching back and forth between tab 3 and tab 5. I'm not sure if vim natively supports this notion.

horizontal split not working

I load nvimux using lua require('nvimux').bootstrap()

Vertical split works fine, however horizontal split results in this.

E5104: Error while creating lua chunk: [string ""]:1: unfinished string near ''

Duplicate tag "g:nvimux_quickterm_scope"

There seems to be a minor error i am getting warned about in the docs. It seems that in nvimux.txt you have help text about g:nvimux_quickterm_scope twice, on line 104 and 165.

Neovim: Improving the lua experience

I've started a PR on the neovim repo to improve the situation for people who develop addons in lua. That somewhat prominently include you, so I'd be very glad if you would chime in and tell us about your experience, in particular what functions you'd like to see in a "lua stdlib". Thanks!

buf_nr in nvimux.term.toggle should be int instead of float

nvimux.term.toggle = function()                                                                                        
  -- TODO Allow external commands                                                                                      
  local buf_nr = fns.variables.get{mode=vars.quickterm_scope, name='nvimux_last_buffer_id'}                            
  if not buf_nr then                                                                                                   
    nvimux.term.new_toggle()                                                                                           
  else                                                                                                                 
    -- Convert buf_nr to int                                                                                          
    -- buf_nr = math.floor(buf_nr)                                                                                     
    local window = nvim.nvim_call_function('bufwinnr', {buf_nr})                                                       
    if window == -1 then                                                                                               
      if nvim.nvim_call_function('bufname', {buf_nr}) == '' then                                                       
        nvimux.term.new_toggle()                                                                                       
      else                                                                                                             
        local split_type = nvim.nvim_buf_get_var(buf_nr, 'nvimux_buf_orientation')                                     
        nvim.nvim_command(split_type .. ' | b' .. buf_nr)                                                              
      end                                                                                                              
    else                                                                                                               
      nvim.nvim_command(window .. ' wincmd w | q | stopinsert')                                                        
    end                                                                                                                
  end                                                                                                                  
end

buf_nr as returned by fns.variables.get() is a float so nvim gets unhappy with the ' | b' .. buf_nr part.
I'm still new to git/github so I'm not sure on how to make a pull request.

open_term_by_default not working

I'm evaluating if nvimux can replace my current tmux workflow seeing as I mostly work on my local machine and rarely ssh in remote machines.

I'm stumbling across the following problem: Somehow the open_term_by_default option is not respected. having new splits default to terminal buffers is essential for me to use this plugin as a tmux replacement.

I tried using the following minimal neovim config:

packadd minpac

call minpac#init()
call minpac#add('hkupty/nvimux', { 'type': 'opt' }) 

packadd nvimux

lua << EOF
local nvimux = require('nvimux')

-- Nvimux configuration
nvimux.config.set_all{
  prefix = '<C-a>',
  open_term_by_default = true,
  new_window_buffer = 'single',
  quickterm_direction = 'botright',
  quickterm_orientation = 'vertical',
  -- Use 'g' for global quickterm
  quickterm_scope = 't',
  quickterm_size = '80',
}

-- Nvimux custom bindings
nvimux.bindings.bind_all{
  {'s', ':NvimuxHorizontalSplit', {'n', 'v', 'i', 't'}},
  {'v', ':NvimuxVerticalSplit', {'n', 'v', 'i', 't'}},
}
EOF

opening a new split using either s or v opens a empty split and not a terminal.

Custom keybindings | and -

Hi, first, great plugin. I've only been playing with it a bit, but it seems awesome. I'm trying to use it in conjunction with the Oni editor to somewhat replace my nvim in tmux setup with a tmux in nvim setup. Seems awesome.

Secondly, I'm trying to map all my tmux mappings the same and for splits I use | for vertical and - for horizontal. So, I replaced the suggested s and v mappings with

nvimux.bindings.bind_all{
  {'-', ':NvimuxHorizontalSplit', {'n', 'v', 'i', 't'}},
  {'|', ':NvimuxVerticalSplit', {'n', 'v', 'i', 't'}},
}

I don't know lua at all, but this seems to cause some kind of error within the plugin. I'm getting the following error:

Error detected while processing /home/william/.dotfiles/vim/init.vim: line 544: E5105: Error while calling lua chunk: /home/william/.vim/bundle/nvimux//lua/nvimux.lua:114: Keyboard interrupt

Any help debugging this would be very appreciated.

custom bindings do not overwrite default bindings

Apologies for pestering!

I'm now having somewhat the opposite issue — custom keybindings that are remap a key mapped to a default are overridden by the default. Eg, if I set
nvimux.bindings.bind_all{ {'j', ':NvimuxHorizontalSplit', {'n', 'v', 'i', 't'}}, }
and I call :verbose map <C-b>j, I see: v <C-Space>j * <C-W><NL>, not v <C-Space>s * :NvimuxHorizontalSplit<CR>

Where

Where/what exactly is supposed to be done with lua chunk?

Nvimux bindings doesn't work at all.

I have a super clean vimrc file like this :

filetype off

set rtp+=~/.config/nvim/bundle/Vundle.vim
call vundle#begin()
Plugin 'gmarik/Vundle.vim'
Plugin 'BurningEther/nvimux'
call vundle#end()            " required
filetype plugin indent on    " required

let g:nvimux_prefix = '<c-a>'
let g:nvimux_override_c = 'echomsg "Open new tab" | tabe'

When I do c it just do nothing. I tried with other keys but I have not results.

Commands NvimuxTermPaste, NvimuxToggleTerm and NvimuxTermRename works but not Vertical and Horizontal split.

I have Neovim 2.2.

Do I have something to do?

<c-b> ! functionality

In tmux, <c-b> ! breaks the current pane (unless it's already the only pane in its current window) into a new window of its own. Is it possible to get this in nvimux?

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.