1+ <!-- panvimdoc-ignore-start -->
12# elixir-tools.nvim
3+ <!-- panvimdoc-ignore-end -->
4+
5+ # Overview
26
37[ ![ Discord] ( https://img.shields.io/badge/Discord-5865F3?style=flat&logo=discord&logoColor=white&link=https://discord.gg/nNDMwTJ8 )] ( https://discord.gg/6XdGnxVA2A )
48
59` elixir-tools.nvim ` provides a nice experience for writing Elixir applications with [ Neovim] ( https://github.com/neovim/neovim ) .
610
711> Note: This plugin does not provide autocompletion, I recommend using [ nvim-cmp] ( https://github.com/hrsh7th/nvim-cmp ) .
812
13+ > Note: This plugin does not provide syntax highlighting, I recommend using [ nvim-treesitter] ( https://github.com/nvim-treesitter/nvim-treesitter ) .
14+
915## Features
1016
1117- [ ElixirLS] ( https://github.com/elixir-lsp/elixir-ls ) installation and configuration (uses the Neovim built-in LSP client)
1218- [ credo-language-server] ( https://github.com/elixir-tools/credo-language-server ) integration.
1319- ` :Mix ` command with autocomplete
1420- [ vim-projectionist] ( https://github.com/tpope/vim-projectionist ) support
1521
16- ## Install
22+ # Install
1723
1824Requires 0.8
1925
20- ### lazy.nvim
26+ ## lazy.nvim
2127
2228``` lua
2329{
@@ -36,7 +42,6 @@ Requires 0.8
3642 enableTestLenses = false ,
3743 },
3844 on_attach = function (client , bufnr )
39- -- whatever keybinds you want, see below for more suggestions
4045 vim .keymap .set (" n" , " <space>fp" , " :ElixirFromPipe<cr>" , { buffer = true , noremap = true })
4146 vim .keymap .set (" n" , " <space>tp" , " :ElixirToPipe<cr>" , { buffer = true , noremap = true })
4247 vim .keymap .set (" v" , " <space>em" , " :ElixirExpandMacro<cr>" , { buffer = true , noremap = true })
@@ -50,15 +55,15 @@ Requires 0.8
5055}
5156```
5257
53- ### packer.nvim
58+ ## packer.nvim
5459
5560``` lua
5661use ({ " elixir-tools/elixir-tools.nvim" , requires = { " nvim-lua/plenary.nvim" }})
5762```
5863
59- ## Getting Started
64+ # Getting Started
6065
61- ### Minimal Setup
66+ ## Minimal Setup
6267
6368The minimal setup will configure both ElixirLS and credo-language-server.
6469
@@ -75,7 +80,7 @@ require("elixir").setup({
7580})
7681```
7782
78- ### Advanced Setup
83+ ## Advanced Setup
7984
8085While the plugin works with a minimal setup, it is much more useful if you add some personal configuration.
8186
@@ -110,42 +115,20 @@ elixir.setup {
110115 enableTestLenses = false ,
111116 suggestSpecs = false ,
112117 },
113-
114118 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 })
139122 end
140123 }
141124}
142125```
143126
144- ## Features
127+ # Features
145128
146- ### ElixirLS
129+ ## ElixirLS
147130
148- #### Automatic Installation
131+ ### Automatic Installation
149132
150133When 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.
151134
@@ -155,68 +138,68 @@ Caveat: This currently downloads the language server into the `.elixir_ls` direc
155138
156139![ auto-install-elixirls] ( https://user-images.githubusercontent.com/5523984/160333851-94d448d9-5c80-458c-aa0d-4c81528dde8f.gif )
157140
158- #### Root Path Detection
141+ ### Root Path Detection
159142
160143` 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.
161144
162- #### Run Tests
145+ ### Run Tests
163146
164147ElixirLS 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() ` .
165148
166149![ elixir-test-lens] ( https://user-images.githubusercontent.com/5523984/159722637-ef1586d5-9d47-4e1a-b68b-6a90ad744098.gif )
167150
168- #### Manipulate Pipes
151+ ### Commands
169152
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
171154
172- ` :ElixirFromPipe `
173- ` :ElixirToPipe `
155+ : Convert pipe operator to nested expressions.
174156
175- ![ manipulate_pipes ] ( https://user-images.githubusercontent.com/5523984/160508641-cedb6ebf-3ec4-4229-9708-aa360b15a2d5.gif )
157+ : ElixirToPipe
176158
177- #### Expand Macro
159+ : Convert nested expressions to the pipe operator.
178160
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 )
180162
181- ` :'<,'> ElixirExpandMacro`
163+ : [ range ] ElixirExpandMacro
182164
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.
184166
185- #### Restart
167+ ![ expand_macro ] ( https://user-images.githubusercontent.com/5523984/162372669-4782baba-1889-4145-8a4f-e3bf13a6450d.gif )
186168
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
188170
189- ` :ElixirRestart `
171+ : Restart ElixirLS, you must then reconnect your buffer with ` :edit ` .
190172
191- #### OutputPanel
173+ : ElixirOutputPanel
192174
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 .
194176
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" })
201182```
202183
203- ### credo-language-server
184+ ## credo-language-server
204185
205186> Note: The credo-language-server integration utilizes ` Mix.install/2 ` , so you must be running Elixir >= 1.12
206187
207188- Uses your project's Credo version.
208189- Full project diagnostics
209190- Code Actions
210191
211- ### Mix
192+ ## Mix
212193
213194You can run any ` mix ` command in your project, complete with... autocomplete!
214195
215- ` :Mix compile --force `
196+ : Mix {args}
197+
198+ : Run any mix command.
216199
217200![ elixir-nvim-mix-demo] ( https://user-images.githubusercontent.com/5523984/181859468-19d47a55-3f63-4af5-8698-4b5dd3459141.gif )
218201
219- ### Projectionist
202+ ## Projectionist
220203
221204[ vim-projectionist] ( https://github.com/tpope/vim-projectionist ) definitions are provided for:
222205
0 commit comments