Commit Graph

138 Commits (master)

Author SHA1 Message Date
Marco Hinz 8254861659
Check if path is protocol supported by netrw
References #87
6 years ago
Marco Hinz 81bfe645e6
Check if first buffer was handled already
References #84
6 years ago
Marco Hinz 5faf37bed6
Avoid empty buffer when starting a new process
Previously, when doing `nvr --remote-tab file` without an already running nvim
process, nvr would first start a new nvim process without any arguments and then
`:tabedit file`.

This would leave an empty first buffer and is not how Vim's `vim --servername
foo --remote-tab` behaves.

Now, nvr reuses the first buffer when starting a new process for any of the
--remote options.

`nvr -p` and friends are already working correctly.

Fixes #84
6 years ago
Marco Hinz 2852b64ba3
Don't convert to absolute path
Previously we converted any path given to nvr to an absolute one. But then `nvr
http://example.com/file` wouldn't trigger netrw's BufReadCmd event and thus
download the file, because it would see an absolute path like
`~/http://example.com/file` and the netrw autocmd only matches on `http://*`.

Fixes #86
6 years ago
Marco Hinz a1a426a894
Make -q work with stdin
Example:

  grep -Rn foo . | nvr -q -
6 years ago
Marco Hinz 450f2c5fe6
Fix waiting logic for -d 6 years ago
Marco Hinz 31b5285f8e
New tab if diff mode in existing process 6 years ago
Marco Hinz b270bbc31b
Refactor waiting mechanism 6 years ago
Marco Hinz 7fbe786a79
Add Nvim.wait_for_current_buffer() 6 years ago
Marco Hinz da0484ce8d
Improve -d 6 years ago
Marco Hinz aab4ed9d3e
Use first buffer for -o/-O/-p when starting new process 6 years ago
Marco Hinz a0197448a6
Make windows equally high/wide for -o/-O/-d 6 years ago
Marco Hinz 95d8aa3568
New option: -d 6 years ago
Marco Hinz f104f234d9
Improve quoting for -q 6 years ago
Marco Hinz d584112075
Improve quoting when reading from stdin 6 years ago
Marco Hinz 4f932bb6ff
Replace unnecessary Nvim.eval()
References #77
6 years ago
Marco Hinz 1c16aced9e
Do not create temporary file 6 years ago
Marco Hinz 172ee11a13
Filter filenames through fnameescape()
Fixes #77
6 years ago
Marco Hinz ac49415d43
Gracefully close the event loop
This uses the APIs new close() method from neovim 0.2.3.
6 years ago
Marco Hinz a08ffdf89a
New option: --version 6 years ago
Marco Hinz 97601e6847
Help: add GitHub URL 6 years ago
Marco Hinz aeb08b81f2
Make -c/-cc/--remote-expr read from stdin on -
Fixes #72.
7 years ago
Marco Hinz 9f018a87d4
Refactoring: Neovim/nvim -> Nvr/nvr 7 years ago
Marco Hinz 01fade4a9d
Refactoring: silencing
Fixes #69.
7 years ago
Marco Hinz df89d17f56
Refactoring: sanitize address 7 years ago
Marco Hinz 83b9d014f7
New option: --nostart
By default nvr starts a new nvim process if none is found. Use this option to
avoid that.

Closes #68.
7 years ago
Marco Hinz 8dccd952b5
Don't start nvim on --serverlist
Fixes #67.
7 years ago
Marco Hinz a10e931247
Correct -h output 7 years ago
Marco Hinz 40f5705eef
Be more precise when to implicitly use --remote-silent 7 years ago
Marco Hinz f8250c0c38
From all --remote* options, check the implicit --remote-silent last
References #43.
7 years ago
Marco Hinz 905bbb7dc3
Fix -p
Closes #65.
7 years ago
Marco Hinz 67f36cc550
Improve error message of --remote-expr
References #63.
7 years ago
Marco Hinz 0c7068b2cc
Start new nvim instance when no argument given
Closes #62.
7 years ago
Marco Hinz 282aa12fb4
Check if Unix domain socket is connectable before attaching 7 years ago
Marco Hinz d28c9c00bf
Remove useless level of indentation 7 years ago
Marco Hinz 538e18be6d
Move address type detection logic into own function 7 years ago
Marco Hinz ec612dc16c
Improve check for IPv4 address
If the address contains only one colon followed by a number, assume TCPv4 and
a Unix domain otherwise.

Closes #60.
7 years ago
Marco Hinz d138b98bde
Ignore "E37: No write since last change" in --remote*
References https://github.com/mhinz/neovim-remote/issues/54
7 years ago
Marco Hinz 64e9f486a1
Revert "Temporarily reset &modified when opening files"
This reverts commit 6845b8b5a6.
7 years ago
Marco Hinz 6845b8b5a6
Temporarily reset &modified when opening files
:edit and similar commands used by the --remote* options throw an exception if
the buffer is modified:

    E37: No write since last change (add ! to override)

Using :enew! doesn't work, since it reverts all changes. Thus we simply reset
&modified temporarily.

References https://github.com/mhinz/neovim-remote/issues/54
7 years ago
Marco Hinz c1fedb4de8
Redirect stdout to stdin when forking
This is needed so the new nvim process ignores the data in stdin, because it
comes from a TTY now.
7 years ago
Marco Hinz 4b8c384462
Only process + at the beginning of --remote*
nvr +1 +2 3 +4 5

The above will do the following in the given order:

  - open file "5"
  - open file "+4"
  - open file "3"
  - execute :2
  - execute :1

That's how Vim does it.
7 years ago
Marco Hinz 957082771b
Ignore OSError instead of FileNotFoundError 7 years ago
Marco Hinz 13808fd5ec
Ignore only invalid addresses 7 years ago
Harm te Hennepe a85aa94321 Support multiple + commands and let empty + go to the last line 7 years ago
Drew Neil ee9a6c4f39 Document `-p` flag independent of `--remote-tab` flag 7 years ago
Marco Hinz a973424000
Make -s overwrite all other options
References https://github.com/mhinz/neovim-remote/issues/48#issuecomment-318163612
7 years ago
Marco Hinz 625b8ddf45
Change command to run using $NVR_CMD
References https://github.com/mhinz/neovim-remote/issues/48
7 years ago
Marco Hinz 4e827d4d7d
Process all options before waiting
References https://github.com/mhinz/neovim-remote/issues/46
7 years ago
Marco Hinz fa9ecbcc71
--serverlist: don't print empty lines 7 years ago
Marco Hinz af4103a16a
Sort short options in help output 7 years ago
Marco Hinz 5df48bbf2c
Add -s option 7 years ago
Marco Hinz 031c7a911f
Rename variable "flags" to "options" 7 years ago
Marco Hinz 70f8bf86d7
Docs: add nvr/git example to help message 7 years ago
Marco Hinz 1e9be0473f
Docs: instance -> process 7 years ago
Marco Hinz 2111ea9d0a
Consider the possibility that "nvim" is not in $PATH 7 years ago
Marco Hinz 6e1fe04456
Make forked child try attaching multiple times
This most likely makes it attach faster than the previous fixed 1 second
timeout.
7 years ago
Marco Hinz 58d56cba6b
More robust socket handling 7 years ago
Marco Hinz 8f8fa3ed27
Improve the start of a new instance
If the given instance is not found, we fork nvr.

The parent process gets replaced by a new nvim instance.

The child waits for one second and then tries attaching to the newly started
nvim instance.

Advantage: All options passed to nvr are now correctly handled even by new nvim
instances that were started by nvr.

References https://github.com/mhinz/neovim-remote/issues/44
7 years ago
Marco Hinz 7422ee6d90
Handle files beginning with - for --remote options
Small tradeoff: You get no error anymore when you provide no arguments to
--remote and friends.

Internally this results in an empty list instead of None. This is important,
because otherwise you'd get an error with `--remote -- foo`, because `--` and
`foo` would be parsed into the remaining arguments and --remote had no argument.

In return it's now possible to provide files beginning with a dash to any
--remote option. Leading -- before those files is not needed.

Equivalent:

    --remote --file
    --remote -- --file

Fixes https://github.com/mhinz/neovim-remote/issues/43
7 years ago
Marco Hinz 39519a7b00
Make main() take optional environment 7 years ago
Marco Hinz aee0fa049c
Rename package to "nvr" 7 years ago
Marco Hinz c405bf48de Upload to PyPI
You can now install "nvr" via:

    pip3 install neovim-remote

References #8.
8 years ago
Marco Hinz f12722e8b3 Make --serverlist work again
Refactoring gone wrong. *cough*

Closes #7.
8 years ago
Marco Hinz 06d9297d3e Add --remote-tab-{wait,silent,wait-silent} 8 years ago
Marco Hinz 69a42753a5 Make --remote-tab take +{cmd} 8 years ago
Marco Hinz beba805d9a Improve option descriptions 8 years ago
Marco Hinz 1eaf77cfce Make --remote{,-silent,-wait,-wait-silent} take +{cmd}
This is done to stay compatible to Vim, see ":h --remote".

References #5.
8 years ago
Marco Hinz d56e137bc7 Simplify TCP/Unix socket distinction 8 years ago
Marco Hinz 994229d97c Make license future-proof 8 years ago
Anmol Sethi abbead4ba1 Support both Unix domain and TCP sockets 8 years ago
Marco Hinz 00252f6195 Implement -c 9 years ago
Marco Hinz a863309db1 Print usage when no arguments are given 9 years ago
ohle a308d2d0c0 Use absolute file paths for opening files
Otherwise, filenames are interpreted as relative to neovim's cwd, which is not
necessarily that of the shell executing nvr.
9 years ago
Marco Hinz 87024b711f Remove obsolete run_nvim() 9 years ago
Marco Hinz 3871822bbb Process unused arguments first 9 years ago
Marco Hinz 8e7d5ff995 Catch --remote-expr failures 9 years ago
Marco Hinz d69792bcc6 Implement -l 9 years ago
Marco Hinz f6395b720b Implement --serverlist.. again 9 years ago
Marco Hinz dc41ddec88 Clean up --help 9 years ago
Marco Hinz 8e649507b3 Implement -O and -p 9 years ago
Marco Hinz 2f35681794 Code style: some align and spacing changes 9 years ago
Marco Hinz 7abbe9618e Implement -o 9 years ago
Marco Hinz 29c0f06f68 Add default clause for --remote-expr 9 years ago
Marco Hinz 931f6bf55f Feed unused arguments to --remote-silent 9 years ago
Marco Hinz 5b1cd8ee03 Ignore unknown arguments
nvr is not a real wrapper anymore, for simplicty reasons and because most
people probably didn't alias nvr to nvim anway. If that were the case, you'd
always load the python provider first, even if you not end up using it, which
leads to a certain delay.

nvim startup time is crucial.
9 years ago
Marco Hinz 318f33abd8 README: adapt to name changes 9 years ago
Marco Hinz 2d47f69aba neovim-remote.py -> nvr 9 years ago