Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yioneko/nvim-type-fmt
LSP handler of textDocument/onTypeFormatting for nvim.
https://github.com/yioneko/nvim-type-fmt
neovim
Last synced: 3 months ago
JSON representation
LSP handler of textDocument/onTypeFormatting for nvim.
- Host: GitHub
- URL: https://github.com/yioneko/nvim-type-fmt
- Owner: yioneko
- Created: 2022-11-25T05:51:09.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-06-24T01:20:50.000Z (5 months ago)
- Last Synced: 2024-06-24T15:53:52.403Z (5 months ago)
- Topics: neovim
- Language: Lua
- Homepage:
- Size: 7.81 KB
- Stars: 14
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# nvim-type-fmt
LSP handler of `textDocument/onTypeFormatting` for nvim.
## Usage
Just install it by any plugin manager, and the plugin will automatically setup the handler for it. The plugin is lazy loaded by default, usually you do not need to add any other lazy loading logic by plugin manger.
To disable auto setup of the plugin, put this before the loading of plugins:
```vim
g:type_fmt_loaded = v:true" or in lua
lua<< EOF
vim.g.type_fmt_loaded = true
EOF
```## Config
The configuration is optional.
```lua
require("type-fmt").setup({
-- In case if you only want to enable this for limited buffers
-- We already filter it by checking capabilities of attached lsp client
buf_filter = function(bufnr)
return true
end,
-- If multiple clients are capable of onTypeFormatting, we use this to determine which will win
-- This is a rare situation but we still provide it for the correctness of lsp client handling
prefer_client = function(client_a, client_b)
return client_a or client_b
end,
})
```