Skip to content

Commit 8a51c91

Browse files
committed
Merge branch 'tech/typescript'
2 parents 26eb5dd + bf1f54a commit 8a51c91

File tree

4 files changed

+39
-23
lines changed

4 files changed

+39
-23
lines changed

README.md

+26-11
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Forem.nvim
22

3-
<p align="center">This plugin integrates Neovim with Forem platforms (for example, dev.to)</p>
3+
<p align="center">This plugin integrates Neovim with Forem platforms like [dev.to](https://dev.to)</p>
44

55
https://user-images.githubusercontent.com/12272702/175755820-a2b93f4b-fd5c-416b-8b9e-d981335ef75c.mov
66

@@ -38,20 +38,37 @@ https://user-images.githubusercontent.com/12272702/175755866-62be0b6c-31b2-4f45-
3838

3939
## Installation
4040

41-
Using [packer](https://github.com/wbthomason/packer.nvim):
41+
### Using [lazy](https://github.com/folke/lazy.nvim):
42+
43+
```lua
44+
{
45+
"Massolari/forem.nvim",
46+
dependencies = {
47+
"nvim-lua/plenary.nvim",
48+
"nvim-telescope/telescope.nvim",
49+
"rcarriga/nvim-notify"
50+
}
51+
}
52+
```
53+
54+
### Using [packer](https://github.com/wbthomason/packer.nvim):
4255

4356
```lua
4457
use {
4558
"Massolari/forem.nvim",
4659
requires = {
4760
"nvim-lua/plenary.nvim",
48-
"nvim-telescope/telescope.nvim"
61+
"nvim-telescope/telescope.nvim",
62+
"rcarriga/nvim-notify"
4963
}
5064
}
5165
```
5266

5367
## Setup
5468

69+
> [!NOTE]
70+
> These instructions are for the dev.to platform.
71+
5572
First, you need to generate an API key for the DEV platform.
5673

5774
For dev.to, you can do it in [the end of the extension's page](https://dev.to/settings/extensions)
@@ -62,17 +79,15 @@ With your API key, you just need to set it into the `FOREM_API_KEY` environment
6279

6380
The plugin has the following commands and functions available in `forem-nvim` module:
6481

65-
| function | command | description |
66-
| --- | --- | --- |
67-
| `feed()` | `:Forem feed` | Shows fresh articles from the feed, then you can read it in Neovim or open it in the browser |
68-
| `my_articles()` | `:Forem my_articles` | Shows all your articles, then you can pick one to edit |
69-
| `new_article()` | `:Forem new_article` | Asks for a title, then creates an article with the given title and open it to edit |
70-
| `open_by_url()` | `:Forem open_by_url` | Asks for an URL, then opens the article |
82+
| function | command | description |
83+
| --------------- | -------------------- | -------------------------------------------------------------------------------------------- |
84+
| `feed()` | `:Forem feed` | Shows fresh articles from the feed, then you can read it in Neovim or open it in the browser |
85+
| `my_articles()` | `:Forem my_articles` | Shows all your articles, then you can pick one to edit |
86+
| `new_article()` | `:Forem new_article` | Asks for a title, then creates an article with the given title and open it to edit |
87+
| `open_by_url()` | `:Forem open_by_url` | Asks for a URL, then opens the article |
7188

7289
After you save the buffer it'll automatically be saved in the cloud.
7390

74-
**Note: these functions will only be available after the `setup` call**
75-
7691
## Contributing
7792

7893
Please, don't hesitate in contributing by creating issues and opening pull requests.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
},
99
"scripts": {
1010
"build": "make",
11-
"dev": "tstl -p ./src/tsconfig.json --watch"
11+
"dev": "tstl --watch"
1212
},
1313
"keywords": [],
1414
"author": "",

tests/minimal_init.lua

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2+
append = function(option, value)
3+
option.append(option, value)
4+
end
25
loadModule = function(module, source, directory)
36
local moduleDir = directory or "/tmp/" .. module
47
local directoryExists = vim.fn.isdirectory(moduleDir)
58
if directoryExists == 0 then
69
vim.fn.system({"git", "clone", source, moduleDir})
710
end
11+
append(vim.opt.rtp, moduleDir)
812
return moduleDir
913
end
1014
plenaryDir = os.getenv("PLENARY_DIR") or "/tmp/plenary.nvim"
1115
loadModule("plenary.nvim", "https://github.com/nvim-lua/plenary.nvim", plenaryDir)
1216
telescopeDir = loadModule("telescope.nvim", "https://github.com/nvim-telescope/telescope.nvim")
13-
append = function(option, value)
14-
option.append(option, value)
15-
end
1617
append(vim.opt.rtp, ".")
17-
append(vim.opt.rtp, plenaryDir)
18-
append(vim.opt.rtp, telescopeDir)
1918
vim.cmd("runtime plugin/plenary.vim")
19+
vim.cmd("runtime plugin/telescope.lua")
2020
require("plenary.busted")

tests/minimal_init.ts

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
const append = (option: any, value: any) => {
2+
option.append(option, value);
3+
};
4+
15
const loadModule = (module: string, source: string, directory?: string) => {
26
const moduleDir = directory || `/tmp/${module}`;
37
const directoryExists = vim.fn.isdirectory(moduleDir);
@@ -6,6 +10,8 @@ const loadModule = (module: string, source: string, directory?: string) => {
610
vim.fn.system(["git", "clone", source, moduleDir]);
711
}
812

13+
append(vim.opt.rtp, moduleDir);
14+
915
return moduleDir;
1016
};
1117

@@ -21,12 +27,7 @@ const telescopeDir = loadModule(
2127
"https://github.com/nvim-telescope/telescope.nvim",
2228
);
2329

24-
const append = (option: any, value: any) => {
25-
option.append(option, value);
26-
};
27-
2830
append(vim.opt.rtp, ".");
29-
append(vim.opt.rtp, plenaryDir);
30-
append(vim.opt.rtp, telescopeDir);
3131
vim.cmd("runtime plugin/plenary.vim");
32+
vim.cmd("runtime plugin/telescope.lua");
3233
require("plenary.busted");

0 commit comments

Comments
 (0)