neovim

Personal neovim configuration files
git clone git://gtms.dev:neovim
Log | Files | Refs

commit 277aa3ca70e3f51923683f602808ad14b532598f
parent 803bf520ede76d0d2eca5e48d4cf68c76c9de159
Author: Tomas Nemec <owl@gtms.dev>
Date:   Fri,  9 Jun 2023 17:43:11 +0200

updtae

Diffstat:
Dafter/plugin/format.lua | 25-------------------------
Mafter/plugin/lsp.lua | 14++++++++++++++
Mafter/plugin/treesitter.lua | 10++++------
3 files changed, 18 insertions(+), 31 deletions(-)

diff --git a/after/plugin/format.lua b/after/plugin/format.lua @@ -1,25 +0,0 @@ -local group = vim.api.nvim_create_augroup('user-format', {}) - -vim.api.nvim_create_autocmd('LspAttach', { - group = group, - callback = function(args) - local buf = args.buf - local client = vim.lsp.get_client_by_id(args.data.client_id) - local cap = client.server_capabilities; - - if cap.documentFormattingProvider then - -- TODO(tms) 03.10.22: zbavit se Q a pouivat gq - vim.keymap.set('n', 'Q', function() - vim.lsp.buf.format() - - if vim.api.nvim_buf_get_option(buf, 'ft') == 'dart' then - vim.cmd.NgHtmlFormat() - end - end, { buffer = buf, desc = 'LSP Format' }) - end - - if cap.documentRangeFormattingProvider then - vim.keymap.set('v', 'Q', vim.lsp.buf.format, { buffer = buf, desc = 'LSP Range Format' }) - end - end, -}) diff --git a/after/plugin/lsp.lua b/after/plugin/lsp.lua @@ -55,6 +55,20 @@ local function keymap(client, buf) require('tms.lsp.request').type_hierarchy('supertypes') end, opt('LSP Supertypes')) end + + if client.supports_method('textDocument/formatting') then + -- TODO(tms) 03.10.22: zbavit se Q a pouivat gq + vim.keymap.set('n', 'gQ', function() + vim.lsp.buf.format() + + if vim.api.nvim_get_option_value('ft', { buf = buf }) == 'dart' then + vim.cmd.NgHtmlFormat() + end + end, { buffer = buf, desc = 'LSP Format' }) + end + -- if client.supports_method('textDocument/rangeFormatting') then + -- vim.keymap.set('v', 'Q', vim.lsp.buf.format, { buffer = buf, desc = 'LSP Range Format' }) + -- end end vim.api.nvim_create_autocmd('LspAttach', { diff --git a/after/plugin/treesitter.lua b/after/plugin/treesitter.lua @@ -29,8 +29,8 @@ parser_configs.norg_table = { } require'nvim-treesitter.configs'.setup { - ensure_intalled = 'all', - ignore_install = { 'lua', 'vim', 'c' }, + -- ensure_intalled = 'all', + -- ignore_install = { 'lua', 'vim', 'c' }, highlight = { enable = true }, indent = { enable = true }, @@ -41,8 +41,6 @@ require'nvim-treesitter.configs'.setup { enable = true, select = { enable = true, - lookahead = false, - lookbehind = false, keymaps = { ['ia'] = '@parameter.inner', ['aa'] = '@parameter.outer', @@ -91,8 +89,8 @@ require'nvim-treesitter.configs'.setup { }, }, - playground = { enable = true, disable = {}, updatetime = 25, persist_queries = false }, - context_commentstring = { enable = true, enable_autocmd = false, config = { scss = '// %s' } }, + -- playground = { enable = true, disable = {}, updatetime = 25, persist_queries = false }, + -- context_commentstring = { enable = true, enable_autocmd = false, config = { scss = '// %s' } }, } vim.api.nvim_create_user_command('TSHRefresh', 'write|TSBufEnable highlight', {})