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
|
#!/bin/bash
|
||||||
|
|
||||||
hc() {
|
hc() {
|
||||||
t="$EPOCHREALTIME"
|
#t="$EPOCHREALTIME"
|
||||||
herbstclient "$@"
|
herbstclient "$@"
|
||||||
t2="$EPOCHREALTIME"
|
#t2="$EPOCHREALTIME"
|
||||||
echo "hc: $( bc<<<"$t2 - $t")" >&2
|
#echo "hc: $( bc<<<"$t2 - $t")" >&2
|
||||||
}
|
}
|
||||||
panel_height=18
|
panel_height=18
|
||||||
# bgcolor=$(hc get frame_border_normal_color)
|
# bgcolor=$(hc get frame_border_normal_color)
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
---
|
||||||
reporting: "off"
|
reporting: "off"
|
||||||
startuppopupversion: 1
|
startuppopupversion: 1
|
||||||
git:
|
git:
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,37 +1,52 @@
|
||||||
local M = {
|
local M = {}
|
||||||
on_attach = function(client, bufnr)
|
local function on_attach(args)
|
||||||
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
|
-- require "lsp_signature".on_attach()
|
||||||
|
|
||||||
require "lsp_signature".on_attach()
|
|
||||||
-- require'completion'.on_attach()
|
-- require'completion'.on_attach()
|
||||||
|
|
||||||
|
|
||||||
|
local client = vim.lsp.get_client_by_id(args.data.client_id)
|
||||||
-- Mappings.
|
-- Mappings.
|
||||||
local opts = { noremap = true, silent = true }
|
local opts = { noremap = true, silent = true, buffer = args.buf }
|
||||||
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)
|
if client.server_capabilities.definitionProvider then
|
||||||
buf_set_keymap('n', 'K', '<Cmd>lua vim.lsp.buf.hover()<CR>', opts)
|
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, 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
|
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()
|
function M.setup()
|
||||||
require("lua-dev").setup({})
|
require("lua-dev").setup({})
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd('LspAttach', {
|
||||||
|
callback = on_attach
|
||||||
|
})
|
||||||
|
|
||||||
local nvim_lsp = require('lspconfig')
|
local nvim_lsp = require('lspconfig')
|
||||||
|
|
||||||
-- Use a loop to conveniently both setup defined servers
|
-- Use a loop to conveniently both setup defined servers
|
||||||
|
@ -46,6 +61,8 @@ function M.setup()
|
||||||
'sumneko_lua',
|
'sumneko_lua',
|
||||||
'perlls',
|
'perlls',
|
||||||
'rust_analyzer',
|
'rust_analyzer',
|
||||||
|
'cssls',
|
||||||
|
'html',
|
||||||
}
|
}
|
||||||
for _, lsp in ipairs(servers) do
|
for _, lsp in ipairs(servers) do
|
||||||
nvim_lsp[lsp].setup {
|
nvim_lsp[lsp].setup {
|
||||||
|
@ -54,8 +71,32 @@ function M.setup()
|
||||||
}
|
}
|
||||||
end
|
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 {
|
require 'lspconfig'.phpactor.setup {
|
||||||
on_attach = M.on_attach,
|
-- on_attach = M.on_attach,
|
||||||
capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()),
|
capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()),
|
||||||
|
|
||||||
root_dir = function(startpath)
|
root_dir = function(startpath)
|
||||||
|
@ -71,7 +112,7 @@ function M.setup()
|
||||||
|
|
||||||
require 'lspconfig'.omnisharp.setup {
|
require 'lspconfig'.omnisharp.setup {
|
||||||
cmd = { '/usr/bin/omnisharp', '--languageserver', '--hostPID', tostring(pid) },
|
cmd = { '/usr/bin/omnisharp', '--languageserver', '--hostPID', tostring(pid) },
|
||||||
on_attach = M.on_attach,
|
-- on_attach = M.on_attach,
|
||||||
capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
|
capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@ function M.setup()
|
||||||
local nls = require "null-ls"
|
local nls = require "null-ls"
|
||||||
|
|
||||||
nls.setup({
|
nls.setup({
|
||||||
on_attach = require('configs.lsp').on_attach,
|
|
||||||
debug = true,
|
debug = true,
|
||||||
sources = {
|
sources = {
|
||||||
nls.builtins.formatting.xmllint,
|
nls.builtins.formatting.xmllint,
|
||||||
|
|
|
@ -18,7 +18,11 @@ function M.setup()
|
||||||
require('packer').startup(function(use, use_rocks)
|
require('packer').startup(function(use, use_rocks)
|
||||||
use 'wbthomason/packer.nvim'
|
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/nvim-cmp', requires = { 'neovim/nvim-lspconfig' }, config = require("configs.nvim-cmp").setup }
|
||||||
use { 'hrsh7th/cmp-nvim-lsp', requires = { 'hrsh7th/nvim-cmp' } }
|
use { 'hrsh7th/cmp-nvim-lsp', requires = { 'hrsh7th/nvim-cmp' } }
|
||||||
use { 'hrsh7th/cmp-buffer', requires = { 'hrsh7th/nvim-cmp' } }
|
use { 'hrsh7th/cmp-buffer', requires = { 'hrsh7th/nvim-cmp' } }
|
||||||
|
@ -36,7 +40,8 @@ function M.setup()
|
||||||
|
|
||||||
use { 'stevearc/dressing.nvim' }
|
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',
|
use { 'nvim-treesitter/nvim-treesitter',
|
||||||
run = ':TSUpdate',
|
run = ':TSUpdate',
|
||||||
|
|
Loading…
Add table
Reference in a new issue