1
+ <!-- panvimdoc-ignore-start -->
1
2
# elixir-tools.nvim
3
+ <!-- panvimdoc-ignore-end -->
4
+
5
+ # Overview
2
6
3
7
[ ![ Discord] ( https://img.shields.io/badge/Discord-5865F3?style=flat&logo=discord&logoColor=white&link=https://discord.gg/nNDMwTJ8 )] ( https://discord.gg/6XdGnxVA2A )
4
8
5
9
` elixir-tools.nvim ` provides a nice experience for writing Elixir applications with [ Neovim] ( https://github.com/neovim/neovim ) .
6
10
7
11
> Note: This plugin does not provide autocompletion, I recommend using [ nvim-cmp] ( https://github.com/hrsh7th/nvim-cmp ) .
8
12
13
+ > Note: This plugin does not provide syntax highlighting, I recommend using [ nvim-treesitter] ( https://github.com/nvim-treesitter/nvim-treesitter ) .
14
+
9
15
## Features
10
16
11
17
- [ ElixirLS] ( https://github.com/elixir-lsp/elixir-ls ) installation and configuration (uses the Neovim built-in LSP client)
12
18
- [ credo-language-server] ( https://github.com/elixir-tools/credo-language-server ) integration.
13
19
- ` :Mix ` command with autocomplete
14
20
- [ vim-projectionist] ( https://github.com/tpope/vim-projectionist ) support
15
21
16
- ## Install
22
+ # Install
17
23
18
24
Requires 0.8
19
25
20
- ### lazy.nvim
26
+ ## lazy.nvim
21
27
22
28
``` lua
23
29
{
@@ -36,7 +42,6 @@ Requires 0.8
36
42
enableTestLenses = false ,
37
43
},
38
44
on_attach = function (client , bufnr )
39
- -- whatever keybinds you want, see below for more suggestions
40
45
vim .keymap .set (" n" , " <space>fp" , " :ElixirFromPipe<cr>" , { buffer = true , noremap = true })
41
46
vim .keymap .set (" n" , " <space>tp" , " :ElixirToPipe<cr>" , { buffer = true , noremap = true })
42
47
vim .keymap .set (" v" , " <space>em" , " :ElixirExpandMacro<cr>" , { buffer = true , noremap = true })
@@ -50,15 +55,15 @@ Requires 0.8
50
55
}
51
56
```
52
57
53
- ### packer.nvim
58
+ ## packer.nvim
54
59
55
60
``` lua
56
61
use ({ " elixir-tools/elixir-tools.nvim" , requires = { " nvim-lua/plenary.nvim" }})
57
62
```
58
63
59
- ## Getting Started
64
+ # Getting Started
60
65
61
- ### Minimal Setup
66
+ ## Minimal Setup
62
67
63
68
The minimal setup will configure both ElixirLS and credo-language-server.
64
69
@@ -75,7 +80,7 @@ require("elixir").setup({
75
80
})
76
81
```
77
82
78
- ### Advanced Setup
83
+ ## Advanced Setup
79
84
80
85
While the plugin works with a minimal setup, it is much more useful if you add some personal configuration.
81
86
@@ -110,42 +115,20 @@ elixir.setup {
110
115
enableTestLenses = false ,
111
116
suggestSpecs = false ,
112
117
},
113
-
114
118
on_attach = function (client , bufnr )
115
- local map_opts = { buffer = true , noremap = true }
116
-
117
- -- run the codelens under the cursor
118
- vim .keymap .set (" n" , " <space>r" , vim .lsp .codelens .run , map_opts )
119
- -- remove the pipe operator
120
- vim .keymap .set (" n" , " <space>fp" , " :ElixirFromPipe<cr>" , map_opts )
121
- -- add the pipe operator
122
- vim .keymap .set (" n" , " <space>tp" , " :ElixirToPipe<cr>" , map_opts )
123
- vim .keymap .set (" v" , " <space>em" , " :ElixirExpandMacro<cr>" , map_opts )
124
-
125
- -- bindings for standard LSP functions.
126
- vim .keymap .set (" n" , " <space>df" , " <cmd>lua vim.lsp.buf.format()<cr>" , map_opts )
127
- vim .keymap .set (" n" , " <space>gd" , " <cmd>lua vim.diagnostic.open_float()<cr>" , map_opts )
128
- vim .keymap .set (" n" , " <space>dt" , " <cmd>lua vim.lsp.buf.definition()<cr>" , map_opts )
129
- vim .keymap .set (" n" , " <space>K" , " <cmd>lua vim.lsp.buf.hover()<cr>" , map_opts )
130
- vim .keymap .set (" n" , " <space>gD" ," <cmd>lua vim.lsp.buf.implementation()<cr>" , map_opts )
131
- vim .keymap .set (" n" , " <space>1gD" ," <cmd>lua vim.lsp.buf.type_definition()<cr>" , map_opts )
132
- -- keybinds for fzf-lsp.nvim: https://github.com/gfanto/fzf-lsp.nvim
133
- -- you could also use telescope.nvim: https://github.com/nvim-telescope/telescope.nvim
134
- -- there are also core vim.lsp functions that put the same data in the loclist
135
- vim .keymap .set (" n" , " <space>gr" , " :References<cr>" , map_opts )
136
- vim .keymap .set (" n" , " <space>g0" , " :DocumentSymbols<cr>" , map_opts )
137
- vim .keymap .set (" n" , " <space>gW" , " :WorkspaceSymbols<cr>" , map_opts )
138
- vim .keymap .set (" n" , " <leader>d" , " :Diagnostics<cr>" , map_opts )
119
+ vim .keymap .set (" n" , " <space>fp" , " :ElixirFromPipe<cr>" , { buffer = true , noremap = true })
120
+ vim .keymap .set (" n" , " <space>tp" , " :ElixirToPipe<cr>" , { buffer = true , noremap = true })
121
+ vim .keymap .set (" v" , " <space>em" , " :ElixirExpandMacro<cr>" , { buffer = true , noremap = true })
139
122
end
140
123
}
141
124
}
142
125
```
143
126
144
- ## Features
127
+ # Features
145
128
146
- ### ElixirLS
129
+ ## ElixirLS
147
130
148
- #### Automatic Installation
131
+ ### Automatic Installation
149
132
150
133
When a compatible installation of ELixirLS is not found, you will be prompted to install it. The plugin will download the source code to the ` .elixir_ls ` directory and compile it using the Elixir and OTP versions used by your current project.
151
134
@@ -155,68 +138,68 @@ Caveat: This currently downloads the language server into the `.elixir_ls` direc
155
138
156
139
![ auto-install-elixirls] ( https://user-images.githubusercontent.com/5523984/160333851-94d448d9-5c80-458c-aa0d-4c81528dde8f.gif )
157
140
158
- #### Root Path Detection
141
+ ### Root Path Detection
159
142
160
143
` elixir-tools.nvim ` should be able to properly set the root directory for umbrella and non-umbrella apps. The nvim-lspconfig project's root detection doesn't properly account for umbrella projects.
161
144
162
- #### Run Tests
145
+ ### Run Tests
163
146
164
147
ElixirLS provides a codelens to identify and run your tests. If you configure ` enableTestLenses = true ` in the settings table, you will see the codelens as virtual text in your editor and can run them with ` vim.lsp.codelens.run() ` .
165
148
166
149
![ elixir-test-lens] ( https://user-images.githubusercontent.com/5523984/159722637-ef1586d5-9d47-4e1a-b68b-6a90ad744098.gif )
167
150
168
- #### Manipulate Pipes
151
+ ### Commands
169
152
170
- The LS has the ability to convert the expression under the cursor form a normal function call to a "piped" function all (and vice versa).
153
+ : ElixirFromPipe
171
154
172
- ` :ElixirFromPipe `
173
- ` :ElixirToPipe `
155
+ : Convert pipe operator to nested expressions.
174
156
175
- ![ manipulate_pipes ] ( https://user-images.githubusercontent.com/5523984/160508641-cedb6ebf-3ec4-4229-9708-aa360b15a2d5.gif )
157
+ : ElixirToPipe
176
158
177
- #### Expand Macro
159
+ : Convert nested expressions to the pipe operator.
178
160
179
- You can highlight a macro call in visual mode and "expand" the macro, opening a floating window with the results.
161
+ ![ manipulate_pipes ] ( https://user-images.githubusercontent.com/5523984/160508641-cedb6ebf-3ec4-4229-9708-aa360b15a2d5.gif )
180
162
181
- ` :'<,'> ElixirExpandMacro`
163
+ : [ range ] ElixirExpandMacro
182
164
183
- ![ expand_macro ] ( https://user-images.githubusercontent.com/5523984/162372669-4782baba-1889-4145-8a4f-e3bf13a6450d.gif )
165
+ : For the given [ range ] , expand any macros and display it in a floating window.
184
166
185
- #### Restart
167
+ ![ expand_macro ] ( https://user-images.githubusercontent.com/5523984/162372669-4782baba-1889-4145-8a4f-e3bf13a6450d.gif )
186
168
187
- You can restart the LS by using the restart command. This is useful if you think the LS has gotten into a weird state. It will send the restart command and then save and reload your current buffer to re-attach the client.
169
+ : ElixirRestart
188
170
189
- ` :ElixirRestart `
171
+ : Restart ElixirLS, you must then reconnect your buffer with ` :edit ` .
190
172
191
- #### OutputPanel
173
+ : ElixirOutputPanel
192
174
193
- You can see the logs for ElixirLS via the output panel. By default opens the buffer in a horizontal split window .
175
+ : Open the output panel that displays logs and compiler information from the server .
194
176
195
- ```
196
- :ElixirOutputPanel
197
- :lua require("elixir").open_output_panel()
198
- :lua require("elixir").open_output_panel({ window = "split" })
199
- :lua require("elixir").open_output_panel({ window = "vsplit" })
200
- :lua require("elixir").open_output_panel({ window = "float" })
177
+ ``` lua
178
+ require (" elixir" ).open_output_panel ()
179
+ require (" elixir" ).open_output_panel ({ window = " split" })
180
+ require (" elixir" ).open_output_panel ({ window = " vsplit" })
181
+ require (" elixir" ).open_output_panel ({ window = " float" })
201
182
```
202
183
203
- ### credo-language-server
184
+ ## credo-language-server
204
185
205
186
> Note: The credo-language-server integration utilizes ` Mix.install/2 ` , so you must be running Elixir >= 1.12
206
187
207
188
- Uses your project's Credo version.
208
189
- Full project diagnostics
209
190
- Code Actions
210
191
211
- ### Mix
192
+ ## Mix
212
193
213
194
You can run any ` mix ` command in your project, complete with... autocomplete!
214
195
215
- ` :Mix compile --force `
196
+ : Mix {args}
197
+
198
+ : Run any mix command.
216
199
217
200
![ elixir-nvim-mix-demo] ( https://user-images.githubusercontent.com/5523984/181859468-19d47a55-3f63-4af5-8698-4b5dd3459141.gif )
218
201
219
- ### Projectionist
202
+ ## Projectionist
220
203
221
204
[ vim-projectionist] ( https://github.com/tpope/vim-projectionist ) definitions are provided for:
222
205
0 commit comments