diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index cca9f9f..8b5226d 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -24,623 +24,31 @@ I hope you enjoy your Neovim journey, - TJ --]] --- TJ said to use my own settings too - --- Use 4 space tabs -vim.opt.tabstop = 4 -vim.opt.softtabstop = 4 -vim.opt.shiftwidth = 4 - --- Prevent continue comment on new line -vim.api.nvim_create_autocmd( - "FileType", - { pattern = "*", command = [[setlocal formatoptions-=c formatoptions-=r formatoptions-=o]] } -) -vim.opt.wildignore = "*/.git/*,*/.DS_Store/*,*/target/*,*/node_modules/*" -vim.opt.expandtab = true - +vim.g.mapleader = " " +vim.g.maplocalleader = " " -- netrw settings vim.g.netrw_banner = 0 vim.g.netrw_browse_split = 0 vim.g.netrw_winsize = 25 - --- line wrap settings -vim.o.linebreak = true -vim.o.wrap = true -vim.o.breakindent = true -vim.o.showbreak = "↳ " - --- stay in indent mode only -vim.keymap.set("v", "<", "", ">gv") - --- Move lines by selecting -vim.keymap.set("v", "J", ":m '>+1gv=gv") -vim.keymap.set("v", "K", ":m '<-2gv=gv") - --- Keep yaa head straight -vim.keymap.set("n", "", "zz") -vim.keymap.set("n", "", "zz") - --- Default TJ settings. --- -vim.g.mapleader = " " -vim.g.maplocalleader = " " - vim.g.have_nerd_font = true -vim.opt.number = true -vim.opt.relativenumber = true - --- Enable mouse mode, can be useful for resizing splits for example! -vim.opt.mouse = "a" - --- Don't show the mode, since it's already in the status line -vim.opt.showmode = false - --- Sync clipboard between OS and Neovim. -vim.opt.clipboard = "unnamedplus" - --- Enable break indent -vim.opt.breakindent = true - --- Save undo history -vim.opt.undofile = true - --- Case-insensitive searching UNLESS \C or one or more capital letters in the search term -vim.opt.ignorecase = true -vim.opt.smartcase = true - --- Keep signcolumn on by default -vim.opt.signcolumn = "yes" - --- Decrease update time -vim.opt.updatetime = 250 - --- Sets how neovim will display certain whitespace characters in the editor. --- vim.opt.list = true --- vim.opt.listchars = { tab = "» ", trail = "·", nbsp = "␣" } - --- Preview substitutions live, as you type! -vim.opt.inccommand = "split" - --- Show which line your cursor is on -vim.opt.cursorline = true - --- Minimal number of screen lines to keep above and below the cursor. -vim.opt.scrolloff = 10 - --- [[ Basic Keymaps ]] - --- Navigate with Netrw -vim.keymap.set("n", "n", vim.cmd.Ex, { desc = "Open [N]etrw" }) --- Prime said this is greatest remap ever -vim.keymap.set("x", "p", [["_dP]]) - --- Next greatest reamap -vim.keymap.set({ "n", "v" }, "d", [["_d]]) - --- Set highlight on search, but clear on pressing in normal mode -vim.opt.hlsearch = true -vim.keymap.set("n", "", "nohlsearch") - --- Diagnostic keymaps -vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, { desc = "Go to previous [D]iagnostic message" }) -vim.keymap.set("n", "]d", vim.diagnostic.goto_next, { desc = "Go to next [D]iagnostic message" }) -vim.keymap.set("n", "e", vim.diagnostic.open_float, { desc = "Show diagnostic [E]rror messages" }) -vim.keymap.set("n", "q", vim.diagnostic.setloclist, { desc = "Open diagnostic [Q]uickfix list" }) - --- Disable arrow keys in normal mode -vim.keymap.set("n", "", 'echo "Use h to move!!"') -vim.keymap.set("n", "", 'echo "Use l to move!!"') -vim.keymap.set("n", "", 'echo "Use k to move!!"') -vim.keymap.set("n", "", 'echo "Use j to move!!"') - --- [[ Basic Autocommands ]] --- See `:help lua-guide-autocommands` - --- Highlight when yanking (copying) text -vim.api.nvim_create_autocmd("TextYankPost", { - desc = "Highlight when yanking (copying) text", - group = vim.api.nvim_create_augroup("kickstart-highlight-yank", { clear = true }), - callback = function() - vim.highlight.on_yank() - end, -}) - local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" -if not vim.loop.fs_stat(lazypath) then - local lazyrepo = "https://github.com/folke/lazy.nvim.git" - vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) -end ---@diagnostic disable-next-line: undefined-field +if not (vim.uv or 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) -require("lazy").setup({ - "tpope/vim-sleuth", -- Detect tabstop and shiftwidth automatically - - -- Use `opts = {}` to force a plugin to be loaded. - - { "numToStr/Comment.nvim", opts = {} }, - - { - "lewis6991/gitsigns.nvim", - opts = { - signs = { - add = { text = "+" }, - change = { text = "~" }, - delete = { text = "_" }, - topdelete = { text = "‾" }, - changedelete = { text = "~" }, - }, - }, - }, - - { - "nvim-telescope/telescope.nvim", - event = "VimEnter", - branch = "0.1.x", - dependencies = { - "nvim-lua/plenary.nvim", - { - "nvim-telescope/telescope-fzf-native.nvim", - - build = "make", - - cond = function() - return vim.fn.executable("make") == 1 - end, - }, - { "nvim-telescope/telescope-ui-select.nvim" }, - - { "nvim-tree/nvim-web-devicons", enabled = vim.g.have_nerd_font }, - }, - - config = function() - -- Telescope is a fuzzy finder that comes with a lot of different things that - -- it can fuzzy find! It's more than just a "file finder", it can search - -- many different aspects of Neovim, your workspace, LSP, and more! - -- - -- Two important keymaps to use while in Telescope are: - -- - Insert mode: - -- - Normal mode: ? - -- - -- This opens a window that shows you all of the keymaps for the current - -- Telescope picker. This is really useful to discover what Telescope can - -- do as well as how to actually do it! - - require("telescope").setup({ - defaults = { - file_ignore_patterns = { ".git/", "node%_modules/.*" }, - prompt_prefix = "🔭 ", - selection_caret = " ", - initial_mode = "normal", - }, - - extensions = { - ["ui-select"] = { - require("telescope.themes").get_dropdown(), - }, - }, - }) - - -- Enable Telescope extensions if they are installed - pcall(require("telescope").load_extension, "fzf") - pcall(require("telescope").load_extension, "ui-select") - - local builtin = require("telescope.builtin") - vim.keymap.set("n", "sh", builtin.help_tags, { desc = "[S]earch [H]elp" }) - vim.keymap.set("n", "sk", builtin.keymaps, { desc = "[S]earch [K]eymaps" }) - vim.keymap.set("n", "sf", builtin.find_files, { desc = "[S]earch [F]iles" }) - vim.keymap.set("n", "ss", builtin.builtin, { desc = "[S]earch [S]elect Telescope" }) - - --[[ IDK how to make grep work on my machine... (skill issues tbh) - vim.keymap.set('n', 'sw', builtin.grep_string, { desc = '[S]earch current [W]ord' }) - vim.keymap.set('n', 'sg', builtin.live_grep, { desc = '[S]earch by [G]rep' }) ]] - - vim.keymap.set("n", "sd", builtin.diagnostics, { desc = "[S]earch [D]iagnostics" }) - vim.keymap.set("n", "sr", builtin.resume, { desc = "[S]earch [R]esume" }) - vim.keymap.set("n", "s.", builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' }) - vim.keymap.set("n", "", builtin.buffers, { desc = "[ ] Find existing buffers" }) - - -- Slightly advanced example of overriding default behavior and theme - vim.keymap.set("n", "/", function() - builtin.current_buffer_fuzzy_find(require("telescope.themes").get_dropdown({ - winblend = 50, - previewer = false, - })) - end, { desc = "[/] Fuzzily search in current buffer" }) - - --[[ vim.keymap.set('n', 's/', function() - builtin.live_grep { - grep_open_files = true, - prompt_title = 'Live Grep in Open Files', - } - end, { desc = '[S]earch [/] in Open Files' }) ]] - - -- Shortcut for searching your Neovim configuration files - vim.keymap.set("n", "sn", function() - builtin.find_files({ cwd = vim.fn.stdpath("config") }) - end, { desc = "[S]earch [N]eovim files" }) - end, - }, - - { - "neovim/nvim-lspconfig", - dependencies = { - "williamboman/mason.nvim", - "williamboman/mason-lspconfig.nvim", - "WhoIsSethDaniel/mason-tool-installer.nvim", - - { "j-hui/fidget.nvim", opts = {} }, - - -- `neodev` configures Lua LSP for your Neovim config, runtime and plugins - -- used for completion, annotations and signatures of Neovim apis - { "folke/neodev.nvim", opts = {} }, - }, - config = function() - vim.api.nvim_create_autocmd("LspAttach", { - group = vim.api.nvim_create_augroup("kickstart-lsp-attach", { clear = true }), - callback = function(event) - local map = function(keys, func, desc) - vim.keymap.set("n", keys, func, { buffer = event.buf, desc = "LSP: " .. desc }) - end - - -- Jump to the definition of the word under your cursor. - -- This is where a variable was first declared, or where a function is defined, etc. - -- To jump back, press . - map("gd", require("telescope.builtin").lsp_definitions, "[G]oto [D]efinition") - - -- Find references for the word under your cursor. - map("gr", require("telescope.builtin").lsp_references, "[G]oto [R]eferences") - - -- Jump to the implementation of the word under your cursor. - -- Useful when your language has ways of declaring types without an actual implementation. - map("gI", require("telescope.builtin").lsp_implementations, "[G]oto [I]mplementation") - - -- Jump to the type of the word under your cursor. - -- Useful when you're not sure what type a variable is and you want to see - -- the definition of its *type*, not where it was *defined*. - map("D", require("telescope.builtin").lsp_type_definitions, "Type [D]efinition") - - -- Fuzzy find all the symbols in your current document. - -- Symbols are things like variables, functions, types, etc. - map("ds", require("telescope.builtin").lsp_document_symbols, "[D]ocument [S]ymbols") - - -- Fuzzy find all the symbols in your current workspace. - -- Similar to document symbols, except searches over your entire project. - map( - "ws", - require("telescope.builtin").lsp_dynamic_workspace_symbols, - "[W]orkspace [S]ymbols" - ) - - -- Rename the variable under your cursor. - -- Most Language Servers support renaming across files, etc. - map("rn", vim.lsp.buf.rename, "[R]e[n]ame") - - -- Execute a code action, usually your cursor needs to be on top of an error - -- or a suggestion from your LSP for this to activate. - map("ca", vim.lsp.buf.code_action, "[C]ode [A]ction") - - -- Opens a popup that displays documentation about the word under your cursor - -- See `:help K` for why this keymap. - map("K", vim.lsp.buf.hover, "Hover Documentation") - - -- WARN: This is not Goto Definition, this is Goto Declaration. - -- For example, in C this would take you to the header. - map("gD", vim.lsp.buf.declaration, "[G]oto [D]eclaration") - - -- The following two autocommands are used to highlight references of the - -- word under your cursor when your cursor rests there for a little while. - local client = vim.lsp.get_client_by_id(event.data.client_id) - if client and client.server_capabilities.documentHighlightProvider then - vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI" }, { - buffer = event.buf, - callback = vim.lsp.buf.document_highlight, - }) - - vim.api.nvim_create_autocmd({ "CursorMoved", "CursorMovedI" }, { - buffer = event.buf, - callback = vim.lsp.buf.clear_references, - }) - end - end, - }) - - local capabilities = vim.lsp.protocol.make_client_capabilities() - capabilities = vim.tbl_deep_extend("force", capabilities, require("cmp_nvim_lsp").default_capabilities()) - - -- Enable the following language servers - local servers = { - clangd = {}, - gopls = { - filetypes = { "go", "gomod", "gowork", "gotmpl" }, - }, - - pyright = {}, - tsserver = {}, - - lua_ls = { - -- cmd = {...}, - -- filetypes = { ...}, - -- capabilities = {}, - settings = { - Lua = { - completion = { - callSnippet = "Replace", - }, - -- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings - -- diagnostics = { disable = { 'missing-fields' } }, - }, - }, - }, - } - - require("mason").setup() - - local ensure_installed = vim.tbl_keys(servers or {}) - vim.list_extend(ensure_installed, { - "clangd", - "clang-format", - "gofumpt", - "goimports-reviser", - "gopls", - "mypy", - "ruff", - "stylua", - }) - require("mason-tool-installer").setup({ ensure_installed = ensure_installed }) - - require("mason-lspconfig").setup({ - handlers = { - function(server_name) - local server = servers[server_name] or {} - server.capabilities = vim.tbl_deep_extend("force", {}, capabilities, server.capabilities or {}) - require("lspconfig")[server_name].setup(server) - end, - }, - }) - end, - }, - - { - "stevearc/conform.nvim", - opts = { - notify_on_error = false, - format_on_save = function(bufnr) - local disable_filetypes = {} - return { - timeout_ms = 500, - lsp_fallback = not disable_filetypes[vim.bo[bufnr].filetype], - } - end, - formatters_by_ft = { - c = { "clang-format" }, - go = { "gofumpt", "goimports_reviser" }, - lua = { "stylua" }, - }, - }, - }, - - { - "hrsh7th/nvim-cmp", - event = "InsertEnter", - dependencies = { - { - "L3MON4D3/LuaSnip", - build = (function() - if vim.fn.has("win32") == 1 or vim.fn.executable("make") == 0 then - return - end - return "make install_jsregexp" - end)(), - dependencies = { - -- https://github.com/rafamadriz/friendly-snippets - { - "rafamadriz/friendly-snippets", - config = function() - require("luasnip.loaders.from_vscode").lazy_load() - end, - }, - }, - }, - "saadparwaiz1/cmp_luasnip", - - "hrsh7th/cmp-nvim-lsp", - "hrsh7th/cmp-path", - }, - config = function() - local cmp = require("cmp") - local luasnip = require("luasnip") - luasnip.config.setup({}) - - cmp.setup({ - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) - end, - }, - completion = { completeopt = "menu,menuone,noinsert" }, - - -- No, but seriously. Please read `:help ins-completion`, it is really good! - mapping = cmp.mapping.preset.insert({ - -- Select the [n]ext item - [""] = cmp.mapping.select_next_item(), - -- Select the [p]revious item - [""] = cmp.mapping.select_prev_item(), - - -- Scroll the documentation window [b]ack / [f]orward - [""] = cmp.mapping.scroll_docs(-4), - [""] = cmp.mapping.scroll_docs(4), - - [""] = cmp.mapping.confirm({ select = true }), - - [""] = cmp.mapping.complete({}), - - -- Think of as moving to the right of your snippet expansion. - -- So if you have a snippet that's like: - -- function $name($args) - -- $body - -- end - -- - -- will move you to the right of each of the expansion locations. - -- is similar, except moving you backwards. - [""] = cmp.mapping(function() - if luasnip.expand_or_locally_jumpable() then - luasnip.expand_or_jump() - end - end, { "i", "s" }), - [""] = cmp.mapping(function() - if luasnip.locally_jumpable(-1) then - luasnip.jump(-1) - end - end, { "i", "s" }), - }), - sources = { - { name = "nvim_lsp" }, - { name = "luasnip" }, - { name = "path" }, - }, - }) - end, - }, - - { - "catppuccin/nvim", - name = "catpuccin", - priority = 1000, - init = function() - require("catppuccin").setup({ - transparent_background = true, - }) - vim.cmd.colorscheme("catppuccin") - - vim.cmd.hi("Comment gui=none") - vim.api.nvim_set_hl(0, "Normal", { bg = "none" }) - vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" }) - end, - }, - - -- Highlight todo, notes, etc in comments - { - "folke/todo-comments.nvim", - event = "VimEnter", - dependencies = { "nvim-lua/plenary.nvim" }, - opts = { signs = false }, - }, - - { - "echasnovski/mini.nvim", - config = function() - -- Better Around/Inside textobjects - -- - -- Examples: - -- - va) - [V]isually select [A]round [)]paren - -- - yinq - [Y]ank [I]nside [N]ext [']quote - -- - ci' - [C]hange [I]nside [']quote - require("mini.ai").setup({ n_lines = 500 }) - - -- Add/delete/replace surroundings (brackets, quotes, etc.) - -- - -- - saiw) - [S]urround [A]dd [I]nner [W]ord [)]Paren - -- - sd' - [S]urround [D]elete [']quotes - -- - sr)' - [S]urround [R]eplace [)] ['] - require("mini.surround").setup() - - local statusline = require("mini.statusline") - statusline.setup({ use_icons = vim.g.have_nerd_font }) - - ---@diagnostic disable-next-line: duplicate-set-field - statusline.section_location = function() - return "%2l:%-2v" - end - - -- Check out: https://github.com/echasnovski/mini.nvim - end, - }, - - { - "nvim-treesitter/nvim-treesitter", - build = ":TSUpdate", - dependencies = { - "nvim-treesitter/nvim-treesitter-textobjects", - }, - opts = { - ensure_installed = { "c", "go", "html", "lua", "python" }, - auto_install = true, - highlight = { - enable = true, - additional_vim_regex_highlighting = { "ruby" }, - }, - indent = { enable = true, disable = { "ruby" } }, - }, - config = function(_, opts) - ---@diagnostic disable-next-line: missing-fields - require("nvim-treesitter.configs").setup(opts) - end, - }, - - -- Navigate tmux with vim keybindings - { - "alexghergh/nvim-tmux-navigation", - - lazy = false, - - config = function() - local nvim_tmux_nav = require("nvim-tmux-navigation") - - nvim_tmux_nav.setup({ - disable_when_zoomed = true, - }) - - vim.keymap.set("n", "", nvim_tmux_nav.NvimTmuxNavigateLeft) - vim.keymap.set("n", "", nvim_tmux_nav.NvimTmuxNavigateDown) - vim.keymap.set("n", "", nvim_tmux_nav.NvimTmuxNavigateUp) - vim.keymap.set("n", "", nvim_tmux_nav.NvimTmuxNavigateRight) - vim.keymap.set("n", "", nvim_tmux_nav.NvimTmuxNavigateLastActive) - vim.keymap.set("n", "", nvim_tmux_nav.NvimTmuxNavigateNext) - end, - }, - - --[[ { - "akinsho/bufferline.nvim", - version = "*", - - dependencies = "nvim-tree/nvim-web-devicons", - - config = function() - require("bufferline").setup({ - options = { - always_show_bufferline = false, - diagnostics = "nvim_lsp", - }, - }) - end, - }, ]] - - -- NOTE: uncomment debug to enable debugging in neoVim - -- require("lilJ.plugins.debug"), - - require("lilJ.plugins.indent_line"), - require("lilJ.plugins.lint"), -}, { - ui = { - icons = vim.g.have_nerd_font and {} or { - cmd = "⌘", - config = "🛠", - event = "📅", - ft = "📂", - init = "⚙", - keys = "🗝", - plugin = "🔌", - runtime = "💻", - require = "🌙", - source = "📄", - start = "🚀", - task = "📌", - lazy = "💤 ", - }, - }, +require("lazy").setup({ import = "lilJ/plugins" }, { + change_detection = { + notify = false + } }) -- The line beneath this is called `modeline`. See `:help modeline` diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json index d871add..88822af 100644 --- a/.config/nvim/lazy-lock.json +++ b/.config/nvim/lazy-lock.json @@ -1,32 +1,43 @@ { "Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" }, - "LuaSnip": { "branch": "master", "commit": "be7be2ca7f55bb881a7ffc16b2efa5af034ab06b" }, - "catpuccin": { "branch": "main", "commit": "6af91673ceccbd6e073b66c439e7fce239f72d24" }, + "LuaSnip": { "branch": "master", "commit": "b152822e1a4bafb6bdf11a16cc26525cbd95ee00" }, + "SchemaStore.nvim": { "branch": "main", "commit": "8706b99e1253f54f640fbc4f4ae13cdf034c135a" }, + "catpuccin": { "branch": "main", "commit": "d97387aea8264f484bb5d5e74f2182a06c83e0d8" }, + "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, - "conform.nvim": { "branch": "master", "commit": "9d5ba06d6ee7418c674f498634617416d15b6239" }, + "conform.nvim": { "branch": "master", "commit": "59d0dd233a2cafacfa1235ab22054c4d80a72319" }, "fidget.nvim": { "branch": "main", "commit": "1ba38e4cbb24683973e00c2e36f53ae64da38ef5" }, - "friendly-snippets": { "branch": "main", "commit": "ea068f1becd91bcd4591fceb6420d4335e2e14d3" }, - "gitsigns.nvim": { "branch": "main", "commit": "1a50b94066def8591d5f65bd60a4233902e9def4" }, + "friendly-snippets": { "branch": "main", "commit": "3e9a3f5a0cfcef1741e352c37bda4e82e5eb846a" }, + "gitsigns.nvim": { "branch": "main", "commit": "805610a9393fa231f2c2b49cb521bfa413fadb3d" }, "indent-blankline.nvim": { "branch": "master", "commit": "3d08501caef2329aba5121b753e903904088f7e6" }, - "lazy.nvim": { "branch": "main", "commit": "31ddbea7c10b6920c9077b66c97951ca8682d5c8" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "44509689b9bf3984d729cc264aacb31cb7f41668" }, - "mason-tool-installer.nvim": { "branch": "main", "commit": "6c15772d5e4a01d0b2ad3ad6df23cf38517c4ad2" }, - "mason.nvim": { "branch": "main", "commit": "751b1fcbf3d3b783fcf8d48865264a9bcd8f9b10" }, - "mini.nvim": { "branch": "main", "commit": "8371930e8b624feabf994c3382143e83e009ed9f" }, + "lazy.nvim": { "branch": "main", "commit": "758bb5de98b805acc5eeed8cdc8ac7f0bc4b0b86" }, + "lspkind.nvim": { "branch": "master", "commit": "1735dd5a5054c1fb7feaf8e8658dbab925f4f0cf" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "9ae570e206360e47d30b4c35a4550c165f4ea7b7" }, + "mason-nvim-dap.nvim": { "branch": "main", "commit": "67210c0e775adec55de9826b038e8b62de554afc" }, + "mason-tool-installer.nvim": { "branch": "main", "commit": "c1fbdcb0d8d1295314f1612c4a247253e70299d9" }, + "mason.nvim": { "branch": "main", "commit": "1b3d60405d1d720b2c4927f19672e9479703b00f" }, + "mini.nvim": { "branch": "main", "commit": "c333187fcc76d7e772dac32c2a440a949fe34be4" }, "neodev.nvim": { "branch": "main", "commit": "ce9a2e8eaba5649b553529c5498acb43a6c317cd" }, - "nvim-cmp": { "branch": "main", "commit": "8f3c541407e691af6163e2447f3af1bd6e17f9a3" }, - "nvim-lint": { "branch": "master", "commit": "861a04313501563bb1b11f125ae9b7237a517b9b" }, - "nvim-lspconfig": { "branch": "master", "commit": "2beb3e9cac3ed9335f8972eb6082f380a4f1f124" }, + "nvim-cmp": { "branch": "main", "commit": "24122371810089d390847d8ba66325c1f1aa64c0" }, + "nvim-dap": { "branch": "master", "commit": "615a1b2046e1eaf7995e0ba8e8a65f344201349d" }, + "nvim-dap-go": { "branch": "main", "commit": "5faf165f5062187320eaf9d177c3c1f647adc22e" }, + "nvim-dap-ui": { "branch": "master", "commit": "5934302d63d1ede12c0b22b6f23518bb183fc972" }, + "nvim-dap-virtual-text": { "branch": "master", "commit": "3e8e207513e6ef520894950acd76b79902714103" }, + "nvim-lint": { "branch": "master", "commit": "f3bcc28ffccb768212247294acccc106e029fc3c" }, + "nvim-lspconfig": { "branch": "master", "commit": "94513a5b246cf32a8f87ca714af50911df63351c" }, + "nvim-nio": { "branch": "master", "commit": "8765cbc4d0c629c8158a5341e1b4305fd93c3a90" }, "nvim-tmux-navigation": { "branch": "main", "commit": "4898c98702954439233fdaf764c39636681e2861" }, - "nvim-treesitter": { "branch": "master", "commit": "da0efd7398713a3177da5ce8690f0e5c5415763d" }, - "nvim-treesitter-textobjects": { "branch": "master", "commit": "23b820146956b3b681c19e10d3a8bc0cbd9a1d4c" }, - "nvim-web-devicons": { "branch": "master", "commit": "5b9067899ee6a2538891573500e8fd6ff008440f" }, + "nvim-treesitter": { "branch": "master", "commit": "cd626dc48e42b2677d501a740622cf4aed43863f" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "dfa4178c0cadb44f687603d72ad0908474c28dd9" }, + "nvim-web-devicons": { "branch": "master", "commit": "e37bb1feee9e7320c76050a55443fa843b4b6f83" }, "plenary.nvim": { "branch": "master", "commit": "08e301982b9a057110ede7a735dd1b5285eb341f" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "9ef21b2e6bb6ebeaf349a0781745549bbb870d27" }, "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, "telescope.nvim": { "branch": "0.1.x", "commit": "6312868392331c9c0f22725041f1ec2bef57c751" }, "todo-comments.nvim": { "branch": "main", "commit": "a7e39ae9e74f2c8c6dc4eea6d40c3971ae84752d" }, - "vim-sleuth": { "branch": "master", "commit": "1cc4557420f215d02c4d2645a748a816c220e99b" } + "vim-dadbod": { "branch": "master", "commit": "37523ffe0849b51db07fa7f48430c2aca5420a0e" }, + "vim-dadbod-completion": { "branch": "master", "commit": "c920cb0ba3dff4b1b0ed373e1c0b3007dec696c2" }, + "vim-dadbod-ui": { "branch": "master", "commit": "b1675d1f56c12b0abac2ef74b94670fe27adcf93" } } \ No newline at end of file diff --git a/.config/nvim/lua/lilJ/completions.lua b/.config/nvim/lua/lilJ/completions.lua new file mode 100644 index 0000000..81666a1 --- /dev/null +++ b/.config/nvim/lua/lilJ/completions.lua @@ -0,0 +1,63 @@ +local luasnip = require "luasnip" +luasnip.config.setup { + history = false, + updateevents = "TextChanged,TextChangedI", +} + +local lspkind = require "lspkind" +lspkind.init {} + +local cmp = require "cmp" +cmp.setup { + sources = { + { name = "nvim_lsp" }, + { name = "path" }, + { name = "buffer" }, + }, + completion = { completeopt = "menu, menuone, noinsert, noselect" }, + + -- No, but seriously. Please read `:help ins-completion`, it is really good! + 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.confirm { select = true }, + + [""] = cmp.mapping.complete {}, + + -- Think of as moving to the right of your snippet expansion. + -- So if you have a snippet that's like: + -- function $name($args) + -- $body + -- end + -- + -- will move you to the right of each of the expansion locations. + -- is similar, except moving you backwards. + [""] = cmp.mapping(function() + if luasnip.expand_or_locally_jumpable() then + luasnip.expand_or_jump() + end + end, { "i", "s" }), + [""] = cmp.mapping(function() + if luasnip.locally_jumpable(-1) then + luasnip.jump(-1) + end + end, { "i", "s" }), + }, + + snippet = { + expand = function(args) + require("luasnip").lsp_expand(args.body) + end, + }, +} + +cmp.setup.filetype({ "sql" }, { + sources = { + { name = "vim-dadbod-completion" }, + { name = "buffer" }, + }, +}) diff --git a/.config/nvim/lua/lilJ/plugins/catppuccin.lua b/.config/nvim/lua/lilJ/plugins/catppuccin.lua new file mode 100644 index 0000000..6d54274 --- /dev/null +++ b/.config/nvim/lua/lilJ/plugins/catppuccin.lua @@ -0,0 +1,15 @@ +return { + "catppuccin/nvim", + name = "catpuccin", + priority = 1000, + init = function() + require("catppuccin").setup { + transparent_background = true, + } + vim.cmd.colorscheme "catppuccin" + + vim.cmd.hi "Comment gui=none" + vim.api.nvim_set_hl(0, "Normal", { bg = "none" }) + vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" }) + end, +} diff --git a/.config/nvim/lua/lilJ/plugins/comment.lua b/.config/nvim/lua/lilJ/plugins/comment.lua new file mode 100644 index 0000000..d3cdc19 --- /dev/null +++ b/.config/nvim/lua/lilJ/plugins/comment.lua @@ -0,0 +1,4 @@ +return { + "numToStr/Comment.nvim", + opts = {}, +} diff --git a/.config/nvim/lua/lilJ/plugins/completions.lua b/.config/nvim/lua/lilJ/plugins/completions.lua new file mode 100644 index 0000000..3b43a50 --- /dev/null +++ b/.config/nvim/lua/lilJ/plugins/completions.lua @@ -0,0 +1,27 @@ +return { + "hrsh7th/nvim-cmp", + event = "InsertEnter", + dependencies = { + "onsails/lspkind.nvim", + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-path", + "hrsh7th/cmp-buffer", + { + "L3MON4D3/LuaSnip", + build = "make install_jsregexp", + dependencies = { + -- https://github.com/rafamadriz/friendly-snippets + { + "rafamadriz/friendly-snippets", + config = function() + require("luasnip.loaders.from_vscode").lazy_load() + end, + }, + }, + }, + "saadparwaiz1/cmp_luasnip", + }, + config = function() + require "lilJ.completions" + end, +} diff --git a/.config/nvim/lua/lilJ/plugins/conform.lua b/.config/nvim/lua/lilJ/plugins/conform.lua new file mode 100644 index 0000000..a43d7f3 --- /dev/null +++ b/.config/nvim/lua/lilJ/plugins/conform.lua @@ -0,0 +1,18 @@ +return { + "stevearc/conform.nvim", + opts = { + notify_on_error = false, + format_on_save = function(bufnr) + local disable_filetypes = {} + return { + timeout_ms = 500, + lsp_fallback = not disable_filetypes[vim.bo[bufnr].filetype], + } + end, + formatters_by_ft = { + c = { "clang-format" }, + go = { "gofumpt", "goimports_reviser" }, + lua = { "stylua" }, + }, + }, +} diff --git a/.config/nvim/lua/lilJ/plugins/dadbod.lua b/.config/nvim/lua/lilJ/plugins/dadbod.lua new file mode 100644 index 0000000..e683c47 --- /dev/null +++ b/.config/nvim/lua/lilJ/plugins/dadbod.lua @@ -0,0 +1,5 @@ +return { + "tpope/vim-dadbod", + "kristijanhusak/vim-dadbod-completion", + "kristijanhusak/vim-dadbod-ui", +} diff --git a/.config/nvim/lua/lilJ/plugins/debug.lua b/.config/nvim/lua/lilJ/plugins/debug.lua index 37b8de2..17a2080 100644 --- a/.config/nvim/lua/lilJ/plugins/debug.lua +++ b/.config/nvim/lua/lilJ/plugins/debug.lua @@ -7,84 +7,75 @@ -- kickstart.nvim and not kitchen-sink.nvim ;) return { - -- NOTE: Yes, you can install new plugins here! - "mfussenegger/nvim-dap", - -- NOTE: And you can specify dependencies as well - dependencies = { - -- Creates a beautiful debugger UI - "rcarriga/nvim-dap-ui", + "mfussenegger/nvim-dap", + dependencies = { + "rcarriga/nvim-dap-ui", + "nvim-neotest/nvim-nio", + "williamboman/mason.nvim", + "jay-babu/mason-nvim-dap.nvim", - -- Required dependency for nvim-dap-ui - "nvim-neotest/nvim-nio", + -- GO DEBUG + "leoluz/nvim-dap-go", + }, + config = function() + local dap = require "dap" + local dapui = require "dapui" - -- Installs the debug adapters for you - "williamboman/mason.nvim", - "jay-babu/mason-nvim-dap.nvim", + require("mason-nvim-dap").setup { + -- Makes a best effort to setup the various debuggers with + -- reasonable debug configurations + automatic_setup = true, - -- Add your own debuggers here - "leoluz/nvim-dap-go", - }, - config = function() - local dap = require("dap") - local dapui = require("dapui") + automatic_installation = true, - require("mason-nvim-dap").setup({ - -- Makes a best effort to setup the various debuggers with - -- reasonable debug configurations - automatic_setup = true, + -- You can provide additional configuration to the handlers, + -- see mason-nvim-dap README for more information + handlers = {}, - -- You can provide additional configuration to the handlers, - -- see mason-nvim-dap README for more information - handlers = {}, + -- You'll need to check that you have the required things installed + -- online, please don't ask me how to install them :) + ensure_installed = { + -- Update this to ensure that you have the debuggers for the langs you want + "delve", + }, + } - -- You'll need to check that you have the required things installed - -- online, please don't ask me how to install them :) - ensure_installed = { - -- Update this to ensure that you have the debuggers for the langs you want - "delve", - }, - }) + -- Basic debugging keymaps, feel free to change to your liking! + vim.keymap.set("n", "", dap.continue, { desc = "Debug: Start/Continue" }) + vim.keymap.set("n", "", dap.step_into, { desc = "Debug: Step Into" }) + vim.keymap.set("n", "", dap.step_over, { desc = "Debug: Step Over" }) + vim.keymap.set("n", "", dap.step_out, { desc = "Debug: Step Out" }) + vim.keymap.set("n", "b", dap.toggle_breakpoint, { desc = "Debug: Toggle Breakpoint" }) + vim.keymap.set("n", "B", function() + dap.set_breakpoint(vim.fn.input "Breakpoint condition: ") + end, { desc = "Debug: Set Breakpoint" }) - -- Basic debugging keymaps, feel free to change to your liking! - vim.keymap.set("n", "", dap.continue, { desc = "Debug: Start/Continue" }) - vim.keymap.set("n", "", dap.step_into, { desc = "Debug: Step Into" }) - vim.keymap.set("n", "", dap.step_over, { desc = "Debug: Step Over" }) - vim.keymap.set("n", "", dap.step_out, { desc = "Debug: Step Out" }) - vim.keymap.set("n", "b", dap.toggle_breakpoint, { desc = "Debug: Toggle Breakpoint" }) - vim.keymap.set("n", "B", function() - dap.set_breakpoint(vim.fn.input("Breakpoint condition: ")) - end, { desc = "Debug: Set Breakpoint" }) + -- Dap UI setup + -- For more information, see |:help nvim-dap-ui| + dapui.setup { + icons = { expanded = "▾", collapsed = "▸", current_frame = "*" }, + controls = { + icons = { + pause = "⏸", + play = "▶", + step_into = "⏎", + step_over = "⏭", + step_out = "⏮", + step_back = "b", + run_last = "▶▶", + terminate = "⏹", + disconnect = "⏏", + }, + }, + } - -- Dap UI setup - -- For more information, see |:help nvim-dap-ui| - dapui.setup({ - -- Set icons to characters that are more likely to work in every terminal. - -- Feel free to remove or use ones that you like more! :) - -- Don't feel like these are good choices. - icons = { expanded = "▾", collapsed = "▸", current_frame = "*" }, - controls = { - icons = { - pause = "⏸", - play = "▶", - step_into = "⏎", - step_over = "⏭", - step_out = "⏮", - step_back = "b", - run_last = "▶▶", - terminate = "⏹", - disconnect = "⏏", - }, - }, - }) + -- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception. + vim.keymap.set("n", "", dapui.toggle, { desc = "Debug: See last session result." }) - -- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception. - vim.keymap.set("n", "", dapui.toggle, { desc = "Debug: See last session result." }) + dap.listeners.after.event_initialized["dapui_config"] = dapui.open + dap.listeners.before.event_terminated["dapui_config"] = dapui.close + dap.listeners.before.event_exited["dapui_config"] = dapui.close - dap.listeners.after.event_initialized["dapui_config"] = dapui.open - dap.listeners.before.event_terminated["dapui_config"] = dapui.close - dap.listeners.before.event_exited["dapui_config"] = dapui.close - - -- Install golang specific config - require("dap-go").setup() - end, + require("dap-go").setup() + end, } diff --git a/.config/nvim/lua/lilJ/plugins/gitsigns.lua b/.config/nvim/lua/lilJ/plugins/gitsigns.lua new file mode 100644 index 0000000..d10bb8d --- /dev/null +++ b/.config/nvim/lua/lilJ/plugins/gitsigns.lua @@ -0,0 +1,12 @@ +return { + "lewis6991/gitsigns.nvim", + opts = { + signs = { + add = { text = "+" }, + change = { text = "~" }, + delete = { text = "_" }, + topdelete = { text = "‾" }, + changedelete = { text = "~" }, + }, + }, +} diff --git a/.config/nvim/lua/lilJ/plugins/indent_line.lua b/.config/nvim/lua/lilJ/plugins/indent_line.lua index 1b3edf3..02beb94 100644 --- a/.config/nvim/lua/lilJ/plugins/indent_line.lua +++ b/.config/nvim/lua/lilJ/plugins/indent_line.lua @@ -1,10 +1,10 @@ return { - { - "lukas-reineke/indent-blankline.nvim", - main = "ibl", - opts = { - indent = { char = "┊" }, - whitespace = { highlight = { "Whitespace", "NonText" } }, - }, - }, + { + "lukas-reineke/indent-blankline.nvim", + main = "ibl", + opts = { + indent = { char = "┊" }, + whitespace = { highlight = { "Whitespace", "NonText" } }, + }, + }, } diff --git a/.config/nvim/lua/lilJ/plugins/lint.lua b/.config/nvim/lua/lilJ/plugins/lint.lua index 87a9fb2..063d18c 100644 --- a/.config/nvim/lua/lilJ/plugins/lint.lua +++ b/.config/nvim/lua/lilJ/plugins/lint.lua @@ -1,56 +1,42 @@ return { + { + "mfussenegger/nvim-lint", + event = { "BufReadPre", "BufNewFile" }, + config = function() + local lint = require "lint" - { - "mfussenegger/nvim-lint", - event = { "BufReadPre", "BufNewFile" }, - config = function() - local lint = require("lint") + lint.linters_by_ft = { + python = { "ruff", "mypy" }, + } - lint.linters_by_ft = { - python = { "ruff", "mypy" }, - } + -- To allow other plugins to add linters to require('lint').linters_by_ft, + -- instead set linters_by_ft like this: + -- lint.linters_by_ft = lint.linters_by_ft or {} + -- lint.linters_by_ft['markdown'] = { 'markdownlint' } + -- + -- However, note that this will enable a set of default linters, + -- which will cause errors unless these tools are available: + -- { + -- dockerfile = { "hadolint" }, + -- json = { "jsonlint" }, + -- markdown = { "vale" }, + -- text = { "vale" } + -- } + -- + -- You can disable the default linters by setting their filetypes to nil: + -- lint.linters_by_ft['dockerfile'] = nil + -- lint.linters_by_ft['json'] = nil + -- lint.linters_by_ft['text'] = nil - -- To allow other plugins to add linters to require('lint').linters_by_ft, - -- instead set linters_by_ft like this: - -- lint.linters_by_ft = lint.linters_by_ft or {} - -- lint.linters_by_ft['markdown'] = { 'markdownlint' } - -- - -- However, note that this will enable a set of default linters, - -- which will cause errors unless these tools are available: - -- { - -- clojure = { "clj-kondo" }, - -- dockerfile = { "hadolint" }, - -- inko = { "inko" }, - -- janet = { "janet" }, - -- json = { "jsonlint" }, - -- markdown = { "vale" }, - -- rst = { "vale" }, - -- ruby = { "ruby" }, - -- terraform = { "tflint" }, - -- text = { "vale" } - -- } - -- - -- You can disable the default linters by setting their filetypes to nil: - -- lint.linters_by_ft['clojure'] = nil - -- lint.linters_by_ft['dockerfile'] = nil - -- lint.linters_by_ft['inko'] = nil - -- lint.linters_by_ft['janet'] = nil - -- lint.linters_by_ft['json'] = nil - -- lint.linters_by_ft['markdown'] = nil - -- lint.linters_by_ft['rst'] = nil - -- lint.linters_by_ft['ruby'] = nil - -- lint.linters_by_ft['terraform'] = nil - -- lint.linters_by_ft['text'] = nil - - -- Create autocommand which carries out the actual linting - -- on the specified events. - local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true }) - vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, { - group = lint_augroup, - callback = function() - require("lint").try_lint() - end, - }) - end, - }, + -- Create autocommand which carries out the actual linting + -- on the specified events. + local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true }) + vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, { + group = lint_augroup, + callback = function() + require("lint").try_lint() + end, + }) + end, + }, } diff --git a/.config/nvim/lua/lilJ/plugins/lsp.lua b/.config/nvim/lua/lilJ/plugins/lsp.lua new file mode 100644 index 0000000..edeaf55 --- /dev/null +++ b/.config/nvim/lua/lilJ/plugins/lsp.lua @@ -0,0 +1,143 @@ +return { + "neovim/nvim-lspconfig", + + dependencies = { + "williamboman/mason.nvim", + "williamboman/mason-lspconfig.nvim", + "WhoIsSethDaniel/mason-tool-installer.nvim", + + { "j-hui/fidget.nvim", opts = {} }, + + { "folke/neodev.nvim", opts = {} }, + + "b0o/SchemaStore.nvim", + }, + + config = function() + local capabilities = nil + if pcall(require, "cmp_nvim_lsp") then + capabilities = require("cmp_nvim_lsp").default_capabilities() + end + + -- Enable the following language servers + local servers = { + clangd = {}, + gopls = { + filetypes = { "go", "gomod", "gowork", "gotmpl" }, + }, + jsonls = { + settings = { + json = { + schemas = require("schemastore").json.schemas(), + validate = { enable = true }, + }, + }, + }, + pyright = {}, + tsserver = {}, + lua_ls = { + -- cmd = {...}, + -- filetypes = { ...}, + -- capabilities = {}, + settings = { + Lua = { + completion = { + callSnippet = "Replace", + }, + -- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings + -- diagnostics = { disable = { 'missing-fields' } }, + }, + }, + }, + } + + require("mason").setup() + + local ensure_installed = vim.tbl_keys(servers or {}) + vim.list_extend(ensure_installed, { + "clang-format", + "gofumpt", + "goimports-reviser", + "mypy", + "prettier", + "ruff", + "stylua", + }) + require("mason-tool-installer").setup { ensure_installed = ensure_installed } + + require("mason-lspconfig").setup { + handlers = { + function(server_name) + local server = servers[server_name] or {} + server.capabilities = vim.tbl_deep_extend("force", {}, capabilities, server.capabilities or {}) + require("lspconfig")[server_name].setup(server) + end, + }, + } + + vim.api.nvim_create_autocmd("LspAttach", { + group = vim.api.nvim_create_augroup("kickstart-lsp-attach", { clear = true }), + callback = function(event) + local map = function(keys, func, desc) + vim.keymap.set("n", keys, func, { buffer = event.buf, desc = "LSP: " .. desc }) + end + + -- Jump to the definition of the word under your cursor. + -- This is where a variable was first declared, or where a function is defined, etc. + -- To jump back, press . + map("gd", require("telescope.builtin").lsp_definitions, "[G]oto [D]efinition") + + -- Find references for the word under your cursor. + map("gr", require("telescope.builtin").lsp_references, "[G]oto [R]eferences") + + -- Jump to the implementation of the word under your cursor. + -- Useful when your language has ways of declaring types without an actual implementation. + map("gI", require("telescope.builtin").lsp_implementations, "[G]oto [I]mplementation") + + -- Jump to the type of the word under your cursor. + -- Useful when you're not sure what type a variable is and you want to see + -- the definition of its *type*, not where it was *defined*. + map("D", require("telescope.builtin").lsp_type_definitions, "Type [D]efinition") + + -- Fuzzy find all the symbols in your current document. + -- Symbols are things like variables, functions, types, etc. + map("ds", require("telescope.builtin").lsp_document_symbols, "[D]ocument [S]ymbols") + + -- Fuzzy find all the symbols in your current workspace. + -- Similar to document symbols, except searches over your entire project. + map("ws", require("telescope.builtin").lsp_dynamic_workspace_symbols, "[W]orkspace [S]ymbols") + + -- Rename the variable under your cursor. + -- Most Language Servers support renaming across files, etc. + map("rn", vim.lsp.buf.rename, "[R]e[n]ame") + + -- Execute a code action, usually your cursor needs to be on top of an error + -- or a suggestion from your LSP for this to activate. + map("ca", vim.lsp.buf.code_action, "[C]ode [A]ction") + + -- Opens a popup that displays documentation about the word under your cursor + -- See `:help K` for why this keymap. + map("K", vim.lsp.buf.hover, "Hover Documentation") + + -- WARN: This is not Goto Definition, this is Goto Declaration. + -- For example, in C this would take you to the header. + map("gD", vim.lsp.buf.declaration, "[G]oto [D]eclaration") + + -- The following two autocommands are used to highlight references of the + -- word under your cursor when your cursor rests there for a little while. + local client = vim.lsp.get_client_by_id(event.data.client_id) + if client and client.server_capabilities.documentHighlightProvider then + vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI" }, { + buffer = event.buf, + callback = vim.lsp.buf.document_highlight, + }) + + vim.api.nvim_create_autocmd({ "CursorMoved", "CursorMovedI" }, { + buffer = event.buf, + callback = vim.lsp.buf.clear_references, + }) + end + end, + }) + end, +} diff --git a/.config/nvim/lua/lilJ/plugins/mini.lua b/.config/nvim/lua/lilJ/plugins/mini.lua new file mode 100644 index 0000000..162601e --- /dev/null +++ b/.config/nvim/lua/lilJ/plugins/mini.lua @@ -0,0 +1,29 @@ +return { + "echasnovski/mini.nvim", + config = function() + -- Better Around/Inside textobjects + -- + -- Examples: + -- - va) - [V]isually select [A]round [)]paren + -- - yinq - [Y]ank [I]nside [N]ext [']quote + -- - ci' - [C]hange [I]nside [']quote + require("mini.ai").setup { n_lines = 500 } + + -- Add/delete/replace surroundings (brackets, quotes, etc.) + -- + -- - saiw) - [S]urround [A]dd [I]nner [W]ord [)]Paren + -- - sd' - [S]urround [D]elete [']quotes + -- - sr)' - [S]urround [R]eplace [)] ['] + require("mini.surround").setup() + + local statusline = require "mini.statusline" + statusline.setup { use_icons = vim.g.have_nerd_font } + + ---@diagnostic disable-next-line: duplicate-set-field + statusline.section_location = function() + return "%2l:%-2v" + end + + -- Check out: https://github.com/echasnovski/mini.nvim + end, +} diff --git a/.config/nvim/lua/lilJ/plugins/telescope.lua b/.config/nvim/lua/lilJ/plugins/telescope.lua new file mode 100644 index 0000000..b66bc3e --- /dev/null +++ b/.config/nvim/lua/lilJ/plugins/telescope.lua @@ -0,0 +1,24 @@ +return { + "nvim-telescope/telescope.nvim", + event = "VimEnter", + branch = "0.1.x", + dependencies = { + "nvim-lua/plenary.nvim", + { + "nvim-telescope/telescope-fzf-native.nvim", + + build = "make", + + cond = function() + return vim.fn.executable "make" == 1 + end, + }, + { "nvim-telescope/telescope-ui-select.nvim" }, + + { "nvim-tree/nvim-web-devicons", enabled = vim.g.have_nerd_font }, + }, + + config = function() + require "lilJ.telescope" + end, +} diff --git a/.config/nvim/lua/lilJ/plugins/tmux-navigator.lua b/.config/nvim/lua/lilJ/plugins/tmux-navigator.lua new file mode 100644 index 0000000..04655a3 --- /dev/null +++ b/.config/nvim/lua/lilJ/plugins/tmux-navigator.lua @@ -0,0 +1,20 @@ +return { + "alexghergh/nvim-tmux-navigation", + + lazy = false, + + config = function() + local nvim_tmux_nav = require "nvim-tmux-navigation" + + nvim_tmux_nav.setup { + disable_when_zoomed = true, + } + + vim.keymap.set("n", "", nvim_tmux_nav.NvimTmuxNavigateLeft) + vim.keymap.set("n", "", nvim_tmux_nav.NvimTmuxNavigateDown) + vim.keymap.set("n", "", nvim_tmux_nav.NvimTmuxNavigateUp) + vim.keymap.set("n", "", nvim_tmux_nav.NvimTmuxNavigateRight) + vim.keymap.set("n", "", nvim_tmux_nav.NvimTmuxNavigateLastActive) + vim.keymap.set("n", "", nvim_tmux_nav.NvimTmuxNavigateNext) + end, +} diff --git a/.config/nvim/lua/lilJ/plugins/todo-comments.lua b/.config/nvim/lua/lilJ/plugins/todo-comments.lua new file mode 100644 index 0000000..17de629 --- /dev/null +++ b/.config/nvim/lua/lilJ/plugins/todo-comments.lua @@ -0,0 +1,6 @@ +return { + "folke/todo-comments.nvim", + event = "VimEnter", + dependencies = { "nvim-lua/plenary.nvim" }, + opts = { signs = false }, +} diff --git a/.config/nvim/lua/lilJ/plugins/treesitter.lua b/.config/nvim/lua/lilJ/plugins/treesitter.lua new file mode 100644 index 0000000..f84f3ef --- /dev/null +++ b/.config/nvim/lua/lilJ/plugins/treesitter.lua @@ -0,0 +1,20 @@ +return { + "nvim-treesitter/nvim-treesitter", + build = ":TSUpdate", + dependencies = { + "nvim-treesitter/nvim-treesitter-textobjects", + }, + opts = { + ensure_installed = { "c", "go", "html", "javascript", "lua", "python" }, + auto_install = true, + highlight = { + enable = true, + additional_vim_regex_highlighting = { "ruby" }, + }, + indent = { enable = true, disable = { "ruby" } }, + }, + config = function(_, opts) + ---@diagnostic disable-next-line: missing-fields + require("nvim-treesitter.configs").setup(opts) + end, +} diff --git a/.config/nvim/lua/lilJ/telescope.lua b/.config/nvim/lua/lilJ/telescope.lua new file mode 100644 index 0000000..1eb9281 --- /dev/null +++ b/.config/nvim/lua/lilJ/telescope.lua @@ -0,0 +1,68 @@ +-- Telescope is a fuzzy finder that comes with a lot of different things that +-- it can fuzzy find! It's more than just a "file finder", it can search +-- many different aspects of Neovim, your workspace, LSP, and more! +-- +-- Two important keymaps to use while in Telescope are: +-- - Insert mode: +-- - Normal mode: ? +-- +-- This opens a window that shows you all of the keymaps for the current +-- Telescope picker. This is really useful to discover what Telescope can +-- do as well as how to actually do it! + +require("telescope").setup { + defaults = { + file_ignore_patterns = { ".git/", "node%_modules/.*" }, + prompt_prefix = "🔭 ", + selection_caret = " ", + -- initial_mode = "normal", + }, + + extensions = { + ["ui-select"] = { + require("telescope.themes").get_dropdown(), + }, + fzf = {}, + wrap_results = true, + }, +} + +-- Enable Telescope extensions if they are installed +pcall(require("telescope").load_extension, "fzf") +pcall(require("telescope").load_extension, "ui-select") + +local builtin = require "telescope.builtin" + +vim.keymap.set("n", "sf", builtin.find_files, { desc = "[S]earch [F]iles" }) +vim.keymap.set("n", "sh", builtin.help_tags, { desc = "[S]earch [H]elp" }) +vim.keymap.set("n", "sk", builtin.keymaps, { desc = "[S]earch [K]eymaps" }) +vim.keymap.set("n", "ss", builtin.builtin, { desc = "[S]earch [S]elect Telescope" }) + +-- IDK how to make grep work on my machine... (skill issues tbh) +vim.keymap.set("n", "sw", builtin.grep_string, { desc = "[S]earch current [W]ord" }) +vim.keymap.set("n", "sg", builtin.live_grep, { desc = "[S]earch by [G]rep" }) + +vim.keymap.set("n", "sd", builtin.diagnostics, { desc = "[S]earch [D]iagnostics" }) +vim.keymap.set("n", "sr", builtin.resume, { desc = "[S]earch [R]esume" }) +vim.keymap.set("n", "s.", builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' }) +vim.keymap.set("n", "", builtin.buffers, { desc = "[ ] Find existing buffers" }) + +-- Slightly advanced example of overriding default behavior and theme +vim.keymap.set("n", "/", function() + builtin.current_buffer_fuzzy_find(require("telescope.themes").get_dropdown { + winblend = 50, + previewer = false, + }) +end, { desc = "[/] Fuzzily search in current buffer" }) + +vim.keymap.set("n", "s/", function() + builtin.live_grep { + grep_open_files = true, + prompt_title = "Live Grep in Open Files", + } +end, { desc = "[S]earch [/] in Open Files" }) + +-- Shortcut for searching your Neovim configuration files +vim.keymap.set("n", "sn", function() + builtin.find_files { cwd = vim.fn.stdpath "config" } +end, { desc = "[S]earch [N]eovim files" }) diff --git a/.config/nvim/plugin/keymaps.lua b/.config/nvim/plugin/keymaps.lua new file mode 100644 index 0000000..72c90cd --- /dev/null +++ b/.config/nvim/plugin/keymaps.lua @@ -0,0 +1,54 @@ +local set = vim.keymap.set + +-- Prevent continue comment on new line +vim.api.nvim_create_autocmd( + "FileType", + { pattern = "*", command = [[setlocal formatoptions-=c formatoptions-=r formatoptions-=o]] } +) +vim.opt.wildignore = "*/.git/*,*/.DS_Store/*,*/target/*,*/node_modules/*" +vim.opt.expandtab = true + +-- stay in indent mode only +set("v", "<", "", ">gv") + +-- Move lines by selecting +set("v", "J", ":m '>+1gv=gv") +set("v", "K", ":m '<-2gv=gv") + +-- Keep yaa head straight +set("n", "", "zz") +set("n", "", "zz") + +-- Navigate with Netrw +set("n", "n", vim.cmd.Ex, { desc = "Open [N]etrw" }) +-- Prime said this is greatest remap ever +set("x", "p", [["_dP]]) + +-- Next greatest reamap +set({ "n", "v" }, "d", [["_d]]) + +-- Set highlight on search, but clear on pressing in normal mode +vim.opt.hlsearch = true +set("n", "", "nohlsearch") + +-- Diagnostic keymaps +set("n", "[d", vim.diagnostic.goto_prev, { desc = "Go to previous [D]iagnostic message" }) +set("n", "]d", vim.diagnostic.goto_next, { desc = "Go to next [D]iagnostic message" }) +set("n", "e", vim.diagnostic.open_float, { desc = "Show diagnostic [E]rror messages" }) +set("n", "q", vim.diagnostic.setloclist, { desc = "Open diagnostic [Q]uickfix list" }) + +-- Disable arrow keys in normal mode +set("n", "", 'echo "Use h to move!!"') +set("n", "", 'echo "Use l to move!!"') +set("n", "", 'echo "Use k to move!!"') +set("n", "", 'echo "Use j to move!!"') + +-- Highlight when yanking (copying) text +vim.api.nvim_create_autocmd("TextYankPost", { + desc = "Highlight when yanking (copying) text", + group = vim.api.nvim_create_augroup("kickstart-highlight-yank", { clear = true }), + callback = function() + vim.highlight.on_yank() + end, +}) diff --git a/.config/nvim/plugin/options.lua b/.config/nvim/plugin/options.lua new file mode 100644 index 0000000..8673043 --- /dev/null +++ b/.config/nvim/plugin/options.lua @@ -0,0 +1,47 @@ +local opt = vim.opt + +-- Use 4 space tabs +opt.tabstop = 4 +opt.softtabstop = 4 +opt.shiftwidth = 4 + +opt.number = true +opt.relativenumber = true + +-- Don't show the mode, since it's already in the status line +opt.showmode = false + +-- Sync clipboard between OS and Neovim. +opt.clipboard = "unnamedplus" + +opt.breakindent = true + +-- Sets how neovim will display certain whitespace characters in the editor. +-- opt.list = true +-- opt.listchars = { tab = "» ", trail = "·", nbsp = "␣" } + +-- Save undo history +opt.undofile = true + +-- Case-insensitive searching UNLESS \C or one or more capital letters in the search term +opt.ignorecase = true +opt.smartcase = true + +opt.signcolumn = "yes" + +opt.updatetime = 250 + +-- Preview substitutions live, as you type! +opt.inccommand = "split" + +-- Show which line your cursor is on +opt.cursorline = true + +-- Minimal number of screen lines to keep above and below the cursor. +opt.scrolloff = 10 + +-- line wrap settings +vim.o.linebreak = true +vim.o.wrap = true +vim.o.breakindent = true +vim.o.showbreak = "↳ " diff --git a/.config/nvim/plugin/terminal.lua b/.config/nvim/plugin/terminal.lua new file mode 100644 index 0000000..b7ad490 --- /dev/null +++ b/.config/nvim/plugin/terminal.lua @@ -0,0 +1,23 @@ +local set = vim.opt_local + +-- Set local settings for terminal buffers +vim.api.nvim_create_autocmd("TermOpen", { + group = vim.api.nvim_create_augroup("custom-term-open", {}), + callback = function() + set.number = false + set.relativenumber = false + set.scrolloff = 0 + end, +}) + +-- Easily hit escape in terminal mode. +vim.keymap.set("t", "", "") + +-- Open a terminal at the bottom of the screen with a fixed height. +vim.keymap.set("n", "st", function() + vim.cmd.new() + vim.cmd.wincmd "J" + vim.api.nvim_win_set_height(0, 12) + vim.wo.winfixheight = true + vim.cmd.term() +end) diff --git a/.config/nvim/stylua.toml b/.config/nvim/stylua.toml new file mode 100644 index 0000000..6a0d259 --- /dev/null +++ b/.config/nvim/stylua.toml @@ -0,0 +1,3 @@ +indent_type = "Spaces" +indent_width = 4 +no_call_parentheses = true diff --git a/.gitignore b/.gitignore index cc44680..ef86487 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ *.DS_Store */.config/tmux/plugins/tmux* *.gitconfig* +*.degit/* *.trash *.bun/* *.cache*