commit 2e2a1e1bdcb652c89a759786713ac7771dd7d98d from: Andre M. Bertachini date: Sun May 11 17:46:09 2025 UTC Colorscheme autopairs and git commit - 49bf591560813b32942e1e9bb0cf73372ecf7ab7 commit + 2e2a1e1bdcb652c89a759786713ac7771dd7d98d blob - 4a03c7e0eb45db5731170fabde6516a1aaf7b55c blob + 404f3b106d6bd941644eba6d7275ba200c14dfa9 --- init.lua +++ init.lua @@ -10,6 +10,9 @@ require('lazy').setup({ require('plugins/conform'), require('plugins/treesitter'), require('plugins/mini'), + require('plugins/autopairs'), + require('plugins/gitsigns'), + require('plugins/colors') }) require('config.options') blob - e0a7ebb0d5198525ff090109cb0c21c891ae627f blob + f77ae516ffc67e10826c29cc56bbccbf62a84840 --- lazy-lock.json +++ lazy-lock.json @@ -1,14 +1,17 @@ { "conform.nvim": { "branch": "master", "commit": "374aaf384e2e841607b8e2fe63fa3ad01d111c91" }, + "gitsigns.nvim": { "branch": "main", "commit": "43b0c856ae5f32a195d83f4a27fe21d63e6c966c" }, "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "d39a75bbce4b8aad5d627191ea915179c77c100f" }, "mason-tool-installer.nvim": { "branch": "main", "commit": "62f821a14e20f3f2ee358cd44d0b3d299a508e72" }, "mason.nvim": { "branch": "main", "commit": "7c7318e8bae7e3536ef6b9e86b9e38e74f2e125e" }, "mini.nvim": { "branch": "main", "commit": "c665f30bb372c2ec8cfd61f7531098d3658b6634" }, + "nvim-autopairs": { "branch": "master", "commit": "4d74e75913832866aa7de35e4202463ddf6efd1b" }, "nvim-lspconfig": { "branch": "master", "commit": "61e5109c8cf24807e4ae29813a3a82b31821dd45" }, "nvim-treesitter": { "branch": "master", "commit": "28d480e0624b259095e56f353ec911f9f2a0f404" }, "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" }, "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, - "telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" } + "telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, + "vim-plan9": { "branch": "master", "commit": "8263b2459ca48bc9dca6dad8fa34a28935426193" } } blob - 39998557aaa3e69cc6791a6abc2acfd153bb9b45 blob + 2c35e66597b3323e2eaff0274050618da568caf2 --- lua/config/keymaps.lua +++ lua/config/keymaps.lua @@ -103,12 +103,71 @@ vim.api.nvim_create_autocmd('LspAttach', { lsp_map('ca', vim.lsp.buf.code_action, 'Code actions', { 'n', 'x' }) lsp_map('lt', require('telescope.builtin').lsp_type_definitions, 'Type Definition') lsp_map('le', function() - vim.diagnostic.open_float({ - scope = 'line', - border = 'rounded', - max_width = 80, - severity = vim.diagnostic.severity.ERROR, + require('telescope.builtin').diagnostics({ + severity = vim.diagnostic.severity.ERROR, -- Filter by ERROR severity + bufnr = 0, -- Current buffer + line = vim.api.nvim_win_get_cursor(0)[1], -- Current line + prompt_title = 'Line Error Diagnostics', + layout_config = { + width = 0.8, -- Max width (80% of screen) + height = 0.4, + }, }) - end, 'Show error diagnostics in float', 'n') + end, 'Show error diagnostics in Telescope', 'n') end, }) + +-- Gitsigns +vim.api.nvim_create_autocmd('BufEnter', { + group = vim.api.nvim_create_augroup('GitSignsConfig', { clear = true }), + callback = function(event) + local gs_map = function(keys, func, desc, mode) + mode = mode or 'n' + vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'GitSigns: ' .. desc }) + end + + local gitsigns = require('gitsigns') + + -- Navigation + gs_map(']c', function() + if vim.wo.diff then + vim.cmd.normal({ ']c', bang = true }) + else + gitsigns.nav_hunk('next') + end + end, 'Jump to next git change') + + gs_map('[c', function() + if vim.wo.diff then + vim.cmd.normal({ '[c', bang = true }) + else + gitsigns.nav_hunk('prev') + end + end, 'Jump to previous git change') + + -- Actions visual mode + gs_map('hs', function() + gitsigns.stage_hunk({ vim.fn.line('.'), vim.fn.line('v') }) + end, 'git stage hunk', 'v') + + gs_map('hr', function() + gitsigns.reset_hunk({ vim.fn.line('.'), vim.fn.line('v') }) + end, 'git reset hunk', 'v') + + gs_map('hs', gitsigns.stage_hunk, 'git rtage hunk') + gs_map('hr', gitsigns.reset_hunk, 'git reset hunk') + gs_map('hS', gitsigns.stage_buffer, 'git stage buffer') + gs_map('hu', gitsigns.undo_stage_hunk, 'git undo stage hunk') + gs_map('hR', gitsigns.reset_buffer, 'git reset buffer') + gs_map('hp', gitsigns.preview_hunk, 'git preview hunk') + gs_map('hb', gitsigns.blame_line, 'git blame line') + gs_map('hd', gitsigns.diffthis, 'git diff against index') + gs_map('hD', function() + gitsigns.diffthis('@') + end, 'git diff against last commit') + + -- Toggles + gs_map('tb', gitsigns.toggle_current_line_blame, 'toggle git show blame line') + gs_map('tD', gitsigns.toggle_deleted, 'Toggle git show deleted') + end, +}) blob - 60376135828e270a184d042effe1e8f8aeb9d4e3 blob + dcaf51191a2e5f79336adda3906ff92d4136c46c --- lua/config/options.lua +++ lua/config/options.lua @@ -4,6 +4,10 @@ vim.o.relativenumber = true -- Enable mouse mode, can be useful for resizing splits for example! vim.o.mouse = 'a' +vim.opt.expandtab = true -- Use spaces instead of tabs +vim.opt.shiftwidth = 4 -- Number of spaces to insert for indentation +vim.opt.tabstop = 4 -- Display width of tabs (doesn't affect actual indentation) +vim.opt.softtabstop = 4 -- Number of spaces for key to insert (for convenience) -- Don't show the mode, since it's already in the status line vim.o.showmode = false blob - 609b6c2631e6da6463e0e6037354551ade1d59a8 blob + ac93bf97a51e715aa962e9af9342a1604511b3d8 --- lua/plugins/conform.lua +++ lua/plugins/conform.lua @@ -6,6 +6,7 @@ return { notify_on_error = true, formatters_by_ft = { lua = { 'stylua' }, + typescript = { 'prettier' }, }, }, }, blob - /dev/null blob + 2106204c41fc83f410a733fb20f822cdcc7bf6d3 (mode 644) --- /dev/null +++ lua/plugins/autopairs.lua @@ -0,0 +1,5 @@ +return { + 'windwp/nvim-autopairs', + event = 'InsertEnter', + opts = {}, +} blob - /dev/null blob + 20a6d9234038d8ecacd5471a113a28d449cc7f9e (mode 644) --- /dev/null +++ lua/plugins/colors.lua @@ -0,0 +1,6 @@ +return { + 'lunacookies/vim-plan9', + config = function() + vim.cmd.colorscheme('plan9') + end, +} blob - 4e6169aa10c79bf146a2851871b1f0b08d87d03f blob + b401a9f845b04bf7c5aee2ae2673e24f5070dead --- lua/plugins/lspconfig.lua +++ lua/plugins/lspconfig.lua @@ -7,12 +7,13 @@ return { }, config = function() vim.diagnostic.config({ + signs = false, severity_sort = true, float = { border = 'rounded', source = 'if_many' }, underline = { severity = vim.diagnostic.severity.ERROR }, virtual_text = { source = 'if_many', - spacing = 2, + spacing = 1, format = function(diagnostic) local diagnostic_message = { [vim.diagnostic.severity.ERROR] = diagnostic.message, blob - /dev/null blob + e1cf6784840d185440de8623198bde3af9807c75 (mode 644) --- /dev/null +++ lua/plugins/gitsigns.lua @@ -0,0 +1,21 @@ +return { + 'lewis6991/gitsigns.nvim', + opts = { + signs = { + add = { text = '+' }, + change = { text = '~' }, + delete = { text = '_' }, + topdelete = { text = '‾' }, + changedelete = { text = '~' }, + }, + current_line_blame_opts = { + virt_text = true, + virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align' + delay = 100, + ignore_whitespace = false, + virt_text_priority = 100, + use_focus = true, + }, + current_line_blame_formatter = ', - ', + }, +}