From f5b59f51736986837fc956843519f4cfac403016 Mon Sep 17 00:00:00 2001 From: 2pac Date: Sun, 5 Nov 2023 22:42:28 +0100 Subject: [PATCH] LFG! --- KICKSTART-README.md | 188 +++++++++++ README.md | 188 +---------- doc/kickstart.txt | 24 -- doc/tags | 3 - init.lua | 296 ++++++------------ lazy-lock.json | 36 +++ .../plugins/autoformat.lua | 0 lua/custom/plugins/autopairs.lua | 13 + lua/{kickstart => custom}/plugins/debug.lua | 0 lua/custom/plugins/filetree.lua | 17 + lua/custom/plugins/init.lua | 4 - 11 files changed, 363 insertions(+), 406 deletions(-) create mode 100644 KICKSTART-README.md delete mode 100644 doc/kickstart.txt delete mode 100644 doc/tags create mode 100644 lazy-lock.json rename lua/{kickstart => custom}/plugins/autoformat.lua (100%) create mode 100644 lua/custom/plugins/autopairs.lua rename lua/{kickstart => custom}/plugins/debug.lua (100%) create mode 100644 lua/custom/plugins/filetree.lua diff --git a/KICKSTART-README.md b/KICKSTART-README.md new file mode 100644 index 00000000..1f8e6f40 --- /dev/null +++ b/KICKSTART-README.md @@ -0,0 +1,188 @@ +# kickstart.nvim + +https://github.com/kdheepak/kickstart.nvim/assets/1813121/f3ff9a2b-c31f-44df-a4fa-8a0d7b17cf7b + +### Introduction + +A starting point for Neovim that is: + +* Small +* Single-file (with examples of moving to multi-file) +* Documented +* Modular + +This repo is meant to be used by **YOU** to begin your Neovim journey; remove the things you don't use and add what you miss. + +Kickstart.nvim targets *only* the latest ['stable'](https://github.com/neovim/neovim/releases/tag/stable) and latest ['nightly'](https://github.com/neovim/neovim/releases/tag/nightly) of Neovim. If you are experiencing issues, please make sure you have the latest versions. + +Distribution Alternatives: +- [LazyVim](https://www.lazyvim.org/): A delightful distribution maintained by @folke (the author of lazy.nvim, the package manager used here) + +### Installation + +> **NOTE** +> [Backup](#FAQ) your previous configuration (if any exists) + +Requirements: +* Make sure to review the readmes of the plugins if you are experiencing errors. In particular: + * [ripgrep](https://github.com/BurntSushi/ripgrep#installation) is required for multiple [telescope](https://github.com/nvim-telescope/telescope.nvim#suggested-dependencies) pickers. +* See [Windows Installation](#Windows-Installation) if you have trouble with `telescope-fzf-native` + +Neovim's configurations are located under the following paths, depending on your OS: + +| OS | PATH | +| :- | :--- | +| Linux | `$XDG_CONFIG_HOME/nvim`, `~/.config/nvim` | +| MacOS | `$XDG_CONFIG_HOME/nvim`, `~/.config/nvim` | +| Windows | `%userprofile%\AppData\Local\nvim\` | + +Clone kickstart.nvim: + +```sh +# on Linux and Mac +git clone https://github.com/nvim-lua/kickstart.nvim.git "${XDG_CONFIG_HOME:-$HOME/.config}"/nvim +``` + + +``` +# on Windows +git clone https://github.com/nvim-lua/kickstart.nvim.git %userprofile%\AppData\Local\nvim\ +``` + +### Post Installation + +Start Neovim + +```sh +nvim +``` + +The `Lazy` plugin manager will start automatically on the first run and install the configured plugins - as can be seen in the introduction video. After the installation is complete you can press `q` to close the `Lazy` UI and **you are ready to go**! Next time you run nvim `Lazy` will no longer show up. + +If you would prefer to hide this step and run the plugin sync from the command line, you can use: + +```sh +nvim --headless "+Lazy! sync" +qa +``` + +### Recommended Steps + +[Fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo) this repo (so that you have your own copy that you can modify) and then installing you can install to your machine using the methods above. + +> **NOTE** +> Your fork's url will be something like this: `https://github.com//kickstart.nvim.git` + +### Configuration And Extension + +* Inside of your copy, feel free to modify any file you like! It's your copy! +* Feel free to change any of the default options in `init.lua` to better suit your needs. +* For adding plugins, there are 3 primary options: + * Add new configuration in `lua/custom/plugins/*` files, which will be auto sourced using `lazy.nvim` (uncomment the line importing the `custom/plugins` directory in the `init.lua` file to enable this) + * Modify `init.lua` with additional plugins. + * Include the `lua/kickstart/plugins/*` files in your configuration. + +You can also merge updates/changes from the repo back into your fork, to keep up-to-date with any changes for the default configuration. + +#### Example: Adding an autopairs plugin + +In the file: `lua/custom/plugins/autopairs.lua`, add: + +```lua +-- File: lua/custom/plugins/autopairs.lua + +return { + "windwp/nvim-autopairs", + -- Optional dependency + dependencies = { 'hrsh7th/nvim-cmp' }, + config = function() + require("nvim-autopairs").setup {} + -- If you want to automatically add `(` after selecting a function or method + local cmp_autopairs = require('nvim-autopairs.completion.cmp') + local cmp = require('cmp') + cmp.event:on( + 'confirm_done', + cmp_autopairs.on_confirm_done() + ) + end, +} +``` + + +This will automatically install [windwp/nvim-autopairs](https://github.com/windwp/nvim-autopairs) and enable it on startup. For more information, see documentation for [lazy.nvim](https://github.com/folke/lazy.nvim). + +#### Example: Adding a file tree plugin + +In the file: `lua/custom/plugins/filetree.lua`, add: + +```lua +-- Unless you are still migrating, remove the deprecated commands from v1.x +vim.cmd([[ let g:neo_tree_remove_legacy_commands = 1 ]]) + +return { + "nvim-neo-tree/neo-tree.nvim", + version = "*", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended + "MunifTanjim/nui.nvim", + }, + config = function () + require('neo-tree').setup {} + end, +} +``` + +This will install the tree plugin and add the command `:Neotree` for you. You can explore the documentation at [neo-tree.nvim](https://github.com/nvim-neo-tree/neo-tree.nvim) for more information. + +### Contribution + +Pull-requests are welcome. The goal of this repo is not to create a Neovim configuration framework, but to offer a starting template that shows, by example, available features in Neovim. Some things that will not be included: + +* Custom language server configuration (null-ls templates) +* Theming beyond a default colorscheme necessary for LSP highlight groups + +Each PR, especially those which increase the line count, should have a description as to why the PR is necessary. + +### FAQ + +* What should I do if I already have a pre-existing neovim configuration? + * You should back it up, then delete all files associated with it. + * This includes your existing init.lua and the neovim files in `~/.local` which can be deleted with `rm -rf ~/.local/share/nvim/` + * You may also want to look at the [migration guide for lazy.nvim](https://github.com/folke/lazy.nvim#-migration-guide) +* Can I keep my existing configuration in parallel to kickstart? + * Yes! You can use [NVIM_APPNAME](https://neovim.io/doc/user/starting.html#%24NVIM_APPNAME)`=nvim-NAME` to maintain multiple configurations. For example you can install the kickstart configuration in `~/.config/nvim-kickstart` and create a script `~/bin/nvim-kickstart`: + ``` + #!/bin/sh + exec env NVIM_APPNAME=nvim-kickstart nvim "$@" + ``` + When you run Neovim with `nvim-kickstart` it will use the alternative config directory and the matching local directory: `~/.local/share/nvim-kickstart`. You can apply this approach to any Neovim distribution that you would like to try out. +* What if I want to "uninstall" this configuration: + * See [lazy.nvim uninstall](https://github.com/folke/lazy.nvim#-uninstalling) information +* Are there any cool videos about this plugin? + * Current iteration of kickstart (coming soon) + * Here is one about the previous iteration of kickstart: [video introduction to Kickstart.nvim](https://youtu.be/stqUbv-5u2s). Note the install via init.lua no longer works as specified. Please follow the install instructions in this file instead as they're up to date. +* Why is the kickstart `init.lua` a single file? Wouldn't it make sense to split it into multiple files? + * The main purpose of kickstart is to serve as a teaching tool and a reference + configuration that someone can easily `git clone` as a basis for their own. + As you progress in learning Neovim and Lua, you might consider splitting `init.lua` + into smaller parts. A fork of kickstart that does this while maintaining the exact + same functionality is available here: + * [kickstart-modular.nvim](https://github.com/dam9000/kickstart-modular.nvim) + * Discussions on this topic can be found here: + * [Restructure the configuration](https://github.com/nvim-lua/kickstart.nvim/issues/218) + * [Reorganize init.lua into a multi-file setup](https://github.com/nvim-lua/kickstart.nvim/pull/473) + +### Windows Installation + +Installation may require installing build tools, and updating the run command for `telescope-fzf-native` + +See `telescope-fzf-native` documentation for [more details](https://github.com/nvim-telescope/telescope-fzf-native.nvim#installation) + +This requires: + +- Install CMake, and the Microsoft C++ Build Tools on Windows + +```lua +{'nvim-telescope/telescope-fzf-native.nvim', build = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build' } +``` + diff --git a/README.md b/README.md index 1f8e6f40..d93c9b72 100644 --- a/README.md +++ b/README.md @@ -1,188 +1,14 @@ -# kickstart.nvim +# 2pac's `nvim` config -https://github.com/kdheepak/kickstart.nvim/assets/1813121/f3ff9a2b-c31f-44df-a4fa-8a0d7b17cf7b +This config is a fork of the `kickstart.nvim` project, and you can refer +to the forked documentation in the [`KICKSTART-README.md`](./KICKSTART-README.md) file. -### Introduction +## Install -A starting point for Neovim that is: +Clone this repo in your OS default Neovim config location, and then run -* Small -* Single-file (with examples of moving to multi-file) -* Documented -* Modular - -This repo is meant to be used by **YOU** to begin your Neovim journey; remove the things you don't use and add what you miss. - -Kickstart.nvim targets *only* the latest ['stable'](https://github.com/neovim/neovim/releases/tag/stable) and latest ['nightly'](https://github.com/neovim/neovim/releases/tag/nightly) of Neovim. If you are experiencing issues, please make sure you have the latest versions. - -Distribution Alternatives: -- [LazyVim](https://www.lazyvim.org/): A delightful distribution maintained by @folke (the author of lazy.nvim, the package manager used here) - -### Installation - -> **NOTE** -> [Backup](#FAQ) your previous configuration (if any exists) - -Requirements: -* Make sure to review the readmes of the plugins if you are experiencing errors. In particular: - * [ripgrep](https://github.com/BurntSushi/ripgrep#installation) is required for multiple [telescope](https://github.com/nvim-telescope/telescope.nvim#suggested-dependencies) pickers. -* See [Windows Installation](#Windows-Installation) if you have trouble with `telescope-fzf-native` - -Neovim's configurations are located under the following paths, depending on your OS: - -| OS | PATH | -| :- | :--- | -| Linux | `$XDG_CONFIG_HOME/nvim`, `~/.config/nvim` | -| MacOS | `$XDG_CONFIG_HOME/nvim`, `~/.config/nvim` | -| Windows | `%userprofile%\AppData\Local\nvim\` | - -Clone kickstart.nvim: - -```sh -# on Linux and Mac -git clone https://github.com/nvim-lua/kickstart.nvim.git "${XDG_CONFIG_HOME:-$HOME/.config}"/nvim -``` - - -``` -# on Windows -git clone https://github.com/nvim-lua/kickstart.nvim.git %userprofile%\AppData\Local\nvim\ -``` - -### Post Installation - -Start Neovim - -```sh +```shell nvim ``` -The `Lazy` plugin manager will start automatically on the first run and install the configured plugins - as can be seen in the introduction video. After the installation is complete you can press `q` to close the `Lazy` UI and **you are ready to go**! Next time you run nvim `Lazy` will no longer show up. - -If you would prefer to hide this step and run the plugin sync from the command line, you can use: - -```sh -nvim --headless "+Lazy! sync" +qa -``` - -### Recommended Steps - -[Fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo) this repo (so that you have your own copy that you can modify) and then installing you can install to your machine using the methods above. - -> **NOTE** -> Your fork's url will be something like this: `https://github.com//kickstart.nvim.git` - -### Configuration And Extension - -* Inside of your copy, feel free to modify any file you like! It's your copy! -* Feel free to change any of the default options in `init.lua` to better suit your needs. -* For adding plugins, there are 3 primary options: - * Add new configuration in `lua/custom/plugins/*` files, which will be auto sourced using `lazy.nvim` (uncomment the line importing the `custom/plugins` directory in the `init.lua` file to enable this) - * Modify `init.lua` with additional plugins. - * Include the `lua/kickstart/plugins/*` files in your configuration. - -You can also merge updates/changes from the repo back into your fork, to keep up-to-date with any changes for the default configuration. - -#### Example: Adding an autopairs plugin - -In the file: `lua/custom/plugins/autopairs.lua`, add: - -```lua --- File: lua/custom/plugins/autopairs.lua - -return { - "windwp/nvim-autopairs", - -- Optional dependency - dependencies = { 'hrsh7th/nvim-cmp' }, - config = function() - require("nvim-autopairs").setup {} - -- If you want to automatically add `(` after selecting a function or method - local cmp_autopairs = require('nvim-autopairs.completion.cmp') - local cmp = require('cmp') - cmp.event:on( - 'confirm_done', - cmp_autopairs.on_confirm_done() - ) - end, -} -``` - - -This will automatically install [windwp/nvim-autopairs](https://github.com/windwp/nvim-autopairs) and enable it on startup. For more information, see documentation for [lazy.nvim](https://github.com/folke/lazy.nvim). - -#### Example: Adding a file tree plugin - -In the file: `lua/custom/plugins/filetree.lua`, add: - -```lua --- Unless you are still migrating, remove the deprecated commands from v1.x -vim.cmd([[ let g:neo_tree_remove_legacy_commands = 1 ]]) - -return { - "nvim-neo-tree/neo-tree.nvim", - version = "*", - dependencies = { - "nvim-lua/plenary.nvim", - "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended - "MunifTanjim/nui.nvim", - }, - config = function () - require('neo-tree').setup {} - end, -} -``` - -This will install the tree plugin and add the command `:Neotree` for you. You can explore the documentation at [neo-tree.nvim](https://github.com/nvim-neo-tree/neo-tree.nvim) for more information. - -### Contribution - -Pull-requests are welcome. The goal of this repo is not to create a Neovim configuration framework, but to offer a starting template that shows, by example, available features in Neovim. Some things that will not be included: - -* Custom language server configuration (null-ls templates) -* Theming beyond a default colorscheme necessary for LSP highlight groups - -Each PR, especially those which increase the line count, should have a description as to why the PR is necessary. - -### FAQ - -* What should I do if I already have a pre-existing neovim configuration? - * You should back it up, then delete all files associated with it. - * This includes your existing init.lua and the neovim files in `~/.local` which can be deleted with `rm -rf ~/.local/share/nvim/` - * You may also want to look at the [migration guide for lazy.nvim](https://github.com/folke/lazy.nvim#-migration-guide) -* Can I keep my existing configuration in parallel to kickstart? - * Yes! You can use [NVIM_APPNAME](https://neovim.io/doc/user/starting.html#%24NVIM_APPNAME)`=nvim-NAME` to maintain multiple configurations. For example you can install the kickstart configuration in `~/.config/nvim-kickstart` and create a script `~/bin/nvim-kickstart`: - ``` - #!/bin/sh - exec env NVIM_APPNAME=nvim-kickstart nvim "$@" - ``` - When you run Neovim with `nvim-kickstart` it will use the alternative config directory and the matching local directory: `~/.local/share/nvim-kickstart`. You can apply this approach to any Neovim distribution that you would like to try out. -* What if I want to "uninstall" this configuration: - * See [lazy.nvim uninstall](https://github.com/folke/lazy.nvim#-uninstalling) information -* Are there any cool videos about this plugin? - * Current iteration of kickstart (coming soon) - * Here is one about the previous iteration of kickstart: [video introduction to Kickstart.nvim](https://youtu.be/stqUbv-5u2s). Note the install via init.lua no longer works as specified. Please follow the install instructions in this file instead as they're up to date. -* Why is the kickstart `init.lua` a single file? Wouldn't it make sense to split it into multiple files? - * The main purpose of kickstart is to serve as a teaching tool and a reference - configuration that someone can easily `git clone` as a basis for their own. - As you progress in learning Neovim and Lua, you might consider splitting `init.lua` - into smaller parts. A fork of kickstart that does this while maintaining the exact - same functionality is available here: - * [kickstart-modular.nvim](https://github.com/dam9000/kickstart-modular.nvim) - * Discussions on this topic can be found here: - * [Restructure the configuration](https://github.com/nvim-lua/kickstart.nvim/issues/218) - * [Reorganize init.lua into a multi-file setup](https://github.com/nvim-lua/kickstart.nvim/pull/473) - -### Windows Installation - -Installation may require installing build tools, and updating the run command for `telescope-fzf-native` - -See `telescope-fzf-native` documentation for [more details](https://github.com/nvim-telescope/telescope-fzf-native.nvim#installation) - -This requires: - -- Install CMake, and the Microsoft C++ Build Tools on Windows - -```lua -{'nvim-telescope/telescope-fzf-native.nvim', build = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build' } -``` - +that's it. diff --git a/doc/kickstart.txt b/doc/kickstart.txt deleted file mode 100644 index cb87ac3f..00000000 --- a/doc/kickstart.txt +++ /dev/null @@ -1,24 +0,0 @@ -================================================================================ -INTRODUCTION *kickstart.nvim* - -Kickstart.nvim is a project to help you get started on your neovim journey. - - *kickstart-is-not* -It is not: -- Complete framework for every plugin under the sun -- Place to add every plugin that could ever be useful - - *kickstart-is* -It is: -- Somewhere that has a good start for the most common "IDE" type features: - - autocompletion - - goto-definition - - find references - - fuzzy finding - - and hinting at what more can be done :) -- A place to _kickstart_ your journey. - - You should fork this project and use/modify it so that it matches your - style and preferences. If you don't want to do that, there are probably - other projects that would fit much better for you (and that's great!)! - - vim:tw=78:ts=8:ft=help:norl: diff --git a/doc/tags b/doc/tags deleted file mode 100644 index 687ae772..00000000 --- a/doc/tags +++ /dev/null @@ -1,3 +0,0 @@ -kickstart-is kickstart.txt /*kickstart-is* -kickstart-is-not kickstart.txt /*kickstart-is-not* -kickstart.nvim kickstart.txt /*kickstart.nvim* diff --git a/init.lua b/init.lua index a7667ddc..9a61dc3a 100644 --- a/init.lua +++ b/init.lua @@ -1,51 +1,7 @@ ---[[ - -===================================================================== -==================== 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 +-- This is the basics of the config local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim' if not vim.loop.fs_stat(lazypath) then vim.fn.system { @@ -59,14 +15,7 @@ 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({ - -- NOTE: First, some plugins that don't require any configuration - -- Git related plugins 'tpope/vim-fugitive', 'tpope/vim-rhubarb', @@ -74,8 +23,6 @@ require('lazy').setup({ -- 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', @@ -88,7 +35,7 @@ require('lazy').setup({ -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})` { 'j-hui/fidget.nvim', tag = 'legacy', opts = {} }, - -- Additional lua configuration, makes nvim stuff amazing! + -- NOTE(taras) WTF is this 'folke/neodev.nvim', }, }, @@ -100,22 +47,16 @@ require('lazy').setup({ -- 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 + -- See `:help gitsigns.txt` 'lewis6991/gitsigns.nvim', opts = { - -- See `:help gitsigns.txt` signs = { add = { text = '+' }, change = { text = '~' }, @@ -151,22 +92,21 @@ require('lazy').setup({ }, { - -- Theme inspired by Atom - 'navarasu/onedark.nvim', + 'jacoborus/tender.vim', priority = 1000, config = function() - vim.cmd.colorscheme 'onedark' + vim.cmd.colorscheme 'tender' end, }, { -- Set lualine as statusline - 'nvim-lualine/lualine.nvim', -- See `:help lualine.txt` + 'nvim-lualine/lualine.nvim', opts = { options = { - icons_enabled = false, - theme = 'onedark', + icons_enabled = true, + theme = 'tender', component_separators = '|', section_separators = '', }, @@ -174,30 +114,34 @@ require('lazy').setup({ }, { - -- Add indentation guides even on blank lines - 'lukas-reineke/indent-blankline.nvim', - -- Enable `lukas-reineke/indent-blankline.nvim` - -- See `:help ibl` - main = 'ibl', - opts = {}, + 'github/copilot.vim', + config = function() + vim.g.copilot_no_tab_map = false + vim.keymap.set('i', '', [[copilot#Accept("\")]], { silent = true, expr = true }) + end, }, - -- "gc" to comment visual regions/lines - { 'numToStr/Comment.nvim', opts = {} }, + { + 'wakatime/vim-wakatime' + }, + + { + -- Add indentation guides even on blank lines + 'lukas-reineke/indent-blankline.nvim', + main = 'ibl', + opts = {}, + enabled = true, + }, + + { '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 @@ -207,7 +151,6 @@ require('lazy').setup({ }, { - -- Highlight, edit, and navigate code 'nvim-treesitter/nvim-treesitter', dependencies = { 'nvim-treesitter/nvim-treesitter-textobjects', @@ -215,74 +158,80 @@ require('lazy').setup({ build = ':TSUpdate', }, - -- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart - -- These are some example plugins that I've included in the kickstart repository. - -- Uncomment any of the lines below to enable them. - -- require 'kickstart.plugins.autoformat', - -- require 'kickstart.plugins.debug', - - -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` - -- You can use this folder to prevent any conflicts with this init.lua if you're interested in keeping - -- up-to-date with whatever is in the kickstart repo. - -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. - -- - -- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins - -- { import = 'custom.plugins' }, + -- Custom plugin folder + { 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 +-- [[ Basic config ]] +vim.o.showmatch = true +vim.o.hlsearch = true +vim.o.smartcase = true +vim.o.ignorecase = true +vim.o.incsearch = true +vim.o.shortmess = 'I' +vim.o.relativenumber = true +vim.o.number = true +vim.o.textwidth = 0 +vim.o.laststatus = 2 +vim.o.cursorline = true +vim.o.ruler = true +vim.o.undolevels = 1000 +vim.o.backspace = 'indent,eol,start' +vim.o.noerrorbells = true +vim.o.visualbell = true +vim.o.t_vb = '' +vim.o.belloff = 'all' +vim.o.noshowmode = true +vim.o.hidden = true +vim.o.noequalalways = true +vim.o.splitright = true +vim.o.splitbelow = true +vim.o.autoindent = true +vim.o.cindent = true +vim.o.wrap = true +vim.o.breakindent = true +vim.o.linebreak = true +vim.o.expandtab = true +vim.o.list = true +vim.o.noswapfile = true +vim.o.cmdheight = 1 +vim.o.scrolloff = 10 +vim.o.tabstop = 4 +vim.o.shiftwidth = 4 +vim.o.softtabstop = 4 +vim.o.foldmethod = 'marker' +vim.o.foldlevel = 0 +vim.o.modelines = 1 +vim.o.inccommand = 'split' +vim.o.undofile = true +vim.o.updatetime = 250 +vim.o.timeoutlen = 300 +vim.o.completeopt = 'menuone,noselect' +vim.o.termguicolors = true --- Make line numbers default -vim.wo.number = true - --- Enable mouse mode -vim.o.mouse = 'a' +vim.wo.signcolumn = 'yes' -- 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' +-- vim.o.clipboard = 'unnamedplus' --- Enable break indent -vim.o.breakindent = true +-- [[ Keymaps ]] +vim.keymap.set('n', '', [[:noh]]) +vim.keymap.set('n', '0', [[^]]) --- Save undo history -vim.o.undofile = true +-- Tab navigation +vim.keymap.set('n', '', [[gt]]) +vim.keymap.set('n', '', [[gT]]) --- 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 }) +-- Move lines around +vim.keymap.set('v', '', [[:m '<-2gv=gv]]) +vim.keymap.set('v', '', [[:m '>+1gv=gv]]) -- 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() @@ -293,7 +242,6 @@ vim.api.nvim_create_autocmd('TextYankPost', { }) -- [[ Configure Telescope ]] --- See `:help telescope` and `:help telescope.setup()` require('telescope').setup { defaults = { mappings = { @@ -308,17 +256,19 @@ require('telescope').setup { -- 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', 'o', require('telescope.builtin').git_files, { desc = 'Search [G]it [F]iles' }) +vim.keymap.set('n', 'O', [[:tabnewrequire('telescope.builtin').git_files()]], + { desc = 'Search [G]it [F]iles' }) + 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' }) @@ -328,16 +278,17 @@ vim.keymap.set('n', 'sd', require('telescope.builtin').diagnostics, { de vim.keymap.set('n', 'sr', require('telescope.builtin').resume, { desc = '[S]earch [R]esume' }) -- [[ Configure Treesitter ]] --- See `:help nvim-treesitter` -- Defer Treesitter setup after first render to improve startup time of 'nvim {filename}' vim.defer_fn(function() require('nvim-treesitter.configs').setup { -- Add languages to be installed here that you want installed for treesitter - ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'javascript', 'typescript', 'vimdoc', 'vim', 'bash' }, + ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'javascript', 'typescript', 'vimdoc', 'vim', + 'bash' }, -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!) - auto_install = false, + auto_install = true, + -- NOTE(taras) This seems like navigation goodies, check at some point highlight = { enable = true }, indent = { enable = true }, incremental_selection = { @@ -351,7 +302,7 @@ vim.defer_fn(function() }, textobjects = { select = { - enable = true, + enable = false, lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim keymaps = { -- You can use the capture groups defined in textobjects.scm @@ -364,7 +315,7 @@ vim.defer_fn(function() }, }, move = { - enable = true, + enable = false, set_jumps = true, -- whether to set jumps in the jumplist goto_next_start = { [']m'] = '@function.outer', @@ -384,7 +335,7 @@ vim.defer_fn(function() }, }, swap = { - enable = true, + enable = false, swap_next = { ['a'] = '@parameter.inner', }, @@ -405,12 +356,6 @@ vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagn -- [[ 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 @@ -447,38 +392,19 @@ local on_attach = function(_, bufnr) end, { desc = 'Format current buffer with LSP' }) end --- document existing key chains -require('which-key').register { - ['c'] = { name = '[C]ode', _ = 'which_key_ignore' }, - ['d'] = { name = '[D]ocument', _ = 'which_key_ignore' }, - ['g'] = { name = '[G]it', _ = 'which_key_ignore' }, - ['h'] = { name = 'More git', _ = 'which_key_ignore' }, - ['r'] = { name = '[R]ename', _ = 'which_key_ignore' }, - ['s'] = { name = '[S]earch', _ = 'which_key_ignore' }, - ['w'] = { name = '[W]orkspace', _ = 'which_key_ignore' }, -} - -- mason-lspconfig requires that these setup functions are called in this order -- before setting up the servers. require('mason').setup() require('mason-lspconfig').setup() -- 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'} }, - + clangd = {}, + gopls = {}, + pyright = {}, + rust_analyzer = {}, + tsserver = {}, + html = { filetypes = { 'html', 'twig', 'hbs' } }, lua_ls = { Lua = { workspace = { checkThirdParty = false }, @@ -535,24 +461,6 @@ cmp.setup { 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' }, diff --git a/lazy-lock.json b/lazy-lock.json new file mode 100644 index 00000000..84a5a4b6 --- /dev/null +++ b/lazy-lock.json @@ -0,0 +1,36 @@ +{ + "Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" }, + "LuaSnip": { "branch": "master", "commit": "a4de64570b9620875c8ea04175cd07ed8e32ac99" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" }, + "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, + "copilot.vim": { "branch": "release", "commit": "309b3c803d1862d5e84c7c9c5749ae04010123b8" }, + "fidget.nvim": { "branch": "main", "commit": "0ba1e16d07627532b6cae915cc992ecac249fb97" }, + "friendly-snippets": { "branch": "main", "commit": "43727c2ff84240e55d4069ec3e6158d74cb534b6" }, + "gitsigns.nvim": { "branch": "main", "commit": "af0f583cd35286dd6f0e3ed52622728703237e50" }, + "indent-blankline.nvim": { "branch": "master", "commit": "29be0919b91fb59eca9e90690d76014233392bef" }, + "lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" }, + "lualine.nvim": { "branch": "master", "commit": "2248ef254d0a1488a72041cfb45ca9caada6d994" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "40301e1c74bc0946eece13edf2b1c561cc497491" }, + "mason-nvim-dap.nvim": { "branch": "main", "commit": "f0cd12f7a8a310c58cecebddb6b219ffad1cfd0f" }, + "mason.nvim": { "branch": "main", "commit": "eabf6d347fdb75be360d4c0ced1145670a171453" }, + "neo-tree.nvim": { "branch": "main", "commit": "1236db954ce502eb5b340bcdb69aa057cc372e8d" }, + "neodev.nvim": { "branch": "main", "commit": "80487e4f7bfa11c2ef2a1b461963db019aad6a73" }, + "nui.nvim": { "branch": "main", "commit": "c0c8e347ceac53030f5c1ece1c5a5b6a17a25b32" }, + "nvim-autopairs": { "branch": "master", "commit": "0f04d78619cce9a5af4f355968040f7d675854a1" }, + "nvim-cmp": { "branch": "main", "commit": "51260c02a8ffded8e16162dcf41a23ec90cfba62" }, + "nvim-dap": { "branch": "master", "commit": "4048f37bc8b1a36fe1f5fde0df7d84aef71380e4" }, + "nvim-dap-go": { "branch": "main", "commit": "a5cc8dcad43f0732585d4793deb02a25c4afb766" }, + "nvim-dap-ui": { "branch": "master", "commit": "34160a7ce6072ef332f350ae1d4a6a501daf0159" }, + "nvim-lspconfig": { "branch": "master", "commit": "b44737605807023d32e6310b87ba69f4dbf10e0e" }, + "nvim-treesitter": { "branch": "master", "commit": "a82bba45fb0fb43fc2e7998f3394fadc80606d8a" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "e69a504baf2951d52e1f1fbb05145d43f236cbf1" }, + "nvim-web-devicons": { "branch": "master", "commit": "5de460ca7595806044eced31e3c36c159a493857" }, + "plenary.nvim": { "branch": "master", "commit": "50012918b2fc8357b87cff2a7f7f0446e47da174" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" }, + "telescope.nvim": { "branch": "0.1.x", "commit": "7011eaae0ac1afe036e30c95cf80200b8dc3f21a" }, + "tender.vim": { "branch": "master", "commit": "7746453a045eaa97dc413a7209268345f33f3243" }, + "vim-fugitive": { "branch": "master", "commit": "46eaf8918b347906789df296143117774e827616" }, + "vim-rhubarb": { "branch": "master", "commit": "ee69335de176d9325267b0fd2597a22901d927b1" }, + "vim-sleuth": { "branch": "master", "commit": "1cc4557420f215d02c4d2645a748a816c220e99b" }, + "vim-wakatime": { "branch": "master", "commit": "3c6c5bf17f4ae6c53396667ce3405df02a80b894" } +} \ No newline at end of file diff --git a/lua/kickstart/plugins/autoformat.lua b/lua/custom/plugins/autoformat.lua similarity index 100% rename from lua/kickstart/plugins/autoformat.lua rename to lua/custom/plugins/autoformat.lua diff --git a/lua/custom/plugins/autopairs.lua b/lua/custom/plugins/autopairs.lua new file mode 100644 index 00000000..77482a5f --- /dev/null +++ b/lua/custom/plugins/autopairs.lua @@ -0,0 +1,13 @@ +return { + "windwp/nvim-autopairs", + dependencies = { 'hrsh7th/nvim-cmp' }, + config = function() + require("nvim-autopairs").setup {} + local cmp_autopairs = require('nvim-autopairs.completion.cmp') + local cmp = require('cmp') + cmp.event:on( + 'confirm_done', + cmp_autopairs.on_confirm_done() + ) + end, +} diff --git a/lua/kickstart/plugins/debug.lua b/lua/custom/plugins/debug.lua similarity index 100% rename from lua/kickstart/plugins/debug.lua rename to lua/custom/plugins/debug.lua diff --git a/lua/custom/plugins/filetree.lua b/lua/custom/plugins/filetree.lua new file mode 100644 index 00000000..84e392dc --- /dev/null +++ b/lua/custom/plugins/filetree.lua @@ -0,0 +1,17 @@ +-- Unless you are still migrating, remove the deprecated commands from v1.x +vim.cmd([[ let g:neo_tree_remove_legacy_commands = 1 ]]) + +return { + "nvim-neo-tree/neo-tree.nvim", + version = "*", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended + "MunifTanjim/nui.nvim", + }, + config = function() + require('neo-tree').setup {} + + vim.keymap.set('n', 'a', [[:Neotree toggle reveal_force_cwd]]) + end, +} diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index be0eb9d8..a5647075 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -1,5 +1 @@ --- 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 {}