sync
This commit is contained in:
parent
346b814105
commit
460af020bc
6 changed files with 845 additions and 501 deletions
|
@ -1,10 +1,10 @@
|
|||
#!/bin/bash
|
||||
|
||||
hc() {
|
||||
t="$EPOCHREALTIME"
|
||||
#t="$EPOCHREALTIME"
|
||||
herbstclient "$@"
|
||||
t2="$EPOCHREALTIME"
|
||||
echo "hc: $( bc<<<"$t2 - $t")" >&2
|
||||
#t2="$EPOCHREALTIME"
|
||||
#echo "hc: $( bc<<<"$t2 - $t")" >&2
|
||||
}
|
||||
panel_height=18
|
||||
# bgcolor=$(hc get frame_border_normal_color)
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
---
|
||||
reporting: "off"
|
||||
startuppopupversion: 1
|
||||
git:
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,84 +1,125 @@
|
|||
local M = {
|
||||
on_attach = function(client, bufnr)
|
||||
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
|
||||
local M = {}
|
||||
local function on_attach(args)
|
||||
-- require "lsp_signature".on_attach()
|
||||
-- require'completion'.on_attach()
|
||||
|
||||
require "lsp_signature".on_attach()
|
||||
-- require'completion'.on_attach()
|
||||
|
||||
-- Mappings.
|
||||
local opts = { noremap = true, silent = true }
|
||||
buf_set_keymap('n', 'gD', '<Cmd>lua vim.lsp.buf.declaration()<CR>', opts)
|
||||
buf_set_keymap('n', 'gd', '<Cmd>lua vim.lsp.buf.definition()<CR>', opts)
|
||||
buf_set_keymap('n', 'K', '<Cmd>lua vim.lsp.buf.hover()<CR>', opts)
|
||||
buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
|
||||
buf_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
|
||||
buf_set_keymap('i', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts)
|
||||
buf_set_keymap('n', '<space>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts)
|
||||
buf_set_keymap('v', '<space>ca', '<cmd>lua vim.lsp.buf.range_code_action()<CR>', opts)
|
||||
buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
|
||||
buf_set_keymap('n', '[d', '<cmd>lua vim.diagnostic.goto_prev()<CR>', opts)
|
||||
buf_set_keymap('n', ']d', '<cmd>lua vim.diagnostic.goto_next()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>q', '<cmd>lua vim.diagnostic.setloclist()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>F', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts)
|
||||
buf_set_keymap('v', '<space>F', '<cmd>lua vim.lsp.buf.range_formatting()<CR>', opts)
|
||||
end
|
||||
}
|
||||
local client = vim.lsp.get_client_by_id(args.data.client_id)
|
||||
-- Mappings.
|
||||
local opts = { noremap = true, silent = true, buffer = args.buf }
|
||||
|
||||
if client.server_capabilities.definitionProvider then
|
||||
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts)
|
||||
end
|
||||
if client.server_capabilities.declarationProvider then
|
||||
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts)
|
||||
end
|
||||
if client.supports_method("textDocument/hover") then
|
||||
vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts)
|
||||
end
|
||||
if client.server_capabilities.implementationProvider then
|
||||
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts)
|
||||
end
|
||||
|
||||
if client.server_capabilities.signatureHelpProvider then
|
||||
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, opts)
|
||||
vim.keymap.set('i', '<C-k>', vim.lsp.buf.signature_help, opts)
|
||||
end
|
||||
|
||||
vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, opts)
|
||||
vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, opts)
|
||||
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, opts)
|
||||
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, opts)
|
||||
vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, opts)
|
||||
vim.keymap.set('v', '<space>ca', vim.lsp.buf.range_code_action, opts)
|
||||
vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts)
|
||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
|
||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
|
||||
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, opts)
|
||||
vim.keymap.set('n', '<space>F', function() vim.lsp.buf.format({ async = true }) end, opts)
|
||||
vim.keymap.set('v', '<space>F', vim.lsp.buf.range_formatting, opts)
|
||||
end
|
||||
|
||||
function M.setup()
|
||||
require("lua-dev").setup({})
|
||||
require("lua-dev").setup({})
|
||||
|
||||
local nvim_lsp = require('lspconfig')
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
callback = on_attach
|
||||
})
|
||||
|
||||
-- Use a loop to conveniently both setup defined servers
|
||||
-- and map buffer local keybindings when the language server attaches
|
||||
local servers = {
|
||||
'phpactor',
|
||||
'gopls',
|
||||
'clangd',
|
||||
'zls',
|
||||
'hls',
|
||||
'tsserver',
|
||||
'sumneko_lua',
|
||||
'perlls',
|
||||
'rust_analyzer',
|
||||
local nvim_lsp = require('lspconfig')
|
||||
|
||||
-- Use a loop to conveniently both setup defined servers
|
||||
-- and map buffer local keybindings when the language server attaches
|
||||
local servers = {
|
||||
'phpactor',
|
||||
'gopls',
|
||||
'clangd',
|
||||
'zls',
|
||||
'hls',
|
||||
'tsserver',
|
||||
'sumneko_lua',
|
||||
'perlls',
|
||||
'rust_analyzer',
|
||||
'cssls',
|
||||
'html',
|
||||
}
|
||||
for _, lsp in ipairs(servers) do
|
||||
nvim_lsp[lsp].setup {
|
||||
on_attach = M.on_attach,
|
||||
capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()),
|
||||
}
|
||||
for _, lsp in ipairs(servers) do
|
||||
nvim_lsp[lsp].setup {
|
||||
on_attach = M.on_attach,
|
||||
capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()),
|
||||
}
|
||||
end
|
||||
|
||||
require('lspconfig').jsonls.setup {
|
||||
-- on_attach = M.on_attach,
|
||||
capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()),
|
||||
settings = {
|
||||
validate = { enable = true },
|
||||
json = {
|
||||
schemas = require('schemastore').json.schemas {
|
||||
replace = {
|
||||
['openapi.json'] = {
|
||||
description = 'A JSON schema for Open API documentation files',
|
||||
fileMatch = { "openapi.json", "openapi.yml", "openapi.yaml", "openapi/*.json" },
|
||||
name = 'openapi.json',
|
||||
url = 'https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/schemas/v3.0/schema.json',
|
||||
versions = {
|
||||
["3.1"] = "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/schemas/v3.1/schema.json",
|
||||
["3.0"] = "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/schemas/v3.0/schema.json",
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
require 'lspconfig'.phpactor.setup {
|
||||
-- on_attach = M.on_attach,
|
||||
capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()),
|
||||
|
||||
root_dir = function(startpath)
|
||||
local u = require('lspconfig.util')
|
||||
return u.search_ancestors(startpath, function(path)
|
||||
return not string.find(path, '/vendor/') and (
|
||||
u.path.exists(u.path.join(path, 'composer.json'))
|
||||
or u.path.exists(u.path.join(path, '.git'))
|
||||
)
|
||||
end)
|
||||
end
|
||||
}
|
||||
|
||||
require 'lspconfig'.phpactor.setup {
|
||||
on_attach = M.on_attach,
|
||||
capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()),
|
||||
require 'lspconfig'.omnisharp.setup {
|
||||
cmd = { '/usr/bin/omnisharp', '--languageserver', '--hostPID', tostring(pid) },
|
||||
-- on_attach = M.on_attach,
|
||||
capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||
}
|
||||
|
||||
root_dir = function(startpath)
|
||||
local u = require('lspconfig.util')
|
||||
return u.search_ancestors(startpath, function(path)
|
||||
return not string.find(path, '/vendor/') and (
|
||||
u.path.exists(u.path.join(path, 'composer.json'))
|
||||
or u.path.exists(u.path.join(path, '.git'))
|
||||
)
|
||||
end)
|
||||
end
|
||||
}
|
||||
|
||||
require 'lspconfig'.omnisharp.setup {
|
||||
cmd = { '/usr/bin/omnisharp', '--languageserver', '--hostPID', tostring(pid) },
|
||||
on_attach = M.on_attach,
|
||||
capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||
}
|
||||
|
||||
require 'lspconfig'.powershell_es.setup {
|
||||
bundle_path = '/home/vladimir/devel/PowerShellEditorServices/module',
|
||||
capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||
}
|
||||
require 'lspconfig'.powershell_es.setup {
|
||||
bundle_path = '/home/vladimir/devel/PowerShellEditorServices/module',
|
||||
capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||
}
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
|
@ -4,7 +4,6 @@ function M.setup()
|
|||
local nls = require "null-ls"
|
||||
|
||||
nls.setup({
|
||||
on_attach = require('configs.lsp').on_attach,
|
||||
debug = true,
|
||||
sources = {
|
||||
nls.builtins.formatting.xmllint,
|
||||
|
|
|
@ -18,7 +18,11 @@ function M.setup()
|
|||
require('packer').startup(function(use, use_rocks)
|
||||
use 'wbthomason/packer.nvim'
|
||||
|
||||
use { 'neovim/nvim-lspconfig', config = function() require("configs.lsp").setup() end }
|
||||
use {
|
||||
'neovim/nvim-lspconfig',
|
||||
config = function() require("configs.lsp").setup() end,
|
||||
requires = { 'b0o/schemastore.nvim' }
|
||||
}
|
||||
use { 'hrsh7th/nvim-cmp', requires = { 'neovim/nvim-lspconfig' }, config = require("configs.nvim-cmp").setup }
|
||||
use { 'hrsh7th/cmp-nvim-lsp', requires = { 'hrsh7th/nvim-cmp' } }
|
||||
use { 'hrsh7th/cmp-buffer', requires = { 'hrsh7th/nvim-cmp' } }
|
||||
|
@ -36,7 +40,8 @@ function M.setup()
|
|||
|
||||
use { 'stevearc/dressing.nvim' }
|
||||
|
||||
use { 'jose-elias-alvarez/null-ls.nvim', requires = { "nvim-lua/plenary.nvim" }, config = require("configs.null-ls").setup }
|
||||
use { 'jose-elias-alvarez/null-ls.nvim', requires = { "nvim-lua/plenary.nvim" },
|
||||
config = require("configs.null-ls").setup }
|
||||
|
||||
use { 'nvim-treesitter/nvim-treesitter',
|
||||
run = ':TSUpdate',
|
||||
|
|
Loading…
Add table
Reference in a new issue