diff --git a/.gitignore b/.gitignore index 227f026..ea93eda 100644 --- a/.gitignore +++ b/.gitignore @@ -2,5 +2,4 @@ tags test.sh .luarc.json nvim -plugin/packer_compiled.lua lazy-lock.json diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 5c303b4..0000000 --- a/Dockerfile +++ /dev/null @@ -1,34 +0,0 @@ -# Build neovim separately in the first stage -FROM alpine:latest AS base - -RUN apk --no-cache add \ - autoconf \ - automake \ - build-base \ - cmake \ - ninja \ - coreutils \ - curl \ - gettext-tiny-dev \ - git \ - libtool \ - pkgconf \ - unzip - -# Build neovim (and use it as an example codebase -RUN git clone https://github.com/neovim/neovim.git - -ARG VERSION=master -RUN cd neovim && git checkout ${VERSION} && make CMAKE_BUILD_TYPE=RelWithDebInfo install - -# To support kickstart.nvim -RUN apk --no-cache add \ - fd \ - ctags \ - ripgrep \ - git - -# Copy the kickstart.nvim init.lua -COPY ./init.lua /root/.config/nvim/init.lua - -WORKDIR /neovim diff --git a/init.lua b/init.lua index 969f573..20a5e36 100644 --- a/init.lua +++ b/init.lua @@ -1,5 +1,23 @@ --- TODO BEFORE MERGE: --- - [ ] Document an example of adding your own custom plugins (for example, autopairs) +--[[ + +===================================================================== +==================== READ THIS BEFORE CONTINUING ==================== +===================================================================== + +I have left several `:help X` comments throughout the init.lua +You should run that command and read the help for the 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` @@ -23,8 +41,23 @@ if not vim.loop.fs_stat(lazypath) then 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({ - ---@diagnostic disable-next-line: assign-type-mismatch + -- NOTE: First, some plugins that don't require any configuration + + -- Git related plugins + 'tpope/vim-fugitive', + 'tpope/vim-rhubarb', + + -- Detect tabstop and shiftwidth automatically + 'tpope/vim-sleuth', + + -- NOTE: This is where your plugins related to LSP can be installed. + -- The configuration is done below. Search for lspconfig to find it below. { -- LSP Configuration & Plugins 'neovim/nvim-lspconfig', dependencies = { @@ -32,28 +65,23 @@ require('lazy').setup({ 'williamboman/mason.nvim', 'williamboman/mason-lspconfig.nvim', - -- Useful status updates for LSP - 'j-hui/fidget.nvim', + { -- Useful status updates for LSP + 'j-hui/fidget.nvim', + config = function() + require('fidget').setup() + end, + }, - -- Additional lua configuration, makes nvim stuff amazing + -- Additional lua configuration, makes nvim stuff amazing! 'folke/neodev.nvim', }, }, + { -- Autocompletion 'hrsh7th/nvim-cmp', dependencies = { 'hrsh7th/cmp-nvim-lsp', 'L3MON4D3/LuaSnip', 'saadparwaiz1/cmp_luasnip' }, }, - { -- Highlight, edit, and navigate code - 'nvim-treesitter/nvim-treesitter', - dependencies = { - 'nvim-treesitter/nvim-treesitter-textobjects', - }, - config = function() - pcall(require('nvim-treesitter.install').update { with_sync = true }) - end, - }, - { -- Useful plugin to show you pending keybinds. 'folke/which-key.nvim', config = function() @@ -63,21 +91,70 @@ require('lazy').setup({ end, }, - -- Git related plugins - 'tpope/vim-fugitive', - 'tpope/vim-rhubarb', - 'lewis6991/gitsigns.nvim', + { -- Adds git releated signs to the gutter, as well as utilities for managing changes + 'lewis6991/gitsigns.nvim', + config = function() + -- See `:help gitsigns.txt` + require('gitsigns').setup { + signs = { + add = { text = '+' }, + change = { text = '~' }, + delete = { text = '_' }, + topdelete = { text = '‾' }, + changedelete = { text = '~' }, + }, + } + end, + }, + + { -- Theme inspired by Atom + 'navarasu/onedark.nvim', + config = function() + vim.cmd.colorscheme 'onedark' + end, + }, + + { -- Fancier statusline + 'nvim-lualine/lualine.nvim', + config = function() + -- Set lualine as statusline + -- See `:help lualine.txt` + require('lualine').setup { + options = { + icons_enabled = false, + theme = 'onedark', + component_separators = '|', + section_separators = '', + }, + } + end, + }, - 'navarasu/onedark.nvim', -- Theme inspired by Atom - 'nvim-lualine/lualine.nvim', -- Fancier statusline - 'lukas-reineke/indent-blankline.nvim', -- Add indentation guides even on blank lines - 'numToStr/Comment.nvim', -- "gc" to comment visual regions/lines - 'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically + { -- Add indentation guides even on blank lines + 'lukas-reineke/indent-blankline.nvim', + config = function() + -- Enable `lukas-reineke/indent-blankline.nvim` + -- See `:help indent_blankline.txt` + require('indent_blankline').setup { + char = '┊', + show_trailing_blankline_indent = false, + } + end, + }, + + { -- "gc" to comment visual regions/lines + 'numToStr/Comment.nvim', + config = function() + require('Comment').setup() + end, + }, -- Fuzzy Finder (files, lsp, etc) { 'nvim-telescope/telescope.nvim', branch = '0.1.x', dependencies = { 'nvim-lua/plenary.nvim' } }, - -- Fuzzy Finder Algorithm which requires local dependencies to be built. Only load if `make` is available + -- 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', build = 'make', @@ -86,13 +163,23 @@ require('lazy').setup({ end, }, - -- Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart + { -- Highlight, edit, and navigate code + 'nvim-treesitter/nvim-treesitter', + dependencies = { + 'nvim-treesitter/nvim-treesitter-textobjects', + }, + config = function() + pcall(require('nvim-treesitter.install').update { with_sync = true }) + end, + }, + + -- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart -- require 'kickstart.plugins.autoformat', -- require 'kickstart.plugins.debug', - -- Add your own custom plugins to `lua/custom/plugins/*.lua` - -- For more information see: - -- https://github.com/folke/lazy.nvim#-structuring-your-plugins + -- NOTE: Add your own custom plugins to `lua/custom/plugins/*.lua` + -- There are examples in the README.md for kickstar.nvim + -- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins { import = 'custom.plugins' }, }, {}) @@ -122,13 +209,12 @@ vim.o.smartcase = true vim.o.updatetime = 250 vim.wo.signcolumn = 'yes' --- Set colorscheme -vim.o.termguicolors = true -vim.cmd [[colorscheme onedark]] - -- 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 @@ -150,39 +236,6 @@ vim.api.nvim_create_autocmd('TextYankPost', { pattern = '*', }) --- Set lualine as statusline --- See `:help lualine.txt` -require('lualine').setup { - options = { - icons_enabled = false, - theme = 'onedark', - component_separators = '|', - section_separators = '', - }, -} - --- Enable Comment.nvim -require('Comment').setup() - --- Enable `lukas-reineke/indent-blankline.nvim` --- See `:help indent_blankline.txt` -require('indent_blankline').setup { - char = '┊', - show_trailing_blankline_indent = false, -} - --- Gitsigns --- See `:help gitsigns.txt` -require('gitsigns').setup { - signs = { - add = { text = '+' }, - change = { text = '~' }, - delete = { text = '_' }, - topdelete = { text = '‾' }, - changedelete = { text = '~' }, - }, -} - -- [[ Configure Telescope ]] -- See `:help telescope` and `:help telescope.setup()` require('telescope').setup { @@ -355,7 +408,7 @@ local servers = { -- 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) @@ -380,9 +433,6 @@ mason_lspconfig.setup_handlers { end, } --- Turn on lsp status information -require('fidget').setup() - -- nvim-cmp setup local cmp = require 'cmp' local luasnip = require 'luasnip' @@ -398,7 +448,7 @@ cmp.setup { mapping = cmp.mapping.preset.insert { [''] = cmp.mapping.scroll_docs(-4), [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.complete(), + [''] = cmp.mapping.complete {}, [''] = cmp.mapping.confirm { behavior = cmp.ConfirmBehavior.Replace, select = true, diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index cdc244c..be0eb9d 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -1,3 +1,5 @@ -- You can add your own plugins here or in other files in this directory! -- I promise not to create any merge conflicts in this directory :) +-- +-- See the kickstart.nvim README for more information return {} diff --git a/lua/kickstart/plugins/autoformat.lua b/lua/kickstart/plugins/autoformat.lua index ca5807f..855f350 100644 --- a/lua/kickstart/plugins/autoformat.lua +++ b/lua/kickstart/plugins/autoformat.lua @@ -1,3 +1,8 @@ +-- autoformat.lua +-- +-- Use your language server to automatically format your code on save. +-- Adds additional commands as well to manage the behavior + return { 'neovim/nvim-lspconfig', diff --git a/lua/kickstart/plugins/debug.lua b/lua/kickstart/plugins/debug.lua index 33e3980..0b68c43 100644 --- a/lua/kickstart/plugins/debug.lua +++ b/lua/kickstart/plugins/debug.lua @@ -1,5 +1,16 @@ +-- debug.lua +-- +-- Shows how to use the DAP plugin to debug your code. +-- +-- Primarily focused on configuring the debugger for Go, but can +-- be extended to other languages as well. That's why it's called +-- 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', @@ -13,12 +24,6 @@ return { }, config = function() - -- Optional debug adapter setup - -- - -- To enable setup, change `disable = true` in the packer section - -- of the init.lua. You'll also want to copy this file into your - -- config at ~/.config/nvim/after/plugin/dap.lua - local dap = require 'dap' local dapui = require 'dapui'