hkupty / nvimux

Neovim as a TMUX replacement

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

haqle opened this issue · comments

commented
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.

Great! Thanks for contributing.

I'll apply this ASAP. for opening a PR, you must fork the project, clone your version, push your changes and open a PR from the interface of github.

Cheers,
Henry John Kupty