From fc4743abc17f45e9091ffa9a11289696e1fb1e24 Mon Sep 17 00:00:00 2001 From: Norm Rasmussen Date: Sat, 11 Feb 2023 11:32:58 -0500 Subject: [PATCH] fully on lazy! cleaned up some plugins --- init.lua | 38 ++++++------ lazy-lock.json | 9 +-- lua/plugins/alpha.lua | 101 +++++++++++++++++++------------- lua/plugins/headlines.lua | 38 ++++++++++++ lua/plugins/init.lua | 83 ++++++-------------------- lua/plugins/mason.lua | 22 +++++++ lua/plugins/null-ls.lua | 22 +++++++ lua/plugins/nvim-cmp.lua | 83 ++++++++++++++++++++++++++ lua/plugins/nvim-treesitter.lua | 24 ++++++++ lua/plugins/telescope.lua | 10 ++-- 10 files changed, 296 insertions(+), 134 deletions(-) create mode 100644 lua/plugins/headlines.lua create mode 100644 lua/plugins/mason.lua create mode 100644 lua/plugins/null-ls.lua create mode 100644 lua/plugins/nvim-cmp.lua create mode 100644 lua/plugins/nvim-treesitter.lua diff --git a/init.lua b/init.lua index b13e90e..89a4ae1 100755 --- a/init.lua +++ b/init.lua @@ -135,22 +135,24 @@ function _G.trim_trailing_whitespaces() end end +-- see https://github.com/hrsh7th/nvim-cmp/wiki/Menu-Appearance#how-to-add-visual-studio-code-dark-theme-colors-to-the-menu +vim.cmd[[ + highlight! link CmpItemMenu Comment + " gray + highlight! CmpItemAbbrDeprecated guibg=NONE gui=strikethrough guifg=#808080 + " blue + highlight! CmpItemAbbrMatch guibg=NONE guifg=#569CD6 + highlight! CmpItemAbbrMatchFuzzy guibg=NONE guifg=#569CD6 + " light blue + highlight! CmpItemKindVariable guibg=NONE guifg=#9CDCFE + highlight! CmpItemKindInterface guibg=NONE guifg=#9CDCFE + highlight! CmpItemKindText guibg=NONE guifg=#9CDCFE + " pink + highlight! CmpItemKindFunction guibg=NONE guifg=#C586C0 + highlight! CmpItemKindMethod guibg=NONE guifg=#C586C0 + " front + highlight! CmpItemKindKeyword guibg=NONE guifg=#D4D4D4 + highlight! CmpItemKindProperty guibg=NONE guifg=#D4D4D4 + highlight! CmpItemKindUnit guibg=NONE guifg=#D4D4D4 + ]] --- require('settings') ---require('keymaps') ---require('plugins/plugins'), ---require('plugins/nvim-tree'), ---require('plugins/indent-blankline'), ---require('plugins/feline'), ---require('plugins/nvim-cmp'), ---require('plugins/nvim-lspconfig'), ---require('plugins/nvim-treesitter'), ---require('plugins/alpha-nvim'), ---require('plugins/telescope'), ---require('plugins/symbols-outline'), ---require('plugins/mason-lspconfig'), ---require('plugins/snippets'), ---require('plugins/neoscroll'), ---require('plugins/null-ls'), ---require('plugins/nvim-mapper'), ---require('plugins/todo-comments') diff --git a/lazy-lock.json b/lazy-lock.json index 8a01834..e937f5c 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,7 +1,6 @@ { "LuaSnip": { "branch": "master", "commit": "563827f00bb4fe43269e3be653deabc0005f1302" }, - "alpha-nvim": { "branch": "main", "commit": "0349fc0aa0c1d940ec3be395cb110483b416bc84" }, - "cellular-automaton.nvim": { "branch": "main", "commit": "679943b8e1e5ef79aaeeaf4b00782c52eb4e928f" }, + "alpha-nvim": { "branch": "main", "commit": "54c9ba499209ac2563ddcefd47ba7bce35ae94ae" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-cmdline": { "branch": "main", "commit": "23c51b2a3c00f6abc4e922dbd7c3b9aca6992063" }, "cmp-nvim-lsp": { "branch": "main", "commit": "0e6b2ed705ddcff9738ec4ea838141654f12eeef" }, @@ -15,8 +14,10 @@ "friendly-snippets": { "branch": "main", "commit": "80597f3ea824946c87fd29f82b5ed4f24ef473f3" }, "gitsigns.nvim": { "branch": "main", "commit": "f29f0b22fd66c910b892aae3bc18a4872c002738" }, "glow.nvim": { "branch": "main", "commit": "2bb4afb6e9dbc93993a1d7d4168dac08c74590ac" }, + "headlines.nvim": { "branch": "master", "commit": "1cd93a641c03419bb255f8b3fe734451517763b1" }, "indent-blankline.nvim": { "branch": "master", "commit": "8299fe7703dfff4b1752aeed271c3b95281a952d" }, "lazy.nvim": { "branch": "main", "commit": "bab744565e9d8d743b1889c66707aa2e8018ae86" }, + "lazygit.nvim": { "branch": "main", "commit": "32bffdebe273e571588f25c8a708ca7297928617" }, "lsp-colors.nvim": { "branch": "main", "commit": "d0b245232aeb197bbd097111d8b69621b0671edb" }, "markdown-preview.nvim": { "branch": "master", "commit": "02cc3874738bc0f86e4b91f09b8a0ac88aef8e96" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "7a97a77eee486ae152d2c559a459eda7c8aa12aa" }, @@ -30,12 +31,12 @@ "neoscroll.nvim": { "branch": "master", "commit": "d7601c26c8a183fa8994ed339e70c2d841253e93" }, "neovim": { "branch": "main", "commit": "845a6ad5443e3559dde42910c4523a5835c9233b" }, "nord.nvim": { "branch": "main", "commit": "70df2b61de21b953fd577f292a973cd22e0ca686" }, - "null-ls.nvim": { "branch": "main", "commit": "60b4a7167c79c7d04d1ff48b55f2235bf58158a7" }, + "null-ls.nvim": { "branch": "main", "commit": "ab4e9261843236d773f49a23fcfb3d2167a3c500" }, "nvim": { "branch": "main", "commit": "c5ed88194ae1d581d3083725a0dc7c90dd3446be" }, "nvim-cmp": { "branch": "main", "commit": "cfafe0a1ca8933f7b7968a287d39904156f2c57d" }, "nvim-dap": { "branch": "master", "commit": "401f5f22b2d7f9bdbb9294d0235136091458816a" }, "nvim-dap-python": { "branch": "master", "commit": "d4400d075c21ed8fb8e8ac6a5ff56f58f6e93531" }, - "nvim-lspconfig": { "branch": "master", "commit": "b5bb6e3d7c775c241726d1ef564902263e93e2cd" }, + "nvim-lspconfig": { "branch": "master", "commit": "27e6eb27f31d1ef41427e1008029284c02dc856f" }, "nvim-mapper": { "branch": "main", "commit": "7585479199ad7c3fdfed47ae79d26198f948cfc5" }, "nvim-notify": { "branch": "master", "commit": "bdd647f61a05c9b8a57c83b78341a0690e9c29d7" }, "nvim-tree.lua": { "branch": "master", "commit": "02fdc262eba188198a7deb2117b3b996e6763d65" }, diff --git a/lua/plugins/alpha.lua b/lua/plugins/alpha.lua index 4608f93..e4b9477 100644 --- a/lua/plugins/alpha.lua +++ b/lua/plugins/alpha.lua @@ -1,55 +1,74 @@ ----------------------------------------------------------- --- Dashboard configuration file +-- startify configuration file ----------------------------------------------------------- - --- Plugin: alpha-nvim --- url: https://github.com/goolord/alpha-nvim - --- For configuration examples see: https://github.com/goolord/alpha-nvim/discussions/16 - return { "goolord/alpha-nvim", dependencies = { - "kyazdani42/nvim-web-devicons", + 'kyazdani42/nvim-web-devicons', }, config = function () - local alpha = require 'alpha' - local dashboard = require 'alpha.themes.dashboard' - -- Banner - dashboard.section.header.val = { + local alpha = require'alpha' + local startify = require'alpha.themes.startify' - [[ ]], - [[ █████ █████ ██████ █████ ███ ]], - [[ ░░███ ░░███ ░░██████ ░░███ ░███ ]], - [[ ░███ ░███ ██████ █████ ████ ░███░███ ░███ ██████ ████████ █████████████ ░███ ]], - [[ ░███████████ ███░░███░░███ ░███ ░███░░███░███ ███░░███░░███░░███░░███░░███░░██ ]], - [[ ░███░░░░░███ ░███████ ░███ ░███ ░███ ░░██████ ░███ ░███ ░███ ░░░ ░███ ░███ ░███░███ ]], - [[ ░███ ░███ ░███░░░ ░███ ░███ ░███ ░░█████ ░███ ░███ ░███ ░███ ░███ ░███░░░ ]], - [[ █████ █████░░██████ ░░███████ █████ ░░█████░░██████ █████ █████░███ ████████ ]], - [[ ░░░░░ ░░░░░ ░░░░░░ ░░░░░███ ░░░░░ ░░░░░ ░░░░░░ ░░░░░ ░░░░░ ░░░ ░░░░░░░░ ]], - [[ ███ ░███ ]], - [[ ░░██████ ]], - [[ ░░░░░░ ]], + startify.section.header.val = { + " ", + " █████ █████ ██████ █████ ███ ", + "░░███ ░░███ ░░██████ ░░███ ░███ ", + " ░███ ░███ ██████ █████ ████ ░███░███ ░███ ██████ ████████ █████████████ ░███ ", + " ░███████████ ███░░███░░███ ░███ ░███░░███░███ ███░░███░░███░░███░░███░░███░░███░███ ", + " ░███░░░░░███ ░███████ ░███ ░███ ░███ ░░██████ ░███ ░███ ░███ ░░░ ░███ ░███ ░███░███ ", + " ░███ ░███ ░███░░░ ░███ ░███ ░███ ░░█████ ░███ ░███ ░███ ░███ ░███ ░███░░░ ", + " █████ █████░░██████ ░░███████ █████ ░░█████░░██████ █████ █████░███ ████████ ", + "░░░░░ ░░░░░ ░░░░░░ ░░░░░███ ░░░░░ ░░░░░ ░░░░░░ ░░░░░ ░░░░░ ░░░ ░░░░░░░░ ", + " ███ ░███ ", + " ░░██████ ", + " ░░░░░░ ", + } + + + --[[ startify.section.mru.val = { + { type = "text", + val = findtodos, + opts = { + position = "left", + hl = {{"hl_group", 0, -2}} + } + } + }--]] + startify.section.mru_cwd.val = { { type = "padding", val = 0 } } + + -- Devicons - Not sure what this doe + startify.nvim_web_devicons.enabled = false + startify.nvim_web_devicons.highlight = false + startify.nvim_web_devicons.highlight = 'Number' + + -- Top Menu + startify.section.top_buttons.val = { + startify.button('e', ' New file', ':ene startinsert'), + startify.button('f', ' Find file', ':Telescope file_browser'), + startify.button('s', '⋅Find Word', ':Telescope live_grep'), + startify.button('t', '& Todo List', ':TodoTrouble keywords=TODO'), + startify.button('r', ' ' .. ' Recent files', ':Telescope oldfiles '), + startify.button('u', ' Show plugins', ':Lazy'), + startify.button('q', ' Quit', ':qa'), + } + + -- Bottom Menu + startify.section.bottom_buttons.val = { + -- Show Empty Space } - -- Menu - dashboard.section.buttons.val = { - dashboard.button('e', ' New file', ':ene startinsert'), - dashboard.button('f', ' Find file', ':Telescope file_browser'), - dashboard.button('s', '⋅ Find Word', ':Telescope live_grep'), - dashboard.button('u', ' Update plugins', ':PackerUpdate'), - dashboard.button('q', ' Quit', ':qa'), - } - - local handle = io.popen('fortune') - -- Footer - local function footer() - local version = vim.version() +--[[ local function footer() + local version = vim.version() local print_version = "v" .. version.major .. '.' .. version.minor .. '.' .. version.patch local datetime = os.date('%Y/%m/%d %H:%M:%S') return print_version .. ' ' .. datetime end - dashboard.section.footer.val = footer() - alpha.setup(dashboard.config) - end -} + --]] + + startify.section.footer.val = { + + } + alpha.setup(startify.config) + end + } diff --git a/lua/plugins/headlines.lua b/lua/plugins/headlines.lua new file mode 100644 index 0000000..a0b9a99 --- /dev/null +++ b/lua/plugins/headlines.lua @@ -0,0 +1,38 @@ +return { + 'lukas-reineke/headlines.nvim', + } + --[[ config = function() + require("headlines").setup { + markdown = { + query = vim.treesitter.parse_query( + "markdown", + [[ + (atx_heading [ + (atx_h1_marker) + (atx_h2_marker) + (atx_h3_marker) + (atx_h4_marker) + (atx_h5_marker) + (atx_h6_marker) + ] @headline) + + (thematic_break) @dash + + (fenced_code_block) @codeblock + + (block_quote_marker) @quote + (block_quote (paragraph (inline (block_continuation) @quote))) + + ), + headline_highlights = { "Headline" }, + codeblock_highlight = "CodeBlock", + dash_highlight = "Dash", + dash_string = "-", + quote_highlight = "Quote", + quote_string = "┃", + fat_headlines = true, + }, +} +end +} +--]] diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index e23bc0e..d6b754e 100755 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -5,70 +5,28 @@ return { -- They should be pulled first! ----------------------------------------------------------------- - -- Easy Way to install Language Servers - { 'williamboman/mason.nvim', - config = function() - require("mason").setup() - end -}, - 'williamboman/mason-lspconfig.nvim', - 'neovim/nvim-lspconfig', - -- Manage all your Keymaps! { "lazytanuki/nvim-mapper", config = function() require("nvim-mapper").setup{} end, before = "telescope.nvim" -}, + }, -- Neovim Autocomplete with LSP - { - 'hrsh7th/nvim-cmp', - dependencies = { - 'neovim/nvim-lspconfig', - 'L3MON4D3/LuaSnip', - 'hrsh7th/cmp-nvim-lsp', - 'hrsh7th/cmp-path', - 'hrsh7th/cmp-buffer', - 'hrsh7th/cmp-cmdline', - 'hrsh7th/nvim-cmp', - 'saadparwaiz1/cmp_luasnip', - 'hrsh7th/cmp-nvim-lsp-signature-help', - 'f3fora/cmp-spell', - } - }, { 'L3MON4D3/LuaSnip', tag = "v1.1.0", wants = { "friendly-snippets", "vim-snippets" }, }, - -- Treesitter interface - { - 'nvim-treesitter/nvim-treesitter', - build = function() require('nvim-treesitter.install').update({ with_sync = true }) end, - }, - - -- Null-LS - { - "jose-elias-alvarez/null-ls.nvim", - config = function() - require("null-ls").setup({ - debug = true, - }) - end, - dependencies = { "nvim-lua/plenary.nvim" }, -}, ------------------------------------------------------------ -- General Functionality ------------------------------------------------------------ - -- Change Color of virtual column bar - -- 'lukas-reineke/virt-column.nvim' - + 'kdheepak/lazygit.nvim', -- Tmux Navigation { "aserowy/tmux.nvim", config = function() require("tmux").setup() end -}, + }, -- Find & Search LSP Tags 'liuchengxu/vista.vim', @@ -84,7 +42,7 @@ return { -- Trouble Shows Errors with Files. { "folke/trouble.nvim", - dependencies = "kyazdani42/nvim-web-devicons", + dependencies = { 'kyazdani42/nvim-web-devicons' }, config = function() require("trouble").setup { } @@ -156,7 +114,7 @@ return { wrap = true }) end -}, + }, { "iamcco/markdown-preview.nvim", build = "cd app && npm install", setup = function() vim.g.mkdp_filetypes = { "markdown" } end, ft = { "markdown" }, }, @@ -164,8 +122,8 @@ return { -- Prettier Plugin for Neovim specifically 'MunifTanjim/prettier.nvim', - -- DAP (Debug adaptor Protocol) - 'mfussenegger/nvim-dap', + -- DAP (Debug adaptor Protocol) + 'mfussenegger/nvim-dap', { 'mfussenegger/nvim-dap-python', @@ -174,7 +132,7 @@ return { '~/.virtualenvs/debugpy/bin/python' ) end -}, + }, -- Sidebar { 'sidebar-nvim/sidebar.nvim', @@ -199,13 +157,9 @@ return { -- Text, Icons, Symbols ---------------------------------------------------------- 'lukas-reineke/indent-blankline.nvim', - 'simrat39/symbols-outline.nvim', - -- 'nvim-tree/nvim-web-devicons', - 'folke/lsp-colors.nvim', - 'karb94/neoscroll.nvim', -- Allow Popups for Telescope etc @@ -243,15 +197,13 @@ return { default = { "Identifier", "#7C3AED" }, test = { "Identifier", "#FF00FF" } }, - } + } end }, - -- The all famous telescope - { - "nvim-telescope/telescope-file-browser.nvim" -}, + -- Various telescopes + 'nvim-telescope/telescope-file-browser.nvim', -{ + { 'nvim-telescope/telescope-fzf-native.nvim', build = 'make' }, @@ -263,8 +215,8 @@ return { 'gbprod/nord.nvim', 'Mofiqul/dracula.nvim', 'lunarvim/colorschemes', - { 'rose-pine/neovim', as = 'rose-pine' }, - { "catppuccin/nvim", as = "catppuccin" }, + 'rose-pine/neovim', + 'catppuccin/nvim', { "folke/tokyonight.nvim", lazy = false, -- make sure we load this during startup if it is your main colorscheme @@ -278,11 +230,10 @@ return { 'feline-nvim/feline.nvim', dependencies = { 'kyazdani42/nvim-web-devicons' }, }, - {"ellisonleao/glow.nvim"}, + 'ellisonleao/glow.nvim', -- Plugin that causes your code to crumble >:) - 'eandrju/cellular-automaton.nvim', + -- 'eandrju/cellular-automaton.nvim', -- Wakatime Tracking 'wakatime/vim-wakatime' -} - + } diff --git a/lua/plugins/mason.lua b/lua/plugins/mason.lua new file mode 100644 index 0000000..6e667e2 --- /dev/null +++ b/lua/plugins/mason.lua @@ -0,0 +1,22 @@ +return { + -- Easy Way to install Language Servers + { 'williamboman/mason.nvim', + }, + 'williamboman/mason-lspconfig.nvim', + 'neovim/nvim-lspconfig', + + config = function() + require("mason").setup() + local lsp_installer = require("mason-lspconfig").setup({ + automatic_instalsation = true, + ui = { + icons = { + server_installed = "✓", + server_pending = "➜", + server_uninstalled = "✗" + } + } + }) + end + +} diff --git a/lua/plugins/null-ls.lua b/lua/plugins/null-ls.lua new file mode 100644 index 0000000..64eec87 --- /dev/null +++ b/lua/plugins/null-ls.lua @@ -0,0 +1,22 @@ +return { + 'jose-elias-alvarez/null-ls.nvim', + dependencies = { + 'nvim-lua/plenary.nvim', + }, + config = function () + local null_ls = require'null-ls' + null_ls.setup({ + debug = true, + sources = { + null_ls.builtins.completion.spell, + null_ls.builtins.diagnostics.alex, + null_ls.builtins.diagnostics.codespell, + null_ls.builtins.diagnostics.markdownlint.with({ extra_args = { "--disable", "MD013", "MD024", "--" } + ,}), + null_ls.builtins.diagnostics.pycodestyle.with({ extra_args = { "--max-line-length=150" }}), + null_ls.builtins.formatting.black.with({ extra_args = { "--fast" }}), + }, + }) + end +} +-- TODO: Add a keymapping for alex. i.e ':! alex' diff --git a/lua/plugins/nvim-cmp.lua b/lua/plugins/nvim-cmp.lua new file mode 100644 index 0000000..867836d --- /dev/null +++ b/lua/plugins/nvim-cmp.lua @@ -0,0 +1,83 @@ +return { + 'hrsh7th/nvim-cmp', + dependencies = { + 'neovim/nvim-lspconfig', + 'L3MON4D3/LuaSnip', + 'hrsh7th/cmp-nvim-lsp', + 'hrsh7th/cmp-path', + 'hrsh7th/cmp-buffer', + 'hrsh7th/cmp-cmdline', + 'hrsh7th/nvim-cmp', + 'saadparwaiz1/cmp_luasnip', + 'hrsh7th/cmp-nvim-lsp-signature-help', + 'f3fora/cmp-spell', + }, + config = function () + local cmp_status_ok, cmp = pcall(require, 'cmp') + if not cmp_status_ok then + return + end + + local luasnip_status_ok, luasnip = pcall(require, 'luasnip') + if not luasnip_status_ok then + return + end + --cmp.setup { + -- Load snippet support + --snippet = { + -- expand = function(args) + -- luasnip.lsp_expand(args.body) + -- }, + + -- Completion settings + completion = { + --completeopt = 'menu,menuone,noselect' + keyword_length = 2 + } + + -- Key mapping + mapping = { + [''] = cmp.mapping.select_next_item(), + [''] = cmp.mapping.select_prev_item(), + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete(), + [""] = cmp.mapping({ + i = cmp.mapping.abort(), + c = cmp.mapping.close(), + }), + [""] = cmp.config.disable, + [''] = cmp.mapping.confirm { + select = false, + }, + -- Tab mapping + [''] = function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + else + fallback() + end + end, + [''] = function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end + } + + -- Load sources, see: https://github.com/topics/nvim-cmp + sources = { + { name = 'nvim-lsp' }, + { name = 'luasnip' }, + { name = 'path' }, + { name = 'buffer' }, + { name = 'zsh' }, + } + end +} diff --git a/lua/plugins/nvim-treesitter.lua b/lua/plugins/nvim-treesitter.lua new file mode 100644 index 0000000..ac3f910 --- /dev/null +++ b/lua/plugins/nvim-treesitter.lua @@ -0,0 +1,24 @@ +--local status_ok, nvim_treesitter = pcall(require, 'nvim-treesitter.configs') +--if not status_ok then +-- return +--end + +return { + -- Treesitter interface + 'nvim-treesitter/nvim-treesitter', + --build = ":TSUpdate" + config = function () + require('nvim-treesitter.install').update({ with_sync = true }) + -- A list of parser names, or "all" + ensure_installed = { + 'bash', 'css', 'html', 'javascript', 'json', 'lua', 'python', + 'vim', 'yaml', 'typescript', 'markdown', + } + sync_install = true + highlight = { + -- `false` will disable the whole extension + enable = true, + additional_vim_regex_highlighting = true, + } + end + } diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua index d70d185..a0de994 100644 --- a/lua/plugins/telescope.lua +++ b/lua/plugins/telescope.lua @@ -5,10 +5,6 @@ return { 'nvim-lua/plenary.nvim', 'nvim-telescope/telescope-live-grep-args.nvim', }, - require("telescope").load_extension "file_browser", - require("telescope").load_extension "mapper", - require("telescope").load_extension "live_grep_args", - require("telescope").load_extension "fzf", config = function () local g = vim.g @@ -154,7 +150,11 @@ return { } } }) - end + require("telescope").load_extension "file_browser" + require("telescope").load_extension "mapper" + require("telescope").load_extension "live_grep_args" + require("telescope").load_extension "fzf" + end }}