From fc4c1c2612ddcc724d891a0c515423ab0cd0725d Mon Sep 17 00:00:00 2001 From: Oluwatobi Date: Fri, 6 Oct 2023 20:38:37 +0100 Subject: [PATCH 01/40] comfortable, but python not formatting --- after/plugin/cmp.lua | 47 +++ after/plugin/lazygit-config.lua | 2 + after/plugin/lsp-config.lua | 64 ++++ after/plugin/mason.lua | 1 + after/plugin/telescope.lua | 42 +++ after/plugin/treesitter-config.lua | 43 +++ after/plugin/undotree.lua | 1 + after/plugin/which-key.lua | 11 + init.lua | 555 +---------------------------- lazy-lock.json | 38 ++ lua/custom/plugins/init.lua | 5 - lua/plugins/alpha.lua | 7 + lua/plugins/autopairs.lua | 15 + lua/plugins/comments.lua | 18 + lua/plugins/gitsigns.lua | 31 ++ lua/plugins/init.lua | 90 +++++ lua/plugins/lazygit.lua | 9 + lua/plugins/lsp.lua | 25 ++ lua/plugins/neo-tree.lua | 122 +++++++ lua/plugins/treesitter.lua | 36 ++ lua/thrillee/editor-configs.lua | 69 ++++ lua/thrillee/init.lua | 3 + lua/thrillee/remaps.lua | 33 ++ lua/thrillee/splits.lua | 35 ++ 24 files changed, 754 insertions(+), 548 deletions(-) create mode 100644 after/plugin/cmp.lua create mode 100644 after/plugin/lazygit-config.lua create mode 100644 after/plugin/lsp-config.lua create mode 100644 after/plugin/mason.lua create mode 100644 after/plugin/telescope.lua create mode 100644 after/plugin/treesitter-config.lua create mode 100644 after/plugin/undotree.lua create mode 100644 after/plugin/which-key.lua create mode 100644 lazy-lock.json delete mode 100644 lua/custom/plugins/init.lua create mode 100644 lua/plugins/alpha.lua create mode 100644 lua/plugins/autopairs.lua create mode 100644 lua/plugins/comments.lua create mode 100644 lua/plugins/gitsigns.lua create mode 100644 lua/plugins/init.lua create mode 100644 lua/plugins/lazygit.lua create mode 100644 lua/plugins/lsp.lua create mode 100644 lua/plugins/neo-tree.lua create mode 100644 lua/plugins/treesitter.lua create mode 100644 lua/thrillee/editor-configs.lua create mode 100644 lua/thrillee/init.lua create mode 100644 lua/thrillee/remaps.lua create mode 100644 lua/thrillee/splits.lua diff --git a/after/plugin/cmp.lua b/after/plugin/cmp.lua new file mode 100644 index 00000000000..d3a415d970b --- /dev/null +++ b/after/plugin/cmp.lua @@ -0,0 +1,47 @@ +-- [[ Configure nvim-cmp ]] +-- See `:help cmp` +local cmp = require 'cmp' +local luasnip = require 'luasnip' +require('luasnip.loaders.from_vscode').lazy_load() +luasnip.config.setup {} + +cmp.setup { + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + mapping = cmp.mapping.preset.insert { + [''] = cmp.mapping.select_next_item(), + [''] = cmp.mapping.select_prev_item(), + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete {}, + [''] = cmp.mapping.confirm { + behavior = cmp.ConfirmBehavior.Replace, + select = true, + }, + [''] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expand_or_locally_jumpable() then + luasnip.expand_or_jump() + else + fallback() + end + end, { 'i', 's' }), + [''] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.locally_jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { 'i', 's' }), + }, + sources = { + { name = 'nvim_lsp' }, + { name = 'luasnip' }, + }, +} diff --git a/after/plugin/lazygit-config.lua b/after/plugin/lazygit-config.lua new file mode 100644 index 00000000000..23e77ab147a --- /dev/null +++ b/after/plugin/lazygit-config.lua @@ -0,0 +1,2 @@ +--[[ LazyGit Configurations ]] +vim.keymap.set("n", "gg", ":LazyGit", { silent = true, desc = 'Launch Lazygit' }) diff --git a/after/plugin/lsp-config.lua b/after/plugin/lsp-config.lua new file mode 100644 index 00000000000..5f485bbc1bb --- /dev/null +++ b/after/plugin/lsp-config.lua @@ -0,0 +1,64 @@ +-- [[ Configure LSP ]] +local lsp = require("lsp-zero") + +lsp.preset("recommended") + +lsp.ensure_installed({ + 'gopls', + 'pyright', + 'tsserver', + 'rust_analyzer', +}) + +-- Fix Undefined global 'vim' +lsp.nvim_workspace() + + +local cmp = require('cmp') +local cmp_select = { behavior = cmp.SelectBehavior.Select } +local cmp_mappings = lsp.defaults.cmp_mappings({ + [''] = cmp.mapping.select_prev_item(cmp_select), + [''] = cmp.mapping.select_next_item(cmp_select), + [''] = cmp.mapping.confirm({ select = true }), + [""] = cmp.mapping.complete(), +}) + +cmp_mappings[''] = nil +cmp_mappings[''] = nil + +lsp.setup_nvim_cmp({ + mapping = cmp_mappings +}) + +lsp.set_preferences({ + suggest_lsp_servers = false, + sign_icons = { + error = '⛔️', + warn = '⚠️', + hint = '🧐', + info = 'I' + } +}) + +lsp.on_attach(function(_, bufnr) + local opts = { buffer = bufnr, remap = false } + + vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts) + vim.keymap.set("n", "gD", function() vim.lsp.buf.declaration() end, opts) + vim.keymap.set("n", "K", function() vim.lsp.buf.hover() end, opts) + vim.keymap.set("n", "vws", function() vim.lsp.buf.workspace_symbol() end, opts) + vim.keymap.set("n", "vd", function() vim.diagnostic.open_float() end, opts) + vim.keymap.set("n", "[d", function() vim.diagnostic.goto_next() end, opts) + vim.keymap.set("n", "]d", function() vim.diagnostic.goto_prev() end, opts) + vim.keymap.set("n", "ca", function() vim.lsp.buf.code_action() end, opts) + vim.keymap.set("n", "gr", require('telescope.builtin').lsp_references, opts) + vim.keymap.set("n", "rn", function() vim.lsp.buf.rename() end, opts) + vim.keymap.set("i", "", function() vim.lsp.buf.signature_help() end, opts) + vim.keymap.set("n", "lf", vim.lsp.buf.format, { desc = 'Format Buffer' }) +end) + +lsp.setup() + +vim.diagnostic.config({ + virtual_text = true +}) diff --git a/after/plugin/mason.lua b/after/plugin/mason.lua new file mode 100644 index 00000000000..e6117d29d70 --- /dev/null +++ b/after/plugin/mason.lua @@ -0,0 +1 @@ +require('mason').setup({}) diff --git a/after/plugin/telescope.lua b/after/plugin/telescope.lua new file mode 100644 index 00000000000..7aeecde659f --- /dev/null +++ b/after/plugin/telescope.lua @@ -0,0 +1,42 @@ +-- [[ Configure Treesitter ]] +require('telescope').setup { + defaults = { + mappings = { + i = { + [''] = false, + [''] = false, + }, + }, + }, +} + +-- Enable telescope fzf native, if installed +pcall(require('telescope').load_extension, 'fzf') + +-- See `:help telescope.builtin` +vim.keymap.set('n', '?', require('telescope.builtin').oldfiles, { desc = '[?] Find recently opened files' }) +vim.keymap.set('n', 'fb', require('telescope.builtin').buffers, { desc = '[ ] Find existing buffers' }) +vim.keymap.set('n', '/', function() + -- You can pass additional configuration to telescope to change theme, layout, etc. + require('telescope.builtin').current_buffer_fuzzy_find(require('telescope.themes').get_dropdown { + winblend = 10, + previewer = false, + }) +end, { desc = '[/] Fuzzily search in current buffer' }) + +vim.keymap.set('n', 'ff', require('telescope.builtin').find_files, { desc = 'Find [F]iles' }) +vim.keymap.set('n', 'fh', require('telescope.builtin').help_tags, { desc = 'Find [H]elp' }) +vim.keymap.set('n', 'fw', require('telescope.builtin').grep_string, { desc = 'Find current [W]ord' }) +vim.keymap.set('n', 'fd', require('telescope.builtin').diagnostics, { desc = 'Find [D]iagnostics' }) +vim.keymap.set('n', 'fr', require('telescope.builtin').registers, { desc = 'Find [R]egister' }) +vim.keymap.set('n', 'fF', + function() require("telescope.builtin").find_files { hidden = true, no_ignore = true } end, + { desc = '[S]earch [R]esume' }) + +vim.keymap.set('n', 'fg', require('telescope.builtin').live_grep, { desc = 'Find by [G]rep' }) +vim.keymap.set('n', 'fG', function() + require("telescope.builtin").live_grep { + additional_args = function(args) return vim.list_extend(args, { "--hidden", "--no-ignore" }) end, + } +end, { desc = 'Find by [G]rep In all Files' }) + diff --git a/after/plugin/treesitter-config.lua b/after/plugin/treesitter-config.lua new file mode 100644 index 00000000000..ee753c3ddf6 --- /dev/null +++ b/after/plugin/treesitter-config.lua @@ -0,0 +1,43 @@ +-- See `:help nvim-treesitter` +-- Defer Treesitter setup after first render to improve startup time of 'nvim {filename}' +--[[ vim.defer_fn(function() + require('nvim-treesitter.configs').setup { + ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'javascript', 'typescript', 'vimdoc', + 'vim' }, + auto_install = true, + highlight = { enable = true }, + indent = { enable = true }, + incremental_selection = { enable = true }, + textobjects = { + select = { enable = true, lookahead = true }, + move = { enable = true, set_jumps = true }, + swap = { enable = true }, + }, + opts = { + context_commentstring = { enable = true, enable_autocmd = false }, + }, + } +end, 0) ]] + +require'nvim-treesitter.configs'.setup { + -- A list of parser names, or "all" + ensure_installed = { "vimdoc", "javascript", "typescript", "c", "lua", "rust", "go", "python", "tsx", "vim" }, + + -- Install parsers synchronously (only applied to `ensure_installed`) + sync_install = false, + + -- Automatically install missing parsers when entering buffer + -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally + auto_install = true, + + highlight = { + -- `false` will disable the whole extension + enable = true, + + -- Setting this to true will run `:h syntax` and tree-sitter at the same time. + -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). + -- Using this option may slow down your editor, and you may see some duplicate highlights. + -- Instead of true it can also be a list of languages + additional_vim_regex_highlighting = false, + }, +} diff --git a/after/plugin/undotree.lua b/after/plugin/undotree.lua new file mode 100644 index 00000000000..b6b9276a542 --- /dev/null +++ b/after/plugin/undotree.lua @@ -0,0 +1 @@ +vim.keymap.set("n", "u", vim.cmd.UndotreeToggle) diff --git a/after/plugin/which-key.lua b/after/plugin/which-key.lua new file mode 100644 index 00000000000..98c0dab62bd --- /dev/null +++ b/after/plugin/which-key.lua @@ -0,0 +1,11 @@ +-- document existing key chains +require('which-key').register({ + --[[ ['c'] = { name = '[C]ode', _ = 'which_key_ignore' }, + ['d'] = { name = '[D]ocument', _ = 'which_key_ignore' }, + ['g'] = { name = '[G]it', _ = 'which_key_ignore' }, + ['h'] = { name = 'More git', _ = 'which_key_ignore' }, + ['r'] = { name = '[R]ename', _ = 'which_key_ignore' }, + ['s'] = { name = '[S]earch', _ = 'which_key_ignore' }, ]] + ['w'] = { name = '[W]orkspace', _ = 'which_key_ignore' }, +}) + diff --git a/init.lua b/init.lua index e5bc576e457..09ee298780d 100644 --- a/init.lua +++ b/init.lua @@ -1,551 +1,20 @@ ---[[ - -===================================================================== -==================== READ THIS BEFORE CONTINUING ==================== -===================================================================== - -Kickstart.nvim is *not* a distribution. - -Kickstart.nvim is a template for your own configuration. - The goal is that you can read every line of code, top-to-bottom, understand - what your configuration is doing, and modify it to suit your needs. - - Once you've done that, you should start exploring, configuring and tinkering to - explore Neovim! - - If you don't know anything about Lua, I recommend taking some time to read through - a guide. One possible example: - - https://learnxinyminutes.com/docs/lua/ - - - And then you can explore or search through `:help lua-guide` - - https://neovim.io/doc/user/lua-guide.html - - -Kickstart Guide: - -I have left several `:help X` comments throughout the init.lua -You should run that command and read that help section for more information. - -In addition, I have some `NOTE:` items throughout the file. -These are for you, the reader to help understand what is happening. Feel free to delete -them once you know what you're doing, but they should serve as a guide for when you -are first encountering a few different constructs in your nvim config. - -I hope you enjoy your Neovim journey, -- TJ - -P.S. You can delete this when you're done too. It's your config now :) ---]] --- Set as the leader key --- See `:help mapleader` --- NOTE: Must happen before plugins are required (otherwise wrong leader will be used) vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' --- Install package manager --- https://github.com/folke/lazy.nvim --- `:help lazy.nvim.txt` for more info local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim' if not vim.loop.fs_stat(lazypath) then - vim.fn.system { - 'git', - 'clone', - '--filter=blob:none', - 'https://github.com/folke/lazy.nvim.git', - '--branch=stable', -- latest stable release - lazypath, - } + vim.fn.system { + 'git', + 'clone', + '--filter=blob:none', + 'https://github.com/folke/lazy.nvim.git', + '--branch=stable', -- latest stable release + lazypath, + } end vim.opt.rtp:prepend(lazypath) --- NOTE: Here is where you install your plugins. --- You can configure plugins using the `config` key. --- --- You can also configure plugins after the setup call, --- as they will be available in your neovim runtime. -require('lazy').setup({ - -- NOTE: First, some plugins that don't require any configuration - - -- Git related plugins - 'tpope/vim-fugitive', - 'tpope/vim-rhubarb', - - -- Detect tabstop and shiftwidth automatically - 'tpope/vim-sleuth', - - -- NOTE: This is where your plugins related to LSP can be installed. - -- The configuration is done below. Search for lspconfig to find it below. - { - -- LSP Configuration & Plugins - 'neovim/nvim-lspconfig', - dependencies = { - -- Automatically install LSPs to stdpath for neovim - { 'williamboman/mason.nvim', config = true }, - 'williamboman/mason-lspconfig.nvim', - - -- Useful status updates for LSP - -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})` - { 'j-hui/fidget.nvim', tag = 'legacy', opts = {} }, - - -- Additional lua configuration, makes nvim stuff amazing! - 'folke/neodev.nvim', - }, - }, - - { - -- Autocompletion - 'hrsh7th/nvim-cmp', - dependencies = { - -- Snippet Engine & its associated nvim-cmp source - 'L3MON4D3/LuaSnip', - 'saadparwaiz1/cmp_luasnip', - - -- Adds LSP completion capabilities - 'hrsh7th/cmp-nvim-lsp', - - -- Adds a number of user-friendly snippets - 'rafamadriz/friendly-snippets', - }, - }, - - -- Useful plugin to show you pending keybinds. - { 'folke/which-key.nvim', opts = {} }, - { - -- Adds git related signs to the gutter, as well as utilities for managing changes - 'lewis6991/gitsigns.nvim', - opts = { - -- See `:help gitsigns.txt` - signs = { - add = { text = '+' }, - change = { text = '~' }, - delete = { text = '_' }, - topdelete = { text = '‾' }, - changedelete = { text = '~' }, - }, - on_attach = function(bufnr) - vim.keymap.set('n', 'hp', require('gitsigns').preview_hunk, { buffer = bufnr, desc = 'Preview git hunk' }) - - -- don't override the built-in and fugitive keymaps - local gs = package.loaded.gitsigns - 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() - 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, - }, - }, - - { - -- Theme inspired by Atom - 'navarasu/onedark.nvim', - priority = 1000, - config = function() - vim.cmd.colorscheme 'onedark' - end, - }, - - { - -- Set lualine as statusline - 'nvim-lualine/lualine.nvim', - -- See `:help lualine.txt` - opts = { - options = { - icons_enabled = false, - theme = 'onedark', - component_separators = '|', - section_separators = '', - }, - }, - }, - - { - -- Add indentation guides even on blank lines - 'lukas-reineke/indent-blankline.nvim', - -- Enable `lukas-reineke/indent-blankline.nvim` - -- See `:help indent_blankline.txt` - main = "ibl", - opts = {}, - }, - - -- "gc" to comment visual regions/lines - { 'numToStr/Comment.nvim', opts = {} }, - - -- Fuzzy Finder (files, lsp, etc) - { - 'nvim-telescope/telescope.nvim', - branch = '0.1.x', - dependencies = { - 'nvim-lua/plenary.nvim', - -- Fuzzy Finder Algorithm which requires local dependencies to be built. - -- Only load if `make` is available. Make sure you have the system - -- requirements installed. - { - 'nvim-telescope/telescope-fzf-native.nvim', - -- NOTE: If you are having trouble with this installation, - -- refer to the README for telescope-fzf-native for more instructions. - build = 'make', - cond = function() - return vim.fn.executable 'make' == 1 - end, - }, - }, - }, - - { - -- Highlight, edit, and navigate code - 'nvim-treesitter/nvim-treesitter', - dependencies = { - 'nvim-treesitter/nvim-treesitter-textobjects', - }, - build = ':TSUpdate', - }, - - -- 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', - - -- 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 - -- up-to-date with whatever is in the kickstart repo. - -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. - -- - -- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins - -- { import = 'custom.plugins' }, -}, {}) - --- [[ Setting options ]] --- See `:help vim.o` --- NOTE: You can change these options as you wish! - --- Set highlight on search -vim.o.hlsearch = false - --- Make line numbers default -vim.wo.number = true - --- Enable mouse mode -vim.o.mouse = 'a' - --- Sync clipboard between OS and Neovim. --- Remove this option if you want your OS clipboard to remain independent. --- See `:help 'clipboard'` -vim.o.clipboard = 'unnamedplus' - --- Enable break indent -vim.o.breakindent = true - --- Save undo history -vim.o.undofile = true - --- Case-insensitive searching UNLESS \C or capital in search -vim.o.ignorecase = true -vim.o.smartcase = true - --- Keep signcolumn on by default -vim.wo.signcolumn = 'yes' - --- Decrease update time -vim.o.updatetime = 250 -vim.o.timeoutlen = 300 - --- Set completeopt to have a better completion experience -vim.o.completeopt = 'menuone,noselect' - --- NOTE: You should make sure your terminal supports this -vim.o.termguicolors = true - --- [[ Basic Keymaps ]] - --- Keymaps for better default experience --- See `:help vim.keymap.set()` -vim.keymap.set({ 'n', 'v' }, '', '', { 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', { - callback = function() - vim.highlight.on_yank() - end, - group = highlight_group, - pattern = '*', -}) - --- [[ Configure Telescope ]] --- See `:help telescope` and `:help telescope.setup()` -require('telescope').setup { - defaults = { - mappings = { - i = { - [''] = false, - [''] = false, - }, - }, - }, -} - --- Enable telescope fzf native, if installed -pcall(require('telescope').load_extension, 'fzf') - --- See `:help telescope.builtin` -vim.keymap.set('n', '?', require('telescope.builtin').oldfiles, { desc = '[?] Find recently opened files' }) -vim.keymap.set('n', '', require('telescope.builtin').buffers, { desc = '[ ] Find existing buffers' }) -vim.keymap.set('n', '/', function() - -- You can pass additional configuration to telescope to change theme, layout, etc. - require('telescope.builtin').current_buffer_fuzzy_find(require('telescope.themes').get_dropdown { - winblend = 10, - previewer = false, - }) -end, { desc = '[/] Fuzzily search in current buffer' }) - -vim.keymap.set('n', 'gf', require('telescope.builtin').git_files, { desc = 'Search [G]it [F]iles' }) -vim.keymap.set('n', 'sf', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' }) -vim.keymap.set('n', 'sh', require('telescope.builtin').help_tags, { desc = '[S]earch [H]elp' }) -vim.keymap.set('n', 'sw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' }) -vim.keymap.set('n', 'sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' }) -vim.keymap.set('n', 'sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' }) -vim.keymap.set('n', 'sr', require('telescope.builtin').resume, { desc = '[S]earch [R]esume' }) - --- [[ Configure Treesitter ]] --- See `:help nvim-treesitter` --- Defer Treesitter setup after first render to improve startup time of 'nvim {filename}' -vim.defer_fn(function() - require('nvim-treesitter.configs').setup { - -- Add languages to be installed here that you want installed for treesitter - ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'javascript', 'typescript', 'vimdoc', 'vim' }, - - -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!) - auto_install = false, - - highlight = { enable = true }, - indent = { enable = true }, - incremental_selection = { - enable = true, - keymaps = { - init_selection = '', - node_incremental = '', - scope_incremental = '', - node_decremental = '', - }, - }, - textobjects = { - select = { - enable = true, - lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim - keymaps = { - -- You can use the capture groups defined in textobjects.scm - ['aa'] = '@parameter.outer', - ['ia'] = '@parameter.inner', - ['af'] = '@function.outer', - ['if'] = '@function.inner', - ['ac'] = '@class.outer', - ['ic'] = '@class.inner', - }, - }, - move = { - enable = true, - set_jumps = true, -- whether to set jumps in the jumplist - goto_next_start = { - [']m'] = '@function.outer', - [']]'] = '@class.outer', - }, - goto_next_end = { - [']M'] = '@function.outer', - [']['] = '@class.outer', - }, - goto_previous_start = { - ['[m'] = '@function.outer', - ['[['] = '@class.outer', - }, - goto_previous_end = { - ['[M'] = '@function.outer', - ['[]'] = '@class.outer', - }, - }, - swap = { - enable = true, - swap_next = { - ['a'] = '@parameter.inner', - }, - swap_previous = { - ['A'] = '@parameter.inner', - }, - }, - }, - } -end, 0) - --- Diagnostic keymaps -vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous diagnostic message' }) -vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnostic message' }) -vim.keymap.set('n', 'e', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' }) -vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' }) - --- [[ Configure LSP ]] --- This function gets run when an LSP connects to a particular buffer. -local on_attach = function(_, bufnr) - -- NOTE: Remember that lua is a real programming language, and as such it is possible - -- to define small helper and utility functions so you don't have to repeat yourself - -- many times. - -- - -- In this case, we create a function that lets us more easily define mappings specific - -- for LSP related items. It sets the mode, buffer and description for us each time. - local nmap = function(keys, func, desc) - if desc then - desc = 'LSP: ' .. desc - end - - vim.keymap.set('n', keys, func, { buffer = bufnr, desc = desc }) - end - - nmap('rn', vim.lsp.buf.rename, '[R]e[n]ame') - nmap('ca', vim.lsp.buf.code_action, '[C]ode [A]ction') - - nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition') - nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') - nmap('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation') - nmap('D', vim.lsp.buf.type_definition, 'Type [D]efinition') - nmap('ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols') - nmap('ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols') - - -- See `:help K` for why this keymap - nmap('K', vim.lsp.buf.hover, 'Hover Documentation') - nmap('', vim.lsp.buf.signature_help, 'Signature Documentation') - - -- Lesser used LSP functionality - nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') - nmap('wa', vim.lsp.buf.add_workspace_folder, '[W]orkspace [A]dd Folder') - nmap('wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder') - nmap('wl', function() - print(vim.inspect(vim.lsp.buf.list_workspace_folders())) - end, '[W]orkspace [L]ist Folders') - - -- Create a command `:Format` local to the LSP buffer - vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_) - vim.lsp.buf.format() - end, { desc = 'Format current buffer with LSP' }) -end - --- document existing key chains -require('which-key').register({ - ['c'] = { name = '[C]ode', _ = 'which_key_ignore' }, - ['d'] = { name = '[D]ocument', _ = 'which_key_ignore' }, - ['g'] = { name = '[G]it', _ = 'which_key_ignore' }, - ['h'] = { name = 'More git', _ = 'which_key_ignore' }, - ['r'] = { name = '[R]ename', _ = 'which_key_ignore' }, - ['s'] = { name = '[S]earch', _ = 'which_key_ignore' }, - ['w'] = { name = '[W]orkspace', _ = 'which_key_ignore' }, -}) - --- Enable the following language servers --- Feel free to add/remove any LSPs that you want here. They will automatically be installed. --- --- Add any additional override configuration in the following tables. They will be passed to --- the `settings` field of the server config. You must look up that documentation yourself. --- --- If you want to override the default filetypes that your language server will attach to you can --- define the property 'filetypes' to the map in question. -local servers = { - -- clangd = {}, - -- gopls = {}, - -- pyright = {}, - -- rust_analyzer = {}, - -- tsserver = {}, - -- html = { filetypes = { 'html', 'twig', 'hbs'} }, - - lua_ls = { - Lua = { - workspace = { checkThirdParty = false }, - telemetry = { enable = false }, - }, - }, -} - --- Setup neovim lua configuration -require('neodev').setup() - --- nvim-cmp supports additional completion capabilities, so broadcast that to servers -local capabilities = vim.lsp.protocol.make_client_capabilities() -capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities) - --- Ensure the servers above are installed -local mason_lspconfig = require 'mason-lspconfig' - -mason_lspconfig.setup { - ensure_installed = vim.tbl_keys(servers), -} - -mason_lspconfig.setup_handlers { - function(server_name) - require('lspconfig')[server_name].setup { - capabilities = capabilities, - on_attach = on_attach, - settings = servers[server_name], - filetypes = (servers[server_name] or {}).filetypes, - } - end -} - --- [[ Configure nvim-cmp ]] --- See `:help cmp` -local cmp = require 'cmp' -local luasnip = require 'luasnip' -require('luasnip.loaders.from_vscode').lazy_load() -luasnip.config.setup {} - -cmp.setup { - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) - end, - }, - mapping = cmp.mapping.preset.insert { - [''] = cmp.mapping.select_next_item(), - [''] = cmp.mapping.select_prev_item(), - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.complete {}, - [''] = cmp.mapping.confirm { - behavior = cmp.ConfirmBehavior.Replace, - select = true, - }, - [''] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif luasnip.expand_or_locally_jumpable() then - luasnip.expand_or_jump() - else - fallback() - end - end, { 'i', 's' }), - [''] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif luasnip.locally_jumpable(-1) then - luasnip.jump(-1) - else - fallback() - end - end, { 'i', 's' }), - }, - sources = { - { name = 'nvim_lsp' }, - { name = 'luasnip' }, - }, -} - --- The line beneath this is called `modeline`. See `:help modeline` --- vim: ts=2 sts=2 sw=2 et +require('lazy').setup('plugins') +require('thrillee') +--[[ require('kickstart.plugins.autoformat') +require('kickstart.plugins.debug') ]] diff --git a/lazy-lock.json b/lazy-lock.json new file mode 100644 index 00000000000..53a3e7aada4 --- /dev/null +++ b/lazy-lock.json @@ -0,0 +1,38 @@ +{ + "Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" }, + "LuaSnip": { "branch": "master", "commit": "2c3a3a3e4fb503bf39efb61290ecfa8aae95f5eb" }, + "alpha-nvim": { "branch": "main", "commit": "234822140b265ec4ba3203e3e0be0e0bb826dff5" }, + "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" }, + "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, + "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, + "cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" }, + "friendly-snippets": { "branch": "main", "commit": "43727c2ff84240e55d4069ec3e6158d74cb534b6" }, + "gitsigns.nvim": { "branch": "main", "commit": "ff01d34daaed72f271a8ffa088a7e839a60c640f" }, + "lazy.nvim": { "branch": "main", "commit": "6b6f0a451200bb6abde85978c577c73ea1577758" }, + "lazygit.nvim": { "branch": "main", "commit": "de35012036d43bca03628d40d083f7c02a4cda3f" }, + "lsp-zero.nvim": { "branch": "v1.x", "commit": "60b0e84f3793f7e8bcc9ec52f9c239fd497b2cd2" }, + "lualine.nvim": { "branch": "master", "commit": "45e27ca739c7be6c49e5496d14fcf45a303c3a63" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "e2705063f395b44f676cd26596a11007a2cbd3bd" }, + "mason.nvim": { "branch": "main", "commit": "d66c60e17dd6fd8165194b1d14d21f7eb2c1697a" }, + "neo-tree.nvim": { "branch": "v3.x", "commit": "71f1841ba6c652908678cece623f52c1fea8a6cd" }, + "nui.nvim": { "branch": "main", "commit": "c8de23342caf8d50b15d6b28368d36a56a69d76f" }, + "nvim-autopairs": { "branch": "master", "commit": "de4f7138a68d5d5063170f2182fd27faf06b0b54" }, + "nvim-cmp": { "branch": "main", "commit": "5dce1b778b85c717f6614e3f4da45e9f19f54435" }, + "nvim-lspconfig": { "branch": "master", "commit": "2b361e043810d5587d9af0787f8ce40da92ec5e9" }, + "nvim-treesitter": { "branch": "master", "commit": "10bfa4826f2235c600c073a82e0d78718aa7240e" }, + "nvim-treesitter-context": { "branch": "master", "commit": "2095f231dfe796d228eedea96fdaa31f2e343fb2" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "4724694bc03ce1148860a46d9d77c3664d8188ab" }, + "nvim-ts-autotag": { "branch": "main", "commit": "6be1192965df35f94b8ea6d323354f7dc7a557e4" }, + "nvim-ts-context-commentstring": { "branch": "main", "commit": "7241635869b7a8115893ffa67bab3907756caf4f" }, + "nvim-web-devicons": { "branch": "master", "commit": "45d0237c427baba8cd05e0ab26d30e2ee58c2c82" }, + "onedark.nvim": { "branch": "master", "commit": "dac8c39812dae025255c9069a260e1f69d967927" }, + "plenary.nvim": { "branch": "master", "commit": "9ce85b0f7dcfe5358c0be937ad23e456907d410b" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" }, + "telescope.nvim": { "branch": "0.1.x", "commit": "54930e1abfc94409e1bb9266e752ef8379008592" }, + "undotree": { "branch": "master", "commit": "0e11ba7325efbbb3f3bebe06213afa3e7ec75131" }, + "vim-fugitive": { "branch": "master", "commit": "99db68d9b3304580bd383da7aaee05c7a954a344" }, + "vim-rhubarb": { "branch": "master", "commit": "ee69335de176d9325267b0fd2597a22901d927b1" }, + "vim-sleuth": { "branch": "master", "commit": "1cc4557420f215d02c4d2645a748a816c220e99b" }, + "which-key.nvim": { "branch": "main", "commit": "7ccf476ebe0445a741b64e36c78a682c1c6118b7" } +} \ No newline at end of file diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua deleted file mode 100644 index be0eb9d8d7a..00000000000 --- a/lua/custom/plugins/init.lua +++ /dev/null @@ -1,5 +0,0 @@ --- You can add your own plugins here or in other files in this directory! --- I promise not to create any merge conflicts in this directory :) --- --- See the kickstart.nvim README for more information -return {} diff --git a/lua/plugins/alpha.lua b/lua/plugins/alpha.lua new file mode 100644 index 00000000000..a4f3028a3d6 --- /dev/null +++ b/lua/plugins/alpha.lua @@ -0,0 +1,7 @@ +return { + 'goolord/alpha-nvim', + dependencies = { 'nvim-tree/nvim-web-devicons' }, + config = function () + require'alpha'.setup(require'alpha.themes.startify'.config) + end +}; diff --git a/lua/plugins/autopairs.lua b/lua/plugins/autopairs.lua new file mode 100644 index 00000000000..d271227f75e --- /dev/null +++ b/lua/plugins/autopairs.lua @@ -0,0 +1,15 @@ +return { + "windwp/nvim-autopairs", + -- Optional dependency + dependencies = { 'hrsh7th/nvim-cmp' }, + config = function() + require("nvim-autopairs").setup {} + -- If you want to automatically add `(` after selecting a function or method + local cmp_autopairs = require('nvim-autopairs.completion.cmp') + local cmp = require('cmp') + cmp.event:on( + 'confirm_done', + cmp_autopairs.on_confirm_done() + ) + end, +} diff --git a/lua/plugins/comments.lua b/lua/plugins/comments.lua new file mode 100644 index 00000000000..06f1809bd28 --- /dev/null +++ b/lua/plugins/comments.lua @@ -0,0 +1,18 @@ +return { + 'numToStr/Comment.nvim', + opts = { + toggler = { + ---Line-comment toggle keymap + line = '++', + ---Block-comment toggle keymap + block = '++', + }, + opleader = { + ---Line-comment keymap + line = '++', + ---Block-comment keymap + block = '++', + }, + }, + lazy = false, +} diff --git a/lua/plugins/gitsigns.lua b/lua/plugins/gitsigns.lua new file mode 100644 index 00000000000..7af0234d25e --- /dev/null +++ b/lua/plugins/gitsigns.lua @@ -0,0 +1,31 @@ +return { + -- Adds git related signs to the gutter, as well as utilities for managing changes + 'lewis6991/gitsigns.nvim', + opts = { + -- See `:help gitsigns.txt` + signs = { + add = { text = '+' }, + change = { text = '~' }, + delete = { text = '_' }, + topdelete = { text = '‾' }, + changedelete = { text = '~' }, + }, + on_attach = function(bufnr) + vim.keymap.set('n', 'hp', require('gitsigns').preview_hunk, + { buffer = bufnr, desc = 'Preview git hunk' }) + + -- don't override the built-in and fugitive keymaps + local gs = package.loaded.gitsigns + 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() + 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, + }, +} diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua new file mode 100644 index 00000000000..179bd8d3863 --- /dev/null +++ b/lua/plugins/init.lua @@ -0,0 +1,90 @@ +return { + -- NOTE: First, some plugins that don't require any configuration + + -- Git related plugins + 'tpope/vim-fugitive', + 'tpope/vim-rhubarb', + + -- Detect tabstop and shiftwidth automatically + 'tpope/vim-sleuth', + + -- Useful plugin to show you pending keybinds. + { 'folke/which-key.nvim', opts = {} }, + + { "mbbill/undotree" }, + + { + -- Theme inspired by Atom + 'navarasu/onedark.nvim', + priority = 1000, + config = function() + vim.cmd.colorscheme 'onedark' + end, + }, + + { + -- Set lualine as statusline + 'nvim-lualine/lualine.nvim', + -- See `:help lualine.txt` + opts = { + options = { + icons_enabled = false, + theme = 'onedark', + component_separators = '|', + section_separators = '', + }, + }, + }, + + { + -- Autocompletion + 'hrsh7th/nvim-cmp', + dependencies = { + -- Snippet Engine & its associated nvim-cmp source + 'L3MON4D3/LuaSnip', + 'saadparwaiz1/cmp_luasnip', + + -- Adds LSP completion capabilities + 'hrsh7th/cmp-nvim-lsp', + + -- Adds a number of user-friendly snippets + 'rafamadriz/friendly-snippets', + }, + }, + + -- Fuzzy Finder (files, lsp, etc) + { + 'nvim-telescope/telescope.nvim', + branch = '0.1.x', + dependencies = { + 'nvim-lua/plenary.nvim', + -- Fuzzy Finder Algorithm which requires local dependencies to be built. + -- Only load if `make` is available. Make sure you have the system + -- requirements installed. + { + 'nvim-telescope/telescope-fzf-native.nvim', + -- NOTE: If you are having trouble with this installation, + -- refer to the README for telescope-fzf-native for more instructions. + build = 'make', + cond = function() + return vim.fn.executable 'make' == 1 + end, + }, + }, + }, + + + -- 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', ]] + + -- 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 + -- up-to-date with whatever is in the kickstart repo. + -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. + -- + -- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins + -- { import = 'custom.plugins' }, +}, {} diff --git a/lua/plugins/lazygit.lua b/lua/plugins/lazygit.lua new file mode 100644 index 00000000000..64de826a21e --- /dev/null +++ b/lua/plugins/lazygit.lua @@ -0,0 +1,9 @@ +return { + { + "kdheepak/lazygit.nvim", + -- optional for floating window border decoration + dependencies = { + "nvim-lua/plenary.nvim", + }, + }, +} diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua new file mode 100644 index 00000000000..4f669da9432 --- /dev/null +++ b/lua/plugins/lsp.lua @@ -0,0 +1,25 @@ +return { + 'VonHeikemen/lsp-zero.nvim', + branch = 'v1.x', + dependencies = { + -- LSP Support + { 'neovim/nvim-lspconfig' }, + { 'williamboman/mason.nvim' }, + { 'williamboman/mason-lspconfig.nvim' }, + + -- Autocompletion + { 'hrsh7th/nvim-cmp' }, + { 'hrsh7th/cmp-buffer' }, + { 'hrsh7th/cmp-path' }, + { 'saadparwaiz1/cmp_luasnip' }, + { 'hrsh7th/cmp-nvim-lsp' }, + { 'hrsh7th/cmp-nvim-lua' }, + + -- Snippets + { 'L3MON4D3/LuaSnip' }, + + { 'rafamadriz/friendly-snippets' }, + }, + -- Use the lazy option to lazy-load the plugin on events or commands + lazy = true, +} diff --git a/lua/plugins/neo-tree.lua b/lua/plugins/neo-tree.lua new file mode 100644 index 00000000000..45ff96bfd50 --- /dev/null +++ b/lua/plugins/neo-tree.lua @@ -0,0 +1,122 @@ +return { + "nvim-neo-tree/neo-tree.nvim", + branch = "*", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended + "MunifTanjim/nui.nvim", + }, + cmd = "Neotree", + keys = { + { + "o", + function() + if vim.bo.filetype == "neo-tree" then + vim.cmd.wincmd "p" + else + vim.cmd.Neotree "focus" + end + end, + desc = "Toggle Explorer Focus" + }, + { "", "Neotree toggle", desc = "Toggle Explorer" } + }, + init = function() vim.g.neo_tree_remove_legacy_commands = true end, + opts = { + auto_clean_after_session_restore = true, + close_if_last_window = true, + source_selector = { + winbar = true, + content_layout = "center", + }, + commands = { + --[[ system_open = function(state) require("astronvim.utils").system_open(state.tree:get_node():get_id()) end, ]] + parent_or_close = function(state) + local node = state.tree:get_node() + if (node.type == "directory" or node:has_children()) and node:is_expanded() then + state.commands.toggle_node(state) + else + require("neo-tree.ui.renderer").focus_node(state, node:get_parent_id()) + end + end, + child_or_open = function(state) + local node = state.tree:get_node() + if node.type == "directory" or node:has_children() then + if not node:is_expanded() then -- if unexpanded, expand + state.commands.toggle_node(state) + else -- if expanded and has children, seleect the next child + require("neo-tree.ui.renderer").focus_node(state, node:get_child_ids()[1]) + end + else -- if not a directory just open it + state.commands.open(state) + end + end, + copy_selector = function(state) + local node = state.tree:get_node() + local filepath = node:get_id() + local filename = node.name + local modify = vim.fn.fnamemodify + + local results = { + e = { val = modify(filename, ":e"), msg = "Extension only" }, + f = { val = filename, msg = "Filename" }, + F = { val = modify(filename, ":r"), msg = "Filename w/o extension" }, + h = { val = modify(filepath, ":~"), msg = "Path relative to Home" }, + p = { val = modify(filepath, ":."), msg = "Path relative to CWD" }, + P = { val = filepath, msg = "Absolute path" }, + } + + local messages = { + { "\nChoose to copy to clipboard:\n", "Normal" }, + } + for i, result in pairs(results) do + if result.val and result.val ~= "" then + vim.list_extend(messages, { + { ("%s."):format(i), "Identifier" }, + { (" %s: "):format(result.msg) }, + { result.val, "String" }, + { "\n" }, + }) + end + end + vim.api.nvim_echo(messages, false, {}) + local result = results[vim.fn.getcharstr()] + if result and result.val and result.val ~= "" then + vim.notify("Copied: " .. result.val) + vim.fn.setreg("+", result.val) + end + end, + }, + window = { + width = 30, + mappings = { + [""] = false, -- disable space until we figure out which-key disabling + ["[b"] = "prev_source", + ["]b"] = "next_source", + o = "open", + --[[ O = "system_open", ]] + h = "parent_or_close", + l = "child_or_open", + Y = "copy_selector", + }, + }, + filesystem = { + hijack_netrw_behavior = "open_current", + use_libuv_file_watcher = true, + follow_current_file = { + enabled = true, -- This will find and focus the file in the active buffer every time + -- -- the current file is changed while the tree is open. + leave_dirs_open = false, -- `false` closes auto expanded dirs, such as with `:Neotree reveal` + }, + }, + event_handlers = { + { + event = "neo_tree_buffer_enter", + handler = function(_) + vim.opt_local.signcolumn = "auto" + -- require("neo-tree").close_all() + end, + }, + }, + }, +} diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua new file mode 100644 index 00000000000..6012d3eaa7b --- /dev/null +++ b/lua/plugins/treesitter.lua @@ -0,0 +1,36 @@ +return { + -- Highlight, edit, and navigate code + 'nvim-treesitter/nvim-treesitter', + dependencies = { + 'nvim-treesitter/nvim-treesitter-textobjects', + "windwp/nvim-ts-autotag", + "JoosepAlviste/nvim-ts-context-commentstring", + "nvim-treesitter/nvim-treesitter-context", + }, + cmd = { + "TSBufDisable", + "TSBufEnable", + "TSBufToggle", + "TSDisable", + "TSEnable", + "TSToggle", + "TSInstall", + "TSInstallInfo", + "TSInstallSync", + "TSModuleInfo", + "TSUninstall", + "TSUpdate", + "TSUpdateSync", + }, + build = ":TSUpdate", + opts = { + highlight = { + enable = true, + disable = function(_, bufnr) return vim.api.nvim_buf_line_count(bufnr) > 10000 end, + }, + incremental_selection = { enable = true }, + indent = { enable = true }, + autotag = { enable = true }, + context_commentstring = { enable = true, enable_autocmd = false }, + }, +} diff --git a/lua/thrillee/editor-configs.lua b/lua/thrillee/editor-configs.lua new file mode 100644 index 00000000000..0ac8c47bea6 --- /dev/null +++ b/lua/thrillee/editor-configs.lua @@ -0,0 +1,69 @@ +-- [[ Basic Keymaps ]] +vim.o.relativenumber = true + +-- Set highlight on search +vim.o.hlsearch = false + +-- Make line numbers default +vim.wo.number = true + +-- Enable mouse mode +vim.o.mouse = 'a' + +-- Enable break indent +vim.o.breakindent = true + +-- Save undo history +vim.o.undofile = true + +-- Case-insensitive searching UNLESS \C or capital in search +vim.o.ignorecase = true +vim.o.smartcase = true + +-- Keep signcolumn on by default +vim.wo.signcolumn = 'yes' + +-- Decrease update time +--[[ vim.o.timeoutlen = 300 ]] + +-- Set completeopt to have a better completion experience +vim.o.completeopt = 'menuone,noselect' + +-- NOTE: You should make sure your terminal supports this +vim.o.termguicolors = true + +vim.opt.tabstop = 4 +vim.opt.softtabstop = 4 +vim.opt.shiftwidth = 4 +vim.opt.expandtab = true + +vim.opt.swapfile = false +vim.opt.backup = false +vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir" +vim.opt.undofile = true + +vim.opt.smartindent = true + +vim.opt.wrap = false + +vim.opt.hlsearch = false +vim.opt.incsearch = true + +vim.opt.scrolloff = 8 +vim.opt.signcolumn = "yes" +vim.opt.isfname:append("@-@") + +vim.opt.updatetime = 50 + +vim.opt.colorcolumn = "100" + +-- [[ 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, + group = highlight_group, + pattern = '*', +}) diff --git a/lua/thrillee/init.lua b/lua/thrillee/init.lua new file mode 100644 index 00000000000..353ed989c9a --- /dev/null +++ b/lua/thrillee/init.lua @@ -0,0 +1,3 @@ +require("thrillee.editor-configs") +require("thrillee.remaps") +require("thrillee.splits") diff --git a/lua/thrillee/remaps.lua b/lua/thrillee/remaps.lua new file mode 100644 index 00000000000..c5587613391 --- /dev/null +++ b/lua/thrillee/remaps.lua @@ -0,0 +1,33 @@ +-- Keymaps for better default experience +-- See `:help vim.keymap.set()` +vim.keymap.set({ 'n', 'v' }, '', '', { 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 }) + +vim.keymap.set("i", "jk", "") + +vim.keymap.set('n', 'w', 'w!', { desc = 'Save File' }) +vim.keymap.set('n', 'q', "confirm q", { desc = 'Quit File' }) + +vim.keymap.set('v', '', '"*y', { desc = 'Copy to system clipboard' }) +vim.keymap.set('v', 'p', [["_dP]], { desc = 'Paste and retain paste in clipboard' }) +vim.keymap.set("n", "s", [[:%s/\<\>//gI]], + { desc = 'Search and Replace Highlighted Word' }) + +vim.keymap.set("n", "J", "mzJ`z", { desc = 'Keep cusor in index position on J' }) + +-- Keep cusor in middle of buffer +vim.keymap.set('n', '', "zz", { desc = '⬇ middle of buffer and keep cusor in middle of buffer' }) +vim.keymap.set('n', '', 'zz', { desc = '⬆ middle of buffer and keep cusor in middle of buffer' }) +vim.keymap.set('n', 'N', 'nzzzv', { desc = 'next search and keep cusor in middle of buffer' }) +vim.keymap.set('n', 'n', 'Nzzzv', { desc = 'previous search and keep cusor in middle of buffer' }) + +-- Move highlighted up or down +vim.keymap.set("v", "J", ":m '>+1gv=gv", { desc = 'Move highlighted up' }) +vim.keymap.set("v", "K", ":m '<-2gv=gv", { desc = 'Move highlighted down' }) + + +-- Map c to close and save the buffer +vim.api.nvim_set_keymap('n', 'c', [[:w | bd]], { noremap = true, silent = true }) diff --git a/lua/thrillee/splits.lua b/lua/thrillee/splits.lua new file mode 100644 index 00000000000..b4e20b64033 --- /dev/null +++ b/lua/thrillee/splits.lua @@ -0,0 +1,35 @@ +--[[ Split cmd ]] +vim.opt.splitbelow = true +vim.opt.splitright = true + +vim.keymap.set("n", "||", "vsplit", { desc = 'Vertical Split' }) +vim.keymap.set("n", "--", "split", { desc = 'Horinzontal Split' }) + +vim.keymap.set("n", "", "h", { desc = "Navigate to the left" }) +vim.keymap.set("n", "", "", { desc = "Navigate below" }) +vim.keymap.set("n", "", "k", { desc = "Navigate up" }) +vim.keymap.set("n", "", "l", { desc = "Navigate right" }) + +vim.keymap.set("n", "hh", ":vertical resize +3", { silent = true }) +vim.keymap.set("n", "ll", ":vertical resize -3", { silent = true }) +vim.keymap.set("n", "kk", ":resize +3", { silent = true }) +vim.keymap.set("n", "jj", ":resize -3", { silent = true }) + +vim.g.original_size = nil + +function Toggle_maximize_pane() + local winnr = vim.api.nvim_get_current_win() + local width = vim.api.nvim_win_get_width(winnr) + local height = vim.api.nvim_win_get_height(winnr) + if vim.g.original_size == nil then + vim.g.original_size = { width, height } + vim.api.nvim_win_set_width(winnr, vim.o.columns) + vim.api.nvim_win_set_height(winnr, vim.o.lines) + else + vim.api.nvim_win_set_width(winnr, vim.g.original_size[1]) + vim.api.nvim_win_set_height(winnr, vim.g.original_size[2]) + vim.g.original_size = nil + end +end + +vim.keymap.set("n", "", 'lua Toggle_maximize_pane()', { noremap = true, desc = "Maximize Current Split" }) From d7575d7a554001155d9e3a75941a995e49f0a3de Mon Sep 17 00:00:00 2001 From: Oluwatobi Date: Tue, 17 Oct 2023 15:30:09 +0100 Subject: [PATCH 02/40] added conform formatter --- after/plugin/conform-config.lua | 16 +++++ after/plugin/lsp-config.lua | 107 +++++++++++++++++++------------- init.lua | 20 +++--- lazy-lock.json | 41 ++++++------ lua/plugins/conform.lua | 4 ++ 5 files changed, 114 insertions(+), 74 deletions(-) create mode 100644 after/plugin/conform-config.lua create mode 100644 lua/plugins/conform.lua diff --git a/after/plugin/conform-config.lua b/after/plugin/conform-config.lua new file mode 100644 index 00000000000..f5557a19b45 --- /dev/null +++ b/after/plugin/conform-config.lua @@ -0,0 +1,16 @@ +require('conform').setup { + formatters_by_ft = { + lua = { 'stylua' }, + -- Conform will run multiple formatters sequentially + python = { 'isort', 'black' }, + -- Use a sub-list to run only the first available formatter + javascript = { { 'prettierd', 'prettier' } }, + }, +} + +vim.api.nvim_create_autocmd('BufWritePre', { + pattern = '*', + callback = function(args) + require('conform').format { bufnr = args.buf } + end, +}) diff --git a/after/plugin/lsp-config.lua b/after/plugin/lsp-config.lua index 5f485bbc1bb..af64bd5783c 100644 --- a/after/plugin/lsp-config.lua +++ b/after/plugin/lsp-config.lua @@ -1,64 +1,83 @@ -- [[ Configure LSP ]] -local lsp = require("lsp-zero") +local lsp = require 'lsp-zero' -lsp.preset("recommended") +lsp.preset 'recommended' -lsp.ensure_installed({ - 'gopls', - 'pyright', - 'tsserver', - 'rust_analyzer', -}) +lsp.ensure_installed { + 'gopls', + 'pyright', + 'tsserver', + 'rust_analyzer', +} -- Fix Undefined global 'vim' lsp.nvim_workspace() - -local cmp = require('cmp') +local cmp = require 'cmp' local cmp_select = { behavior = cmp.SelectBehavior.Select } -local cmp_mappings = lsp.defaults.cmp_mappings({ - [''] = cmp.mapping.select_prev_item(cmp_select), - [''] = cmp.mapping.select_next_item(cmp_select), - [''] = cmp.mapping.confirm({ select = true }), - [""] = cmp.mapping.complete(), -}) +local cmp_mappings = lsp.defaults.cmp_mappings { + [''] = cmp.mapping.select_prev_item(cmp_select), + [''] = cmp.mapping.select_next_item(cmp_select), + [''] = cmp.mapping.confirm { select = true }, + [''] = cmp.mapping.complete(), +} cmp_mappings[''] = nil cmp_mappings[''] = nil -lsp.setup_nvim_cmp({ - mapping = cmp_mappings -}) +lsp.setup_nvim_cmp { + mapping = cmp_mappings, +} -lsp.set_preferences({ - suggest_lsp_servers = false, - sign_icons = { - error = '⛔️', - warn = '⚠️', - hint = '🧐', - info = 'I' - } -}) +lsp.set_preferences { + suggest_lsp_servers = false, + sign_icons = { + error = '⛔️', + warn = '⚠️', + hint = '🧐', + info = 'I', + }, +} lsp.on_attach(function(_, bufnr) - local opts = { buffer = bufnr, remap = false } + local opts = { buffer = bufnr, remap = false } - vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts) - vim.keymap.set("n", "gD", function() vim.lsp.buf.declaration() end, opts) - vim.keymap.set("n", "K", function() vim.lsp.buf.hover() end, opts) - vim.keymap.set("n", "vws", function() vim.lsp.buf.workspace_symbol() end, opts) - vim.keymap.set("n", "vd", function() vim.diagnostic.open_float() end, opts) - vim.keymap.set("n", "[d", function() vim.diagnostic.goto_next() end, opts) - vim.keymap.set("n", "]d", function() vim.diagnostic.goto_prev() end, opts) - vim.keymap.set("n", "ca", function() vim.lsp.buf.code_action() end, opts) - vim.keymap.set("n", "gr", require('telescope.builtin').lsp_references, opts) - vim.keymap.set("n", "rn", function() vim.lsp.buf.rename() end, opts) - vim.keymap.set("i", "", function() vim.lsp.buf.signature_help() end, opts) - vim.keymap.set("n", "lf", vim.lsp.buf.format, { desc = 'Format Buffer' }) + vim.keymap.set('n', 'gd', function() + vim.lsp.buf.definition() + end, opts) + vim.keymap.set('n', 'gD', function() + vim.lsp.buf.declaration() + end, opts) + vim.keymap.set('n', 'K', function() + vim.lsp.buf.hover() + end, opts) + vim.keymap.set('n', 'vws', function() + vim.lsp.buf.workspace_symbol() + end, opts) + vim.keymap.set('n', 'vd', function() + vim.diagnostic.open_float() + end, opts) + vim.keymap.set('n', '[d', function() + vim.diagnostic.goto_next() + end, opts) + vim.keymap.set('n', ']d', function() + vim.diagnostic.goto_prev() + end, opts) + vim.keymap.set('n', 'ca', function() + vim.lsp.buf.code_action() + end, opts) + vim.keymap.set('n', 'gr', require('telescope.builtin').lsp_references, opts) + vim.keymap.set('n', 'rn', function() + vim.lsp.buf.rename() + end, opts) + --[[ vim.keymap.set("i", "", function() vim.lsp.buf.signature_help() end, opts) ]] + vim.keymap.set('n', 'lf', function() + require('conform').format() + end, { desc = 'Format Buffer' }) end) lsp.setup() -vim.diagnostic.config({ - virtual_text = true -}) +vim.diagnostic.config { + virtual_text = true, +} diff --git a/init.lua b/init.lua index 09ee298780d..86fb4e34999 100644 --- a/init.lua +++ b/init.lua @@ -3,18 +3,18 @@ vim.g.maplocalleader = ' ' local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim' if not vim.loop.fs_stat(lazypath) then - vim.fn.system { - 'git', - 'clone', - '--filter=blob:none', - 'https://github.com/folke/lazy.nvim.git', - '--branch=stable', -- latest stable release - lazypath, - } + vim.fn.system { + 'git', + 'clone', + '--filter=blob:none', + 'https://github.com/folke/lazy.nvim.git', + '--branch=stable', -- latest stable release + lazypath, + } end vim.opt.rtp:prepend(lazypath) -require('lazy').setup('plugins') -require('thrillee') +require('lazy').setup 'plugins' +require 'thrillee' --[[ require('kickstart.plugins.autoformat') require('kickstart.plugins.debug') ]] diff --git a/lazy-lock.json b/lazy-lock.json index 53a3e7aada4..8a696e67399 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,38 +1,39 @@ { "Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" }, - "LuaSnip": { "branch": "master", "commit": "2c3a3a3e4fb503bf39efb61290ecfa8aae95f5eb" }, + "LuaSnip": { "branch": "master", "commit": "0df29db3543837f8b41597f2640397c5ec792b7b" }, "alpha-nvim": { "branch": "main", "commit": "234822140b265ec4ba3203e3e0be0e0bb826dff5" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" }, "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, - "cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" }, + "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, + "conform.nvim": { "branch": "master", "commit": "1281e26948fc06994e0e0cdcaafdd9bbd28929e7" }, "friendly-snippets": { "branch": "main", "commit": "43727c2ff84240e55d4069ec3e6158d74cb534b6" }, - "gitsigns.nvim": { "branch": "main", "commit": "ff01d34daaed72f271a8ffa088a7e839a60c640f" }, - "lazy.nvim": { "branch": "main", "commit": "6b6f0a451200bb6abde85978c577c73ea1577758" }, + "gitsigns.nvim": { "branch": "main", "commit": "5a9a6ac29a7805c4783cda21b80a1e361964b3f2" }, + "lazy.nvim": { "branch": "main", "commit": "7613ab2abb1bd99e039ae02030bc2c48b7626925" }, "lazygit.nvim": { "branch": "main", "commit": "de35012036d43bca03628d40d083f7c02a4cda3f" }, "lsp-zero.nvim": { "branch": "v1.x", "commit": "60b0e84f3793f7e8bcc9ec52f9c239fd497b2cd2" }, - "lualine.nvim": { "branch": "master", "commit": "45e27ca739c7be6c49e5496d14fcf45a303c3a63" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "e2705063f395b44f676cd26596a11007a2cbd3bd" }, - "mason.nvim": { "branch": "main", "commit": "d66c60e17dd6fd8165194b1d14d21f7eb2c1697a" }, + "lualine.nvim": { "branch": "master", "commit": "1a3f6bba410aff5a51bf8c84287aaa3a8ba30d0d" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "e7b64c11035aa924f87385b72145e0ccf68a7e0a" }, + "mason.nvim": { "branch": "main", "commit": "cd7835b15f5a4204fc37e0aa739347472121a54c" }, "neo-tree.nvim": { "branch": "v3.x", "commit": "71f1841ba6c652908678cece623f52c1fea8a6cd" }, - "nui.nvim": { "branch": "main", "commit": "c8de23342caf8d50b15d6b28368d36a56a69d76f" }, - "nvim-autopairs": { "branch": "master", "commit": "de4f7138a68d5d5063170f2182fd27faf06b0b54" }, + "nui.nvim": { "branch": "main", "commit": "c0c8e347ceac53030f5c1ece1c5a5b6a17a25b32" }, + "nvim-autopairs": { "branch": "master", "commit": "f6c71641f6f183427a651c0ce4ba3fb89404fa9e" }, "nvim-cmp": { "branch": "main", "commit": "5dce1b778b85c717f6614e3f4da45e9f19f54435" }, - "nvim-lspconfig": { "branch": "master", "commit": "2b361e043810d5587d9af0787f8ce40da92ec5e9" }, - "nvim-treesitter": { "branch": "master", "commit": "10bfa4826f2235c600c073a82e0d78718aa7240e" }, - "nvim-treesitter-context": { "branch": "master", "commit": "2095f231dfe796d228eedea96fdaa31f2e343fb2" }, - "nvim-treesitter-textobjects": { "branch": "master", "commit": "4724694bc03ce1148860a46d9d77c3664d8188ab" }, + "nvim-lspconfig": { "branch": "master", "commit": "e49b1e90c1781ce372013de3fa93a91ea29fc34a" }, + "nvim-treesitter": { "branch": "master", "commit": "9c4fc86b67c1d68141cef57846d24cbee9b74fb0" }, + "nvim-treesitter-context": { "branch": "master", "commit": "82c695951612911421e8e21068ba5fc2c2e2c212" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "78c49ca7d2f7ccba2115c11422c037713c978ad1" }, "nvim-ts-autotag": { "branch": "main", "commit": "6be1192965df35f94b8ea6d323354f7dc7a557e4" }, - "nvim-ts-context-commentstring": { "branch": "main", "commit": "7241635869b7a8115893ffa67bab3907756caf4f" }, - "nvim-web-devicons": { "branch": "master", "commit": "45d0237c427baba8cd05e0ab26d30e2ee58c2c82" }, - "onedark.nvim": { "branch": "master", "commit": "dac8c39812dae025255c9069a260e1f69d967927" }, - "plenary.nvim": { "branch": "master", "commit": "9ce85b0f7dcfe5358c0be937ad23e456907d410b" }, + "nvim-ts-context-commentstring": { "branch": "main", "commit": "92e688f013c69f90c9bbd596019ec10235bc51de" }, + "nvim-web-devicons": { "branch": "master", "commit": "3af745113ea537f58c4b1573b64a429fefad9e07" }, + "onedark.nvim": { "branch": "master", "commit": "826fb77e9ca92d3c0f3d937328663d4a6dc7fee1" }, + "plenary.nvim": { "branch": "master", "commit": "50012918b2fc8357b87cff2a7f7f0446e47da174" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" }, - "telescope.nvim": { "branch": "0.1.x", "commit": "54930e1abfc94409e1bb9266e752ef8379008592" }, + "telescope.nvim": { "branch": "0.1.x", "commit": "7011eaae0ac1afe036e30c95cf80200b8dc3f21a" }, "undotree": { "branch": "master", "commit": "0e11ba7325efbbb3f3bebe06213afa3e7ec75131" }, - "vim-fugitive": { "branch": "master", "commit": "99db68d9b3304580bd383da7aaee05c7a954a344" }, + "vim-fugitive": { "branch": "master", "commit": "cbe9dfa162c178946afa689dd3f42d4ea8bf89c1" }, "vim-rhubarb": { "branch": "master", "commit": "ee69335de176d9325267b0fd2597a22901d927b1" }, "vim-sleuth": { "branch": "master", "commit": "1cc4557420f215d02c4d2645a748a816c220e99b" }, - "which-key.nvim": { "branch": "main", "commit": "7ccf476ebe0445a741b64e36c78a682c1c6118b7" } + "which-key.nvim": { "branch": "main", "commit": "6962dae3565369363b59dd51fb206051555fcb4d" } } \ No newline at end of file diff --git a/lua/plugins/conform.lua b/lua/plugins/conform.lua new file mode 100644 index 00000000000..6b816b8da9b --- /dev/null +++ b/lua/plugins/conform.lua @@ -0,0 +1,4 @@ +return { + 'stevearc/conform.nvim', + opts = {}, +} From 2100726468760e258c54daa249dd1b38315afb55 Mon Sep 17 00:00:00 2001 From: Oluwatobi Date: Tue, 17 Oct 2023 15:43:50 +0100 Subject: [PATCH 03/40] added format support for jsx tsx --- after/plugin/conform-config.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/after/plugin/conform-config.lua b/after/plugin/conform-config.lua index f5557a19b45..8e780f88ed6 100644 --- a/after/plugin/conform-config.lua +++ b/after/plugin/conform-config.lua @@ -5,6 +5,8 @@ require('conform').setup { python = { 'isort', 'black' }, -- Use a sub-list to run only the first available formatter javascript = { { 'prettierd', 'prettier' } }, + javascriptreact = { { 'prettier' } }, + typescriptreact = { { 'prettier' } }, }, } From 3a76bbf0c6d28952c8206856356ac5acd27c7d46 Mon Sep 17 00:00:00 2001 From: Oluwatobi Date: Tue, 31 Oct 2023 12:00:00 +0100 Subject: [PATCH 04/40] update --- after/plugin/catppuccin-config.lua | 46 +++++++ after/plugin/cmp.lua | 5 + after/plugin/lsp-config.lua | 21 ++- after/plugin/mini-comment-config.lua | 39 ++++++ after/plugin/treesitter-config.lua | 75 ++++++++++- after/plugin/ts-context-commentstring.lua | 1 + lazy-lock.json | 40 +++--- lua/plugins/comments.lua | 18 --- lua/plugins/init.lua | 154 ++++++++++++---------- lua/plugins/mini-ai.lua | 22 ++++ lua/plugins/mini-comment.lua | 11 ++ lua/plugins/surrond.lua | 14 ++ lua/plugins/treesitter.lua | 66 +++++----- lua/thrillee/splits.lua | 51 +++---- 14 files changed, 391 insertions(+), 172 deletions(-) create mode 100644 after/plugin/catppuccin-config.lua create mode 100644 after/plugin/mini-comment-config.lua create mode 100644 after/plugin/ts-context-commentstring.lua delete mode 100644 lua/plugins/comments.lua create mode 100644 lua/plugins/mini-ai.lua create mode 100644 lua/plugins/mini-comment.lua create mode 100644 lua/plugins/surrond.lua diff --git a/after/plugin/catppuccin-config.lua b/after/plugin/catppuccin-config.lua new file mode 100644 index 00000000000..8572757accc --- /dev/null +++ b/after/plugin/catppuccin-config.lua @@ -0,0 +1,46 @@ +require('catppuccin').setup { + flavour = 'macchiato', -- mocha, frappe, latte, mocha + background = { -- :h background + light = 'latte', + dark = 'mocha', + }, + transparent_background = false, -- disables setting the background color. + show_end_of_buffer = false, -- shows the '~' characters after the end of buffers + term_colors = false, -- sets terminal colors (e.g. `g:terminal_color_0`) + dim_inactive = { + enabled = false, -- dims the background color of inactive window + shade = 'dark', + percentage = 0.15, -- percentage of the shade to apply to the inactive window + }, + no_italic = false, -- Force no italic + no_bold = false, -- Force no bold + no_underline = false, -- Force no underline + styles = { -- Handles the styles of general hi groups (see `:h highlight-args`): + comments = { 'italic' }, -- Change the style of comments + conditionals = { 'italic' }, + loops = {}, + functions = {}, + keywords = {}, + strings = {}, + variables = {}, + numbers = {}, + booleans = {}, + properties = {}, + types = {}, + operators = {}, + }, + color_overrides = {}, + custom_highlights = {}, + integrations = { + cmp = true, + gitsigns = true, + nvimtree = true, + treesitter = true, + notify = false, + mini = { + enabled = true, + indentscope_color = '', + }, + -- For more plugins integrations please scroll down (https://github.com/catppuccin/nvim#integrations) + }, +} diff --git a/after/plugin/cmp.lua b/after/plugin/cmp.lua index d3a415d970b..77179d4bcf2 100644 --- a/after/plugin/cmp.lua +++ b/after/plugin/cmp.lua @@ -1,5 +1,6 @@ -- [[ Configure nvim-cmp ]] -- See `:help cmp` +vim.api.nvim_set_hl(0, 'CmpGhostText', { link = 'Comment', default = true }) local cmp = require 'cmp' local luasnip = require 'luasnip' require('luasnip.loaders.from_vscode').lazy_load() @@ -43,5 +44,9 @@ cmp.setup { sources = { { name = 'nvim_lsp' }, { name = 'luasnip' }, + { name = 'path' }, + { + { name = 'buffer' }, + }, }, } diff --git a/after/plugin/lsp-config.lua b/after/plugin/lsp-config.lua index af64bd5783c..d0e73710a0e 100644 --- a/after/plugin/lsp-config.lua +++ b/after/plugin/lsp-config.lua @@ -42,9 +42,6 @@ lsp.set_preferences { lsp.on_attach(function(_, bufnr) local opts = { buffer = bufnr, remap = false } - vim.keymap.set('n', 'gd', function() - vim.lsp.buf.definition() - end, opts) vim.keymap.set('n', 'gD', function() vim.lsp.buf.declaration() end, opts) @@ -57,23 +54,39 @@ lsp.on_attach(function(_, bufnr) vim.keymap.set('n', 'vd', function() vim.diagnostic.open_float() end, opts) + vim.keymap.set('n', '[d', function() vim.diagnostic.goto_next() end, opts) vim.keymap.set('n', ']d', function() vim.diagnostic.goto_prev() end, opts) + vim.keymap.set('n', 'ca', function() vim.lsp.buf.code_action() end, opts) + + vim.keymap.set('n', 'gd', require('telescope.builtin').lsp_definitions, opts) vim.keymap.set('n', 'gr', require('telescope.builtin').lsp_references, opts) + vim.keymap.set('n', 'rn', function() vim.lsp.buf.rename() end, opts) - --[[ vim.keymap.set("i", "", function() vim.lsp.buf.signature_help() end, opts) ]] + vim.keymap.set('n', 'lf', function() require('conform').format() end, { desc = 'Format Buffer' }) + + -- Add WorkSpace + vim.keymap.set('n', 'wa', vim.lsp.buf.add_workspace_folder, opts) + + -- Remove WorkSpace + vim.keymap.set('n', 'wr', vim.lsp.buf.remove_workspace_folder, opts) + + -- List WorkSpace + vim.keymap.set('n', 'wl', function() + print(vim.inspect(vim.lsp.buf.list_workspace_folders())) + end, opts) end) lsp.setup() diff --git a/after/plugin/mini-comment-config.lua b/after/plugin/mini-comment-config.lua new file mode 100644 index 00000000000..4a078ac9d6f --- /dev/null +++ b/after/plugin/mini-comment-config.lua @@ -0,0 +1,39 @@ +require('mini.comment').setup { + -- Options which control module behavior + options = { + -- Function to compute custom 'commentstring' (optional) + custom_commentstring = function() + return require('ts_context_commentstring.internal').calculate_commentstring() or vim.bo.commentstring + end, + + -- Whether to ignore blank lines + ignore_blank_line = false, + + -- Whether to recognize as comment only lines without indent + start_of_line = false, + + -- Whether to ensure single space pad for comment parts + pad_comment_parts = true, + }, + + -- Module mappings. Use `''` (empty string) to disable one. + mappings = { + -- Toggle comment (like `gcip` - comment inner paragraph) for both + -- Normal and Visual modes + comment = '++', + + -- Toggle comment on current line + comment_line = '++', + + -- Define 'comment' textobject (like `dgc` - delete whole comment block) + textobject = '++', + }, + + -- Hook functions to be executed at certain stage of commenting + hooks = { + -- Before successful commenting. Does nothing by default. + pre = function() end, + -- After successful commenting. Does nothing by default. + post = function() end, + }, +} diff --git a/after/plugin/treesitter-config.lua b/after/plugin/treesitter-config.lua index ee753c3ddf6..583435f5bd8 100644 --- a/after/plugin/treesitter-config.lua +++ b/after/plugin/treesitter-config.lua @@ -19,9 +19,25 @@ } end, 0) ]] -require'nvim-treesitter.configs'.setup { +require('nvim-treesitter.configs').setup { -- A list of parser names, or "all" - ensure_installed = { "vimdoc", "javascript", "typescript", "c", "lua", "rust", "go", "python", "tsx", "vim" }, + ensure_installed = { + 'c', + 'css', + 'lua', + 'rust', + 'go', + 'python', + 'vim', + 'vimdoc', + 'tsx', + 'html', + 'javascript', + 'typescript', + }, + context_commentstring = { + enable = true, + }, -- Install parsers synchronously (only applied to `ensure_installed`) sync_install = false, @@ -40,4 +56,59 @@ require'nvim-treesitter.configs'.setup { -- Instead of true it can also be a list of languages additional_vim_regex_highlighting = false, }, + + incremental_selection = { + enable = true, + keymaps = { + init_selection = '', + node_incremental = '', + scope_incremental = '', + node_decremental = '', + }, + }, + + textobjects = { + select = { + enable = true, + lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim + keymaps = { + -- You can use the capture groups defined in textobjects.scm + ['aa'] = '@parameter.outer', + ['ia'] = '@parameter.inner', + ['af'] = '@function.outer', + ['if'] = '@function.inner', + ['ac'] = '@class.outer', + ['ic'] = '@class.inner', + }, + }, + move = { + enable = true, + set_jumps = true, -- whether to set jumps in the jumplist + goto_next_start = { + [']m'] = '@function.outer', + [']]'] = '@class.outer', + }, + goto_next_end = { + [']M'] = '@function.outer', + [']['] = '@class.outer', + }, + goto_previous_start = { + ['[m'] = '@function.outer', + ['[['] = '@class.outer', + }, + goto_previous_end = { + ['[M'] = '@function.outer', + ['[]'] = '@class.outer', + }, + }, + swap = { + enable = true, + swap_next = { + ['a'] = '@parameter.inner', + }, + swap_previous = { + ['A'] = '@parameter.inner', + }, + }, + }, } diff --git a/after/plugin/ts-context-commentstring.lua b/after/plugin/ts-context-commentstring.lua new file mode 100644 index 00000000000..c12dbaa8366 --- /dev/null +++ b/after/plugin/ts-context-commentstring.lua @@ -0,0 +1 @@ +require('ts_context_commentstring').setup {} diff --git a/lazy-lock.json b/lazy-lock.json index 8a696e67399..4a5b1ea9c8d 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,39 +1,41 @@ { - "Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" }, - "LuaSnip": { "branch": "master", "commit": "0df29db3543837f8b41597f2640397c5ec792b7b" }, + "LuaSnip": { "branch": "master", "commit": "80a8528f084a97b624ae443a6f50ff8074ba486b" }, "alpha-nvim": { "branch": "main", "commit": "234822140b265ec4ba3203e3e0be0e0bb826dff5" }, + "catppuccin": { "branch": "main", "commit": "b359f3eec32dcc6b7c9a26901dc235bbb6cd8a0b" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" }, "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, - "conform.nvim": { "branch": "master", "commit": "1281e26948fc06994e0e0cdcaafdd9bbd28929e7" }, + "conform.nvim": { "branch": "master", "commit": "f7766d2fbe23f0f22a3db1513beba7d03a8dc261" }, "friendly-snippets": { "branch": "main", "commit": "43727c2ff84240e55d4069ec3e6158d74cb534b6" }, - "gitsigns.nvim": { "branch": "main", "commit": "5a9a6ac29a7805c4783cda21b80a1e361964b3f2" }, - "lazy.nvim": { "branch": "main", "commit": "7613ab2abb1bd99e039ae02030bc2c48b7626925" }, + "gitsigns.nvim": { "branch": "main", "commit": "af0f583cd35286dd6f0e3ed52622728703237e50" }, + "lazy.nvim": { "branch": "main", "commit": "16603c6917435d8446f7357cb61095138a417085" }, "lazygit.nvim": { "branch": "main", "commit": "de35012036d43bca03628d40d083f7c02a4cda3f" }, - "lsp-zero.nvim": { "branch": "v1.x", "commit": "60b0e84f3793f7e8bcc9ec52f9c239fd497b2cd2" }, - "lualine.nvim": { "branch": "master", "commit": "1a3f6bba410aff5a51bf8c84287aaa3a8ba30d0d" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "e7b64c11035aa924f87385b72145e0ccf68a7e0a" }, + "lsp-zero.nvim": { "branch": "v1.x", "commit": "c51a9104de7fddff2351361d2dbcbd8d08600ef4" }, + "lualine.nvim": { "branch": "master", "commit": "2248ef254d0a1488a72041cfb45ca9caada6d994" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "40301e1c74bc0946eece13edf2b1c561cc497491" }, "mason.nvim": { "branch": "main", "commit": "cd7835b15f5a4204fc37e0aa739347472121a54c" }, + "mini.ai": { "branch": "main", "commit": "fc9ce93eb8d58ce1a39101928fb5ea8f8b97844c" }, + "mini.comment": { "branch": "main", "commit": "e4320af992cd053a7da2f33d9f63a86c2ab6ce59" }, + "mini.surround": { "branch": "main", "commit": "862cfaef72d789d320625ec34e2488a5cc8fd423" }, "neo-tree.nvim": { "branch": "v3.x", "commit": "71f1841ba6c652908678cece623f52c1fea8a6cd" }, "nui.nvim": { "branch": "main", "commit": "c0c8e347ceac53030f5c1ece1c5a5b6a17a25b32" }, - "nvim-autopairs": { "branch": "master", "commit": "f6c71641f6f183427a651c0ce4ba3fb89404fa9e" }, - "nvim-cmp": { "branch": "main", "commit": "5dce1b778b85c717f6614e3f4da45e9f19f54435" }, - "nvim-lspconfig": { "branch": "master", "commit": "e49b1e90c1781ce372013de3fa93a91ea29fc34a" }, - "nvim-treesitter": { "branch": "master", "commit": "9c4fc86b67c1d68141cef57846d24cbee9b74fb0" }, - "nvim-treesitter-context": { "branch": "master", "commit": "82c695951612911421e8e21068ba5fc2c2e2c212" }, - "nvim-treesitter-textobjects": { "branch": "master", "commit": "78c49ca7d2f7ccba2115c11422c037713c978ad1" }, + "nvim-autopairs": { "branch": "master", "commit": "0f04d78619cce9a5af4f355968040f7d675854a1" }, + "nvim-cmp": { "branch": "main", "commit": "51260c02a8ffded8e16162dcf41a23ec90cfba62" }, + "nvim-lspconfig": { "branch": "master", "commit": "d0467b9574b48429debf83f8248d8cee79562586" }, + "nvim-treesitter": { "branch": "master", "commit": "efec7115d8175bdb6720eeb4e26196032cb52593" }, + "nvim-treesitter-context": { "branch": "master", "commit": "2806d83e3965017382ce08792ee527e708fa1bd4" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "e69a504baf2951d52e1f1fbb05145d43f236cbf1" }, "nvim-ts-autotag": { "branch": "main", "commit": "6be1192965df35f94b8ea6d323354f7dc7a557e4" }, "nvim-ts-context-commentstring": { "branch": "main", "commit": "92e688f013c69f90c9bbd596019ec10235bc51de" }, - "nvim-web-devicons": { "branch": "master", "commit": "3af745113ea537f58c4b1573b64a429fefad9e07" }, - "onedark.nvim": { "branch": "master", "commit": "826fb77e9ca92d3c0f3d937328663d4a6dc7fee1" }, + "nvim-web-devicons": { "branch": "master", "commit": "5de460ca7595806044eced31e3c36c159a493857" }, "plenary.nvim": { "branch": "master", "commit": "50012918b2fc8357b87cff2a7f7f0446e47da174" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" }, "telescope.nvim": { "branch": "0.1.x", "commit": "7011eaae0ac1afe036e30c95cf80200b8dc3f21a" }, - "undotree": { "branch": "master", "commit": "0e11ba7325efbbb3f3bebe06213afa3e7ec75131" }, - "vim-fugitive": { "branch": "master", "commit": "cbe9dfa162c178946afa689dd3f42d4ea8bf89c1" }, + "undotree": { "branch": "master", "commit": "170aa9e516b6926e6bddfe21bbf01f2283a00e7d" }, + "vim-fugitive": { "branch": "master", "commit": "46eaf8918b347906789df296143117774e827616" }, "vim-rhubarb": { "branch": "master", "commit": "ee69335de176d9325267b0fd2597a22901d927b1" }, "vim-sleuth": { "branch": "master", "commit": "1cc4557420f215d02c4d2645a748a816c220e99b" }, - "which-key.nvim": { "branch": "main", "commit": "6962dae3565369363b59dd51fb206051555fcb4d" } + "which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" } } \ No newline at end of file diff --git a/lua/plugins/comments.lua b/lua/plugins/comments.lua deleted file mode 100644 index 06f1809bd28..00000000000 --- a/lua/plugins/comments.lua +++ /dev/null @@ -1,18 +0,0 @@ -return { - 'numToStr/Comment.nvim', - opts = { - toggler = { - ---Line-comment toggle keymap - line = '++', - ---Block-comment toggle keymap - block = '++', - }, - opleader = { - ---Line-comment keymap - line = '++', - ---Block-comment keymap - block = '++', - }, - }, - lazy = false, -} diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 179bd8d3863..ca3fb910ad6 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -1,90 +1,98 @@ return { - -- NOTE: First, some plugins that don't require any configuration + -- NOTE: First, some plugins that don't require any configuration - -- Git related plugins - 'tpope/vim-fugitive', - 'tpope/vim-rhubarb', + -- Git related plugins + 'tpope/vim-fugitive', + 'tpope/vim-rhubarb', - -- Detect tabstop and shiftwidth automatically - 'tpope/vim-sleuth', + -- Detect tabstop and shiftwidth automatically + 'tpope/vim-sleuth', - -- Useful plugin to show you pending keybinds. - { 'folke/which-key.nvim', opts = {} }, + -- Useful plugin to show you pending keybinds. + { 'folke/which-key.nvim', opts = {} }, - { "mbbill/undotree" }, + { 'mbbill/undotree' }, - { - -- Theme inspired by Atom - 'navarasu/onedark.nvim', - priority = 1000, - config = function() - vim.cmd.colorscheme 'onedark' - end, - }, + -- { + -- -- Theme inspired by Atom + -- 'navarasu/onedark.nvim', + -- priority = 1000, + -- config = function() + -- vim.cmd.colorscheme 'onedark' + -- end, + -- }, + -- + { + 'catppuccin/nvim', + name = 'catppuccin', + priority = 1000, + config = function() + vim.cmd.colorscheme 'catppuccin' + end, + }, - { - -- Set lualine as statusline - 'nvim-lualine/lualine.nvim', - -- See `:help lualine.txt` - opts = { - options = { - icons_enabled = false, - theme = 'onedark', - component_separators = '|', - section_separators = '', - }, - }, + { + -- Set lualine as statusline + 'nvim-lualine/lualine.nvim', + -- See `:help lualine.txt` + opts = { + options = { + icons_enabled = false, + theme = 'onedark', + component_separators = '|', + section_separators = '', + }, }, + }, - { - -- Autocompletion - 'hrsh7th/nvim-cmp', - dependencies = { - -- Snippet Engine & its associated nvim-cmp source - 'L3MON4D3/LuaSnip', - 'saadparwaiz1/cmp_luasnip', + { + -- Autocompletion + 'hrsh7th/nvim-cmp', + dependencies = { + -- Snippet Engine & its associated nvim-cmp source + 'L3MON4D3/LuaSnip', + 'saadparwaiz1/cmp_luasnip', - -- Adds LSP completion capabilities - 'hrsh7th/cmp-nvim-lsp', + -- Adds LSP completion capabilities + 'hrsh7th/cmp-nvim-lsp', - -- Adds a number of user-friendly snippets - 'rafamadriz/friendly-snippets', - }, + -- Adds a number of user-friendly snippets + 'rafamadriz/friendly-snippets', }, + }, - -- Fuzzy Finder (files, lsp, etc) - { - 'nvim-telescope/telescope.nvim', - branch = '0.1.x', - dependencies = { - 'nvim-lua/plenary.nvim', - -- Fuzzy Finder Algorithm which requires local dependencies to be built. - -- Only load if `make` is available. Make sure you have the system - -- requirements installed. - { - 'nvim-telescope/telescope-fzf-native.nvim', - -- NOTE: If you are having trouble with this installation, - -- refer to the README for telescope-fzf-native for more instructions. - build = 'make', - cond = function() - return vim.fn.executable 'make' == 1 - end, - }, - }, + -- Fuzzy Finder (files, lsp, etc) + { + 'nvim-telescope/telescope.nvim', + branch = '0.1.x', + dependencies = { + 'nvim-lua/plenary.nvim', + -- Fuzzy Finder Algorithm which requires local dependencies to be built. + -- Only load if `make` is available. Make sure you have the system + -- requirements installed. + { + 'nvim-telescope/telescope-fzf-native.nvim', + -- NOTE: If you are having trouble with this installation, + -- refer to the README for telescope-fzf-native for more instructions. + build = 'make', + cond = function() + return vim.fn.executable 'make' == 1 + end, + }, }, + }, + -- 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', ]] - -- 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', ]] - - -- 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 - -- up-to-date with whatever is in the kickstart repo. - -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. - -- - -- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins - -- { import = 'custom.plugins' }, + -- 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 + -- up-to-date with whatever is in the kickstart repo. + -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. + -- + -- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins + -- { import = 'custom.plugins' }, }, {} diff --git a/lua/plugins/mini-ai.lua b/lua/plugins/mini-ai.lua new file mode 100644 index 00000000000..83d0110dcb7 --- /dev/null +++ b/lua/plugins/mini-ai.lua @@ -0,0 +1,22 @@ +return { + 'echasnovski/mini.ai', + -- keys = { + -- { "a", mode = { "x", "o" } }, + -- { "i", mode = { "x", "o" } }, + -- }, + opts = function() + local ai = require 'mini.ai' + return { + n_lines = 500, + custom_textobjects = { + o = ai.gen_spec.treesitter({ + a = { '@block.outer', '@conditional.outer', '@loop.outer' }, + i = { '@block.inner', '@conditional.inner', '@loop.inner' }, + }, {}), + f = ai.gen_spec.treesitter({ a = '@function.outer', i = '@function.inner' }, {}), + c = ai.gen_spec.treesitter({ a = '@class.outer', i = '@class.inner' }, {}), + t = { '<([%p%w]-)%f[^<%w][^<>]->.-', '^<.->().*()$' }, + }, + } + end, +} diff --git a/lua/plugins/mini-comment.lua b/lua/plugins/mini-comment.lua new file mode 100644 index 00000000000..3c1cfdc8502 --- /dev/null +++ b/lua/plugins/mini-comment.lua @@ -0,0 +1,11 @@ +return { + 'echasnovski/mini.comment', + event = 'VeryLazy', + opts = { + options = { + custom_commentstring = function() + return require('ts_context_commentstring.internal').calculate_commentstring() or vim.bo.commentstring + end, + }, + }, +} diff --git a/lua/plugins/surrond.lua b/lua/plugins/surrond.lua new file mode 100644 index 00000000000..64cd6a0b30b --- /dev/null +++ b/lua/plugins/surrond.lua @@ -0,0 +1,14 @@ +return { + 'echasnovski/mini.surround', + opts = { + mappings = { + add = 'gsa', -- Add surrounding in Normal and Visual modes + delete = 'gsd', -- Delete surrounding + find = 'gsf', -- Find surrounding (to the right) + find_left = 'gsF', -- Find surrounding (to the left) + highlight = 'gsh', -- Highlight surrounding + replace = 'gsr', -- Replace surrounding + update_n_lines = 'gsn', -- Update `n_lines` + }, + }, +} diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua index 6012d3eaa7b..1eec17cbbb9 100644 --- a/lua/plugins/treesitter.lua +++ b/lua/plugins/treesitter.lua @@ -1,36 +1,36 @@ return { - -- Highlight, edit, and navigate code - 'nvim-treesitter/nvim-treesitter', - dependencies = { - 'nvim-treesitter/nvim-treesitter-textobjects', - "windwp/nvim-ts-autotag", - "JoosepAlviste/nvim-ts-context-commentstring", - "nvim-treesitter/nvim-treesitter-context", - }, - cmd = { - "TSBufDisable", - "TSBufEnable", - "TSBufToggle", - "TSDisable", - "TSEnable", - "TSToggle", - "TSInstall", - "TSInstallInfo", - "TSInstallSync", - "TSModuleInfo", - "TSUninstall", - "TSUpdate", - "TSUpdateSync", - }, - build = ":TSUpdate", - opts = { - highlight = { - enable = true, - disable = function(_, bufnr) return vim.api.nvim_buf_line_count(bufnr) > 10000 end, - }, - incremental_selection = { enable = true }, - indent = { enable = true }, - autotag = { enable = true }, - context_commentstring = { enable = true, enable_autocmd = false }, + -- Highlight, edit, and navigate code + 'nvim-treesitter/nvim-treesitter', + dependencies = { + 'nvim-treesitter/nvim-treesitter-textobjects', + 'windwp/nvim-ts-autotag', + 'JoosepAlviste/nvim-ts-context-commentstring', + 'nvim-treesitter/nvim-treesitter-context', + }, + cmd = { + 'TSBufDisable', + 'TSBufEnable', + 'TSBufToggle', + 'TSDisable', + 'TSEnable', + 'TSToggle', + 'TSInstall', + 'TSInstallInfo', + 'TSInstallSync', + 'TSModuleInfo', + 'TSUninstall', + 'TSUpdate', + 'TSUpdateSync', + }, + build = ':TSUpdate', + opts = { + highlight = { + enable = true, + -- disable = function(_, bufnr) return vim.api.nvim_buf_line_count(bufnr) > 10000 end, }, + incremental_selection = { enable = true }, + indent = { enable = true }, + autotag = { enable = true }, + context_commentstring = { enable = true, enable_autocmd = false }, + }, } diff --git a/lua/thrillee/splits.lua b/lua/thrillee/splits.lua index b4e20b64033..a241c6fd0df 100644 --- a/lua/thrillee/splits.lua +++ b/lua/thrillee/splits.lua @@ -2,34 +2,39 @@ vim.opt.splitbelow = true vim.opt.splitright = true -vim.keymap.set("n", "||", "vsplit", { desc = 'Vertical Split' }) -vim.keymap.set("n", "--", "split", { desc = 'Horinzontal Split' }) +vim.keymap.set('n', '||', 'vsplit', { desc = 'Vertical Split' }) +vim.keymap.set('n', '--', 'split', { desc = 'Horinzontal Split' }) -vim.keymap.set("n", "", "h", { desc = "Navigate to the left" }) -vim.keymap.set("n", "", "", { desc = "Navigate below" }) -vim.keymap.set("n", "", "k", { desc = "Navigate up" }) -vim.keymap.set("n", "", "l", { desc = "Navigate right" }) +vim.keymap.set('n', '', 'h', { desc = 'Navigate to the left' }) +vim.keymap.set('n', '', '', { desc = 'Navigate below' }) +vim.keymap.set('n', '', 'k', { desc = 'Navigate up' }) +vim.keymap.set('n', '', 'l', { desc = 'Navigate right' }) -vim.keymap.set("n", "hh", ":vertical resize +3", { silent = true }) -vim.keymap.set("n", "ll", ":vertical resize -3", { silent = true }) -vim.keymap.set("n", "kk", ":resize +3", { silent = true }) -vim.keymap.set("n", "jj", ":resize -3", { silent = true }) +vim.keymap.set('n', 'sh', 'h', { desc = 'Navigate to the left' }) +vim.keymap.set('n', 'sw', '', { desc = 'Navigate below' }) +vim.keymap.set('n', 'sk', 'k', { desc = 'Navigate up' }) +vim.keymap.set('n', 'sl', 'l', { desc = 'Navigate right' }) + +vim.keymap.set('n', 'hh', ':vertical resize +3', { silent = true }) +vim.keymap.set('n', 'll', ':vertical resize -3', { silent = true }) +vim.keymap.set('n', 'kk', ':resize +3', { silent = true }) +vim.keymap.set('n', 'jj', ':resize -3', { silent = true }) vim.g.original_size = nil function Toggle_maximize_pane() - local winnr = vim.api.nvim_get_current_win() - local width = vim.api.nvim_win_get_width(winnr) - local height = vim.api.nvim_win_get_height(winnr) - if vim.g.original_size == nil then - vim.g.original_size = { width, height } - vim.api.nvim_win_set_width(winnr, vim.o.columns) - vim.api.nvim_win_set_height(winnr, vim.o.lines) - else - vim.api.nvim_win_set_width(winnr, vim.g.original_size[1]) - vim.api.nvim_win_set_height(winnr, vim.g.original_size[2]) - vim.g.original_size = nil - end + local winnr = vim.api.nvim_get_current_win() + local width = vim.api.nvim_win_get_width(winnr) + local height = vim.api.nvim_win_get_height(winnr) + if vim.g.original_size == nil then + vim.g.original_size = { width, height } + vim.api.nvim_win_set_width(winnr, vim.o.columns) + vim.api.nvim_win_set_height(winnr, vim.o.lines) + else + vim.api.nvim_win_set_width(winnr, vim.g.original_size[1]) + vim.api.nvim_win_set_height(winnr, vim.g.original_size[2]) + vim.g.original_size = nil + end end -vim.keymap.set("n", "", 'lua Toggle_maximize_pane()', { noremap = true, desc = "Maximize Current Split" }) +vim.keymap.set('n', '', 'lua Toggle_maximize_pane()', { noremap = true, desc = 'Maximize Current Split' }) From c37bf09c81abb538d319225a5f8c46a8832a6f4e Mon Sep 17 00:00:00 2001 From: Oluwatobi Date: Thu, 30 Nov 2023 14:57:19 +0100 Subject: [PATCH 05/40] update vim config --- after/plugin/conform-config.lua | 3 + after/plugin/dadbod-ui-config.lua | 30 ++++++ after/plugin/gopher-config.lua | 12 +++ after/plugin/telescope.lua | 39 ++++---- ftplugin/java.lua | 153 ++++++++++++++++++++++++++++++ lazy-lock.json | 38 ++++---- lua/plugins/dadbod.lua | 17 ++++ lua/plugins/gopher.lua | 7 ++ lua/thrillee/splits.lua | 8 +- 9 files changed, 267 insertions(+), 40 deletions(-) create mode 100644 after/plugin/dadbod-ui-config.lua create mode 100644 after/plugin/gopher-config.lua create mode 100644 ftplugin/java.lua create mode 100644 lua/plugins/dadbod.lua create mode 100644 lua/plugins/gopher.lua diff --git a/after/plugin/conform-config.lua b/after/plugin/conform-config.lua index 8e780f88ed6..e2f30346bf8 100644 --- a/after/plugin/conform-config.lua +++ b/after/plugin/conform-config.lua @@ -7,6 +7,9 @@ require('conform').setup { javascript = { { 'prettierd', 'prettier' } }, javascriptreact = { { 'prettier' } }, typescriptreact = { { 'prettier' } }, + typescript = { { 'prettier' } }, + go = { { 'gofumpt', 'goimports-reviser', 'golines' } }, + java = { 'google-java-format' }, }, } diff --git a/after/plugin/dadbod-ui-config.lua b/after/plugin/dadbod-ui-config.lua new file mode 100644 index 00000000000..4b42e97d2e5 --- /dev/null +++ b/after/plugin/dadbod-ui-config.lua @@ -0,0 +1,30 @@ +vim.keymap.set('n', 'db', 'DBUIToggle', { noremap = true, desc = 'DB UI Toggle' }) +vim.keymap.set('n', 'dba', 'DBUIAddConnection', { noremap = true, desc = 'Add New DB Connection' }) + +local M = {} + +local function db_completion() + require('cmp').setup.buffer { sources = { { name = 'vim-dadbod-completion' } } } +end + +function M.setup() + vim.api.nvim_create_autocmd('FileType', { + pattern = { + 'sql', + }, + command = [[setlocal omnifunc=vim_dadbod_completion#omni]], + }) + + vim.api.nvim_create_autocmd('FileType', { + pattern = { + 'sql', + 'mysql', + 'plsql', + }, + callback = function() + vim.schedule(db_completion) + end, + }) +end + +return M diff --git a/after/plugin/gopher-config.lua b/after/plugin/gopher-config.lua new file mode 100644 index 00000000000..3016172b8af --- /dev/null +++ b/after/plugin/gopher-config.lua @@ -0,0 +1,12 @@ +require('gopher').setup { + commands = { + go = 'go', + gomodifytags = 'gomodifytags', + gotests = '~/go/bin/gotests', -- also you can set custom command path + impl = 'impl', + iferr = 'iferr', + }, +} + +vim.keymap.set('n', 'gaj', ':GoTagAdd json', { desc = 'Add JSON Tag TO Go Struct' }) +vim.keymap.set('n', 'gax', ':GoTagAdd xml', { desc = 'Add XML Tag TO Go Struct' }) diff --git a/after/plugin/telescope.lua b/after/plugin/telescope.lua index 7aeecde659f..4bbc633c0d7 100644 --- a/after/plugin/telescope.lua +++ b/after/plugin/telescope.lua @@ -1,13 +1,13 @@ -- [[ Configure Treesitter ]] require('telescope').setup { - defaults = { - mappings = { - i = { - [''] = false, - [''] = false, - }, - }, + defaults = { + mappings = { + i = { + [''] = false, + [''] = false, + }, }, + }, } -- Enable telescope fzf native, if installed @@ -17,11 +17,11 @@ pcall(require('telescope').load_extension, 'fzf') vim.keymap.set('n', '?', require('telescope.builtin').oldfiles, { desc = '[?] Find recently opened files' }) vim.keymap.set('n', 'fb', require('telescope.builtin').buffers, { desc = '[ ] Find existing buffers' }) vim.keymap.set('n', '/', function() - -- You can pass additional configuration to telescope to change theme, layout, etc. - require('telescope.builtin').current_buffer_fuzzy_find(require('telescope.themes').get_dropdown { - winblend = 10, - previewer = false, - }) + -- You can pass additional configuration to telescope to change theme, layout, etc. + require('telescope.builtin').current_buffer_fuzzy_find(require('telescope.themes').get_dropdown { + winblend = 10, + previewer = true, + }) end, { desc = '[/] Fuzzily search in current buffer' }) vim.keymap.set('n', 'ff', require('telescope.builtin').find_files, { desc = 'Find [F]iles' }) @@ -29,14 +29,15 @@ vim.keymap.set('n', 'fh', require('telescope.builtin').help_tags, { desc vim.keymap.set('n', 'fw', require('telescope.builtin').grep_string, { desc = 'Find current [W]ord' }) vim.keymap.set('n', 'fd', require('telescope.builtin').diagnostics, { desc = 'Find [D]iagnostics' }) vim.keymap.set('n', 'fr', require('telescope.builtin').registers, { desc = 'Find [R]egister' }) -vim.keymap.set('n', 'fF', - function() require("telescope.builtin").find_files { hidden = true, no_ignore = true } end, - { desc = '[S]earch [R]esume' }) +vim.keymap.set('n', 'fF', function() + require('telescope.builtin').find_files { hidden = true, no_ignore = true } +end, { desc = '[S]earch [R]esume' }) vim.keymap.set('n', 'fg', require('telescope.builtin').live_grep, { desc = 'Find by [G]rep' }) vim.keymap.set('n', 'fG', function() - require("telescope.builtin").live_grep { - additional_args = function(args) return vim.list_extend(args, { "--hidden", "--no-ignore" }) end, - } + require('telescope.builtin').live_grep { + additional_args = function(args) + return vim.list_extend(args, { '--hidden', '--no-ignore' }) + end, + } end, { desc = 'Find by [G]rep In all Files' }) - diff --git a/ftplugin/java.lua b/ftplugin/java.lua new file mode 100644 index 00000000000..785f0737d53 --- /dev/null +++ b/ftplugin/java.lua @@ -0,0 +1,153 @@ +-- Java Language Server configuration. +-- Locations: +-- 'nvim/ftplugin/java.lua'. +-- 'nvim/lang-servers/intellij-java-google-style.xml' + +local jdtls_ok, jdtls = pcall(require, 'jdtls') +if not jdtls_ok then + vim.notify 'JDTLS not found, install with `:LspInstall jdtls`' + return +end + +-- See `:help vim.lsp.start_client` for an overview of the supported `config` options. +-- local jdtls_path = vim.fn.stdpath 'data' .. '/mason/packages/jdtls' +local jdtls_path = '/Users/oluwatobibello/.local/share/nvim/mason/packages/jdtls' +local path_to_lsp_server = jdtls_path .. '/config_mac' +local path_to_plugins = jdtls_path .. '/plugins/' +local path_to_jar = path_to_plugins .. 'org.eclipse.equinox.launcher_1.6.400.v20210924-0641.jar' +local lombok_path = path_to_plugins .. 'lombok.jar' + +local root_markers = { '.git', 'mvnw', 'gradlew', 'pom.xml', 'build.gradle' } +local root_dir = require('jdtls.setup').find_root(root_markers) +if root_dir == '' then + return +end + +local project_name = vim.fn.fnamemodify(vim.fn.getcwd(), ':p:h:t') +local workspace_dir = vim.fn.stdpath 'data' .. '/site/java/workspace-root/' .. project_name +os.execute('mkdir ' .. workspace_dir) + +local java_17_home_dir = '/Library/Java/JavaVirtualMachines/zulu-17.jdk/Contents/Home' +local java_11_home_dir = '/Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home' + +-- Main Config +local config = { + -- The command that starts the language server + -- See: https://github.com/eclipse/eclipse.jdt.ls#running-from-the-command-line + cmd = { + java_17_home_dir .. '/bin/java', + '-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', + '-javaagent:' .. lombok_path, + '-Xms1g', + '--add-modules=ALL-SYSTEM', + '--add-opens', + 'java.base/java.util=ALL-UNNAMED', + '--add-opens', + 'java.base/java.lang=ALL-UNNAMED', + + '-jar', + path_to_jar, + '-configuration', + path_to_lsp_server, + '-data', + workspace_dir, + }, + + -- This is the default if not provided, you can remove it. Or adjust as needed. + -- One dedicated LSP server & client will be started per unique root_dir + root_dir = root_dir, + + -- Here you can configure eclipse.jdt.ls specific settings + -- See https://github.com/eclipse/eclipse.jdt.ls/wiki/Running-the-JAVA-LS-server-from-the-command-line#initialize-request + -- for a list of options + settings = { + java = { + home = java_17_home_dir, + eclipse = { + downloadSources = true, + }, + configuration = { + updateBuildConfiguration = 'interactive', + runtimes = { + { + name = 'JavaSE-11', + path = '/Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home', + }, + { + name = 'JavaSE-17', + path = java_17_home_dir, + }, + }, + }, + maven = { + downloadSources = true, + }, + implementationsCodeLens = { + enabled = true, + }, + referencesCodeLens = { + enabled = true, + }, + references = { + includeDecompiledSources = true, + }, + }, + signatureHelp = { enabled = true }, + completion = { + favoriteStaticMembers = { + 'org.hamcrest.MatcherAssert.assertThat', + 'org.hamcrest.Matchers.*', + 'org.hamcrest.CoreMatchers.*', + 'org.junit.jupiter.api.Assertions.*', + 'java.util.Objects.requireNonNull', + 'java.util.Objects.requireNonNullElse', + 'org.mockito.Mockito.*', + }, + importOrder = { + 'java', + 'javax', + 'com', + 'org', + }, + }, + sources = { + organizeImports = { + starThreshold = 9999, + staticStarThreshold = 9999, + }, + }, + codeGeneration = { + toString = { + template = '${object.className}{${member.name()}=${member.value}, ${otherMembers}}', + }, + useBlocks = true, + }, + }, + + flags = { + allow_incremental_sync = true, + }, + init_options = { + bundles = {}, + }, +} + +config['on_attach'] = function(_, bufnr) + require('keymaps').map_java_keys(bufnr) + require('lsp_signature').on_attach({ + bind = true, -- This is mandatory, otherwise border config won't get registered. + floating_window_above_cur_line = false, + padding = '', + handler_opts = { + border = 'rounded', + }, + }, bufnr) +end + +-- This starts a new client & server, +-- or attaches to an existing client & server depending on the `root_dir`. +require('jdtls').start_or_attach(config) diff --git a/lazy-lock.json b/lazy-lock.json index 4a5b1ea9c8d..96778cb21ca 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,39 +1,43 @@ { - "LuaSnip": { "branch": "master", "commit": "80a8528f084a97b624ae443a6f50ff8074ba486b" }, + "LuaSnip": { "branch": "master", "commit": "46c91e814732c1630b8a8b50d04acbf54b8320fa" }, "alpha-nvim": { "branch": "main", "commit": "234822140b265ec4ba3203e3e0be0e0bb826dff5" }, - "catppuccin": { "branch": "main", "commit": "b359f3eec32dcc6b7c9a26901dc235bbb6cd8a0b" }, + "catppuccin": { "branch": "main", "commit": "9f3c13bbcf16fcaec3a429c03743a13e5923f3e3" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" }, "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, - "conform.nvim": { "branch": "master", "commit": "f7766d2fbe23f0f22a3db1513beba7d03a8dc261" }, + "conform.nvim": { "branch": "master", "commit": "ca3dfba94600aa62bfc88ae37cbd4f17eaea2553" }, "friendly-snippets": { "branch": "main", "commit": "43727c2ff84240e55d4069ec3e6158d74cb534b6" }, "gitsigns.nvim": { "branch": "main", "commit": "af0f583cd35286dd6f0e3ed52622728703237e50" }, - "lazy.nvim": { "branch": "main", "commit": "16603c6917435d8446f7357cb61095138a417085" }, + "gopher.nvim": { "branch": "main", "commit": "ac27f4b6794c872140fb205313d79ab166892fe9" }, + "lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" }, "lazygit.nvim": { "branch": "main", "commit": "de35012036d43bca03628d40d083f7c02a4cda3f" }, "lsp-zero.nvim": { "branch": "v1.x", "commit": "c51a9104de7fddff2351361d2dbcbd8d08600ef4" }, "lualine.nvim": { "branch": "master", "commit": "2248ef254d0a1488a72041cfb45ca9caada6d994" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "40301e1c74bc0946eece13edf2b1c561cc497491" }, - "mason.nvim": { "branch": "main", "commit": "cd7835b15f5a4204fc37e0aa739347472121a54c" }, - "mini.ai": { "branch": "main", "commit": "fc9ce93eb8d58ce1a39101928fb5ea8f8b97844c" }, - "mini.comment": { "branch": "main", "commit": "e4320af992cd053a7da2f33d9f63a86c2ab6ce59" }, - "mini.surround": { "branch": "main", "commit": "862cfaef72d789d320625ec34e2488a5cc8fd423" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "6eb8cae80f2e4322ec82cd9f8fa423f6d1eb02c3" }, + "mason.nvim": { "branch": "main", "commit": "41e75af1f578e55ba050c863587cffde3556ffa6" }, + "mini.ai": { "branch": "main", "commit": "4a2e387b121352dfb478f440c9a5313a9d97006c" }, + "mini.comment": { "branch": "main", "commit": "3d9c8009615857e982f09bc5357fc95f2a2175f3" }, + "mini.surround": { "branch": "main", "commit": "af8129efcabe95fc08a233e9f91569829bed031f" }, "neo-tree.nvim": { "branch": "v3.x", "commit": "71f1841ba6c652908678cece623f52c1fea8a6cd" }, "nui.nvim": { "branch": "main", "commit": "c0c8e347ceac53030f5c1ece1c5a5b6a17a25b32" }, "nvim-autopairs": { "branch": "master", "commit": "0f04d78619cce9a5af4f355968040f7d675854a1" }, - "nvim-cmp": { "branch": "main", "commit": "51260c02a8ffded8e16162dcf41a23ec90cfba62" }, - "nvim-lspconfig": { "branch": "master", "commit": "d0467b9574b48429debf83f8248d8cee79562586" }, - "nvim-treesitter": { "branch": "master", "commit": "efec7115d8175bdb6720eeb4e26196032cb52593" }, - "nvim-treesitter-context": { "branch": "master", "commit": "2806d83e3965017382ce08792ee527e708fa1bd4" }, - "nvim-treesitter-textobjects": { "branch": "master", "commit": "e69a504baf2951d52e1f1fbb05145d43f236cbf1" }, + "nvim-cmp": { "branch": "main", "commit": "0b751f6beef40fd47375eaf53d3057e0bfa317e4" }, + "nvim-lspconfig": { "branch": "master", "commit": "90a28fd7637b66e055af62387ecee06f7cbd3173" }, + "nvim-treesitter": { "branch": "master", "commit": "075a64addc33390028ea124a1046a43497f05cd1" }, + "nvim-treesitter-context": { "branch": "master", "commit": "c03f8aab1e6649036d69ba7e3af4d09cb7e4d977" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "dbcd9388e3b119a87c785e10a00d62876077d23d" }, "nvim-ts-autotag": { "branch": "main", "commit": "6be1192965df35f94b8ea6d323354f7dc7a557e4" }, - "nvim-ts-context-commentstring": { "branch": "main", "commit": "92e688f013c69f90c9bbd596019ec10235bc51de" }, - "nvim-web-devicons": { "branch": "master", "commit": "5de460ca7595806044eced31e3c36c159a493857" }, + "nvim-ts-context-commentstring": { "branch": "main", "commit": "6c30f3c8915d7b31c3decdfe6c7672432da1809d" }, + "nvim-web-devicons": { "branch": "master", "commit": "3fafeea5f339223e888fd15eb4032260849cb038" }, "plenary.nvim": { "branch": "master", "commit": "50012918b2fc8357b87cff2a7f7f0446e47da174" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" }, "telescope.nvim": { "branch": "0.1.x", "commit": "7011eaae0ac1afe036e30c95cf80200b8dc3f21a" }, - "undotree": { "branch": "master", "commit": "170aa9e516b6926e6bddfe21bbf01f2283a00e7d" }, + "undotree": { "branch": "master", "commit": "36ff7abb6b60980338344982ad4cdf03f7961ecd" }, + "vim-dadbod": { "branch": "master", "commit": "fecf5a3ecfb1869f34252c7c27351de99f01ab0e" }, + "vim-dadbod-completion": { "branch": "master", "commit": "bcdf3ff768cc7e544a0f78b0383d8719c2116569" }, + "vim-dadbod-ui": { "branch": "master", "commit": "95fd22469507e86b78aa55d868c14108adee2881" }, "vim-fugitive": { "branch": "master", "commit": "46eaf8918b347906789df296143117774e827616" }, "vim-rhubarb": { "branch": "master", "commit": "ee69335de176d9325267b0fd2597a22901d927b1" }, "vim-sleuth": { "branch": "master", "commit": "1cc4557420f215d02c4d2645a748a816c220e99b" }, diff --git a/lua/plugins/dadbod.lua b/lua/plugins/dadbod.lua new file mode 100644 index 00000000000..de850af86f7 --- /dev/null +++ b/lua/plugins/dadbod.lua @@ -0,0 +1,17 @@ +return { + 'kristijanhusak/vim-dadbod-ui', + dependencies = { + { 'tpope/vim-dadbod', lazy = true }, + { 'kristijanhusak/vim-dadbod-completion', ft = { 'sql', 'mysql', 'plsql' }, lazy = true }, + }, + cmd = { + 'DBUI', + 'DBUIToggle', + 'DBUIAddConnection', + 'DBUIFindBuffer', + }, + init = function() + -- Your DBUI configuration + vim.g.db_ui_use_nerd_fonts = 1 + end, +} diff --git a/lua/plugins/gopher.lua b/lua/plugins/gopher.lua new file mode 100644 index 00000000000..b313e260763 --- /dev/null +++ b/lua/plugins/gopher.lua @@ -0,0 +1,7 @@ +return { + 'olexsmir/gopher.nvim', + dependencies = { + 'nvim-lua/plenary.nvim', + 'nvim-treesitter/nvim-treesitter', + }, +} diff --git a/lua/thrillee/splits.lua b/lua/thrillee/splits.lua index a241c6fd0df..3db3eb74d4b 100644 --- a/lua/thrillee/splits.lua +++ b/lua/thrillee/splits.lua @@ -5,10 +5,10 @@ vim.opt.splitright = true vim.keymap.set('n', '||', 'vsplit', { desc = 'Vertical Split' }) vim.keymap.set('n', '--', 'split', { desc = 'Horinzontal Split' }) -vim.keymap.set('n', '', 'h', { desc = 'Navigate to the left' }) -vim.keymap.set('n', '', '', { desc = 'Navigate below' }) -vim.keymap.set('n', '', 'k', { desc = 'Navigate up' }) -vim.keymap.set('n', '', 'l', { desc = 'Navigate right' }) +-- vim.keymap.set('n', '', 'h', { desc = 'Navigate to the left' }) +-- vim.keymap.set('n', '', '', { desc = 'Navigate below' }) +-- vim.keymap.set('n', '', 'k', { desc = 'Navigate up' }) +-- vim.keymap.set('n', '', 'l', { desc = 'Navigate right' }) vim.keymap.set('n', 'sh', 'h', { desc = 'Navigate to the left' }) vim.keymap.set('n', 'sw', '', { desc = 'Navigate below' }) From f9e3314b2df5619f95032de8093c0a71095bc128 Mon Sep 17 00:00:00 2001 From: Oluwatobi Date: Sat, 30 Dec 2023 21:43:42 +0100 Subject: [PATCH 06/40] update --- after/plugin/mini-comment-config.lua | 3 +++ lua/thrillee/editor-configs.lua | 22 +++++++++------------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/after/plugin/mini-comment-config.lua b/after/plugin/mini-comment-config.lua index 4a078ac9d6f..aa59b4b593b 100644 --- a/after/plugin/mini-comment-config.lua +++ b/after/plugin/mini-comment-config.lua @@ -25,6 +25,9 @@ require('mini.comment').setup { -- Toggle comment on current line comment_line = '++', + -- Toggle comment on visual selection + comment_visual = '++', + -- Define 'comment' textobject (like `dgc` - delete whole comment block) textobject = '++', }, diff --git a/lua/thrillee/editor-configs.lua b/lua/thrillee/editor-configs.lua index 0ac8c47bea6..1b945f0ffc0 100644 --- a/lua/thrillee/editor-configs.lua +++ b/lua/thrillee/editor-configs.lua @@ -1,9 +1,6 @@ -- [[ Basic Keymaps ]] vim.o.relativenumber = true --- Set highlight on search -vim.o.hlsearch = false - -- Make line numbers default vim.wo.number = true @@ -39,8 +36,7 @@ vim.opt.expandtab = true vim.opt.swapfile = false vim.opt.backup = false -vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir" -vim.opt.undofile = true +vim.opt.undodir = os.getenv 'HOME' .. '/.vim/undodir' vim.opt.smartindent = true @@ -50,20 +46,20 @@ vim.opt.hlsearch = false vim.opt.incsearch = true vim.opt.scrolloff = 8 -vim.opt.signcolumn = "yes" -vim.opt.isfname:append("@-@") +vim.opt.signcolumn = 'yes' +vim.opt.isfname:append '@-@' vim.opt.updatetime = 50 -vim.opt.colorcolumn = "100" +vim.opt.colorcolumn = '100' -- [[ 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, - group = highlight_group, - pattern = '*', + callback = function() + vim.highlight.on_yank() + end, + group = highlight_group, + pattern = '*', }) From 3c5d202b1b603365193387466aeaef0b86b2b8b3 Mon Sep 17 00:00:00 2001 From: Oluwatobi Date: Tue, 2 Jan 2024 21:24:50 +0100 Subject: [PATCH 07/40] lsp diagnotics --- after/plugin/lsp-config.lua | 9 +++++++++ after/plugin/treesitter-config.lua | 6 ++++++ 2 files changed, 15 insertions(+) diff --git a/after/plugin/lsp-config.lua b/after/plugin/lsp-config.lua index d0e73710a0e..1f6ff1396d6 100644 --- a/after/plugin/lsp-config.lua +++ b/after/plugin/lsp-config.lua @@ -58,10 +58,19 @@ lsp.on_attach(function(_, bufnr) vim.keymap.set('n', '[d', function() vim.diagnostic.goto_next() end, opts) + vim.keymap.set('n', ']d', function() vim.diagnostic.goto_prev() end, opts) + vim.keymap.set('n', 'dd', function() + vim.diagnostic.setloclist() + end, opts) + + vim.keymap.set('n', 'do', function() + vim.diagnostic.open_float() + end, opts) + vim.keymap.set('n', 'ca', function() vim.lsp.buf.code_action() end, opts) diff --git a/after/plugin/treesitter-config.lua b/after/plugin/treesitter-config.lua index 583435f5bd8..a8e35c47f38 100644 --- a/after/plugin/treesitter-config.lua +++ b/after/plugin/treesitter-config.lua @@ -112,3 +112,9 @@ require('nvim-treesitter.configs').setup { }, }, } + +vim.filetype.add { + extension = { + templ = 'templ', + }, +} From 19568cdfe2b74b87a29fb2f86f5cc7b28ef93996 Mon Sep 17 00:00:00 2001 From: Oluwatobi Date: Tue, 16 Jan 2024 13:49:36 +0100 Subject: [PATCH 08/40] update and added config for templ --- after/plugin/conform-config.lua | 1 + after/plugin/lsp-config.lua | 1 + after/plugin/treesitter-config.lua | 1 + lazy-lock.json | 62 +++++++++++++++--------------- 4 files changed, 34 insertions(+), 31 deletions(-) diff --git a/after/plugin/conform-config.lua b/after/plugin/conform-config.lua index e2f30346bf8..e595a8bb996 100644 --- a/after/plugin/conform-config.lua +++ b/after/plugin/conform-config.lua @@ -10,6 +10,7 @@ require('conform').setup { typescript = { { 'prettier' } }, go = { { 'gofumpt', 'goimports-reviser', 'golines' } }, java = { 'google-java-format' }, + templ = { 'templ' }, }, } diff --git a/after/plugin/lsp-config.lua b/after/plugin/lsp-config.lua index 1f6ff1396d6..b1910e7c1e4 100644 --- a/after/plugin/lsp-config.lua +++ b/after/plugin/lsp-config.lua @@ -8,6 +8,7 @@ lsp.ensure_installed { 'pyright', 'tsserver', 'rust_analyzer', + 'templ', } -- Fix Undefined global 'vim' diff --git a/after/plugin/treesitter-config.lua b/after/plugin/treesitter-config.lua index a8e35c47f38..56622c69646 100644 --- a/after/plugin/treesitter-config.lua +++ b/after/plugin/treesitter-config.lua @@ -34,6 +34,7 @@ require('nvim-treesitter.configs').setup { 'html', 'javascript', 'typescript', + 'templ', }, context_commentstring = { enable = true, diff --git a/lazy-lock.json b/lazy-lock.json index 96778cb21ca..80d8bdfbf83 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,44 +1,44 @@ { - "LuaSnip": { "branch": "master", "commit": "46c91e814732c1630b8a8b50d04acbf54b8320fa" }, - "alpha-nvim": { "branch": "main", "commit": "234822140b265ec4ba3203e3e0be0e0bb826dff5" }, - "catppuccin": { "branch": "main", "commit": "9f3c13bbcf16fcaec3a429c03743a13e5923f3e3" }, + "LuaSnip": { "branch": "master", "commit": "82108e7e31cc6fc223cc5df5cae6d89f70bb199f" }, + "alpha-nvim": { "branch": "main", "commit": "29074eeb869a6cbac9ce1fbbd04f5f5940311b32" }, + "catppuccin": { "branch": "main", "commit": "5e36ca599f4aa41bdd87fbf2c5aae4397ac55074" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, - "cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" }, "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, - "conform.nvim": { "branch": "master", "commit": "ca3dfba94600aa62bfc88ae37cbd4f17eaea2553" }, - "friendly-snippets": { "branch": "main", "commit": "43727c2ff84240e55d4069ec3e6158d74cb534b6" }, - "gitsigns.nvim": { "branch": "main", "commit": "af0f583cd35286dd6f0e3ed52622728703237e50" }, + "conform.nvim": { "branch": "master", "commit": "cbc5745bf7519acaf3a5cbaaa677fd556aa813d7" }, + "friendly-snippets": { "branch": "main", "commit": "69a2c1675b66e002799f5eef803b87a12f593049" }, + "gitsigns.nvim": { "branch": "main", "commit": "4aaacbf5e5e2218fd05eb75703fe9e0f85335803" }, "gopher.nvim": { "branch": "main", "commit": "ac27f4b6794c872140fb205313d79ab166892fe9" }, "lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" }, - "lazygit.nvim": { "branch": "main", "commit": "de35012036d43bca03628d40d083f7c02a4cda3f" }, - "lsp-zero.nvim": { "branch": "v1.x", "commit": "c51a9104de7fddff2351361d2dbcbd8d08600ef4" }, - "lualine.nvim": { "branch": "master", "commit": "2248ef254d0a1488a72041cfb45ca9caada6d994" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "6eb8cae80f2e4322ec82cd9f8fa423f6d1eb02c3" }, - "mason.nvim": { "branch": "main", "commit": "41e75af1f578e55ba050c863587cffde3556ffa6" }, - "mini.ai": { "branch": "main", "commit": "4a2e387b121352dfb478f440c9a5313a9d97006c" }, - "mini.comment": { "branch": "main", "commit": "3d9c8009615857e982f09bc5357fc95f2a2175f3" }, - "mini.surround": { "branch": "main", "commit": "af8129efcabe95fc08a233e9f91569829bed031f" }, + "lazygit.nvim": { "branch": "main", "commit": "1e08e3f5ac1152339690140e61a4a32b3bdc7de5" }, + "lsp-zero.nvim": { "branch": "v1.x", "commit": "aa36afcf7a59fbd98008c9a434593c423d3d649a" }, + "lualine.nvim": { "branch": "master", "commit": "566b7036f717f3d676362742630518a47f132fff" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "3ba1b92b771f33256b4969d696b82c8ae7075364" }, + "mason.nvim": { "branch": "main", "commit": "e110bc3be1a7309617cecd77bfe4bf86ba1b8134" }, + "mini.ai": { "branch": "main", "commit": "f7787cff9cc42004f722ca1e64e6af4e64e34177" }, + "mini.comment": { "branch": "main", "commit": "67f00d3ebbeae15e84584d971d0c32aad4f4f3a4" }, + "mini.surround": { "branch": "main", "commit": "7bf8915ba15d7a4f3c2afe7868d3c15a858d73f1" }, "neo-tree.nvim": { "branch": "v3.x", "commit": "71f1841ba6c652908678cece623f52c1fea8a6cd" }, - "nui.nvim": { "branch": "main", "commit": "c0c8e347ceac53030f5c1ece1c5a5b6a17a25b32" }, - "nvim-autopairs": { "branch": "master", "commit": "0f04d78619cce9a5af4f355968040f7d675854a1" }, - "nvim-cmp": { "branch": "main", "commit": "0b751f6beef40fd47375eaf53d3057e0bfa317e4" }, - "nvim-lspconfig": { "branch": "master", "commit": "90a28fd7637b66e055af62387ecee06f7cbd3173" }, - "nvim-treesitter": { "branch": "master", "commit": "075a64addc33390028ea124a1046a43497f05cd1" }, - "nvim-treesitter-context": { "branch": "master", "commit": "c03f8aab1e6649036d69ba7e3af4d09cb7e4d977" }, - "nvim-treesitter-textobjects": { "branch": "master", "commit": "dbcd9388e3b119a87c785e10a00d62876077d23d" }, - "nvim-ts-autotag": { "branch": "main", "commit": "6be1192965df35f94b8ea6d323354f7dc7a557e4" }, - "nvim-ts-context-commentstring": { "branch": "main", "commit": "6c30f3c8915d7b31c3decdfe6c7672432da1809d" }, - "nvim-web-devicons": { "branch": "master", "commit": "3fafeea5f339223e888fd15eb4032260849cb038" }, - "plenary.nvim": { "branch": "master", "commit": "50012918b2fc8357b87cff2a7f7f0446e47da174" }, + "nui.nvim": { "branch": "main", "commit": "35da9ca1de0fc4dda96c2e214d93d363c145f418" }, + "nvim-autopairs": { "branch": "master", "commit": "9fd41181693dd4106b3e414a822bb6569924de81" }, + "nvim-cmp": { "branch": "main", "commit": "538e37ba87284942c1d76ed38dd497e54e65b891" }, + "nvim-lspconfig": { "branch": "master", "commit": "7eed8b2150192e5ad05e1886fdf133493ddf2928" }, + "nvim-treesitter": { "branch": "master", "commit": "842507a578704157e6c8f8f26befcb3b3a880efb" }, + "nvim-treesitter-context": { "branch": "master", "commit": "2017a0d7fc2d3790d823feddedada506984a10ce" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "19a91a38b02c1c28c14e0ba468d20ae1423c39b2" }, + "nvim-ts-autotag": { "branch": "main", "commit": "8515e48a277a2f4947d91004d9aa92c29fdc5e18" }, + "nvim-ts-context-commentstring": { "branch": "main", "commit": "1277b4a1f451b0f18c0790e1a7f12e1e5fdebfee" }, + "nvim-web-devicons": { "branch": "master", "commit": "140edfcf25093e8b321d13e154cbce89ee868ca0" }, + "plenary.nvim": { "branch": "master", "commit": "55d9fe89e33efd26f532ef20223e5f9430c8b0c0" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" }, - "telescope.nvim": { "branch": "0.1.x", "commit": "7011eaae0ac1afe036e30c95cf80200b8dc3f21a" }, + "telescope.nvim": { "branch": "0.1.x", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" }, "undotree": { "branch": "master", "commit": "36ff7abb6b60980338344982ad4cdf03f7961ecd" }, - "vim-dadbod": { "branch": "master", "commit": "fecf5a3ecfb1869f34252c7c27351de99f01ab0e" }, - "vim-dadbod-completion": { "branch": "master", "commit": "bcdf3ff768cc7e544a0f78b0383d8719c2116569" }, - "vim-dadbod-ui": { "branch": "master", "commit": "95fd22469507e86b78aa55d868c14108adee2881" }, - "vim-fugitive": { "branch": "master", "commit": "46eaf8918b347906789df296143117774e827616" }, + "vim-dadbod": { "branch": "master", "commit": "738cfc2ea6a1510fe23cba9006fef9291be70f7b" }, + "vim-dadbod-completion": { "branch": "master", "commit": "c920cb0ba3dff4b1b0ed373e1c0b3007dec696c2" }, + "vim-dadbod-ui": { "branch": "master", "commit": "e99dcfd5162d9b9b4b24a5d035cf114315f1aeec" }, + "vim-fugitive": { "branch": "master", "commit": "59659093581aad2afacedc81f009ed6a4bfad275" }, "vim-rhubarb": { "branch": "master", "commit": "ee69335de176d9325267b0fd2597a22901d927b1" }, "vim-sleuth": { "branch": "master", "commit": "1cc4557420f215d02c4d2645a748a816c220e99b" }, "which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" } From b802ca4a290ca0290e19846040f0eeadf4f82b07 Mon Sep 17 00:00:00 2001 From: Oluwatobi Date: Mon, 22 Jan 2024 13:52:41 +0100 Subject: [PATCH 09/40] updated --- after/plugin/conform-config.lua | 1 + after/plugin/ts-context-commentstring.lua | 1 - lazy-lock.json | 29 +++++++++++------------ lua/plugins/treesitter.lua | 2 +- 4 files changed, 16 insertions(+), 17 deletions(-) delete mode 100644 after/plugin/ts-context-commentstring.lua diff --git a/after/plugin/conform-config.lua b/after/plugin/conform-config.lua index e595a8bb996..feaef3ee73f 100644 --- a/after/plugin/conform-config.lua +++ b/after/plugin/conform-config.lua @@ -8,6 +8,7 @@ require('conform').setup { javascriptreact = { { 'prettier' } }, typescriptreact = { { 'prettier' } }, typescript = { { 'prettier' } }, + html = { { 'prettier' } }, go = { { 'gofumpt', 'goimports-reviser', 'golines' } }, java = { 'google-java-format' }, templ = { 'templ' }, diff --git a/after/plugin/ts-context-commentstring.lua b/after/plugin/ts-context-commentstring.lua deleted file mode 100644 index c12dbaa8366..00000000000 --- a/after/plugin/ts-context-commentstring.lua +++ /dev/null @@ -1 +0,0 @@ -require('ts_context_commentstring').setup {} diff --git a/lazy-lock.json b/lazy-lock.json index 80d8bdfbf83..971b3520ed6 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,44 +1,43 @@ { - "LuaSnip": { "branch": "master", "commit": "82108e7e31cc6fc223cc5df5cae6d89f70bb199f" }, - "alpha-nvim": { "branch": "main", "commit": "29074eeb869a6cbac9ce1fbbd04f5f5940311b32" }, - "catppuccin": { "branch": "main", "commit": "5e36ca599f4aa41bdd87fbf2c5aae4397ac55074" }, + "LuaSnip": { "branch": "master", "commit": "2dbef19461198630b3d7c39f414d09fb07d1fdd2" }, + "alpha-nvim": { "branch": "main", "commit": "4b36c1ca9ea475bdc006896657cf1ccc486aeffa" }, + "catppuccin": { "branch": "main", "commit": "048c18fc531703815f5e10765ea46ce9b2c75ae4" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" }, "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, - "conform.nvim": { "branch": "master", "commit": "cbc5745bf7519acaf3a5cbaaa677fd556aa813d7" }, + "conform.nvim": { "branch": "master", "commit": "3d59cbd01a4b74124c5a6fb23b8cc63e5c2db3d5" }, "friendly-snippets": { "branch": "main", "commit": "69a2c1675b66e002799f5eef803b87a12f593049" }, - "gitsigns.nvim": { "branch": "main", "commit": "4aaacbf5e5e2218fd05eb75703fe9e0f85335803" }, + "gitsigns.nvim": { "branch": "main", "commit": "c5ff7628e19a47ec14d3657294cc074ecae27b99" }, "gopher.nvim": { "branch": "main", "commit": "ac27f4b6794c872140fb205313d79ab166892fe9" }, - "lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" }, + "lazy.nvim": { "branch": "main", "commit": "28126922c9b54e35a192ac415788f202c3944c9f" }, "lazygit.nvim": { "branch": "main", "commit": "1e08e3f5ac1152339690140e61a4a32b3bdc7de5" }, "lsp-zero.nvim": { "branch": "v1.x", "commit": "aa36afcf7a59fbd98008c9a434593c423d3d649a" }, "lualine.nvim": { "branch": "master", "commit": "566b7036f717f3d676362742630518a47f132fff" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "3ba1b92b771f33256b4969d696b82c8ae7075364" }, - "mason.nvim": { "branch": "main", "commit": "e110bc3be1a7309617cecd77bfe4bf86ba1b8134" }, + "mason.nvim": { "branch": "main", "commit": "9c9416817c9f4e6f333c749327a1ed5355cfab61" }, "mini.ai": { "branch": "main", "commit": "f7787cff9cc42004f722ca1e64e6af4e64e34177" }, "mini.comment": { "branch": "main", "commit": "67f00d3ebbeae15e84584d971d0c32aad4f4f3a4" }, "mini.surround": { "branch": "main", "commit": "7bf8915ba15d7a4f3c2afe7868d3c15a858d73f1" }, "neo-tree.nvim": { "branch": "v3.x", "commit": "71f1841ba6c652908678cece623f52c1fea8a6cd" }, "nui.nvim": { "branch": "main", "commit": "35da9ca1de0fc4dda96c2e214d93d363c145f418" }, - "nvim-autopairs": { "branch": "master", "commit": "9fd41181693dd4106b3e414a822bb6569924de81" }, + "nvim-autopairs": { "branch": "master", "commit": "eac31b4797ce4fa9dd546f7b98ec32305527b19e" }, "nvim-cmp": { "branch": "main", "commit": "538e37ba87284942c1d76ed38dd497e54e65b891" }, - "nvim-lspconfig": { "branch": "master", "commit": "7eed8b2150192e5ad05e1886fdf133493ddf2928" }, - "nvim-treesitter": { "branch": "master", "commit": "842507a578704157e6c8f8f26befcb3b3a880efb" }, - "nvim-treesitter-context": { "branch": "master", "commit": "2017a0d7fc2d3790d823feddedada506984a10ce" }, + "nvim-lspconfig": { "branch": "master", "commit": "8917d2c830e04bf944a699b8c41f097621283828" }, + "nvim-treesitter": { "branch": "master", "commit": "97997c928bb038457f49343ffa5304d931545584" }, + "nvim-treesitter-context": { "branch": "master", "commit": "85cf977181fb8e816e47ac05df7f756e9cb72caf" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "19a91a38b02c1c28c14e0ba468d20ae1423c39b2" }, "nvim-ts-autotag": { "branch": "main", "commit": "8515e48a277a2f4947d91004d9aa92c29fdc5e18" }, - "nvim-ts-context-commentstring": { "branch": "main", "commit": "1277b4a1f451b0f18c0790e1a7f12e1e5fdebfee" }, "nvim-web-devicons": { "branch": "master", "commit": "140edfcf25093e8b321d13e154cbce89ee868ca0" }, - "plenary.nvim": { "branch": "master", "commit": "55d9fe89e33efd26f532ef20223e5f9430c8b0c0" }, + "plenary.nvim": { "branch": "master", "commit": "663246936325062427597964d81d30eaa42ab1e4" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" }, "telescope.nvim": { "branch": "0.1.x", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" }, - "undotree": { "branch": "master", "commit": "36ff7abb6b60980338344982ad4cdf03f7961ecd" }, + "undotree": { "branch": "master", "commit": "d9c8b4ef872e078e8c4080812e5a3ed56d151c00" }, "vim-dadbod": { "branch": "master", "commit": "738cfc2ea6a1510fe23cba9006fef9291be70f7b" }, "vim-dadbod-completion": { "branch": "master", "commit": "c920cb0ba3dff4b1b0ed373e1c0b3007dec696c2" }, "vim-dadbod-ui": { "branch": "master", "commit": "e99dcfd5162d9b9b4b24a5d035cf114315f1aeec" }, - "vim-fugitive": { "branch": "master", "commit": "59659093581aad2afacedc81f009ed6a4bfad275" }, + "vim-fugitive": { "branch": "master", "commit": "854a8df0d06b8d3fcb30fa7f2b08c62b553eee3b" }, "vim-rhubarb": { "branch": "master", "commit": "ee69335de176d9325267b0fd2597a22901d927b1" }, "vim-sleuth": { "branch": "master", "commit": "1cc4557420f215d02c4d2645a748a816c220e99b" }, "which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" } diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua index 1eec17cbbb9..d056f92d35a 100644 --- a/lua/plugins/treesitter.lua +++ b/lua/plugins/treesitter.lua @@ -4,7 +4,7 @@ return { dependencies = { 'nvim-treesitter/nvim-treesitter-textobjects', 'windwp/nvim-ts-autotag', - 'JoosepAlviste/nvim-ts-context-commentstring', + -- 'JoosepAlviste/nvim-ts-context-commentstring', 'nvim-treesitter/nvim-treesitter-context', }, cmd = { From 92663adae6ac3fbb63fd503828df66bf66f6c7ab Mon Sep 17 00:00:00 2001 From: Oluwatobi Date: Tue, 6 Feb 2024 11:37:08 +0100 Subject: [PATCH 10/40] removed tx-context-commment --- after/plugin/mini-comment-config.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/after/plugin/mini-comment-config.lua b/after/plugin/mini-comment-config.lua index aa59b4b593b..0d1a09d0bf1 100644 --- a/after/plugin/mini-comment-config.lua +++ b/after/plugin/mini-comment-config.lua @@ -3,7 +3,7 @@ require('mini.comment').setup { options = { -- Function to compute custom 'commentstring' (optional) custom_commentstring = function() - return require('ts_context_commentstring.internal').calculate_commentstring() or vim.bo.commentstring + return vim.bo.commentstring end, -- Whether to ignore blank lines From f07fb6cced175463424b0d85406b2babb28d1617 Mon Sep 17 00:00:00 2001 From: Oluwatobi Date: Tue, 30 Apr 2024 10:19:08 +0100 Subject: [PATCH 11/40] added xml formatter --- after/plugin/conform-config.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/after/plugin/conform-config.lua b/after/plugin/conform-config.lua index feaef3ee73f..59bb7baaf5b 100644 --- a/after/plugin/conform-config.lua +++ b/after/plugin/conform-config.lua @@ -8,11 +8,23 @@ require('conform').setup { javascriptreact = { { 'prettier' } }, typescriptreact = { { 'prettier' } }, typescript = { { 'prettier' } }, + xml = { 'prettier', 'xmlformat' }, html = { { 'prettier' } }, go = { { 'gofumpt', 'goimports-reviser', 'golines' } }, java = { 'google-java-format' }, templ = { 'templ' }, }, + format_on_save = { + -- I recommend these options. See :help conform.format for details. + lsp_fallback = true, + timeout_ms = 500, + }, + -- If this is set, Conform will run the formatter asynchronously after save. + -- It will pass the table to conform.format(). + -- This can also be a function that returns the table. + format_after_save = { + lsp_fallback = true, + }, } vim.api.nvim_create_autocmd('BufWritePre', { From b4d295e1e4fb220f5595776ac7223cbad93b0528 Mon Sep 17 00:00:00 2001 From: Oluwatobi Date: Tue, 30 Apr 2024 10:19:27 +0100 Subject: [PATCH 12/40] updated key bind for go --- after/plugin/gopher-config.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/after/plugin/gopher-config.lua b/after/plugin/gopher-config.lua index 3016172b8af..61448df78a8 100644 --- a/after/plugin/gopher-config.lua +++ b/after/plugin/gopher-config.lua @@ -8,5 +8,8 @@ require('gopher').setup { }, } +vim.keymap.set('n', 'gsv', ':GoTagAdd validate:required', { desc = 'Add validation to struct' }) vim.keymap.set('n', 'gaj', ':GoTagAdd json', { desc = 'Add JSON Tag TO Go Struct' }) vim.keymap.set('n', 'gax', ':GoTagAdd xml', { desc = 'Add XML Tag TO Go Struct' }) +vim.keymap.set('n', 'gadb', ':GoTagAdd db', { desc = 'Add DB Tag TO Go Struct' }) +vim.keymap.set('n', 'gmt', ':GoMod tidy', { desc = 'go mod tidy' }) From 3059d0236aa7ed091ca4be804f173b140abc1089 Mon Sep 17 00:00:00 2001 From: Oluwatobi Date: Tue, 30 Apr 2024 10:20:05 +0100 Subject: [PATCH 13/40] telescope: Search to Quick Fix List --- after/plugin/telescope.lua | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/after/plugin/telescope.lua b/after/plugin/telescope.lua index 4bbc633c0d7..ee16cf2511e 100644 --- a/after/plugin/telescope.lua +++ b/after/plugin/telescope.lua @@ -28,7 +28,7 @@ vim.keymap.set('n', 'ff', require('telescope.builtin').find_files, { des vim.keymap.set('n', 'fh', require('telescope.builtin').help_tags, { desc = 'Find [H]elp' }) vim.keymap.set('n', 'fw', require('telescope.builtin').grep_string, { desc = 'Find current [W]ord' }) vim.keymap.set('n', 'fd', require('telescope.builtin').diagnostics, { desc = 'Find [D]iagnostics' }) -vim.keymap.set('n', 'fr', require('telescope.builtin').registers, { desc = 'Find [R]egister' }) +-- vim.keymap.set('n', 'fr', require('telescope.builtin').registers, { desc = 'Find [R]egister' }) vim.keymap.set('n', 'fF', function() require('telescope.builtin').find_files { hidden = true, no_ignore = true } end, { desc = '[S]earch [R]esume' }) @@ -41,3 +41,19 @@ vim.keymap.set('n', 'fG', function() end, } end, { desc = 'Find by [G]rep In all Files' }) + +-- Replace in the Quickfix list +function QuickfixReplace(search, replace) + vim.fn.setqflist {} + local bufnr = vim.fn.bufnr '%' + local lines = vim.api.nvim_buf_get_lines(bufnr, 0, -1, false) + for lnum, line in ipairs(lines) do + if string.match(line, search) then + local replaced_line = string.gsub(line, search, replace) + vim.fn.setqflist { { bufnr = bufnr, lnum = lnum, text = replaced_line } } + end + end + vim.cmd 'cwindow' +end + +vim.api.nvim_set_keymap('n', 'fr', ':lua QuickfixReplace(vim.fn.input("Search: "), vim.fn.input("Replace: "))', { noremap = true }) From a3441de62b7d2508be828d8681593c3b2647b3a7 Mon Sep 17 00:00:00 2001 From: Oluwatobi Date: Thu, 1 Aug 2024 08:48:28 +0100 Subject: [PATCH 14/40] added jarkata to java plugin --- ftplugin/java.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ftplugin/java.lua b/ftplugin/java.lua index 785f0737d53..9a80ad5dafd 100644 --- a/ftplugin/java.lua +++ b/ftplugin/java.lua @@ -75,7 +75,7 @@ local config = { runtimes = { { name = 'JavaSE-11', - path = '/Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home', + path = java_11_home_dir, }, { name = 'JavaSE-17', @@ -110,6 +110,7 @@ local config = { importOrder = { 'java', 'javax', + 'jarkata', 'com', 'org', }, From 6095f11ed23044fb33739e2b7838395a2652a546 Mon Sep 17 00:00:00 2001 From: Oluwatobi Date: Thu, 1 Aug 2024 08:48:37 +0100 Subject: [PATCH 15/40] db auto completion --- after/plugin/cmp.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/after/plugin/cmp.lua b/after/plugin/cmp.lua index 77179d4bcf2..026f5b49833 100644 --- a/after/plugin/cmp.lua +++ b/after/plugin/cmp.lua @@ -45,8 +45,16 @@ cmp.setup { { name = 'nvim_lsp' }, { name = 'luasnip' }, { name = 'path' }, + { name = 'buffer' }, { { name = 'buffer' }, }, }, } + +cmp.setup.filetype({ 'sql', 'mysql' }, { + sources = { + { name = 'vim-dadbod-completion' }, + { name = 'buffer' }, + }, +}) From a963cb72842ae0f4b98a953eebf593792a4d9cc5 Mon Sep 17 00:00:00 2001 From: Oluwatobi Date: Thu, 1 Aug 2024 08:48:44 +0100 Subject: [PATCH 16/40] split updat --- lua/thrillee/splits.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/thrillee/splits.lua b/lua/thrillee/splits.lua index 3db3eb74d4b..fd771d46182 100644 --- a/lua/thrillee/splits.lua +++ b/lua/thrillee/splits.lua @@ -11,7 +11,7 @@ vim.keymap.set('n', '--', 'split', { desc = 'Horinzontal Split' }) -- vim.keymap.set('n', '', 'l', { desc = 'Navigate right' }) vim.keymap.set('n', 'sh', 'h', { desc = 'Navigate to the left' }) -vim.keymap.set('n', 'sw', '', { desc = 'Navigate below' }) +vim.keymap.set('n', 'sj', '', { desc = 'Navigate below' }) vim.keymap.set('n', 'sk', 'k', { desc = 'Navigate up' }) vim.keymap.set('n', 'sl', 'l', { desc = 'Navigate right' }) From 00ed47465db3eb270738d2f2aa0467996649ee72 Mon Sep 17 00:00:00 2001 From: Oluwatobi Date: Thu, 1 Aug 2024 15:38:10 +0100 Subject: [PATCH 17/40] working version after update --- after/plugin/conform-config.lua | 2 - after/plugin/lsp-config.lua | 24 ++++++- after/plugin/neo-tree.lua | 115 +++++++++++++++++++++++++++++++ after/plugin/tailwind-config.lua | 17 +++++ after/plugin/which-key.lua | 11 --- lazy-lock.json | 75 ++++++++++---------- lua/plugins/catppuccin.lua | 8 +++ lua/plugins/git-fugitive.lua | 6 ++ lua/plugins/init.lua | 98 -------------------------- lua/plugins/lualine.lua | 13 ++++ lua/plugins/neo-tree.lua | 17 ++--- lua/plugins/nvim-cmp.lua | 27 ++++++++ lua/plugins/sleuth.lua | 7 ++ lua/plugins/tailwind-tools.lua | 5 ++ lua/plugins/telescope.lua | 19 +++++ lua/plugins/undotree.lua | 1 + lua/plugins/which-key.lua | 1 + 17 files changed, 288 insertions(+), 158 deletions(-) create mode 100644 after/plugin/neo-tree.lua create mode 100644 after/plugin/tailwind-config.lua delete mode 100644 after/plugin/which-key.lua create mode 100644 lua/plugins/catppuccin.lua create mode 100644 lua/plugins/git-fugitive.lua delete mode 100644 lua/plugins/init.lua create mode 100644 lua/plugins/lualine.lua create mode 100644 lua/plugins/nvim-cmp.lua create mode 100644 lua/plugins/sleuth.lua create mode 100644 lua/plugins/tailwind-tools.lua create mode 100644 lua/plugins/telescope.lua create mode 100644 lua/plugins/undotree.lua create mode 100644 lua/plugins/which-key.lua diff --git a/after/plugin/conform-config.lua b/after/plugin/conform-config.lua index 59bb7baaf5b..19f244d559d 100644 --- a/after/plugin/conform-config.lua +++ b/after/plugin/conform-config.lua @@ -1,9 +1,7 @@ require('conform').setup { formatters_by_ft = { lua = { 'stylua' }, - -- Conform will run multiple formatters sequentially python = { 'isort', 'black' }, - -- Use a sub-list to run only the first available formatter javascript = { { 'prettierd', 'prettier' } }, javascriptreact = { { 'prettier' } }, typescriptreact = { { 'prettier' } }, diff --git a/after/plugin/lsp-config.lua b/after/plugin/lsp-config.lua index b1910e7c1e4..c806fae5f2a 100644 --- a/after/plugin/lsp-config.lua +++ b/after/plugin/lsp-config.lua @@ -4,11 +4,29 @@ local lsp = require 'lsp-zero' lsp.preset 'recommended' lsp.ensure_installed { - 'gopls', - 'pyright', - 'tsserver', 'rust_analyzer', + -- Python + -- 'mypy', + -- 'black', + -- 'isort', + 'ruff_lsp', + 'pyright', + -- Java Stuffs + 'jdtls', + -- 'google-java-format', + -- Golang + -- 'gofumpt', + -- 'goimports-reviser', + -- 'golines', + 'gopls', 'templ', + 'htmx', + -- Typescript + -- 'prettier', + -- 'prettierd', + 'tsserver', + -- Others + 'tailwindcss', } -- Fix Undefined global 'vim' diff --git a/after/plugin/neo-tree.lua b/after/plugin/neo-tree.lua new file mode 100644 index 00000000000..bfdf50ad062 --- /dev/null +++ b/after/plugin/neo-tree.lua @@ -0,0 +1,115 @@ +require("neo-tree").setup({ + cmd = "Neotree", + keys = { + { + "o", + function() + if vim.bo.filetype == "neo-tree" then + vim.cmd.wincmd "p" + else + vim.cmd.Neotree "focus" + end + end, + desc = "Toggle Explorer Focus" + }, + { "", "Neotree toggle", desc = "Toggle Explorer" } + }, + init = function() vim.g.neo_tree_remove_legacy_commands = true end, + + opts = { + auto_clean_after_session_restore = true, + close_if_last_window = true, + source_selector = { + winbar = true, + content_layout = "center", + }, + commands = { + parent_or_close = function(state) + local node = state.tree:get_node() + if (node.type == "directory" or node:has_children()) and node:is_expanded() then + state.commands.toggle_node(state) + else + require("neo-tree.ui.renderer").focus_node(state, node:get_parent_id()) + end + end, + child_or_open = function(state) + local node = state.tree:get_node() + if node.type == "directory" or node:has_children() then + if not node:is_expanded() then -- if unexpanded, expand + state.commands.toggle_node(state) + else -- if expanded and has children, seleect the next child + require("neo-tree.ui.renderer").focus_node(state, node:get_child_ids()[1]) + end + else -- if not a directory just open it + state.commands.open(state) + end + end, + copy_selector = function(state) + local node = state.tree:get_node() + local filepath = node:get_id() + local filename = node.name + local modify = vim.fn.fnamemodify + + local results = { + e = { val = modify(filename, ":e"), msg = "Extension only" }, + f = { val = filename, msg = "Filename" }, + F = { val = modify(filename, ":r"), msg = "Filename w/o extension" }, + h = { val = modify(filepath, ":~"), msg = "Path relative to Home" }, + p = { val = modify(filepath, ":."), msg = "Path relative to CWD" }, + P = { val = filepath, msg = "Absolute path" }, + } + + local messages = { + { "\nChoose to copy to clipboard:\n", "Normal" }, + } + for i, result in pairs(results) do + if result.val and result.val ~= "" then + vim.list_extend(messages, { + { ("%s."):format(i), "Identifier" }, + { (" %s: "):format(result.msg) }, + { result.val, "String" }, + { "\n" }, + }) + end + end + vim.api.nvim_echo(messages, false, {}) + local result = results[vim.fn.getcharstr()] + if result and result.val and result.val ~= "" then + vim.notify("Copied: " .. result.val) + vim.fn.setreg("+", result.val) + end + end, + }, + window = { + width = 30, + mappings = { + [""] = false, -- disable space until we figure out which-key disabling + ["[b"] = "prev_source", + ["]b"] = "next_source", + o = "open", + --[[ O = "system_open", ]] + h = "parent_or_close", + l = "child_or_open", + Y = "copy_selector", + }, + }, + filesystem = { + hijack_netrw_behavior = "open_current", + use_libuv_file_watcher = true, + follow_current_file = { + enabled = true, -- This will find and focus the file in the active buffer every time + -- -- the current file is changed while the tree is open. + leave_dirs_open = false, -- `false` closes auto expanded dirs, such as with `:Neotree reveal` + }, + }, + event_handlers = { + { + event = "neo_tree_buffer_enter", + handler = function(_) + vim.opt_local.signcolumn = "auto" + -- require("neo-tree").close_all() + end, + }, + }, + }, +}) diff --git a/after/plugin/tailwind-config.lua b/after/plugin/tailwind-config.lua new file mode 100644 index 00000000000..b15db54ff84 --- /dev/null +++ b/after/plugin/tailwind-config.lua @@ -0,0 +1,17 @@ +require('tailwind-tools').setup { + document_color = { + enabled = true, -- can be toggled by commands + kind = 'inline', -- "inline" | "foreground" | "background" + inline_symbol = '󰝤 ', -- only used in inline mode + debounce = 200, -- in milliseconds, only applied in insert mode + }, + conceal = { + enabled = false, -- can be toggled by commands + min_length = nil, -- only conceal classes exceeding the provided length + symbol = '󱏿', -- only a single character is allowed + highlight = { -- extmark highlight options, see :h 'highlight' + fg = '#38BDF8', + }, + }, + custom_filetypes = {}, -- see the extension section to learn how it works +} diff --git a/after/plugin/which-key.lua b/after/plugin/which-key.lua deleted file mode 100644 index 98c0dab62bd..00000000000 --- a/after/plugin/which-key.lua +++ /dev/null @@ -1,11 +0,0 @@ --- document existing key chains -require('which-key').register({ - --[[ ['c'] = { name = '[C]ode', _ = 'which_key_ignore' }, - ['d'] = { name = '[D]ocument', _ = 'which_key_ignore' }, - ['g'] = { name = '[G]it', _ = 'which_key_ignore' }, - ['h'] = { name = 'More git', _ = 'which_key_ignore' }, - ['r'] = { name = '[R]ename', _ = 'which_key_ignore' }, - ['s'] = { name = '[S]earch', _ = 'which_key_ignore' }, ]] - ['w'] = { name = '[W]orkspace', _ = 'which_key_ignore' }, -}) - diff --git a/lazy-lock.json b/lazy-lock.json index 971b3520ed6..e49fd86ee91 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,44 +1,47 @@ { - "LuaSnip": { "branch": "master", "commit": "2dbef19461198630b3d7c39f414d09fb07d1fdd2" }, - "alpha-nvim": { "branch": "main", "commit": "4b36c1ca9ea475bdc006896657cf1ccc486aeffa" }, - "catppuccin": { "branch": "main", "commit": "048c18fc531703815f5e10765ea46ce9b2c75ae4" }, + "LuaSnip": { "branch": "master", "commit": "7552e6504ee95a9c8cfc6db53e389122ded46cd4" }, + "alpha-nvim": { "branch": "main", "commit": "41283fb402713fc8b327e60907f74e46166f4cfd" }, + "catppuccin": { "branch": "main", "commit": "10eda02ea4faa7d1f94e77a3410a4ae91c25c5f5" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, - "cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, - "conform.nvim": { "branch": "master", "commit": "3d59cbd01a4b74124c5a6fb23b8cc63e5c2db3d5" }, - "friendly-snippets": { "branch": "main", "commit": "69a2c1675b66e002799f5eef803b87a12f593049" }, - "gitsigns.nvim": { "branch": "main", "commit": "c5ff7628e19a47ec14d3657294cc074ecae27b99" }, - "gopher.nvim": { "branch": "main", "commit": "ac27f4b6794c872140fb205313d79ab166892fe9" }, - "lazy.nvim": { "branch": "main", "commit": "28126922c9b54e35a192ac415788f202c3944c9f" }, - "lazygit.nvim": { "branch": "main", "commit": "1e08e3f5ac1152339690140e61a4a32b3bdc7de5" }, + "conform.nvim": { "branch": "master", "commit": "25d48271e3d4404ba017cb92a37d3a681c1ad149" }, + "friendly-snippets": { "branch": "main", "commit": "00ebcaa159e817150bd83bfe2d51fa3b3377d5c4" }, + "gitsigns.nvim": { "branch": "main", "commit": "f074844b60f9e151970fbcdbeb8a2cd52b6ef25a" }, + "gopher.nvim": { "branch": "main", "commit": "f55c15ada8e02398000c04a96ef44d986cd01051" }, + "image.nvim": { "branch": "master", "commit": "61c76515cfc3cdac8123ece9e9761b20c3dc1315" }, + "lazy.nvim": { "branch": "main", "commit": "077102c5bfc578693f12377846d427f49bc50076" }, + "lazygit.nvim": { "branch": "main", "commit": "dc56df433bfbf107fee0139e187eb9750878fa84" }, "lsp-zero.nvim": { "branch": "v1.x", "commit": "aa36afcf7a59fbd98008c9a434593c423d3d649a" }, - "lualine.nvim": { "branch": "master", "commit": "566b7036f717f3d676362742630518a47f132fff" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "3ba1b92b771f33256b4969d696b82c8ae7075364" }, - "mason.nvim": { "branch": "main", "commit": "9c9416817c9f4e6f333c749327a1ed5355cfab61" }, - "mini.ai": { "branch": "main", "commit": "f7787cff9cc42004f722ca1e64e6af4e64e34177" }, - "mini.comment": { "branch": "main", "commit": "67f00d3ebbeae15e84584d971d0c32aad4f4f3a4" }, - "mini.surround": { "branch": "main", "commit": "7bf8915ba15d7a4f3c2afe7868d3c15a858d73f1" }, - "neo-tree.nvim": { "branch": "v3.x", "commit": "71f1841ba6c652908678cece623f52c1fea8a6cd" }, - "nui.nvim": { "branch": "main", "commit": "35da9ca1de0fc4dda96c2e214d93d363c145f418" }, - "nvim-autopairs": { "branch": "master", "commit": "eac31b4797ce4fa9dd546f7b98ec32305527b19e" }, - "nvim-cmp": { "branch": "main", "commit": "538e37ba87284942c1d76ed38dd497e54e65b891" }, - "nvim-lspconfig": { "branch": "master", "commit": "8917d2c830e04bf944a699b8c41f097621283828" }, - "nvim-treesitter": { "branch": "master", "commit": "97997c928bb038457f49343ffa5304d931545584" }, - "nvim-treesitter-context": { "branch": "master", "commit": "85cf977181fb8e816e47ac05df7f756e9cb72caf" }, - "nvim-treesitter-textobjects": { "branch": "master", "commit": "19a91a38b02c1c28c14e0ba468d20ae1423c39b2" }, - "nvim-ts-autotag": { "branch": "main", "commit": "8515e48a277a2f4947d91004d9aa92c29fdc5e18" }, - "nvim-web-devicons": { "branch": "master", "commit": "140edfcf25093e8b321d13e154cbce89ee868ca0" }, - "plenary.nvim": { "branch": "master", "commit": "663246936325062427597964d81d30eaa42ab1e4" }, - "telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" }, - "telescope.nvim": { "branch": "0.1.x", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" }, - "undotree": { "branch": "master", "commit": "d9c8b4ef872e078e8c4080812e5a3ed56d151c00" }, - "vim-dadbod": { "branch": "master", "commit": "738cfc2ea6a1510fe23cba9006fef9291be70f7b" }, - "vim-dadbod-completion": { "branch": "master", "commit": "c920cb0ba3dff4b1b0ed373e1c0b3007dec696c2" }, - "vim-dadbod-ui": { "branch": "master", "commit": "e99dcfd5162d9b9b4b24a5d035cf114315f1aeec" }, - "vim-fugitive": { "branch": "master", "commit": "854a8df0d06b8d3fcb30fa7f2b08c62b553eee3b" }, + "lspkind-nvim": { "branch": "master", "commit": "cff4ae321a91ee3473a92ea1a8c637e3a9510aec" }, + "lualine.nvim": { "branch": "master", "commit": "544dd1583f9bb27b393f598475c89809c4d5e86b" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "ba9c2f0b93deb48d0a99ae0e8d8dd36f7cc286d6" }, + "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, + "mini.ai": { "branch": "main", "commit": "45587078f323eaf41b9f701bbc04f8d1ab008979" }, + "mini.comment": { "branch": "main", "commit": "03c13e37318bdb18481311c0ac1adc9ed731caf1" }, + "mini.surround": { "branch": "main", "commit": "57caca9525cec0ea771a67326b0ee637d056078a" }, + "neo-tree.nvim": { "branch": "v3.x", "commit": "29f7c215332ba95e470811c380ddbce2cebe2af4" }, + "nui.nvim": { "branch": "main", "commit": "61574ce6e60c815b0a0c4b5655b8486ba58089a1" }, + "nvim-autopairs": { "branch": "master", "commit": "e38c5d837e755ce186ae51d2c48e1b387c4425c6" }, + "nvim-cmp": { "branch": "main", "commit": "ae644feb7b67bf1ce4260c231d1d4300b19c6f30" }, + "nvim-lspconfig": { "branch": "master", "commit": "e9b1c95d29ca9e479fc39896b31d24eed96b40a3" }, + "nvim-treesitter": { "branch": "master", "commit": "d13f0183ba93f9b5aba7359146f294abfffff9c3" }, + "nvim-treesitter-context": { "branch": "master", "commit": "2aba92ceb1479485953007f4d5adf34d0b66917e" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "34867c69838078df7d6919b130c0541c0b400c47" }, + "nvim-ts-autotag": { "branch": "main", "commit": "dc5e1687ab76ee02e0f11c5ce137f530b36e98b3" }, + "nvim-web-devicons": { "branch": "master", "commit": "5be6c4e685618b99c3210a69375b38a1202369b4" }, + "plenary.nvim": { "branch": "master", "commit": "a3e3bc82a3f95c5ed0d7201546d5d2c19b20d683" }, + "tailwind-tools.nvim": { "branch": "master", "commit": "7f1dda9ac3fb0460dfa4243656e8f00e36856385" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "cf48d4dfce44e0b9a2e19a008d6ec6ea6f01a83b" }, + "telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, + "undotree": { "branch": "master", "commit": "56c684a805fe948936cda0d1b19505b84ad7e065" }, + "vim-dadbod": { "branch": "master", "commit": "7888cb7164d69783d3dce4e0283decd26b82538b" }, + "vim-dadbod-completion": { "branch": "master", "commit": "c3ab458fb7c94c2fc4baae4e2cd5601eec9d27bc" }, + "vim-dadbod-ui": { "branch": "master", "commit": "0f51d8de368c8c6220973e8acd156d17da746f4c" }, + "vim-fugitive": { "branch": "master", "commit": "0444df68cd1cdabc7453d6bd84099458327e5513" }, "vim-rhubarb": { "branch": "master", "commit": "ee69335de176d9325267b0fd2597a22901d927b1" }, "vim-sleuth": { "branch": "master", "commit": "1cc4557420f215d02c4d2645a748a816c220e99b" }, - "which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" } -} \ No newline at end of file + "which-key.nvim": { "branch": "main", "commit": "6c1584eb76b55629702716995cca4ae2798a9cca" } +} diff --git a/lua/plugins/catppuccin.lua b/lua/plugins/catppuccin.lua new file mode 100644 index 00000000000..cf2318b68be --- /dev/null +++ b/lua/plugins/catppuccin.lua @@ -0,0 +1,8 @@ +return { + 'catppuccin/nvim', + name = 'catppuccin', + priority = 1000, + config = function() + vim.cmd.colorscheme 'catppuccin' + end, +} diff --git a/lua/plugins/git-fugitive.lua b/lua/plugins/git-fugitive.lua new file mode 100644 index 00000000000..c171ab32085 --- /dev/null +++ b/lua/plugins/git-fugitive.lua @@ -0,0 +1,6 @@ +return { + -- Git related plugins + 'tpope/vim-fugitive', + 'tpope/vim-rhubarb', + +} diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua deleted file mode 100644 index ca3fb910ad6..00000000000 --- a/lua/plugins/init.lua +++ /dev/null @@ -1,98 +0,0 @@ -return { - -- NOTE: First, some plugins that don't require any configuration - - -- Git related plugins - 'tpope/vim-fugitive', - 'tpope/vim-rhubarb', - - -- Detect tabstop and shiftwidth automatically - 'tpope/vim-sleuth', - - -- Useful plugin to show you pending keybinds. - { 'folke/which-key.nvim', opts = {} }, - - { 'mbbill/undotree' }, - - -- { - -- -- Theme inspired by Atom - -- 'navarasu/onedark.nvim', - -- priority = 1000, - -- config = function() - -- vim.cmd.colorscheme 'onedark' - -- end, - -- }, - -- - { - 'catppuccin/nvim', - name = 'catppuccin', - priority = 1000, - config = function() - vim.cmd.colorscheme 'catppuccin' - end, - }, - - { - -- Set lualine as statusline - 'nvim-lualine/lualine.nvim', - -- See `:help lualine.txt` - opts = { - options = { - icons_enabled = false, - theme = 'onedark', - component_separators = '|', - section_separators = '', - }, - }, - }, - - { - -- Autocompletion - 'hrsh7th/nvim-cmp', - dependencies = { - -- Snippet Engine & its associated nvim-cmp source - 'L3MON4D3/LuaSnip', - 'saadparwaiz1/cmp_luasnip', - - -- Adds LSP completion capabilities - 'hrsh7th/cmp-nvim-lsp', - - -- Adds a number of user-friendly snippets - 'rafamadriz/friendly-snippets', - }, - }, - - -- Fuzzy Finder (files, lsp, etc) - { - 'nvim-telescope/telescope.nvim', - branch = '0.1.x', - dependencies = { - 'nvim-lua/plenary.nvim', - -- Fuzzy Finder Algorithm which requires local dependencies to be built. - -- Only load if `make` is available. Make sure you have the system - -- requirements installed. - { - 'nvim-telescope/telescope-fzf-native.nvim', - -- NOTE: If you are having trouble with this installation, - -- refer to the README for telescope-fzf-native for more instructions. - build = 'make', - cond = function() - return vim.fn.executable 'make' == 1 - end, - }, - }, - }, - - -- 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', ]] - - -- 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 - -- up-to-date with whatever is in the kickstart repo. - -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. - -- - -- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins - -- { import = 'custom.plugins' }, -}, {} diff --git a/lua/plugins/lualine.lua b/lua/plugins/lualine.lua new file mode 100644 index 00000000000..b9a10ced098 --- /dev/null +++ b/lua/plugins/lualine.lua @@ -0,0 +1,13 @@ +return { + -- Set lualine as statusline + 'nvim-lualine/lualine.nvim', + -- See `:help lualine.txt` + opts = { + options = { + icons_enabled = false, + theme = 'onedark', + component_separators = '|', + section_separators = '', + }, + }, +} diff --git a/lua/plugins/neo-tree.lua b/lua/plugins/neo-tree.lua index 45ff96bfd50..815d1ede47f 100644 --- a/lua/plugins/neo-tree.lua +++ b/lua/plugins/neo-tree.lua @@ -1,11 +1,12 @@ return { - "nvim-neo-tree/neo-tree.nvim", - branch = "*", - dependencies = { - "nvim-lua/plenary.nvim", - "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended - "MunifTanjim/nui.nvim", - }, + "nvim-neo-tree/neo-tree.nvim", + branch = "v3.x", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-tree/nvim-web-devicons", + "MunifTanjim/nui.nvim", + "3rd/image.nvim", + }, cmd = "Neotree", keys = { { @@ -22,6 +23,7 @@ return { { "", "Neotree toggle", desc = "Toggle Explorer" } }, init = function() vim.g.neo_tree_remove_legacy_commands = true end, + opts = { auto_clean_after_session_restore = true, close_if_last_window = true, @@ -30,7 +32,6 @@ return { content_layout = "center", }, commands = { - --[[ system_open = function(state) require("astronvim.utils").system_open(state.tree:get_node():get_id()) end, ]] parent_or_close = function(state) local node = state.tree:get_node() if (node.type == "directory" or node:has_children()) and node:is_expanded() then diff --git a/lua/plugins/nvim-cmp.lua b/lua/plugins/nvim-cmp.lua new file mode 100644 index 00000000000..aa03ed1a3d8 --- /dev/null +++ b/lua/plugins/nvim-cmp.lua @@ -0,0 +1,27 @@ +return { + -- Autocompletion + { + 'hrsh7th/nvim-cmp', + dependencies = { + 'luckasRanarison/tailwind-tools.nvim', + 'onsails/lspkind-nvim', + -- Snippet Engine & its associated nvim-cmp source + 'L3MON4D3/LuaSnip', + 'saadparwaiz1/cmp_luasnip', + -- Adds LSP completion capabilities + 'hrsh7th/cmp-nvim-lsp', + -- Adds a number of user-friendly snippets + 'rafamadriz/friendly-snippets', + }, + opts = function() + return { + -- ... + formatting = { + format = require('lspkind').cmp_format { + before = require('tailwind-tools.cmp').lspkind_format, + }, + }, + } + end, + }, +} diff --git a/lua/plugins/sleuth.lua b/lua/plugins/sleuth.lua new file mode 100644 index 00000000000..5654a920455 --- /dev/null +++ b/lua/plugins/sleuth.lua @@ -0,0 +1,7 @@ +return { + 'tpope/vim-sleuth', + config = function() + -- Your configuration for vim-sleuth goes here + end, + opts = {}, +} diff --git a/lua/plugins/tailwind-tools.lua b/lua/plugins/tailwind-tools.lua new file mode 100644 index 00000000000..82140ecc9e3 --- /dev/null +++ b/lua/plugins/tailwind-tools.lua @@ -0,0 +1,5 @@ +return { + 'luckasRanarison/tailwind-tools.nvim', + dependencies = { 'nvim-treesitter/nvim-treesitter' }, + opts = {}, -- your configuration +} diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua new file mode 100644 index 00000000000..d20ee888202 --- /dev/null +++ b/lua/plugins/telescope.lua @@ -0,0 +1,19 @@ +return { + 'nvim-telescope/telescope.nvim', + branch = '0.1.x', + dependencies = { + 'nvim-lua/plenary.nvim', + -- Fuzzy Finder Algorithm which requires local dependencies to be built. + -- Only load if `make` is available. Make sure you have the system + -- requirements installed. + { + 'nvim-telescope/telescope-fzf-native.nvim', + -- NOTE: If you are having trouble with this installation, + -- refer to the README for telescope-fzf-native for more instructions. + build = 'make', + cond = function() + return vim.fn.executable 'make' == 1 + end, + }, + }, + } diff --git a/lua/plugins/undotree.lua b/lua/plugins/undotree.lua new file mode 100644 index 00000000000..7774a4a9eaf --- /dev/null +++ b/lua/plugins/undotree.lua @@ -0,0 +1 @@ +return { 'mbbill/undotree' } diff --git a/lua/plugins/which-key.lua b/lua/plugins/which-key.lua new file mode 100644 index 00000000000..ab4e2caa6a5 --- /dev/null +++ b/lua/plugins/which-key.lua @@ -0,0 +1 @@ +return { 'folke/which-key.nvim', opts = {} } From 081d908c8662f4c4838c8e77970afa9955c9aa4b Mon Sep 17 00:00:00 2001 From: Oluwatobi Date: Thu, 1 Aug 2024 18:08:32 +0100 Subject: [PATCH 18/40] updated neotree --- after/plugin/neo-tree.lua | 115 -------------------------------------- lazy-lock.json | 1 + lua/plugins/neo-tree.lua | 114 +++++++++++++++++++++---------------- 3 files changed, 67 insertions(+), 163 deletions(-) delete mode 100644 after/plugin/neo-tree.lua diff --git a/after/plugin/neo-tree.lua b/after/plugin/neo-tree.lua deleted file mode 100644 index bfdf50ad062..00000000000 --- a/after/plugin/neo-tree.lua +++ /dev/null @@ -1,115 +0,0 @@ -require("neo-tree").setup({ - cmd = "Neotree", - keys = { - { - "o", - function() - if vim.bo.filetype == "neo-tree" then - vim.cmd.wincmd "p" - else - vim.cmd.Neotree "focus" - end - end, - desc = "Toggle Explorer Focus" - }, - { "", "Neotree toggle", desc = "Toggle Explorer" } - }, - init = function() vim.g.neo_tree_remove_legacy_commands = true end, - - opts = { - auto_clean_after_session_restore = true, - close_if_last_window = true, - source_selector = { - winbar = true, - content_layout = "center", - }, - commands = { - parent_or_close = function(state) - local node = state.tree:get_node() - if (node.type == "directory" or node:has_children()) and node:is_expanded() then - state.commands.toggle_node(state) - else - require("neo-tree.ui.renderer").focus_node(state, node:get_parent_id()) - end - end, - child_or_open = function(state) - local node = state.tree:get_node() - if node.type == "directory" or node:has_children() then - if not node:is_expanded() then -- if unexpanded, expand - state.commands.toggle_node(state) - else -- if expanded and has children, seleect the next child - require("neo-tree.ui.renderer").focus_node(state, node:get_child_ids()[1]) - end - else -- if not a directory just open it - state.commands.open(state) - end - end, - copy_selector = function(state) - local node = state.tree:get_node() - local filepath = node:get_id() - local filename = node.name - local modify = vim.fn.fnamemodify - - local results = { - e = { val = modify(filename, ":e"), msg = "Extension only" }, - f = { val = filename, msg = "Filename" }, - F = { val = modify(filename, ":r"), msg = "Filename w/o extension" }, - h = { val = modify(filepath, ":~"), msg = "Path relative to Home" }, - p = { val = modify(filepath, ":."), msg = "Path relative to CWD" }, - P = { val = filepath, msg = "Absolute path" }, - } - - local messages = { - { "\nChoose to copy to clipboard:\n", "Normal" }, - } - for i, result in pairs(results) do - if result.val and result.val ~= "" then - vim.list_extend(messages, { - { ("%s."):format(i), "Identifier" }, - { (" %s: "):format(result.msg) }, - { result.val, "String" }, - { "\n" }, - }) - end - end - vim.api.nvim_echo(messages, false, {}) - local result = results[vim.fn.getcharstr()] - if result and result.val and result.val ~= "" then - vim.notify("Copied: " .. result.val) - vim.fn.setreg("+", result.val) - end - end, - }, - window = { - width = 30, - mappings = { - [""] = false, -- disable space until we figure out which-key disabling - ["[b"] = "prev_source", - ["]b"] = "next_source", - o = "open", - --[[ O = "system_open", ]] - h = "parent_or_close", - l = "child_or_open", - Y = "copy_selector", - }, - }, - filesystem = { - hijack_netrw_behavior = "open_current", - use_libuv_file_watcher = true, - follow_current_file = { - enabled = true, -- This will find and focus the file in the active buffer every time - -- -- the current file is changed while the tree is open. - leave_dirs_open = false, -- `false` closes auto expanded dirs, such as with `:Neotree reveal` - }, - }, - event_handlers = { - { - event = "neo_tree_buffer_enter", - handler = function(_) - vim.opt_local.signcolumn = "auto" - -- require("neo-tree").close_all() - end, - }, - }, - }, -}) diff --git a/lazy-lock.json b/lazy-lock.json index e49fd86ee91..8085bfce8f4 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -32,6 +32,7 @@ "nvim-treesitter-textobjects": { "branch": "master", "commit": "34867c69838078df7d6919b130c0541c0b400c47" }, "nvim-ts-autotag": { "branch": "main", "commit": "dc5e1687ab76ee02e0f11c5ce137f530b36e98b3" }, "nvim-web-devicons": { "branch": "master", "commit": "5be6c4e685618b99c3210a69375b38a1202369b4" }, + "nvim-window-picker": { "branch": "main", "commit": "41cfaa428577c53552200a404ae9b3a0b5719706" }, "plenary.nvim": { "branch": "master", "commit": "a3e3bc82a3f95c5ed0d7201546d5d2c19b20d683" }, "tailwind-tools.nvim": { "branch": "master", "commit": "7f1dda9ac3fb0460dfa4243656e8f00e36856385" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "cf48d4dfce44e0b9a2e19a008d6ec6ea6f01a83b" }, diff --git a/lua/plugins/neo-tree.lua b/lua/plugins/neo-tree.lua index 815d1ede47f..9fba323e417 100644 --- a/lua/plugins/neo-tree.lua +++ b/lua/plugins/neo-tree.lua @@ -1,52 +1,70 @@ return { - "nvim-neo-tree/neo-tree.nvim", - branch = "v3.x", - dependencies = { - "nvim-lua/plenary.nvim", - "nvim-tree/nvim-web-devicons", - "MunifTanjim/nui.nvim", - "3rd/image.nvim", + 'nvim-neo-tree/neo-tree.nvim', + branch = 'v3.x', + dependencies = { + 'nvim-lua/plenary.nvim', + 'nvim-tree/nvim-web-devicons', + 'MunifTanjim/nui.nvim', + '3rd/image.nvim', + { + 's1n7ax/nvim-window-picker', + version = '2.*', + config = function() + require('window-picker').setup { + filter_rules = { + include_current_win = false, + autoselect_one = true, + bo = { + filetype = { 'neo-tree', 'neo-tree-popup', 'notify' }, + buftype = { 'terminal', 'quickfix' }, + }, + }, + } + end, }, - cmd = "Neotree", + }, + cmd = 'Neotree', keys = { { - "o", + 'o', function() - if vim.bo.filetype == "neo-tree" then - vim.cmd.wincmd "p" + if vim.bo.filetype == 'neo-tree' then + vim.cmd.wincmd 'p' else - vim.cmd.Neotree "focus" + vim.cmd.Neotree 'focus' end end, - desc = "Toggle Explorer Focus" + desc = 'Toggle Explorer Focus', }, - { "", "Neotree toggle", desc = "Toggle Explorer" } + { '', 'Neotree toggle', desc = 'Toggle Explorer' }, }, - init = function() vim.g.neo_tree_remove_legacy_commands = true end, + init = function() + vim.g.neo_tree_remove_legacy_commands = true + end, opts = { auto_clean_after_session_restore = true, close_if_last_window = true, source_selector = { winbar = true, - content_layout = "center", + content_layout = 'center', }, commands = { parent_or_close = function(state) local node = state.tree:get_node() - if (node.type == "directory" or node:has_children()) and node:is_expanded() then + if (node.type == 'directory' or node:has_children()) and node:is_expanded() then state.commands.toggle_node(state) else - require("neo-tree.ui.renderer").focus_node(state, node:get_parent_id()) + require('neo-tree.ui.renderer').focus_node(state, node:get_parent_id()) end end, child_or_open = function(state) local node = state.tree:get_node() - if node.type == "directory" or node:has_children() then + if node.type == 'directory' or node:has_children() then if not node:is_expanded() then -- if unexpanded, expand state.commands.toggle_node(state) - else -- if expanded and has children, seleect the next child - require("neo-tree.ui.renderer").focus_node(state, node:get_child_ids()[1]) + else -- if expanded and has children, seleect the next child + require('neo-tree.ui.renderer').focus_node(state, node:get_child_ids()[1]) end else -- if not a directory just open it state.commands.open(state) @@ -59,62 +77,62 @@ return { local modify = vim.fn.fnamemodify local results = { - e = { val = modify(filename, ":e"), msg = "Extension only" }, - f = { val = filename, msg = "Filename" }, - F = { val = modify(filename, ":r"), msg = "Filename w/o extension" }, - h = { val = modify(filepath, ":~"), msg = "Path relative to Home" }, - p = { val = modify(filepath, ":."), msg = "Path relative to CWD" }, - P = { val = filepath, msg = "Absolute path" }, + e = { val = modify(filename, ':e'), msg = 'Extension only' }, + f = { val = filename, msg = 'Filename' }, + F = { val = modify(filename, ':r'), msg = 'Filename w/o extension' }, + h = { val = modify(filepath, ':~'), msg = 'Path relative to Home' }, + p = { val = modify(filepath, ':.'), msg = 'Path relative to CWD' }, + P = { val = filepath, msg = 'Absolute path' }, } local messages = { - { "\nChoose to copy to clipboard:\n", "Normal" }, + { '\nChoose to copy to clipboard:\n', 'Normal' }, } for i, result in pairs(results) do - if result.val and result.val ~= "" then + if result.val and result.val ~= '' then vim.list_extend(messages, { - { ("%s."):format(i), "Identifier" }, - { (" %s: "):format(result.msg) }, - { result.val, "String" }, - { "\n" }, + { ('%s.'):format(i), 'Identifier' }, + { (' %s: '):format(result.msg) }, + { result.val, 'String' }, + { '\n' }, }) end end vim.api.nvim_echo(messages, false, {}) local result = results[vim.fn.getcharstr()] - if result and result.val and result.val ~= "" then - vim.notify("Copied: " .. result.val) - vim.fn.setreg("+", result.val) + if result and result.val and result.val ~= '' then + vim.notify('Copied: ' .. result.val) + vim.fn.setreg('+', result.val) end end, }, window = { width = 30, mappings = { - [""] = false, -- disable space until we figure out which-key disabling - ["[b"] = "prev_source", - ["]b"] = "next_source", - o = "open", + [''] = false, -- disable space until we figure out which-key disabling + ['[b'] = 'prev_source', + [']b'] = 'next_source', + o = 'open', --[[ O = "system_open", ]] - h = "parent_or_close", - l = "child_or_open", - Y = "copy_selector", + h = 'parent_or_close', + l = 'child_or_open', + Y = 'copy_selector', }, }, filesystem = { - hijack_netrw_behavior = "open_current", + hijack_netrw_behavior = 'open_current', use_libuv_file_watcher = true, follow_current_file = { - enabled = true, -- This will find and focus the file in the active buffer every time + enabled = true, -- This will find and focus the file in the active buffer every time -- -- the current file is changed while the tree is open. - leave_dirs_open = false, -- `false` closes auto expanded dirs, such as with `:Neotree reveal` + leave_dirs_open = false, -- `false` closes auto expanded dirs, such as with `:Neotree reveal` }, }, event_handlers = { { - event = "neo_tree_buffer_enter", + event = 'neo_tree_buffer_enter', handler = function(_) - vim.opt_local.signcolumn = "auto" + vim.opt_local.signcolumn = 'auto' -- require("neo-tree").close_all() end, }, From b0b09a068cee8bd437b8cd12e69460b1bde89383 Mon Sep 17 00:00:00 2001 From: Oluwatobi Date: Fri, 25 Oct 2024 12:48:56 +0100 Subject: [PATCH 19/40] added java plugin --- after/plugin/java-config.lua | 2 + after/plugin/lsp-config.lua | 2 +- after/plugin/treesitter-config.lua | 1 + ftplugin/java.lua | 21 ++++++--- lazy-lock.json | 72 +++++++++++++++++------------- lua/plugins/java.lua | 1 + 6 files changed, 61 insertions(+), 38 deletions(-) create mode 100644 after/plugin/java-config.lua create mode 100644 lua/plugins/java.lua diff --git a/after/plugin/java-config.lua b/after/plugin/java-config.lua new file mode 100644 index 00000000000..8e5d59ec209 --- /dev/null +++ b/after/plugin/java-config.lua @@ -0,0 +1,2 @@ +require('java').setup() +require('lspconfig').jdtls.setup {} diff --git a/after/plugin/lsp-config.lua b/after/plugin/lsp-config.lua index c806fae5f2a..582bbcfed93 100644 --- a/after/plugin/lsp-config.lua +++ b/after/plugin/lsp-config.lua @@ -24,7 +24,7 @@ lsp.ensure_installed { -- Typescript -- 'prettier', -- 'prettierd', - 'tsserver', + -- 'tsserver', -- Others 'tailwindcss', } diff --git a/after/plugin/treesitter-config.lua b/after/plugin/treesitter-config.lua index 56622c69646..78f0e915555 100644 --- a/after/plugin/treesitter-config.lua +++ b/after/plugin/treesitter-config.lua @@ -32,6 +32,7 @@ require('nvim-treesitter.configs').setup { 'vimdoc', 'tsx', 'html', + 'java', 'javascript', 'typescript', 'templ', diff --git a/ftplugin/java.lua b/ftplugin/java.lua index 9a80ad5dafd..fe6aab3736c 100644 --- a/ftplugin/java.lua +++ b/ftplugin/java.lua @@ -14,7 +14,7 @@ end local jdtls_path = '/Users/oluwatobibello/.local/share/nvim/mason/packages/jdtls' local path_to_lsp_server = jdtls_path .. '/config_mac' local path_to_plugins = jdtls_path .. '/plugins/' -local path_to_jar = path_to_plugins .. 'org.eclipse.equinox.launcher_1.6.400.v20210924-0641.jar' +local path_to_jar = path_to_plugins .. 'org.eclipse.equinox.launcher_*.jar' local lombok_path = path_to_plugins .. 'lombok.jar' local root_markers = { '.git', 'mvnw', 'gradlew', 'pom.xml', 'build.gradle' } @@ -27,6 +27,7 @@ local project_name = vim.fn.fnamemodify(vim.fn.getcwd(), ':p:h:t') local workspace_dir = vim.fn.stdpath 'data' .. '/site/java/workspace-root/' .. project_name os.execute('mkdir ' .. workspace_dir) +local java_21_home_dir = '/Library/Java/JavaVirtualMachines/openjdk.jdk/Contents/Home/bin/java' local java_17_home_dir = '/Library/Java/JavaVirtualMachines/zulu-17.jdk/Contents/Home' local java_11_home_dir = '/Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home' @@ -35,12 +36,18 @@ local config = { -- The command that starts the language server -- See: https://github.com/eclipse/eclipse.jdt.ls#running-from-the-command-line cmd = { - java_17_home_dir .. '/bin/java', + java_21_home_dir .. '/bin/java', '-Declipse.application=org.eclipse.jdt.ls.core.id1', '-Dosgi.bundles.defaultStartLevel=4', '-Declipse.product=org.eclipse.jdt.ls.core.product', '-Dlog.protocol=true', + '-Xmx1g', '-Dlog.level=ALL', + '--add-modules=ALL-SYSTEM', + '--add-opens', + 'java.base/java.util=ALL-UNNAMED', + '--add-opens', + 'java.base/java.lang=ALL-UNNAMED', '-javaagent:' .. lombok_path, '-Xms1g', '--add-modules=ALL-SYSTEM', @@ -66,13 +73,17 @@ local config = { -- for a list of options settings = { java = { - home = java_17_home_dir, + home = java_21_home_dir, eclipse = { downloadSources = true, }, configuration = { updateBuildConfiguration = 'interactive', runtimes = { + { + name = 'JavaSE-21', + path = java_21_home_dir, + }, { name = 'JavaSE-11', path = java_11_home_dir, @@ -109,10 +120,10 @@ local config = { }, importOrder = { 'java', - 'javax', - 'jarkata', 'com', 'org', + 'javax', + 'jarkata', }, }, sources = { diff --git a/lazy-lock.json b/lazy-lock.json index 8085bfce8f4..56800f42f99 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,48 +1,56 @@ { - "LuaSnip": { "branch": "master", "commit": "7552e6504ee95a9c8cfc6db53e389122ded46cd4" }, - "alpha-nvim": { "branch": "main", "commit": "41283fb402713fc8b327e60907f74e46166f4cfd" }, - "catppuccin": { "branch": "main", "commit": "10eda02ea4faa7d1f94e77a3410a4ae91c25c5f5" }, + "LuaSnip": { "branch": "master", "commit": "787dee55ca364cc9119787165418fe93b74c1842" }, + "alpha-nvim": { "branch": "main", "commit": "bf3c8bb8c02ed3d9644cc5bbc48e2bdc39349cd7" }, + "catppuccin": { "branch": "main", "commit": "d9ee9a35f46f0a2bda9a15b5a763fee4095428fd" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, - "conform.nvim": { "branch": "master", "commit": "25d48271e3d4404ba017cb92a37d3a681c1ad149" }, - "friendly-snippets": { "branch": "main", "commit": "00ebcaa159e817150bd83bfe2d51fa3b3377d5c4" }, - "gitsigns.nvim": { "branch": "main", "commit": "f074844b60f9e151970fbcdbeb8a2cd52b6ef25a" }, + "conform.nvim": { "branch": "master", "commit": "278376b953bcab65e2ab9508b5575d1f9a2cbac1" }, + "friendly-snippets": { "branch": "main", "commit": "de8fce94985873666bd9712ea3e49ee17aadb1ed" }, + "gitsigns.nvim": { "branch": "main", "commit": "ee7634ab4f0a6606438fe13e16cbf2065589a5ed" }, "gopher.nvim": { "branch": "main", "commit": "f55c15ada8e02398000c04a96ef44d986cd01051" }, - "image.nvim": { "branch": "master", "commit": "61c76515cfc3cdac8123ece9e9761b20c3dc1315" }, - "lazy.nvim": { "branch": "main", "commit": "077102c5bfc578693f12377846d427f49bc50076" }, - "lazygit.nvim": { "branch": "main", "commit": "dc56df433bfbf107fee0139e187eb9750878fa84" }, + "image.nvim": { "branch": "master", "commit": "88e9693e188b8464b1c426aebb4389fd9db2fcbf" }, + "lazy.nvim": { "branch": "main", "commit": "cf8ecc2c5e4332760431a33534240b0cbc6680ab" }, + "lazygit.nvim": { "branch": "main", "commit": "56760339a81cd1540d5a72fd9d93010a2677b55d" }, "lsp-zero.nvim": { "branch": "v1.x", "commit": "aa36afcf7a59fbd98008c9a434593c423d3d649a" }, - "lspkind-nvim": { "branch": "master", "commit": "cff4ae321a91ee3473a92ea1a8c637e3a9510aec" }, - "lualine.nvim": { "branch": "master", "commit": "544dd1583f9bb27b393f598475c89809c4d5e86b" }, + "lspkind-nvim": { "branch": "master", "commit": "59c3f419af48a2ffb2320cea85e44e5a95f71664" }, + "lua-async-await": { "branch": "main", "commit": "652d94df34e97abe2d4a689edbc4270e7ead1a98" }, + "lualine.nvim": { "branch": "master", "commit": "b431d228b7bbcdaea818bdc3e25b8cdbe861f056" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "ba9c2f0b93deb48d0a99ae0e8d8dd36f7cc286d6" }, "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, - "mini.ai": { "branch": "main", "commit": "45587078f323eaf41b9f701bbc04f8d1ab008979" }, - "mini.comment": { "branch": "main", "commit": "03c13e37318bdb18481311c0ac1adc9ed731caf1" }, - "mini.surround": { "branch": "main", "commit": "57caca9525cec0ea771a67326b0ee637d056078a" }, - "neo-tree.nvim": { "branch": "v3.x", "commit": "29f7c215332ba95e470811c380ddbce2cebe2af4" }, - "nui.nvim": { "branch": "main", "commit": "61574ce6e60c815b0a0c4b5655b8486ba58089a1" }, + "mini.ai": { "branch": "main", "commit": "9b9b7cfa38b4871c3e44cfe89cf6d53fd40684d9" }, + "mini.comment": { "branch": "main", "commit": "a56581c40c19fa26f2b39da72504398de3173c5a" }, + "mini.surround": { "branch": "main", "commit": "48a9795c9d352c771e1ab5dedab6063c0a2df037" }, + "neo-tree.nvim": { "branch": "v3.x", "commit": "a77af2e764c5ed4038d27d1c463fa49cd4794e07" }, + "nui.nvim": { "branch": "main", "commit": "b58e2bfda5cea347c9d58b7f11cf3012c7b3953f" }, "nvim-autopairs": { "branch": "master", "commit": "e38c5d837e755ce186ae51d2c48e1b387c4425c6" }, - "nvim-cmp": { "branch": "main", "commit": "ae644feb7b67bf1ce4260c231d1d4300b19c6f30" }, - "nvim-lspconfig": { "branch": "master", "commit": "e9b1c95d29ca9e479fc39896b31d24eed96b40a3" }, - "nvim-treesitter": { "branch": "master", "commit": "d13f0183ba93f9b5aba7359146f294abfffff9c3" }, - "nvim-treesitter-context": { "branch": "master", "commit": "2aba92ceb1479485953007f4d5adf34d0b66917e" }, - "nvim-treesitter-textobjects": { "branch": "master", "commit": "34867c69838078df7d6919b130c0541c0b400c47" }, - "nvim-ts-autotag": { "branch": "main", "commit": "dc5e1687ab76ee02e0f11c5ce137f530b36e98b3" }, - "nvim-web-devicons": { "branch": "master", "commit": "5be6c4e685618b99c3210a69375b38a1202369b4" }, + "nvim-cmp": { "branch": "main", "commit": "29fb4854573355792df9e156cb779f0d31308796" }, + "nvim-dap": { "branch": "master", "commit": "7ff6936010b7222fea2caea0f67ed77f1b7c60dd" }, + "nvim-java": { "branch": "main", "commit": "905013eb83c58bda992724b3ecbe20f60b58513f" }, + "nvim-java-core": { "branch": "main", "commit": "5b03dca22fee76524a89e1c2dc1d73a9f0b1a3bb" }, + "nvim-java-dap": { "branch": "main", "commit": "55f239532f7a3789d21ea68d1e795abc77484974" }, + "nvim-java-refactor": { "branch": "main", "commit": "ea1420fed5463c9cc976c2b4175f434b3646f0f7" }, + "nvim-java-test": { "branch": "main", "commit": "7f0f40e9c5b7eab5096d8bec6ac04251c6e81468" }, + "nvim-lspconfig": { "branch": "master", "commit": "85afd4b936acd62b578c2e2d8e86541fb972c32e" }, + "nvim-treesitter": { "branch": "master", "commit": "f6c5a58e3bbbedd2a31d04e5aa6f9997df20e3df" }, + "nvim-treesitter-context": { "branch": "master", "commit": "e7fdb4cdf0942cd6e63dd822110a93c0ec777fe5" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "0d79d169fcd45a8da464727ac893044728f121d4" }, + "nvim-ts-autotag": { "branch": "main", "commit": "e239a560f338be31337e7abc3ee42515daf23f5e" }, + "nvim-web-devicons": { "branch": "master", "commit": "19d257cf889f79f4022163c3fbb5e08639077bd8" }, "nvim-window-picker": { "branch": "main", "commit": "41cfaa428577c53552200a404ae9b3a0b5719706" }, - "plenary.nvim": { "branch": "master", "commit": "a3e3bc82a3f95c5ed0d7201546d5d2c19b20d683" }, - "tailwind-tools.nvim": { "branch": "master", "commit": "7f1dda9ac3fb0460dfa4243656e8f00e36856385" }, + "plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" }, + "spring-boot.nvim": { "branch": "main", "commit": "218c0c26c14d99feca778e4d13f5ec3e8b1b60f0" }, + "tailwind-tools.nvim": { "branch": "master", "commit": "89e560705ecd49607c63c277935c5264bb770d57" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "cf48d4dfce44e0b9a2e19a008d6ec6ea6f01a83b" }, "telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, - "undotree": { "branch": "master", "commit": "56c684a805fe948936cda0d1b19505b84ad7e065" }, - "vim-dadbod": { "branch": "master", "commit": "7888cb7164d69783d3dce4e0283decd26b82538b" }, - "vim-dadbod-completion": { "branch": "master", "commit": "c3ab458fb7c94c2fc4baae4e2cd5601eec9d27bc" }, - "vim-dadbod-ui": { "branch": "master", "commit": "0f51d8de368c8c6220973e8acd156d17da746f4c" }, - "vim-fugitive": { "branch": "master", "commit": "0444df68cd1cdabc7453d6bd84099458327e5513" }, + "undotree": { "branch": "master", "commit": "78b5241191852ffa9bb5da5ff2ee033160798c3b" }, + "vim-dadbod": { "branch": "master", "commit": "fe5a55e92b2dded7c404006147ef97fb073d8b1b" }, + "vim-dadbod-completion": { "branch": "master", "commit": "880f7e9f2959e567c718d52550f9fae1aa07aa81" }, + "vim-dadbod-ui": { "branch": "master", "commit": "f29c85ab42861c6ef683289b0c6a51e0d436dcf6" }, + "vim-fugitive": { "branch": "master", "commit": "d4877e54cef67f5af4f950935b1ade19ed6b7370" }, "vim-rhubarb": { "branch": "master", "commit": "ee69335de176d9325267b0fd2597a22901d927b1" }, - "vim-sleuth": { "branch": "master", "commit": "1cc4557420f215d02c4d2645a748a816c220e99b" }, - "which-key.nvim": { "branch": "main", "commit": "6c1584eb76b55629702716995cca4ae2798a9cca" } + "vim-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" }, + "which-key.nvim": { "branch": "main", "commit": "8badb359f7ab8711e2575ef75dfe6fbbd87e4821" } } diff --git a/lua/plugins/java.lua b/lua/plugins/java.lua new file mode 100644 index 00000000000..3553267b5ec --- /dev/null +++ b/lua/plugins/java.lua @@ -0,0 +1 @@ +return { 'nvim-java/nvim-java' } From a717a047cbd39a838e601e7b6c1676356cd0b460 Mon Sep 17 00:00:00 2001 From: Oluwatobi Date: Sat, 26 Oct 2024 22:22:27 +0100 Subject: [PATCH 20/40] updated formatter and java home for config config --- after/plugin/conform-config.lua | 14 +++++++------- after/plugin/java-config.lua | 18 +++++++++++++++++- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/after/plugin/conform-config.lua b/after/plugin/conform-config.lua index 19f244d559d..e6522750ca9 100644 --- a/after/plugin/conform-config.lua +++ b/after/plugin/conform-config.lua @@ -15,7 +15,7 @@ require('conform').setup { format_on_save = { -- I recommend these options. See :help conform.format for details. lsp_fallback = true, - timeout_ms = 500, + timeout_ms = 600, }, -- If this is set, Conform will run the formatter asynchronously after save. -- It will pass the table to conform.format(). @@ -25,9 +25,9 @@ require('conform').setup { }, } -vim.api.nvim_create_autocmd('BufWritePre', { - pattern = '*', - callback = function(args) - require('conform').format { bufnr = args.buf } - end, -}) +-- vim.api.nvim_create_autocmd('BufWritePre', { +-- pattern = '*', +-- callback = function(args) +-- require('conform').format { bufnr = args.buf } +-- end, +-- }) diff --git a/after/plugin/java-config.lua b/after/plugin/java-config.lua index 8e5d59ec209..ff08dcabed3 100644 --- a/after/plugin/java-config.lua +++ b/after/plugin/java-config.lua @@ -1,2 +1,18 @@ +local java_21_home_dir = '/Library/Java/JavaVirtualMachines/openjdk.jdk/Contents/Home/bin/java' + require('java').setup() -require('lspconfig').jdtls.setup {} +require('lspconfig').jdtls.setup { + settings = { + java = { + configuration = { + runtimes = { + { + name = 'JavaSE-21', + path = java_21_home_dir .. '/bin/java', + default = true, + }, + }, + }, + }, + }, +} From 0dbbd5665243b650ae127e236a4980454ab4658c Mon Sep 17 00:00:00 2001 From: Oluwatobi Date: Thu, 14 Nov 2024 11:25:16 +0100 Subject: [PATCH 21/40] updated and add vi-mongo plugin --- LICENSE | 201 +++++++++++++++++++++++++++++++++++ README.md | 187 ++++++++------------------------ after/plugin/java-config.lua | 18 ++++ lazy-lock.json | 46 ++++---- lua/plugins/vi-mongo.lua | 10 ++ 5 files changed, 295 insertions(+), 167 deletions(-) create mode 100644 LICENSE create mode 100644 lua/plugins/vi-mongo.lua diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000000..261eeb9e9f8 --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/README.md b/README.md index 4d27756c92e..c851ce78827 100644 --- a/README.md +++ b/README.md @@ -1,163 +1,60 @@ -# kickstart.nvim +
+ +
-https://github.com/kdheepak/kickstart.nvim/assets/1813121/f3ff9a2b-c31f-44df-a4fa-8a0d7b17cf7b +--- -### Introduction +## Overview -A starting point for Neovim that is: +**Vi Mongo** is an intuitive Terminal User Interface (TUI) application, written +in Go, designed to streamline and simplify the management of MongoDB databases. +Emphasizing ease of use without sacrificing functionality, Vi Mongo offers a +user-friendly command-line experience for database administrators and developers +alike. -* Small -* Single-file (with examples of moving to multi-file) -* Documented -* Modular +Visit [vi-mongo.com](https://vi-mongo.com) for more information. -This repo is meant to be used by **YOU** to begin your Neovim journey; remove the things you don't use and add what you miss. +![autocomplete](./assets/autocomplete.webp) -Kickstart.nvim targets *only* the latest ['stable'](https://github.com/neovim/neovim/releases/tag/stable) and latest ['nightly'](https://github.com/neovim/neovim/releases/tag/nightly) of Neovim. If you are experiencing issues, please make sure you have the latest versions. +## Installation -Distribution Alternatives: -- [LazyVim](https://www.lazyvim.org/): A delightful distribution maintained by @folke (the author of lazy.nvim, the package manager used here) +To install Vi Mongo, follow the instructions on the [installation page](https://vi-mongo.com/docs/installation). -### Installation +If you are using [Neovim](https://neovim.io/) you can install the plugin from [nvim-plugin](https://github.com/kopecmaciej/vi-mongo.nvim) -> **NOTE** -> [Backup](#FAQ) your previous configuration (if any exists) +## Features -Requirements: -* Make sure to review the readmes of the plugins if you are experiencing errors. In particular: - * [ripgrep](https://github.com/BurntSushi/ripgrep#installation) is required for multiple [telescope](https://github.com/nvim-telescope/telescope.nvim#suggested-dependencies) pickers. -* See [Windows Installation](#Windows-Installation) if you have trouble with `telescope-fzf-native` +- **Intuitive Navigation**: Vi Mongo's simple, intuitive interface makes it easy + to navigate and manage your MongoDB databases. +- **Fast switching between databases**: Vi Mongo allows you to fast switch + between databases. +- **Managing Documents**: Vi Mongo allows you to view, create, update, duplicate + and delete documents in your databases with ease. +- **Managing Collections**: Vi Mongo provides a simple way to manage your + collections, including the ability to create, delete collections. +- **Autocomplete**: Vi Mongo offers an autocomplete feature that suggests + collection names, database names, and MongoDB commands as you type. +- **Query History**: Vi Mongo keeps track of your query history, allowing you to + easily access and reuse previous queries. +- **Multiple Styles**: Vi Mongo supports multiple color schemes, they can be + selected in config file or add/modify easily. -Neovim's configurations are located under the following paths, depending on your OS: +## List of features to be implemented -| OS | PATH | -| :- | :--- | -| Linux | `$XDG_CONFIG_HOME/nvim`, `~/.config/nvim` | -| MacOS | `$XDG_CONFIG_HOME/nvim`, '~/.config/nvim` | -| Windows | `%userprofile%\AppData\Local\nvim\` | +[vi-mongo.com/docs/roadmap](https://vi-mongo.com/docs/roadmap) -Clone kickstart.nvim: +## Contributing -```sh -# on Linux and Mac -git clone https://github.com/nvim-lua/kickstart.nvim.git "${XDG_CONFIG_HOME:-$HOME/.config}"/nvim -``` +All contributions are welcome! +1. Create an issue +2. Fork the repository +3. Go with the flow -``` -# on Windows -git clone https://github.com/nvim-lua/kickstart.nvim.git %userprofile%\AppData\Local\nvim\ -``` +If possible please write tests for your changes. -### Post Installation - -Run the following command and then **you are ready to go**! - -```sh -nvim --headless "+Lazy! sync" +qa -``` - -### Recommended Steps - -[Fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo) this repo (so that you have your own copy that you can modify) and then installing you can install to your machine using the methods above. - -> **NOTE** -> Your fork's url will be something like this: `https://github.com//kickstart.nvim.git` - -### Configuration And Extension - -* Inside of your copy, feel free to modify any file you like! It's your copy! -* Feel free to change any of the default options in `init.lua` to better suit your needs. -* For adding plugins, there are 3 primary options: - * Add new configuration in `lua/custom/plugins/*` files, which will be auto sourced using `lazy.nvim` (uncomment the line importing the `custom/plugins` directory in the `init.lua` file to enable this) - * Modify `init.lua` with additional plugins. - * Include the `lua/kickstart/plugins/*` files in your configuration. - -You can also merge updates/changes from the repo back into your fork, to keep up-to-date with any changes for the default configuration. - -#### Example: Adding an autopairs plugin - -In the file: `lua/custom/plugins/autopairs.lua`, add: - -```lua --- File: lua/custom/plugins/autopairs.lua - -return { - "windwp/nvim-autopairs", - -- Optional dependency - dependencies = { 'hrsh7th/nvim-cmp' }, - config = function() - require("nvim-autopairs").setup {} - -- If you want to automatically add `(` after selecting a function or method - local cmp_autopairs = require('nvim-autopairs.completion.cmp') - local cmp = require('cmp') - cmp.event:on( - 'confirm_done', - cmp_autopairs.on_confirm_done() - ) - end, -} -``` - - -This will automatically install [windwp/nvim-autopairs](https://github.com/windwp/nvim-autopairs) and enable it on startup. For more information, see documentation for [lazy.nvim](https://github.com/folke/lazy.nvim). - -#### Example: Adding a file tree plugin - -In the file: `lua/custom/plugins/filetree.lua`, add: - -```lua --- Unless you are still migrating, remove the deprecated commands from v1.x -vim.cmd([[ let g:neo_tree_remove_legacy_commands = 1 ]]) - -return { - "nvim-neo-tree/neo-tree.nvim", - version = "*", - dependencies = { - "nvim-lua/plenary.nvim", - "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended - "MunifTanjim/nui.nvim", - }, - config = function () - require('neo-tree').setup {} - end, -} -``` - -This will install the tree plugin and add the command `:Neotree` for you. You can explore the documentation at [neo-tree.nvim](https://github.com/nvim-neo-tree/neo-tree.nvim) for more information. - -### Contribution - -Pull-requests are welcome. The goal of this repo is not to create a Neovim configuration framework, but to offer a starting template that shows, by example, available features in Neovim. Some things that will not be included: - -* Custom language server configuration (null-ls templates) -* Theming beyond a default colorscheme necessary for LSP highlight groups - -Each PR, especially those which increase the line count, should have a description as to why the PR is necessary. - -### FAQ - -* What should I do if I already have a pre-existing neovim configuration? - * You should back it up, then delete all files associated with it. - * This includes your existing init.lua and the neovim files in `~/.local` which can be deleted with `rm -rf ~/.local/share/nvim/` - * You may also want to look at the [migration guide for lazy.nvim](https://github.com/folke/lazy.nvim#-migration-guide) -* What if I want to "uninstall" this configuration: - * See [lazy.nvim uninstall](https://github.com/folke/lazy.nvim#-uninstalling) information -* Are there any cool videos about this plugin? - * Current iteration of kickstart (coming soon) - * Here is one about the previous iteration of kickstart: [video introduction to Kickstart.nvim](https://youtu.be/stqUbv-5u2s). Note the install via init.lua no longer works as specified. Please follow the install instructions in this file instead as they're up to date. - -### Windows Installation - -Installation may require installing build tools, and updating the run command for `telescope-fzf-native` - -See `telescope-fzf-native` documentation for [more details](https://github.com/nvim-telescope/telescope-fzf-native.nvim#installation) - -This requires: - -- Install CMake, and the Microsoft C++ Build Tools on Windows - -```lua -{'nvim-telescope/telescope-fzf-native.nvim', build = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build' } -``` +## Issues +For now all issues are resolved, but if you find any new issues, please report +them in the [GitHub Issues](https://github.com/kopecmaciej/vi-mongo/issues) +page. diff --git a/after/plugin/java-config.lua b/after/plugin/java-config.lua index ff08dcabed3..af5d7649d69 100644 --- a/after/plugin/java-config.lua +++ b/after/plugin/java-config.lua @@ -16,3 +16,21 @@ require('lspconfig').jdtls.setup { }, }, } + +local function is_java_file() + return vim.bo.filetype == 'java' +end + +-- Function to run the Maven Wildfly redeploy command +local function redeploy_wildfly() + vim.cmd '!mvn wildfly:redeploy' +end + +-- Create the keymap +vim.keymap.set('n', 'jd', function() + if is_java_file() then + redeploy_wildfly() + else + vim.notify 'This keymap only works for Java files.' + end +end, { desc = 'Redeploy Wildfly' }) diff --git a/lazy-lock.json b/lazy-lock.json index 56800f42f99..db3a4ddad38 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,56 +1,58 @@ { - "LuaSnip": { "branch": "master", "commit": "787dee55ca364cc9119787165418fe93b74c1842" }, + "LuaSnip": { "branch": "master", "commit": "659c4479529a05cc9b05ef762639a09d366cc690" }, "alpha-nvim": { "branch": "main", "commit": "bf3c8bb8c02ed3d9644cc5bbc48e2bdc39349cd7" }, - "catppuccin": { "branch": "main", "commit": "d9ee9a35f46f0a2bda9a15b5a763fee4095428fd" }, + "catppuccin": { "branch": "main", "commit": "637d99e638bc6f1efedac582f6ccab08badac0c6" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, - "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, - "conform.nvim": { "branch": "master", "commit": "278376b953bcab65e2ab9508b5575d1f9a2cbac1" }, + "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, + "conform.nvim": { "branch": "master", "commit": "023f795dbcf32d4351b6a9ed2e613d471b5bb812" }, "friendly-snippets": { "branch": "main", "commit": "de8fce94985873666bd9712ea3e49ee17aadb1ed" }, - "gitsigns.nvim": { "branch": "main", "commit": "ee7634ab4f0a6606438fe13e16cbf2065589a5ed" }, + "gitsigns.nvim": { "branch": "main", "commit": "9521fe8be39255b9abc6ec54e352bf04c410f5cf" }, "gopher.nvim": { "branch": "main", "commit": "f55c15ada8e02398000c04a96ef44d986cd01051" }, - "image.nvim": { "branch": "master", "commit": "88e9693e188b8464b1c426aebb4389fd9db2fcbf" }, - "lazy.nvim": { "branch": "main", "commit": "cf8ecc2c5e4332760431a33534240b0cbc6680ab" }, + "hererocks": { "branch": "master", "commit": "c9c5444dea1e07e005484014a8231aa667be30b6" }, + "image.nvim": { "branch": "master", "commit": "7f61c1940a8b072ca47a28928d2375dc1e11f464" }, + "lazy.nvim": { "branch": "main", "commit": "7967abe55752aa90532e6bb4bd4663fe27a264cb" }, "lazygit.nvim": { "branch": "main", "commit": "56760339a81cd1540d5a72fd9d93010a2677b55d" }, "lsp-zero.nvim": { "branch": "v1.x", "commit": "aa36afcf7a59fbd98008c9a434593c423d3d649a" }, - "lspkind-nvim": { "branch": "master", "commit": "59c3f419af48a2ffb2320cea85e44e5a95f71664" }, + "lspkind-nvim": { "branch": "master", "commit": "a700f1436d4a938b1a1a93c9962dc796afbaef4d" }, "lua-async-await": { "branch": "main", "commit": "652d94df34e97abe2d4a689edbc4270e7ead1a98" }, - "lualine.nvim": { "branch": "master", "commit": "b431d228b7bbcdaea818bdc3e25b8cdbe861f056" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "ba9c2f0b93deb48d0a99ae0e8d8dd36f7cc286d6" }, + "lualine.nvim": { "branch": "master", "commit": "2a5bae925481f999263d6f5ed8361baef8df4f83" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "4d0e5b49363cac187326998b96aa6a2884e0e89b" }, "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, - "mini.ai": { "branch": "main", "commit": "9b9b7cfa38b4871c3e44cfe89cf6d53fd40684d9" }, + "mini.ai": { "branch": "main", "commit": "31c149067d38b97720d2a179619f7745a0006ecc" }, "mini.comment": { "branch": "main", "commit": "a56581c40c19fa26f2b39da72504398de3173c5a" }, "mini.surround": { "branch": "main", "commit": "48a9795c9d352c771e1ab5dedab6063c0a2df037" }, "neo-tree.nvim": { "branch": "v3.x", "commit": "a77af2e764c5ed4038d27d1c463fa49cd4794e07" }, "nui.nvim": { "branch": "main", "commit": "b58e2bfda5cea347c9d58b7f11cf3012c7b3953f" }, - "nvim-autopairs": { "branch": "master", "commit": "e38c5d837e755ce186ae51d2c48e1b387c4425c6" }, - "nvim-cmp": { "branch": "main", "commit": "29fb4854573355792df9e156cb779f0d31308796" }, - "nvim-dap": { "branch": "master", "commit": "7ff6936010b7222fea2caea0f67ed77f1b7c60dd" }, + "nvim-autopairs": { "branch": "master", "commit": "ee297f215e95a60b01fde33275cc3c820eddeebe" }, + "nvim-cmp": { "branch": "main", "commit": "f17d9b4394027ff4442b298398dfcaab97e40c4f" }, + "nvim-dap": { "branch": "master", "commit": "6bf4de67dbe90271608e1c81797e5edc79ec6335" }, "nvim-java": { "branch": "main", "commit": "905013eb83c58bda992724b3ecbe20f60b58513f" }, "nvim-java-core": { "branch": "main", "commit": "5b03dca22fee76524a89e1c2dc1d73a9f0b1a3bb" }, "nvim-java-dap": { "branch": "main", "commit": "55f239532f7a3789d21ea68d1e795abc77484974" }, "nvim-java-refactor": { "branch": "main", "commit": "ea1420fed5463c9cc976c2b4175f434b3646f0f7" }, "nvim-java-test": { "branch": "main", "commit": "7f0f40e9c5b7eab5096d8bec6ac04251c6e81468" }, - "nvim-lspconfig": { "branch": "master", "commit": "85afd4b936acd62b578c2e2d8e86541fb972c32e" }, - "nvim-treesitter": { "branch": "master", "commit": "f6c5a58e3bbbedd2a31d04e5aa6f9997df20e3df" }, - "nvim-treesitter-context": { "branch": "master", "commit": "e7fdb4cdf0942cd6e63dd822110a93c0ec777fe5" }, - "nvim-treesitter-textobjects": { "branch": "master", "commit": "0d79d169fcd45a8da464727ac893044728f121d4" }, + "nvim-lspconfig": { "branch": "master", "commit": "d2d153a179ed59aa7134d7ebdf4d7dcb156efa22" }, + "nvim-treesitter": { "branch": "master", "commit": "6389ceb1758b8f62a15194e3b790e33268304cb8" }, + "nvim-treesitter-context": { "branch": "master", "commit": "158377d700596367a91ea41818f76abdbf75a232" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "3e450cd85243da99dc23ebbf14f9c70e9a0c26a4" }, "nvim-ts-autotag": { "branch": "main", "commit": "e239a560f338be31337e7abc3ee42515daf23f5e" }, "nvim-web-devicons": { "branch": "master", "commit": "19d257cf889f79f4022163c3fbb5e08639077bd8" }, "nvim-window-picker": { "branch": "main", "commit": "41cfaa428577c53552200a404ae9b3a0b5719706" }, "plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" }, "spring-boot.nvim": { "branch": "main", "commit": "218c0c26c14d99feca778e4d13f5ec3e8b1b60f0" }, - "tailwind-tools.nvim": { "branch": "master", "commit": "89e560705ecd49607c63c277935c5264bb770d57" }, + "tailwind-tools.nvim": { "branch": "master", "commit": "cfd8275caa16749b130c0eae2f737c5f66620efc" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "cf48d4dfce44e0b9a2e19a008d6ec6ea6f01a83b" }, "telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, "undotree": { "branch": "master", "commit": "78b5241191852ffa9bb5da5ff2ee033160798c3b" }, + "vi-mongo.nvim": { "branch": "master", "commit": "ac21b4de10b9409c872e81a34b41cee52bf7174c" }, "vim-dadbod": { "branch": "master", "commit": "fe5a55e92b2dded7c404006147ef97fb073d8b1b" }, - "vim-dadbod-completion": { "branch": "master", "commit": "880f7e9f2959e567c718d52550f9fae1aa07aa81" }, - "vim-dadbod-ui": { "branch": "master", "commit": "f29c85ab42861c6ef683289b0c6a51e0d436dcf6" }, + "vim-dadbod-completion": { "branch": "master", "commit": "da0e75c09c27a82aad078d993bb1b2f4afd43427" }, + "vim-dadbod-ui": { "branch": "master", "commit": "39a5d69ff786ca43ca3785857c38e4e0515c6bf8" }, "vim-fugitive": { "branch": "master", "commit": "d4877e54cef67f5af4f950935b1ade19ed6b7370" }, "vim-rhubarb": { "branch": "master", "commit": "ee69335de176d9325267b0fd2597a22901d927b1" }, "vim-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" }, - "which-key.nvim": { "branch": "main", "commit": "8badb359f7ab8711e2575ef75dfe6fbbd87e4821" } + "which-key.nvim": { "branch": "main", "commit": "68e37e12913a66b60073906f5d3f14dee0de19f2" } } diff --git a/lua/plugins/vi-mongo.lua b/lua/plugins/vi-mongo.lua new file mode 100644 index 00000000000..82950134976 --- /dev/null +++ b/lua/plugins/vi-mongo.lua @@ -0,0 +1,10 @@ +return { + 'kopecmaciej/vi-mongo.nvim', + config = function() + require('vi-mongo').setup() + end, + cmd = { 'ViMongo' }, + keys = { + { 'vm', 'ViMongo', desc = 'ViMongo' }, + }, +} From d7f4690061be38f67c51f94a9d313884569416f2 Mon Sep 17 00:00:00 2001 From: Oluwatobi Date: Fri, 20 Dec 2024 11:59:59 +0100 Subject: [PATCH 22/40] temp remove isort --- after/plugin/conform-config.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/after/plugin/conform-config.lua b/after/plugin/conform-config.lua index e6522750ca9..683f66b8a99 100644 --- a/after/plugin/conform-config.lua +++ b/after/plugin/conform-config.lua @@ -1,7 +1,7 @@ require('conform').setup { formatters_by_ft = { lua = { 'stylua' }, - python = { 'isort', 'black' }, + python = { 'black' }, --'isort', javascript = { { 'prettierd', 'prettier' } }, javascriptreact = { { 'prettier' } }, typescriptreact = { { 'prettier' } }, From 74267c56fd6bbe2aa39f02d8dbb7ddaaca52ee55 Mon Sep 17 00:00:00 2001 From: Oluwatobi Date: Fri, 20 Dec 2024 12:13:34 +0100 Subject: [PATCH 23/40] updated and added folding config --- after/plugin/lsp-config.lua | 2 +- after/plugin/nvim-ufo-config.lua | 36 +++++++++++++++++ lazy-lock.json | 66 ++++++++++++++++---------------- lua/plugins/nvim-ufo.lua | 1 + 4 files changed, 72 insertions(+), 33 deletions(-) create mode 100644 after/plugin/nvim-ufo-config.lua create mode 100644 lua/plugins/nvim-ufo.lua diff --git a/after/plugin/lsp-config.lua b/after/plugin/lsp-config.lua index 582bbcfed93..e0039079526 100644 --- a/after/plugin/lsp-config.lua +++ b/after/plugin/lsp-config.lua @@ -9,7 +9,7 @@ lsp.ensure_installed { -- 'mypy', -- 'black', -- 'isort', - 'ruff_lsp', + -- 'ruff_lsp', 'pyright', -- Java Stuffs 'jdtls', diff --git a/after/plugin/nvim-ufo-config.lua b/after/plugin/nvim-ufo-config.lua new file mode 100644 index 00000000000..13ed9275683 --- /dev/null +++ b/after/plugin/nvim-ufo-config.lua @@ -0,0 +1,36 @@ +vim.o.foldcolumn = '1' -- '0' is not bad +vim.o.foldlevel = 99 -- Using ufo provider need a large value, feel free to decrease the value +vim.o.foldlevelstart = 99 +vim.o.foldenable = true + +-- Using ufo provider need remap `zR` and `zM`. If Neovim is 0.6.1, remap yourself +vim.keymap.set('n', 'zR', require('ufo').openAllFolds) +vim.keymap.set('n', 'zM', require('ufo').closeAllFolds) + +vim.keymap.set('n', 'zK', function() + local winid = require('ufo').peekFoldedLinesUnderCursor() + if not winid then + -- choose one of coc.nvim and nvim lsp + vim.fn.CocActionAsync 'definitionHover' -- coc.nvim + vim.lsp.buf.hover() + end +end) + +local capabilities = vim.lsp.protocol.make_client_capabilities() +capabilities.textDocument.foldingRange = { + dynamicRegistration = false, + lineFoldingOnly = true, +} +local language_servers = require('lspconfig').util.available_servers() -- or list servers manually like {'gopls', 'clangd'} +for _, ls in ipairs(language_servers) do + require('lspconfig')[ls].setup { + capabilities = capabilities, + -- you can add other fields for setting up lsp server in this table + } +end + +require('ufo').setup { + provider_selector = function(bufnr, filetype, buftype) + return { 'lsp', 'indent' } + end, +} diff --git a/lazy-lock.json b/lazy-lock.json index db3a4ddad38..0c255af3e5f 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,58 +1,60 @@ { - "LuaSnip": { "branch": "master", "commit": "659c4479529a05cc9b05ef762639a09d366cc690" }, - "alpha-nvim": { "branch": "main", "commit": "bf3c8bb8c02ed3d9644cc5bbc48e2bdc39349cd7" }, - "catppuccin": { "branch": "main", "commit": "637d99e638bc6f1efedac582f6ccab08badac0c6" }, + "LuaSnip": { "branch": "master", "commit": "33b06d72d220aa56a7ce80a0dd6f06c70cd82b9d" }, + "alpha-nvim": { "branch": "main", "commit": "de72250e054e5e691b9736ee30db72c65d560771" }, + "catppuccin": { "branch": "main", "commit": "faf15ab0201b564b6368ffa47b56feefc92ce3f4" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, - "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "99290b3ec1322070bcfb9e846450a46f6efa50f0" }, "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, - "conform.nvim": { "branch": "master", "commit": "023f795dbcf32d4351b6a9ed2e613d471b5bb812" }, - "friendly-snippets": { "branch": "main", "commit": "de8fce94985873666bd9712ea3e49ee17aadb1ed" }, - "gitsigns.nvim": { "branch": "main", "commit": "9521fe8be39255b9abc6ec54e352bf04c410f5cf" }, + "conform.nvim": { "branch": "master", "commit": "f4e8837878fc5712d053ba3091a73d27d96a09e2" }, + "friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" }, + "gitsigns.nvim": { "branch": "main", "commit": "5f808b5e4fef30bd8aca1b803b4e555da07fc412" }, "gopher.nvim": { "branch": "main", "commit": "f55c15ada8e02398000c04a96ef44d986cd01051" }, "hererocks": { "branch": "master", "commit": "c9c5444dea1e07e005484014a8231aa667be30b6" }, - "image.nvim": { "branch": "master", "commit": "7f61c1940a8b072ca47a28928d2375dc1e11f464" }, - "lazy.nvim": { "branch": "main", "commit": "7967abe55752aa90532e6bb4bd4663fe27a264cb" }, - "lazygit.nvim": { "branch": "main", "commit": "56760339a81cd1540d5a72fd9d93010a2677b55d" }, + "image.nvim": { "branch": "master", "commit": "b3e1af829a56bb038e5f81bf97798a2950064b62" }, + "lazy.nvim": { "branch": "main", "commit": "7e6c863bc7563efbdd757a310d17ebc95166cef3" }, + "lazygit.nvim": { "branch": "main", "commit": "77a0d42943d8265271e6e6beaed72da54eeb17e7" }, "lsp-zero.nvim": { "branch": "v1.x", "commit": "aa36afcf7a59fbd98008c9a434593c423d3d649a" }, - "lspkind-nvim": { "branch": "master", "commit": "a700f1436d4a938b1a1a93c9962dc796afbaef4d" }, + "lspkind-nvim": { "branch": "master", "commit": "d79a1c3299ad0ef94e255d045bed9fa26025dab6" }, "lua-async-await": { "branch": "main", "commit": "652d94df34e97abe2d4a689edbc4270e7ead1a98" }, "lualine.nvim": { "branch": "master", "commit": "2a5bae925481f999263d6f5ed8361baef8df4f83" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "4d0e5b49363cac187326998b96aa6a2884e0e89b" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "2daa8921b7afdcfa47419a21ea343c3df6d74fa0" }, "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, - "mini.ai": { "branch": "main", "commit": "31c149067d38b97720d2a179619f7745a0006ecc" }, + "mini.ai": { "branch": "main", "commit": "ebb04799794a7f94628153991e6334c3304961b8" }, "mini.comment": { "branch": "main", "commit": "a56581c40c19fa26f2b39da72504398de3173c5a" }, - "mini.surround": { "branch": "main", "commit": "48a9795c9d352c771e1ab5dedab6063c0a2df037" }, + "mini.surround": { "branch": "main", "commit": "aa5e245829dd12d8ff0c96ef11da28681d6049aa" }, "neo-tree.nvim": { "branch": "v3.x", "commit": "a77af2e764c5ed4038d27d1c463fa49cd4794e07" }, - "nui.nvim": { "branch": "main", "commit": "b58e2bfda5cea347c9d58b7f11cf3012c7b3953f" }, - "nvim-autopairs": { "branch": "master", "commit": "ee297f215e95a60b01fde33275cc3c820eddeebe" }, - "nvim-cmp": { "branch": "main", "commit": "f17d9b4394027ff4442b298398dfcaab97e40c4f" }, - "nvim-dap": { "branch": "master", "commit": "6bf4de67dbe90271608e1c81797e5edc79ec6335" }, - "nvim-java": { "branch": "main", "commit": "905013eb83c58bda992724b3ecbe20f60b58513f" }, + "nui.nvim": { "branch": "main", "commit": "53e907ffe5eedebdca1cd503b00aa8692068ca46" }, + "nvim-autopairs": { "branch": "master", "commit": "b464658e9b880f463b9f7e6ccddd93fb0013f559" }, + "nvim-cmp": { "branch": "main", "commit": "b555203ce4bd7ff6192e759af3362f9d217e8c89" }, + "nvim-dap": { "branch": "master", "commit": "04ce47fc5a6ef2b717f33c320fc003091cebac40" }, + "nvim-java": { "branch": "main", "commit": "a36f50c82f922f352d4ce7ac6a3c6b238b3e0a36" }, "nvim-java-core": { "branch": "main", "commit": "5b03dca22fee76524a89e1c2dc1d73a9f0b1a3bb" }, "nvim-java-dap": { "branch": "main", "commit": "55f239532f7a3789d21ea68d1e795abc77484974" }, "nvim-java-refactor": { "branch": "main", "commit": "ea1420fed5463c9cc976c2b4175f434b3646f0f7" }, "nvim-java-test": { "branch": "main", "commit": "7f0f40e9c5b7eab5096d8bec6ac04251c6e81468" }, - "nvim-lspconfig": { "branch": "master", "commit": "d2d153a179ed59aa7134d7ebdf4d7dcb156efa22" }, - "nvim-treesitter": { "branch": "master", "commit": "6389ceb1758b8f62a15194e3b790e33268304cb8" }, - "nvim-treesitter-context": { "branch": "master", "commit": "158377d700596367a91ea41818f76abdbf75a232" }, - "nvim-treesitter-textobjects": { "branch": "master", "commit": "3e450cd85243da99dc23ebbf14f9c70e9a0c26a4" }, - "nvim-ts-autotag": { "branch": "main", "commit": "e239a560f338be31337e7abc3ee42515daf23f5e" }, - "nvim-web-devicons": { "branch": "master", "commit": "19d257cf889f79f4022163c3fbb5e08639077bd8" }, + "nvim-lspconfig": { "branch": "master", "commit": "040001d85e9190a904d0e35ef5774633e14d8475" }, + "nvim-treesitter": { "branch": "master", "commit": "2405274937718d520a40e03df92030dca6b4f0fd" }, + "nvim-treesitter-context": { "branch": "master", "commit": "8fd989b6b457a448606b4a2e51f9161700f609a7" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "ad8f0a472148c3e0ae9851e26a722ee4e29b1595" }, + "nvim-ts-autotag": { "branch": "main", "commit": "1cca23c9da708047922d3895a71032bc0449c52d" }, + "nvim-ufo": { "branch": "main", "commit": "270ca542dae992ffe40274718c63645217ebc8bf" }, + "nvim-web-devicons": { "branch": "master", "commit": "0eb18da56e2ba6ba24de7130a12bcc4e31ad11cb" }, "nvim-window-picker": { "branch": "main", "commit": "41cfaa428577c53552200a404ae9b3a0b5719706" }, "plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" }, + "promise-async": { "branch": "main", "commit": "119e8961014c9bfaf1487bf3c2a393d254f337e2" }, "spring-boot.nvim": { "branch": "main", "commit": "218c0c26c14d99feca778e4d13f5ec3e8b1b60f0" }, - "tailwind-tools.nvim": { "branch": "master", "commit": "cfd8275caa16749b130c0eae2f737c5f66620efc" }, - "telescope-fzf-native.nvim": { "branch": "main", "commit": "cf48d4dfce44e0b9a2e19a008d6ec6ea6f01a83b" }, + "tailwind-tools.nvim": { "branch": "master", "commit": "3703e162d819a04b128902c508276553dae0dfb8" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "dae2eac9d91464448b584c7949a31df8faefec56" }, "telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, "undotree": { "branch": "master", "commit": "78b5241191852ffa9bb5da5ff2ee033160798c3b" }, "vi-mongo.nvim": { "branch": "master", "commit": "ac21b4de10b9409c872e81a34b41cee52bf7174c" }, - "vim-dadbod": { "branch": "master", "commit": "fe5a55e92b2dded7c404006147ef97fb073d8b1b" }, - "vim-dadbod-completion": { "branch": "master", "commit": "da0e75c09c27a82aad078d993bb1b2f4afd43427" }, - "vim-dadbod-ui": { "branch": "master", "commit": "39a5d69ff786ca43ca3785857c38e4e0515c6bf8" }, - "vim-fugitive": { "branch": "master", "commit": "d4877e54cef67f5af4f950935b1ade19ed6b7370" }, + "vim-dadbod": { "branch": "master", "commit": "f740950d0703099e0f172016f10e0e39f50fd0ba" }, + "vim-dadbod-completion": { "branch": "master", "commit": "9e354e86fcc67a5ec2c104f312e374ea2f89c799" }, + "vim-dadbod-ui": { "branch": "master", "commit": "0fec59e3e1e619e302198cd491b7d27f8d398b7c" }, + "vim-fugitive": { "branch": "master", "commit": "fcb4db52e7f65b95705aa58f0f2df1312c1f2df2" }, "vim-rhubarb": { "branch": "master", "commit": "ee69335de176d9325267b0fd2597a22901d927b1" }, "vim-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" }, - "which-key.nvim": { "branch": "main", "commit": "68e37e12913a66b60073906f5d3f14dee0de19f2" } + "which-key.nvim": { "branch": "main", "commit": "8ab96b38a2530eacba5be717f52e04601eb59326" } } diff --git a/lua/plugins/nvim-ufo.lua b/lua/plugins/nvim-ufo.lua new file mode 100644 index 00000000000..db84458d703 --- /dev/null +++ b/lua/plugins/nvim-ufo.lua @@ -0,0 +1 @@ +return { 'kevinhwang91/nvim-ufo', dependencies = 'kevinhwang91/promise-async' } From 7a730dc9d6357d3f02ab3f4bef4d65d3bacf65a4 Mon Sep 17 00:00:00 2001 From: Oluwatobi Date: Mon, 23 Dec 2024 06:56:54 +0100 Subject: [PATCH 24/40] removed java --- after/plugin/lsp-config.lua | 2 +- lazy-lock.json | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/after/plugin/lsp-config.lua b/after/plugin/lsp-config.lua index e0039079526..daf3004ea3d 100644 --- a/after/plugin/lsp-config.lua +++ b/after/plugin/lsp-config.lua @@ -12,7 +12,7 @@ lsp.ensure_installed { -- 'ruff_lsp', 'pyright', -- Java Stuffs - 'jdtls', + -- 'jdtls', -- 'google-java-format', -- Golang -- 'gofumpt', diff --git a/lazy-lock.json b/lazy-lock.json index 0c255af3e5f..cdca24fa254 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -7,7 +7,7 @@ "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, - "conform.nvim": { "branch": "master", "commit": "f4e8837878fc5712d053ba3091a73d27d96a09e2" }, + "conform.nvim": { "branch": "master", "commit": "62055b40c4d0b001c87559c7adf96a4a464bcdd5" }, "friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" }, "gitsigns.nvim": { "branch": "main", "commit": "5f808b5e4fef30bd8aca1b803b4e555da07fc412" }, "gopher.nvim": { "branch": "main", "commit": "f55c15ada8e02398000c04a96ef44d986cd01051" }, @@ -28,22 +28,20 @@ "nui.nvim": { "branch": "main", "commit": "53e907ffe5eedebdca1cd503b00aa8692068ca46" }, "nvim-autopairs": { "branch": "master", "commit": "b464658e9b880f463b9f7e6ccddd93fb0013f559" }, "nvim-cmp": { "branch": "main", "commit": "b555203ce4bd7ff6192e759af3362f9d217e8c89" }, - "nvim-dap": { "branch": "master", "commit": "04ce47fc5a6ef2b717f33c320fc003091cebac40" }, + "nvim-dap": { "branch": "master", "commit": "a6070b4e9e9a8ff1bc513c3748eff27080b0f44a" }, "nvim-java": { "branch": "main", "commit": "a36f50c82f922f352d4ce7ac6a3c6b238b3e0a36" }, "nvim-java-core": { "branch": "main", "commit": "5b03dca22fee76524a89e1c2dc1d73a9f0b1a3bb" }, "nvim-java-dap": { "branch": "main", "commit": "55f239532f7a3789d21ea68d1e795abc77484974" }, "nvim-java-refactor": { "branch": "main", "commit": "ea1420fed5463c9cc976c2b4175f434b3646f0f7" }, "nvim-java-test": { "branch": "main", "commit": "7f0f40e9c5b7eab5096d8bec6ac04251c6e81468" }, "nvim-lspconfig": { "branch": "master", "commit": "040001d85e9190a904d0e35ef5774633e14d8475" }, - "nvim-treesitter": { "branch": "master", "commit": "2405274937718d520a40e03df92030dca6b4f0fd" }, - "nvim-treesitter-context": { "branch": "master", "commit": "8fd989b6b457a448606b4a2e51f9161700f609a7" }, + "nvim-treesitter": { "branch": "master", "commit": "2a75d8065cff33216e106b651eb0f58b90375717" }, + "nvim-treesitter-context": { "branch": "master", "commit": "2bcf700b59bc92850ca83a1c02e86ba832e0fae0" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "ad8f0a472148c3e0ae9851e26a722ee4e29b1595" }, "nvim-ts-autotag": { "branch": "main", "commit": "1cca23c9da708047922d3895a71032bc0449c52d" }, - "nvim-ufo": { "branch": "main", "commit": "270ca542dae992ffe40274718c63645217ebc8bf" }, "nvim-web-devicons": { "branch": "master", "commit": "0eb18da56e2ba6ba24de7130a12bcc4e31ad11cb" }, "nvim-window-picker": { "branch": "main", "commit": "41cfaa428577c53552200a404ae9b3a0b5719706" }, "plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" }, - "promise-async": { "branch": "main", "commit": "119e8961014c9bfaf1487bf3c2a393d254f337e2" }, "spring-boot.nvim": { "branch": "main", "commit": "218c0c26c14d99feca778e4d13f5ec3e8b1b60f0" }, "tailwind-tools.nvim": { "branch": "master", "commit": "3703e162d819a04b128902c508276553dae0dfb8" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "dae2eac9d91464448b584c7949a31df8faefec56" }, From f5937893ccb03b67fe566800b387ccf96c9925c4 Mon Sep 17 00:00:00 2001 From: Oluwatobi Date: Tue, 24 Dec 2024 07:36:30 +0100 Subject: [PATCH 25/40] folding completed --- after/plugin/nvim-ufo-config.lua | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/after/plugin/nvim-ufo-config.lua b/after/plugin/nvim-ufo-config.lua index 13ed9275683..19bb044f159 100644 --- a/after/plugin/nvim-ufo-config.lua +++ b/after/plugin/nvim-ufo-config.lua @@ -11,7 +11,7 @@ vim.keymap.set('n', 'zK', function() local winid = require('ufo').peekFoldedLinesUnderCursor() if not winid then -- choose one of coc.nvim and nvim lsp - vim.fn.CocActionAsync 'definitionHover' -- coc.nvim + -- vim.fn.CocActionAsync 'definitionHover' -- coc.nvim vim.lsp.buf.hover() end end) @@ -21,13 +21,15 @@ capabilities.textDocument.foldingRange = { dynamicRegistration = false, lineFoldingOnly = true, } -local language_servers = require('lspconfig').util.available_servers() -- or list servers manually like {'gopls', 'clangd'} -for _, ls in ipairs(language_servers) do - require('lspconfig')[ls].setup { - capabilities = capabilities, - -- you can add other fields for setting up lsp server in this table - } -end + +-- local language_servers = require('lspconfig').util.available_servers() -- or list servers manually like {'gopls', 'clangd'} +-- print(language_servers) +-- for _, ls in ipairs(language_servers) do +-- require('lspconfig')[ls].setup { +-- capabilities = capabilities, +-- -- you can add other fields for setting up lsp server in this table +-- } +-- end require('ufo').setup { provider_selector = function(bufnr, filetype, buftype) From 44570ee8a79c7de089b94bbb5db7f48b449a8a51 Mon Sep 17 00:00:00 2001 From: Oluwatobi Date: Tue, 24 Dec 2024 08:14:21 +0100 Subject: [PATCH 26/40] updated java env --- .../{java-config.lua => nvim-java-config.lua} | 0 java.lua | 176 ++++++++++++++++++ lazy-lock.json | 14 +- lua/plugins/{java.lua => nvim-java.lua} | 0 nvim-jdtls.lua | 6 + 5 files changed, 190 insertions(+), 6 deletions(-) rename after/plugin/{java-config.lua => nvim-java-config.lua} (100%) create mode 100644 java.lua rename lua/plugins/{java.lua => nvim-java.lua} (100%) create mode 100644 nvim-jdtls.lua diff --git a/after/plugin/java-config.lua b/after/plugin/nvim-java-config.lua similarity index 100% rename from after/plugin/java-config.lua rename to after/plugin/nvim-java-config.lua diff --git a/java.lua b/java.lua new file mode 100644 index 00000000000..07517ee2dcd --- /dev/null +++ b/java.lua @@ -0,0 +1,176 @@ +-- Java Language Server configuration. +-- Locations: +-- 'nvim/ftplugin/java.lua'. +-- 'nvim/lang-servers/intellij-java-google-style.xml' + +-- local jdtls_ok, jdtls = pcall(require, 'jdtls') +-- if not jdtls_ok then +-- vim.notify 'JDTLS not found, install with `:LspInstall jdtls`' +-- return +-- end + +local home = os.getenv 'HOME' +local jdtls = require 'jdtls' +-- vim.notify 'Home: ' .. home + +-- See `:help vim.lsp.start_client` for an overview of the supported `config` options. +-- local jdtls_path = vim.fn.stdpath 'data' .. '/mason/packages/jdtls' +local jdtls_path = home .. '/.local/share/nvim/mason/packages/jdtls' +local path_to_lsp_server = jdtls_path .. '/config_mac' +local path_to_plugins = jdtls_path .. '/plugins/' +local path_to_jar = path_to_plugins .. 'org.eclipse.equinox.launcher_1.6.900.v20240613-2009.jar' +local lombok_path = jdtls_path .. '/lombok.jar' +local styling = home .. '/.local/share/java/eclipse-java-google-style.xml' +print(lombok_path) + +local root_markers = { '.git', 'mvnw', 'gradlew', 'pom.xml', 'build.gradle' } +local root_dir = require('jdtls.setup').find_root(root_markers) +if root_dir == '' then + return +end + +local project_name = vim.fn.fnamemodify(vim.fn.getcwd(), ':p:h:t') +local workspace_dir = vim.fn.stdpath 'data' .. '/site/java/workspace-root/' .. project_name +os.execute('mkdir ' .. workspace_dir) + +local java_21_home_dir = '/Library/Java/JavaVirtualMachines/openjdk.jdk/Contents/Home' +local java_17_home_dir = '/Library/Java/JavaVirtualMachines/zulu-17.jdk/Contents/Home' +local java_11_home_dir = '/Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home' + +-- Main Config +local config = { + -- The command that starts the language server + -- See: https://github.com/eclipse/eclipse.jdt.ls#running-from-the-command-line + cmd = { + java_21_home_dir .. '/bin/java', + '-Declipse.application=org.eclipse.jdt.ls.core.id1', + '-Dosgi.bundles.defaultStartLevel=4', + '-Declipse.product=org.eclipse.jdt.ls.core.product', + '-Dlog.protocol=true', + '-Xmx1g', + '-Dlog.level=ALL', + '--add-modules=ALL-SYSTEM', + '--add-opens', + 'java.base/java.util=ALL-UNNAMED', + '--add-opens', + 'java.base/java.lang=ALL-UNNAMED', + '-javaagent:' .. lombok_path, + '-Xms1g', + '--add-modules=ALL-SYSTEM', + '--add-opens', + 'java.base/java.util=ALL-UNNAMED', + '--add-opens', + 'java.base/java.lang=ALL-UNNAMED', + + '-jar', + path_to_jar, + '-configuration', + path_to_lsp_server, + '-data', + workspace_dir, + }, + + -- This is the default if not provided, you can remove it. Or adjust as needed. + -- One dedicated LSP server & client will be started per unique root_dir + root_dir = root_dir, + + settings = { + java = { + home = java_21_home_dir, + eclipse = { + downloadSources = true, + }, + configuration = { + updateBuildConfiguration = 'interactive', + runtimes = { + { + name = 'JavaSE-21', + path = java_21_home_dir, + }, + { + name = 'JavaSE-11', + path = java_11_home_dir, + }, + { + name = 'JavaSE-17', + path = java_17_home_dir, + }, + }, + }, + maven = { + downloadSources = true, + }, + implementationsCodeLens = { + enabled = true, + }, + referencesCodeLens = { + enabled = true, + }, + references = { + includeDecompiledSources = true, + }, + format = { + settings = { + url = styling, + profile = 'GoogleStyle', + }, + }, + }, + signatureHelp = { enabled = true }, + completion = { + favoriteStaticMembers = { + 'org.hamcrest.MatcherAssert.assertThat', + 'org.hamcrest.Matchers.*', + 'org.hamcrest.CoreMatchers.*', + 'org.junit.jupiter.api.Assertions.*', + 'java.util.Objects.requireNonNull', + 'java.util.Objects.requireNonNullElse', + 'org.mockito.Mockito.*', + }, + importOrder = { + 'java', + 'com', + 'org', + 'javax', + 'jarkata', + }, + }, + sources = { + organizeImports = { + starThreshold = 9999, + staticStarThreshold = 9999, + }, + }, + codeGeneration = { + toString = { + template = '${object.className}{${member.name()}=${member.value}, ${otherMembers}}', + }, + useBlocks = true, + }, + }, + + flags = { + allow_incremental_sync = true, + }, + init_options = { + bundles = { + vim.fn.glob(lombok_path, 1), + }, + }, +} + +-- config['on_attach'] = function(_, bufnr) +-- require('keymaps').map_java_keys(bufnr) +-- require('lsp_signature').on_attach({ +-- bind = true, -- This is mandatory, otherwise border config won't get registered. +-- floating_window_above_cur_line = false, +-- padding = '', +-- handler_opts = { +-- border = 'rounded', +-- }, +-- }, bufnr) +-- end + +-- This starts a new client & server, +-- or attaches to an existing client & server depending on the `root_dir`. +require('jdtls').start_or_attach(config) diff --git a/lazy-lock.json b/lazy-lock.json index cdca24fa254..4a24e2ed6f1 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -7,10 +7,10 @@ "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, - "conform.nvim": { "branch": "master", "commit": "62055b40c4d0b001c87559c7adf96a4a464bcdd5" }, + "conform.nvim": { "branch": "master", "commit": "339b3e4519ec49312d34fcfa275aa15bfaa67025" }, "friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" }, "gitsigns.nvim": { "branch": "main", "commit": "5f808b5e4fef30bd8aca1b803b4e555da07fc412" }, - "gopher.nvim": { "branch": "main", "commit": "f55c15ada8e02398000c04a96ef44d986cd01051" }, + "gopher.nvim": { "branch": "main", "commit": "0ed14a40d9799ac8d92aaf9eb1cd9be22ffd6b14" }, "hererocks": { "branch": "master", "commit": "c9c5444dea1e07e005484014a8231aa667be30b6" }, "image.nvim": { "branch": "master", "commit": "b3e1af829a56bb038e5f81bf97798a2950064b62" }, "lazy.nvim": { "branch": "main", "commit": "7e6c863bc7563efbdd757a310d17ebc95166cef3" }, @@ -29,19 +29,21 @@ "nvim-autopairs": { "branch": "master", "commit": "b464658e9b880f463b9f7e6ccddd93fb0013f559" }, "nvim-cmp": { "branch": "main", "commit": "b555203ce4bd7ff6192e759af3362f9d217e8c89" }, "nvim-dap": { "branch": "master", "commit": "a6070b4e9e9a8ff1bc513c3748eff27080b0f44a" }, - "nvim-java": { "branch": "main", "commit": "a36f50c82f922f352d4ce7ac6a3c6b238b3e0a36" }, + "nvim-java": { "branch": "main", "commit": "e8e84413ca03e7d0541921e795b2e6bf8801f186" }, "nvim-java-core": { "branch": "main", "commit": "5b03dca22fee76524a89e1c2dc1d73a9f0b1a3bb" }, "nvim-java-dap": { "branch": "main", "commit": "55f239532f7a3789d21ea68d1e795abc77484974" }, "nvim-java-refactor": { "branch": "main", "commit": "ea1420fed5463c9cc976c2b4175f434b3646f0f7" }, "nvim-java-test": { "branch": "main", "commit": "7f0f40e9c5b7eab5096d8bec6ac04251c6e81468" }, - "nvim-lspconfig": { "branch": "master", "commit": "040001d85e9190a904d0e35ef5774633e14d8475" }, - "nvim-treesitter": { "branch": "master", "commit": "2a75d8065cff33216e106b651eb0f58b90375717" }, + "nvim-lspconfig": { "branch": "master", "commit": "c580f34bc5fdca8aaf737a9ab8a5d775cb940e57" }, + "nvim-treesitter": { "branch": "master", "commit": "50947387c20ec3fb8c30b8c1c1a1c39f68deb970" }, "nvim-treesitter-context": { "branch": "master", "commit": "2bcf700b59bc92850ca83a1c02e86ba832e0fae0" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "ad8f0a472148c3e0ae9851e26a722ee4e29b1595" }, "nvim-ts-autotag": { "branch": "main", "commit": "1cca23c9da708047922d3895a71032bc0449c52d" }, - "nvim-web-devicons": { "branch": "master", "commit": "0eb18da56e2ba6ba24de7130a12bcc4e31ad11cb" }, + "nvim-ufo": { "branch": "main", "commit": "270ca542dae992ffe40274718c63645217ebc8bf" }, + "nvim-web-devicons": { "branch": "master", "commit": "15c7d0f616ebf88960ce5c4221828f62789d36d9" }, "nvim-window-picker": { "branch": "main", "commit": "41cfaa428577c53552200a404ae9b3a0b5719706" }, "plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" }, + "promise-async": { "branch": "main", "commit": "119e8961014c9bfaf1487bf3c2a393d254f337e2" }, "spring-boot.nvim": { "branch": "main", "commit": "218c0c26c14d99feca778e4d13f5ec3e8b1b60f0" }, "tailwind-tools.nvim": { "branch": "master", "commit": "3703e162d819a04b128902c508276553dae0dfb8" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "dae2eac9d91464448b584c7949a31df8faefec56" }, diff --git a/lua/plugins/java.lua b/lua/plugins/nvim-java.lua similarity index 100% rename from lua/plugins/java.lua rename to lua/plugins/nvim-java.lua diff --git a/nvim-jdtls.lua b/nvim-jdtls.lua new file mode 100644 index 00000000000..00044ebd1fc --- /dev/null +++ b/nvim-jdtls.lua @@ -0,0 +1,6 @@ +return { + 'mfussenegger/nvim-jdtls', + dependencies = { + 'nvim-lua/plenary.nvim', + }, +} From c1bde2c6915708d05df88994bcb8f40835377b67 Mon Sep 17 00:00:00 2001 From: Oluwatobi Date: Tue, 24 Dec 2024 09:56:50 +0100 Subject: [PATCH 27/40] stable java --- after/plugin/lsp-config.lua | 96 ++++++++-------- after/plugin/nvim-java-config.lua | 45 +++++++- after/plugin/nvim-ufo-config.lua | 13 +-- java-config.lua | 176 ++++++++++++++++++++++++++++++ java.lua | 59 ++++------ 5 files changed, 296 insertions(+), 93 deletions(-) create mode 100644 java-config.lua diff --git a/after/plugin/lsp-config.lua b/after/plugin/lsp-config.lua index daf3004ea3d..d9d0a12e183 100644 --- a/after/plugin/lsp-config.lua +++ b/after/plugin/lsp-config.lua @@ -12,7 +12,7 @@ lsp.ensure_installed { -- 'ruff_lsp', 'pyright', -- Java Stuffs - -- 'jdtls', + 'jdtls', -- 'google-java-format', -- Golang -- 'gofumpt', @@ -29,6 +29,12 @@ lsp.ensure_installed { 'tailwindcss', } +local capabilities = vim.lsp.protocol.make_client_capabilities() +capabilities.textDocument.foldingRange = { + dynamicRegistration = false, + lineFoldingOnly = true, +} + -- Fix Undefined global 'vim' lsp.nvim_workspace() @@ -58,67 +64,71 @@ lsp.set_preferences { }, } -lsp.on_attach(function(_, bufnr) +local function on_attach(client, bufnr) local opts = { buffer = bufnr, remap = false } - vim.keymap.set('n', 'gD', function() - vim.lsp.buf.declaration() - end, opts) - vim.keymap.set('n', 'K', function() - vim.lsp.buf.hover() - end, opts) - vim.keymap.set('n', 'vws', function() - vim.lsp.buf.workspace_symbol() - end, opts) - vim.keymap.set('n', 'vd', function() - vim.diagnostic.open_float() - end, opts) - - vim.keymap.set('n', '[d', function() - vim.diagnostic.goto_next() - end, opts) - - vim.keymap.set('n', ']d', function() - vim.diagnostic.goto_prev() + vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts) + vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts) + vim.keymap.set('n', 'vws', vim.lsp.buf.workspace_symbol, opts) + vim.keymap.set('n', 'vd', vim.diagnostic.open_float, opts) + vim.keymap.set('n', '[d', vim.diagnostic.goto_next, opts) + vim.keymap.set('n', ']d', vim.diagnostic.goto_prev, opts) + vim.keymap.set('n', 'dd', vim.diagnostic.setloclist, opts) + vim.keymap.set('n', 'do', vim.diagnostic.open_float, opts) + vim.keymap.set('n', 'ca', vim.lsp.buf.code_action, opts) + vim.keymap.set('n', 'gd', require('telescope.builtin').lsp_definitions, opts) + vim.keymap.set('n', 'gr', require('telescope.builtin').lsp_references, opts) + vim.keymap.set('n', 'rn', vim.lsp.buf.rename, opts) + vim.keymap.set('n', 'lf', function() + require('conform').format() + end, { buffer = bufnr, desc = 'Format Buffer' }) + vim.keymap.set('n', 'wa', vim.lsp.buf.add_workspace_folder, opts) + vim.keymap.set('n', 'wr', vim.lsp.buf.remove_workspace_folder, opts) + vim.keymap.set('n', 'wl', function() + print(vim.inspect(vim.lsp.buf.list_workspace_folders())) end, opts) +end - vim.keymap.set('n', 'dd', function() - vim.diagnostic.setloclist() - end, opts) +lsp.on_attach(on_attach) +lsp.setup() - vim.keymap.set('n', 'do', function() - vim.diagnostic.open_float() - end, opts) +vim.diagnostic.config { + virtual_text = true, +} - vim.keymap.set('n', 'ca', function() - vim.lsp.buf.code_action() - end, opts) +local function on_attach(client, bufnr) + local opts = { buffer = bufnr, remap = false } + vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts) + vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts) + vim.keymap.set('n', 'vws', vim.lsp.buf.workspace_symbol, opts) + vim.keymap.set('n', 'vd', vim.diagnostic.open_float, opts) + vim.keymap.set('n', '[d', vim.diagnostic.goto_next, opts) + vim.keymap.set('n', ']d', vim.diagnostic.goto_prev, opts) + vim.keymap.set('n', 'dd', vim.diagnostic.setloclist, opts) + vim.keymap.set('n', 'do', vim.diagnostic.open_float, opts) + vim.keymap.set('n', 'ca', vim.lsp.buf.code_action, opts) vim.keymap.set('n', 'gd', require('telescope.builtin').lsp_definitions, opts) vim.keymap.set('n', 'gr', require('telescope.builtin').lsp_references, opts) - - vim.keymap.set('n', 'rn', function() - vim.lsp.buf.rename() - end, opts) - + vim.keymap.set('n', 'rn', vim.lsp.buf.rename, opts) vim.keymap.set('n', 'lf', function() require('conform').format() - end, { desc = 'Format Buffer' }) - - -- Add WorkSpace + end, { buffer = bufnr, desc = 'Format Buffer' }) vim.keymap.set('n', 'wa', vim.lsp.buf.add_workspace_folder, opts) - - -- Remove WorkSpace vim.keymap.set('n', 'wr', vim.lsp.buf.remove_workspace_folder, opts) - - -- List WorkSpace vim.keymap.set('n', 'wl', function() print(vim.inspect(vim.lsp.buf.list_workspace_folders())) end, opts) -end) +end +lsp.on_attach(on_attach) lsp.setup() vim.diagnostic.config { virtual_text = true, } + +return { + capabilities = capabilities, + on_attach = on_attach, +} diff --git a/after/plugin/nvim-java-config.lua b/after/plugin/nvim-java-config.lua index af5d7649d69..7562139bcaf 100644 --- a/after/plugin/nvim-java-config.lua +++ b/after/plugin/nvim-java-config.lua @@ -1,14 +1,49 @@ -local java_21_home_dir = '/Library/Java/JavaVirtualMachines/openjdk.jdk/Contents/Home/bin/java' +local java_21_home_dir = '/Library/Java/JavaVirtualMachines/openjdk.jdk/Contents/Home' +local java_17_home_dir = '/Library/Java/JavaVirtualMachines/zulu-17.jdk/Contents/Home' +local java_11_home_dir = '/Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home' + +local function on_attach(client, bufnr) + local opts = { buffer = bufnr, remap = false } + + vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts) + vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts) + vim.keymap.set('n', 'vws', vim.lsp.buf.workspace_symbol, opts) + vim.keymap.set('n', 'vd', vim.diagnostic.open_float, opts) + vim.keymap.set('n', '[d', vim.diagnostic.goto_next, opts) + vim.keymap.set('n', ']d', vim.diagnostic.goto_prev, opts) + vim.keymap.set('n', 'dd', vim.diagnostic.setloclist, opts) + vim.keymap.set('n', 'do', vim.diagnostic.open_float, opts) + vim.keymap.set('n', 'ca', vim.lsp.buf.code_action, opts) + vim.keymap.set('n', 'gd', require('telescope.builtin').lsp_definitions, opts) + vim.keymap.set('n', 'gr', require('telescope.builtin').lsp_references, opts) + vim.keymap.set('n', 'rn', vim.lsp.buf.rename, opts) + vim.keymap.set('n', 'lf', function() + require('conform').format() + end, { buffer = bufnr, desc = 'Format Buffer' }) + vim.keymap.set('n', 'wa', vim.lsp.buf.add_workspace_folder, opts) + vim.keymap.set('n', 'wr', vim.lsp.buf.remove_workspace_folder, opts) + vim.keymap.set('n', 'wl', function() + print(vim.inspect(vim.lsp.buf.list_workspace_folders())) + end, opts) +end + +local capabilities = vim.lsp.protocol.make_client_capabilities() +capabilities.textDocument.foldingRange = { + dynamicRegistration = false, + lineFoldingOnly = true, +} require('java').setup() require('lspconfig').jdtls.setup { + on_attach = on_attach, + capabilities = capabilities, settings = { java = { configuration = { runtimes = { { - name = 'JavaSE-21', - path = java_21_home_dir .. '/bin/java', + name = 'JavaSE-17', + path = java_17_home_dir .. '/bin/java', default = true, }, }, @@ -34,3 +69,7 @@ vim.keymap.set('n', 'jd', function() vim.notify 'This keymap only works for Java files.' end end, { desc = 'Redeploy Wildfly' }) + +vim.diagnostic.config { + virtual_text = true, +} diff --git a/after/plugin/nvim-ufo-config.lua b/after/plugin/nvim-ufo-config.lua index 19bb044f159..29b14e86cf5 100644 --- a/after/plugin/nvim-ufo-config.lua +++ b/after/plugin/nvim-ufo-config.lua @@ -8,10 +8,8 @@ vim.keymap.set('n', 'zR', require('ufo').openAllFolds) vim.keymap.set('n', 'zM', require('ufo').closeAllFolds) vim.keymap.set('n', 'zK', function() - local winid = require('ufo').peekFoldedLinesUnderCursor() + local winid = ufo.peekFoldedLinesUnderCursor() if not winid then - -- choose one of coc.nvim and nvim lsp - -- vim.fn.CocActionAsync 'definitionHover' -- coc.nvim vim.lsp.buf.hover() end end) @@ -22,15 +20,6 @@ capabilities.textDocument.foldingRange = { lineFoldingOnly = true, } --- local language_servers = require('lspconfig').util.available_servers() -- or list servers manually like {'gopls', 'clangd'} --- print(language_servers) --- for _, ls in ipairs(language_servers) do --- require('lspconfig')[ls].setup { --- capabilities = capabilities, --- -- you can add other fields for setting up lsp server in this table --- } --- end - require('ufo').setup { provider_selector = function(bufnr, filetype, buftype) return { 'lsp', 'indent' } diff --git a/java-config.lua b/java-config.lua new file mode 100644 index 00000000000..07517ee2dcd --- /dev/null +++ b/java-config.lua @@ -0,0 +1,176 @@ +-- Java Language Server configuration. +-- Locations: +-- 'nvim/ftplugin/java.lua'. +-- 'nvim/lang-servers/intellij-java-google-style.xml' + +-- local jdtls_ok, jdtls = pcall(require, 'jdtls') +-- if not jdtls_ok then +-- vim.notify 'JDTLS not found, install with `:LspInstall jdtls`' +-- return +-- end + +local home = os.getenv 'HOME' +local jdtls = require 'jdtls' +-- vim.notify 'Home: ' .. home + +-- See `:help vim.lsp.start_client` for an overview of the supported `config` options. +-- local jdtls_path = vim.fn.stdpath 'data' .. '/mason/packages/jdtls' +local jdtls_path = home .. '/.local/share/nvim/mason/packages/jdtls' +local path_to_lsp_server = jdtls_path .. '/config_mac' +local path_to_plugins = jdtls_path .. '/plugins/' +local path_to_jar = path_to_plugins .. 'org.eclipse.equinox.launcher_1.6.900.v20240613-2009.jar' +local lombok_path = jdtls_path .. '/lombok.jar' +local styling = home .. '/.local/share/java/eclipse-java-google-style.xml' +print(lombok_path) + +local root_markers = { '.git', 'mvnw', 'gradlew', 'pom.xml', 'build.gradle' } +local root_dir = require('jdtls.setup').find_root(root_markers) +if root_dir == '' then + return +end + +local project_name = vim.fn.fnamemodify(vim.fn.getcwd(), ':p:h:t') +local workspace_dir = vim.fn.stdpath 'data' .. '/site/java/workspace-root/' .. project_name +os.execute('mkdir ' .. workspace_dir) + +local java_21_home_dir = '/Library/Java/JavaVirtualMachines/openjdk.jdk/Contents/Home' +local java_17_home_dir = '/Library/Java/JavaVirtualMachines/zulu-17.jdk/Contents/Home' +local java_11_home_dir = '/Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home' + +-- Main Config +local config = { + -- The command that starts the language server + -- See: https://github.com/eclipse/eclipse.jdt.ls#running-from-the-command-line + cmd = { + java_21_home_dir .. '/bin/java', + '-Declipse.application=org.eclipse.jdt.ls.core.id1', + '-Dosgi.bundles.defaultStartLevel=4', + '-Declipse.product=org.eclipse.jdt.ls.core.product', + '-Dlog.protocol=true', + '-Xmx1g', + '-Dlog.level=ALL', + '--add-modules=ALL-SYSTEM', + '--add-opens', + 'java.base/java.util=ALL-UNNAMED', + '--add-opens', + 'java.base/java.lang=ALL-UNNAMED', + '-javaagent:' .. lombok_path, + '-Xms1g', + '--add-modules=ALL-SYSTEM', + '--add-opens', + 'java.base/java.util=ALL-UNNAMED', + '--add-opens', + 'java.base/java.lang=ALL-UNNAMED', + + '-jar', + path_to_jar, + '-configuration', + path_to_lsp_server, + '-data', + workspace_dir, + }, + + -- This is the default if not provided, you can remove it. Or adjust as needed. + -- One dedicated LSP server & client will be started per unique root_dir + root_dir = root_dir, + + settings = { + java = { + home = java_21_home_dir, + eclipse = { + downloadSources = true, + }, + configuration = { + updateBuildConfiguration = 'interactive', + runtimes = { + { + name = 'JavaSE-21', + path = java_21_home_dir, + }, + { + name = 'JavaSE-11', + path = java_11_home_dir, + }, + { + name = 'JavaSE-17', + path = java_17_home_dir, + }, + }, + }, + maven = { + downloadSources = true, + }, + implementationsCodeLens = { + enabled = true, + }, + referencesCodeLens = { + enabled = true, + }, + references = { + includeDecompiledSources = true, + }, + format = { + settings = { + url = styling, + profile = 'GoogleStyle', + }, + }, + }, + signatureHelp = { enabled = true }, + completion = { + favoriteStaticMembers = { + 'org.hamcrest.MatcherAssert.assertThat', + 'org.hamcrest.Matchers.*', + 'org.hamcrest.CoreMatchers.*', + 'org.junit.jupiter.api.Assertions.*', + 'java.util.Objects.requireNonNull', + 'java.util.Objects.requireNonNullElse', + 'org.mockito.Mockito.*', + }, + importOrder = { + 'java', + 'com', + 'org', + 'javax', + 'jarkata', + }, + }, + sources = { + organizeImports = { + starThreshold = 9999, + staticStarThreshold = 9999, + }, + }, + codeGeneration = { + toString = { + template = '${object.className}{${member.name()}=${member.value}, ${otherMembers}}', + }, + useBlocks = true, + }, + }, + + flags = { + allow_incremental_sync = true, + }, + init_options = { + bundles = { + vim.fn.glob(lombok_path, 1), + }, + }, +} + +-- config['on_attach'] = function(_, bufnr) +-- require('keymaps').map_java_keys(bufnr) +-- require('lsp_signature').on_attach({ +-- bind = true, -- This is mandatory, otherwise border config won't get registered. +-- floating_window_above_cur_line = false, +-- padding = '', +-- handler_opts = { +-- border = 'rounded', +-- }, +-- }, bufnr) +-- end + +-- This starts a new client & server, +-- or attaches to an existing client & server depending on the `root_dir`. +require('jdtls').start_or_attach(config) diff --git a/java.lua b/java.lua index 07517ee2dcd..fe6aab3736c 100644 --- a/java.lua +++ b/java.lua @@ -3,25 +3,19 @@ -- 'nvim/ftplugin/java.lua'. -- 'nvim/lang-servers/intellij-java-google-style.xml' --- local jdtls_ok, jdtls = pcall(require, 'jdtls') --- if not jdtls_ok then --- vim.notify 'JDTLS not found, install with `:LspInstall jdtls`' --- return --- end - -local home = os.getenv 'HOME' -local jdtls = require 'jdtls' --- vim.notify 'Home: ' .. home +local jdtls_ok, jdtls = pcall(require, 'jdtls') +if not jdtls_ok then + vim.notify 'JDTLS not found, install with `:LspInstall jdtls`' + return +end -- See `:help vim.lsp.start_client` for an overview of the supported `config` options. -- local jdtls_path = vim.fn.stdpath 'data' .. '/mason/packages/jdtls' -local jdtls_path = home .. '/.local/share/nvim/mason/packages/jdtls' +local jdtls_path = '/Users/oluwatobibello/.local/share/nvim/mason/packages/jdtls' local path_to_lsp_server = jdtls_path .. '/config_mac' local path_to_plugins = jdtls_path .. '/plugins/' -local path_to_jar = path_to_plugins .. 'org.eclipse.equinox.launcher_1.6.900.v20240613-2009.jar' -local lombok_path = jdtls_path .. '/lombok.jar' -local styling = home .. '/.local/share/java/eclipse-java-google-style.xml' -print(lombok_path) +local path_to_jar = path_to_plugins .. 'org.eclipse.equinox.launcher_*.jar' +local lombok_path = path_to_plugins .. 'lombok.jar' local root_markers = { '.git', 'mvnw', 'gradlew', 'pom.xml', 'build.gradle' } local root_dir = require('jdtls.setup').find_root(root_markers) @@ -33,7 +27,7 @@ local project_name = vim.fn.fnamemodify(vim.fn.getcwd(), ':p:h:t') local workspace_dir = vim.fn.stdpath 'data' .. '/site/java/workspace-root/' .. project_name os.execute('mkdir ' .. workspace_dir) -local java_21_home_dir = '/Library/Java/JavaVirtualMachines/openjdk.jdk/Contents/Home' +local java_21_home_dir = '/Library/Java/JavaVirtualMachines/openjdk.jdk/Contents/Home/bin/java' local java_17_home_dir = '/Library/Java/JavaVirtualMachines/zulu-17.jdk/Contents/Home' local java_11_home_dir = '/Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home' @@ -74,6 +68,9 @@ local config = { -- One dedicated LSP server & client will be started per unique root_dir root_dir = root_dir, + -- Here you can configure eclipse.jdt.ls specific settings + -- See https://github.com/eclipse/eclipse.jdt.ls/wiki/Running-the-JAVA-LS-server-from-the-command-line#initialize-request + -- for a list of options settings = { java = { home = java_21_home_dir, @@ -109,12 +106,6 @@ local config = { references = { includeDecompiledSources = true, }, - format = { - settings = { - url = styling, - profile = 'GoogleStyle', - }, - }, }, signatureHelp = { enabled = true }, completion = { @@ -153,23 +144,21 @@ local config = { allow_incremental_sync = true, }, init_options = { - bundles = { - vim.fn.glob(lombok_path, 1), - }, + bundles = {}, }, } --- config['on_attach'] = function(_, bufnr) --- require('keymaps').map_java_keys(bufnr) --- require('lsp_signature').on_attach({ --- bind = true, -- This is mandatory, otherwise border config won't get registered. --- floating_window_above_cur_line = false, --- padding = '', --- handler_opts = { --- border = 'rounded', --- }, --- }, bufnr) --- end +config['on_attach'] = function(_, bufnr) + require('keymaps').map_java_keys(bufnr) + require('lsp_signature').on_attach({ + bind = true, -- This is mandatory, otherwise border config won't get registered. + floating_window_above_cur_line = false, + padding = '', + handler_opts = { + border = 'rounded', + }, + }, bufnr) +end -- This starts a new client & server, -- or attaches to an existing client & server depending on the `root_dir`. From 98d7ef571a5792f806a10bf7059980cfeea051a9 Mon Sep 17 00:00:00 2001 From: Oluwatobi Date: Thu, 26 Dec 2024 12:08:39 +0100 Subject: [PATCH 28/40] changed import order --- ftplugin/java.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ftplugin/java.lua b/ftplugin/java.lua index fe6aab3736c..ace1b730191 100644 --- a/ftplugin/java.lua +++ b/ftplugin/java.lua @@ -119,11 +119,11 @@ local config = { 'org.mockito.Mockito.*', }, importOrder = { - 'java', 'com', - 'org', - 'javax', + 'java', 'jarkata', + 'javax', + 'org', }, }, sources = { From b98b85718ffbdd820edfba6bc3e8297a681c0044 Mon Sep 17 00:00:00 2001 From: Oluwatobi Date: Tue, 31 Dec 2024 08:11:52 +0100 Subject: [PATCH 29/40] update --- lazy-lock.json | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lazy-lock.json b/lazy-lock.json index 4a24e2ed6f1..91da1f48638 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,25 +1,25 @@ { "LuaSnip": { "branch": "master", "commit": "33b06d72d220aa56a7ce80a0dd6f06c70cd82b9d" }, "alpha-nvim": { "branch": "main", "commit": "de72250e054e5e691b9736ee30db72c65d560771" }, - "catppuccin": { "branch": "main", "commit": "faf15ab0201b564b6368ffa47b56feefc92ce3f4" }, + "catppuccin": { "branch": "main", "commit": "f67b886d65a029f12ffa298701fb8f1efd89295d" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-nvim-lsp": { "branch": "main", "commit": "99290b3ec1322070bcfb9e846450a46f6efa50f0" }, "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, - "conform.nvim": { "branch": "master", "commit": "339b3e4519ec49312d34fcfa275aa15bfaa67025" }, + "conform.nvim": { "branch": "master", "commit": "9180320205d250429f0f80e073326c674e2a7149" }, "friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" }, "gitsigns.nvim": { "branch": "main", "commit": "5f808b5e4fef30bd8aca1b803b4e555da07fc412" }, "gopher.nvim": { "branch": "main", "commit": "0ed14a40d9799ac8d92aaf9eb1cd9be22ffd6b14" }, "hererocks": { "branch": "master", "commit": "c9c5444dea1e07e005484014a8231aa667be30b6" }, - "image.nvim": { "branch": "master", "commit": "b3e1af829a56bb038e5f81bf97798a2950064b62" }, + "image.nvim": { "branch": "master", "commit": "b991fc7f845bc6ab40c6ec00b39750dcd5190010" }, "lazy.nvim": { "branch": "main", "commit": "7e6c863bc7563efbdd757a310d17ebc95166cef3" }, "lazygit.nvim": { "branch": "main", "commit": "77a0d42943d8265271e6e6beaed72da54eeb17e7" }, "lsp-zero.nvim": { "branch": "v1.x", "commit": "aa36afcf7a59fbd98008c9a434593c423d3d649a" }, "lspkind-nvim": { "branch": "master", "commit": "d79a1c3299ad0ef94e255d045bed9fa26025dab6" }, "lua-async-await": { "branch": "main", "commit": "652d94df34e97abe2d4a689edbc4270e7ead1a98" }, "lualine.nvim": { "branch": "master", "commit": "2a5bae925481f999263d6f5ed8361baef8df4f83" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "2daa8921b7afdcfa47419a21ea343c3df6d74fa0" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "c6c686781f9841d855bf1b926e10aa5e19430a38" }, "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, "mini.ai": { "branch": "main", "commit": "ebb04799794a7f94628153991e6334c3304961b8" }, "mini.comment": { "branch": "main", "commit": "a56581c40c19fa26f2b39da72504398de3173c5a" }, @@ -28,19 +28,19 @@ "nui.nvim": { "branch": "main", "commit": "53e907ffe5eedebdca1cd503b00aa8692068ca46" }, "nvim-autopairs": { "branch": "master", "commit": "b464658e9b880f463b9f7e6ccddd93fb0013f559" }, "nvim-cmp": { "branch": "main", "commit": "b555203ce4bd7ff6192e759af3362f9d217e8c89" }, - "nvim-dap": { "branch": "master", "commit": "a6070b4e9e9a8ff1bc513c3748eff27080b0f44a" }, + "nvim-dap": { "branch": "master", "commit": "ffb077e65259f13be096ea6d603e3575a76b214a" }, "nvim-java": { "branch": "main", "commit": "e8e84413ca03e7d0541921e795b2e6bf8801f186" }, - "nvim-java-core": { "branch": "main", "commit": "5b03dca22fee76524a89e1c2dc1d73a9f0b1a3bb" }, + "nvim-java-core": { "branch": "main", "commit": "22eca6b90b7e209299d99cbf60421f0ffdae5629" }, "nvim-java-dap": { "branch": "main", "commit": "55f239532f7a3789d21ea68d1e795abc77484974" }, "nvim-java-refactor": { "branch": "main", "commit": "ea1420fed5463c9cc976c2b4175f434b3646f0f7" }, "nvim-java-test": { "branch": "main", "commit": "7f0f40e9c5b7eab5096d8bec6ac04251c6e81468" }, - "nvim-lspconfig": { "branch": "master", "commit": "c580f34bc5fdca8aaf737a9ab8a5d775cb940e57" }, - "nvim-treesitter": { "branch": "master", "commit": "50947387c20ec3fb8c30b8c1c1a1c39f68deb970" }, + "nvim-lspconfig": { "branch": "master", "commit": "8b15a1a597a59f4f5306fad9adfe99454feab743" }, + "nvim-treesitter": { "branch": "master", "commit": "0a0e2e354b770d709a327bc51f7b4ddeae927ba7" }, "nvim-treesitter-context": { "branch": "master", "commit": "2bcf700b59bc92850ca83a1c02e86ba832e0fae0" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "ad8f0a472148c3e0ae9851e26a722ee4e29b1595" }, "nvim-ts-autotag": { "branch": "main", "commit": "1cca23c9da708047922d3895a71032bc0449c52d" }, - "nvim-ufo": { "branch": "main", "commit": "270ca542dae992ffe40274718c63645217ebc8bf" }, - "nvim-web-devicons": { "branch": "master", "commit": "15c7d0f616ebf88960ce5c4221828f62789d36d9" }, + "nvim-ufo": { "branch": "main", "commit": "32cb247b893a384f1888b9cd737264159ecf183c" }, + "nvim-web-devicons": { "branch": "master", "commit": "4adeeaa7a32d46cf3b5833341358c797304f950a" }, "nvim-window-picker": { "branch": "main", "commit": "41cfaa428577c53552200a404ae9b3a0b5719706" }, "plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" }, "promise-async": { "branch": "main", "commit": "119e8961014c9bfaf1487bf3c2a393d254f337e2" }, @@ -51,9 +51,9 @@ "undotree": { "branch": "master", "commit": "78b5241191852ffa9bb5da5ff2ee033160798c3b" }, "vi-mongo.nvim": { "branch": "master", "commit": "ac21b4de10b9409c872e81a34b41cee52bf7174c" }, "vim-dadbod": { "branch": "master", "commit": "f740950d0703099e0f172016f10e0e39f50fd0ba" }, - "vim-dadbod-completion": { "branch": "master", "commit": "9e354e86fcc67a5ec2c104f312e374ea2f89c799" }, + "vim-dadbod-completion": { "branch": "master", "commit": "71eb73d1f7399be6a56cc43b928276cd5ca27ffd" }, "vim-dadbod-ui": { "branch": "master", "commit": "0fec59e3e1e619e302198cd491b7d27f8d398b7c" }, - "vim-fugitive": { "branch": "master", "commit": "fcb4db52e7f65b95705aa58f0f2df1312c1f2df2" }, + "vim-fugitive": { "branch": "master", "commit": "174230d6a7f2df94705a7ffd8d5413e27ec10a80" }, "vim-rhubarb": { "branch": "master", "commit": "ee69335de176d9325267b0fd2597a22901d927b1" }, "vim-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" }, "which-key.nvim": { "branch": "main", "commit": "8ab96b38a2530eacba5be717f52e04601eb59326" } From faf247ea5ce1b958d6264d9c344a7628d505c02e Mon Sep 17 00:00:00 2001 From: Oluwatobi Date: Tue, 31 Dec 2024 08:55:57 +0100 Subject: [PATCH 30/40] updated search and replace key mapping --- lua/thrillee/remaps.lua | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/lua/thrillee/remaps.lua b/lua/thrillee/remaps.lua index c5587613391..a081abe480f 100644 --- a/lua/thrillee/remaps.lua +++ b/lua/thrillee/remaps.lua @@ -6,28 +6,26 @@ vim.keymap.set({ 'n', 'v' }, '', '', { silent = true }) 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 }) -vim.keymap.set("i", "jk", "") +vim.keymap.set('i', 'jk', '') vim.keymap.set('n', 'w', 'w!', { desc = 'Save File' }) -vim.keymap.set('n', 'q', "confirm q", { desc = 'Quit File' }) +vim.keymap.set('n', 'q', 'confirm q', { desc = 'Quit File' }) vim.keymap.set('v', '', '"*y', { desc = 'Copy to system clipboard' }) vim.keymap.set('v', 'p', [["_dP]], { desc = 'Paste and retain paste in clipboard' }) -vim.keymap.set("n", "s", [[:%s/\<\>//gI]], - { desc = 'Search and Replace Highlighted Word' }) +vim.keymap.set('n', 'sr', [[:%s/\<\>//gI]], { desc = 'Search and Replace Highlighted Word' }) -vim.keymap.set("n", "J", "mzJ`z", { desc = 'Keep cusor in index position on J' }) +vim.keymap.set('n', 'J', 'mzJ`z', { desc = 'Keep cusor in index position on J' }) -- Keep cusor in middle of buffer -vim.keymap.set('n', '', "zz", { desc = '⬇ middle of buffer and keep cusor in middle of buffer' }) +vim.keymap.set('n', '', 'zz', { desc = '⬇ middle of buffer and keep cusor in middle of buffer' }) vim.keymap.set('n', '', 'zz', { desc = '⬆ middle of buffer and keep cusor in middle of buffer' }) vim.keymap.set('n', 'N', 'nzzzv', { desc = 'next search and keep cusor in middle of buffer' }) vim.keymap.set('n', 'n', 'Nzzzv', { desc = 'previous search and keep cusor in middle of buffer' }) -- Move highlighted up or down -vim.keymap.set("v", "J", ":m '>+1gv=gv", { desc = 'Move highlighted up' }) -vim.keymap.set("v", "K", ":m '<-2gv=gv", { desc = 'Move highlighted down' }) - +vim.keymap.set('v', 'J', ":m '>+1gv=gv", { desc = 'Move highlighted up' }) +vim.keymap.set('v', 'K', ":m '<-2gv=gv", { desc = 'Move highlighted down' }) -- Map c to close and save the buffer vim.api.nvim_set_keymap('n', 'c', [[:w | bd]], { noremap = true, silent = true }) From 3b032c9f5c79731f5abc7923010f8e6cb7723b80 Mon Sep 17 00:00:00 2001 From: Oluwatobi Date: Thu, 16 Jan 2025 10:09:10 +0100 Subject: [PATCH 31/40] added keymappings for quickfix list --- lua/thrillee/remaps.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lua/thrillee/remaps.lua b/lua/thrillee/remaps.lua index a081abe480f..3d7808c5394 100644 --- a/lua/thrillee/remaps.lua +++ b/lua/thrillee/remaps.lua @@ -29,3 +29,9 @@ vim.keymap.set('v', 'K', ":m '<-2gv=gv", { desc = 'Move highlighted down' }) -- Map c to close and save the buffer vim.api.nvim_set_keymap('n', 'c', [[:w | bd]], { noremap = true, silent = true }) + +-- Map c quickfix list remaps +vim.api.nvim_set_keymap('n', 'cj', 'cnext', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('n', 'ck', 'cprev', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('n', 'cq', 'cclose', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('n', 'co', 'copen', { noremap = true, silent = true }) From f56b64f64e6d6c02a784a2ac40deaf669a0791b8 Mon Sep 17 00:00:00 2001 From: Oluwatobi Date: Mon, 21 Apr 2025 14:10:21 +0100 Subject: [PATCH 32/40] updated conform formatter --- after/plugin/conform-config.lua | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/after/plugin/conform-config.lua b/after/plugin/conform-config.lua index 683f66b8a99..161cc1d65f7 100644 --- a/after/plugin/conform-config.lua +++ b/after/plugin/conform-config.lua @@ -2,13 +2,14 @@ require('conform').setup { formatters_by_ft = { lua = { 'stylua' }, python = { 'black' }, --'isort', - javascript = { { 'prettierd', 'prettier' } }, - javascriptreact = { { 'prettier' } }, - typescriptreact = { { 'prettier' } }, - typescript = { { 'prettier' } }, + javascript = { "prettierd", "prettier", stop_after_first = true }, + javascriptreact = { 'prettier' }, + typescriptreact = { 'prettier' }, + typescript = { 'prettier' }, xml = { 'prettier', 'xmlformat' }, - html = { { 'prettier' } }, - go = { { 'gofumpt', 'goimports-reviser', 'golines' } }, + html = { 'prettier' }, + htmldjango = { 'prettier' }, + go = { 'gofumpt', 'goimports-reviser', 'golines', stop_after_first = true }, java = { 'google-java-format' }, templ = { 'templ' }, }, From d98548a231f99f2b5554f63cda727249310cda76 Mon Sep 17 00:00:00 2001 From: Oluwatobi Date: Sat, 31 May 2025 12:19:47 +0100 Subject: [PATCH 33/40] updated --- lazy-lock.json | 94 +++++++++++++++++++++++++------------------------- 1 file changed, 47 insertions(+), 47 deletions(-) diff --git a/lazy-lock.json b/lazy-lock.json index 91da1f48638..8bd183ddd0f 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,60 +1,60 @@ { - "LuaSnip": { "branch": "master", "commit": "33b06d72d220aa56a7ce80a0dd6f06c70cd82b9d" }, - "alpha-nvim": { "branch": "main", "commit": "de72250e054e5e691b9736ee30db72c65d560771" }, - "catppuccin": { "branch": "main", "commit": "f67b886d65a029f12ffa298701fb8f1efd89295d" }, - "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, - "cmp-nvim-lsp": { "branch": "main", "commit": "99290b3ec1322070bcfb9e846450a46f6efa50f0" }, + "LuaSnip": { "branch": "master", "commit": "faf3c94a44508cec1b961406d36cc65113ff3b98" }, + "alpha-nvim": { "branch": "main", "commit": "a35468cd72645dbd52c0624ceead5f301c566dff" }, + "catppuccin": { "branch": "main", "commit": "387b4b19568cbda82c1d6def9ded31fd6ae7fb99" }, + "cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "a8912b88ce488f411177fc8aed358b04dc246d7b" }, "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, - "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, + "cmp-path": { "branch": "main", "commit": "c6635aae33a50d6010bf1aa756ac2398a2d54c32" }, "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, - "conform.nvim": { "branch": "master", "commit": "9180320205d250429f0f80e073326c674e2a7149" }, - "friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" }, - "gitsigns.nvim": { "branch": "main", "commit": "5f808b5e4fef30bd8aca1b803b4e555da07fc412" }, - "gopher.nvim": { "branch": "main", "commit": "0ed14a40d9799ac8d92aaf9eb1cd9be22ffd6b14" }, - "hererocks": { "branch": "master", "commit": "c9c5444dea1e07e005484014a8231aa667be30b6" }, - "image.nvim": { "branch": "master", "commit": "b991fc7f845bc6ab40c6ec00b39750dcd5190010" }, - "lazy.nvim": { "branch": "main", "commit": "7e6c863bc7563efbdd757a310d17ebc95166cef3" }, - "lazygit.nvim": { "branch": "main", "commit": "77a0d42943d8265271e6e6beaed72da54eeb17e7" }, - "lsp-zero.nvim": { "branch": "v1.x", "commit": "aa36afcf7a59fbd98008c9a434593c423d3d649a" }, + "conform.nvim": { "branch": "master", "commit": "6feb2f28f9a9385e401857b21eeac3c1b66dd628" }, + "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, + "gitsigns.nvim": { "branch": "main", "commit": "8bdaccdb897945a3c99c1ad8df94db0ddf5c8790" }, + "gopher.nvim": { "branch": "main", "commit": "9db5931af1293ae52500921d92c02145d86df02c" }, + "hererocks": { "branch": "master", "commit": "344c46ed54df9a4dbc2d2bf510dcd9a9d90497bf" }, + "image.nvim": { "branch": "master", "commit": "4c51d6202628b3b51e368152c053c3fb5c5f76f2" }, + "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, + "lazygit.nvim": { "branch": "main", "commit": "b9eae3badab982e71abab96d3ee1d258f0c07961" }, + "lsp-zero.nvim": { "branch": "v1.x", "commit": "a7c18ecde0b4462bcd84f363723ff633f2c9a198" }, "lspkind-nvim": { "branch": "master", "commit": "d79a1c3299ad0ef94e255d045bed9fa26025dab6" }, "lua-async-await": { "branch": "main", "commit": "652d94df34e97abe2d4a689edbc4270e7ead1a98" }, - "lualine.nvim": { "branch": "master", "commit": "2a5bae925481f999263d6f5ed8361baef8df4f83" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "c6c686781f9841d855bf1b926e10aa5e19430a38" }, - "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, - "mini.ai": { "branch": "main", "commit": "ebb04799794a7f94628153991e6334c3304961b8" }, - "mini.comment": { "branch": "main", "commit": "a56581c40c19fa26f2b39da72504398de3173c5a" }, - "mini.surround": { "branch": "main", "commit": "aa5e245829dd12d8ff0c96ef11da28681d6049aa" }, - "neo-tree.nvim": { "branch": "v3.x", "commit": "a77af2e764c5ed4038d27d1c463fa49cd4794e07" }, - "nui.nvim": { "branch": "main", "commit": "53e907ffe5eedebdca1cd503b00aa8692068ca46" }, - "nvim-autopairs": { "branch": "master", "commit": "b464658e9b880f463b9f7e6ccddd93fb0013f559" }, - "nvim-cmp": { "branch": "main", "commit": "b555203ce4bd7ff6192e759af3362f9d217e8c89" }, - "nvim-dap": { "branch": "master", "commit": "ffb077e65259f13be096ea6d603e3575a76b214a" }, - "nvim-java": { "branch": "main", "commit": "e8e84413ca03e7d0541921e795b2e6bf8801f186" }, - "nvim-java-core": { "branch": "main", "commit": "22eca6b90b7e209299d99cbf60421f0ffdae5629" }, + "lualine.nvim": { "branch": "master", "commit": "0c6cca9f2c63dadeb9225c45bc92bb95a151d4af" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "67da97f8c2fd12d05427bb485ce07ee6418e0a51" }, + "mason.nvim": { "branch": "main", "commit": "8024d64e1330b86044fed4c8494ef3dcd483a67c" }, + "mini.ai": { "branch": "main", "commit": "4b5348fac5912f1957f4c012c2e0ab0c4b865386" }, + "mini.comment": { "branch": "main", "commit": "22ee9f6be1c78bcebe009a564758e5b6df08903b" }, + "mini.surround": { "branch": "main", "commit": "f4307f935ad87cfe3e570dbaae485b35cce4e5ec" }, + "neo-tree.nvim": { "branch": "v3.x", "commit": "f481de16a0eb59c985abac8985e3f2e2f75b4875" }, + "nui.nvim": { "branch": "main", "commit": "7cd18e73cfbd70e1546931b7268b3eebaeff9391" }, + "nvim-autopairs": { "branch": "master", "commit": "4d74e75913832866aa7de35e4202463ddf6efd1b" }, + "nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" }, + "nvim-dap": { "branch": "master", "commit": "b0f983507e3702f073bfe1516846e58b56d4e42f" }, + "nvim-java": { "branch": "main", "commit": "7c2e81caa301b0d1bc7992b88981af883b3b5d6b" }, + "nvim-java-core": { "branch": "main", "commit": "401bf7683012a25929a359deec418f36beb876e2" }, "nvim-java-dap": { "branch": "main", "commit": "55f239532f7a3789d21ea68d1e795abc77484974" }, - "nvim-java-refactor": { "branch": "main", "commit": "ea1420fed5463c9cc976c2b4175f434b3646f0f7" }, + "nvim-java-refactor": { "branch": "main", "commit": "b51a57d862338999059e1d1717df3bc80a3a15c0" }, "nvim-java-test": { "branch": "main", "commit": "7f0f40e9c5b7eab5096d8bec6ac04251c6e81468" }, - "nvim-lspconfig": { "branch": "master", "commit": "8b15a1a597a59f4f5306fad9adfe99454feab743" }, - "nvim-treesitter": { "branch": "master", "commit": "0a0e2e354b770d709a327bc51f7b4ddeae927ba7" }, - "nvim-treesitter-context": { "branch": "master", "commit": "2bcf700b59bc92850ca83a1c02e86ba832e0fae0" }, - "nvim-treesitter-textobjects": { "branch": "master", "commit": "ad8f0a472148c3e0ae9851e26a722ee4e29b1595" }, - "nvim-ts-autotag": { "branch": "main", "commit": "1cca23c9da708047922d3895a71032bc0449c52d" }, - "nvim-ufo": { "branch": "main", "commit": "32cb247b893a384f1888b9cd737264159ecf183c" }, - "nvim-web-devicons": { "branch": "master", "commit": "4adeeaa7a32d46cf3b5833341358c797304f950a" }, - "nvim-window-picker": { "branch": "main", "commit": "41cfaa428577c53552200a404ae9b3a0b5719706" }, - "plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" }, + "nvim-lspconfig": { "branch": "master", "commit": "03bc581e05e81d33808b42b2d7e76d70adb3b595" }, + "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, + "nvim-treesitter-context": { "branch": "master", "commit": "ed1cf48d5af252248c55f50b9427e8ce883a2c6b" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "0f051e9813a36481f48ca1f833897210dbcfffde" }, + "nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" }, + "nvim-ufo": { "branch": "main", "commit": "3c7a3570e9c9dc198a2ad4491b0b0e51c4d4ba08" }, + "nvim-web-devicons": { "branch": "master", "commit": "1fb58cca9aebbc4fd32b086cb413548ce132c127" }, + "nvim-window-picker": { "branch": "main", "commit": "6382540b2ae5de6c793d4aa2e3fe6dbb518505ec" }, + "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, "promise-async": { "branch": "main", "commit": "119e8961014c9bfaf1487bf3c2a393d254f337e2" }, "spring-boot.nvim": { "branch": "main", "commit": "218c0c26c14d99feca778e4d13f5ec3e8b1b60f0" }, - "tailwind-tools.nvim": { "branch": "master", "commit": "3703e162d819a04b128902c508276553dae0dfb8" }, - "telescope-fzf-native.nvim": { "branch": "main", "commit": "dae2eac9d91464448b584c7949a31df8faefec56" }, + "tailwind-tools.nvim": { "branch": "master", "commit": "fbe982901d4508b0dcd80e07addf0fcb6dab6c49" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" }, "telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, - "undotree": { "branch": "master", "commit": "78b5241191852ffa9bb5da5ff2ee033160798c3b" }, + "undotree": { "branch": "master", "commit": "b951b87b46c34356d44aa71886aecf9dd7f5788a" }, "vi-mongo.nvim": { "branch": "master", "commit": "ac21b4de10b9409c872e81a34b41cee52bf7174c" }, - "vim-dadbod": { "branch": "master", "commit": "f740950d0703099e0f172016f10e0e39f50fd0ba" }, - "vim-dadbod-completion": { "branch": "master", "commit": "71eb73d1f7399be6a56cc43b928276cd5ca27ffd" }, - "vim-dadbod-ui": { "branch": "master", "commit": "0fec59e3e1e619e302198cd491b7d27f8d398b7c" }, - "vim-fugitive": { "branch": "master", "commit": "174230d6a7f2df94705a7ffd8d5413e27ec10a80" }, - "vim-rhubarb": { "branch": "master", "commit": "ee69335de176d9325267b0fd2597a22901d927b1" }, + "vim-dadbod": { "branch": "master", "commit": "e95afed23712f969f83b4857a24cf9d59114c2e6" }, + "vim-dadbod-completion": { "branch": "master", "commit": "a8dac0b3cf6132c80dc9b18bef36d4cf7a9e1fe6" }, + "vim-dadbod-ui": { "branch": "master", "commit": "460432301a5cb280ea265ddfa15c9f3dcd1d26b7" }, + "vim-fugitive": { "branch": "master", "commit": "4a745ea72fa93bb15dd077109afbb3d1809383f2" }, + "vim-rhubarb": { "branch": "master", "commit": "386daa2e9d98e23e27ad089afcbe5c5a903e488d" }, "vim-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" }, - "which-key.nvim": { "branch": "main", "commit": "8ab96b38a2530eacba5be717f52e04601eb59326" } + "which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" } } From 98ea49a70f9219f0ec37538ab875031950c4a885 Mon Sep 17 00:00:00 2001 From: Oluwatobi Date: Sat, 31 May 2025 12:55:03 +0100 Subject: [PATCH 34/40] updated to 0.11 --- after/plugin/lsp-config.lua | 193 ++++++++++++++++++------------------ after/plugin/mason.lua | 1 - lazy-lock.json | 4 +- lua/plugins/lsp.lua | 41 ++++---- 4 files changed, 118 insertions(+), 121 deletions(-) delete mode 100644 after/plugin/mason.lua diff --git a/after/plugin/lsp-config.lua b/after/plugin/lsp-config.lua index d9d0a12e183..573751821cd 100644 --- a/after/plugin/lsp-config.lua +++ b/after/plugin/lsp-config.lua @@ -1,102 +1,32 @@ --- [[ Configure LSP ]] -local lsp = require 'lsp-zero' - -lsp.preset 'recommended' - -lsp.ensure_installed { - 'rust_analyzer', - -- Python - -- 'mypy', - -- 'black', - -- 'isort', - -- 'ruff_lsp', - 'pyright', - -- Java Stuffs - 'jdtls', - -- 'google-java-format', - -- Golang - -- 'gofumpt', - -- 'goimports-reviser', - -- 'golines', - 'gopls', - 'templ', - 'htmx', - -- Typescript - -- 'prettier', - -- 'prettierd', - -- 'tsserver', - -- Others - 'tailwindcss', -} +require('mason').setup() +require('mason-lspconfig').setup() -local capabilities = vim.lsp.protocol.make_client_capabilities() -capabilities.textDocument.foldingRange = { - dynamicRegistration = false, - lineFoldingOnly = true, -} +vim.lsp.enable 'rust_analyzer' +vim.lsp.enable 'pyright' --- Fix Undefined global 'vim' -lsp.nvim_workspace() - -local cmp = require 'cmp' -local cmp_select = { behavior = cmp.SelectBehavior.Select } -local cmp_mappings = lsp.defaults.cmp_mappings { - [''] = cmp.mapping.select_prev_item(cmp_select), - [''] = cmp.mapping.select_next_item(cmp_select), - [''] = cmp.mapping.confirm { select = true }, - [''] = cmp.mapping.complete(), -} +vim.lsp.enable 'jdtls' -cmp_mappings[''] = nil -cmp_mappings[''] = nil +vim.lsp.enable 'lua_ls' -lsp.setup_nvim_cmp { - mapping = cmp_mappings, -} +vim.lsp.enable 'gopls' +vim.lsp.enable 'templ' +vim.lsp.enable 'htmx' -lsp.set_preferences { - suggest_lsp_servers = false, - sign_icons = { - error = '⛔️', - warn = '⚠️', - hint = '🧐', - info = 'I', - }, -} +vim.lsp.enable 'jsonls' +vim.lsp.enable 'html' -local function on_attach(client, bufnr) - local opts = { buffer = bufnr, remap = false } +vim.lsp.enable 'ts_ls' +vim.lsp.enable 'eslint' - vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts) - vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts) - vim.keymap.set('n', 'vws', vim.lsp.buf.workspace_symbol, opts) - vim.keymap.set('n', 'vd', vim.diagnostic.open_float, opts) - vim.keymap.set('n', '[d', vim.diagnostic.goto_next, opts) - vim.keymap.set('n', ']d', vim.diagnostic.goto_prev, opts) - vim.keymap.set('n', 'dd', vim.diagnostic.setloclist, opts) - vim.keymap.set('n', 'do', vim.diagnostic.open_float, opts) - vim.keymap.set('n', 'ca', vim.lsp.buf.code_action, opts) - vim.keymap.set('n', 'gd', require('telescope.builtin').lsp_definitions, opts) - vim.keymap.set('n', 'gr', require('telescope.builtin').lsp_references, opts) - vim.keymap.set('n', 'rn', vim.lsp.buf.rename, opts) - vim.keymap.set('n', 'lf', function() - require('conform').format() - end, { buffer = bufnr, desc = 'Format Buffer' }) - vim.keymap.set('n', 'wa', vim.lsp.buf.add_workspace_folder, opts) - vim.keymap.set('n', 'wr', vim.lsp.buf.remove_workspace_folder, opts) - vim.keymap.set('n', 'wl', function() - print(vim.inspect(vim.lsp.buf.list_workspace_folders())) - end, opts) -end - -lsp.on_attach(on_attach) -lsp.setup() +vim.lsp.enable 'tailwindcss' -vim.diagnostic.config { - virtual_text = true, +local capabilities = vim.lsp.protocol.make_client_capabilities() +capabilities.textDocument.foldingRange = { + dynamicRegistration = false, + lineFoldingOnly = true, } -local function on_attach(client, bufnr) +local function on_attach(bufnr) local opts = { buffer = bufnr, remap = false } vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts) @@ -121,14 +51,79 @@ local function on_attach(client, bufnr) end, opts) end -lsp.on_attach(on_attach) -lsp.setup() - -vim.diagnostic.config { - virtual_text = true, -} +vim.api.nvim_create_autocmd('LspAttach', { + group = vim.api.nvim_create_augroup('UserLspConfig', {}), + callback = function(ev) + on_attach(ev.buf) + -- local map = function(keys, func, desc) + -- vim.keymap.set('n', keys, func, { buffer = ev.buf, desc = 'Lsp: ' .. desc }) + -- end + + -- local tele = require 'telescope.builtin' + -- map('gd', tele.lsp_definitions, 'Goto Definition') + -- map('gr', tele.lsp_references, 'Goto References') + -- + -- map('K', vim.lsp.buf.hover, 'hover') + -- + -- map('n', 'vws', vim.lsp.buf.workspace_symbol, 'Workspace Symbols') + -- + -- map('n', 'vd', vim.diagnostic.open_float, 'View Diagnostic') + -- + -- map('n', '[d', vim.diagnostic.goto_next, 'Goto Next Diagnostic') + -- map('n', ']d', vim.diagnostic.goto_prev, 'Goto Preview Diagnostic') + -- map('n', 'dd', vim.diagnostic.setloclist, 'List Diagnostics') + -- map('n', 'do', vim.diagnostic.open_float, 'List All Diagnostics') + -- map('n', 'ca', vim.lsp.buf.code_action, 'Code Action') + -- + -- map('fs', tele.lsp_document_symbols, 'Doc Symbols') + -- map('fS', tele.lsp_dynamic_workspace_symbols, 'Dynamic Symbols') + -- map('ft', tele.lsp_type_definitions, 'Goto Type') + -- map('fi', tele.lsp_implementations, 'Goto Impl') + -- + -- map('n', 'rn', vim.lsp.buf.rename, 'Rename') + -- map('n', 'lf', function() + -- require('conform').format() + -- end, 'Format Buffer') + -- + -- map('n', 'wa', vim.lsp.buf.add_workspace_folder, 'Add WorkSpace') + -- map('n', 'wr', vim.lsp.buf.remove_workspace_folder, 'Remove WorkSpace') + -- map('n', 'wl', function() + -- print(vim.inspect(vim.lsp.buf.list_workspace_folders())) + -- end, 'List Work Spaces') + end, +}) +-- vim.lsp.on_attach(on_attach) +-- vim.lsp.setup() +-- +-- vim.diagnostic.config { +-- virtual_text = true, +-- } -return { - capabilities = capabilities, - on_attach = on_attach, -} +-- Fix Undefined global 'vim' +-- vim.lsp.nvim_workspace() + +-- local cmp = require 'cmp' +-- local cmp_select = { behavior = cmp.SelectBehavior.Select } +-- local cmp_mappings = vim.lsp.defaults.cmp_mappings { +-- [''] = cmp.mapping.select_prev_item(cmp_select), +-- [''] = cmp.mapping.select_next_item(cmp_select), +-- [''] = cmp.mapping.confirm { select = true }, +-- [''] = cmp.mapping.complete(), +-- } + +-- cmp_mappings[''] = nil +-- cmp_mappings[''] = nil + +-- vim.lsp.setup_nvim_cmp { +-- mapping = cmp_mappings, +-- } + +-- vim.lsp.set_preferences { +-- suggest_lsp_servers = false, +-- sign_icons = { +-- error = '⛔️', +-- warn = '⚠️', +-- hint = '🧐', +-- info = 'I', +-- }, +-- } diff --git a/after/plugin/mason.lua b/after/plugin/mason.lua deleted file mode 100644 index e6117d29d70..00000000000 --- a/after/plugin/mason.lua +++ /dev/null @@ -1 +0,0 @@ -require('mason').setup({}) diff --git a/lazy-lock.json b/lazy-lock.json index 8bd183ddd0f..7be19d18e48 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -3,9 +3,11 @@ "alpha-nvim": { "branch": "main", "commit": "a35468cd72645dbd52c0624ceead5f301c566dff" }, "catppuccin": { "branch": "main", "commit": "387b4b19568cbda82c1d6def9ded31fd6ae7fb99" }, "cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" }, + "cmp-cmdline": { "branch": "main", "commit": "d126061b624e0af6c3a556428712dd4d4194ec6d" }, "cmp-nvim-lsp": { "branch": "main", "commit": "a8912b88ce488f411177fc8aed358b04dc246d7b" }, "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, "cmp-path": { "branch": "main", "commit": "c6635aae33a50d6010bf1aa756ac2398a2d54c32" }, + "cmp-vsnip": { "branch": "main", "commit": "989a8a73c44e926199bfd05fa7a516d51f2d2752" }, "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, "conform.nvim": { "branch": "master", "commit": "6feb2f28f9a9385e401857b21eeac3c1b66dd628" }, "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, @@ -15,7 +17,6 @@ "image.nvim": { "branch": "master", "commit": "4c51d6202628b3b51e368152c053c3fb5c5f76f2" }, "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, "lazygit.nvim": { "branch": "main", "commit": "b9eae3badab982e71abab96d3ee1d258f0c07961" }, - "lsp-zero.nvim": { "branch": "v1.x", "commit": "a7c18ecde0b4462bcd84f363723ff633f2c9a198" }, "lspkind-nvim": { "branch": "master", "commit": "d79a1c3299ad0ef94e255d045bed9fa26025dab6" }, "lua-async-await": { "branch": "main", "commit": "652d94df34e97abe2d4a689edbc4270e7ead1a98" }, "lualine.nvim": { "branch": "master", "commit": "0c6cca9f2c63dadeb9225c45bc92bb95a151d4af" }, @@ -56,5 +57,6 @@ "vim-fugitive": { "branch": "master", "commit": "4a745ea72fa93bb15dd077109afbb3d1809383f2" }, "vim-rhubarb": { "branch": "master", "commit": "386daa2e9d98e23e27ad089afcbe5c5a903e488d" }, "vim-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" }, + "vim-vsnip": { "branch": "master", "commit": "0a4b8419e44f47c57eec4c90df17567ad4b1b36e" }, "which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" } } diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index 4f669da9432..c43e6473113 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -1,25 +1,26 @@ return { - 'VonHeikemen/lsp-zero.nvim', - branch = 'v1.x', - dependencies = { - -- LSP Support - { 'neovim/nvim-lspconfig' }, - { 'williamboman/mason.nvim' }, - { 'williamboman/mason-lspconfig.nvim' }, + 'neovim/nvim-lspconfig', + dependencies = { + -- LSP Support + { 'williamboman/mason.nvim' }, + { 'williamboman/mason-lspconfig.nvim' }, - -- Autocompletion - { 'hrsh7th/nvim-cmp' }, - { 'hrsh7th/cmp-buffer' }, - { 'hrsh7th/cmp-path' }, - { 'saadparwaiz1/cmp_luasnip' }, - { 'hrsh7th/cmp-nvim-lsp' }, - { 'hrsh7th/cmp-nvim-lua' }, + -- Autocompletion + { 'hrsh7th/nvim-cmp' }, + { 'hrsh7th/cmp-buffer' }, + { 'hrsh7th/cmp-path' }, + { 'saadparwaiz1/cmp_luasnip' }, + { 'hrsh7th/cmp-nvim-lsp' }, + { 'hrsh7th/cmp-nvim-lua' }, + { 'hrsh7th/cmp-cmdline' }, + { 'hrsh7th/cmp-vsnip' }, + { 'hrsh7th/vim-vsnip' }, - -- Snippets - { 'L3MON4D3/LuaSnip' }, + -- Snippets + { 'L3MON4D3/LuaSnip' }, - { 'rafamadriz/friendly-snippets' }, - }, - -- Use the lazy option to lazy-load the plugin on events or commands - lazy = true, + { 'rafamadriz/friendly-snippets' }, + }, + -- Use the lazy option to lazy-load the plugin on events or commands + lazy = true, } From 502f8cc6a8a25f072184c9e2cf65c5be710ced79 Mon Sep 17 00:00:00 2001 From: Oluwatobi Date: Sat, 31 May 2025 15:20:37 +0100 Subject: [PATCH 35/40] fixing java --- after/plugin/lsp-config.lua | 129 ++++++------------ after/plugin/tailwind-config.lua | 17 --- lazy-lock.json | 3 +- lua/plugins/lsp.lua | 2 +- lua/plugins/nvim-cmp.lua | 12 +- lua/plugins/tailwind-tools.lua | 5 - ...im-java-config.lua => nvim-java-config.lua | 0 7 files changed, 47 insertions(+), 121 deletions(-) delete mode 100644 after/plugin/tailwind-config.lua delete mode 100644 lua/plugins/tailwind-tools.lua rename after/plugin/nvim-java-config.lua => nvim-java-config.lua (100%) diff --git a/after/plugin/lsp-config.lua b/after/plugin/lsp-config.lua index 573751821cd..ba0414dfa88 100644 --- a/after/plugin/lsp-config.lua +++ b/after/plugin/lsp-config.lua @@ -10,14 +10,17 @@ vim.lsp.enable 'lua_ls' vim.lsp.enable 'gopls' vim.lsp.enable 'templ' -vim.lsp.enable 'htmx' -vim.lsp.enable 'jsonls' -vim.lsp.enable 'html' +vim.lsp.enable 'dartls' +-- vim.lsp.enable 'htmx' -vim.lsp.enable 'ts_ls' +-- vim.lsp.enable 'jsonls' +-- vim.lsp.enable 'html' + +vim.lsp.enable 'tsserver' vim.lsp.enable 'eslint' +-- vim.lsp.enable 'tsserver' vim.lsp.enable 'tailwindcss' local capabilities = vim.lsp.protocol.make_client_capabilities() @@ -27,103 +30,47 @@ capabilities.textDocument.foldingRange = { } local function on_attach(bufnr) + -- 'opts' table to avoid repetition for buffer and remap settings local opts = { buffer = bufnr, remap = false } - vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts) - vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts) - vim.keymap.set('n', 'vws', vim.lsp.buf.workspace_symbol, opts) - vim.keymap.set('n', 'vd', vim.diagnostic.open_float, opts) - vim.keymap.set('n', '[d', vim.diagnostic.goto_next, opts) - vim.keymap.set('n', ']d', vim.diagnostic.goto_prev, opts) - vim.keymap.set('n', 'dd', vim.diagnostic.setloclist, opts) - vim.keymap.set('n', 'do', vim.diagnostic.open_float, opts) - vim.keymap.set('n', 'ca', vim.lsp.buf.code_action, opts) - vim.keymap.set('n', 'gd', require('telescope.builtin').lsp_definitions, opts) - vim.keymap.set('n', 'gr', require('telescope.builtin').lsp_references, opts) - vim.keymap.set('n', 'rn', vim.lsp.buf.rename, opts) + -- Require Telescope for LSP-related functions + local tele = require 'telescope.builtin' + + -- Set up keymaps with clear descriptions + vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, { desc = 'Lsp: Goto Declaration', buffer = bufnr, remap = false }) + vim.keymap.set('n', 'K', vim.lsp.buf.hover, { desc = 'Lsp: Hover Documentation', buffer = bufnr, remap = false }) + vim.keymap.set('n', 'vws', vim.lsp.buf.workspace_symbol, { desc = 'Lsp: Workspace Symbols', buffer = bufnr, remap = false }) + vim.keymap.set('n', 'vd', vim.diagnostic.open_float, { desc = 'Lsp: View Line Diagnostic', buffer = bufnr, remap = false }) + vim.keymap.set('n', '[d', vim.diagnostic.goto_next, { desc = 'Lsp: Next Diagnostic', buffer = bufnr, remap = false }) + vim.keymap.set('n', ']d', vim.diagnostic.goto_prev, { desc = 'Lsp: Previous Diagnostic', buffer = bufnr, remap = false }) + vim.keymap.set('n', 'dd', vim.diagnostic.setloclist, { desc = 'Lsp: List Diagnostics', buffer = bufnr, remap = false }) + vim.keymap.set('n', 'do', vim.diagnostic.open_float, { desc = 'Lsp: Open Diagnostic Float', buffer = bufnr, remap = false }) + vim.keymap.set('n', 'ca', vim.lsp.buf.code_action, { desc = 'Lsp: Code Action', buffer = bufnr, remap = false }) + vim.keymap.set('n', 'gd', require('telescope.builtin').lsp_definitions, { desc = 'Lsp: Goto Definition', buffer = bufnr, remap = false }) + vim.keymap.set('n', 'gr', require('telescope.builtin').lsp_references, { desc = 'Lsp: Goto References', buffer = bufnr, remap = false }) + vim.keymap.set('n', 'rn', vim.lsp.buf.rename, { desc = 'Lsp: Rename Symbol', buffer = bufnr, remap = false }) + vim.keymap.set('n', 'lf', function() - require('conform').format() - end, { buffer = bufnr, desc = 'Format Buffer' }) - vim.keymap.set('n', 'wa', vim.lsp.buf.add_workspace_folder, opts) - vim.keymap.set('n', 'wr', vim.lsp.buf.remove_workspace_folder, opts) + require('conform').format { bufnr = bufnr } + end, { buffer = bufnr, desc = 'Lsp: Format Buffer' }) + + vim.keymap.set('n', 'wa', vim.lsp.buf.add_workspace_folder, { desc = 'Lsp: Add Workspace Folder', buffer = bufnr, remap = false }) + vim.keymap.set('n', 'wr', vim.lsp.buf.remove_workspace_folder, { desc = 'Lsp: Remove Workspace Folder', buffer = bufnr, remap = false }) vim.keymap.set('n', 'wl', function() print(vim.inspect(vim.lsp.buf.list_workspace_folders())) - end, opts) + end, { desc = 'Lsp: List Workspace Folders', buffer = bufnr, remap = false }) + + local tele = require 'telescope.builtin' + + vim.keymap.set('n', 'fs', tele.lsp_document_symbols, { desc = 'Lsp: Document Symbols (Current File)', buffer = bufnr, remap = false }) + vim.keymap.set('n', 'fS', tele.lsp_dynamic_workspace_symbols, { desc = 'Lsp: Workspace Symbols (Dynamic)', buffer = bufnr, remap = false }) + vim.keymap.set('n', 'ft', tele.lsp_type_definitions, { desc = 'Lsp: Goto Type Definition', buffer = bufnr, remap = false }) + vim.keymap.set('n', 'fi', tele.lsp_implementations, { desc = 'Lsp: Goto Implementations', buffer = bufnr, remap = false }) end vim.api.nvim_create_autocmd('LspAttach', { group = vim.api.nvim_create_augroup('UserLspConfig', {}), callback = function(ev) on_attach(ev.buf) - -- local map = function(keys, func, desc) - -- vim.keymap.set('n', keys, func, { buffer = ev.buf, desc = 'Lsp: ' .. desc }) - -- end - - -- local tele = require 'telescope.builtin' - -- map('gd', tele.lsp_definitions, 'Goto Definition') - -- map('gr', tele.lsp_references, 'Goto References') - -- - -- map('K', vim.lsp.buf.hover, 'hover') - -- - -- map('n', 'vws', vim.lsp.buf.workspace_symbol, 'Workspace Symbols') - -- - -- map('n', 'vd', vim.diagnostic.open_float, 'View Diagnostic') - -- - -- map('n', '[d', vim.diagnostic.goto_next, 'Goto Next Diagnostic') - -- map('n', ']d', vim.diagnostic.goto_prev, 'Goto Preview Diagnostic') - -- map('n', 'dd', vim.diagnostic.setloclist, 'List Diagnostics') - -- map('n', 'do', vim.diagnostic.open_float, 'List All Diagnostics') - -- map('n', 'ca', vim.lsp.buf.code_action, 'Code Action') - -- - -- map('fs', tele.lsp_document_symbols, 'Doc Symbols') - -- map('fS', tele.lsp_dynamic_workspace_symbols, 'Dynamic Symbols') - -- map('ft', tele.lsp_type_definitions, 'Goto Type') - -- map('fi', tele.lsp_implementations, 'Goto Impl') - -- - -- map('n', 'rn', vim.lsp.buf.rename, 'Rename') - -- map('n', 'lf', function() - -- require('conform').format() - -- end, 'Format Buffer') - -- - -- map('n', 'wa', vim.lsp.buf.add_workspace_folder, 'Add WorkSpace') - -- map('n', 'wr', vim.lsp.buf.remove_workspace_folder, 'Remove WorkSpace') - -- map('n', 'wl', function() - -- print(vim.inspect(vim.lsp.buf.list_workspace_folders())) - -- end, 'List Work Spaces') end, }) --- vim.lsp.on_attach(on_attach) --- vim.lsp.setup() --- --- vim.diagnostic.config { --- virtual_text = true, --- } - --- Fix Undefined global 'vim' --- vim.lsp.nvim_workspace() - --- local cmp = require 'cmp' --- local cmp_select = { behavior = cmp.SelectBehavior.Select } --- local cmp_mappings = vim.lsp.defaults.cmp_mappings { --- [''] = cmp.mapping.select_prev_item(cmp_select), --- [''] = cmp.mapping.select_next_item(cmp_select), --- [''] = cmp.mapping.confirm { select = true }, --- [''] = cmp.mapping.complete(), --- } - --- cmp_mappings[''] = nil --- cmp_mappings[''] = nil - --- vim.lsp.setup_nvim_cmp { --- mapping = cmp_mappings, --- } - --- vim.lsp.set_preferences { --- suggest_lsp_servers = false, --- sign_icons = { --- error = '⛔️', --- warn = '⚠️', --- hint = '🧐', --- info = 'I', --- }, --- } diff --git a/after/plugin/tailwind-config.lua b/after/plugin/tailwind-config.lua deleted file mode 100644 index b15db54ff84..00000000000 --- a/after/plugin/tailwind-config.lua +++ /dev/null @@ -1,17 +0,0 @@ -require('tailwind-tools').setup { - document_color = { - enabled = true, -- can be toggled by commands - kind = 'inline', -- "inline" | "foreground" | "background" - inline_symbol = '󰝤 ', -- only used in inline mode - debounce = 200, -- in milliseconds, only applied in insert mode - }, - conceal = { - enabled = false, -- can be toggled by commands - min_length = nil, -- only conceal classes exceeding the provided length - symbol = '󱏿', -- only a single character is allowed - highlight = { -- extmark highlight options, see :h 'highlight' - fg = '#38BDF8', - }, - }, - custom_filetypes = {}, -- see the extension section to learn how it works -} diff --git a/lazy-lock.json b/lazy-lock.json index 7be19d18e48..a71f325508d 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -20,7 +20,7 @@ "lspkind-nvim": { "branch": "master", "commit": "d79a1c3299ad0ef94e255d045bed9fa26025dab6" }, "lua-async-await": { "branch": "main", "commit": "652d94df34e97abe2d4a689edbc4270e7ead1a98" }, "lualine.nvim": { "branch": "master", "commit": "0c6cca9f2c63dadeb9225c45bc92bb95a151d4af" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "67da97f8c2fd12d05427bb485ce07ee6418e0a51" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "60eaff7a470b8e78ddff09d847d17a011f560759" }, "mason.nvim": { "branch": "main", "commit": "8024d64e1330b86044fed4c8494ef3dcd483a67c" }, "mini.ai": { "branch": "main", "commit": "4b5348fac5912f1957f4c012c2e0ab0c4b865386" }, "mini.comment": { "branch": "main", "commit": "22ee9f6be1c78bcebe009a564758e5b6df08903b" }, @@ -49,6 +49,7 @@ "tailwind-tools.nvim": { "branch": "master", "commit": "fbe982901d4508b0dcd80e07addf0fcb6dab6c49" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" }, "telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, + "typescript-tools.nvim": { "branch": "master", "commit": "3c501d7c7f79457932a8750a2a1476a004c5c1a9" }, "undotree": { "branch": "master", "commit": "b951b87b46c34356d44aa71886aecf9dd7f5788a" }, "vi-mongo.nvim": { "branch": "master", "commit": "ac21b4de10b9409c872e81a34b41cee52bf7174c" }, "vim-dadbod": { "branch": "master", "commit": "e95afed23712f969f83b4857a24cf9d59114c2e6" }, diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index c43e6473113..58825056b69 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -22,5 +22,5 @@ return { { 'rafamadriz/friendly-snippets' }, }, -- Use the lazy option to lazy-load the plugin on events or commands - lazy = true, + lazy = false, } diff --git a/lua/plugins/nvim-cmp.lua b/lua/plugins/nvim-cmp.lua index aa03ed1a3d8..b4785a86961 100644 --- a/lua/plugins/nvim-cmp.lua +++ b/lua/plugins/nvim-cmp.lua @@ -3,7 +3,7 @@ return { { 'hrsh7th/nvim-cmp', dependencies = { - 'luckasRanarison/tailwind-tools.nvim', + -- 'luckasRanarison/tailwind-tools.nvim', 'onsails/lspkind-nvim', -- Snippet Engine & its associated nvim-cmp source 'L3MON4D3/LuaSnip', @@ -16,11 +16,11 @@ return { opts = function() return { -- ... - formatting = { - format = require('lspkind').cmp_format { - before = require('tailwind-tools.cmp').lspkind_format, - }, - }, + -- formatting = { + -- format = require('lspkind').cmp_format { + -- before = require('tailwind-tools.cmp').lspkind_format, + -- }, + -- }, } end, }, diff --git a/lua/plugins/tailwind-tools.lua b/lua/plugins/tailwind-tools.lua deleted file mode 100644 index 82140ecc9e3..00000000000 --- a/lua/plugins/tailwind-tools.lua +++ /dev/null @@ -1,5 +0,0 @@ -return { - 'luckasRanarison/tailwind-tools.nvim', - dependencies = { 'nvim-treesitter/nvim-treesitter' }, - opts = {}, -- your configuration -} diff --git a/after/plugin/nvim-java-config.lua b/nvim-java-config.lua similarity index 100% rename from after/plugin/nvim-java-config.lua rename to nvim-java-config.lua From b64cf5e3ce276a83fb11e4178f26ef0a7b94bd47 Mon Sep 17 00:00:00 2001 From: Oluwatobi Date: Sat, 31 May 2025 16:29:30 +0100 Subject: [PATCH 36/40] js, py, go working --- after/plugin/lsp-config.lua | 4 ++-- .../plugin/nvim-java-config.lua | 0 after/plugin/tailwind-tool-config.lua | 3 +++ lazy-lock.json | 3 +-- lua/plugins/nvim-cmp.lua | 13 ++++++------- lua/plugins/tailwind-tools.lua | 11 +++++++++++ 6 files changed, 23 insertions(+), 11 deletions(-) rename nvim-java-config.lua => after/plugin/nvim-java-config.lua (100%) create mode 100644 after/plugin/tailwind-tool-config.lua create mode 100644 lua/plugins/tailwind-tools.lua diff --git a/after/plugin/lsp-config.lua b/after/plugin/lsp-config.lua index ba0414dfa88..cbe031e2f59 100644 --- a/after/plugin/lsp-config.lua +++ b/after/plugin/lsp-config.lua @@ -17,8 +17,8 @@ vim.lsp.enable 'dartls' -- vim.lsp.enable 'jsonls' -- vim.lsp.enable 'html' -vim.lsp.enable 'tsserver' -vim.lsp.enable 'eslint' +vim.lsp.enable 'ts_ls' +-- vim.lsp.enable 'eslint' -- vim.lsp.enable 'tsserver' vim.lsp.enable 'tailwindcss' diff --git a/nvim-java-config.lua b/after/plugin/nvim-java-config.lua similarity index 100% rename from nvim-java-config.lua rename to after/plugin/nvim-java-config.lua diff --git a/after/plugin/tailwind-tool-config.lua b/after/plugin/tailwind-tool-config.lua new file mode 100644 index 00000000000..a85525058bc --- /dev/null +++ b/after/plugin/tailwind-tool-config.lua @@ -0,0 +1,3 @@ +require("tailwind-tools").setup({ + +}) diff --git a/lazy-lock.json b/lazy-lock.json index a71f325508d..f547ce7e846 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -46,10 +46,9 @@ "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, "promise-async": { "branch": "main", "commit": "119e8961014c9bfaf1487bf3c2a393d254f337e2" }, "spring-boot.nvim": { "branch": "main", "commit": "218c0c26c14d99feca778e4d13f5ec3e8b1b60f0" }, - "tailwind-tools.nvim": { "branch": "master", "commit": "fbe982901d4508b0dcd80e07addf0fcb6dab6c49" }, + "tailwind-tools": { "branch": "master", "commit": "fbe982901d4508b0dcd80e07addf0fcb6dab6c49" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" }, "telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, - "typescript-tools.nvim": { "branch": "master", "commit": "3c501d7c7f79457932a8750a2a1476a004c5c1a9" }, "undotree": { "branch": "master", "commit": "b951b87b46c34356d44aa71886aecf9dd7f5788a" }, "vi-mongo.nvim": { "branch": "master", "commit": "ac21b4de10b9409c872e81a34b41cee52bf7174c" }, "vim-dadbod": { "branch": "master", "commit": "e95afed23712f969f83b4857a24cf9d59114c2e6" }, diff --git a/lua/plugins/nvim-cmp.lua b/lua/plugins/nvim-cmp.lua index b4785a86961..443e97bc79c 100644 --- a/lua/plugins/nvim-cmp.lua +++ b/lua/plugins/nvim-cmp.lua @@ -3,7 +3,7 @@ return { { 'hrsh7th/nvim-cmp', dependencies = { - -- 'luckasRanarison/tailwind-tools.nvim', + 'tailwind-tools', 'onsails/lspkind-nvim', -- Snippet Engine & its associated nvim-cmp source 'L3MON4D3/LuaSnip', @@ -15,12 +15,11 @@ return { }, opts = function() return { - -- ... - -- formatting = { - -- format = require('lspkind').cmp_format { - -- before = require('tailwind-tools.cmp').lspkind_format, - -- }, - -- }, + formatting = { + format = require('lspkind').cmp_format { + before = require('tailwind-tools.cmp').lspkind_format, + }, + }, } end, }, diff --git a/lua/plugins/tailwind-tools.lua b/lua/plugins/tailwind-tools.lua new file mode 100644 index 00000000000..e435d615200 --- /dev/null +++ b/lua/plugins/tailwind-tools.lua @@ -0,0 +1,11 @@ +return { + "luckasRanarison/tailwind-tools.nvim", + name = "tailwind-tools", + build = ":UpdateRemotePlugins", + dependencies = { + "nvim-treesitter/nvim-treesitter", + "nvim-telescope/telescope.nvim", -- optional + "neovim/nvim-lspconfig", -- optional + }, + opts = {} -- your configuration +} From 8bad3cd11c4682f1a7bd773ca1b5a452eb08aeaa Mon Sep 17 00:00:00 2001 From: Oluwatobi Date: Wed, 4 Jun 2025 16:10:55 +0100 Subject: [PATCH 37/40] java --- after/plugin/nvim-java-config.lua | 1 - ftplugin/java.lua | 161 ++++++++---------------------- 2 files changed, 43 insertions(+), 119 deletions(-) diff --git a/after/plugin/nvim-java-config.lua b/after/plugin/nvim-java-config.lua index 7562139bcaf..9a8169cac22 100644 --- a/after/plugin/nvim-java-config.lua +++ b/after/plugin/nvim-java-config.lua @@ -33,7 +33,6 @@ capabilities.textDocument.foldingRange = { lineFoldingOnly = true, } -require('java').setup() require('lspconfig').jdtls.setup { on_attach = on_attach, capabilities = capabilities, diff --git a/ftplugin/java.lua b/ftplugin/java.lua index ace1b730191..9994f2e5abb 100644 --- a/ftplugin/java.lua +++ b/ftplugin/java.lua @@ -1,111 +1,64 @@ --- Java Language Server configuration. --- Locations: --- 'nvim/ftplugin/java.lua'. --- 'nvim/lang-servers/intellij-java-google-style.xml' - local jdtls_ok, jdtls = pcall(require, 'jdtls') if not jdtls_ok then - vim.notify 'JDTLS not found, install with `:LspInstall jdtls`' + vim.notify 'JDTLS not found, install with `:MasonInstall jdtls`' return end --- See `:help vim.lsp.start_client` for an overview of the supported `config` options. --- local jdtls_path = vim.fn.stdpath 'data' .. '/mason/packages/jdtls' -local jdtls_path = '/Users/oluwatobibello/.local/share/nvim/mason/packages/jdtls' +-- Path setup +local jdtls_path = vim.fn.stdpath('data') .. '/mason/packages/jdtls' local path_to_lsp_server = jdtls_path .. '/config_mac' local path_to_plugins = jdtls_path .. '/plugins/' -local path_to_jar = path_to_plugins .. 'org.eclipse.equinox.launcher_*.jar' -local lombok_path = path_to_plugins .. 'lombok.jar' +local path_to_jar = vim.fn.glob(path_to_plugins .. 'org.eclipse.equinox.launcher_*.jar') +local lombok_path = vim.fn.glob(path_to_plugins .. 'lombok.jar') -local root_markers = { '.git', 'mvnw', 'gradlew', 'pom.xml', 'build.gradle' } -local root_dir = require('jdtls.setup').find_root(root_markers) -if root_dir == '' then - return -end +-- Java home directories +local java_17_home = '/Library/Java/JavaVirtualMachines/zulu-17.jdk/Contents/Home' + +-- Root directory detection +local root_dir = require('jdtls.setup').find_root({'.git', 'mvnw', 'gradlew', 'pom.xml', 'build.gradle'}) +if root_dir == '' then return end -local project_name = vim.fn.fnamemodify(vim.fn.getcwd(), ':p:h:t') -local workspace_dir = vim.fn.stdpath 'data' .. '/site/java/workspace-root/' .. project_name -os.execute('mkdir ' .. workspace_dir) +-- Workspace setup +local project_name = vim.fn.fnamemodify(root_dir, ':p:h:t') +local workspace_dir = vim.fn.stdpath('data') .. '/site/java/workspace-root/' .. project_name +vim.fn.mkdir(workspace_dir, 'p') -local java_21_home_dir = '/Library/Java/JavaVirtualMachines/openjdk.jdk/Contents/Home/bin/java' -local java_17_home_dir = '/Library/Java/JavaVirtualMachines/zulu-17.jdk/Contents/Home' -local java_11_home_dir = '/Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home' +print(workspace_dir) -- Main Config local config = { - -- The command that starts the language server - -- See: https://github.com/eclipse/eclipse.jdt.ls#running-from-the-command-line cmd = { - java_21_home_dir .. '/bin/java', + java_17_home .. '/bin/java', '-Declipse.application=org.eclipse.jdt.ls.core.id1', '-Dosgi.bundles.defaultStartLevel=4', '-Declipse.product=org.eclipse.jdt.ls.core.product', '-Dlog.protocol=true', - '-Xmx1g', '-Dlog.level=ALL', - '--add-modules=ALL-SYSTEM', - '--add-opens', - 'java.base/java.util=ALL-UNNAMED', - '--add-opens', - 'java.base/java.lang=ALL-UNNAMED', - '-javaagent:' .. lombok_path, '-Xms1g', '--add-modules=ALL-SYSTEM', - '--add-opens', - 'java.base/java.util=ALL-UNNAMED', - '--add-opens', - 'java.base/java.lang=ALL-UNNAMED', - - '-jar', - path_to_jar, - '-configuration', - path_to_lsp_server, - '-data', - workspace_dir, + '--add-opens', 'java.base/java.util=ALL-UNNAMED', + '--add-opens', 'java.base/java.lang=ALL-UNNAMED', + '-javaagent:' .. lombok_path, + '-jar', path_to_jar, + '-configuration', path_to_lsp_server, + '-data', workspace_dir, }, - -- This is the default if not provided, you can remove it. Or adjust as needed. - -- One dedicated LSP server & client will be started per unique root_dir root_dir = root_dir, - -- Here you can configure eclipse.jdt.ls specific settings - -- See https://github.com/eclipse/eclipse.jdt.ls/wiki/Running-the-JAVA-LS-server-from-the-command-line#initialize-request - -- for a list of options settings = { java = { - home = java_21_home_dir, - eclipse = { - downloadSources = true, - }, + eclipse = { downloadSources = true }, + maven = { downloadSources = true }, + implementationsCodeLens = { enabled = true }, + referencesCodeLens = { enabled = true }, + references = { includeDecompiledSources = true }, configuration = { updateBuildConfiguration = 'interactive', runtimes = { - { - name = 'JavaSE-21', - path = java_21_home_dir, - }, - { - name = 'JavaSE-11', - path = java_11_home_dir, - }, - { - name = 'JavaSE-17', - path = java_17_home_dir, - }, - }, - }, - maven = { - downloadSources = true, - }, - implementationsCodeLens = { - enabled = true, - }, - referencesCodeLens = { - enabled = true, - }, - references = { - includeDecompiledSources = true, - }, + { name = 'JavaSE-17', path = java_17_home, default = true } + } + } }, signatureHelp = { enabled = true }, completion = { @@ -117,49 +70,21 @@ local config = { 'java.util.Objects.requireNonNull', 'java.util.Objects.requireNonNullElse', 'org.mockito.Mockito.*', - }, - importOrder = { - 'com', - 'java', - 'jarkata', - 'javax', - 'org', - }, - }, - sources = { - organizeImports = { - starThreshold = 9999, - staticStarThreshold = 9999, - }, - }, - codeGeneration = { - toString = { - template = '${object.className}{${member.name()}=${member.value}, ${otherMembers}}', - }, - useBlocks = true, - }, + } + } }, - flags = { - allow_incremental_sync = true, - }, - init_options = { - bundles = {}, - }, + flags = { allow_incremental_sync = true }, + init_options = { bundles = {} } } -config['on_attach'] = function(_, bufnr) - require('keymaps').map_java_keys(bufnr) - require('lsp_signature').on_attach({ - bind = true, -- This is mandatory, otherwise border config won't get registered. - floating_window_above_cur_line = false, - padding = '', - handler_opts = { - border = 'rounded', - }, - }, bufnr) +-- Keymaps setup +config.on_attach = function(_, bufnr) + -- Your keymaps here + vim.keymap.set('n', 'rn', vim.lsp.buf.rename, { buffer = bufnr }) + vim.keymap.set('n', 'gd', vim.lsp.buf.definition, { buffer = bufnr }) + -- Add other keymaps from your deleted nvim-java-config end --- This starts a new client & server, --- or attaches to an existing client & server depending on the `root_dir`. -require('jdtls').start_or_attach(config) +-- Start JDTLS +jdtls.start_or_attach(config) From f2f4ff708b8d042cca113f18d8836de3efb86696 Mon Sep 17 00:00:00 2001 From: Oluwatobi Date: Mon, 23 Jun 2025 21:06:13 +0100 Subject: [PATCH 38/40] java working --- ftplugin/java.lua | 41 +++++++++++++++++++++++++------ lazy-lock.json | 51 +++++++++++++++++---------------------- lua/plugins/nvim-java.lua | 2 +- 3 files changed, 56 insertions(+), 38 deletions(-) diff --git a/ftplugin/java.lua b/ftplugin/java.lua index 9994f2e5abb..076e4310363 100644 --- a/ftplugin/java.lua +++ b/ftplugin/java.lua @@ -1,6 +1,6 @@ local jdtls_ok, jdtls = pcall(require, 'jdtls') if not jdtls_ok then - vim.notify 'JDTLS not found, install with `:MasonInstall jdtls`' + vim.notify('JDTLS not found, install with `:MasonInstall jdtls`', vim.log.levels.ERROR) return end @@ -11,19 +11,41 @@ local path_to_plugins = jdtls_path .. '/plugins/' local path_to_jar = vim.fn.glob(path_to_plugins .. 'org.eclipse.equinox.launcher_*.jar') local lombok_path = vim.fn.glob(path_to_plugins .. 'lombok.jar') +-- Debug: Print paths +-- print("JDTLS Path: " .. jdtls_path) +-- print("LSP Server Path: " .. path_to_lsp_server) +-- print("JAR Path: " .. path_to_jar) +-- print("Lombok Path: " .. lombok_path) + +-- Check if paths exist +if vim.fn.executable(vim.fn.glob('/Library/Java/JavaVirtualMachines/openjdk.jdk/Contents/Home/bin/java')) == 0 then + vim.notify('Java 17 not found at expected path', vim.log.levels.ERROR) + return +end + +if path_to_jar == '' then + vim.notify('JDTLS JAR not found', vim.log.levels.ERROR) + return +end + -- Java home directories -local java_17_home = '/Library/Java/JavaVirtualMachines/zulu-17.jdk/Contents/Home' +local java_17_home = '/Library/Java/JavaVirtualMachines/openjdk.jdk/Contents/Home' -- Root directory detection local root_dir = require('jdtls.setup').find_root({'.git', 'mvnw', 'gradlew', 'pom.xml', 'build.gradle'}) -if root_dir == '' then return end +if root_dir == '' then + print("No root directory found") + return +end + +-- print("Root directory: " .. root_dir) -- Workspace setup local project_name = vim.fn.fnamemodify(root_dir, ':p:h:t') local workspace_dir = vim.fn.stdpath('data') .. '/site/java/workspace-root/' .. project_name vim.fn.mkdir(workspace_dir, 'p') -print(workspace_dir) +-- print("Workspace directory: " .. workspace_dir) -- Main Config local config = { @@ -33,7 +55,7 @@ local config = { '-Dosgi.bundles.defaultStartLevel=4', '-Declipse.product=org.eclipse.jdt.ls.core.product', '-Dlog.protocol=true', - '-Dlog.level=ALL', + '-Dlog.level=ALL', -- Changed back to ALL for debugging '-Xms1g', '--add-modules=ALL-SYSTEM', '--add-opens', 'java.base/java.util=ALL-UNNAMED', @@ -80,11 +102,14 @@ local config = { -- Keymaps setup config.on_attach = function(_, bufnr) - -- Your keymaps here + vim.notify('JDTLS attached to buffer ' .. bufnr, vim.log.levels.INFO) vim.keymap.set('n', 'rn', vim.lsp.buf.rename, { buffer = bufnr }) vim.keymap.set('n', 'gd', vim.lsp.buf.definition, { buffer = bufnr }) - -- Add other keymaps from your deleted nvim-java-config end --- Start JDTLS +-- Debug: Print config command +-- print("JDTLS Command: " .. table.concat(config.cmd, ' ')) +-- +-- -- Start JDTLS +-- print("Starting JDTLS...") jdtls.start_or_attach(config) diff --git a/lazy-lock.json b/lazy-lock.json index f547ce7e846..de0cc15873d 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,7 +1,7 @@ { - "LuaSnip": { "branch": "master", "commit": "faf3c94a44508cec1b961406d36cc65113ff3b98" }, + "LuaSnip": { "branch": "master", "commit": "fb525166ccc30296fb3457441eb979113de46b00" }, "alpha-nvim": { "branch": "main", "commit": "a35468cd72645dbd52c0624ceead5f301c566dff" }, - "catppuccin": { "branch": "main", "commit": "387b4b19568cbda82c1d6def9ded31fd6ae7fb99" }, + "catppuccin": { "branch": "main", "commit": "fa42eb5e26819ef58884257d5ae95dd0552b9a66" }, "cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" }, "cmp-cmdline": { "branch": "main", "commit": "d126061b624e0af6c3a556428712dd4d4194ec6d" }, "cmp-nvim-lsp": { "branch": "main", "commit": "a8912b88ce488f411177fc8aed358b04dc246d7b" }, @@ -9,43 +9,36 @@ "cmp-path": { "branch": "main", "commit": "c6635aae33a50d6010bf1aa756ac2398a2d54c32" }, "cmp-vsnip": { "branch": "main", "commit": "989a8a73c44e926199bfd05fa7a516d51f2d2752" }, "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, - "conform.nvim": { "branch": "master", "commit": "6feb2f28f9a9385e401857b21eeac3c1b66dd628" }, + "conform.nvim": { "branch": "master", "commit": "8132ec733eed3bf415b97b76797ca41b59f51d7d" }, "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, - "gitsigns.nvim": { "branch": "main", "commit": "8bdaccdb897945a3c99c1ad8df94db0ddf5c8790" }, - "gopher.nvim": { "branch": "main", "commit": "9db5931af1293ae52500921d92c02145d86df02c" }, - "hererocks": { "branch": "master", "commit": "344c46ed54df9a4dbc2d2bf510dcd9a9d90497bf" }, + "gitsigns.nvim": { "branch": "main", "commit": "1b0350ab707713b2bc6c236151f1a324175347b1" }, + "gopher.nvim": { "branch": "main", "commit": "de585144ebde9f0516fb9b542dd42e90c7835b59" }, + "hererocks": { "branch": "master", "commit": "4ce92131e9858950440ab99a25db9a9b43db8cd4" }, "image.nvim": { "branch": "master", "commit": "4c51d6202628b3b51e368152c053c3fb5c5f76f2" }, "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, - "lazygit.nvim": { "branch": "main", "commit": "b9eae3badab982e71abab96d3ee1d258f0c07961" }, + "lazygit.nvim": { "branch": "main", "commit": "4839ab642962cc76bb1bf278427dc4c59be15072" }, "lspkind-nvim": { "branch": "master", "commit": "d79a1c3299ad0ef94e255d045bed9fa26025dab6" }, - "lua-async-await": { "branch": "main", "commit": "652d94df34e97abe2d4a689edbc4270e7ead1a98" }, - "lualine.nvim": { "branch": "master", "commit": "0c6cca9f2c63dadeb9225c45bc92bb95a151d4af" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "60eaff7a470b8e78ddff09d847d17a011f560759" }, + "lualine.nvim": { "branch": "master", "commit": "a94fc68960665e54408fe37dcf573193c4ce82c9" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "c4c84f4521d62de595c0d0f718a9a40c1890c8ce" }, "mason.nvim": { "branch": "main", "commit": "8024d64e1330b86044fed4c8494ef3dcd483a67c" }, - "mini.ai": { "branch": "main", "commit": "4b5348fac5912f1957f4c012c2e0ab0c4b865386" }, - "mini.comment": { "branch": "main", "commit": "22ee9f6be1c78bcebe009a564758e5b6df08903b" }, - "mini.surround": { "branch": "main", "commit": "f4307f935ad87cfe3e570dbaae485b35cce4e5ec" }, + "mini.ai": { "branch": "main", "commit": "d172ada7b0281044a06cb9a625a862553c457b6f" }, + "mini.comment": { "branch": "main", "commit": "51c173dffa17dc14c81169deaeea430bd394ab51" }, + "mini.surround": { "branch": "main", "commit": "1a2b59c77a0c4713a5bd8972da322f842f4821b1" }, "neo-tree.nvim": { "branch": "v3.x", "commit": "f481de16a0eb59c985abac8985e3f2e2f75b4875" }, - "nui.nvim": { "branch": "main", "commit": "7cd18e73cfbd70e1546931b7268b3eebaeff9391" }, - "nvim-autopairs": { "branch": "master", "commit": "4d74e75913832866aa7de35e4202463ddf6efd1b" }, + "nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" }, + "nvim-autopairs": { "branch": "master", "commit": "2647cce4cb64fb35c212146663384e05ae126bdf" }, "nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" }, - "nvim-dap": { "branch": "master", "commit": "b0f983507e3702f073bfe1516846e58b56d4e42f" }, - "nvim-java": { "branch": "main", "commit": "7c2e81caa301b0d1bc7992b88981af883b3b5d6b" }, - "nvim-java-core": { "branch": "main", "commit": "401bf7683012a25929a359deec418f36beb876e2" }, - "nvim-java-dap": { "branch": "main", "commit": "55f239532f7a3789d21ea68d1e795abc77484974" }, - "nvim-java-refactor": { "branch": "main", "commit": "b51a57d862338999059e1d1717df3bc80a3a15c0" }, - "nvim-java-test": { "branch": "main", "commit": "7f0f40e9c5b7eab5096d8bec6ac04251c6e81468" }, - "nvim-lspconfig": { "branch": "master", "commit": "03bc581e05e81d33808b42b2d7e76d70adb3b595" }, + "nvim-jdtls": { "branch": "master", "commit": "4d77ff02063cf88963d5cf10683ab1fd15d072de" }, + "nvim-lspconfig": { "branch": "master", "commit": "5e0e9c00d51fcb7efef0d4c49023f9593b38661e" }, "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, - "nvim-treesitter-context": { "branch": "master", "commit": "ed1cf48d5af252248c55f50b9427e8ce883a2c6b" }, - "nvim-treesitter-textobjects": { "branch": "master", "commit": "0f051e9813a36481f48ca1f833897210dbcfffde" }, + "nvim-treesitter-context": { "branch": "master", "commit": "1a1a7c5d6d75cb49bf64049dafab15ebe294a79f" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "89ebe73cd2836db80a22d9748999ace0241917a5" }, "nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" }, - "nvim-ufo": { "branch": "main", "commit": "3c7a3570e9c9dc198a2ad4491b0b0e51c4d4ba08" }, - "nvim-web-devicons": { "branch": "master", "commit": "1fb58cca9aebbc4fd32b086cb413548ce132c127" }, + "nvim-ufo": { "branch": "main", "commit": "80fe8215ba566df2fbf3bf4d25f59ff8f41bc0e1" }, + "nvim-web-devicons": { "branch": "master", "commit": "19d6211c78169e78bab372b585b6fb17ad974e82" }, "nvim-window-picker": { "branch": "main", "commit": "6382540b2ae5de6c793d4aa2e3fe6dbb518505ec" }, "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, "promise-async": { "branch": "main", "commit": "119e8961014c9bfaf1487bf3c2a393d254f337e2" }, - "spring-boot.nvim": { "branch": "main", "commit": "218c0c26c14d99feca778e4d13f5ec3e8b1b60f0" }, "tailwind-tools": { "branch": "master", "commit": "fbe982901d4508b0dcd80e07addf0fcb6dab6c49" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" }, "telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, @@ -53,8 +46,8 @@ "vi-mongo.nvim": { "branch": "master", "commit": "ac21b4de10b9409c872e81a34b41cee52bf7174c" }, "vim-dadbod": { "branch": "master", "commit": "e95afed23712f969f83b4857a24cf9d59114c2e6" }, "vim-dadbod-completion": { "branch": "master", "commit": "a8dac0b3cf6132c80dc9b18bef36d4cf7a9e1fe6" }, - "vim-dadbod-ui": { "branch": "master", "commit": "460432301a5cb280ea265ddfa15c9f3dcd1d26b7" }, - "vim-fugitive": { "branch": "master", "commit": "4a745ea72fa93bb15dd077109afbb3d1809383f2" }, + "vim-dadbod-ui": { "branch": "master", "commit": "2900a1617b3df1a48683d872eadbe1101146a49a" }, + "vim-fugitive": { "branch": "master", "commit": "593f831d6f6d779cbabb70a4d1e6b1b1936a88af" }, "vim-rhubarb": { "branch": "master", "commit": "386daa2e9d98e23e27ad089afcbe5c5a903e488d" }, "vim-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" }, "vim-vsnip": { "branch": "master", "commit": "0a4b8419e44f47c57eec4c90df17567ad4b1b36e" }, diff --git a/lua/plugins/nvim-java.lua b/lua/plugins/nvim-java.lua index 3553267b5ec..c38647483ae 100644 --- a/lua/plugins/nvim-java.lua +++ b/lua/plugins/nvim-java.lua @@ -1 +1 @@ -return { 'nvim-java/nvim-java' } +return { "mfussenegger/nvim-jdtls" } From fef8f59469a08e4a06ab7314fc022a4405eba1dc Mon Sep 17 00:00:00 2001 From: Oluwatobi Date: Sat, 23 Aug 2025 09:39:33 +0100 Subject: [PATCH 39/40] updated lsp-config --- after/plugin/lsp-config.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/after/plugin/lsp-config.lua b/after/plugin/lsp-config.lua index cbe031e2f59..5944438a428 100644 --- a/after/plugin/lsp-config.lua +++ b/after/plugin/lsp-config.lua @@ -38,7 +38,8 @@ local function on_attach(bufnr) -- Set up keymaps with clear descriptions vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, { desc = 'Lsp: Goto Declaration', buffer = bufnr, remap = false }) - vim.keymap.set('n', 'K', vim.lsp.buf.hover, { desc = 'Lsp: Hover Documentation', buffer = bufnr, remap = false }) + vim.keymap.set('n', 'K', 'lua vim.lsp.buf.hover()', opts) + -- vim.keymap.set('n', 'K', vim.lsp.buf.hover, { desc = 'Lsp: Hover Documentation', buffer = bufnr, remap = false }) vim.keymap.set('n', 'vws', vim.lsp.buf.workspace_symbol, { desc = 'Lsp: Workspace Symbols', buffer = bufnr, remap = false }) vim.keymap.set('n', 'vd', vim.diagnostic.open_float, { desc = 'Lsp: View Line Diagnostic', buffer = bufnr, remap = false }) vim.keymap.set('n', '[d', vim.diagnostic.goto_next, { desc = 'Lsp: Next Diagnostic', buffer = bufnr, remap = false }) @@ -46,8 +47,8 @@ local function on_attach(bufnr) vim.keymap.set('n', 'dd', vim.diagnostic.setloclist, { desc = 'Lsp: List Diagnostics', buffer = bufnr, remap = false }) vim.keymap.set('n', 'do', vim.diagnostic.open_float, { desc = 'Lsp: Open Diagnostic Float', buffer = bufnr, remap = false }) vim.keymap.set('n', 'ca', vim.lsp.buf.code_action, { desc = 'Lsp: Code Action', buffer = bufnr, remap = false }) - vim.keymap.set('n', 'gd', require('telescope.builtin').lsp_definitions, { desc = 'Lsp: Goto Definition', buffer = bufnr, remap = false }) - vim.keymap.set('n', 'gr', require('telescope.builtin').lsp_references, { desc = 'Lsp: Goto References', buffer = bufnr, remap = false }) + vim.keymap.set('n', 'gd', tele.lsp_definitions, { desc = 'Lsp: Goto Definition', buffer = bufnr, remap = false }) + vim.keymap.set('n', 'gr', tele.lsp_references, { desc = 'Lsp: Goto References', buffer = bufnr, remap = false }) vim.keymap.set('n', 'rn', vim.lsp.buf.rename, { desc = 'Lsp: Rename Symbol', buffer = bufnr, remap = false }) vim.keymap.set('n', 'lf', function() @@ -64,7 +65,7 @@ local function on_attach(bufnr) vim.keymap.set('n', 'fs', tele.lsp_document_symbols, { desc = 'Lsp: Document Symbols (Current File)', buffer = bufnr, remap = false }) vim.keymap.set('n', 'fS', tele.lsp_dynamic_workspace_symbols, { desc = 'Lsp: Workspace Symbols (Dynamic)', buffer = bufnr, remap = false }) - vim.keymap.set('n', 'ft', tele.lsp_type_definitions, { desc = 'Lsp: Goto Type Definition', buffer = bufnr, remap = false }) + vim.keymap.set('n', 'ft', tele.lsp_type_definitions, { desc = 'Lsp: Goio Type Definition', buffer = bufnr, remap = false }) vim.keymap.set('n', 'fi', tele.lsp_implementations, { desc = 'Lsp: Goto Implementations', buffer = bufnr, remap = false }) end From 3c03d412e0ee9abcff555ae1b134333bddded2d1 Mon Sep 17 00:00:00 2001 From: Oluwatobi Date: Tue, 26 Aug 2025 11:50:22 +0100 Subject: [PATCH 40/40] updated treesitter --- after/plugin/treesitter-config.lua | 37 +++++++++++++----------------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/after/plugin/treesitter-config.lua b/after/plugin/treesitter-config.lua index 78f0e915555..32e8b88117e 100644 --- a/after/plugin/treesitter-config.lua +++ b/after/plugin/treesitter-config.lua @@ -1,24 +1,3 @@ --- See `:help nvim-treesitter` --- Defer Treesitter setup after first render to improve startup time of 'nvim {filename}' ---[[ vim.defer_fn(function() - require('nvim-treesitter.configs').setup { - ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'javascript', 'typescript', 'vimdoc', - 'vim' }, - auto_install = true, - highlight = { enable = true }, - indent = { enable = true }, - incremental_selection = { enable = true }, - textobjects = { - select = { enable = true, lookahead = true }, - move = { enable = true, set_jumps = true }, - swap = { enable = true }, - }, - opts = { - context_commentstring = { enable = true, enable_autocmd = false }, - }, - } -end, 0) ]] - require('nvim-treesitter.configs').setup { -- A list of parser names, or "all" ensure_installed = { @@ -115,6 +94,22 @@ require('nvim-treesitter.configs').setup { }, } +require'treesitter-context'.setup{ + enable = true, -- Enable this plugin (Can be enabled/disabled later via commands) + multiwindow = false, -- Enable multiwindow support. + max_lines = 0, -- How many lines the window should span. Values <= 0 mean no limit. + min_window_height = 0, -- Minimum editor window height to enable context. Values <= 0 mean no limit. + line_numbers = true, + multiline_threshold = 20, -- Maximum number of lines to show for a single context + trim_scope = 'outer', -- Which context lines to discard if `max_lines` is exceeded. Choices: 'inner', 'outer' + mode = 'cursor', -- Line used to calculate context. Choices: 'cursor', 'topline' + -- Separator between context and content. Should be a single character string, like '-'. + -- When separator is set, the context will only show up when there are at least 2 lines above cursorline. + separator = nil, + zindex = 20, -- The Z-index of the context window + on_attach = nil, -- (fun(buf: integer): boolean) return false to disable attaching +} + vim.filetype.add { extension = { templ = 'templ',