GithubHelp home page GithubHelp logo

remote.nvim's Introduction

remote.nvim

Edit remote files with local neovim configuration.

Edit them as local directories.

No other dependencies required for remote machine except ssh.

Usage

First add a configuration.

Here is an example.

[
  {
    "host": "localhost",
    "user": "user",
    "passwd": "passwd",
    "remote_dir": "/home/niuiic/Documents/projects/nvim/remote.nvim",
    "mount_point": "remote.nvim",
    "options": ["-p", 22]
  },
  {
    "host": "10.10.11.12",
    "user": "user",
    "passwd": "passwd",
    "remote_dir": "/home/niuiic/Documents/projects/nvim/remote2.nvim",
    "mount_point": "remote2.nvim"
  }
]

remote_dir and mount_point should be directories. options will be passed to sshfs.

Then you can connect to remote directory with require("remote").connect().

Avaliable functions.

function desc
connect connect to the remote directories
disconnect disconnect
reconnect reconnect
edit_config edit configuration
check_log check log file

Dependencies

All dependencies are only required locally.

Config

Here is the default configuration.

{
	config_file = ".nvim/remote.json",
	log_file = ".nvim/remote.log",
	unmount = function(path)
		return "umount " .. path
	end,
	disconnect_on_leave = true,
	---@type fun(config: remote.Config)
	on_each_to_connect = function() end,
	---@type fun(config: remote.Config)
	on_each_connected = function() end,
	---@type fun(config: remote.Config)
	on_each_to_disconnect = function() end,
	---@type fun(config: remote.Config)
	on_each_disconnected = function() end,
}

---@class remote.Config
---@field host string
---@field user string
---@field passwd string
---@field remote_dir string
---@field mount_point string
---@field options string[] | nil

Troubleshooting

  • Remote directories were not mounted/unmounted correctly

Check log file, sshfs command may failed for some reason.

  • Remote directories were not updated

Check the document of sshfs.

  • Neovim is stuck

Someting wrong with ssh, cancel the task with <C-c> and check you configuration.

  • Failed to unmount directories

It may not be possiable to unmount the directories if ssh is unable to connect to the remote machine. You can modify the unmount option in configuration to force umount and avoid stuck process. (This always require root privileges, so it's an option.)

remote.nvim's People

Contributors

niuiic avatar

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.