From 68eb71e507b0089598debbb7768b492379d50b7e Mon Sep 17 00:00:00 2001 From: "Lockszmith (kateryna)" Date: Sat, 28 Sep 2024 23:36:13 -0400 Subject: [PATCH] Added nvim kickstart-modular based configuration --- _home/private_dot_config/nvim/.chezmoiignore | 10 ++ _home/private_dot_config/nvim/dot_gitignore | 6 + _home/private_dot_config/nvim/dot_stylua.toml | 6 + _home/private_dot_config/nvim/init.lua | 109 ++++++++++++++++++ _home/private_dot_config/nvim/lazy-lock.json | 26 +++++ .../nvim/lua/custom/plugins/init.lua | 5 + _home/private_dot_config/nvim/lua/keymaps.lua | 48 ++++++++ .../nvim/lua/lazy-bootstrap.lua | 13 +++ .../nvim/lua/lazy-plugins.lua | 90 +++++++++++++++ _home/private_dot_config/nvim/lua/options.lua | 65 +++++++++++ 10 files changed, 378 insertions(+) create mode 100644 _home/private_dot_config/nvim/.chezmoiignore create mode 100644 _home/private_dot_config/nvim/dot_gitignore create mode 100644 _home/private_dot_config/nvim/dot_stylua.toml create mode 100644 _home/private_dot_config/nvim/init.lua create mode 100644 _home/private_dot_config/nvim/lazy-lock.json create mode 100644 _home/private_dot_config/nvim/lua/custom/plugins/init.lua create mode 100644 _home/private_dot_config/nvim/lua/keymaps.lua create mode 100644 _home/private_dot_config/nvim/lua/lazy-bootstrap.lua create mode 100644 _home/private_dot_config/nvim/lua/lazy-plugins.lua create mode 100644 _home/private_dot_config/nvim/lua/options.lua diff --git a/_home/private_dot_config/nvim/.chezmoiignore b/_home/private_dot_config/nvim/.chezmoiignore new file mode 100644 index 0000000..51b7b03 --- /dev/null +++ b/_home/private_dot_config/nvim/.chezmoiignore @@ -0,0 +1,10 @@ +.github +.github/** +LICENSE.md +README.md +doc +doc/** +spell +spell/** +lua/kickstart +lua/kickstart/** diff --git a/_home/private_dot_config/nvim/dot_gitignore b/_home/private_dot_config/nvim/dot_gitignore new file mode 100644 index 0000000..8a192ca --- /dev/null +++ b/_home/private_dot_config/nvim/dot_gitignore @@ -0,0 +1,6 @@ +tags +test.sh +.luarc.json +nvim + +spell/ diff --git a/_home/private_dot_config/nvim/dot_stylua.toml b/_home/private_dot_config/nvim/dot_stylua.toml new file mode 100644 index 0000000..139e939 --- /dev/null +++ b/_home/private_dot_config/nvim/dot_stylua.toml @@ -0,0 +1,6 @@ +column_width = 160 +line_endings = "Unix" +indent_type = "Spaces" +indent_width = 2 +quote_style = "AutoPreferSingle" +call_parentheses = "None" diff --git a/_home/private_dot_config/nvim/init.lua b/_home/private_dot_config/nvim/init.lua new file mode 100644 index 0000000..3784c1a --- /dev/null +++ b/_home/private_dot_config/nvim/init.lua @@ -0,0 +1,109 @@ +--[[ + +===================================================================== +==================== READ THIS BEFORE CONTINUING ==================== +===================================================================== +======== .-----. ======== +======== .----------------------. | === | ======== +======== |.-""""""""""""""""""-.| |-----| ======== +======== || || | === | ======== +======== || KICKSTART.NVIM || |-----| ======== +======== || || | === | ======== +======== || || |-----| ======== +======== ||:Tutor || |:::::| ======== +======== |'-..................-'| |____o| ======== +======== `"")----------------(""` ___________ ======== +======== /::::::::::| |::::::::::\ \ no mouse \ ======== +======== /:::========| |==hjkl==:::\ \ required \ ======== +======== '""""""""""""' '""""""""""""' '""""""""""' ======== +======== ======== +===================================================================== +===================================================================== + +What is Kickstart? + + Kickstart.nvim is *not* a distribution. + + Kickstart.nvim is a starting point 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 can start exploring, configuring and tinkering to + make Neovim your own! That might mean leaving Kickstart just the way it is for a while + or immediately breaking it into modular pieces. It's up to you! + + If you don't know anything about Lua, I recommend taking some time to read through + a guide. One possible example which will only take 10-15 minutes: + - https://learnxinyminutes.com/docs/lua/ + + After understanding a bit more about Lua, you can use `:help lua-guide` as a + reference for how Neovim integrates Lua. + - :help lua-guide + - (or HTML version): https://neovim.io/doc/user/lua-guide.html + +Kickstart Guide: + + TODO: The very first thing you should do is to run the command `:Tutor` in Neovim. + + If you don't know what this means, type the following: + - + - : + - Tutor + - + + (If you already know the Neovim basics, you can skip this step.) + + Once you've completed that, you can continue working through **AND READING** the rest + of the kickstart init.lua. + + Next, run AND READ `:help`. + This will open up a help window with some basic information + about reading, navigating and searching the builtin help documentation. + + This should be the first place you go to look when you're stuck or confused + with something. It's one of my favorite Neovim features. + + MOST IMPORTANTLY, we provide a keymap "sh" to [s]earch the [h]elp documentation, + which is very useful when you're not exactly sure of what you're looking for. + + I have left several `:help X` comments throughout the init.lua + These are hints about where to find more information about the relevant settings, + plugins or Neovim features used in Kickstart. + + NOTE: Look for lines like this + + Throughout the file. These are for you, the reader, to help you 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 Neovim config. + +If you experience any errors while trying to install kickstart, run `:checkhealth` for more info. + +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 loaded (otherwise wrong leader will be used) +vim.g.mapleader = ' ' +vim.g.maplocalleader = ' ' + +-- Set to true if you have a Nerd Font installed and selected in the terminal +vim.g.have_nerd_font = false + +-- [[ Setting options ]] +require 'options' + +-- [[ Basic Keymaps ]] +require 'keymaps' + +-- [[ Install `lazy.nvim` plugin manager ]] +require 'lazy-bootstrap' + +-- [[ Configure and install plugins ]] +require 'lazy-plugins' + +-- The line beneath this is called `modeline`. See `:help modeline` +-- vim: ts=2 sts=2 sw=2 et diff --git a/_home/private_dot_config/nvim/lazy-lock.json b/_home/private_dot_config/nvim/lazy-lock.json new file mode 100644 index 0000000..b60dcab --- /dev/null +++ b/_home/private_dot_config/nvim/lazy-lock.json @@ -0,0 +1,26 @@ +{ + "LuaSnip": { "branch": "master", "commit": "e808bee352d1a6fcf902ca1a71cee76e60e24071" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, + "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, + "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, + "conform.nvim": { "branch": "master", "commit": "1a99fdc1d3aa9ccdf3021e67982a679a8c5c740c" }, + "fidget.nvim": { "branch": "main", "commit": "d855eed8a06531a7e8fd0684889b2943f373c469" }, + "gitsigns.nvim": { "branch": "main", "commit": "863903631e676b33e8be2acb17512fdc1b80b4fb" }, + "lazy.nvim": { "branch": "main", "commit": "460e1cd8f24e364d54543a4b0e83f6f4ec1f65fb" }, + "lazydev.nvim": { "branch": "main", "commit": "491452cf1ca6f029e90ad0d0368848fac717c6d2" }, + "luvit-meta": { "branch": "main", "commit": "ce76f6f6cdc9201523a5875a4471dcfe0186eb60" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "25c11854aa25558ee6c03432edfa0df0217324be" }, + "mason-tool-installer.nvim": { "branch": "main", "commit": "c5e07b8ff54187716334d585db34282e46fa2932" }, + "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, + "mini.nvim": { "branch": "main", "commit": "848c5e8f428faf843051768e0d56104cd02aea1f" }, + "nvim-cmp": { "branch": "main", "commit": "ae644feb7b67bf1ce4260c231d1d4300b19c6f30" }, + "nvim-lspconfig": { "branch": "master", "commit": "a9bc587e9ae0cbcb3e90a2e9342f86b3b78c4408" }, + "nvim-treesitter": { "branch": "master", "commit": "36b78d112bddd69a05e24679241962e29e494d9e" }, + "plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" }, + "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, + "telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, + "todo-comments.nvim": { "branch": "main", "commit": "ae0a2afb47cf7395dc400e5dc4e05274bf4fb9e0" }, + "tokyonight.nvim": { "branch": "main", "commit": "817bb6ffff1b9ce72cdd45d9fcfa8c9cd1ad3839" }, + "vim-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" }, + "which-key.nvim": { "branch": "main", "commit": "fb070344402cfc662299d9914f5546d840a22126" } +} diff --git a/_home/private_dot_config/nvim/lua/custom/plugins/init.lua b/_home/private_dot_config/nvim/lua/custom/plugins/init.lua new file mode 100644 index 0000000..be0eb9d --- /dev/null +++ b/_home/private_dot_config/nvim/lua/custom/plugins/init.lua @@ -0,0 +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/_home/private_dot_config/nvim/lua/keymaps.lua b/_home/private_dot_config/nvim/lua/keymaps.lua new file mode 100644 index 0000000..c07a08a --- /dev/null +++ b/_home/private_dot_config/nvim/lua/keymaps.lua @@ -0,0 +1,48 @@ +-- [[ Basic Keymaps ]] +-- See `:help vim.keymap.set()` + +-- Clear highlights on search when pressing in normal mode +-- See `:help hlsearch` +vim.keymap.set('n', '', 'nohlsearch') + +-- Diagnostic keymaps +vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' }) + +-- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier +-- for people to discover. Otherwise, you normally need to press , which +-- is not what someone will guess without a bit more experience. +-- +-- NOTE: This won't work in all terminal emulators/tmux/etc. Try your own mapping +-- or just use to exit terminal mode +vim.keymap.set('t', '', '', { desc = 'Exit terminal mode' }) + +-- TIP: 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!!"') + +-- Keybinds to make split navigation easier. +-- Use CTRL+ to switch between windows +-- +-- See `:help wincmd` for a list of all window commands +vim.keymap.set('n', '', '', { desc = 'Move focus to the left window' }) +vim.keymap.set('n', '', '', { desc = 'Move focus to the right window' }) +vim.keymap.set('n', '', '', { desc = 'Move focus to the lower window' }) +vim.keymap.set('n', '', '', { desc = 'Move focus to the upper window' }) + +-- [[ Basic Autocommands ]] +-- See `:help lua-guide-autocommands` + +-- Highlight when yanking (copying) text +-- Try it with `yap` in normal mode +-- See `:help vim.highlight.on_yank()` +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, +}) + +-- vim: ts=2 sts=2 sw=2 et diff --git a/_home/private_dot_config/nvim/lua/lazy-bootstrap.lua b/_home/private_dot_config/nvim/lua/lazy-bootstrap.lua new file mode 100644 index 0000000..8dc96c8 --- /dev/null +++ b/_home/private_dot_config/nvim/lua/lazy-bootstrap.lua @@ -0,0 +1,13 @@ +-- [[ Install `lazy.nvim` plugin manager ]] +-- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info +local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim' +if not (vim.uv or vim.loop).fs_stat(lazypath) then + local lazyrepo = 'https://github.com/folke/lazy.nvim.git' + local out = vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath } + if vim.v.shell_error ~= 0 then + error('Error cloning lazy.nvim:\n' .. out) + end +end ---@diagnostic disable-next-line: undefined-field +vim.opt.rtp:prepend(lazypath) + +-- vim: ts=2 sts=2 sw=2 et diff --git a/_home/private_dot_config/nvim/lua/lazy-plugins.lua b/_home/private_dot_config/nvim/lua/lazy-plugins.lua new file mode 100644 index 0000000..f601d39 --- /dev/null +++ b/_home/private_dot_config/nvim/lua/lazy-plugins.lua @@ -0,0 +1,90 @@ +-- [[ Configure and install plugins ]] +-- +-- To check the current status of your plugins, run +-- :Lazy +-- +-- You can press `?` in this menu for help. Use `:q` to close the window +-- +-- To update plugins you can run +-- :Lazy update +-- +-- NOTE: Here is where you install your plugins. +require('lazy').setup({ + -- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link). + 'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically + + -- NOTE: Plugins can also be added by using a table, + -- with the first argument being the link and the following + -- keys can be used to configure plugin behavior/loading/etc. + -- + -- Use `opts = {}` to force a plugin to be loaded. + -- + + + -- modular approach: using `require 'path/name'` will + -- include a plugin definition from file lua/path/name.lua + + require 'kickstart/plugins/gitsigns', + + require 'kickstart/plugins/which-key', + + require 'kickstart/plugins/telescope', + + require 'kickstart/plugins/lspconfig', + + require 'kickstart/plugins/conform', + + require 'kickstart/plugins/cmp', + + require 'kickstart/plugins/tokyonight', + + require 'kickstart/plugins/todo-comments', + + require 'kickstart/plugins/mini', + + require 'kickstart/plugins/treesitter', + + -- The following two comments only work if you have downloaded the kickstart repo, not just copy pasted the + -- init.lua. If you want these files, they are in the repository, so you can just download them and + -- place them in the correct locations. + + -- NOTE: Next step on your Neovim journey: Add/Configure additional plugins for Kickstart + -- + -- Here are some example plugins that I've included in the Kickstart repository. + -- Uncomment any of the lines below to enable them (you will need to restart nvim). + -- + -- require 'kickstart.plugins.debug', + -- require 'kickstart.plugins.indent_line', + -- require 'kickstart.plugins.lint', + -- require 'kickstart.plugins.autopairs', + -- require 'kickstart.plugins.neo-tree', + + -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` + -- This is the easiest way to modularize your config. + -- + -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. + -- For additional information, see `:help lazy.nvim-lazy.nvim-structuring-your-plugins` + -- { import = 'custom.plugins' }, +}, { + ui = { + -- If you are using a Nerd Font: set icons to an empty table which will use the + -- default lazy.nvim defined Nerd Font icons, otherwise define a unicode icons table + icons = vim.g.have_nerd_font and {} or { + cmd = 'โŒ˜', + config = '๐Ÿ› ', + event = '๐Ÿ“…', + ft = '๐Ÿ“‚', + init = 'โš™', + keys = '๐Ÿ—', + plugin = '๐Ÿ”Œ', + runtime = '๐Ÿ’ป', + require = '๐ŸŒ™', + source = '๐Ÿ“„', + start = '๐Ÿš€', + task = '๐Ÿ“Œ', + lazy = '๐Ÿ’ค ', + }, + }, +}) + +-- vim: ts=2 sts=2 sw=2 et diff --git a/_home/private_dot_config/nvim/lua/options.lua b/_home/private_dot_config/nvim/lua/options.lua new file mode 100644 index 0000000..94ee2ed --- /dev/null +++ b/_home/private_dot_config/nvim/lua/options.lua @@ -0,0 +1,65 @@ +-- [[ Setting options ]] +-- See `:help vim.opt` +-- NOTE: You can change these options as you wish! +-- For more options, you can see `:help option-list` + +-- Make line numbers default +vim.opt.number = true +-- You can also add relative line numbers, to help with jumping. +-- Experiment for yourself to see if you like it! +-- 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. +-- Schedule the setting after `UiEnter` because it can increase startup-time. +-- Remove this option if you want your OS clipboard to remain independent. +-- See `:help 'clipboard'` +vim.schedule(function() + vim.opt.clipboard = 'unnamedplus' +end) + +-- 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 + +-- Decrease mapped sequence wait time +-- Displays which-key popup sooner +vim.opt.timeoutlen = 300 + +-- Configure how new splits should be opened +vim.opt.splitright = true +vim.opt.splitbelow = true + +-- Sets how neovim will display certain whitespace characters in the editor. +-- See `:help 'list'` +-- and `:help 'listchars'` +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 + +-- vim: ts=2 sts=2 sw=2 et