neovim codemp plugin -- code multiplexer
Find a file
2024-09-17 17:58:32 +02:00
lua/codemp fix: pass callback arg, add available field 2024-09-17 17:58:32 +02:00
.editorconfig chore: removed old rust stuff 2024-08-17 17:14:22 +02:00
build.lua fix: try with uv.spawn powershell.exe for win 2024-09-17 03:46:11 +02:00
lazy.lua fix: this should make require unneeded on nvim 2024-09-05 05:30:21 +02:00
LICENSE chore: relicensed 2024-09-06 14:14:29 +02:00
README.md docs: some buttons for nvim too 2024-09-16 04:52:24 +02:00

codemp GitHub last commit LuaRocks Gitter

codemp is a collaborative text editing solution to work remotely.

It seamlessly integrates in your editor providing remote cursors and instant text synchronization, as well as a remote virtual workspace for you and your team.

codemp-nvim

This is the reference codemp neovim plugin maintained by hexedtech

installation

Currently only lazy.nvim is supported, but codemp should work with any plugin manager able to run build.lua upon installation and update.

Just add hexedtech/codemp-nvim in your plugin spec.

Note that the native codemp lua library will be downloaded automatically on each update.

neo-tree integration

codemp-nvim integrates with neo-tree to provide a rich and intuitive file tree.

To enable this integration, add neo_tree = true in plugin opts and add codemp as a neo-tree source:

{
	"hexedtech/codemp-nvim",
	opts = { neo_tree = true },
},
{
	"nvim-neo-tree/neo-tree.nvim",
	dependencies = { "hexedtech/codemp-nvim" },
	config = function ()
		require('neo-tree').setup({
			sources = {
				-- your other sources
				"codemp.neo-tree",
			},
		})
	end,
}

usage

Interact with this plugin using the :MP command.

Most actions can be performed from the side tree: toggle it with :MP toggle.

command description
:MP toggle toggles the codemp sidebar
:MP connect [host] [username] [password] to connect to server, user and pwd will be prompted if not given

once connected, more commands become available:

command description
:MP disconnect disconnects from server
:MP id shows current client id
:MP start <workspace> will create a new workspace with given name
:MP invite <user> [workspace] invite given user to workspace
:MP available list all workspaces available to join
:MP join <workspace> will join requested workspace; starts processing cursors, users and filetree

after a workspace is joined, more commands become available:

command description
:MP leave <workspace> disconnect from a joined workspace
:MP attach <buffer> will attach to requested buffer if it exists (opens a new local buffer and uses current window)
:MP detach <buffer> detach from a buffer and stop receiving changes
:MP share shares current file: creates a new buffer with local file's content, and attach to it
:MP sync forces resynchronization of current buffer
:MP create <bufname> will create a new empty buffer in workspace
:MP delete <bufname> will delete a buffer from workspace

quick start

  • first connect to server with :MP connect
  • then join a workspace with :MP join <workspace>
  • either attach directly to a buffer with :MP attach <buffer> or browse available buffers with :MP toggle

MP command autocompletes available options for current state, so cycle if you forget any name

configuration

codemp-nvim gets most of its configuration from setup() options. If you're using lazy.nvim, just place these in the opts table in your spec, otherwise be sure to require('codemp').setup({...}).

opts = {
	neo_tree = false, -- enable neo-tree integration
	timer_interval = 100, -- poll for codemp callbacks every __ ms
	debug = false, -- print text operations as they happen
}

codemp-nvim reads some global vim variables for configuration:

  • vim.g.codemp_username will be used when connecting instead of prompting for username
  • vim.g.codemp_password will be used when connecting instead of prompting for password

building

this plugin relies on the native codemp lua bindings: just compile the main codemp project with lua feature enabled, rename the output library into native.so (or .dll or .dylib) and place it together with the plugin lua files while bundling

.config/
  |-nvim/
  :  |-lua/
  :  :  |-codemp/
  :  :  :  |- native.(so|dll|dylib)
  :  :  :  |- init.lua
  :  :  :  :   ...