diff --git a/init.lua b/init.lua index cec3084e..468b7fdd 100644 --- a/init.lua +++ b/init.lua @@ -74,6 +74,26 @@ require('lazy').setup({ -- Detect tabstop and shiftwidth automatically 'tpope/vim-sleuth', + -- my extra plugins + { + 'romgrk/barbar.nvim', + dependencies = { + 'lewis6991/gitsigns.nvim', -- OPTIONAL: for git status + 'nvim-tree/nvim-web-devicons', -- OPTIONAL: for file icons + }, + init = function() vim.g.barbar_auto_setup = false end, + opts = { + -- lazy.nvim will automatically call setup for you. put your options here, anything missing will use the default: + -- animation = true, + -- insert_at_start = true, + -- …etc. + }, + version = '^1.0.0', -- optional: only update when a new 1.x version is released + }, + 'godlygeek/tabular', + 'kdheepak/lazygit.nvim', + 'tpope/vim-obsession', + -- NOTE: This is where your plugins related to LSP can be installed. -- The configuration is done below. Search for lspconfig to find it below. { @@ -86,7 +106,7 @@ require('lazy').setup({ -- Useful status updates for LSP -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})` - { 'j-hui/fidget.nvim', tag = 'legacy', opts = {} }, + { 'j-hui/fidget.nvim', tag = 'legacy', opts = {} }, -- Additional lua configuration, makes nvim stuff amazing! 'folke/neodev.nvim', @@ -110,7 +130,7 @@ require('lazy').setup({ }, -- Useful plugin to show you pending keybinds. - { 'folke/which-key.nvim', opts = {} }, + { 'folke/which-key.nvim', opts = {} }, { -- Adds git related signs to the gutter, as well as utilities for managing changes 'lewis6991/gitsigns.nvim', @@ -128,16 +148,16 @@ require('lazy').setup({ -- don't override the built-in and fugitive keymaps local gs = package.loaded.gitsigns - vim.keymap.set({'n', 'v'}, ']c', function() + vim.keymap.set({ 'n', 'v' }, ']c', function() if vim.wo.diff then return ']c' end vim.schedule(function() gs.next_hunk() end) return '' - end, {expr=true, buffer = bufnr, desc = "Jump to next hunk"}) - vim.keymap.set({'n', 'v'}, '[c', function() + end, { expr = true, buffer = bufnr, desc = "Jump to next hunk" }) + vim.keymap.set({ 'n', 'v' }, '[c', function() if vim.wo.diff then return '[c' end vim.schedule(function() gs.prev_hunk() end) return '' - end, {expr=true, buffer = bufnr, desc = "Jump to previous hunk"}) + end, { expr = true, buffer = bufnr, desc = "Jump to previous hunk" }) end, }, }, @@ -212,8 +232,8 @@ require('lazy').setup({ -- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart -- These are some example plugins that I've included in the kickstart repository. -- Uncomment any of the lines below to enable them. - -- require 'kickstart.plugins.autoformat', - -- require 'kickstart.plugins.debug', + require 'kickstart.plugins.autoformat', + require 'kickstart.plugins.debug', -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` -- You can use this folder to prevent any conflicts with this init.lua if you're interested in keeping @@ -271,14 +291,55 @@ vim.o.termguicolors = true -- See `:help vim.keymap.set()` vim.keymap.set({ 'n', 'v' }, '', '', { silent = true }) +vim.keymap.set({ 'n', 'v', 'x', 'i' }, '', ':w', { silent = true }) + +vim.keymap.set('n', 'gg', 'LazyGit', { silent = true, desc = 'Open Lazigit' }) + +-- vim.keymap.set('n', '<', '<<_', { noremap = true, silent = true }) +-- vim.keymap.set('n', '>', '>>_', { noremap = true, silent = true }) + +vim.keymap.set('v', '<', '<', '>>gv', { noremap = true, silent = true }) + +-- pcall(vim.keymap.del,{'n' , 'v'} , '>iÞ' , nil) +-- pcall(vim.keymap.del,{'n' , 'v'} , '>aÞ' , nil) +-- pcall(vim.keymap.del,{'n' , 'v'} , '>Þ' , nil) +-- +-- pcall(vim.keymap.del,{'n' , 'v'} , '', ':m .+1==', { silent = true }) +vim.keymap.set('x', '', ":m '>+1gv-gv", { silent = true }) + +vim.keymap.set('n', '', ':m .-2==', { silent = true }) +vim.keymap.set('x', '', ":m '<-2gv-gv", { silent = true }) + +vim.keymap.set('n', '', 'BufferNext', { silent = true }) +vim.keymap.set('n', '', 'BufferPrevious', { silent = true }) +vim.keymap.set('n', '', 'BufferMoveNext', { silent = true }) +vim.keymap.set('n', '', 'BufferMovePrevious', { silent = true }) +vim.keymap.set('n', '', 'BufferNext', { silent = true }) +vim.keymap.set('n', '', 'BufferPrevious', { silent = true }) +vim.keymap.set('n', 'c', 'BufferClose', { silent = true }) + +vim.keymap.set({ 'n', 'v' }, 'a:', ":Tab /:", { silent = true }) +vim.keymap.set({ 'n', 'v' }, 'a,', ":Tab /,", { silent = true }) +vim.keymap.set({ 'n', 'v' }, 'a=', ":Tab /=", { silent = true }) +vim.keymap.set({ 'n', 'v' }, 'a|', ":Tab /|", { silent = true }) +vim.keymap.set({ 'n', 'v' }, 'a ', ":Tab / ", { silent = true }) +vim.keymap.set({ 'n', 'v' }, 'a;', ":Tab /;", { silent = true }) + -- Remap for dealing with word wrap vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true }) vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true }) --- [[ Highlight on yank ]] --- See `:help vim.highlight.on_yank()` -local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true }) -vim.api.nvim_create_autocmd('TextYankPost', { + + +-- [[ highlight on yank ]] +-- see `:help vim.highlight.on_yank()` +local highlight_group = vim.api.nvim_create_augroup('yankhighlight', { clear = true }) +vim.api.nvim_create_autocmd('textyankpost', { callback = function() vim.highlight.on_yank() end, diff --git a/lua/kickstart/plugins/debug.lua b/lua/kickstart/plugins/debug.lua index 7fc783fa..4c789237 100644 --- a/lua/kickstart/plugins/debug.lua +++ b/lua/kickstart/plugins/debug.lua @@ -20,6 +20,7 @@ return { -- Add your own debuggers here 'leoluz/nvim-dap-go', + 'mfussenegger/nvim-jdtls', }, config = function() local dap = require 'dap' @@ -43,10 +44,10 @@ return { } -- Basic debugging keymaps, feel free to change to your liking! - vim.keymap.set('n', '', dap.continue, { desc = 'Debug: Start/Continue' }) - vim.keymap.set('n', '', dap.step_into, { desc = 'Debug: Step Into' }) - vim.keymap.set('n', '', dap.step_over, { desc = 'Debug: Step Over' }) - vim.keymap.set('n', '', dap.step_out, { desc = 'Debug: Step Out' }) + vim.keymap.set('n', '', dap.continue, { desc = 'Debug: Start/Continue' }) + vim.keymap.set('n', '', dap.step_into, { desc = 'Debug: Step Into' }) + vim.keymap.set('n', '', dap.step_over, { desc = 'Debug: Step Over' }) + vim.keymap.set('n', '', dap.step_out, { desc = 'Debug: Step Out' }) vim.keymap.set('n', 'b', dap.toggle_breakpoint, { desc = 'Debug: Toggle Breakpoint' }) vim.keymap.set('n', 'B', function() dap.set_breakpoint(vim.fn.input 'Breakpoint condition: ') @@ -75,7 +76,7 @@ return { } -- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception. - vim.keymap.set('n', '', dapui.toggle, { desc = 'Debug: See last session result.' }) + vim.keymap.set('n', '', dapui.toggle, { desc = 'Debug: See last session result.' }) dap.listeners.after.event_initialized['dapui_config'] = dapui.open dap.listeners.before.event_terminated['dapui_config'] = dapui.close @@ -83,5 +84,6 @@ return { -- Install golang specific config require('dap-go').setup() + require('jdtls').setup_dap({ hotcodereplace = 'auto' }) end, }