Skip to content

Commit

Permalink
update readme with more explicit language for url/page/element config
Browse files Browse the repository at this point in the history
  • Loading branch information
benlieb authored and glacambre committed Aug 3, 2023
1 parent 3c4babf commit 28a5516
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,11 @@ vim.api.nvim_create_autocmd({'UIEnter'}, {

Similarly, you can detect when Firenvim disconnects from a Neovim instance with the `UILeave` autocommand.

### Using different settings depending on the page/element being edited
### Using different settings depending on the url/page/element being edited

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:
The nvim buffer loaded into a textarea is given a unique name. All buffers are named something like this: `domainname_page_selector.txt` (see the [toFileName function](src/utils/utils.ts)).

This alows you to configure different settings by creating autocommands targeting/matching the buffername for that url/page/element. For example, this will set file type to markdown for all GitHub buffers:

```lua
vim.api.nvim_create_autocmd({'BufEnter'}, {
Expand All @@ -138,6 +140,8 @@ vim.api.nvim_create_autocmd({'BufEnter'}, {
})
```

To view the buffername of your nvim instance in a textarea, use `:buffers`.

### Understanding Firenvim's configuration object

You can configure everything else about Firenvim by creating a dictionary named `vim.g.firenvim_config` in your init.lua and setting the keys "globalSettings" and "localSettings". In the dictionary `vim.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):
Expand Down

0 comments on commit 28a5516

Please sign in to comment.