97 lines
2.8 KiB
Lua
97 lines
2.8 KiB
Lua
local map = require('my.functions').map
|
|
|
|
require('Comment').setup({
|
|
toggler = {
|
|
line = '<Leader>cc',
|
|
block = '<Leader>CC'
|
|
},
|
|
opleader = {
|
|
line = '<Leader>c',
|
|
block = '<Leader>C'
|
|
},
|
|
extra = {
|
|
above = '<Leader>cO',
|
|
below = '<Leader>co',
|
|
eol = '<Leader>cA',
|
|
},
|
|
pre_hook = require('ts_context_commentstring.integrations.comment_nvim').create_pre_hook(),
|
|
})
|
|
|
|
require("nvim-autopairs").setup({})
|
|
|
|
require('luasnip.loaders.from_lua').load({
|
|
paths = vim.fn.stdpath('config') .. '/snippets'
|
|
})
|
|
|
|
require('project_nvim').setup({
|
|
detection_methods = { 'pattern', 'lsp' },
|
|
patterns = require('my.functions').project_root_markers,
|
|
show_hidden = false,
|
|
fallback_buffer_dir = true
|
|
})
|
|
|
|
-- icons for diagnostics in the symbol column
|
|
local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " }
|
|
for type, icon in pairs(signs) do
|
|
local hl = "DiagnosticSign" .. type
|
|
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
|
|
end
|
|
|
|
local dap = require('dap')
|
|
|
|
if vim.fn.executable('lldb-vscode') > 0 then
|
|
dap.adapters.lldb = {
|
|
type = 'executable',
|
|
command = 'lldb-vscode',
|
|
name = 'lldb'
|
|
}
|
|
|
|
dap.configurations.cpp = {
|
|
{
|
|
name = 'Launch',
|
|
type = 'lldb',
|
|
request = 'launch',
|
|
program = function()
|
|
return vim.fn.input('Path to executable: ',
|
|
vim.fn.getcwd() .. '/', 'file')
|
|
end,
|
|
cwd = '${workspaceFolder}',
|
|
stopOnEntry = false,
|
|
args = {},
|
|
},
|
|
{
|
|
name = "Attach to process",
|
|
type = 'lldb',
|
|
request = 'attach',
|
|
pid = require('dap.utils').pick_process,
|
|
args = {},
|
|
}
|
|
}
|
|
dap.configurations.c = dap.configurations.cpp
|
|
end
|
|
|
|
map('n', '<Leader>dc', dap.continue, 'Continue')
|
|
map('n', '<F10>', dap.step_over, 'DAP: step over')
|
|
map('n', '<F11>', dap.step_into, 'DAP: step into')
|
|
map('n', '<F12>', dap.step_out, 'DAP: step out')
|
|
map('n', '<Leader>db', dap.toggle_breakpoint, 'Toggle breakpoint')
|
|
map('n', '<Leader>dB', function()
|
|
dap.set_breakpoint(vim.fn.input('Breakpoint condition: '))
|
|
end, 'Set breakpoint')
|
|
map('n', '<Leader>dr', dap.repl.open, 'Open REPL')
|
|
map('n', '<Leader>dl', dap.run_last, 'Run last')
|
|
map('n', '<Leader>dj', function()
|
|
require('dap.ext.vscode').load_launchjs(
|
|
vim.fn.input('Path to launch.json: ',
|
|
vim.fn.getcwd() .. '/launch.json', 'file'))
|
|
end, 'Load launch.json')
|
|
|
|
require('dapui').setup({})
|
|
map('n', '<Leader>du', require("dapui").toggle, 'Toggle UI')
|
|
|
|
require('nvim-dap-virtual-text').setup({})
|
|
|
|
require('femaco').setup({})
|
|
map('n', '<Leader>E', require('femaco.edit').edit_code_block,
|
|
'Edit inline code block')
|