From d5f625c0f3dede2a18374cb4eb3dd46f87d6a089 Mon Sep 17 00:00:00 2001 From: Niccolo Borgioli Date: Sun, 17 Nov 2024 01:03:20 +0100 Subject: [PATCH] lazygit config --- files/nvim/.gitignore | 8 + files/nvim/.neoconf.json | 15 + files/nvim/LICENSE | 201 ++++++++++ files/nvim/README.md | 4 + files/nvim/init.lua | 571 +---------------------------- files/nvim/lazy-lock.json | 57 +++ files/nvim/lazyvim.json | 28 ++ files/nvim/lua/config/autocmds.lua | 3 + files/nvim/lua/config/keymaps.lua | 5 + files/nvim/lua/config/lazy.lua | 43 +++ files/nvim/lua/config/options.lua | 3 + files/nvim/lua/plugins/bg.lua | 3 + files/nvim/lua/plugins/hop.lua | 12 + files/nvim/lua/plugins/onedark.lua | 10 + files/nvim/stylua.toml | 3 + 15 files changed, 397 insertions(+), 569 deletions(-) create mode 100644 files/nvim/.gitignore create mode 100644 files/nvim/.neoconf.json create mode 100644 files/nvim/LICENSE create mode 100644 files/nvim/README.md create mode 100644 files/nvim/lazy-lock.json create mode 100644 files/nvim/lazyvim.json create mode 100644 files/nvim/lua/config/autocmds.lua create mode 100644 files/nvim/lua/config/keymaps.lua create mode 100644 files/nvim/lua/config/lazy.lua create mode 100644 files/nvim/lua/config/options.lua create mode 100644 files/nvim/lua/plugins/bg.lua create mode 100644 files/nvim/lua/plugins/hop.lua create mode 100644 files/nvim/lua/plugins/onedark.lua create mode 100644 files/nvim/stylua.toml diff --git a/files/nvim/.gitignore b/files/nvim/.gitignore new file mode 100644 index 0000000..cc5457a --- /dev/null +++ b/files/nvim/.gitignore @@ -0,0 +1,8 @@ +tt.* +.tests +doc/tags +debug +.repro +foo.* +*.log +data diff --git a/files/nvim/.neoconf.json b/files/nvim/.neoconf.json new file mode 100644 index 0000000..7c48087 --- /dev/null +++ b/files/nvim/.neoconf.json @@ -0,0 +1,15 @@ +{ + "neodev": { + "library": { + "enabled": true, + "plugins": true + } + }, + "neoconf": { + "plugins": { + "lua_ls": { + "enabled": true + } + } + } +} diff --git a/files/nvim/LICENSE b/files/nvim/LICENSE new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/files/nvim/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/files/nvim/README.md b/files/nvim/README.md new file mode 100644 index 0000000..185280b --- /dev/null +++ b/files/nvim/README.md @@ -0,0 +1,4 @@ +# 💤 LazyVim + +A starter template for [LazyVim](https://github.com/LazyVim/LazyVim). +Refer to the [documentation](https://lazyvim.github.io/installation) to get started. diff --git a/files/nvim/init.lua b/files/nvim/init.lua index 894080d..2514f9e 100644 --- a/files/nvim/init.lua +++ b/files/nvim/init.lua @@ -1,569 +1,2 @@ ---[[ - -===================================================================== -==================== 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, - } -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', - - { - "nvim-tree/nvim-tree.lua", - version = "*", - dependencies = { - "nvim-tree/nvim-web-devicons" - }, - config = function() - require("nvim-tree").setup { - } - end - - }, - - { 'akinsho/toggleterm.nvim', version = "*", config = true }, - - -- 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', 'gp', require('gitsigns').prev_hunk, - { buffer = bufnr, desc = '[G]o to [P]revious Hunk' }) - vim.keymap.set('n', 'gn', require('gitsigns').next_hunk, { buffer = bufnr, desc = '[G]o to [N]ext Hunk' }) - vim.keymap.set('n', 'ph', require('gitsigns').preview_hunk, { buffer = bufnr, desc = '[P]review [H]unk' }) - 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` - opts = { - char = '┊', - show_trailing_blankline_indent = false, - }, - }, - - -- "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', - }, - - - { - "kylechui/nvim-surround", - version = "*", -- Use for stability; omit to use `main` branch for the latest features - event = "VeryLazy", - config = function() - require("nvim-surround").setup({ - -- Configuration here, or leave empty to use defaults - }) - end - }, - - { - 'windwp/nvim-autopairs', - event = "InsertEnter", - opts = {} -- this is equalent to setup({}) function - }, - - { 'akinsho/toggleterm.nvim', version = "*", config = true }, - { 'LunarVim/bigfile.nvim', version = "*" } - - -- 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.relativenumber = true -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', 'st', require('telescope.builtin').treesitter, { desc = '[S]earch [T]reesitter' }) -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' }) - --- Terminal -require("toggleterm").setup {} - --- [[ Configure Treesitter ]] --- See `:help nvim-treesitter` -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', 'typescript', 'vimdoc', 'vim' }, - - -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!) - auto_install = true, - - 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', - }, - }, - }, -} - --- 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', vim.lsp.buf.implementation, '[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 - --- 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 +-- bootstrap lazy.nvim, LazyVim and your plugins +require("config.lazy") diff --git a/files/nvim/lazy-lock.json b/files/nvim/lazy-lock.json new file mode 100644 index 0000000..61ab313 --- /dev/null +++ b/files/nvim/lazy-lock.json @@ -0,0 +1,57 @@ +{ + "LazyVim": { "branch": "main", "commit": "704c29110d578186f0ca3eac67b753ddf52541fc" }, + "SchemaStore.nvim": { "branch": "main", "commit": "f8d6e9068861888651f68958521b1958314aac41" }, + "bg.nvim": { "branch": "main", "commit": "00a12555962047b71ccb1a724eaf3293d3e995de" }, + "bufferline.nvim": { "branch": "main", "commit": "5cc447cb2b463cb499c82eaeabbed4f5fa6a0a44" }, + "catppuccin": { "branch": "main", "commit": "637d99e638bc6f1efedac582f6ccab08badac0c6" }, + "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, + "cmp-git": { "branch": "main", "commit": "ec049036e354ed8ed0215f2427112882e1ea7051" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, + "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, + "conform.nvim": { "branch": "master", "commit": "023f795dbcf32d4351b6a9ed2e613d471b5bb812" }, + "crates.nvim": { "branch": "main", "commit": "8bf8358ee326d5d8c11dcd7ac0bcc9ff97dbc785" }, + "dashboard-nvim": { "branch": "master", "commit": "ae309606940d26d8c9df8b048a6e136b6bbec478" }, + "flash.nvim": { "branch": "main", "commit": "34c7be146a91fec3555c33fe89c7d643f6ef5cf1" }, + "friendly-snippets": { "branch": "main", "commit": "de8fce94985873666bd9712ea3e49ee17aadb1ed" }, + "fzf-lua": { "branch": "main", "commit": "2a7eb32871a131e24021dd1756865e475fe7e274" }, + "gitsigns.nvim": { "branch": "main", "commit": "ac5aba6dce8c06ea22bea2c9016f51a2dbf90dc7" }, + "grug-far.nvim": { "branch": "main", "commit": "9a2f78219390b47d67795ab09390d7f092e23976" }, + "hop.nvim": { "branch": "master", "commit": "08ddca799089ab96a6d1763db0b8adc5320bf050" }, + "indent-blankline.nvim": { "branch": "master", "commit": "7871a88056f7144defca9c931e311a3134c5d509" }, + "lazy.nvim": { "branch": "main", "commit": "7967abe55752aa90532e6bb4bd4663fe27a264cb" }, + "lazydev.nvim": { "branch": "main", "commit": "d5800897d9180cea800023f2429bce0a94ed6064" }, + "lualine.nvim": { "branch": "master", "commit": "2a5bae925481f999263d6f5ed8361baef8df4f83" }, + "luvit-meta": { "branch": "main", "commit": "ce76f6f6cdc9201523a5875a4471dcfe0186eb60" }, + "markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "cab00668464d2914d0752b86168b4a431cc93eb2" }, + "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, + "mini.ai": { "branch": "main", "commit": "31c149067d38b97720d2a179619f7745a0006ecc" }, + "mini.animate": { "branch": "main", "commit": "d33ddf0eefee6338bbd95805c4595c1b34e6bfe2" }, + "mini.comment": { "branch": "main", "commit": "a56581c40c19fa26f2b39da72504398de3173c5a" }, + "mini.icons": { "branch": "main", "commit": "54686be7d58807906cb2c8c2216e0bf9c044f19a" }, + "mini.pairs": { "branch": "main", "commit": "7e834c5937d95364cc1740e20d673afe2d034cdb" }, + "mini.surround": { "branch": "main", "commit": "48a9795c9d352c771e1ab5dedab6063c0a2df037" }, + "neo-tree.nvim": { "branch": "main", "commit": "a77af2e764c5ed4038d27d1c463fa49cd4794e07" }, + "noice.nvim": { "branch": "main", "commit": "221ffbc499d322699ea079fcd878a2399529e775" }, + "nui.nvim": { "branch": "main", "commit": "b58e2bfda5cea347c9d58b7f11cf3012c7b3953f" }, + "nvim-cmp": { "branch": "main", "commit": "f17d9b4394027ff4442b298398dfcaab97e40c4f" }, + "nvim-lint": { "branch": "master", "commit": "36da8dd0ddc4f88e0beae234c20e75397326f143" }, + "nvim-lspconfig": { "branch": "master", "commit": "87c7c83ce62971e0bdb29bb32b8ad2b19c8f95d0" }, + "nvim-snippets": { "branch": "main", "commit": "56b4052f71220144689caaa2e5b66222ba5661eb" }, + "nvim-treesitter": { "branch": "master", "commit": "20e10ca6914f65cf1410232433fb58de70ab6b39" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "3e450cd85243da99dc23ebbf14f9c70e9a0c26a4" }, + "nvim-ts-autotag": { "branch": "main", "commit": "e239a560f338be31337e7abc3ee42515daf23f5e" }, + "nvim-ts-context-commentstring": { "branch": "main", "commit": "9c74db656c3d0b1c4392fc89a016b1910539e7c0" }, + "persistence.nvim": { "branch": "main", "commit": "f6aad7dde7fcf54148ccfc5f622c6d5badd0cc3d" }, + "plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" }, + "render-markdown.nvim": { "branch": "main", "commit": "82184c4a3c3580a7a859b2cb7e58f16c10fd29ef" }, + "rustaceanvim": { "branch": "master", "commit": "8ece53be36515cb9e76f3d03511643636469502d" }, + "snacks.nvim": { "branch": "main", "commit": "313954efdfb064a85df731b29fa9b86bc711044a" }, + "tailwindcss-colorizer-cmp.nvim": { "branch": "main", "commit": "3d3cd95e4a4135c250faf83dd5ed61b8e5502b86" }, + "todo-comments.nvim": { "branch": "main", "commit": "ae0a2afb47cf7395dc400e5dc4e05274bf4fb9e0" }, + "tokyonight.nvim": { "branch": "main", "commit": "9758827c3b380ba89da4a2212b6255d01afbcf08" }, + "trouble.nvim": { "branch": "main", "commit": "3dc00c0447c016cd43e03054c3d49436a1f2076d" }, + "ts-comments.nvim": { "branch": "main", "commit": "2002692ad1d3f6518d016550c20c2a890f0cbf0e" }, + "vim-startuptime": { "branch": "master", "commit": "ac2cccb5be617672add1f4f3c0a55ce99ba34e01" }, + "which-key.nvim": { "branch": "main", "commit": "68e37e12913a66b60073906f5d3f14dee0de19f2" } +} diff --git a/files/nvim/lazyvim.json b/files/nvim/lazyvim.json new file mode 100644 index 0000000..0e82939 --- /dev/null +++ b/files/nvim/lazyvim.json @@ -0,0 +1,28 @@ +{ + "extras": [ + "lazyvim.plugins.extras.coding.mini-comment", + "lazyvim.plugins.extras.coding.mini-surround", + "lazyvim.plugins.extras.editor.fzf", + "lazyvim.plugins.extras.lang.docker", + "lazyvim.plugins.extras.lang.git", + "lazyvim.plugins.extras.lang.go", + "lazyvim.plugins.extras.lang.json", + "lazyvim.plugins.extras.lang.markdown", + "lazyvim.plugins.extras.lang.php", + "lazyvim.plugins.extras.lang.prisma", + "lazyvim.plugins.extras.lang.rust", + "lazyvim.plugins.extras.lang.svelte", + "lazyvim.plugins.extras.lang.tailwind", + "lazyvim.plugins.extras.lang.toml", + "lazyvim.plugins.extras.lang.typescript", + "lazyvim.plugins.extras.lang.vue", + "lazyvim.plugins.extras.lang.yaml", + "lazyvim.plugins.extras.ui.mini-animate", + "lazyvim.plugins.extras.util.dot", + "lazyvim.plugins.extras.util.startuptime" + ], + "news": { + "NEWS.md": "7107" + }, + "version": 7 +} \ No newline at end of file diff --git a/files/nvim/lua/config/autocmds.lua b/files/nvim/lua/config/autocmds.lua new file mode 100644 index 0000000..27e9e06 --- /dev/null +++ b/files/nvim/lua/config/autocmds.lua @@ -0,0 +1,3 @@ +-- Autocmds are automatically loaded on the VeryLazy event +-- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua +-- Add any additional autocmds here diff --git a/files/nvim/lua/config/keymaps.lua b/files/nvim/lua/config/keymaps.lua new file mode 100644 index 0000000..b3d9fd8 --- /dev/null +++ b/files/nvim/lua/config/keymaps.lua @@ -0,0 +1,5 @@ +-- Keymaps are automatically loaded on the VeryLazy event +-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua +-- Add any additional keymaps here + +vim.keymap.set("n", "", "HopWord", { desc = "Hop to any word" }) diff --git a/files/nvim/lua/config/lazy.lua b/files/nvim/lua/config/lazy.lua new file mode 100644 index 0000000..cc889fc --- /dev/null +++ b/files/nvim/lua/config/lazy.lua @@ -0,0 +1,43 @@ +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" + +if not (vim.uv or vim.loop).fs_stat(lazypath) then + -- bootstrap lazy.nvim + -- stylua: ignore + vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath }) +end +vim.opt.rtp:prepend(lazypath) + +require("lazy").setup({ + spec = { + -- add LazyVim and import its plugins + { "LazyVim/LazyVim", import = "lazyvim.plugins" }, + -- import/override with your plugins + { import = "plugins" }, + }, + defaults = { + -- By default, only LazyVim plugins will be lazy-loaded. Your custom plugins will load during startup. + -- If you know what you're doing, you can set this to `true` to have all your custom plugins lazy-loaded by default. + lazy = false, + -- It's recommended to leave version=false for now, since a lot the plugin that support versioning, + -- have outdated releases, which may break your Neovim install. + version = false, -- always use the latest git commit + -- version = "*", -- try installing the latest stable version for plugins that support semver + }, + -- install = { colorscheme = { "tokyonight", "habamax" } }, + checker = { enabled = true }, -- automatically check for plugin updates + performance = { + rtp = { + -- disable some rtp plugins + disabled_plugins = { + "gzip", + -- "matchit", + -- "matchparen", + -- "netrwPlugin", + "tarPlugin", + "tohtml", + "tutor", + "zipPlugin", + }, + }, + }, +}) diff --git a/files/nvim/lua/config/options.lua b/files/nvim/lua/config/options.lua new file mode 100644 index 0000000..3ea1454 --- /dev/null +++ b/files/nvim/lua/config/options.lua @@ -0,0 +1,3 @@ +-- Options are automatically loaded before lazy.nvim startup +-- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua +-- Add any additional options here diff --git a/files/nvim/lua/plugins/bg.lua b/files/nvim/lua/plugins/bg.lua new file mode 100644 index 0000000..720f087 --- /dev/null +++ b/files/nvim/lua/plugins/bg.lua @@ -0,0 +1,3 @@ +return { + { "typicode/bg.nvim", lazy = false }, +} diff --git a/files/nvim/lua/plugins/hop.lua b/files/nvim/lua/plugins/hop.lua new file mode 100644 index 0000000..fd2b9ab --- /dev/null +++ b/files/nvim/lua/plugins/hop.lua @@ -0,0 +1,12 @@ +return { + { + "smoka7/hop.nvim", + version = "*", + opts = { + keys = "etovxqpdygfblzhckisuran", + }, + keys = { + { "", "HopWord", desc = "Hop to any word" }, + }, + }, +} diff --git a/files/nvim/lua/plugins/onedark.lua b/files/nvim/lua/plugins/onedark.lua new file mode 100644 index 0000000..21c7ce1 --- /dev/null +++ b/files/nvim/lua/plugins/onedark.lua @@ -0,0 +1,10 @@ +return { + -- { "navarasu/onedark.nvim", opts = { style = "darker" } }, + -- { "LazyVim/LazyVim", opts = { + -- colorscheme = "onedark", + -- } }, + { "catppuccin/nvim", name = "catppuccin" }, + { "LazyVim/LazyVim", opts = { + colorscheme = "catppuccin", + } }, +} diff --git a/files/nvim/stylua.toml b/files/nvim/stylua.toml new file mode 100644 index 0000000..5d6c50d --- /dev/null +++ b/files/nvim/stylua.toml @@ -0,0 +1,3 @@ +indent_type = "Spaces" +indent_width = 2 +column_width = 120 \ No newline at end of file