You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+15-14Lines changed: 15 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,19 +8,19 @@ Turn your browser¹ into a Neovim client.
8
8
9
9
## How to use
10
10
11
-
Just click on any textarea and it will be immediately replaced by an instance of Firenvim. When you want to set the content of the now hidden textarea to the content of the Neovim instance, just`:w`. If you want to close the Firenvim overlay and return to the textarea run`:q`. If you selected an element where you expected the Firenvim frame to appear and it didn't, try pressing `<C-e>`.
11
+
Just click on any textarea and it will be immediately replaced by an instance of Firenvim. To set the content of the now hidden textarea to the content of the Neovim instance, simply`:w`. If you want to close the Firenvim overlay and return to the textarea, use`:q`. If you selected an element where you expected the Firenvim frame to appear and it didn't, try pressing `<C-e>`.
12
12
13
13
## Installing
14
14
15
15
Before installing anything please read [SECURITY.md](SECURITY.md) and make sure you're okay with everything mentioned. In the event you think of a way to compromise Firenvim, please send me an email (you can find my address in my commits).
16
16
17
17
### Pre-built
18
18
19
-
1. Make sure you are using [Neovim][nvim] 0.4.0 or later. This plugin will not work with vanilla [VIM][vim] or [Vimr][vimr]. Also make sure that your browser hasn't been installed with Snap or Flatpak - these are sandboxed and won't work.
19
+
1. Make sure you are using [Neovim][nvim] 0.4.0 or later. This plugin will not work with vanilla [VIM][vim] or [Vimr][vimr]. Also make sure that your browser hasn't been installed with Snap or Flatpak - these are sandboxed and thus won't work.
20
20
21
21
2. Check if the luabitop package is available by running `:lua bit.band(1,1)` in Neovim. If this throws an error, you will need to install it.
22
22
23
-
3. Install Firenvim as a VIM plugin as you would any other, then run the builtin post-install hook script.
23
+
3. Install Firenvim as a VIM plugin as you would any other, then run the built-in post-install script.
24
24
25
25
*[vim-plug](https://github.com/junegunn/vim-plug)
26
26
@@ -51,20 +51,19 @@ Before installing anything please read [SECURITY.md](SECURITY.md) and make sure
51
51
$ nvim --headless "+call firenvim#install(0) | q"
52
52
```
53
53
54
-
4. Finally install Firenvim in your browser from [Mozilla's store](https://addons.mozilla.org/en-US/firefox/addon/firenvim/) or [Google's](https://chrome.google.com/webstore/detail/firenvim/egpjdkipkomnmjhjmdamaniclmdlobbo).
54
+
4. Finally, install the Firenvim addon for your browser from [Mozilla's store](https://addons.mozilla.org/en-US/firefox/addon/firenvim/) or [Google's](https://chrome.google.com/webstore/detail/firenvim/egpjdkipkomnmjhjmdamaniclmdlobbo).
55
55
56
56
### From source
57
57
58
58
#### Requirements
59
59
60
-
Installing from source requires NodeJS, `npm`, and Neovim >= 0.4.
60
+
Installing from source requires NodeJS, npm, and Neovim >= 0.4.
61
61
62
62
#### Cross-browser steps
63
63
64
-
First, install Firenvim like a regular vim plugin (either by changing your runtime path manually or by using your favourite plugin manager).
65
-
66
-
Then, run the following commands:
64
+
First, install Firenvim like a regular vim plugin (either by changing your runtime path manually or by [using your favourite plugin manager](#pre-built)).
67
65
66
+
Then run the following commands:
68
67
```sh
69
68
git clone https://git.sr.ht/~glacambre/firenvim
70
69
cd firenvim
@@ -77,7 +76,7 @@ These commands should create three directories: `target/chrome`, `target/firefox
77
76
78
77
#### Firefox-specific steps
79
78
80
-
Go to `about:addons`, click on the cog icon and select `install addon from file` (note: this might require setting `xpinstall.signatures.required` to false in `about:config`).
79
+
Go to `about:addons`, click on the cog icon, select `install addon from file` and select the `target/firefox` directory (note: this might require setting `xpinstall.signatures.required` to false in `about:config`).
81
80
82
81
#### Google Chrome/Chromium-specific steps
83
82
@@ -141,15 +140,15 @@ Similarly, you can detect when Firenvim disconnects from a Neovim instance with
141
140
142
141
### Using different settings depending on the page/element being edited
143
142
144
-
If you want to use different settings depending on the textarea you're currently editing, you can use autocommands to do that too. All buffers are named like this: `domainname_page_selector.txt` (see the [toFileName function](src/utils/utils.ts)). This means that you can for example set the file type to markdown for all GitHub buffers:
143
+
If you want to use different settings depending on the textarea you're currently editing, you can use autocommands to do that too. All buffers are named like this: `domainname_page_selector.txt` (see the [toFileName function](src/utils/utils.ts)). For example, this will set file type to markdown for all GitHub buffers:
145
144
146
145
```vim
147
146
au BufEnter github.com_*.txt set filetype=markdown
148
147
```
149
148
150
149
### Understanding Firenvim's configuration object
151
150
152
-
You can configure the rest of Firenvim by creating a variable named `g:firenvim_config` in your init.vim. This variable is a dictionary containing the keys "globalSettings" and "localSettings". `g:firenvim_config["localSettings"]`is a dictionary, mapping Javascript patterns that match against the full URL to settings that are used for all URLs matched by that pattern. When multiple patterns match a same URL, the pattern with the highest "priority" value is used. Here is an example (the settings and their possible values will be explained in the next subsections):
151
+
You can configure everything else about Firenvim by creating a dictionnary named `g:firenvim_config` in your init.vim and setting the keys "globalSettings" and "localSettings". In the dictionary `g:firenvim_config["localSettings"]`you can map Javascript patterns that match against the full URL to settings that are used for all URLs matched by that pattern. When multiple patterns match a URL, the pattern with the highest "priority" value is used. Here is an example (the settings and their possible values will be explained in the next subsections):
153
152
154
153
```vim
155
154
let g:firenvim_config = {
@@ -212,11 +211,13 @@ You can chose to use an external command line (and thus save a line of space) by
212
211
let fc['.*'] = { 'cmdline' : 'firenvim' }
213
212
```
214
213
214
+
When you then enter command mode, the command will appear in a sort of "pop-up" instead of the bottom of the frame.
215
+
215
216
### Using a single neovim instance
216
217
217
218
Firenvim can be made to use a single neovim instance. To do so, set the `server` setting to `'persistent'`. Firenvim will automatically start an instance on Firefox's startup and then launch a new one every time the previous one is `:quit`'ed. In this mode, every new Firenvim window is actually a Neovim floating window. This means that having the cursor move to another window/opening new floating windows can be pretty confusing and should be avoided.
218
219
219
-
Note: this requires a Neovim compiled at commit a2efc9c or more recent.
220
+
Note: this requires Neovim [commit a2efc9c](https://github.com/neovim/neovim/commit/a2efc9c) or later, which has no official release yet.
220
221
221
222
```vim
222
223
let g:firenvim_config = {
@@ -269,14 +270,14 @@ Known Issues: some chat apps do not react to firenvim#press_keys (e.g. Slack).
269
270
270
271
### Automatically syncing changes to the page
271
272
272
-
Since Firenvim just uses the BufWrite event in order to detect when it needs to write neovim's buffers to the page, Firenvim can be made to automatically synchronize all changes like this:
273
+
Since Firenvim simply uses the BufWrite event in order to detect when it needs to write neovim's buffers to the page, Firenvim can be made to automatically synchronize all changes like this:
273
274
274
275
```vim
275
276
au TextChanged * ++nested write
276
277
au TextChangedI * ++nested write
277
278
```
278
279
279
-
Depending on how large the edited buffer is, this could be a little slow. A better approach would then be to delay writes, like this:
280
+
Depending on how large the edited buffer is, this could be a little slow. This more sophisticated approach will throttle writes:
0 commit comments