Skip to content

tomiis4/BufEx.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Buffer Exchange

A plugin for effortless buffer sharing between nvim sessions.


Colorscheme: dogrun; Font: Hurmit NerdFont Mono

Usage Local

  1. send buffer

    • open BufEx menu

    • select "Send Buffer" window (press n to switch between windows)

    • select buffer which you want to send and toggle options

    • preview

      send-buffer

  2. select buffer

    • open BufEx menu

    • press enter on buffer which you want open

    • preview

      select-buffer

Usage Global

  1. host server
    • create or select TCP server and host it
    • in configuration change port, host and local_server
    • follow instructions from Usage Local

Available transfer servers

  • Lua (build-in)
  • TypeScript
  • GoLang

Installation

Using vim-plug
Plug 'tomiis4/BufEx.nvim'
Using packer
use 'tomiis4/BufEx.nvim'
Using lazy
{
    'tomiis4/BufEx.nvim',
    dependencies = {
        'nvim-tree/nvim-web-devicons', -- optional
    },
    lazy = true,
    config = function()
        require('bufex').setup({
            -- config
        })
    end
},

Setup

require('bufex').setup()
Default configuration
require('hypersonic').setup({
    transfer = {
        ---@type string|nil nil = name will be random selected
        name = nil,

        ---@type string|nil password will need to be entered each time
        password = nil,
        opts = {
            allow_edit = true,
            allow_save = false, -- NOTE: WIP

            ---@type 'always'|'never'
            need_password = 'always',
            server = {
                local_server = true,
                port = 4200,
                host = '127.0.0.1',
            }
        }
    },
    float = {
        ---@type 'none'|'single'|'double'|'rounded'|'solid'|'shadow'|table
        border = 'rounded',

        ---@type number background blur: 0-100 
        winblend = 0,

        ---@type boolean allow nvim-web-devicons
        icons = true,
        keymap = {
            next_window = 'n',
            quit = 'q',
            opts = {
                toggle_save = 'S',
                toggle_edit = 'E',
                toggle_password = 'P',
                continue = 'C',
            }
        }
    }
})

Create own transfer server

  • create
    • TCP server
    • variable
      • array[array[got_data, client_id]]
  • got message GET
    • send all got_data from variable joined by , and all wrapped in {}
    • TS example: '{' + variable.map((buf) => buf[0]).join(',') + '}'
  • other message
    • to variable push [got_data, client_id], client_id can be anything unique
  • user disconected (optional)
    • delte from variable array with client_id

File order

|  📄 LICENSE
|  📄 README.md
|
+-- 📁 lua
|    \-- 📁 bufex
|       |  📄 config.lua
|       |  📄 data.lua
|       |  📄 init.lua
|       |  📄 utils.lua
|       |
|       +-- 📁 local
|       |      📄 client.lua
|       |      📄 local.lua
|       |      📄 server.lua
|       |
|       \-- 📁 ui
|              📄 float.lua
|              📄 input.lua
|              📄 select.lua
|
\-- 📁 plugin
|      📄 bufex.lua
|
\-- 📁 servers
|      📄 ts/main.ts
|      📄 go/main.go

Contributors

tomiis4
tomiis4
founder

About

A plugin for effortless buffer sharing between nvim sessions.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published