comparison .chezmoitemplates/init.lua @ 455:f65e3507e10b

Add lsp_signature plugin to show function signatures
author zegervdv <zegervdv@me.com>
date Tue, 14 Sep 2021 17:30:24 +0200
parents 6053959484ec
children 06e6e2dde6cb
comparison
equal deleted inserted replaced
454:3614ad1b085c 455:f65e3507e10b
236 { name = 'path' }, 236 { name = 'path' },
237 }, 237 },
238 } 238 }
239 end, 239 end,
240 } 240 }
241 use { 'ray-x/lsp_signature.nvim' }
241 use { 242 use {
242 { 243 {
243 'nvim-treesitter/nvim-treesitter', 244 'nvim-treesitter/nvim-treesitter',
244 config = function() 245 config = function()
245 require 'nvim-treesitter.highlight' 246 require 'nvim-treesitter.highlight'
529 530
530 opt.pastetoggle = '<F2>' -- Enable paste mode 531 opt.pastetoggle = '<F2>' -- Enable paste mode
531 532
532 opt.undofile = true -- Persistently remember undos 533 opt.undofile = true -- Persistently remember undos
533 opt.undolevels = 1000 534 opt.undolevels = 1000
534 if os.getenv('HOME') ~= nil then 535 if os.getenv 'HOME' ~= nil then
535 opt.undodir = os.getenv 'HOME' .. '/.config/nvim/tmp/undo//' 536 opt.undodir = os.getenv 'HOME' .. '/.config/nvim/tmp/undo//'
536 end 537 end
537 opt.swapfile = false -- Disable swap files 538 opt.swapfile = false -- Disable swap files
538 opt.backup = true -- Keep backups 539 opt.backup = true -- Keep backups
539 if os.getenv('HOME') ~= nil then 540 if os.getenv 'HOME' ~= nil then
540 opt.backupdir = os.getenv 'HOME' .. '/.config/nvim/tmp/backup//' 541 opt.backupdir = os.getenv 'HOME' .. '/.config/nvim/tmp/backup//'
541 end 542 end
542 543
543 -- Files to ignore from completion 544 -- Files to ignore from completion
544 opt.wildignore:append { 545 opt.wildignore:append {
649 vim.lsp.handlers['textDocument/publishDiagnostics'] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, { 650 vim.lsp.handlers['textDocument/publishDiagnostics'] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
650 underline = true, 651 underline = true,
651 update_in_insert = false, 652 update_in_insert = false,
652 virtual_text = { severity_limit = 'Warning' }, 653 virtual_text = { severity_limit = 'Warning' },
653 }) 654 })
655
656 require "lsp_signature".on_attach()
654 end 657 end
655 658
656 local capabilities = vim.lsp.protocol.make_client_capabilities() 659 local capabilities = vim.lsp.protocol.make_client_capabilities()
657 capabilities.textDocument.completion.completionItem.snippetSupport = true 660 capabilities.textDocument.completion.completionItem.snippetSupport = true
658 capabilities.textDocument.completion.completionItem.resolveSupport = { 661 capabilities.textDocument.completion.completionItem.resolveSupport = {
695 lsp.sumneko_lua.setup(luadev) 698 lsp.sumneko_lua.setup(luadev)
696 699
697 -- Populate quickfix with all locations of rename 700 -- Populate quickfix with all locations of rename
698 function LspRename() 701 function LspRename()
699 local params = vim.lsp.util.make_position_params() 702 local params = vim.lsp.util.make_position_params()
700 params.newName = vim.fn.input("Rename: ", vim.fn.expand('<cword>')) 703 params.newName = vim.fn.input('Rename: ', vim.fn.expand '<cword>')
701 vim.lsp.buf_request(0, 'textDocument/rename', params, function(err, result, ctx, ...) 704 vim.lsp.buf_request(0, 'textDocument/rename', params, function(err, result, ctx, ...)
702 vim.lsp.handlers['textDocument/rename'](err, result, ctx, ...) 705 vim.lsp.handlers['textDocument/rename'](err, result, ctx, ...)
703 local changed = {} 706 local changed = {}
704 for uri, changes in pairs(result.changes) do 707 for uri, changes in pairs(result.changes) do
705 local bufnr = vim.uri_to_bufnr(uri) 708 local bufnr = vim.uri_to_bufnr(uri)