From 5edfba8462c00c42a093ab22987112f1e3c09772 Mon Sep 17 00:00:00 2001 From: Michael Beasley Date: Tue, 29 Oct 2024 14:49:48 -0500 Subject: [PATCH 01/16] pretty stable commit while things are pretty much working how I like --- init.lua | 317 ++++++++++++++++++----------- lua/custom/plugins/barbar.lua | 19 ++ lua/custom/plugins/init.lua | 5 - lua/custom/plugins/lazygit.lua | 20 ++ lua/custom/plugins/persistence.lua | 19 ++ lua/kickstart/plugins/lint.lua | 55 ----- lua/kickstart/plugins/neo-tree.lua | 4 +- 7 files changed, 254 insertions(+), 185 deletions(-) create mode 100644 lua/custom/plugins/barbar.lua delete mode 100644 lua/custom/plugins/init.lua create mode 100644 lua/custom/plugins/lazygit.lua create mode 100644 lua/custom/plugins/persistence.lua delete mode 100644 lua/kickstart/plugins/lint.lua diff --git a/init.lua b/init.lua index ea86b792abe..5f4454c8078 100644 --- a/init.lua +++ b/init.lua @@ -1,89 +1,3 @@ ---[[ - -===================================================================== -==================== 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) @@ -91,7 +5,7 @@ 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 +vim.g.have_nerd_font = true -- [[ Setting options ]] -- See `:help vim.opt` @@ -118,6 +32,9 @@ vim.schedule(function() vim.opt.clipboard = 'unnamedplus' end) +-- Set syntax highlighting for .hujson to json +vim.cmd [[au BufNewFile,BufRead *.hujson setf json]] + -- Enable break indent vim.opt.breakindent = true @@ -162,8 +79,27 @@ vim.opt.scrolloff = 10 -- Clear highlights on search when pressing in normal mode -- See `:help hlsearch` + vim.keymap.set('n', '', 'nohlsearch') +-- Buffer keymaps +local map = vim.keymap.set +map('n', 'bn', 'enew', { desc = '[B]uffer [N]ew' }) +map('n', '', 'BufferPrevious', { desc = 'Cycle Previous Buffer' }) +map('n', '', 'BufferNext', { desc = 'Cycle Next Buffer' }) +map('n', 'bN', 'BufferOrderByName', { desc = '[B]uffer Order by [N]ame' }) +map('n', 'bc', 'BufferClose!', { desc = '[B]uffer [C]lose' }) +map('n', 'br', 'BufferRestore', { desc = '[B]uffer [R]estore' }) +map('n', 'tc', 'gcc', { desc = '[T]oggle [C]omment', remap = true }) +map('v', 'tc', 'gc', { desc = '[T]oggle [C]omment', remap = true }) +map('n', ';', ':', { desc = 'CMD enter command mode' }) + +-- Floaterm keymaps +map('n', 'tt', 'FloatermToggle', { desc = '[T]erminal [T]toggle' }) +map('n', 'tn', 'FloatermNew', { desc = '[T]erminal [New]' }) +map('n', 'tN', 'FloatermNext', { desc = 'Cycle Next Terminal' }) +vim.g.floaterm_title = 'Terminal ($1/$2)' + -- Diagnostic keymaps vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' }) @@ -204,6 +140,15 @@ vim.api.nvim_create_autocmd('TextYankPost', { end, }) +-- Enable concealing characters on certain filetypes +-- For markdown this renders inline links, etc +vim.api.nvim_create_autocmd('FileType', { + pattern = { 'markdown' }, + callback = function() + vim.opt.conceallevel = 3 + end, +}) + -- [[ 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' @@ -228,6 +173,49 @@ vim.opt.rtp:prepend(lazypath) -- -- NOTE: Here is where you install your plugins. require('lazy').setup({ + -- Automatically check for updates + checker = { + enabled = true, + notify = true, + }, + -- Enable caching + performance = { + cache = { + enabled = true, + }, + -- Disable some rtp plugins for performance + rtp = { + disabled_plugins = { + '2html_plugin', + 'tohtml', + 'getscript', + 'getscriptPlugin', + 'gzip', + 'logipat', + 'netrw', + 'netrwPlugin', + 'netrwSettings', + 'netrwFileHandlers', + 'matchit', + 'tar', + 'tarPlugin', + 'rrhelper', + 'spellfile_plugin', + 'vimball', + 'vimballPlugin', + 'zip', + 'zipPlugin', + 'tutor', + 'rplugin', + 'syntax', + 'synmenu', + 'optwin', + 'compiler', + 'bugreport', + 'ftplugin', + }, + }, + }, -- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link). 'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically @@ -243,18 +231,18 @@ require('lazy').setup({ -- require('gitsigns').setup({ ... }) -- -- See `:help gitsigns` to understand what the configuration keys do - { -- Adds git related signs to the gutter, as well as utilities for managing changes - 'lewis6991/gitsigns.nvim', - opts = { - signs = { - add = { text = '+' }, - change = { text = '~' }, - delete = { text = '_' }, - topdelete = { text = '‾' }, - changedelete = { text = '~' }, - }, - }, - }, + -- { -- Adds git related signs to the gutter, as well as utilities for managing changes + -- 'lewis6991/gitsigns.nvim', + -- opts = { + -- signs = { + -- add = { text = '+' }, + -- change = { text = '~' }, + -- delete = { text = '_' }, + -- topdelete = { text = '‾' }, + -- changedelete = { text = '~' }, + -- }, + -- }, + -- }, -- NOTE: Plugins can also be configured to run Lua code when they are loaded. -- @@ -270,6 +258,7 @@ require('lazy').setup({ -- Then, because we use the `config` key, the configuration only runs -- after the plugin has been loaded: -- config = function() ... end + { 'voldikss/vim-floaterm' }, { -- Useful plugin to show you pending keybinds. 'folke/which-key.nvim', @@ -317,9 +306,11 @@ require('lazy').setup({ { 'c', group = '[C]ode', mode = { 'n', 'x' } }, { 'd', group = '[D]ocument' }, { 'r', group = '[R]ename' }, + { 'g', group = '[G]it' }, { 's', group = '[S]earch' }, { 'w', group = '[W]orkspace' }, { 't', group = '[T]oggle' }, + { 'b', group = '[B]uffer' }, { 'h', group = 'Git [H]unk', mode = { 'n', 'v' } }, }, }, @@ -382,11 +373,12 @@ require('lazy').setup({ -- You can put your default mappings / updates / etc. in here -- All the info you're looking for is in `:help telescope.setup()` -- - -- defaults = { - -- mappings = { - -- i = { [''] = 'to_fuzzy_refine' }, - -- }, - -- }, + defaults = { + layout_config = { + prompt_position = 'top', + }, + sorting_strategy = 'ascending', + }, -- pickers = {} extensions = { ['ui-select'] = { @@ -401,6 +393,9 @@ require('lazy').setup({ -- See `:help telescope.builtin` local builtin = require 'telescope.builtin' + vim.keymap.set('n', 'gs', builtin.git_status, { desc = '[G]it [S]tatus' }) + vim.keymap.set('n', 'gc', builtin.git_commits, { desc = '[G]it [C]ommits' }) + vim.keymap.set('n', 'gb', builtin.git_branches, { desc = '[G]it [B]ranches' }) 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' }) @@ -606,8 +601,56 @@ require('lazy').setup({ -- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/ local servers = { -- clangd = {}, - -- gopls = {}, - -- pyright = {}, + gopls = {}, + jsonls = {}, + ansiblels = { + settings = { + ansible = { + validation = { + enabled = true, + lint = { + enabled = true, + }, + }, + }, + }, + }, + -- pyright { + bashls = {}, + terraformls = {}, + yamlls = { + settings = { + yaml = { + keyOrdering = false, + }, + }, + }, + pylsp = { + settings = { + pylsp = { + plugins = { + -- Formatters + autopep8 = { enabled = true }, + black = { enabled = false }, + pyls_isort = { enabled = true }, + yapf = { enabled = false }, + -- Linters + pylint = { enabled = false }, + pyflakes = { enabled = true }, + pycodestyle = { + ignore = { 'W391' }, + maxLineLength = 130, + }, + -- Complexity Checkers + mccabe = { enabled = true }, + -- Type Checkers + pylsp_mypy = { enabled = true }, + -- Auto-completers + jedi_completion = { fuzzy = true }, + }, + }, + }, + }, -- rust_analyzer = {}, -- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs -- @@ -647,6 +690,11 @@ require('lazy').setup({ local ensure_installed = vim.tbl_keys(servers or {}) vim.list_extend(ensure_installed, { 'stylua', -- Used to format Lua code + 'python-lsp-server', + 'terraform-ls', + 'bash-language-server', + 'autopep8', + 'json-lsp', }) require('mason-tool-installer').setup { ensure_installed = ensure_installed } @@ -699,6 +747,7 @@ require('lazy').setup({ end, formatters_by_ft = { lua = { 'stylua' }, + python = { 'autopep8' }, -- Conform can also run multiple formatters sequentially -- python = { "isort", "black" }, -- @@ -728,12 +777,12 @@ require('lazy').setup({ -- `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, - -- }, + { + 'rafamadriz/friendly-snippets', + config = function() + require('luasnip.loaders.from_vscode').lazy_load() + end, + }, }, }, 'saadparwaiz1/cmp_luasnip', @@ -779,9 +828,9 @@ require('lazy').setup({ -- 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(), + [''] = 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 @@ -829,13 +878,18 @@ require('lazy').setup({ -- change the command in the config to whatever the name of that colorscheme is. -- -- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`. - 'folke/tokyonight.nvim', - priority = 1000, -- Make sure to load this before all the other start plugins. + 'projekt0n/github-nvim-theme', + name = 'github-theme', + lazy = false, + priority = 1000, + config = function() + require('github-theme').setup {} + end, init = function() -- Load the colorscheme here. -- Like many other themes, this one has different styles, and you could load -- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'. - vim.cmd.colorscheme 'tokyonight-night' + vim.cmd.colorscheme 'github_dark' -- You can configure highlights by doing something like: vim.cmd.hi 'Comment gui=none' @@ -888,7 +942,24 @@ require('lazy').setup({ main = 'nvim-treesitter.configs', -- Sets main module to use for opts -- [[ Configure Treesitter ]] See `:help nvim-treesitter` opts = { - ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' }, + ensure_installed = { + 'bash', + 'diff', + 'lua', + 'luadoc', + 'markdown', + 'markdown_inline', + 'vim', + 'vimdoc', + 'hcl', + 'python', + 'go', + 'yaml', + 'markdown', + 'markdown_inline', + 'dockerfile', + 'toml', + }, -- Autoinstall languages that are not installed auto_install = true, highlight = { @@ -920,16 +991,16 @@ require('lazy').setup({ -- 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.gitsigns', -- adds gitsigns recommend keymaps + require 'kickstart.plugins.autopairs', + require 'kickstart.plugins.neo-tree', + require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps -- 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' }, + { import = 'custom.plugins' }, }, { ui = { -- If you are using a Nerd Font: set icons to an empty table which will use the diff --git a/lua/custom/plugins/barbar.lua b/lua/custom/plugins/barbar.lua new file mode 100644 index 00000000000..a484adea37f --- /dev/null +++ b/lua/custom/plugins/barbar.lua @@ -0,0 +1,19 @@ +return { + { + 'romgrk/barbar.nvim', + dependencies = { + 'lewis6991/gitsigns.nvim', + 'nvim-tree/nvim-web-devicons', + }, + init = function() + vim.g.barbar_auto_setup = false + end, + opts = { + animation = true, + insert_at_start = true, + icons = {}, + }, + version = '^1.0.0', + }, + require('gitsigns').setup {}, +} diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua deleted file mode 100644 index be0eb9d8d7a..00000000000 --- a/lua/custom/plugins/init.lua +++ /dev/null @@ -1,5 +0,0 @@ --- 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/custom/plugins/lazygit.lua b/lua/custom/plugins/lazygit.lua new file mode 100644 index 00000000000..0794409bfdb --- /dev/null +++ b/lua/custom/plugins/lazygit.lua @@ -0,0 +1,20 @@ +return { + 'kdheepak/lazygit.nvim', + lazy = true, + cmd = { + 'LazyGit', + 'LazyGitConfig', + 'LazyGitCurrentFile', + 'LazyGitFilter', + 'LazyGitFilterCurrentFile', + }, + -- optional for floating window border decoration + dependencies = { + 'nvim-lua/plenary.nvim', + }, + -- setting the keybinding for LazyGit with 'keys' is recommended in + -- order to load the plugin when the command is run for the first time + keys = { + { 'lg', 'LazyGit', desc = '[L]azy[G]it' }, + }, +} diff --git a/lua/custom/plugins/persistence.lua b/lua/custom/plugins/persistence.lua new file mode 100644 index 00000000000..82ea737c784 --- /dev/null +++ b/lua/custom/plugins/persistence.lua @@ -0,0 +1,19 @@ +return { + -- Session management. This saves your session in the background, + -- keeping track of open buffers, window arrangement, and more. + -- You can restore sessions when returning through the dashboard. + { + 'folke/persistence.nvim', + event = 'BufReadPre', + opts = {}, + -- stylua: ignore + keys = { + { "sS", function() require("persistence").select() end,desc = "[S]earch Previous [S]essions" }, + { "sR", function() require("persistence").load({ last = true }) end, desc = "Restore Last [S]ession" }, + { "sD", function() require("persistence").stop() end, desc = "Don't Save Current [S]ession" }, + }, + }, + + -- library used by other plugins + { 'nvim-lua/plenary.nvim', lazy = true }, +} diff --git a/lua/kickstart/plugins/lint.lua b/lua/kickstart/plugins/lint.lua deleted file mode 100644 index ca9bc237904..00000000000 --- a/lua/kickstart/plugins/lint.lua +++ /dev/null @@ -1,55 +0,0 @@ -return { - - { -- Linting - 'mfussenegger/nvim-lint', - event = { 'BufReadPre', 'BufNewFile' }, - config = function() - local lint = require 'lint' - lint.linters_by_ft = { - markdown = { 'markdownlint' }, - } - - -- 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() - lint.try_lint() - end, - }) - end, - }, -} diff --git a/lua/kickstart/plugins/neo-tree.lua b/lua/kickstart/plugins/neo-tree.lua index bd4422695aa..dd128bf2265 100644 --- a/lua/kickstart/plugins/neo-tree.lua +++ b/lua/kickstart/plugins/neo-tree.lua @@ -11,13 +11,13 @@ return { }, cmd = 'Neotree', keys = { - { '\\', ':Neotree reveal', desc = 'NeoTree reveal', silent = true }, + { 'e', ':Neotree reveal', desc = '[N]eoTree reveal', silent = true }, }, opts = { filesystem = { window = { mappings = { - ['\\'] = 'close_window', + ['e'] = 'close_window', }, }, }, From 0532b540ca2a3f8687a2f34151c67e49a0130895 Mon Sep 17 00:00:00 2001 From: Michael Beasley Date: Tue, 29 Oct 2024 15:29:02 -0500 Subject: [PATCH 02/16] remove empty icon table --- lua/custom/plugins/barbar.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/lua/custom/plugins/barbar.lua b/lua/custom/plugins/barbar.lua index a484adea37f..d005c7e796e 100644 --- a/lua/custom/plugins/barbar.lua +++ b/lua/custom/plugins/barbar.lua @@ -11,7 +11,6 @@ return { opts = { animation = true, insert_at_start = true, - icons = {}, }, version = '^1.0.0', }, From a6d2749e1922f6ab66ae32f99818ec1f800a0918 Mon Sep 17 00:00:00 2001 From: Michael Beasley Date: Tue, 29 Oct 2024 16:07:16 -0500 Subject: [PATCH 03/16] swap statuslines --- init.lua | 22 +++++++++++----------- lua/custom/plugins/lualine.lua | 15 +++++++++++++++ 2 files changed, 26 insertions(+), 11 deletions(-) create mode 100644 lua/custom/plugins/lualine.lua diff --git a/init.lua b/init.lua index 5f4454c8078..4f22269c2ba 100644 --- a/init.lua +++ b/init.lua @@ -920,17 +920,17 @@ require('lazy').setup({ -- Simple and easy statusline. -- You could remove this setup call if you don't like it, -- and try some other statusline plugin - local statusline = require 'mini.statusline' - -- set use_icons to true if you have a Nerd Font - statusline.setup { use_icons = vim.g.have_nerd_font } - - -- You can configure sections in the statusline by overriding their - -- default behavior. For example, here we set the section for - -- cursor location to LINE:COLUMN - ---@diagnostic disable-next-line: duplicate-set-field - statusline.section_location = function() - return '%2l:%-2v' - end + -- local statusline = require 'mini.statusline' + -- -- set use_icons to true if you have a Nerd Font + -- statusline.setup { use_icons = vim.g.have_nerd_font } + -- + -- -- You can configure sections in the statusline by overriding their + -- -- default behavior. For example, here we set the section for + -- -- cursor location to LINE:COLUMN + -- ---@diagnostic disable-next-line: duplicate-set-field + -- statusline.section_location = function() + -- return '%2l:%-2v' + -- end -- ... and there is more! -- Check out: https://github.com/echasnovski/mini.nvim diff --git a/lua/custom/plugins/lualine.lua b/lua/custom/plugins/lualine.lua new file mode 100644 index 00000000000..bb8f80ad74d --- /dev/null +++ b/lua/custom/plugins/lualine.lua @@ -0,0 +1,15 @@ +return { + -- Use lualine instead of mini.statusline + { + 'nvim-lualine/lualine.nvim', + dependencies = { 'nvim-tree/nvim-web-devicons' }, + config = function() + require('lualine').setup { + options = { + icons_enabled = true, + globalstatus = true, + }, + } + end, + }, +} From f02794d35a25ec44444dd5025f3bee0561687c54 Mon Sep 17 00:00:00 2001 From: Michael Beasley Date: Tue, 29 Oct 2024 19:14:59 -0500 Subject: [PATCH 04/16] add groovy lang server and shfmt --- init.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/init.lua b/init.lua index 4f22269c2ba..2acf71537a1 100644 --- a/init.lua +++ b/init.lua @@ -617,6 +617,7 @@ require('lazy').setup({ }, -- pyright { bashls = {}, + groovyls = {}, terraformls = {}, yamlls = { settings = { @@ -695,6 +696,7 @@ require('lazy').setup({ 'bash-language-server', 'autopep8', 'json-lsp', + 'groovy-language-server', }) require('mason-tool-installer').setup { ensure_installed = ensure_installed } @@ -748,6 +750,7 @@ require('lazy').setup({ formatters_by_ft = { lua = { 'stylua' }, python = { 'autopep8' }, + sh = { 'shfmt' }, -- Conform can also run multiple formatters sequentially -- python = { "isort", "black" }, -- From a750b1de18fe67150f446d504841f615c20c28ea Mon Sep 17 00:00:00 2001 From: Michael Beasley Date: Tue, 29 Oct 2024 19:39:04 -0500 Subject: [PATCH 05/16] fix tabs not shifting over when opening neo-tree --- lua/custom/plugins/barbar.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lua/custom/plugins/barbar.lua b/lua/custom/plugins/barbar.lua index d005c7e796e..bbe9c525dce 100644 --- a/lua/custom/plugins/barbar.lua +++ b/lua/custom/plugins/barbar.lua @@ -11,6 +11,9 @@ return { opts = { animation = true, insert_at_start = true, + sidebar_filetypes = { + ['neo-tree'] = { event = 'BufWipeout' }, + }, }, version = '^1.0.0', }, From 37bdc66ac955145877c03c84a84985961c7f3926 Mon Sep 17 00:00:00 2001 From: Michael Beasley Date: Tue, 29 Oct 2024 22:57:56 -0500 Subject: [PATCH 06/16] add cmd history support to telescope --- init.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 2acf71537a1..9e10c6162d7 100644 --- a/init.lua +++ b/init.lua @@ -92,7 +92,7 @@ map('n', 'bc', 'BufferClose!', { desc = '[B]uffer [C]lose' }) map('n', 'br', 'BufferRestore', { desc = '[B]uffer [R]estore' }) map('n', 'tc', 'gcc', { desc = '[T]oggle [C]omment', remap = true }) map('v', 'tc', 'gc', { desc = '[T]oggle [C]omment', remap = true }) -map('n', ';', ':', { desc = 'CMD enter command mode' }) +map('n', ';', 'Telescope cmdline', { desc = 'Telescope Cmd History' }) -- Floaterm keymaps map('n', 'tt', 'FloatermToggle', { desc = '[T]erminal [T]toggle' }) @@ -329,6 +329,7 @@ require('lazy').setup({ branch = '0.1.x', dependencies = { 'nvim-lua/plenary.nvim', + 'jonarrien/telescope-cmdline.nvim', { -- If encountering errors, see telescope-fzf-native README for installation instructions 'nvim-telescope/telescope-fzf-native.nvim', @@ -390,6 +391,7 @@ require('lazy').setup({ -- Enable Telescope extensions if they are installed pcall(require('telescope').load_extension, 'fzf') pcall(require('telescope').load_extension, 'ui-select') + pcall(require('telescope').load_extension, 'cmdline') -- See `:help telescope.builtin` local builtin = require 'telescope.builtin' From 0d6562c87c7e2568e55392787fc0137e4d4f1664 Mon Sep 17 00:00:00 2001 From: Michael Beasley Date: Thu, 31 Oct 2024 12:29:35 -0500 Subject: [PATCH 07/16] Update init.lua --- init.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/init.lua b/init.lua index 7df16af54df..3fb20cbdded 100644 --- a/init.lua +++ b/init.lua @@ -1020,7 +1020,6 @@ require('lazy').setup({ -- Or use telescope! -- In normal mode type `sh` then write `lazy.nvim-plugin` -- you can continue same window with `sr` which resumes last telescope search ->>>>>>> 2ba39c69736597b60f6033aa3f8526e7c28343d5 }, { ui = { -- If you are using a Nerd Font: set icons to an empty table which will use the From 16a0632e8e7e624c565a00be04e875924bd71225 Mon Sep 17 00:00:00 2001 From: Michael Beasley Date: Tue, 5 Nov 2024 12:24:19 -0600 Subject: [PATCH 08/16] add dashboard plugin --- lua/custom/plugins/dashboard.lua | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 lua/custom/plugins/dashboard.lua diff --git a/lua/custom/plugins/dashboard.lua b/lua/custom/plugins/dashboard.lua new file mode 100644 index 00000000000..cdf48a47705 --- /dev/null +++ b/lua/custom/plugins/dashboard.lua @@ -0,0 +1,19 @@ +return { + { + 'nvimdev/dashboard-nvim', + event = 'VimEnter', + config = function() + require('dashboard').setup { + theme = 'hyper', + config = { + week_header = { enable = true }, + footer = {}, + shortcut = { + { desc = '󰊳 Update Lazy', group = '@property', action = 'Lazy update', key = 'u' }, + }, + }, + } + end, + dependencies = { { 'nvim-tree/nvim-web-devicons' } }, + }, +} From 5852212a9d1ee5477264a4b4e4be8c0e098c46ef Mon Sep 17 00:00:00 2001 From: Michael Beasley Date: Tue, 12 Nov 2024 11:10:12 -0600 Subject: [PATCH 09/16] Add telescope zoxide extension and update dashboard plugin --- init.lua | 12 ++++++ lua/custom/plugins/dashboard.lua | 71 +++++++++++++++++++++++++++----- 2 files changed, 73 insertions(+), 10 deletions(-) diff --git a/init.lua b/init.lua index 3fb20cbdded..0428836daca 100644 --- a/init.lua +++ b/init.lua @@ -330,6 +330,7 @@ require('lazy').setup({ dependencies = { 'nvim-lua/plenary.nvim', 'jonarrien/telescope-cmdline.nvim', + 'jvgrootveld/telescope-zoxide', { -- If encountering errors, see telescope-fzf-native README for installation instructions 'nvim-telescope/telescope-fzf-native.nvim', @@ -385,6 +386,15 @@ require('lazy').setup({ ['ui-select'] = { require('telescope.themes').get_dropdown(), }, + zoxide = { + mappings = { + default = { + after_action = function(selection) + print('Update to (' .. selection.z_score .. ') ' .. selection.path) + end, + }, + }, + }, }, } @@ -392,6 +402,7 @@ require('lazy').setup({ pcall(require('telescope').load_extension, 'fzf') pcall(require('telescope').load_extension, 'ui-select') pcall(require('telescope').load_extension, 'cmdline') + pcall(require('telescope').load_extension, 'zoxide') -- See `:help telescope.builtin` local builtin = require 'telescope.builtin' @@ -408,6 +419,7 @@ require('lazy').setup({ 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' }) + vim.keymap.set('n', 'Z', require('telescope').extensions.zoxide.list, { desc = 'Open [Z]oxide' }) -- Slightly advanced example of overriding default behavior and theme vim.keymap.set('n', '/', function() diff --git a/lua/custom/plugins/dashboard.lua b/lua/custom/plugins/dashboard.lua index cdf48a47705..705a7754b2a 100644 --- a/lua/custom/plugins/dashboard.lua +++ b/lua/custom/plugins/dashboard.lua @@ -1,19 +1,70 @@ return { { 'nvimdev/dashboard-nvim', - event = 'VimEnter', - config = function() - require('dashboard').setup { - theme = 'hyper', + lazy = false, -- As https://github.com/nvimdev/dashboard-nvim/pull/450, dashboard-nvim shouldn't be lazy-loaded to properly handle stdin. + dependencies = { + { 'nvim-tree/nvim-web-devicons' }, + }, + opts = function() + local logo = [[ + ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗ + ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║ + ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║ + ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║ + ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║ + ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ + ]] + + logo = string.rep('\n', 8) .. logo .. '\n\n' + + local builtin = require 'telescope.builtin' + local opts = { + theme = 'doom', + hide = { + -- this is taken care of by lualine + -- enabling this messes up the actual laststatus setting after loading a file + statusline = false, + }, config = { - week_header = { enable = true }, - footer = {}, - shortcut = { - { desc = '󰊳 Update Lazy', group = '@property', action = 'Lazy update', key = 'u' }, - }, + header = vim.split(logo, '\n'), + -- stylua: ignore + center = { + { action = builtin.find_files, desc = " Find File", icon = " ", key = "f" }, + { action = "ene | startinsert", desc = " New File", icon = " ", key = "n" }, + { action = builtin.oldfiles, desc = " Recent Files", icon = " ", key = "r" }, + { action = builtin.live_grep, desc = " Find Text", icon = " ", key = "g" }, + { action = 'lua require("persistence").load()', desc = " Restore Session", icon = " ", key = "s" }, + { action = "Lazy", desc = " Lazy", icon = "󰒲 ", key = "l" }, + { action = "Mason", desc = " Mason", icon = "⌘ ", key = "m" }, + { action = function() vim.api.nvim_input("qa!") end, desc = " Quit", icon = " ", key = "q" }, + }, + footer = function() + local stats = require('lazy').stats() + local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100) + return { '⚡ Neovim loaded ' .. stats.loaded .. '/' .. stats.count .. ' plugins in ' .. ms .. 'ms' } + end, }, } + + for _, button in ipairs(opts.config.center) do + button.desc = button.desc .. string.rep(' ', 43 - #button.desc) + button.key_format = ' %s' + end + + -- open dashboard after closing lazy + if vim.o.filetype == 'lazy' then + vim.api.nvim_create_autocmd('WinClosed', { + pattern = tostring(vim.api.nvim_get_current_win()), + once = true, + callback = function() + vim.schedule(function() + vim.api.nvim_exec_autocmds('UIEnter', { group = 'dashboard' }) + end) + end, + }) + end + + return opts end, - dependencies = { { 'nvim-tree/nvim-web-devicons' } }, }, } From 8ae28dc332a9a4217f42ebaa1de81493132989cc Mon Sep 17 00:00:00 2001 From: Michael Beasley Date: Wed, 13 Nov 2024 11:20:59 -0600 Subject: [PATCH 10/16] add helm ls --- init.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/init.lua b/init.lua index 0428836daca..6b7f07df315 100644 --- a/init.lua +++ b/init.lua @@ -640,6 +640,7 @@ require('lazy').setup({ }, -- pyright { bashls = {}, + helm_ls = {}, groovyls = {}, terraformls = {}, yamlls = { @@ -717,6 +718,7 @@ require('lazy').setup({ 'python-lsp-server', 'terraform-ls', 'bash-language-server', + 'yaml-language-server', 'autopep8', 'json-lsp', 'groovy-language-server', From 41b8cafc9489ce74cf5ec5c0aeab65fc6b6ad239 Mon Sep 17 00:00:00 2001 From: Michael Beasley Date: Wed, 13 Nov 2024 12:03:55 -0600 Subject: [PATCH 11/16] disable yaml lang server because it breaks helm templates --- init.lua | 15 +++++++-------- lua/custom/plugins/filetype.lua | 7 +++++++ 2 files changed, 14 insertions(+), 8 deletions(-) create mode 100644 lua/custom/plugins/filetype.lua diff --git a/init.lua b/init.lua index 6b7f07df315..2344565fa18 100644 --- a/init.lua +++ b/init.lua @@ -212,7 +212,6 @@ require('lazy').setup({ 'optwin', 'compiler', 'bugreport', - 'ftplugin', }, }, }, @@ -643,13 +642,13 @@ require('lazy').setup({ helm_ls = {}, groovyls = {}, terraformls = {}, - yamlls = { - settings = { - yaml = { - keyOrdering = false, - }, - }, - }, + -- yamlls = { + -- settings = { + -- yaml = { + -- keyOrdering = false, + -- }, + -- }, + -- }, pylsp = { settings = { pylsp = { diff --git a/lua/custom/plugins/filetype.lua b/lua/custom/plugins/filetype.lua new file mode 100644 index 00000000000..e2f3370fe9b --- /dev/null +++ b/lua/custom/plugins/filetype.lua @@ -0,0 +1,7 @@ +return { + 'towolf/vim-helm', + lazy = false, + dependencies = { + 'crakkhead/ansible.nvim', + }, +} From 8b039cc83e8997f119c635f342ac30cde9a496a7 Mon Sep 17 00:00:00 2001 From: Michael Beasley Date: Mon, 18 Nov 2024 14:45:45 -0600 Subject: [PATCH 12/16] tabs -> spaces --- init.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 2344565fa18..0488da7dc87 100644 --- a/init.lua +++ b/init.lua @@ -59,6 +59,8 @@ vim.opt.timeoutlen = 300 vim.opt.splitright = true vim.opt.splitbelow = true +vim.g.expandtab = true + -- Sets how neovim will display certain whitespace characters in the editor. -- See `:help 'list'` -- and `:help 'listchars'` @@ -717,7 +719,6 @@ require('lazy').setup({ 'python-lsp-server', 'terraform-ls', 'bash-language-server', - 'yaml-language-server', 'autopep8', 'json-lsp', 'groovy-language-server', From 44859c24c82f7b9e17ceea1e4bca22afab5d5d97 Mon Sep 17 00:00:00 2001 From: Michael Beasley Date: Thu, 21 Nov 2024 16:15:23 -0600 Subject: [PATCH 13/16] config tabs --- init.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/init.lua b/init.lua index 0488da7dc87..30041794825 100644 --- a/init.lua +++ b/init.lua @@ -21,6 +21,12 @@ vim.opt.number = true -- Enable mouse mode, can be useful for resizing splits for example! vim.opt.mouse = 'a' +-- Use spaces instead of tabs +vim.opt.tabstop = 4 +vim.opt.softtabstop = 4 +vim.opt.shiftwidth = 4 +vim.opt.expandtab = true + -- Don't show the mode, since it's already in the status line vim.opt.showmode = false From d3481db750ea17372b16a1f8697015ffd119cf4a Mon Sep 17 00:00:00 2001 From: Michael Beasley Date: Fri, 21 Mar 2025 09:50:05 -0800 Subject: [PATCH 14/16] add k8s utils --- .pre-commit-config.yaml | 35 +++++++++++++++++++++++++++++++ init.lua | 14 +++++++++++++ lua/custom/plugins/kube-utils.lua | 11 ++++++++++ 3 files changed, 60 insertions(+) create mode 100644 .pre-commit-config.yaml create mode 100644 lua/custom/plugins/kube-utils.lua diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000000..3e72b6e9630 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,35 @@ +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v5.0.0 + hooks: + - id: trailing-whitespace + - id: check-added-large-files + - id: end-of-file-fixer +- repo: https://github.com/hhatto/autopep8 + rev: 'v2.3.2' + hooks: + - id: autopep8 +- repo: https://github.com/gitleaks/gitleaks.git + rev: 'v8.24.0' + hooks: + - id: gitleaks +- repo: https://github.com/koalaman/shellcheck-precommit + rev: v0.10.0 + hooks: + - id: shellcheck + exclude: .*jenkins-slave$ +- repo: https://github.com/hadolint/hadolint + rev: v2.13.1-beta + hooks: + - id: hadolint-docker + args: + - --ignore=DL3015 # Ignore not using --no-install-recommends with apt + - --ignore=DL3008 # Ignore not pinning all software package versions (apt-get) + - --ignore=DL3018 # Ignore not pinning all software package versions (apk) + - --ignore=SC1091 # Ignore missing shellcheck mock files +- repo: https://github.com/gruntwork-io/pre-commit + rev: 'v0.1.26' + hooks: + - id: terraform-validate diff --git a/init.lua b/init.lua index 276cf439629..d8d44a1cf2b 100644 --- a/init.lua +++ b/init.lua @@ -107,6 +107,15 @@ map('n', 'tn', 'FloatermNew', { desc = '[T]erminal [New]' }) map('n', 'tN', 'FloatermNext', { desc = 'Cycle Next Terminal' }) vim.g.floaterm_title = 'Terminal ($1/$2)' +-- Kubernetes keymaps +map('n', 'kkK', 'OpenK9s', { desc = 'Open [K]9s' }) +map('n', 'kkk', 'OpenK9sSplit', { desc = 'Open [k]9s in Split Pane' }) +map('n', 'klv', 'ViewPodLogs', { desc = '[V]iew Pod Logs' }) +map('n', 'klf', 'JsonFormatLogs', { desc = 'JSON Log [F]ormat' }) +map('n', 'kkt', 'ToggleYamlHelm', { desc = '[T]oggle YAML/Helm' }) +map('n', 'kht', 'HelmTemplateFromBuffer', { desc = '[H]elm [T]emplate' }) +map('n', 'khu', 'HelmDependencyUpdateFromBuffer', { desc = '[H]elm Dependency [U]pdate' }) + -- Diagnostic keymaps vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' }) @@ -322,6 +331,10 @@ require('lazy').setup({ -- Document existing key chains spec = { + { 'k', group = '[K]ubernetes' }, + { 'kk', group = '[K]ubectl' }, + { 'kl', group = '[L]ogs' }, + { 'kh', group = '[H]elm' }, { 'c', group = '[C]ode', mode = { 'n', 'x' } }, { 'd', group = '[D]ocument' }, { 'r', group = '[R]ename' }, @@ -330,6 +343,7 @@ require('lazy').setup({ { 'w', group = '[W]orkspace' }, { 't', group = '[T]oggle' }, { 'b', group = '[B]uffer' }, + { 'l', group = '[L]azy Git' }, { 'h', group = 'Git [H]unk', mode = { 'n', 'v' } }, }, }, diff --git a/lua/custom/plugins/kube-utils.lua b/lua/custom/plugins/kube-utils.lua new file mode 100644 index 00000000000..fd5a5d44b08 --- /dev/null +++ b/lua/custom/plugins/kube-utils.lua @@ -0,0 +1,11 @@ +return { + { + 'h4ckm1n-dev/kube-utils-nvim', + dependencies = { 'nvim-telescope/telescope.nvim' }, + lazy = true, + event = 'VeryLazy', + config = function() + require('kube-utils-nvim').setup() + end, + }, +} From 7635cecc4ab0977aae44336484e8b79e73ee5d39 Mon Sep 17 00:00:00 2001 From: Michael Beasley Date: Fri, 21 Mar 2025 10:34:19 -0800 Subject: [PATCH 15/16] add apply manifest from buffer keybind --- init.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/init.lua b/init.lua index d8d44a1cf2b..1f16f61e602 100644 --- a/init.lua +++ b/init.lua @@ -113,6 +113,7 @@ map('n', 'kkk', 'OpenK9sSplit', { desc = 'Open [k]9s in Split P map('n', 'klv', 'ViewPodLogs', { desc = '[V]iew Pod Logs' }) map('n', 'klf', 'JsonFormatLogs', { desc = 'JSON Log [F]ormat' }) map('n', 'kkt', 'ToggleYamlHelm', { desc = '[T]oggle YAML/Helm' }) +map('n', 'kka', 'KubectlApplyFromBuffer', { desc = '[A]pply Manifest from Buffer' }) map('n', 'kht', 'HelmTemplateFromBuffer', { desc = '[H]elm [T]emplate' }) map('n', 'khu', 'HelmDependencyUpdateFromBuffer', { desc = '[H]elm Dependency [U]pdate' }) From 0afec6837d33554ee95dd35a382dc4b0fcca6877 Mon Sep 17 00:00:00 2001 From: Michael Beasley Date: Fri, 21 Mar 2025 12:02:02 -0800 Subject: [PATCH 16/16] trivial --- init.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/init.lua b/init.lua index 1f16f61e602..3f70ca0b73a 100644 --- a/init.lua +++ b/init.lua @@ -110,6 +110,7 @@ vim.g.floaterm_title = 'Terminal ($1/$2)' -- Kubernetes keymaps map('n', 'kkK', 'OpenK9s', { desc = 'Open [K]9s' }) map('n', 'kkk', 'OpenK9sSplit', { desc = 'Open [k]9s in Split Pane' }) +map('n', 'kkc', 'SelectSplitCRD', { desc = 'View [C]RD in Split Pane' }) map('n', 'klv', 'ViewPodLogs', { desc = '[V]iew Pod Logs' }) map('n', 'klf', 'JsonFormatLogs', { desc = 'JSON Log [F]ormat' }) map('n', 'kkt', 'ToggleYamlHelm', { desc = '[T]oggle YAML/Helm' })