From dab19ab080b0b92db7a27067a3b97ff8f674ccf4 Mon Sep 17 00:00:00 2001 From: Josh Hamill Date: Tue, 5 Mar 2024 15:41:53 -0500 Subject: [PATCH] feat: personal versions --- ftplugin/java.lua | 34 +++++++++++++ init.lua | 123 +++++++++++++++++++++++++++++++++++++--------- 2 files changed, 134 insertions(+), 23 deletions(-) create mode 100644 ftplugin/java.lua diff --git a/ftplugin/java.lua b/ftplugin/java.lua new file mode 100644 index 00000000..a6911449 --- /dev/null +++ b/ftplugin/java.lua @@ -0,0 +1,34 @@ +local root_markers = { 'gradlew', 'pom.xml' } +local root_dir = require('jdtls.setup').find_root(root_markers) +local home = os.getenv 'HOME' + +local workspace_folder = home .. '/.workspace' .. vim.fn.fnamemodify(root_dir, ':p:h:t') +local config = {} + +config.cmd = { + '/Users/joshua/.jabba/jdk/amazon-corretto@1.17.0-0.35.1/Contents/Home/bin/java', + '-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=1044', + '-javaagent:/Users/joshua/.config/jdtls/jars/lombok.jar', + + '-Declipse.application=org.eclipse.jdt.ls.core.id1', + '-Dosgi.bundles.defaultStartLevel=4', + '-Declipse.product=org.eclipse.jdt.ls.core.product', + '-Dlog.protocol=true', + '-Dlog.level=ALL', + '-Xmx1g', + '--add-modules=ALL-SYSTEM', + '--add-opens', + 'java.base/java.util=ALL-UNNAMED', + '--add-opens', + 'java.base/java.lang=ALL-UNNAMED', + '-jar', + '/Users/joshua/.config/jdtls/plugins/org.eclipse.equinox.launcher_1.6.400.v20210924-0641.jar', + '-configuration', + '/Users/joshua/.config/jdtls/config_mac', + + '-data', + workspace_folder, +} + +-- Server +require('jdtls').start_or_attach(config) diff --git a/init.lua b/init.lua index 3bdb5e36..9c8a78cb 100644 --- a/init.lua +++ b/init.lua @@ -99,7 +99,7 @@ vim.g.have_nerd_font = false -- For more options, you can see `:help option-list` -- Make line numbers default -vim.opt.number = true +-- vim.opt.number = true -- You can also add relative line numbers, for help with jumping. -- Experiment for yourself to see if you like it! -- vim.opt.relativenumber = true @@ -134,7 +134,7 @@ vim.opt.timeoutlen = 300 -- Configure how new splits should be opened vim.opt.splitright = true -vim.opt.splitbelow = true +vim.opt.splitbelow = false -- Sets how neovim will display certain whitespace in the editor. -- See `:help 'list'` @@ -151,11 +151,18 @@ vim.opt.cursorline = true -- Minimal number of screen lines to keep above and below the cursor. vim.opt.scrolloff = 10 +vim.opt.tabstop = 4 +vim.opt.softtabstop = 4 +vim.opt.shiftwidth = 4 +vim.opt.smarttab = true +vim.opt.expandtab = true + -- [[ Basic Keymaps ]] -- See `:help vim.keymap.set()` -- Set highlight on search, but clear on pressing in normal mode vim.opt.hlsearch = true +vim.keymap.set('i', '', '') vim.keymap.set('n', '', 'nohlsearch') -- Diagnostic keymaps @@ -192,7 +199,7 @@ vim.keymap.set('n', '', '', { desc = 'Move focus to the upper win -- Highlight when yanking (copying) text -- Try it with `yap` in normal mode --- See `:help vim.highlight.on_yank()` +-- See `:help vim.highlight. vim.api.nvim_create_autocmd('TextYankPost', { desc = 'Highlight when yanking (copying) text', group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }), @@ -373,6 +380,7 @@ require('lazy').setup({ vim.keymap.set('n', 'sr', builtin.resume, { desc = '[S]earch [R]esume' }) vim.keymap.set('n', 's.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' }) vim.keymap.set('n', '', builtin.buffers, { desc = '[ ] Find existing buffers' }) + vim.keymap.set('n', '', builtin.git_files, { desc = '[ ] Find Git Files' }) -- Slightly advanced example of overriding default behavior and theme vim.keymap.set('n', '/', function() @@ -532,18 +540,11 @@ require('lazy').setup({ -- - settings (table): Override the default settings passed when initializing the server. -- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/ local servers = { - -- clangd = {}, - -- gopls = {}, - -- pyright = {}, - -- rust_analyzer = {}, - -- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs - -- - -- Some languages (like typescript) have entire language plugins that can be useful: - -- https://github.com/pmizio/typescript-tools.nvim - -- - -- But for many setups, the LSP (`tsserver`) will work just fine - -- tsserver = {}, - -- + clangd = {}, + gopls = {}, + rust_analyzer = {}, + jdtls = {}, + tsserver = {}, lua_ls = { -- cmd = {...}, @@ -619,7 +620,9 @@ require('lazy').setup({ -- -- You can use a sub-list to tell conform to run *until* a formatter -- is found. - -- javascript = { { "prettierd", "prettier" } }, + javascript = { 'prettier' }, + typescript = { 'prettier' }, + go = { 'gofmt', 'goimports', 'golines', 'gofumpt' }, }, }, }, @@ -674,6 +677,8 @@ require('lazy').setup({ -- -- No, but seriously. Please read `:help ins-completion`, it is really good! mapping = cmp.mapping.preset.insert { + [''] = nil, + [''] = nil, -- Select the [n]ext item [''] = cmp.mapping.select_next_item(), -- Select the [p]revious item @@ -722,15 +727,13 @@ require('lazy').setup({ -- change the command in the config to whatever the name of that colorscheme is -- -- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme` - 'folke/tokyonight.nvim', + 'catppuccin/nvim', + name = 'catppuccin', lazy = false, -- make sure we load this during startup if it is your main colorscheme priority = 1000, -- make sure to load this before all the other start plugins config = function() - -- Load the colorscheme here. - -- Like many other themes, this one has different styles, and you could load - -- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'. - vim.cmd.colorscheme 'tokyonight-night' - + -- Load the colorscheme here + vim.cmd.colorscheme 'catppuccin-mocha' -- You can configure highlights by doing something like vim.cmd.hi 'Comment gui=none' end, @@ -783,7 +786,6 @@ require('lazy').setup({ config = function() -- [[ Configure Treesitter ]] See `:help nvim-treesitter` - ---@diagnostic disable-next-line: missing-fields require('nvim-treesitter.configs').setup { ensure_installed = { 'bash', 'c', 'html', 'lua', 'markdown', 'vim', 'vimdoc' }, -- Autoinstall languages that are not installed @@ -800,6 +802,81 @@ require('lazy').setup({ -- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects end, }, + { + 'tpope/vim-fugitive', + config = function() + vim.keymap.set('n', 'gs', vim.cmd.Git) + end, + }, + { + 'theprimeagen/harpoon', + config = function() + local mark = require 'harpoon.mark' + local ui = require 'harpoon.ui' + + vim.keymap.set('n', 'a', mark.add_file) + vim.keymap.set('n', '', ui.toggle_quick_menu) + + vim.keymap.set('n', 'j', function() + ui.nav_file(1) + end) + vim.keymap.set('n', 'k', function() + ui.nav_file(2) + end) + vim.keymap.set('n', 'l', function() + ui.nav_file(3) + end) + vim.keymap.set('n', ';', function() + ui.nav_file(4) + end) + end, + }, + { + 'mbbill/undotree', + config = function() + vim.keymap.set('n', 'u', vim.cmd.UndotreeToggle) + end, + }, + + { 'lewis6991/gitsigns.nvim' }, + { + 'nvim-tree/nvim-tree.lua', + config = function() + vim.g.loaded_netrw = 1 + vim.g.loaded_netrwPlugin = 1 + + require('nvim-tree').setup { + view = { + adaptive_size = true, + }, + filters = { + dotfiles = true, + }, + } + + vim.keymap.set('n', '', ':NvimTreeFindFileToggle') + end, + }, + { 'nvim-tree/nvim-web-devicons' }, + { 'simrat39/symbols-outline.nvim' }, + { 'github/copilot.vim' }, + { + 'alexghergh/nvim-tmux-navigation', + config = function() + require('nvim-tmux-navigation').setup { + disable_when_zoomed = true, -- defaults to false + keybindings = { + left = '', + down = '', + up = '', + right = '', + last_active = '', + next = '', + }, + } + end, + }, + { 'mfussenegger/nvim-jdtls' }, -- The following two comments only work if you have downloaded the kickstart repo, not just copy pasted the -- init.lua. If you want these files, they are in the repository, so you can just download them and