├── .luarc.json ├── lua ├── config │ ├── autocmds.lua │ ├── keymaps.lua │ ├── options.lua │ ├── icons.lua │ └── jdtls.lua └── plugins │ ├── tmux-navigator.lua │ ├── harpoon.lua │ ├── autopairs.lua │ ├── whichkey.lua │ ├── comment.lua │ ├── treesitter.lua │ ├── springboot-nvim.lua │ ├── nvim-dap.lua │ ├── none-ls.lua │ ├── colorscheme.lua │ ├── nvim-tree.lua │ ├── git.lua │ ├── lualine.lua │ ├── cmp.lua │ ├── lsp-config.lua │ └── telescope.lua ├── init.lua └── lazy-lock.json /.luarc.json: -------------------------------------------------------------------------------- 1 | { 2 | "diagnostics.globals": [ 3 | "vim" 4 | ] 5 | } -------------------------------------------------------------------------------- /lua/config/autocmds.lua: -------------------------------------------------------------------------------- 1 | -- Setup our JDTLS server any time we open up a java file 2 | vim.cmd [[ 3 | augroup jdtls_lsp 4 | autocmd! 5 | autocmd FileType java lua require'config.jdtls'.setup_jdtls() 6 | augroup end 7 | ]] 8 | -------------------------------------------------------------------------------- /lua/plugins/tmux-navigator.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "christoomey/vim-tmux-navigator", 3 | cmd = { 4 | "TmuxNavigateLeft", 5 | "TmuxNavigateDown", 6 | "TmuxNavigateUp", 7 | "TmuxNavigateRight", 8 | "TmuxNavigatePrevious", 9 | }, 10 | keys = { 11 | { "", "TmuxNavigateLeft" }, 12 | { "", "TmuxNavigateDown" }, 13 | { "", "TmuxNavigateUp" }, 14 | { "", "TmuxNavigateRight" }, 15 | { "", "TmuxNavigatePrevious" }, 16 | }, 17 | } 18 | -------------------------------------------------------------------------------- /lua/plugins/harpoon.lua: -------------------------------------------------------------------------------- 1 | local M = { 2 | "ThePrimeagen/harpoon", 3 | event = "VeryLazy", 4 | dependencies = { 5 | "nvim-lua/plenary.nvim" 6 | }, 7 | config = function() 8 | -- Set a vim motion to m to mark a file with harpoon 9 | vim.keymap.set("n", "", "lua require('plugins.harpoon').mark_file()", {desc = "Harpoon Mark File"}) 10 | -- Set a vim motion to the tab key to open the harpoon menu to easily navigate frequented files 11 | vim.keymap.set("n", "", "lua require('harpoon.ui').toggle_quick_menu()", {desc = "Harpoon Toggle Menu"}) 12 | end 13 | } 14 | 15 | function M.mark_file() 16 | require("harpoon.mark").add_file() 17 | vim.notify "󱡅 marked file" 18 | end 19 | 20 | return M 21 | -------------------------------------------------------------------------------- /lua/plugins/autopairs.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "windwp/nvim-autopairs", 3 | event = { "InsertEnter" }, 4 | dependencies = { 5 | "hrsh7th/nvim-cmp", 6 | }, 7 | config = function() 8 | -- Call the autopairs setup function to configure how we want autopairs to work 9 | require'nvim-autopairs'.setup({ 10 | check_ts = true, 11 | ts_config = { 12 | lua = { "string" }, 13 | javascript = { "template_string" }, 14 | java = false, 15 | } 16 | }) 17 | 18 | -- Get access to auto pairs completion and cmp plugins 19 | local cmp_autopairs = require("nvim-autopairs.completion.cmp") 20 | local cmp = require("cmp") 21 | 22 | -- Whenever we accept a choice from an autocompletion, make sure that any pairs are automatically closed 23 | cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done()) 24 | end 25 | } 26 | -------------------------------------------------------------------------------- /lua/plugins/whichkey.lua: -------------------------------------------------------------------------------- 1 | return { 2 | 'folke/which-key.nvim', 3 | event = 'VimEnter', 4 | config = function() 5 | -- gain access to the which key plugin 6 | local which_key = require('which-key') 7 | 8 | -- call the setup function with default properties 9 | which_key.setup() 10 | 11 | -- Register prefixes for the different key mappings we have setup previously 12 | which_key.register({ 13 | ['/'] = {name = "Comments", _ = 'which_key_ignore'}, 14 | ['c'] = { name = '[C]ode', _ = 'which_key_ignore' }, 15 | ['d'] = {name = '[D]ebug' , _ = 'which_key_ignore' }, 16 | ['e'] = {name = '[E]xplorer', _ = 'which_key_ignore'}, 17 | ['f'] = { name = '[F]ind', _ = 'which_key_ignore' }, 18 | ['g'] = { name = '[G]it', _ = 'which_key_ignore' }, 19 | ['J'] = { name = '[J]ava', _ = 'which_key_ignore' }, 20 | ['t'] = { name = '[T]ab', _ = 'which_key_ignore'}, 21 | ['w'] = {name = '[W]indow', _ = 'which_key_ignore'} 22 | }) 23 | end 24 | } 25 | -------------------------------------------------------------------------------- /lua/plugins/comment.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "numToStr/Comment.nvim", 3 | event = { "BufReadPre", "BufNewFile" }, 4 | dependencies = { 5 | -- plugin to allow us to automatically comment tsx elements with the comment plugin 6 | "JoosepAlviste/nvim-ts-context-commentstring", 7 | }, 8 | config = function() 9 | -- Set a vim motion to + / to comment the line under the cursor in normal mode 10 | vim.keymap.set("n", "/", "(comment_toggle_linewise_current)", { desc = "Comment Line" }) 11 | -- Set a vim motion to + / to comment all the lines selected in visual mode 12 | vim.keymap.set("v", "/", "(comment_toggle_linewise_visual)", { desc = "Comment Selected" }) 13 | 14 | -- gain access to the comment plugins functions 15 | local comment = require("Comment") 16 | -- gain access to tsx commenting plugins functions 17 | local ts_context_comment_string = require("ts_context_commentstring.integrations.comment_nvim") 18 | 19 | -- setup the comment plugin to use ts_context_comment_string to check if we are attempting to comment out a tsx element 20 | -- if we are use ts_context_comment_string to comment it out 21 | comment.setup({ 22 | pre_hook = ts_context_comment_string.create_pre_hook(), 23 | }) 24 | end, 25 | } 26 | -------------------------------------------------------------------------------- /lua/plugins/treesitter.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "nvim-treesitter/nvim-treesitter", 3 | dependencies = { 4 | -- ts-autotag utilizes treesitter to understand the code structure to automatically close tsx tags 5 | "windwp/nvim-ts-autotag" 6 | }, 7 | -- when the plugin builds run the TSUpdate command to ensure all our servers are installed and updated 8 | build = ':TSUpdate', 9 | config = function() 10 | -- gain access to the treesitter config functions 11 | local ts_config = require("nvim-treesitter.configs") 12 | 13 | -- call the treesitter setup function with properties to configure our experience 14 | ts_config.setup({ 15 | -- make sure we have vim, vimdoc, lua, java, javascript, typescript, html, css, json, tsx, markdown, markdown, inline markdown and gitignore highlighting servers 16 | ensure_installed = {"vim", "vimdoc", "lua", "java", "javascript", "typescript", "html", "css", "json", "tsx", "markdown", "markdown_inline", "gitignore"}, 17 | -- make sure highlighting it anabled 18 | highlight = {enable = true}, 19 | -- enable tsx auto closing tag creation 20 | autotag = { 21 | enable = true 22 | } 23 | }) 24 | end 25 | } 26 | -------------------------------------------------------------------------------- /lua/plugins/springboot-nvim.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "elmcgill/springboot-nvim", 3 | dependencies = { 4 | "neovim/nvim-lspconfig", 5 | "mfussenegger/nvim-jdtls" 6 | }, 7 | config = function() 8 | -- gain acces to the springboot nvim plugin and its functions 9 | local springboot_nvim = require("springboot-nvim") 10 | 11 | -- set a vim motion to + J + r to run the spring boot project in a vim terminal 12 | vim.keymap.set('n', 'Jr', springboot_nvim.boot_run, {desc = "[J]ava [R]un Spring Boot"}) 13 | -- set a vim motion to + J + c to open the generate class ui to create a class 14 | vim.keymap.set('n', 'Jc', springboot_nvim.generate_class, {desc = "[J]ava Create [C]lass"}) 15 | -- set a vim motion to + J + i to open the generate interface ui to create an interface 16 | vim.keymap.set('n', 'Ji', springboot_nvim.generate_interface, {desc = "[J]ava Create [I]nterface"}) 17 | -- set a vim motion to + J + e to open the generate enum ui to create an enum 18 | vim.keymap.set('n', 'Je', springboot_nvim.generate_enum, {desc = "[J]ava Create [E]num"}) 19 | 20 | -- run the setup function with default configuration 21 | springboot_nvim.setup({}) 22 | end 23 | } 24 | -------------------------------------------------------------------------------- /lua/plugins/nvim-dap.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "mfussenegger/nvim-dap", 3 | dependencies = { 4 | -- ui plugins to make debugging simplier 5 | "rcarriga/nvim-dap-ui", 6 | "nvim-neotest/nvim-nio" 7 | }, 8 | config = function() 9 | -- gain access to the dap plugin and its functions 10 | local dap = require("dap") 11 | -- gain access to the dap ui plugin and its functions 12 | local dapui = require("dapui") 13 | 14 | -- Setup the dap ui with default configuration 15 | dapui.setup() 16 | 17 | -- setup an event listener for when the debugger is launched 18 | dap.listeners.before.launch.dapui_config = function() 19 | -- when the debugger is launched open up the debug ui 20 | dapui.open() 21 | end 22 | 23 | -- set a vim motion for + d + t to toggle a breakpoint at the line where the cursor is currently on 24 | vim.keymap.set("n", "dt", dap.toggle_breakpoint, { desc = "[D]ebug [T]oggle Breakpoint" }) 25 | 26 | -- set a vim motion for + d + s to start the debugger and launch the debugging ui 27 | vim.keymap.set("n", "ds", dap.continue, { desc = "[D]ebug [S]tart" }) 28 | 29 | -- set a vim motion to close the debugging ui 30 | vim.keymap.set("n", "dc", dapui.close, {desc = "[D]ebug [C]lose"}) 31 | end 32 | } 33 | -------------------------------------------------------------------------------- /lua/plugins/none-ls.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "nvimtools/none-ls.nvim", 3 | dependencies = { 4 | "nvimtools/none-ls-extras.nvim", 5 | }, 6 | config = function() 7 | -- get access to the none-ls functions 8 | local null_ls = require("null-ls") 9 | -- run the setup function for none-ls to setup our different formatters 10 | null_ls.setup({ 11 | sources = { 12 | -- setup lua formatter 13 | null_ls.builtins.formatting.stylua, 14 | -- setup eslint linter for javascript 15 | require("none-ls.diagnostics.eslint_d"), 16 | -- setup prettier to format languages that are not lua 17 | null_ls.builtins.formatting.prettierd.with({ 18 | extra_args = function(params) 19 | return params.options 20 | and params.options.tabSize 21 | and { 22 | "--tab-width", 23 | params.options.tabSize 24 | } 25 | end 26 | }) 27 | } 28 | }) 29 | 30 | -- set up a vim motion for + c + f to automatically format our code based on which langauge server is active 31 | vim.keymap.set("n", "cf", vim.lsp.buf.format, { desc = "[C]ode [F]ormat" }) 32 | end 33 | } 34 | -------------------------------------------------------------------------------- /init.lua: -------------------------------------------------------------------------------- 1 | -- Declare the path where lazy will clone plugin code 2 | local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" 3 | 4 | -- Check to see if lazy itself has been cloned, if not clone it into the lazy.nvim directory 5 | if not (vim.uv or vim.loop).fs_stat(lazypath) then 6 | vim.fn.system({ 7 | "git", 8 | "clone", 9 | "--filter=blob:none", 10 | "https://github.com/folke/lazy.nvim.git", 11 | "--branch=stable", -- latest stable release 12 | lazypath, 13 | }) 14 | end 15 | 16 | -- Add the path to the lazy plugin repositories to the vim runtime path 17 | vim.opt.rtp:prepend(lazypath) 18 | 19 | -- Declare a few options for lazy 20 | local opts = { 21 | change_detection = { 22 | -- Don't notify us every time a change is made to the configuration 23 | notify = false, 24 | }, 25 | checker = { 26 | -- Automatically check for package updates 27 | enabled = true, 28 | -- Don't spam us with notification every time there is an update available 29 | notify = false, 30 | }, 31 | } 32 | 33 | -- Load the options from the config/options.lua file 34 | require("config.options") 35 | -- Load the keymaps from the config/keymaps.lua file 36 | require("config.keymaps") 37 | -- Load the auto commands from the config/autocmds.lua file 38 | require("config.autocmds") 39 | -- Setup lazy, this should always be last 40 | -- Tell lazy that all plugin specs are found in the plugins directory 41 | -- Pass it the options we specified above 42 | require("lazy").setup("plugins", opts) 43 | -------------------------------------------------------------------------------- /lua/config/keymaps.lua: -------------------------------------------------------------------------------- 1 | -- Set our leader keybinding to space 2 | -- Anywhere you see in a keymapping specifies the space key 3 | vim.g.mapleader = " " 4 | vim.g.maplocalleader = " " 5 | 6 | -- Remove search highlights after searching 7 | vim.keymap.set("n", "", "nohlsearch", { desc = "Remove search highlights" }) 8 | 9 | -- Exit Vim's terminal mode 10 | vim.keymap.set("t", "", "", { desc = "Exit terminal mode" }) 11 | 12 | -- OPTIONAL: Disable arrow keys in normal mode 13 | -- vim.keymap.set('n', '', 'echo "Use h to move!!"') 14 | -- vim.keymap.set('n', '', 'echo "Use l to move!!"') 15 | -- vim.keymap.set('n', '', 'echo "Use k to move!!"') 16 | -- vim.keymap.set('n', '', 'echo "Use j to move!!"') 17 | 18 | -- Better window navigation 19 | vim.keymap.set("n", "", ":wincmd h", { desc = "Move focus to the left window" }) 20 | vim.keymap.set("n", "", ":wincmd l", { desc = "Move focus to the right window" }) 21 | vim.keymap.set("n", "", ":wincmd j", { desc = "Move focus to the lower window" }) 22 | vim.keymap.set("n", "", ":wincmd k", { desc = "Move focus to the upper window" }) 23 | 24 | vim.keymap.set("n", "tc", ":tabnew", {desc = "[T]ab [C]reat New"}) 25 | vim.keymap.set("n", "tn", ":tabnext", {desc = "[T]ab [N]ext"}) 26 | vim.keymap.set("n", "tp", ":tabprevious", {desc = "[T]ab [P]revious"}) 27 | 28 | -- Easily split windows 29 | vim.keymap.set("n", "wv", ":vsplit", { desc = "[W]indow Split [V]ertical" }) 30 | vim.keymap.set("n", "wh", ":split", { desc = "[W]indow Split [H]orizontal" }) 31 | 32 | -- Stay in indent mode 33 | vim.keymap.set("v", "<", "", ">gv", { desc = "Indent right in visual mode" }) 35 | -------------------------------------------------------------------------------- /lua/plugins/colorscheme.lua: -------------------------------------------------------------------------------- 1 | return { 2 | -- Shortened Github Url 3 | "Mofiqul/dracula.nvim", 4 | lazy = false, 5 | priority = 1000, 6 | config = function() 7 | local dracula = require("dracula") 8 | dracula.setup({ 9 | -- customize dracula color palette 10 | colors = { 11 | bg = "#282A36", 12 | fg = "#F8F8F2", 13 | selection = "#44475A", 14 | comment = "#6272A4", 15 | red = "#FF5555", 16 | orange = "#FFB86C", 17 | yellow = "#F1FA8C", 18 | green = "#50fa7b", 19 | purple = "#BD93F9", 20 | cyan = "#8BE9FD", 21 | pink = "#FF79C6", 22 | bright_red = "#FF6E6E", 23 | bright_green = "#69FF94", 24 | bright_yellow = "#FFFFA5", 25 | bright_blue = "#D6ACFF", 26 | bright_magenta = "#FF92DF", 27 | bright_cyan = "#A4FFFF", 28 | bright_white = "#FFFFFF", 29 | menu = "#21222C", 30 | visual = "#3E4452", 31 | gutter_fg = "#4B5263", 32 | nontext = "#3B4048", 33 | white = "#ABB2BF", 34 | black = "#191A21", 35 | }, 36 | -- show the '~' characters after the end of buffers 37 | show_end_of_buffer = true, -- default false 38 | -- use transparent background 39 | transparent_bg = true, -- default false 40 | -- set custom lualine background color 41 | lualine_bg_color = "#44475a", -- default nil 42 | -- set italic comment 43 | italic_comment = true, -- default false 44 | -- overrides the default highlights with table see `:h synIDattr` 45 | }) 46 | -- Make sure to set the color scheme when neovim loads and configures the dracula plugin 47 | vim.cmd.colorscheme("dracula") 48 | end, 49 | } 50 | -------------------------------------------------------------------------------- /lua/config/options.lua: -------------------------------------------------------------------------------- 1 | -- Left column and similar settings 2 | vim.opt.number = true -- display line numbers 3 | vim.opt.relativenumber = true -- display relative line numbers 4 | vim.opt.numberwidth = 2 -- set width of line number column 5 | vim.opt.signcolumn = "yes" -- always show sign column 6 | vim.opt.wrap = false -- display lines as single line 7 | vim.opt.scrolloff = 10 -- number of lines to keep above/below cursor 8 | vim.opt.sidescrolloff = 8 -- number of columns to keep to the left/right of cursor 9 | 10 | -- Tab spacing/behavior 11 | vim.opt.expandtab = true -- convert tabs to spaces 12 | vim.opt.shiftwidth = 4 -- number of spaces inserted for each indentation level 13 | vim.opt.tabstop = 4 -- number of spaces inserted for tab character 14 | vim.opt.softtabstop = 4 -- number of spaces inserted for key 15 | vim.opt.smartindent = true -- enable smart indentation 16 | vim.opt.breakindent = true -- enable line breaking indentation 17 | 18 | -- General Behaviors 19 | vim.g.loaded_netrw = 1 20 | vim.g.loaded_netrwPlugin = 1 21 | vim.opt.backup = false -- disable backup file creation 22 | vim.opt.clipboard = "unnamedplus" -- enable system clipboard access 23 | vim.opt.conceallevel = 0 -- show concealed characters in markdown files 24 | vim.opt.fileencoding = "utf-8" -- set file encoding to UTF-8 25 | vim.opt.mouse = "a" -- enable mouse support 26 | vim.opt.showmode = false -- hide mode display 27 | vim.opt.splitbelow = true -- force horizontal splits below current window 28 | vim.opt.splitright = true -- force vertical splits right of current window 29 | vim.opt.termguicolors = true -- enable term GUI colors 30 | vim.opt.timeoutlen = 1000 -- set timeout for mapped sequences 31 | vim.opt.undofile = true -- enable persistent undo 32 | vim.opt.updatetime = 100 -- set faster completion 33 | vim.opt.writebackup = false -- prevent editing of files being edited elsewhere 34 | vim.opt.cursorline = true -- highlight current line 35 | vim.opt.swapfile = false -- creates a swapfile 36 | 37 | -- Searching Behaviors 38 | vim.opt.hlsearch = true -- highlight all matches in search 39 | vim.opt.ignorecase = true -- ignore case in search 40 | vim.opt.smartcase = true -- match case if explicitly stated 41 | -------------------------------------------------------------------------------- /lua/plugins/nvim-tree.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "nvim-tree/nvim-tree.lua", 3 | config = function() 4 | vim.keymap.set("n", "e", "NvimTreeToggle", { desc = "Toggle [E]xplorer" }) 5 | 6 | local icons = require("config.icons") 7 | 8 | require("nvim-tree").setup({ 9 | hijack_netrw = true, 10 | auto_reload_on_write = true, 11 | sync_root_with_cwd = true, 12 | view = { 13 | relativenumber = true, 14 | }, 15 | renderer = { 16 | add_trailing = false, 17 | group_empty = false, 18 | highlight_git = false, 19 | full_name = false, 20 | highlight_opened_files = "none", 21 | root_folder_label = ":t", 22 | indent_width = 2, 23 | indent_markers = { 24 | enable = false, 25 | inline_arrows = true, 26 | icons = { 27 | corner = "└", 28 | edge = "│", 29 | item = "│", 30 | none = " ", 31 | }, 32 | }, 33 | icons = { 34 | git_placement = "before", 35 | padding = " ", 36 | symlink_arrow = " ➛ ", 37 | glyphs = { 38 | default = icons.ui.Text, 39 | symlink = icons.ui.FileSymlink, 40 | bookmark = icons.ui.BookMark, 41 | folder = { 42 | arrow_closed = icons.ui.ChevronRight, 43 | arrow_open = icons.ui.ChevronShortDown, 44 | default = icons.ui.Folder, 45 | open = icons.ui.FolderOpen, 46 | empty = icons.ui.EmptyFolder, 47 | empty_open = icons.ui.EmptyFolderOpen, 48 | symlink = icons.ui.FolderSymlink, 49 | symlink_open = icons.ui.FolderOpen, 50 | }, 51 | git = { 52 | unstaged = icons.git.FileUnstaged, 53 | staged = icons.git.FileStaged, 54 | unmerged = icons.git.FileUnmerged, 55 | renamed = icons.git.FileRenamed, 56 | untracked = icons.git.FileUntracked, 57 | deleted = icons.git.FileDeleted, 58 | ignored = icons.git.FileIgnored, 59 | }, 60 | }, 61 | }, 62 | special_files = { "Cargo.toml", "Makefile", "README.md", "readme.md" }, 63 | symlink_destination = true, 64 | }, 65 | update_focused_file = { 66 | enable = true, 67 | debounce_delay = 15, 68 | update_root = true, 69 | ignore_list = {}, 70 | }, 71 | 72 | diagnostics = { 73 | enable = true, 74 | show_on_dirs = false, 75 | show_on_open_dirs = true, 76 | debounce_delay = 50, 77 | severity = { 78 | min = vim.diagnostic.severity.HINT, 79 | max = vim.diagnostic.severity.ERROR, 80 | }, 81 | icons = { 82 | hint = icons.diagnostics.BoldHint, 83 | info = icons.diagnostics.BoldInformation, 84 | warning = icons.diagnostics.BoldWarning, 85 | error = icons.diagnostics.BoldError, 86 | }, 87 | }, 88 | }) 89 | end, 90 | } 91 | -------------------------------------------------------------------------------- /lua/plugins/git.lua: -------------------------------------------------------------------------------- 1 | return { 2 | { 3 | "lewis6991/gitsigns.nvim", 4 | config = function() 5 | local icons = require("config.icons") 6 | 7 | -- setup gitsigns 8 | require("gitsigns").setup({ 9 | signs = { 10 | add = { 11 | hl = "GitSignsAdd", 12 | text = icons.ui.BoldLineMiddle, 13 | numhl = "GitSignsAddNr", 14 | linehl = "GitSignsAddLn", 15 | }, 16 | change = { 17 | hl = "GitSignsChange", 18 | text = icons.ui.BoldLineDashedMiddle, 19 | numhl = "GitSignsChangeNr", 20 | linehl = "GitSignsChangeLn", 21 | }, 22 | delete = { 23 | hl = "GitSignsDelete", 24 | text = icons.ui.TriangleShortArrowRight, 25 | numhl = "GitSignsDeleteNr", 26 | linehl = "GitSignsDeleteLn", 27 | }, 28 | topdelete = { 29 | hl = "GitSignsDelete", 30 | text = icons.ui.TriangleShortArrowRight, 31 | numhl = "GitSignsDeleteNr", 32 | linehl = "GitSignsDeleteLn", 33 | }, 34 | changedelete = { 35 | hl = "GitSignsChange", 36 | text = icons.ui.BoldLineMiddle, 37 | numhl = "GitSignsChangeNr", 38 | linehl = "GitSignsChangeLn", 39 | }, 40 | }, 41 | watch_gitdir = { 42 | interval = 1000, 43 | follow_files = true, 44 | }, 45 | attach_to_untracked = true, 46 | current_line_blame_formatter = ", - ", 47 | update_debounce = 200, 48 | max_file_length = 40000, 49 | preview_config = { 50 | border = "rounded", 51 | style = "minimal", 52 | relative = "cursor", 53 | row = 0, 54 | col = 1, 55 | }, 56 | }) 57 | 58 | -- Set a vim motion to + g + h to preview changes to the file under the cursor in normal mode 59 | vim.keymap.set("n", "gh", ":Gitsigns preview_hunk", { desc = "[G]it Preview [H]unk" }) 60 | end, 61 | }, 62 | { 63 | "tpope/vim-fugitive", 64 | config = function() 65 | -- Set a vim motion to + g + b to view the most recent contributers to the file 66 | vim.keymap.set("n", "gb", ":Git blame", { desc = "[G]it [B]lame" }) 67 | -- Set a vim motion to + g + A to all files changed to the staging area 68 | vim.keymap.set("n", "gA", ":Git add .", { desc = "[G]it Add [A]ll" }) 69 | -- Set a vim motion to + g + a to add the current file and changes to the staging area 70 | vim.keymap.set("n", "ga", "Git add", { desc = "[G]it [A]dd" }) 71 | -- Set a vim motion to + g + c to commit the current chages 72 | vim.keymap.set("n", "gc", ":Git commit", { desc = "[G]it [C]ommit" }) 73 | -- Set a vim motion to + g + p to push the commited changes to the remote repository 74 | vim.keymap.set("n", "gp", "Git push", { desc = "[G]it [P]ush" }) 75 | end, 76 | }, 77 | } 78 | -------------------------------------------------------------------------------- /lua/plugins/lualine.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "nvim-lualine/lualine.nvim", 3 | dependencies = { 4 | "nvim-tree/nvim-web-devicons", 5 | }, 6 | config = function() 7 | -- call the setup function with properties to define how our lualine will look 8 | require("lualine").setup({ 9 | options = { 10 | -- Use web devicons if you have a nerdfont installed 11 | icons_enabled = true, 12 | -- Set the theme to dracula, lualine documentation has other themes available as well 13 | theme = "dracula", 14 | -- Separate components of lua line with chevrons 15 | component_separators = { left = "", right = "" }, 16 | -- Separate sections with solid triangles 17 | section_separators = { left = "", right = "" }, 18 | -- disable the status line and winbar 19 | disabled_filetypes = { 20 | statusline = {}, 21 | winbar = {}, 22 | }, 23 | -- Don't focus lualine on NvimTree 24 | ignore_focus = { "NvimTree" }, 25 | -- Always divide lualine in the middle 26 | always_divide_middle = true, 27 | -- Disable global status 28 | globalstatus = false, 29 | -- Refresh every 1000 miliseconds 30 | refresh = { 31 | statusline = 1000, 32 | tabline = 1000, 33 | winbar = 1000, 34 | }, 35 | }, 36 | -- Setup what each lualine section will contain 37 | -- sections start at a on the left and go to z on the right 38 | sections = { 39 | -- display the current mode in section a 40 | lualine_a = { "mode" }, 41 | -- display the current git branch, git differences, and any code diagnostics in section b 42 | lualine_b = { "branch", "diff", "diagnostics" }, 43 | -- display the filename in section c 44 | lualine_c = { "filename" }, 45 | -- display the file encoding type, os, and filetype in section x 46 | lualine_x = { "encoding", "fileformat", "filetype" }, 47 | -- display where you are at in the file in section y 48 | lualine_y = { "progress" }, 49 | -- display exact location of the cursor in section z 50 | lualine_z = { "location" }, 51 | }, 52 | -- Setup what each section will contain in inactive buffers 53 | inactive_sections = { 54 | -- display nothing in sections a and b 55 | lualine_a = {}, 56 | lualine_b = {}, 57 | -- display the file name in section c 58 | lualine_c = { "filename" }, 59 | -- display the exact location of the cursor in section x 60 | lualine_x = { "location" }, 61 | -- display nothing in sections y and z 62 | lualine_y = {}, 63 | lualine_z = {}, 64 | }, 65 | -- Use default values for tabline, winbar, inactive winbar and extensions 66 | tabline = {}, 67 | winbar = {}, 68 | inactive_winbar = {}, 69 | extensions = { "quickfix", "man", "fugitive" }, 70 | }) 71 | end, 72 | } 73 | -------------------------------------------------------------------------------- /lua/plugins/cmp.lua: -------------------------------------------------------------------------------- 1 | return { 2 | { 3 | "L3MON4D3/LuaSnip", 4 | dependencies = { 5 | -- feed luasnip suggestions to cmp 6 | "saadparwaiz1/cmp_luasnip", 7 | -- provide vscode like snippets to cmp 8 | "rafamadriz/friendly-snippets", 9 | } 10 | }, 11 | -- cmp-nvim-lsp provides language specific completion suggestions to nvim-cmp 12 | { 13 | "hrsh7th/cmp-nvim-lsp", 14 | }, 15 | -- nvim-cmp provides auto completion and auto completion dropdown ui 16 | { 17 | "hrsh7th/nvim-cmp", 18 | event = "InsertEnter", 19 | dependencies = { 20 | -- buffer based completion options 21 | "hrsh7th/cmp-buffer", 22 | -- path based completion options 23 | "hrsh7th/cmp-path", 24 | }, 25 | config = function() 26 | -- Gain access to the functions of the cmp plugin 27 | local cmp = require("cmp") 28 | -- Gain access to the function of the luasnip plugin 29 | local luasnip = require("luasnip") 30 | 31 | -- Lazily load the vscode like snippets 32 | require("luasnip.loaders.from_vscode").lazy_load() 33 | 34 | -- All the cmp setup function to configure our completion experience 35 | cmp.setup({ 36 | -- How should completion options be displayed to us? 37 | completion = { 38 | -- menu: display options in a menu 39 | -- menuone: automatically select the first option of the menu 40 | -- preview: automatically display the completion candiate as you navigate the menu 41 | -- noselect: prevent neovim from automatically selecting a completion option while navigating the menu 42 | competeopt = "menu,menuone,preview,noselect" 43 | }, 44 | -- setup snippet support based on the active lsp and the current text of the file 45 | snippet = { 46 | expand = function(args) 47 | luasnip.lsp_expand(args.body) 48 | end 49 | }, 50 | -- setup how we interact with completion menus and options 51 | mapping = cmp.mapping.preset.insert({ 52 | -- previous suggestion 53 | [""] = cmp.mapping.select_prev_item(), 54 | -- next suggestion 55 | [""] = cmp.mapping.select_next_item(), 56 | [""] = cmp.mapping.scroll_docs(-4), 57 | [""] = cmp.mapping.scroll_docs(4), 58 | -- show completion suggestions 59 | [""] = cmp.mapping.abort(), 62 | -- confirm completion, only when you explicitly selected an option 63 | [""] = cmp.mapping.confirm({ select = false}) 64 | }), 65 | -- Where and how should cmp rank and find completions 66 | -- Order matters, cmp will provide lsp suggestions above all else 67 | sources = cmp.config.sources({ 68 | { name = 'nvim_lsp' }, 69 | { name = 'luasnip' }, 70 | { name = 'buffer' }, 71 | { name = 'path' } 72 | }) 73 | }) 74 | end 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /lazy-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" }, 3 | "LuaSnip": { "branch": "master", "commit": "b152822e1a4bafb6bdf11a16cc26525cbd95ee00" }, 4 | "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, 5 | "cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" }, 6 | "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, 7 | "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, 8 | "dracula.nvim": { "branch": "main", "commit": "8d8bddb8814c3e7e62d80dda65a9876f97eb699c" }, 9 | "friendly-snippets": { "branch": "main", "commit": "d5f74ce4dfdd82848f3f4eac65fe6e29ac5df4c2" }, 10 | "gitsigns.nvim": { "branch": "main", "commit": "790355f00af1fc2c330ea1b2b7f68d65f19b57c9" }, 11 | "harpoon": { "branch": "master", "commit": "ccae1b9bec717ae284906b0bf83d720e59d12b91" }, 12 | "lazy.nvim": { "branch": "main", "commit": "758bb5de98b805acc5eeed8cdc8ac7f0bc4b0b86" }, 13 | "lsp_signature.nvim": { "branch": "master", "commit": "aed5d1162b0f07bb3af34bedcc5f70a2b6466ed8" }, 14 | "lualine.nvim": { "branch": "master", "commit": "0a5a66803c7407767b799067986b4dc3036e1983" }, 15 | "mason-lspconfig.nvim": { "branch": "main", "commit": "273fdde8ac5e51f3a223ba70980e52bbc09d9f6f" }, 16 | "mason-nvim-dap.nvim": { "branch": "main", "commit": "67210c0e775adec55de9826b038e8b62de554afc" }, 17 | "mason.nvim": { "branch": "main", "commit": "751b1fcbf3d3b783fcf8d48865264a9bcd8f9b10" }, 18 | "none-ls-extras.nvim": { "branch": "main", "commit": "c7264e9b97a051ccb955ae178b6fb3e0e9936a45" }, 19 | "none-ls.nvim": { "branch": "main", "commit": "f5632db2491fbe02b54f1a321a98548a8ba2bd15" }, 20 | "nvim-autopairs": { "branch": "master", "commit": "4f41e5940bc0443fdbe5f995e2a596847215cd2a" }, 21 | "nvim-cmp": { "branch": "main", "commit": "8f3c541407e691af6163e2447f3af1bd6e17f9a3" }, 22 | "nvim-dap": { "branch": "master", "commit": "6ae8a14828b0f3bff1721a35a1dfd604b6a933bb" }, 23 | "nvim-dap-ui": { "branch": "master", "commit": "5934302d63d1ede12c0b22b6f23518bb183fc972" }, 24 | "nvim-jdtls": { "branch": "master", "commit": "8eb5f0dbe6e126b392ddcaf45893358619893e45" }, 25 | "nvim-lspconfig": { "branch": "master", "commit": "aa5f4f4ee10b2688fb37fa46215672441d5cd5d9" }, 26 | "nvim-nio": { "branch": "master", "commit": "79e8968769d4422c08d514a413815bea6c1f67f9" }, 27 | "nvim-tree.lua": { "branch": "master", "commit": "347e1eb35264677f66a79466bb5e3d111968e12c" }, 28 | "nvim-treesitter": { "branch": "master", "commit": "160e5d52c841dc9261c0b2dc6f253bddbcf3d766" }, 29 | "nvim-ts-autotag": { "branch": "main", "commit": "531f48334c422222aebc888fd36e7d109cb354cd" }, 30 | "nvim-ts-context-commentstring": { "branch": "main", "commit": "a6382f744f584bbf71d0a563af789af7190aabda" }, 31 | "nvim-web-devicons": { "branch": "master", "commit": "794bba734ec95eaff9bb82fbd112473be2087283" }, 32 | "plenary.nvim": { "branch": "master", "commit": "08e301982b9a057110ede7a735dd1b5285eb341f" }, 33 | "springboot-nvim": { "branch": "main", "commit": "c7a2491d5036e5bb7133185b3db98517c572eef0" }, 34 | "telescope-fzf-native.nvim": { "branch": "main", "commit": "9ef21b2e6bb6ebeaf349a0781745549bbb870d27" }, 35 | "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, 36 | "telescope.nvim": { "branch": "master", "commit": "6312868392331c9c0f22725041f1ec2bef57c751" }, 37 | "vim-fugitive": { "branch": "master", "commit": "dac8e5c2d85926df92672bf2afb4fc48656d96c7" }, 38 | "vim-tmux-navigator": { "branch": "master", "commit": "a26954a585b02a2ac02f87145e204f8798a7cbc2" }, 39 | "which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" } 40 | } -------------------------------------------------------------------------------- /lua/config/icons.lua: -------------------------------------------------------------------------------- 1 | return { 2 | kind = { 3 | Array = " ", 4 | Boolean = " ", 5 | Class = " ", 6 | Color = " ", 7 | Constant = " ", 8 | Constructor = " ", 9 | Enum = " ", 10 | EnumMember = " ", 11 | Event = " ", 12 | Field = " ", 13 | File = " ", 14 | Folder = "󰉋 ", 15 | Function = " ", 16 | Interface = " ", 17 | Key = " ", 18 | Keyword = " ", 19 | Method = " ", 20 | -- Module = " ", 21 | Module = " ", 22 | Namespace = " ", 23 | Null = "󰟢 ", 24 | Number = " ", 25 | Object = " ", 26 | Operator = " ", 27 | Package = " ", 28 | Property = " ", 29 | Reference = " ", 30 | Snippet = " ", 31 | String = " ", 32 | Struct = " ", 33 | Text = " ", 34 | TypeParameter = " ", 35 | Unit = " ", 36 | Value = " ", 37 | Variable = " ", 38 | }, 39 | git = { 40 | LineAdded = " ", 41 | LineModified = " ", 42 | LineRemoved = " ", 43 | FileDeleted = " ", 44 | FileIgnored = "◌", 45 | FileRenamed = " ", 46 | FileStaged = "S", 47 | FileUnmerged = "", 48 | FileUnstaged = "", 49 | FileUntracked = "U", 50 | Diff = " ", 51 | Repo = " ", 52 | Octoface = " ", 53 | Copilot = " ", 54 | Branch = "", 55 | }, 56 | ui = { 57 | ArrowCircleDown = "", 58 | ArrowCircleLeft = "", 59 | ArrowCircleRight = "", 60 | ArrowCircleUp = "", 61 | BoldArrowDown = "", 62 | BoldArrowLeft = "", 63 | BoldArrowRight = "", 64 | BoldArrowUp = "", 65 | BoldClose = "", 66 | BoldDividerLeft = "", 67 | BoldDividerRight = "", 68 | BoldLineLeft = "▎", 69 | BoldLineMiddle = "┃", 70 | BoldLineDashedMiddle = "┋", 71 | BookMark = "", 72 | BoxChecked = " ", 73 | Bug = " ", 74 | Stacks = "", 75 | Scopes = "", 76 | Watches = "󰂥", 77 | DebugConsole = " ", 78 | Calendar = " ", 79 | Check = "", 80 | ChevronRight = "", 81 | ChevronShortDown = "", 82 | ChevronShortLeft = "", 83 | ChevronShortRight = "", 84 | ChevronShortUp = "", 85 | Circle = " ", 86 | Close = "󰅖", 87 | CloudDownload = " ", 88 | Code = "", 89 | Comment = "", 90 | Dashboard = "", 91 | DividerLeft = "", 92 | DividerRight = "", 93 | DoubleChevronRight = "»", 94 | Ellipsis = "", 95 | EmptyFolder = " ", 96 | EmptyFolderOpen = " ", 97 | File = " ", 98 | FileSymlink = "", 99 | Files = " ", 100 | FindFile = "󰈞", 101 | FindText = "󰊄", 102 | Fire = "", 103 | Folder = "󰉋 ", 104 | FolderOpen = " ", 105 | FolderSymlink = " ", 106 | Forward = " ", 107 | Gear = " ", 108 | History = " ", 109 | Lightbulb = " ", 110 | LineLeft = "▏", 111 | LineMiddle = "│", 112 | List = " ", 113 | Lock = " ", 114 | NewFile = " ", 115 | Note = " ", 116 | Package = " ", 117 | Pencil = "󰏫 ", 118 | Plus = " ", 119 | Project = " ", 120 | Search = " ", 121 | SignIn = " ", 122 | SignOut = " ", 123 | Tab = "󰌒 ", 124 | Table = " ", 125 | Target = "󰀘 ", 126 | Telescope = " ", 127 | Text = " ", 128 | Tree = "", 129 | Triangle = "󰐊", 130 | TriangleShortArrowDown = "", 131 | TriangleShortArrowLeft = "", 132 | TriangleShortArrowRight = "", 133 | TriangleShortArrowUp = "", 134 | }, 135 | diagnostics = { 136 | BoldError = "", 137 | Error = "", 138 | BoldWarning = "", 139 | Warning = "", 140 | BoldInformation = "", 141 | Information = "", 142 | BoldQuestion = "", 143 | Question = "", 144 | BoldHint = "", 145 | Hint = "󰌶", 146 | Debug = "", 147 | Trace = "✎", 148 | }, 149 | misc = { 150 | Robot = "󰚩 ", 151 | Squirrel = " ", 152 | Tag = " ", 153 | Watch = "", 154 | Smiley = " ", 155 | Package = " ", 156 | CircuitBoard = " ", 157 | }, 158 | } 159 | -------------------------------------------------------------------------------- /lua/plugins/lsp-config.lua: -------------------------------------------------------------------------------- 1 | return { 2 | { 3 | "williamboman/mason.nvim", 4 | config = function() 5 | -- setup mason with default properties 6 | require("mason").setup({ 7 | ui = { 8 | border = "rounded" 9 | } 10 | }) 11 | end, 12 | }, 13 | -- mason lsp config utilizes mason to automatically ensure lsp servers you want installed are installed 14 | { 15 | "williamboman/mason-lspconfig.nvim", 16 | config = function() 17 | -- ensure that we have lua language server, typescript launguage server, java language server, and java test language server are installed 18 | require("mason-lspconfig").setup({ 19 | ensure_installed = { "lua_ls", "tsserver", "jdtls", "cssls" }, 20 | }) 21 | end, 22 | }, 23 | -- mason nvim dap utilizes mason to automatically ensure debug adapters you want installed are installed, mason-lspconfig will not automatically install debug adapters for us 24 | { 25 | "jay-babu/mason-nvim-dap.nvim", 26 | config = function() 27 | -- ensure the java debug adapter is installed 28 | require("mason-nvim-dap").setup({ 29 | ensure_installed = { "java-debug-adapter", "java-test" }, 30 | }) 31 | end, 32 | }, 33 | -- utility plugin for configuring the java language server for us 34 | { 35 | "mfussenegger/nvim-jdtls", 36 | dependencies = { 37 | "mfussenegger/nvim-dap", 38 | "ray-x/lsp_signature.nvim" 39 | }, 40 | }, 41 | { 42 | "ray-x/lsp_signature.nvim", 43 | config = function() 44 | require "lsp_signature".setup() 45 | end 46 | }, 47 | { 48 | "neovim/nvim-lspconfig", 49 | config = function() 50 | local icons = require("config.icons") 51 | 52 | -- get access to the lspconfig plugins functions 53 | local lspconfig = require("lspconfig") 54 | 55 | local capabilities = require("cmp_nvim_lsp").default_capabilities() 56 | 57 | -- setup the lua language server 58 | lspconfig.lua_ls.setup({ 59 | capabilities = capabilities, 60 | }) 61 | 62 | -- setup the typescript language server 63 | lspconfig.tsserver.setup({ 64 | capabilities = capabilities, 65 | }) 66 | 67 | lspconfig.cssls.setup({ 68 | capabilities = capabilities 69 | }) 70 | 71 | local default_diagnostic_config = { 72 | signs = { 73 | active = true, 74 | values = { 75 | { name = "DiagnosticSignError", text = icons.diagnostics.Error }, 76 | { name = "DiagnosticSignWarn", text = icons.diagnostics.Warning }, 77 | { name = "DiagnosticSignHint", text = icons.diagnostics.Hint }, 78 | { name = "DiagnosticSignInfo", text = icons.diagnostics.Information }, 79 | }, 80 | }, 81 | virtual_text = false, 82 | update_in_insert = false, 83 | underline = true, 84 | severity_sort = true, 85 | float = { 86 | focusable = true, 87 | style = "minimal", 88 | border = "rounded", 89 | source = "always", 90 | header = "", 91 | prefix = "", 92 | }, 93 | } 94 | 95 | vim.diagnostic.config(default_diagnostic_config) 96 | 97 | for _, sign in ipairs(vim.tbl_get(vim.diagnostic.config(), "signs", "values") or {}) do 98 | vim.fn.sign_define(sign.name, { texthl = sign.name, text = sign.text, numhl = sign.name }) 99 | end 100 | 101 | -- Set vim motion for + c + h to show code documentation about the code the cursor is currently over if available 102 | vim.keymap.set("n", "ch", vim.lsp.buf.hover, { desc = "[C]ode [H]over Documentation" }) 103 | -- Set vim motion for + c + d to go where the code/variable under the cursor was defined 104 | vim.keymap.set("n", "cd", vim.lsp.buf.definition, { desc = "[C]ode Goto [D]efinition" }) 105 | -- Set vim motion for + c + a for display code action suggestions for code diagnostics in both normal and visual mode 106 | vim.keymap.set({ "n", "v" }, "ca", vim.lsp.buf.code_action, { desc = "[C]ode [A]ctions" }) 107 | -- Set vim motion for + c + r to display references to the code under the cursor 108 | vim.keymap.set( 109 | "n", 110 | "cr", 111 | require("telescope.builtin").lsp_references, 112 | { desc = "[C]ode Goto [R]eferences" } 113 | ) 114 | -- Set vim motion for + c + i to display implementations to the code under the cursor 115 | vim.keymap.set( 116 | "n", 117 | "ci", 118 | require("telescope.builtin").lsp_implementations, 119 | { desc = "[C]ode Goto [I]mplementations" } 120 | ) 121 | -- Set a vim motion for + c + R to smartly rename the code under the cursor 122 | vim.keymap.set("n", "cR", vim.lsp.buf.rename, { desc = "[C]ode [R]ename" }) 123 | -- Set a vim motion for + c + D to go to where the code/object was declared in the project (class file) 124 | vim.keymap.set("n", "cD", vim.lsp.buf.declaration, { desc = "[C]ode Goto [D]eclaration" }) 125 | end, 126 | }, 127 | } 128 | -------------------------------------------------------------------------------- /lua/plugins/telescope.lua: -------------------------------------------------------------------------------- 1 | return { 2 | { 3 | 'nvim-telescope/telescope.nvim', 4 | -- pull a specific version of the plugin 5 | tag = '0.1.6', 6 | dependencies = { 7 | { 8 | -- general purpose plugin used to build user interfaces in neovim plugins 9 | 'nvim-lua/plenary.nvim' 10 | }, 11 | { 12 | { "nvim-telescope/telescope-fzf-native.nvim", build = "make", lazy = true }, 13 | }, 14 | }, 15 | config = function() 16 | -- get access to telescopes built in functions 17 | local builtin = require('telescope.builtin') 18 | 19 | -- set a vim motion to + f + f to search for files by their names 20 | vim.keymap.set('n', 'ff', builtin.find_files, { desc = "[F]ind [F]iles" }) 21 | -- set a vim motion to + f + g to search for files based on the text inside of them 22 | vim.keymap.set('n', 'fg', builtin.live_grep, { desc = "[F]ind by [G]rep" }) 23 | -- set a vim motion to + f + d to search for Code Diagnostics in the current project 24 | vim.keymap.set('n', 'fd', builtin.diagnostics, { desc = '[F]ind [D]iagnostics' }) 25 | -- set a vim motion to + f + r to resume the previous search 26 | vim.keymap.set('n', 'fr', builtin.resume, { desc = '[F]inder [R]esume' }) 27 | -- set a vim motion to + f + . to search for Recent Files 28 | vim.keymap.set('n', 'f.', builtin.oldfiles, { desc = '[F]ind Recent Files ("." for repeat)' }) 29 | -- set a vim motion to + f + b to search Open Buffers 30 | vim.keymap.set('n', 'fb', builtin.buffers, { desc = '[F]ind Existing [B]uffers' }) 31 | end 32 | }, 33 | { 34 | 'nvim-telescope/telescope-ui-select.nvim', 35 | config = function() 36 | -- get access to telescopes navigation functions 37 | local actions = require("telescope.actions") 38 | local icons = require("config.icons") 39 | 40 | require("telescope").setup({ 41 | -- use ui-select dropdown as our ui 42 | extensions = { 43 | ["ui-select"] = { 44 | require("telescope.themes").get_dropdown {} 45 | }, 46 | fzf = { 47 | fuzzy = true, -- false will only do exact matching 48 | override_generic_sorter = true, -- override the generic sorter 49 | override_file_sorter = true, -- override the file sorter 50 | case_mode = "smart_case", -- or "ignore_case" or "respect_case" 51 | }, 52 | }, 53 | defaults = { 54 | prompt_prefix = icons.ui.Telescope .. " ", 55 | selection_caret = icons.ui.Forward .. " ", 56 | entry_prefix = " ", 57 | initial_mode = "insert", 58 | selection_strategy = "reset", 59 | path_display = { "smart" }, 60 | color_devicons = true, 61 | vimgrep_arguments = { 62 | "rg", 63 | "--color=never", 64 | "--no-heading", 65 | "--with-filename", 66 | "--line-number", 67 | "--column", 68 | "--smart-case", 69 | "--hidden", 70 | "--glob=!.git/", 71 | }, 72 | }, 73 | -- set keymappings to navigate through items in the telescope io 74 | mappings = { 75 | i = { 76 | [""] = actions.cycle_history_next, 77 | [""] = actions.cycle_history_prev, 78 | 79 | [""] = actions.move_selection_next, 80 | [""] = actions.move_selection_previous, 81 | }, 82 | n = { 83 | [""] = actions.close, 84 | ["j"] = actions.move_selection_next, 85 | ["k"] = actions.move_selection_previous, 86 | ["q"] = actions.close, 87 | }, 88 | }, 89 | pickers = { 90 | live_grep = { 91 | theme = "dropdown", 92 | }, 93 | 94 | grep_string = { 95 | theme = "dropdown", 96 | }, 97 | 98 | find_files = { 99 | theme = "dropdown", 100 | previewer = false, 101 | }, 102 | 103 | buffers = { 104 | theme = "dropdown", 105 | previewer = false, 106 | initial_mode = "normal", 107 | mappings = { 108 | i = { 109 | [""] = actions.delete_buffer, 110 | }, 111 | n = { 112 | ["dd"] = actions.delete_buffer, 113 | }, 114 | }, 115 | }, 116 | 117 | planets = { 118 | show_pluto = true, 119 | show_moon = true, 120 | }, 121 | 122 | colorscheme = { 123 | enable_preview = true, 124 | }, 125 | 126 | lsp_references = { 127 | theme = "dropdown", 128 | initial_mode = "normal", 129 | }, 130 | 131 | lsp_definitions = { 132 | theme = "dropdown", 133 | initial_mode = "normal", 134 | }, 135 | 136 | lsp_declarations = { 137 | theme = "dropdown", 138 | initial_mode = "normal", 139 | }, 140 | 141 | lsp_implementations = { 142 | theme = "dropdown", 143 | initial_mode = "normal", 144 | }, 145 | }, 146 | }) 147 | -- load the ui-select extension 148 | require("telescope").load_extension("ui-select") 149 | end 150 | } 151 | } 152 | -------------------------------------------------------------------------------- /lua/config/jdtls.lua: -------------------------------------------------------------------------------- 1 | local function get_jdtls() 2 | -- Get the Mason Registry to gain access to downloaded binaries 3 | local mason_registry = require("mason-registry") 4 | -- Find the JDTLS package in the Mason Regsitry 5 | local jdtls = mason_registry.get_package("jdtls") 6 | -- Find the full path to the directory where Mason has downloaded the JDTLS binaries 7 | local jdtls_path = jdtls:get_install_path() 8 | -- Obtain the path to the jar which runs the language server 9 | local launcher = vim.fn.glob(jdtls_path .. "/plugins/org.eclipse.equinox.launcher_*.jar") 10 | -- Declare white operating system we are using, windows use win, macos use mac 11 | local SYSTEM = "linux" 12 | -- Obtain the path to configuration files for your specific operating system 13 | local config = jdtls_path .. "/config_" .. SYSTEM 14 | -- Obtain the path to the Lomboc jar 15 | local lombok = jdtls_path .. "/lombok.jar" 16 | return launcher, config, lombok 17 | end 18 | 19 | local function get_bundles() 20 | -- Get the Mason Registry to gain access to downloaded binaries 21 | local mason_registry = require("mason-registry") 22 | -- Find the Java Debug Adapter package in the Mason Registry 23 | local java_debug = mason_registry.get_package("java-debug-adapter") 24 | -- Obtain the full path to the directory where Mason has downloaded the Java Debug Adapter binaries 25 | local java_debug_path = java_debug:get_install_path() 26 | 27 | local bundles = { 28 | vim.fn.glob(java_debug_path .. "/extension/server/com.microsoft.java.debug.plugin-*.jar", 1) 29 | } 30 | 31 | -- Find the Java Test package in the Mason Registry 32 | local java_test = mason_registry.get_package("java-test") 33 | -- Obtain the full path to the directory where Mason has downloaded the Java Test binaries 34 | local java_test_path = java_test:get_install_path() 35 | -- Add all of the Jars for running tests in debug mode to the bundles list 36 | vim.list_extend(bundles, vim.split(vim.fn.glob(java_test_path .. "/extension/server/*.jar", 1), "\n")) 37 | 38 | return bundles 39 | end 40 | 41 | local function get_workspace() 42 | -- Get the home directory of your operating system 43 | local home = os.getenv "HOME" 44 | -- Declare a directory where you would like to store project information 45 | local workspace_path = home .. "/code/workspace/" 46 | -- Determine the project name 47 | local project_name = vim.fn.fnamemodify(vim.fn.getcwd(), ":p:h:t") 48 | -- Create the workspace directory by concatenating the designated workspace path and the project name 49 | local workspace_dir = workspace_path .. project_name 50 | return workspace_dir 51 | end 52 | 53 | local function java_keymaps() 54 | -- Allow yourself to run JdtCompile as a Vim command 55 | vim.cmd( 56 | "command! -buffer -nargs=? -complete=custom,v:lua.require'jdtls'._complete_compile JdtCompile lua require('jdtls').compile()") 57 | -- Allow yourself/register to run JdtUpdateConfig as a Vim command 58 | vim.cmd("command! -buffer JdtUpdateConfig lua require('jdtls').update_project_config()") 59 | -- Allow yourself/register to run JdtBytecode as a Vim command 60 | vim.cmd("command! -buffer JdtBytecode lua require('jdtls').javap()") 61 | -- Allow yourself/register to run JdtShell as a Vim command 62 | vim.cmd("command! -buffer JdtJshell lua require('jdtls').jshell()") 63 | 64 | -- Set a Vim motion to + J + o to organize imports in normal mode 65 | vim.keymap.set('n', 'Jo', " lua require('jdtls').organize_imports()", 66 | { desc = "[J]ava [O]rganize Imports" }) 67 | -- Set a Vim motion to + J + v to extract the code under the cursor to a variable 68 | vim.keymap.set('n', 'Jv', " lua require('jdtls').extract_variable()", 69 | { desc = "[J]ava Extract [V]ariable" }) 70 | -- Set a Vim motion to + J + v to extract the code selected in visual mode to a variable 71 | vim.keymap.set('v', 'Jv', " lua require('jdtls').extract_variable(true)", 72 | { desc = "[J]ava Extract [V]ariable" }) 73 | -- Set a Vim motion to + J + C to extract the code under the cursor to a static variable 74 | vim.keymap.set('n', 'JC', " lua require('jdtls').extract_constant()", 75 | { desc = "[J]ava Extract [C]onstant" }) 76 | -- Set a Vim motion to + J + C to extract the code selected in visual mode to a static variable 77 | vim.keymap.set('v', 'JC', " lua require('jdtls').extract_constant(true)", 78 | { desc = "[J]ava Extract [C]onstant" }) 79 | -- Set a Vim motion to + J + t to run the test method currently under the cursor 80 | vim.keymap.set('n', 'Jt', " lua require('jdtls').test_nearest_method()", 81 | { desc = "[J]ava [T]est Method" }) 82 | -- Set a Vim motion to + J + t to run the test method that is currently selected in visual mode 83 | vim.keymap.set('v', 'Jt', " lua require('jdtls').test_nearest_method(true)", 84 | { desc = "[J]ava [T]est Method" }) 85 | -- Set a Vim motion to + J + T to run an entire test suite (class) 86 | vim.keymap.set('n', 'JT', " lua require('jdtls').test_class()", { desc = "[J]ava [T]est Class" }) 87 | -- Set a Vim motion to + J + u to update the project configuration 88 | vim.keymap.set('n', 'Ju', " JdtUpdateConfig", { desc = "[J]ava [U]pdate Config" }) 89 | end 90 | 91 | local function setup_jdtls() 92 | -- Get access to the jdtls plugin and all of its functionality 93 | local jdtls = require "jdtls" 94 | 95 | -- Get the paths to the jdtls jar, operating specific configuration directory, and lombok jar 96 | local launcher, os_config, lombok = get_jdtls() 97 | 98 | -- Get the path you specified to hold project information 99 | local workspace_dir = get_workspace() 100 | 101 | -- Get the bundles list with the jars to the debug adapter, and testing adapters 102 | local bundles = get_bundles() 103 | 104 | -- Determine the root directory of the project by looking for these specific markers 105 | local root_dir = jdtls.setup.find_root({ '.git', 'mvnw', 'gradlew', 'pom.xml', 'build.gradle' }); 106 | 107 | -- Tell our JDTLS language features it is capable of 108 | local capabilities = { 109 | workspace = { 110 | configuration = true 111 | }, 112 | textDocument = { 113 | completion = { 114 | snippetSupport = false 115 | } 116 | } 117 | } 118 | 119 | local lsp_capabilities = require("cmp_nvim_lsp").default_capabilities() 120 | 121 | for k, v in pairs(lsp_capabilities) do capabilities[k] = v end 122 | 123 | -- Get the default extended client capablities of the JDTLS language server 124 | local extendedClientCapabilities = jdtls.extendedClientCapabilities 125 | -- Modify one property called resolveAdditionalTextEditsSupport and set it to true 126 | extendedClientCapabilities.resolveAdditionalTextEditsSupport = true 127 | 128 | -- Set the command that starts the JDTLS language server jar 129 | local cmd = { 130 | 'java', 131 | '-Declipse.application=org.eclipse.jdt.ls.core.id1', 132 | '-Dosgi.bundles.defaultStartLevel=4', 133 | '-Declipse.product=org.eclipse.jdt.ls.core.product', 134 | '-Dlog.protocol=true', 135 | '-Dlog.level=ALL', 136 | '-Xmx1g', 137 | '--add-modules=ALL-SYSTEM', 138 | '--add-opens', 'java.base/java.util=ALL-UNNAMED', 139 | '--add-opens', 'java.base/java.lang=ALL-UNNAMED', 140 | '-javaagent:' .. lombok, 141 | '-jar', 142 | launcher, 143 | '-configuration', 144 | os_config, 145 | '-data', 146 | workspace_dir 147 | } 148 | 149 | -- Configure settings in the JDTLS server 150 | local settings = { 151 | java = { 152 | -- Enable code formatting 153 | format = { 154 | enabled = true, 155 | -- Use the Google Style guide for code formattingh 156 | settings = { 157 | url = vim.fn.stdpath("config") .. "/lang_servers/intellij-java-google-style.xml", 158 | profile = "GoogleStyle" 159 | } 160 | }, 161 | -- Enable downloading archives from eclipse automatically 162 | eclipse = { 163 | downloadSource = true 164 | }, 165 | -- Enable downloading archives from maven automatically 166 | maven = { 167 | downloadSources = true 168 | }, 169 | -- Enable method signature help 170 | signatureHelp = { 171 | enabled = true 172 | }, 173 | -- Use the fernflower decompiler when using the javap command to decompile byte code back to java code 174 | contentProvider = { 175 | preferred = "fernflower" 176 | }, 177 | -- Setup automatical package import oranization on file save 178 | saveActions = { 179 | organizeImports = true 180 | }, 181 | -- Customize completion options 182 | completion = { 183 | -- When using an unimported static method, how should the LSP rank possible places to import the static method from 184 | favoriteStaticMembers = { 185 | "org.hamcrest.MatcherAssert.assertThat", 186 | "org.hamcrest.Matchers.*", 187 | "org.hamcrest.CoreMatchers.*", 188 | "org.junit.jupiter.api.Assertions.*", 189 | "java.util.Objects.requireNonNull", 190 | "java.util.Objects.requireNonNullElse", 191 | "org.mockito.Mockito.*", 192 | }, 193 | -- Try not to suggest imports from these packages in the code action window 194 | filteredTypes = { 195 | "com.sun.*", 196 | "io.micrometer.shaded.*", 197 | "java.awt.*", 198 | "jdk.*", 199 | "sun.*", 200 | }, 201 | -- Set the order in which the language server should organize imports 202 | importOrder = { 203 | "java", 204 | "jakarta", 205 | "javax", 206 | "com", 207 | "org", 208 | } 209 | }, 210 | sources = { 211 | -- How many classes from a specific package should be imported before automatic imports combine them all into a single import 212 | organizeImports = { 213 | starThreshold = 9999, 214 | staticThreshold = 9999 215 | } 216 | }, 217 | -- How should different pieces of code be generated? 218 | codeGeneration = { 219 | -- When generating toString use a json format 220 | toString = { 221 | template = "${object.className}{${member.name()}=${member.value}, ${otherMembers}}" 222 | }, 223 | -- When generating hashCode and equals methods use the java 7 objects method 224 | hashCodeEquals = { 225 | useJava7Objects = true 226 | }, 227 | -- When generating code use code blocks 228 | useBlocks = true 229 | }, 230 | -- If changes to the project will require the developer to update the projects configuration advise the developer before accepting the change 231 | configuration = { 232 | updateBuildConfiguration = "interactive" 233 | }, 234 | -- enable code lens in the lsp 235 | referencesCodeLens = { 236 | enabled = true 237 | }, 238 | -- enable inlay hints for parameter names, 239 | inlayHints = { 240 | parameterNames = { 241 | enabled = "all" 242 | } 243 | } 244 | } 245 | } 246 | 247 | -- Create a table called init_options to pass the bundles with debug and testing jar, along with the extended client capablies to the start or attach function of JDTLS 248 | local init_options = { 249 | bundles = bundles, 250 | extendedClientCapabilities = extendedClientCapabilities 251 | } 252 | 253 | -- Function that will be ran once the language server is attached 254 | local on_attach = function(_, bufnr) 255 | -- Map the Java specific key mappings once the server is attached 256 | java_keymaps() 257 | 258 | -- Setup the java debug adapter of the JDTLS server 259 | require('jdtls.dap').setup_dap() 260 | 261 | -- Find the main method(s) of the application so the debug adapter can successfully start up the application 262 | -- Sometimes this will randomly fail if language server takes to long to startup for the project, if a ClassDefNotFoundException occurs when running 263 | -- the debug tool, attempt to run the debug tool while in the main class of the application, or restart the neovim instance 264 | -- Unfortunately I have not found an elegant way to ensure this works 100% 265 | require('jdtls.dap').setup_dap_main_class_configs() 266 | -- Enable jdtls commands to be used in Neovim 267 | require 'jdtls.setup'.add_commands() 268 | -- Refresh the codelens 269 | -- Code lens enables features such as code reference counts, implemenation counts, and more. 270 | vim.lsp.codelens.refresh() 271 | 272 | require("lsp_signature").on_attach({ 273 | bind = true, 274 | padding = "", 275 | handler_opts = { 276 | border = "rounded", 277 | }, 278 | hint_prefix = "󱄑 ", 279 | }, bufnr) 280 | 281 | -- Setup a function that automatically runs every time a java file is saved to refresh the code lens 282 | vim.api.nvim_create_autocmd("BufWritePost", { 283 | pattern = { "*.java" }, 284 | callback = function() 285 | local _, _ = pcall(vim.lsp.codelens.refresh) 286 | end 287 | }) 288 | end 289 | 290 | -- Create the configuration table for the start or attach function 291 | local config = { 292 | cmd = cmd, 293 | root_dir = root_dir, 294 | settings = settings, 295 | capabilities = capabilities, 296 | init_options = init_options, 297 | on_attach = on_attach 298 | } 299 | 300 | -- Start the JDTLS server 301 | require('jdtls').start_or_attach(config) 302 | end 303 | 304 | return { 305 | setup_jdtls = setup_jdtls, 306 | } 307 | --------------------------------------------------------------------------------