Compare commits
No commits in common. "542b72024f62513017a16e61334d02aa5888ff64" and "4990d802913015af07854d9ee8887009bf6b7258" have entirely different histories.
542b72024f
...
4990d80291
1 changed files with 118 additions and 131 deletions
167
init.lua
167
init.lua
|
@ -236,10 +236,6 @@ if fn.empty(fn.glob(packer_path)) > 0 then
|
||||||
vim.notify('Downloading plugin manager with git')
|
vim.notify('Downloading plugin manager with git')
|
||||||
packer_bootstrap = fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', packer_path})
|
packer_bootstrap = fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', packer_path})
|
||||||
end
|
end
|
||||||
--- @param package string
|
|
||||||
function mason_path(package)
|
|
||||||
return vim.fn.stdpath('data') .. '/mason/packages/' .. package
|
|
||||||
end
|
|
||||||
|
|
||||||
require'packer'.startup(function(use)
|
require'packer'.startup(function(use)
|
||||||
use 'wbthomason/packer.nvim'
|
use 'wbthomason/packer.nvim'
|
||||||
|
@ -351,12 +347,6 @@ require'packer'.startup(function(use)
|
||||||
use 'vim-airline/vim-airline'
|
use 'vim-airline/vim-airline'
|
||||||
use 'vim-airline/vim-airline-themes'
|
use 'vim-airline/vim-airline-themes'
|
||||||
use 'romgrk/barbar.nvim'
|
use 'romgrk/barbar.nvim'
|
||||||
use {'luckasRanarison/clear-action.nvim', config = function()
|
|
||||||
require'clear-action'.setup {
|
|
||||||
signs = { enable = false },
|
|
||||||
popup = { enable = true },
|
|
||||||
}
|
|
||||||
end}
|
|
||||||
use {'MattesGroeger/vim-bookmarks', config = function()
|
use {'MattesGroeger/vim-bookmarks', config = function()
|
||||||
vim.g.bookmark_no_default_key_mappings = 1
|
vim.g.bookmark_no_default_key_mappings = 1
|
||||||
vim.g.bookmark_save_per_working_dir = 1
|
vim.g.bookmark_save_per_working_dir = 1
|
||||||
|
@ -366,30 +356,15 @@ require'packer'.startup(function(use)
|
||||||
vim.fn.sign_define('DapBreakpoint', {text='⯃', texthl='DiagnosticError'})
|
vim.fn.sign_define('DapBreakpoint', {text='⯃', texthl='DiagnosticError'})
|
||||||
dap.adapters.codelldb = {
|
dap.adapters.codelldb = {
|
||||||
type = 'server',
|
type = 'server',
|
||||||
host = 'localhost',
|
|
||||||
port = '${port}',
|
port = '${port}',
|
||||||
executable = {
|
executable = {
|
||||||
--command = mason_path('codelldb') .. '/extension/adapter/codelldb',
|
command = vim.fn.stdpath('data') .. '/mason/packages/codelldb/extension/adapter/codelldb',
|
||||||
--args = {'--liblldb', mason_path('codelldb') .. '/extension/lldb/lib/liblldb.so', '--port', '${port}'},
|
|
||||||
command = 'lldb',
|
|
||||||
args = {'--port', '${port}'},
|
args = {'--port', '${port}'},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
dap.adapters.sh = {
|
dap.adapters.sh = {
|
||||||
type = 'executable',
|
type = 'executable',
|
||||||
command = mason_path('bash-debug-adapter') .. '/bash-debug-adapter'
|
command = vim.fn.stdpath('data') .. '/mason/packages/bash-debug-adapter/bash-debug-adapter'
|
||||||
}
|
|
||||||
dap.adapters['pwa-node'] = {
|
|
||||||
type = 'server',
|
|
||||||
host = 'localhost',
|
|
||||||
port = '${port}',
|
|
||||||
executable = {
|
|
||||||
command = 'node',
|
|
||||||
args = {
|
|
||||||
mason_path('js-debug-adapter') .. '/js-debug/src/dapDebugServer.js',
|
|
||||||
'${port}'
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
dap.configurations.cpp = {
|
dap.configurations.cpp = {
|
||||||
{
|
{
|
||||||
|
@ -412,8 +387,8 @@ require'packer'.startup(function(use)
|
||||||
request = 'launch',
|
request = 'launch',
|
||||||
program = '${file}',
|
program = '${file}',
|
||||||
cwd = '${fileDirname}',
|
cwd = '${fileDirname}',
|
||||||
pathBashdb = mason_path('bash-debug-adapter') .. '/extension/bashdb_dir/bashdb',
|
pathBashdb = vim.fn.stdpath('data') .. '/mason/packages/bash-debug-adapter/extension/bashdb_dir/bashdb',
|
||||||
pathBashdbLib = mason_path('bash-debug-adapter') .. '/extension/bashdb_dir',
|
pathBashdbLib = vim.fn.stdpath('data') .. '/mason/packages/bash-debug-adapter/extension/bashdb_dir',
|
||||||
pathBash = 'bash',
|
pathBash = 'bash',
|
||||||
pathCat = 'cat',
|
pathCat = 'cat',
|
||||||
pathMkfifo = 'mkfifo',
|
pathMkfifo = 'mkfifo',
|
||||||
|
@ -424,47 +399,6 @@ require'packer'.startup(function(use)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
dap.configurations.javascript = {
|
|
||||||
{
|
|
||||||
type = 'pwa-node',
|
|
||||||
request = 'launch',
|
|
||||||
name = 'Launch current file',
|
|
||||||
program = '${file}',
|
|
||||||
cwd = '${workspaceFolder}',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type = 'pwa-node',
|
|
||||||
request = 'launch',
|
|
||||||
name = 'Launch file',
|
|
||||||
program = function()
|
|
||||||
return vim.fn.input('Path to file: ', vim.fn.getcwd() .. '/', 'file')
|
|
||||||
end,
|
|
||||||
cwd = '${workspaceFolder}',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type = 'pwa-node',
|
|
||||||
request = 'attach',
|
|
||||||
name = 'Attach',
|
|
||||||
processId = require'dap.utils'.pick_process,
|
|
||||||
cwd = '${workspaceFolder}',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type = 'pwa-node',
|
|
||||||
request = 'launch',
|
|
||||||
name = 'Debug Mocha Tests',
|
|
||||||
-- trace = true, -- include debugger info
|
|
||||||
runtimeExecutable = 'node',
|
|
||||||
runtimeArgs = {
|
|
||||||
'./node_modules/mocha/bin/mocha',
|
|
||||||
},
|
|
||||||
rootPath = '${workspaceFolder}',
|
|
||||||
cwd = '${workspaceFolder}',
|
|
||||||
console = 'integratedTerminal',
|
|
||||||
internalConsoleOptions = 'neverOpen',
|
|
||||||
}
|
|
||||||
}
|
|
||||||
dap.configurations.typescript = dap.configurations.javascript
|
|
||||||
|
|
||||||
local function conditional_breakpoint()
|
local function conditional_breakpoint()
|
||||||
vim.ui.input({prompt = 'Breakpoint condition'}, function(condition)
|
vim.ui.input({prompt = 'Breakpoint condition'}, function(condition)
|
||||||
if not condition then return end
|
if not condition then return end
|
||||||
|
@ -510,6 +444,57 @@ require'packer'.startup(function(use)
|
||||||
clear_on_continue = true,
|
clear_on_continue = true,
|
||||||
}
|
}
|
||||||
end}
|
end}
|
||||||
|
use {'mxsdev/nvim-dap-vscode-js', requires = {'mfussenegger/nvim-dap'}, config = function()
|
||||||
|
require'dap-vscode-js'.setup {
|
||||||
|
adapters = {'pwa-node', 'node-terminal'},
|
||||||
|
}
|
||||||
|
for _, language in ipairs({'javascript', 'typescript'}) do
|
||||||
|
require'dap'.configurations[language] = {
|
||||||
|
{
|
||||||
|
type = 'pwa-node',
|
||||||
|
request = 'launch',
|
||||||
|
name = 'Launch current file',
|
||||||
|
program = '${file}',
|
||||||
|
cwd = '${workspaceFolder}',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type = 'pwa-node',
|
||||||
|
request = 'launch',
|
||||||
|
name = 'Launch file',
|
||||||
|
program = function()
|
||||||
|
return vim.fn.input('Path to file: ', vim.fn.getcwd() .. '/', 'file')
|
||||||
|
end,
|
||||||
|
cwd = '${workspaceFolder}',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type = 'pwa-node',
|
||||||
|
request = 'attach',
|
||||||
|
name = 'Attach',
|
||||||
|
processId = require'dap.utils'.pick_process,
|
||||||
|
cwd = '${workspaceFolder}',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type = 'pwa-node',
|
||||||
|
request = 'launch',
|
||||||
|
name = 'Debug Mocha Tests',
|
||||||
|
-- trace = true, -- include debugger info
|
||||||
|
runtimeExecutable = 'node',
|
||||||
|
runtimeArgs = {
|
||||||
|
'./node_modules/mocha/bin/mocha',
|
||||||
|
},
|
||||||
|
rootPath = '${workspaceFolder}',
|
||||||
|
cwd = '${workspaceFolder}',
|
||||||
|
console = 'integratedTerminal',
|
||||||
|
internalConsoleOptions = 'neverOpen',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end}
|
||||||
|
use {
|
||||||
|
'microsoft/vscode-js-debug',
|
||||||
|
opt = true,
|
||||||
|
run = 'npm install --legacy-peer-deps && npm run compile'
|
||||||
|
}
|
||||||
use {'sindrets/diffview.nvim', config = function()
|
use {'sindrets/diffview.nvim', config = function()
|
||||||
require'diffview'.setup {
|
require'diffview'.setup {
|
||||||
-- Use nicer highlighting for diffs
|
-- Use nicer highlighting for diffs
|
||||||
|
@ -929,24 +914,17 @@ capabilities.textDocument.foldingRange = {
|
||||||
}
|
}
|
||||||
|
|
||||||
---- lsp: language servers ----
|
---- lsp: language servers ----
|
||||||
au('LspAttach', {
|
--- Performs keymaps and other setup specific to buffers with LSP enabled
|
||||||
callback = function (event)
|
--- @param bufnr number
|
||||||
local bufnr = event.buf
|
--- @diagnostic disable-next-line: unused-local
|
||||||
local client = vim.lsp.get_client_by_id(event.data.client_id)
|
local function on_attach(client, bufnr)
|
||||||
local function code_action()
|
|
||||||
local ok, clear_action = pcall(require, 'clear-action')
|
|
||||||
if ok then
|
|
||||||
clear_action.code_action()
|
|
||||||
else
|
|
||||||
vim.lsp.buf.code_action()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
require'which-key'.register({
|
require'which-key'.register({
|
||||||
['<Leader>l'] = {
|
['<Leader>l'] = {
|
||||||
D = {vim.lsp.buf.declaration, 'Declaration'},
|
D = {vim.lsp.buf.declaration, 'Declaration'},
|
||||||
d = {'<Cmd>Telescope lsp_definitions<CR>', 'Definition'},
|
d = {'<Cmd>Telescope lsp_definitions<CR>', 'Definition'},
|
||||||
i = {'<Cmd>Telescope lsp_implementations<CR>', 'Implementation'},
|
i = {'<Cmd>Telescope lsp_implementations<CR>', 'Implementation'},
|
||||||
a = {code_action, 'Code action'},
|
a = {vim.lsp.buf.code_action, 'Code action'},
|
||||||
r = {vim.lsp.buf.rename, 'Rename'},
|
r = {vim.lsp.buf.rename, 'Rename'},
|
||||||
h = {function() vim.lsp.inlay_hint(0, nil) end, 'Inlay hints'},
|
h = {function() vim.lsp.inlay_hint(0, nil) end, 'Inlay hints'},
|
||||||
l = {vim.lsp.codelens.refresh, 'Show codelenses'},
|
l = {vim.lsp.codelens.refresh, 'Show codelenses'},
|
||||||
|
@ -957,7 +935,7 @@ au('LspAttach', {
|
||||||
g = {
|
g = {
|
||||||
d = {vim.lsp.buf.definition, 'Goto definition'},
|
d = {vim.lsp.buf.definition, 'Goto definition'},
|
||||||
D = {vim.lsp.buf.implementation, 'Goto implementation'},
|
D = {vim.lsp.buf.implementation, 'Goto implementation'},
|
||||||
a = {code_action, 'Code action'},
|
a = {vim.lsp.buf.code_action, 'Code action'},
|
||||||
R = {vim.lsp.buf.rename, 'Rename'},
|
R = {vim.lsp.buf.rename, 'Rename'},
|
||||||
y = {vim.lsp.buf.type_definition, 'Type definition'},
|
y = {vim.lsp.buf.type_definition, 'Type definition'},
|
||||||
},
|
},
|
||||||
|
@ -986,16 +964,17 @@ au('LspAttach', {
|
||||||
vim.bo.tagfunc = 'v:lua.vim.lsp.tagfunc'
|
vim.bo.tagfunc = 'v:lua.vim.lsp.tagfunc'
|
||||||
|
|
||||||
require'nvim-navic'.attach(client, bufnr)
|
require'nvim-navic'.attach(client, bufnr)
|
||||||
end
|
end
|
||||||
})
|
|
||||||
|
|
||||||
-- Enable language servers
|
-- Enable language servers
|
||||||
local default = {
|
local default = {
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
|
on_attach = on_attach,
|
||||||
}
|
}
|
||||||
|
|
||||||
require'lspconfig'.lua_ls.setup {
|
require'lspconfig'.lua_ls.setup {
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
|
on_attach = on_attach,
|
||||||
settings = {
|
settings = {
|
||||||
Lua = {
|
Lua = {
|
||||||
runtime = {
|
runtime = {
|
||||||
|
@ -1026,6 +1005,7 @@ au('FileType', {
|
||||||
jdtls.dap = require'jdtls.dap'
|
jdtls.dap = require'jdtls.dap'
|
||||||
_G.jdt = jdtls
|
_G.jdt = jdtls
|
||||||
|
|
||||||
|
local path = vim.fn.stdpath('data') .. '/mason/packages/jdtls'
|
||||||
local root_dir = jdtls.setup.find_root({'.git', 'mvnw', 'gradlew'})
|
local root_dir = jdtls.setup.find_root({'.git', 'mvnw', 'gradlew'})
|
||||||
|
|
||||||
local config = {
|
local config = {
|
||||||
|
@ -1036,7 +1016,7 @@ au('FileType', {
|
||||||
'--jvm-arg=-Dlog.level=ALL',
|
'--jvm-arg=-Dlog.level=ALL',
|
||||||
'--jvm-arg=-Dlog.protocol=true',
|
'--jvm-arg=-Dlog.protocol=true',
|
||||||
-- Enable lombok
|
-- Enable lombok
|
||||||
'--jvm-arg=-javaagent:' .. mason_path('jdtls') .. '/lombok.jar',
|
'--jvm-arg=-javaagent:' .. path .. '/lombok.jar',
|
||||||
-- store workpace data in ~/.local/share/eclipse/<project-name>
|
-- store workpace data in ~/.local/share/eclipse/<project-name>
|
||||||
'-data', vim.fn.expand('~/.local/share/eclipse/') .. vim.fn.fnamemodify(root_dir, ':p:h:t')
|
'-data', vim.fn.expand('~/.local/share/eclipse/') .. vim.fn.fnamemodify(root_dir, ':p:h:t')
|
||||||
},
|
},
|
||||||
|
@ -1052,11 +1032,11 @@ au('FileType', {
|
||||||
bundles = (function ()
|
bundles = (function ()
|
||||||
-- add java-debug-adapter
|
-- add java-debug-adapter
|
||||||
local bundles = {
|
local bundles = {
|
||||||
vim.fn.glob(mason_path'java-debug-adapter' .. '/extension/server/com.microsoft.java.debug.plugin-*.jar', true)
|
vim.fn.glob(vim.fn.stdpath('data') .. '/mason/packages/java-debug-adapter/extension/server/com.microsoft.java.debug.plugin-*.jar', true)
|
||||||
}
|
}
|
||||||
-- add java-test
|
-- add java-test
|
||||||
vim.list_extend(bundles, vim.split(
|
vim.list_extend(bundles, vim.split(
|
||||||
vim.fn.glob(mason_path'java-test' .. '/extension/server/*.jar', true),
|
vim.fn.glob(vim.fn.stdpath'data' .. '/mason/packages/java-test/extension/server/*.jar', true),
|
||||||
'\n'
|
'\n'
|
||||||
))
|
))
|
||||||
|
|
||||||
|
@ -1067,6 +1047,7 @@ au('FileType', {
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
|
|
||||||
on_attach = function (client, bufnr)
|
on_attach = function (client, bufnr)
|
||||||
|
on_attach(client, bufnr)
|
||||||
jdtls.setup_dap()
|
jdtls.setup_dap()
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
@ -1083,6 +1064,7 @@ au('FileType', {
|
||||||
require'lspconfig'.sqls.setup {
|
require'lspconfig'.sqls.setup {
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
on_attach = function (client, bufnr)
|
on_attach = function (client, bufnr)
|
||||||
|
on_attach(client, bufnr)
|
||||||
local ok, sqls = pcall(require, 'sqls')
|
local ok, sqls = pcall(require, 'sqls')
|
||||||
if not ok then return end
|
if not ok then return end
|
||||||
sqls.on_attach(client, bufnr)
|
sqls.on_attach(client, bufnr)
|
||||||
|
@ -1134,6 +1116,7 @@ require'rust-tools'.setup {
|
||||||
-- Enable standalone file (i.e. no cargo) support
|
-- Enable standalone file (i.e. no cargo) support
|
||||||
standalone = true,
|
standalone = true,
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
|
on_attach = on_attach,
|
||||||
settings = {
|
settings = {
|
||||||
['rust-analyzer'] = {
|
['rust-analyzer'] = {
|
||||||
cargo = {
|
cargo = {
|
||||||
|
@ -1168,7 +1151,10 @@ require'rust-tools'.setup {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
dap = {
|
dap = {
|
||||||
adapter = require'dap'.adapters.codelldb,
|
adapter = require'rust-tools.dap'.get_codelldb_adapter(
|
||||||
|
vim.fn.stdpath('data') .. '/mason/packages/codelldb/extension/adapter/codelldb',
|
||||||
|
vim.fn.stdpath('data') .. '/mason/packages/codelldb/extension/lldb/lib/liblldb.so'
|
||||||
|
)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1277,6 +1263,7 @@ vim.keymap.set('n', '<Leader>t', '<Cmd>NvimTreeFindFile<CR>', {desc = 'Nvim Tree
|
||||||
|
|
||||||
|
|
||||||
---- treesitter ----
|
---- treesitter ----
|
||||||
|
---@diagnostic disable-next-line: missing-fields
|
||||||
require'nvim-treesitter.configs'.setup {
|
require'nvim-treesitter.configs'.setup {
|
||||||
-- Configure the nvim-ts-autotag plugin
|
-- Configure the nvim-ts-autotag plugin
|
||||||
autotag = {
|
autotag = {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue