Skip to content

Commit

Permalink
Fix BufPreWrite pattern in nvim-lspconfig rubocop formatting example
Browse files Browse the repository at this point in the history
The pattern for `Buf*` commands in neovim looks to be a file names pattern, not file types. When set to `ruby`, automatic formatting doesn't work. It starts working only when I set it to `*.rb`.

Reference:
https://neovim.io/doc/user/api.html#:~:text=%22BufWinEnter%22%7D%2C%20%7B-,pattern%20%3D%20%7B%22*.c%22%2C%20%22*.h%22%7D,-%2C%0A%20%20callback%20%3D%20function
  • Loading branch information
pjg authored and bbatsov committed Dec 13, 2023
1 parent 4759735 commit 7c80c79
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion docs/modules/ROOT/pages/usage/lsp.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ Below is an example of additional setting for autocorrecting on save:

```lua
vim.api.nvim_create_autocmd("BufWritePre", {
pattern = "ruby",
pattern = "*.rb",
callback = function()
vim.lsp.buf.format()
end,
Expand Down

0 comments on commit 7c80c79

Please sign in to comment.