summaryrefslogtreecommitdiff
path: root/Readme.md
blob: 5a010aef90439d34b4f845be0d0f403b16b84204 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
rclone.nvim
===

Uses [rclone](https://rclone.org/) under the hood.

`copy` or `sync` folders,  
or copy the file in the current buffer  
to a remote in your `rclone.conf`


## Table of Contents

- [Commands](#commands)
- [Usage](#usage)
- [Install](#install)


## Commands

```
:Rclone [<command>] [<remote>] [options]

Arguments:
command		Command to run: [copy, copyFile, sync]
remote		Name of the remote section defined in rclone.conf
		If only one remote is specified that remote is used by default.
		Otherwise the remote with "vim_rclone_default = true" is used.

Options:
--dry-run	Print command to run and don't execute
```


## Usage

Example `rclone.conf`

```
[Test]
type = sftp
host = example.org
user = admin
pass = pa55w0rd
vim_rclone_local_path = .
vim_rclone_remote_path = /test

[Test_another]
type = sftp
host = example.org
user = admin
pass = pa55w0rd
vim_rclone_local_path = ./test_another
vim_rclone_remote_path = /test/another
vim_rclone_default = true
```

`:Rclone copy` copies the local `test_another` folder to the remote `/test/another` because `vim_rclone_default` is set for the **Test_another** remote.

To upload to the **Test** remote use `:Rclone copy Test`.

The resulting command from the example above would be
```sh
rclone copy $PATH_TO_PROJECT/test_another Test_another:/test/another --config=./rclone.conf
--exclude=.git/ --exclude=.gitignore --exclude=.rcloneignore
--exclude-from=$PATH_TO_PROJECT/test_another/.gitignore --exclude-from=$PATH_TO_PROJECT/test_another/.rcloneignore
--log-level=INFO --log-file=${vim.fn.stdpath('data')}/rclone_nvim/rclone.log
```

### exclude files

You can extend or overwrite the global `g:vim_rclone_configurable_default_exclude_patterns` variable.  
The default patterns are
`{'.git/', '.gitignore', '.rcloneignore'}`

`rclone.nvim` uses the patterns defined in a `.gitignore` and `.rcloneignore`.

If you want to upload folders that are in the `.gitignore` like a `/build/` folder, then add `!/build/` to your `.rcloneignore`.

**Caution:**

[rclone exclude patterns](https://rclone.org/filtering/#pattern-syntax) for folders **need** a trailing slash.  
If you have ignored folders in your `.gitignore` then you have to add a trailing slash to them, or define them separately in the `.rcloneignore`.


## Install

Like any other nvim plugin.

For example with [vim-plug](https://github.com/junegunn/vim-plug)

```vim
Plug 'https://gitlab.com/dweipert.de/rclone.nvim'
```