chipsenkbeil/distant.nvim

github github
remote-development plugin
star 206
stars
alert-circle 14
open issues
users 8
subscribers
git-branch 1
forks
CREATED

2021-07-31

UPDATED

4 days ago

packer

require('packer').startup(function()
  use 'chipsenkbeil/distant.nvim'
end)

paq

require "paq" { 
  'chipsenkbeil/distant.nvim'
}

distant.nvim

CI

A wrapper around distant that enables users to edit remote files from the comfort of their local environment.

  • Requires neovim 0.5+
  • Requires distant 0.15.0+

🚧 (Alpha stage software) This plugin is in rapid development and may break or change frequently! 🚧

Features

Supports the following features against remote machines:

  • Retrieving a list of available files & directories
  • Editing remote files
  • Creating and deleting files & directories
  • Copying files & directories
  • Renaming files & directories
  • Running LSPs remotely and getting live results locally

Support is coming up for these features:

Demo

Intro Video

Demonstrates using distant.nvim to edit files and use a language server on a remote machine.

Intro Video

v0.1.0 Update

Demonstrates the new release of distant.nvim (v0.1.0) leveraging distant's new lua module (v0.15.0). Main highlights include:

  • integrated ssh authentication
  • ssh mode
  • refactored and simplified vim & Lua APIs
  • complete help documentation

v0.1.0 update

Installation & Setup

Using packer.nvim, the quickest way to get up and running is the following:

use {
  'chipsenkbeil/distant.nvim',
  config = function()
    require('distant').setup {
      -- Applies Chip's personal settings to every machine you connect to
      --
      -- 1. Ensures that distant servers terminate with no connections
      -- 2. Provides navigation bindings for remote directories
      -- 3. Provides keybinding to jump into a remote file's parent directory
      ['*'] = require('distant.settings').chip_default()
    }
  end
}

The above will initialize the plugin with the following:

  1. Any spawned distant server will shutdown after 60 seconds of inactivity
  2. Standard keybindings are assigned for remote buffers (described below)

Within a file

Key Action
- lua distant.nav.actions.up()

Within a directory

Key Action
<Return> lua distant.nav.actions.edit()
- lua distant.nav.actions.up()
K lua distant.nav.actions.mkdir()
N lua distant.nav.actions.newfile()
R lua distant.nav.actions.rename()
D lua distant.nav.actions.remove()

Post-setup

Run :DistantInstall to complete the setup.

  • For more information on installation, check out :help distant-installation
  • For more information on settings, check out :help distant-settings

Getting Started

In order to operate against a remote machine, we first need to establish a connection to it. To do this, we run :DistantLaunch {host} where the host points to the remote machine and can be an IP address like 127.0.0.1 or a domain like example.com.

The launch command will attempt to SSH into the remote machine using port 22 by default and start an instance of distant.

Once started, all remote operations will be sent to that machine! You can try out something simple like displaying a list of files, directories, and symlinks by running :DistantOpen /some/dir, which will open a dialog that displays all of the contents of the specified directory.

Documentation

For more details on available functions, settings, commands, and more, please check out the vim help documentation via :help distant.txt.

License

This project is licensed under either of

Apache License, Version 2.0, (LICENSE-APACHE or apache-license) MIT license (LICENSE-MIT or mit-license) at your option.