diff options
Diffstat (limited to '.config/nvim/lua')
-rw-r--r-- | .config/nvim/lua/dap_conf.lua | 52 | ||||
-rw-r--r-- | .config/nvim/lua/git.lua | 65 | ||||
-rw-r--r-- | .config/nvim/lua/lsp_conf.lua | 114 |
3 files changed, 0 insertions, 231 deletions
diff --git a/.config/nvim/lua/dap_conf.lua b/.config/nvim/lua/dap_conf.lua deleted file mode 100644 index b3cee89..0000000 --- a/.config/nvim/lua/dap_conf.lua +++ /dev/null @@ -1,52 +0,0 @@ -local dap, dapui = require('dap'), require('dapui') -local dapgo = require('dap-go') -dapui.setup() -dapgo.setup() -dap.listeners.before.attach.dapui_config = function() - dapui.open() -end -dap.listeners.before.launch.dapui_config = function() - dapui.open() -end - -dap.adapters.gdb = { - type = "executable", - command = "gdb", - args = { "--interpreter=dap", "--eval-command", "set print pretty on" } -} - -local configurations = {'c', 'cpp', 'rust'} - -for _, conf in ipairs(configurations) do - dap.configurations[conf] = { - { - name = "Launch", - type = "gdb", - request = "launch", - program = function() - return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') - end, - cwd = "${workspaceFolder}", - stopAtBeginningOfMainSubprogram = false, - }, - } -end - --- Include the next few lines until the comment only if you feel you need it -dap.listeners.before.event_terminated.dapui_config = function() - dapui.close() -end -dap.listeners.before.event_exited.dapui_config = function() - dapui.close() -end --- Include everything after this - - -vim.keymap.set('n', '<F5>', function() require('dap').continue() end) -vim.keymap.set('n', '<F10>', function() require('dap').step_over() end) -vim.keymap.set('n', '<F11>', function() require('dap').step_into() end) -vim.keymap.set('n', '<F12>', function() require('dap').step_out() end) -vim.keymap.set('n', '<C-K>', function() require('dap').toggle_breakpoint() end) -vim.api.nvim_create_user_command('DapRepeat',function() require('dap').run_last() end, {}) -vim.api.nvim_create_user_command('DapOpen',function() dapui.open() end, {}) -vim.api.nvim_create_user_command('DapClose',function() dapui.close() end, {}) diff --git a/.config/nvim/lua/git.lua b/.config/nvim/lua/git.lua deleted file mode 100644 index da6bbdd..0000000 --- a/.config/nvim/lua/git.lua +++ /dev/null @@ -1,65 +0,0 @@ -require('gitsigns').setup { - signs = { - add = { text = '+' }, - change = { text = '~' }, - delete = { text = '-' }, - topdelete = { text = '-' }, - changedelete = { text = '~' }, - untracked = { text = '┆' }, - }, - signcolumn = true, -- Toggle with `:Gitsigns toggle_signs` - numhl = false, -- Toggle with `:Gitsigns toggle_numhl` - linehl = false, -- Toggle with `:Gitsigns toggle_linehl` - word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff` - watch_gitdir = { - follow_files = true - }, - attach_to_untracked = true, - current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame` - current_line_blame_opts = { - virt_text = true, - virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align' - delay = 1000, - ignore_whitespace = false, - }, - current_line_blame_formatter = '<author>, <author_time:%Y-%m-%d> - <summary>', - sign_priority = 6, - update_debounce = 100, - status_formatter = nil, -- Use default - max_file_length = 40000, -- Disable if file is longer than this (in lines) - preview_config = { - -- Options passed to nvim_open_win - border = 'single', - style = 'minimal', - relative = 'cursor', - row = 0, - col = 1 - }, - on_attach = function(bufnr) - local gs = package.loaded.gitsigns - local function map(mode, l, r, opts) - opts = opts or {} - opts.buffer = bufnr - vim.keymap.set(mode, l, r, opts) - end - - map('n', ']c', function() - if vim.wo.diff then return ']c' end - vim.schedule(function() gs.next_hunk() end) - return '<Ignore>' - end, {expr=true}) - - map('n', '[c', function() - if vim.wo.diff then return '[c' end - vim.schedule(function() gs.prev_hunk() end) - return '<Ignore>' - end, {expr=true}) - - map('n', 'hs', gs.stage_hunk) - map('v', 'hs', function() gs.stage_hunk {vim.fn.line('.'), vim.fn.line('v')} end) - map('n', 'hS', gs.stage_buffer) - map('n', 'hu', gs.undo_stage_hunk) - map('n', 'hp', gs.preview_hunk) - map('n', 'hB', gs.blame_line) - end -} diff --git a/.config/nvim/lua/lsp_conf.lua b/.config/nvim/lua/lsp_conf.lua deleted file mode 100644 index a93dc5b..0000000 --- a/.config/nvim/lua/lsp_conf.lua +++ /dev/null @@ -1,114 +0,0 @@ -local nvim_lsp = require('lspconfig') -local trouble = require("trouble") - -local capabilities = require("cmp_nvim_lsp").default_capabilities() - --- Redefine LSP diagnostic signs -local signs = { Error = 'E', Warning = 'W', Hint = 'H', Information = 'I' } - -for type, icon in pairs(signs) do - local hl = 'DiagnosticSign' .. type - vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = '' }) -end - -local opts = { noremap=true, silent=true } - --- Setup lsp_signature for function signature help -require "lsp_signature".setup() - --- Common on_attach function to handle keymaps and settings for all LSPs -local common_on_attach = function(client, bufnr) - -- Key mappings - vim.api.nvim_buf_set_keymap(bufnr, "n", "gD", "<cmd>lua vim.lsp.buf.declaration()<CR>", opts) - vim.api.nvim_buf_set_keymap(bufnr, "n", "gd", "<cmd>lua vim.lsp.buf.definition()<CR>", opts) - vim.api.nvim_buf_set_keymap(bufnr, "n", "ga", "<cmd>lua vim.lsp.buf.code_action()<CR>", opts) - vim.api.nvim_buf_set_keymap(bufnr, "n", "K", "<cmd>lua vim.lsp.buf.hover()<CR>", opts) - vim.api.nvim_buf_set_keymap(bufnr, "n", "gr", "<cmd>lua vim.lsp.buf.references()<CR>", opts) - -- Use vim.diagnostic.open_float for showing line diagnostics (replacing deprecated call) - vim.api.nvim_buf_set_keymap(bufnr, "n", "<space>e", "<cmd>lua vim.diagnostic.open_float()<CR>", opts) - vim.keymap.set('n', '<A-f>', '<cmd>lua vim.lsp.buf.format {async = true}<cr>', opts) - - -- Autoformat on save - vim.cmd("autocmd BufWritePre <buffer> lua vim.lsp.buf.format {async = true}") -end - --- LSP servers setup -local servers = { - 'clangd', - 'gopls', - 'jdtls', - 'metals', - 'ocamllsp', - 'ruff_lsp', - 'rust_analyzer', -} - -capabilities.offsetEncoding = { "utf-16" } - -for _, lsp in ipairs(servers) do - nvim_lsp[lsp].setup { - capabilities = capabilities, - on_attach = common_on_attach, - flags = { - debounce_text_changes = 150, - } - } -end - -nvim_lsp.ts_ls.setup { - capabilities = capabilities, - on_attach = common_on_attach, - filetypes = { "typescript", "typescriptreact", "typescript.tsx" }, - cmd = { "typescript-language-server", "--stdio" } -} - -vim.lsp.inlay_hint.enable(true, { 0 }) - --- Trouble setup -trouble.setup({ - use_diagnostic_signs = true, - auto_close = true, - auto_open = false -}) - --- nvim-cmp setup for autocompletion -local luasnip = require 'luasnip' -local cmp = require 'cmp' -cmp.setup { - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) - end, - }, - mapping = cmp.mapping.preset.insert({ - ['<C-d>'] = cmp.mapping.scroll_docs(-4), - ['<C-f>'] = cmp.mapping.scroll_docs(4), - ['<C-Space>'] = cmp.mapping.complete(), - ['<CR>'] = cmp.mapping.confirm { - behavior = cmp.ConfirmBehavior.Replace, - select = true, - }, - ['<Tab>'] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() - else - fallback() - end - end, { 'i', 's' }), - ['<S-Tab>'] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif luasnip.jumpable(-1) then - luasnip.jump(-1) - else - fallback() - end - end, { 'i', 's' }), - }), - sources = { - { name = 'nvim_lsp' }, - { name = 'luasnip' }, - }, -} |