Something went wrong. Try again.
forked from nix-community/nixvim
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366{ lib, ... }:let inherit (lib) types; inherit (lib.nixvim) defaultNullOpts literalLua mkNullOrOption mkNullOrStr ;inlib.nixvim.plugins.mkNeovimPlugin { name = "distant"; package = "distant-nvim"; description = "Edit files, run programs, and work with LSP on a remote machine from the comfort of your local environment.";
maintainers = [ lib.maintainers.GaetanLepage ];
setup = ":setup";
dependencies = [ "distant" ];
settingsOptions = { buffer = { watch = { enabled = defaultNullOpts.mkBool true '' If true, will watch buffers for changes. ''; retry_timeout = defaultNullOpts.mkUnsignedInt 5000 '' Time in milliseconds between attempts to retry a watch request for a buffer when the path represented by the buffer does not exist.
Set to `0` to disable. ''; }; };
client = { bin = defaultNullOpts.mkStr' { example = lib.literalMD ''"\$\{lib.getExe distant}"''; pluginDefault = literalLua '' (function() local os_name = require('distant-core').utils.detect_os_arch() return os_name == 'windows' and 'distant.exe' or 'distant' end)() ''; description = '' Binary to use locally with the client.
Defaults to `"distant"` on Unix platforms and `"distant.exe"` on Windows. ''; };
log_file = defaultNullOpts.mkStr null '' Log file path. '';
log_level = defaultNullOpts.mkEnum [ "trace" "debug" "info" "warn" "error" "off" ] null '' Log level. ''; };
keymap = let keymapType = with types; either str (listOf str); mkKeymap = defaultNullOpts.mkNullable keymapType; in { dir = { enabled = defaultNullOpts.mkBool true '' If true, will apply keybindings when the buffer is created. '';
copy = mkKeymap "C" '' Keymap to copy the file or directory under the cursor. '';
edit = mkKeymap "<Return>" '' Keymap to edit the file or directory under the cursor. '';
tabedit = mkKeymap "<C-t>" '' Keymap to open the file or directory under the cursor in a new tab. '';
metadata = mkKeymap "M" '' Keymap to display metadata for the file or directory under the cursor. '';
newdir = mkKeymap "K" '' Keymap to create a new directory within the open directory. '';
newfile = mkKeymap "N" '' Keymap to create a new file within the open directory. '';
rename = mkKeymap "R" '' Keymap to rename the file or directory under the cursor. '';
remove = mkKeymap "D" '' Keymap to remove the file or directory under the cursor. '';
up = mkKeymap "-" '' Keymap to navigate up into the parent directory. ''; };
file = { enabled = defaultNullOpts.mkBool true '' If true, will apply keybindings when the buffer is created. '';
up = mkKeymap "-" '' Keymap to navigate up into the parent directory. ''; };
ui = { exit = mkKeymap [ "q" "<Esc>" ] '' Keymap used to exit the window. '';
main = { connections = { kill = mkKeymap "K" '' Kill the connection under cursor. '';
toggle_info = mkKeymap "I" '' Toggle information about the server/connection under cursor. ''; };
tabs = { goto_connections = mkKeymap "1" '' Keymap used to bring up the connections tab. '';
goto_system_info = mkKeymap "2" '' Keymap used to bring up the system info tab. '';
goto_help = mkKeymap "?" '' Keymap used to bring up the help menu. '';
refresh = mkKeymap "R" '' Keymap used to refresh data in a tab. ''; }; }; }; };
manager = { daemon = defaultNullOpts.mkBool false '' If true, when neovim starts a manager, it will be run as a daemon, which will detach it from the neovim process. This means that the manager will persist after neovim itself exits. '';
lazy = defaultNullOpts.mkBool true '' If true, will avoid starting the manager until first needed. '';
log_file = defaultNullOpts.mkStr null '' Log file path. '';
log_level = defaultNullOpts.mkEnum [ "trace" "debug" "info" "warn" "error" "off" ] null '' Log level. '';
user = defaultNullOpts.mkBool false '' If true, when neovim starts a manager, it will listen on a user-local domain socket or windows pipe rather than the globally-accessible variant. ''; };
network = { private = defaultNullOpts.mkBool false '' If true, will create a private network for all operations associated with a singular neovim instance. '';
timeout = { max = defaultNullOpts.mkUnsignedInt 15000 '' Maximum time to wait (in milliseconds) for requests to finish. '';
interval = defaultNullOpts.mkUnsignedInt 256 '' Time to wait (in milliseconds) inbetween checks to see if a request timed out ''; };
windows_pipe = defaultNullOpts.mkStr null '' If provided, will overwrite the pipe name used for network communication on Windows machines. '';
unix_socket = defaultNullOpts.mkStr null '' If provided, will overwrite the unix socket path used for network communication on Unix machines. ''; };
servers = defaultNullOpts.mkNullable' { type = types.attrsOf ( types.submodule { freeformType = with types; attrsOf anything;
options = { connect = { default = { scheme = mkNullOrStr '' Scheme to use in place of letting distant infer an appropriate scheme (e.g. `"ssh"`). '';
port = mkNullOrOption types.ints.unsigned '' Port to use when connecting. '';
username = mkNullOrStr '' Username when connecting to the server (defaults to user running neovim). '';
options = mkNullOrStr '' Options to pass along to distant when connecting (e.g. ssh backend). ''; }; };
cwd = defaultNullOpts.mkStr null '' If specified, will apply the current working directory to any cases of spawning processes, opening directories & files, starting shells, and wrapping commands.
Will be overwritten if an explicit `cwd` or absolute path is provided in those situations. '';
launch = { default = { scheme = mkNullOrStr '' Scheme to use in place of letting distant infer an appropriate scheme (e.g. `"ssh"`). '';
port = mkNullOrOption types.ints.unsigned '' Port to use when launching (not same as what server listens on). '';
username = mkNullOrStr '' Username when accessing machine to launch server (defaults to user running neovim). '';
bin = mkNullOrStr '' Path to distant binary on remote machine. '';
args = mkNullOrOption (with types; listOf str) '' Additional CLI arguments for binary upon launch. '';
options = mkNullOrStr '' Options to pass along to distant when launching (e.g. ssh backend). ''; }; };
lsp = defaultNullOpts.mkAttrsOf (types.submodule { freeformType = with types; attrsOf anything; options = { cmd = mkNullOrOption (with types; either str (listOf str)) '' LSP command to run. '';
root_dir = mkNullOrOption (with types; either str (listOf str)) '' Path to the root directory or a function to locate it: ```lua fun(path:string, bufnr:number):string ``` '';
filetypes = mkNullOrOption (with types; listOf str) '' List of filetypes for which to enable this LSP server. '';
on_exit = mkNullOrOption types.rawLua '' Callback when exiting the LSP server.
```lua fun(code:number, signal?:number, client_id:string) ``` ''; }; }) { } '' Settings to use to start LSP instances. Mapping of a label to the settings for that specific LSP server ''; }; } ); description = '' Collection of settings for servers defined by their hostname.
A key of `"*"` is special in that it is considered the default for all servers and will be applied first with any host-specific settings overwriting the default. ''; example = { "192.168.1.42" = { default = { username = "me"; port = 11451; }; }; }; pluginDefault = { "*" = { connect.default = { }; cwd = null; launch.default = { }; lsp = { }; }; }; }; };
settingsExample = { "network.unix_socket" = "/tmp/distant.sock"; servers."192.168.1.42" = { default = { username = "me"; port = 11451; }; }; };}