diff --git a/init.lua b/init.lua index 560c183337e..8254bb2697f 100644 --- a/init.lua +++ b/init.lua @@ -43,19 +43,6 @@ What is Kickstart? 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. @@ -99,7 +86,7 @@ do vim.g.maplocalleader = ' ' -- Set to true if you have a Nerd Font installed and selected in the terminal - vim.g.have_nerd_font = false + vim.g.have_nerd_font = true -- [[ Setting options ]] -- See `:help vim.o` @@ -1014,11 +1001,11 @@ do -- 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' + require 'kickstart.plugins.debug' + require 'kickstart.plugins.indent_line' + require 'kickstart.plugins.lint' + require 'kickstart.plugins.autopairs' + require 'kickstart.plugins.neo-tree' -- NOTE: You can add your own plugins, configuration, etc. in `lua/custom/plugins/*.lua`. -- diff --git a/lazy-lock.json b/lazy-lock.json new file mode 100644 index 00000000000..e2fa292d6ee --- /dev/null +++ b/lazy-lock.json @@ -0,0 +1,40 @@ +{ + "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, + "LuaSnip": { "branch": "master", "commit": "21e9fecfc07fb2cd707b6c7c3fa148550a34d053" }, + "cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" }, + "cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" }, + "cmp-vsnip": { "branch": "main", "commit": "989a8a73c44e926199bfd05fa7a516d51f2d2752" }, + "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, + "conform.nvim": { "branch": "master", "commit": "4993e07fac6679d0a5005aa7499e0bad2bd39f19" }, + "fidget.nvim": { "branch": "main", "commit": "9e0201673e08e997e7cf52afca5565c70bd117f3" }, + "gitsigns.nvim": { "branch": "main", "commit": "fd780920613e541cbdfac41bf711583ed49f9249" }, + "indent-blankline.nvim": { "branch": "master", "commit": "f1e186e44d3b7f9ae918008e2c28ce37c6023d2d" }, + "lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "2304ff65ecc8cb2afc2484de3e2ed9a407edf0b9" }, + "mason-nvim-dap.nvim": { "branch": "main", "commit": "9a10e096703966335bd5c46c8c875d5b0690dade" }, + "mason-tool-installer.nvim": { "branch": "main", "commit": "443f1ef8b5e6bf47045cb2217b6f748a223cf7dc" }, + "mason.nvim": { "branch": "main", "commit": "2a6940af80375532e5e9e7c1f2fc6319a1b7a69d" }, + "mini.nvim": { "branch": "main", "commit": "69b7433355664cf76898eb86a12a019f39bd86d1" }, + "neo-tree.nvim": { "branch": "main", "commit": "f3f3bf73414e400cf9fc13fda50f00404a8f8ab1" }, + "neodev.nvim": { "branch": "main", "commit": "46aa467dca16cf3dfe27098042402066d2ae242d" }, + "nui.nvim": { "branch": "main", "commit": "10fc361835c856ba4233ef5ea135b919bf3dce97" }, + "nvim-autopairs": { "branch": "master", "commit": "3172f40c16563db871a58f20d205c710ad782311" }, + "nvim-cmp": { "branch": "main", "commit": "2ffe79f1f021def8dd1fcd81deb16f1bb0d989f3" }, + "nvim-dap": { "branch": "master", "commit": "cfa2d58f4537aca6ca83e2de1a0d9f1491121264" }, + "nvim-dap-go": { "branch": "main", "commit": "b4421153ead5d726603b02743ea40cf26a51ed5f" }, + "nvim-dap-ui": { "branch": "master", "commit": "cc9dd33aade7f20bae414d0cba163bc60d4d4b43" }, + "nvim-lint": { "branch": "master", "commit": "54c5f839f8b3e3e69afbf2e074be8ac7e5b793b9" }, + "nvim-lspconfig": { "branch": "master", "commit": "ececa531ecae813422697b5ef627a11cc964c2a7" }, + "nvim-nio": { "branch": "master", "commit": "edcc181a875301dd21840189aa2f2f9ad69fc172" }, + "nvim-treesitter": { "branch": "master", "commit": "cf12346a3414fa1b06af75c79faebe7f76df080a" }, + "nvim-web-devicons": { "branch": "master", "commit": "ec309a0eaff6ea967e58c275996155ab5c16938d" }, + "plenary.nvim": { "branch": "master", "commit": "74b06c6c75e4eeb3108ec01852001636d85a932b" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "b25b749b9db64d375d782094e2b9dce53ad53a40" }, + "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, + "telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, + "todo-comments.nvim": { "branch": "main", "commit": "31e3c38ce9b29781e4422fc0322eb0a21f4e8668" }, + "tokyonight.nvim": { "branch": "main", "commit": "cdc07ac78467a233fd62c493de29a17e0cf2b2b6" }, + "vim-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" }, + "which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" } +} diff --git a/lua/custom/plugins/auto-open-neo-tree.lua b/lua/custom/plugins/auto-open-neo-tree.lua new file mode 100644 index 00000000000..177c53fb274 --- /dev/null +++ b/lua/custom/plugins/auto-open-neo-tree.lua @@ -0,0 +1,26 @@ +return { + { + 'nvim-neo-tree/neo-tree.nvim', + init = function() + -- Mirror your current behavior: open once on first BufWinEnter + local group = vim.api.nvim_create_augroup('neotree_autoopen', { clear = true }) + vim.api.nvim_create_autocmd('BufWinEnter', { + group = group, + desc = 'Open Neo-tree by default (first window only)', + callback = function(args) + if vim.g.neotree_opened then + return + end + -- Avoid re-entering when the window *is* Neo-tree or other side UIs + local ft = vim.bo[args.buf].filetype + if ft == 'neo-tree' or ft == 'lazy' or ft == 'starter' then + return + end + + vim.g.neotree_opened = true + vim.cmd 'Neotree show' + end, + }) + end, + }, +} diff --git a/lua/custom/plugins/autocmds.lua b/lua/custom/plugins/autocmds.lua new file mode 100644 index 00000000000..77aa00815d0 --- /dev/null +++ b/lua/custom/plugins/autocmds.lua @@ -0,0 +1,14 @@ +local function augroup(name) + return vim.api.nvim_create_augroup('lazyvim_' .. name, { clear = true }) +end + +vim.api.nvim_create_autocmd('VimEnter', { + group = augroup 'autoupdate', + callback = function() + require('lazy').update { + show = false, + } + end, +}) + +return {} diff --git a/lua/custom/plugins/autocomplete.lua b/lua/custom/plugins/autocomplete.lua new file mode 100644 index 00000000000..f4ec957f041 --- /dev/null +++ b/lua/custom/plugins/autocomplete.lua @@ -0,0 +1,122 @@ +return { -- Autocompletion + 'hrsh7th/nvim-cmp', + event = 'InsertEnter', + dependencies = { + -- Snippet Engine & its associated nvim-cmp source + { + 'L3MON4D3/LuaSnip', + build = (function() + -- Build Step is needed for regex support in snippets. + -- This step is not supported in many windows environments. + -- Remove the below condition to re-enable on windows. + if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then + return + end + return 'make install_jsregexp' + end)(), + dependencies = { + -- `friendly-snippets` contains a variety of premade snippets. + -- See the README about individual language/framework/plugin snippets: + -- https://github.com/rafamadriz/friendly-snippets + -- { + -- 'rafamadriz/friendly-snippets', + -- config = function() + -- require('luasnip.loaders.from_vscode').lazy_load() + -- end, + -- }, + }, + }, + 'saadparwaiz1/cmp_luasnip', + + -- Adds other completion capabilities. + -- nvim-cmp does not ship with all sources by default. They are split + -- into multiple repos for maintenance purposes. + 'hrsh7th/cmp-nvim-lsp', + 'hrsh7th/cmp-buffer', + 'hrsh7th/cmp-vsnip', + 'hrsh7th/cmp-path', + }, + config = function() + -- See `:help cmp` + 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' }, + + -- For an understanding of why these mappings were + -- chosen, you will need to read `:help ins-completion` + -- + -- 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), + + -- Accept ([y]es) the completion. + -- This will auto-import if your LSP supports it. + -- This will expand snippets if the LSP sent a snippet. + --[''] = cmp.mapping.confirm { select = true }, + + -- If you prefer more traditional completion keymaps, + -- you can uncomment the following lines + [''] = cmp.mapping.confirm { select = true }, + [''] = cmp.mapping.select_next_item(), + [''] = cmp.mapping.select_prev_item(), + + -- Manually trigger a completion from nvim-cmp. + -- Generally you don't need this, because nvim-cmp will display + -- completions whenever it has completion options available. + [''] = 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' }), + + -- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see: + -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps + + -- [''] = 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' }), + }, + sources = { + { name = 'nvim_lsp' }, + { name = 'luasnip' }, + { name = 'path' }, + }, + } + end, +} diff --git a/lua/custom/plugins/lazy-ssh.lua b/lua/custom/plugins/lazy-ssh.lua new file mode 100644 index 00000000000..5dab5d18341 --- /dev/null +++ b/lua/custom/plugins/lazy-ssh.lua @@ -0,0 +1,6 @@ +-- Force Lazy.nvim to use SSH for GitHub (avoids HTTPS credential prompts) +local ok, Config = pcall(require, 'lazy.core.config') +if ok and Config.options and Config.options.git then + Config.options.git.url_format = 'git@github.com:%s.git' +end +return {} diff --git a/lua/custom/plugins/terraform.lua b/lua/custom/plugins/terraform.lua new file mode 100644 index 00000000000..5d03de08202 --- /dev/null +++ b/lua/custom/plugins/terraform.lua @@ -0,0 +1,81 @@ +return { + -- 1) Treesitter: add terraform + hcl parsers + { + 'nvim-treesitter/nvim-treesitter', + opts = function(_, opts) + opts = opts or {} + opts.ensure_installed = opts.ensure_installed or {} + for _, lang in ipairs { 'terraform', 'hcl' } do + if not vim.tbl_contains(opts.ensure_installed, lang) then + table.insert(opts.ensure_installed, lang) + end + end + return opts + end, + }, + + -- 2) LSP: extend Kickstart's lsp plugin (no direct lspconfig.setup) + { + 'neovim/nvim-lspconfig', + opts = function(_, opts) + opts = opts or {} + opts.servers = opts.servers or {} + -- Kickstart will call lspconfig for you using this table + opts.servers.terraformls = { + filetypes = { 'terraform', 'terraform-vars', 'hcl' }, + } + return opts + end, + }, + { + 'williamboman/mason-lspconfig.nvim', + opts = function(_, opts) + opts = opts or {} + opts.ensure_installed = opts.ensure_installed or {} + if not vim.tbl_contains(opts.ensure_installed, 'terraformls') then + table.insert(opts.ensure_installed, 'terraformls') + end + return opts + end, + }, + + -- 3) Formatting: terraform fmt via conform.nvim + { + 'stevearc/conform.nvim', + opts = function(_, opts) + opts = opts or {} + opts.formatters_by_ft = opts.formatters_by_ft or {} + opts.formatters_by_ft.terraform = { 'terraform_fmt' } + opts.formatters_by_ft['terraform-vars'] = { 'terraform_fmt' } + opts.formatters_by_ft.hcl = { 'terraform_fmt' } + return opts + end, + }, + + -- 4) Linting: tflint via nvim-lint (fixed require + callback) + { + 'mfussenegger/nvim-lint', + config = function() + local lint = require 'lint' + lint.linters_by_ft = lint.linters_by_ft or {} + lint.linters_by_ft.terraform = { 'tflint' } + lint.linters_by_ft['terraform-vars'] = { 'tflint' } + + vim.api.nvim_create_autocmd({ 'BufWritePost', 'BufEnter', 'InsertLeave' }, { + callback = function() + require('lint').try_lint() + end, + }) + end, + }, + + -- (Optional) 5) Auto-install CLI tools like tflint + { + 'WhoIsSethDaniel/mason-tool-installer.nvim', + opts = { + ensure_installed = { 'tflint', 'terraform-ls' }, -- terraform-ls is harmless if already installed + run_on_start = true, + auto_update = false, + }, + }, +} diff --git a/lua/custom/plugins/venv-selector.lua b/lua/custom/plugins/venv-selector.lua new file mode 100644 index 00000000000..29244dcd6f7 --- /dev/null +++ b/lua/custom/plugins/venv-selector.lua @@ -0,0 +1,17 @@ +return { + -- 'linux-cultist/venv-selector.nvim', + -- dependencies = { 'neovim/nvim-lspconfig', 'nvim-telescope/telescope.nvim', 'mfussenegger/nvim-dap-python' }, + -- opts = { + -- name = 'venv', + -- -- Your options go here + -- -- name = "venv", + -- -- auto_refresh = false + -- }, + -- event = 'VeryLazy', -- Optional: needed only if you want to type `:VenvSelect` without a keymapping + -- keys = { + -- -- Keymap to open VenvSelector to pick a venv. + -- { 'vs', 'VenvSelect' }, + -- -- Keymap to retrieve the venv from a cache (the one previously used for the same project directory). + -- { 'vc', 'VenvSelectCached' }, + -- }, +}