diff --git a/chezmoi/private_dot_config/nvim/init.lua b/chezmoi/private_dot_config/nvim/init.lua index 57840ee..9035afc 100644 --- a/chezmoi/private_dot_config/nvim/init.lua +++ b/chezmoi/private_dot_config/nvim/init.lua @@ -1,4 +1 @@ -require('settings') -require('plugins') -require('mappings') -require('autocmd') +require('core.init') diff --git a/chezmoi/private_dot_config/nvim/lazy-lock.json b/chezmoi/private_dot_config/nvim/lazy-lock.json new file mode 100644 index 0000000..cca810a --- /dev/null +++ b/chezmoi/private_dot_config/nvim/lazy-lock.json @@ -0,0 +1,28 @@ +{ + "bufferline.nvim": { "branch": "main", "commit": "243893ba9d5d1049dd451a25cab32ec7f8f67bcf" }, + "fidget.nvim": { "branch": "main", "commit": "0ba1e16d07627532b6cae915cc992ecac249fb97" }, + "gitsigns.nvim": { "branch": "main", "commit": "a36bc3360d584d39b4fb076d855c4180842d4444" }, + "gruvbox.nvim": { "branch": "main", "commit": "df149bccb19a02c5c2b9fa6ec0716f0c0487feb0" }, + "hop.nvim": { "branch": "master", "commit": "03f0434869f1f38868618198b5f4f2ab6d39aef2" }, + "indent-blankline.nvim": { "branch": "master", "commit": "7075d7861f7a6bbf0de0298c83f8a13195e6ec01" }, + "lazy.nvim": { "branch": "main", "commit": "c1aad95243f0d180f41348be26b2417547fb168b" }, + "lualine.nvim": { "branch": "master", "commit": "05d78e9fd0cdfb4545974a5aa14b1be95a86e9c9" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "d381fcb78d7a562c3244e1c8f76406954649db36" }, + "mason.nvim": { "branch": "main", "commit": "f7f81ab41b153e2902ebded401a8a0a6abe28607" }, + "mini.nvim": { "branch": "main", "commit": "3a11a130bac227462dd226669d260c4bbe33fb5b" }, + "neodev.nvim": { "branch": "main", "commit": "78f1c370173e7689bd58d64229b4d92c5dfb2793" }, + "null-ls.nvim": { "branch": "main", "commit": "bbaf5a96913aa92281f154b08732be2f57021c45" }, + "nvim-lsp-basics": { "branch": "main", "commit": "632714bd3ab355eb6e725b5a78cd8730f12d14d2" }, + "nvim-lspconfig": { "branch": "master", "commit": "a51892484c2002c083a8b0a9dfcefb3a569be36d" }, + "nvim-treesitter": { "branch": "master", "commit": "1897926700b6b0add1cf25c8ff0ba5f6e917814e" }, + "nvim-web-devicons": { "branch": "master", "commit": "14b3a5ba63b82b60cde98d0a40319d80f25e8301" }, + "plenary.nvim": { "branch": "master", "commit": "36aaceb6e93addd20b1b18f94d86aecc552f30c4" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "9bc8237565ded606e6c366a71c64c0af25cd7a50" }, + "telescope.nvim": { "branch": "0.1.x", "commit": "776b509f80dd49d8205b9b0d94485568236d1192" }, + "trouble.nvim": { "branch": "main", "commit": "2af0dd9767526410c88c628f1cbfcb6cf22dd683" }, + "vim-fugitive": { "branch": "master", "commit": "43f18ab9155c853a84ded560c6104e6300ad41da" }, + "vim-illuminate": { "branch": "master", "commit": "a2907275a6899c570d16e95b9db5fd921c167502" }, + "vim-sleuth": { "branch": "master", "commit": "1cc4557420f215d02c4d2645a748a816c220e99b" }, + "vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" }, + "which-key.nvim": { "branch": "main", "commit": "d871f2b664afd5aed3dc1d1573bef2fb24ce0484" } +} \ No newline at end of file diff --git a/chezmoi/private_dot_config/nvim/lua/autocmd.lua b/chezmoi/private_dot_config/nvim/lua/autocmd.lua deleted file mode 100644 index 539ee92..0000000 --- a/chezmoi/private_dot_config/nvim/lua/autocmd.lua +++ /dev/null @@ -1,7 +0,0 @@ -local api = vim.api - --- set the theme to gruvbox -api.nvim_command("autocmd vimenter * ++nested colorscheme gruvbox") - --- run nvim-lightbulb for all files -vim.cmd [[autocmd CursorHold,CursorHoldI * lua require'nvim-lightbulb'.update_lightbulb()]] diff --git a/chezmoi/private_dot_config/nvim/lua/core/colorscheme.lua b/chezmoi/private_dot_config/nvim/lua/core/colorscheme.lua new file mode 100644 index 0000000..1575b31 --- /dev/null +++ b/chezmoi/private_dot_config/nvim/lua/core/colorscheme.lua @@ -0,0 +1,2 @@ +local colorscheme = require("helpers.colorscheme") +vim.cmd.colorscheme(colorscheme) diff --git a/chezmoi/private_dot_config/nvim/lua/core/init.lua b/chezmoi/private_dot_config/nvim/lua/core/init.lua new file mode 100644 index 0000000..004ec06 --- /dev/null +++ b/chezmoi/private_dot_config/nvim/lua/core/init.lua @@ -0,0 +1,3 @@ +require("core.options") +require("core.lazy") +require("core.colorscheme") diff --git a/chezmoi/private_dot_config/nvim/lua/core/lazy.lua b/chezmoi/private_dot_config/nvim/lua/core/lazy.lua new file mode 100644 index 0000000..08ac889 --- /dev/null +++ b/chezmoi/private_dot_config/nvim/lua/core/lazy.lua @@ -0,0 +1,32 @@ +-- Install lazy.nvim if not already installed +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not vim.loop.fs_stat(lazypath) then + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", -- latest stable release + lazypath, + }) +end +vim.opt.rtp:prepend(lazypath) + +-- Use a protected call so we don't error out on first use +local ok, lazy = pcall(require, "lazy") +if not ok then + return +end + +local keys = require("helpers.keys") + +-- We have to set the leader key here for lazy.nvim to work +keys.set_leader("\\") + +-- Load plugins from specifications +-- (The leader key must be set before this) +lazy.setup("plugins") + +-- Might as well set up an easy-access keybinding + +keys.map("n", "L", lazy.show, "Show Lazy") diff --git a/chezmoi/private_dot_config/nvim/lua/core/options.lua b/chezmoi/private_dot_config/nvim/lua/core/options.lua new file mode 100644 index 0000000..b8ef27b --- /dev/null +++ b/chezmoi/private_dot_config/nvim/lua/core/options.lua @@ -0,0 +1,23 @@ +local opts = { + termguicolors = true, -- enable 24 bit colors + -- tabs look like 4 spaces { + expandtab = true, + tabstop = 4, + shiftwidth = 4, + softtabstop = 4, + -- } + number = true, -- show line numbers + mouse = 'c', -- disable mouse + laststatus = 2, -- always show the status line + autoindent = true, -- turn on autoindent + smarttab = true, -- turn on smart tabs + incsearch = true, -- turn on incremental search + ruler = true, -- show ruler on page + lazyredraw = true, -- make large file bearable + regexpengine = 1, -- make searching large files bearable + background = 'dark' -- use dark theme +} + +for opt, val in pairs(opts) do + vim.o[opt] = val +end diff --git a/chezmoi/private_dot_config/nvim/lua/dot_luarc.json b/chezmoi/private_dot_config/nvim/lua/dot_luarc.json new file mode 100644 index 0000000..6da3b2d --- /dev/null +++ b/chezmoi/private_dot_config/nvim/lua/dot_luarc.json @@ -0,0 +1,29 @@ +{ + "workspace.library": [ + "/Users/tony.blyler/.local/share/nvim/lazy/neodev.nvim/types/stable", + "/opt/homebrew/Cellar/neovim/0.9.1/share/nvim/runtime/lua", + "/Users/tony.blyler/.local/share/nvim/lazy/bufferline.nvim/lua", + "/Users/tony.blyler/.local/share/nvim/lazy/fidget.nvim/lua", + "/Users/tony.blyler/.local/share/nvim/lazy/nvim-web-devicons/lua", + "/Users/tony.blyler/.local/share/nvim/lazy/lualine.nvim/lua", + "/Users/tony.blyler/.local/share/nvim/lazy/hop.nvim/lua", + "/Users/tony.blyler/.local/share/nvim/lazy/vim-illuminate/lua", + "/Users/tony.blyler/.local/share/nvim/lazy/lazy.nvim/lua", + "/Users/tony.blyler/.local/share/nvim/lazy/nvim-lspconfig/lua", + "/Users/tony.blyler/.local/share/nvim/lazy/gruvbox.nvim/lua", + "/Users/tony.blyler/.local/share/nvim/lazy/plenary.nvim/lua", + "/Users/tony.blyler/.local/share/nvim/lazy/cmp-nvim-lsp/lua", + "/Users/tony.blyler/.local/share/nvim/lazy/which-key.nvim/lua", + "/Users/tony.blyler/.local/share/nvim/lazy/trouble.nvim/lua", + "/Users/tony.blyler/.local/share/nvim/lazy/mason.nvim/lua", + "/Users/tony.blyler/.local/share/nvim/lazy/telescope-fzf-native.nvim/lua", + "/Users/tony.blyler/.local/share/nvim/lazy/nvim-treesitter/lua", + "/Users/tony.blyler/.local/share/nvim/lazy/telescope.nvim/lua", + "/Users/tony.blyler/.local/share/nvim/lazy/neodev.nvim/lua", + "/Users/tony.blyler/.local/share/nvim/lazy/mason-lspconfig.nvim/lua", + "/Users/tony.blyler/.local/share/nvim/lazy/mini.nvim/lua", + "/Users/tony.blyler/.local/share/nvim/lazy/gitsigns.nvim/lua", + "/Users/tony.blyler/.config/nvim/lua", + "${3rd}/luv/library" + ] +} \ No newline at end of file diff --git a/chezmoi/private_dot_config/nvim/lua/helpers/colorscheme.lua b/chezmoi/private_dot_config/nvim/lua/helpers/colorscheme.lua new file mode 100644 index 0000000..e1a278f --- /dev/null +++ b/chezmoi/private_dot_config/nvim/lua/helpers/colorscheme.lua @@ -0,0 +1,20 @@ +-- Fetch and setup colorscheme if available, otherwise just return 'default' +-- This should prevent Neovim from complaining about missing colorschemes on first boot +local function get_if_available(name, opts) + local lua_ok, colorscheme = pcall(require, name) + if lua_ok then + colorscheme.setup(opts) + return name + end + + local vim_ok, _ = pcall(vim.cmd.colorscheme, name) + if vim_ok then + return name + end + + return "default" +end + +local colorscheme = get_if_available('gruvbox') + +return colorscheme diff --git a/chezmoi/private_dot_config/nvim/lua/helpers/keys.lua b/chezmoi/private_dot_config/nvim/lua/helpers/keys.lua new file mode 100644 index 0000000..3bf4079 --- /dev/null +++ b/chezmoi/private_dot_config/nvim/lua/helpers/keys.lua @@ -0,0 +1,21 @@ +local M = {} + +M.map = function(mode, lhs, rhs, desc) + vim.keymap.set(mode, lhs, rhs, { silent = true, desc = desc }) +end + +M.lsp_map = function(lhs, rhs, bufnr, desc) + vim.keymap.set("n", lhs, rhs, { silent = true, buffer = bufnr, desc = desc }) +end + +M.dap_map = function(mode, lhs, rhs, desc) + M.map(mode, lhs, rhs, desc) +end + +M.set_leader = function(key) + vim.g.mapleader = key + vim.g.maplocalleader = key + M.map({ "n", "v" }, key, "") +end + +return M diff --git a/chezmoi/private_dot_config/nvim/lua/mappings.lua b/chezmoi/private_dot_config/nvim/lua/mappings.lua deleted file mode 100644 index ac8e4c3..0000000 --- a/chezmoi/private_dot_config/nvim/lua/mappings.lua +++ /dev/null @@ -1,26 +0,0 @@ -local api = vim.api - -local M = {} -function M.map(mode, keydef, command, opts) - local options = {noremap = true} - if opts then options = vim.tbl_extend("force", options, opts) end - api.nvim_set_keymap(mode, keydef, command, options) -end - --- fzf searching -M.map("", "ff", "lua require('telescope.builtin').find_files()") -M.map("", "fg", "lua require('telescope.builtin').live_grep()") -M.map("", "fb", "lua require('telescope.builtin').buffers()") -M.map("", "fh", "lua require('telescope.builtin').help_tags()") -M.map("", "fb", "lua require('telescope.builtin').file_browser()") - --- easymotion -M.map("", "j", "lua require('hop').hint_lines({direction = require('hop.hint').HintDirection.AFTER_CURSOR})") -M.map("", "k", "lua require('hop').hint_lines({direction = require('hop.hint').HintDirection.BEFORE_CURSOR})") -M.map("", "l", "lua require('hop').hint_words({direction = require('hop.hint').HintDirection.AFTER_CURSOR, current_line_only = true})") -M.map("", "h", "lua require('hop').hint_words({direction = require('hop.hint').HintDirection.BEFORE_CURSOR, current_line_only = true})") - -api.nvim_command(":command Bd lua MiniBufremove.delete()") -api.nvim_command(":command FixWhitespace lua MiniTrailspace.trim()") - -return M diff --git a/chezmoi/private_dot_config/nvim/lua/plugins/bufferline.lua b/chezmoi/private_dot_config/nvim/lua/plugins/bufferline.lua new file mode 100644 index 0000000..134d1b9 --- /dev/null +++ b/chezmoi/private_dot_config/nvim/lua/plugins/bufferline.lua @@ -0,0 +1,9 @@ +-- See current buffers at the top of the editor +return { + { + "akinsho/bufferline.nvim", + version = "v3.*", + dependencies = "nvim-tree/nvim-web-devicons", + opts = {}, + }, +} diff --git a/chezmoi/private_dot_config/nvim/lua/plugins/config/bufferline.lua b/chezmoi/private_dot_config/nvim/lua/plugins/config/bufferline.lua deleted file mode 100644 index da65645..0000000 --- a/chezmoi/private_dot_config/nvim/lua/plugins/config/bufferline.lua +++ /dev/null @@ -1 +0,0 @@ -require("bufferline").setup() diff --git a/chezmoi/private_dot_config/nvim/lua/plugins/config/cmp.lua b/chezmoi/private_dot_config/nvim/lua/plugins/config/cmp.lua deleted file mode 100644 index 87a1553..0000000 --- a/chezmoi/private_dot_config/nvim/lua/plugins/config/cmp.lua +++ /dev/null @@ -1,46 +0,0 @@ -local cmp = require'cmp' - -cmp.setup({ - snippet = { - -- REQUIRED - you must specify a snippet engine - expand = function(args) - require('luasnip').lsp_expand(args.body) -- For `luasnip` users. - end, - }, - mapping = { - [''] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }), - [''] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }), - [''] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Select }), - [''] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select }), - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.complete(), - [''] = cmp.mapping.close(), - [''] = cmp.mapping.confirm({ - behavior = cmp.ConfirmBehavior.Replace, - select = true, - }) - }, - sources = cmp.config.sources({ - { name = 'nvim_lsp' }, - { name = 'luasnip' }, -- For luasnip users. - }, { - { name = 'buffer' }, - }) -}) - --- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore). -cmp.setup.cmdline('/', { - sources = { - { name = 'buffer' } - } -}) - --- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). -cmp.setup.cmdline(':', { - sources = cmp.config.sources({ - { name = 'path' } - }, { - { name = 'cmdline' } - }) -}) diff --git a/chezmoi/private_dot_config/nvim/lua/plugins/config/gitsigns.lua b/chezmoi/private_dot_config/nvim/lua/plugins/config/gitsigns.lua deleted file mode 100644 index b5cb9db..0000000 --- a/chezmoi/private_dot_config/nvim/lua/plugins/config/gitsigns.lua +++ /dev/null @@ -1,7 +0,0 @@ -require("gitsigns").setup { - current_line_blame = true, - current_line_blame_opts = { - virt_text = true, - delay = 0, - }, -} diff --git a/chezmoi/private_dot_config/nvim/lua/plugins/config/hop.lua b/chezmoi/private_dot_config/nvim/lua/plugins/config/hop.lua deleted file mode 100644 index e82f65c..0000000 --- a/chezmoi/private_dot_config/nvim/lua/plugins/config/hop.lua +++ /dev/null @@ -1 +0,0 @@ -require("hop").setup() diff --git a/chezmoi/private_dot_config/nvim/lua/plugins/config/indentblankline.lua b/chezmoi/private_dot_config/nvim/lua/plugins/config/indentblankline.lua deleted file mode 100644 index 973ed01..0000000 --- a/chezmoi/private_dot_config/nvim/lua/plugins/config/indentblankline.lua +++ /dev/null @@ -1,6 +0,0 @@ -require("indent_blankline").setup { - show_current_context = true, - show_current_context_start = true, -} - -vim.g.indent_blankline_use_treesitter = true diff --git a/chezmoi/private_dot_config/nvim/lua/plugins/config/lightbulb.lua b/chezmoi/private_dot_config/nvim/lua/plugins/config/lightbulb.lua deleted file mode 100644 index aab8922..0000000 --- a/chezmoi/private_dot_config/nvim/lua/plugins/config/lightbulb.lua +++ /dev/null @@ -1,10 +0,0 @@ -local lightbulb = require("nvim-lightbulb") - -lightbulb.get_status_text() -lightbulb.update_lightbulb({ - status_text = { - enabled = true, - text = "💡", - text_unavailble = "", - } -}) diff --git a/chezmoi/private_dot_config/nvim/lua/plugins/config/lspinstall.lua b/chezmoi/private_dot_config/nvim/lua/plugins/config/lspinstall.lua deleted file mode 100644 index e9309f3..0000000 --- a/chezmoi/private_dot_config/nvim/lua/plugins/config/lspinstall.lua +++ /dev/null @@ -1,112 +0,0 @@ -require("nvim-lsp-installer").setup({ - automatic_installation = true, -}) -local lsp_installer_servers = require'nvim-lsp-installer.servers' -local cmp_lsp = require('cmp_nvim_lsp') -local null_ls = require("null-ls") -local lspconfig = require("lspconfig") - -null_ls.setup({ - sources = { - null_ls.builtins.diagnostics.vale, - }, -}) - --- Use an on_attach function to only map the following keys --- after the language server attaches to the current buffer -local on_attach = function(client, bufnr) - local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end - local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end - - -- Enable completion triggered by - buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc') - - -- Mappings. - local opts = { noremap=true, silent=true } - - -- See `:help vim.lsp.*` for documentation on any of the below functions - buf_set_keymap('n', 'gD', 'lua vim.lsp.buf.declaration()', opts) - --buf_set_keymap('n', 'gd', 'lua vim.lsp.buf.definition()', opts) - buf_set_keymap('n', 'gd', "lua require('telescope.builtin').lsp_definitions()", opts) - buf_set_keymap('n', 'K', 'lua vim.lsp.buf.hover()', opts) - --buf_set_keymap('n', 'gi', 'lua vim.lsp.buf.implementation()', opts) - buf_set_keymap('n', 'gi', "lua require('telescope.builtin').lsp_implementations()", opts) - buf_set_keymap('n', '', 'lua vim.lsp.buf.signature_help()', opts) - buf_set_keymap('n', 'wa', 'lua vim.lsp.buf.add_workspace_folder()', opts) - buf_set_keymap('n', 'wr', 'lua vim.lsp.buf.remove_workspace_folder()', opts) - buf_set_keymap('n', 'wl', 'lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))', opts) - --buf_set_keymap('n', 'D', 'lua vim.lsp.buf.type_definition()', opts) - buf_set_keymap('n', 'D', "lua require('telescope.builtin').lsp_type_definitions()", opts) - buf_set_keymap('n', 'rn', 'lua vim.lsp.buf.rename()', opts) - --buf_set_keymap('n', 'ca', 'lua vim.lsp.buf.code_action()', opts) - buf_set_keymap('n', 'ca', "lua require('telescope.builtin').lsp_code_actions()", opts) - --buf_set_keymap('n', 'gr', 'lua vim.lsp.buf.references()', opts) - buf_set_keymap('', 'gr', "lua require('telescope.builtin').lsp_references()", opts) - buf_set_keymap('n', 'e', 'lua vim.lsp.diagnostic.show_line_diagnostics()', opts) - buf_set_keymap('n', '[d', 'lua vim.lsp.diagnostic.goto_prev()', opts) - buf_set_keymap('n', ']d', 'lua vim.lsp.diagnostic.goto_next()', opts) - buf_set_keymap('n', 'q', 'lua vim.lsp.diagnostic.set_loclist()', opts) - buf_set_keymap('n', 'f', 'lua vim.lsp.buf.formatting()', opts) - - require("lsp-status").on_attach(client) -- required for LSP status to function - local basics = require("lsp_basics") -- adds nice human accessible LSP commands - basics.make_lsp_commands(client, bufnr) - basics.make_lsp_mappings(client, bufnr) - - local sources = { - null_ls.builtins.formatting.gofumpt, - null_ls.builtins.formatting.goimports, - null_ls.builtins.formatting.isort, - null_ls.builtins.formatting.black.with({ - extra_args = { "-l 120" } - }), - null_ls.builtins.diagnostics.flake8.with({ - extra_args = { "--max-line-length=120" } - }), - null_ls.builtins.formatting.rubocop, - null_ls.builtins.formatting.rustfmt, - null_ls.builtins.diagnostics.shellcheck, - null_ls.builtins.formatting.stylua, - } - - null_ls.setup({sources = sources }) -end - -local lspServers = { - bashls = {}, - cssls = {}, - dockerls = {}, - eslint = {}, - gopls = { - cmd = {"gopls", "serve"}, - settings = { - gopls = { - analyses = { - unusedparams = true, - }, - staticcheck = true, - }, - }, - }, - html = {}, - jsonls = {}, - sumneko_lua = {}, - jedi_language_server = {}, - rust_analyzer = {}, - terraformls = {}, - tsserver = {}, - lemminx = {}, - yamlls = {} -} - -for lspServer, opts in pairs(lspServers) do - local server_available, requested_server = lsp_installer_servers.get_server(lspServer) - if server_available then - opts["capabilities"] = cmp_lsp.default_capabilities(vim.lsp.protocol.make_client_capabilities()) - opts["on_attach"] = on_attach - lspconfig[lspServer].setup(opts) - if not requested_server:is_installed() then - requested_server:install() - end - end -end diff --git a/chezmoi/private_dot_config/nvim/lua/plugins/config/mini.lua b/chezmoi/private_dot_config/nvim/lua/plugins/config/mini.lua deleted file mode 100644 index c6c80e6..0000000 --- a/chezmoi/private_dot_config/nvim/lua/plugins/config/mini.lua +++ /dev/null @@ -1,5 +0,0 @@ -require("mini.bufremove").setup() -require("mini.comment").setup() -require("mini.cursorword").setup() -require("mini.surround").setup() -require("mini.trailspace").setup() diff --git a/chezmoi/private_dot_config/nvim/lua/plugins/config/statusline.lua b/chezmoi/private_dot_config/nvim/lua/plugins/config/statusline.lua deleted file mode 100644 index 9bf28c3..0000000 --- a/chezmoi/private_dot_config/nvim/lua/plugins/config/statusline.lua +++ /dev/null @@ -1,2 +0,0 @@ -local statusline = require('statusline') -statusline.tabline = false diff --git a/chezmoi/private_dot_config/nvim/lua/plugins/config/telescope.lua b/chezmoi/private_dot_config/nvim/lua/plugins/config/telescope.lua deleted file mode 100644 index aa2c060..0000000 --- a/chezmoi/private_dot_config/nvim/lua/plugins/config/telescope.lua +++ /dev/null @@ -1,14 +0,0 @@ -local telescope = require("telescope") - -telescope.setup({ - extensions = { - fzf = { - fuzzy = true, - override_generic_sorter = true, - override_file_sorter = true, - case_mode = "smart_case", - }, - }, -}) - -telescope.load_extension("fzf") diff --git a/chezmoi/private_dot_config/nvim/lua/plugins/config/treesitter.lua b/chezmoi/private_dot_config/nvim/lua/plugins/config/treesitter.lua deleted file mode 100644 index 2f18b0e..0000000 --- a/chezmoi/private_dot_config/nvim/lua/plugins/config/treesitter.lua +++ /dev/null @@ -1,28 +0,0 @@ -require'nvim-treesitter.configs'.setup { - ensure_installed = "all", -- one of "all", "maintained" (parsers with maintainers), or a list of languages - sync_install = false, -- install languages synchronously (only applied to `ensure_installed`) - ignore_install = {"phpdoc", "tree-sitter-phpdoc"}, -- List of parsers to ignore installing - autopairs = { - enable = true, - }, - highlight = { - enable = true, -- false will disable the whole extension - disable = {"phpdoc", "tree-sitter-phpdoc"}, -- list of language that will be disabled - -- Setting this to true will run `:h syntax` and tree-sitter at the same time. - -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). - -- Using this option may slow down your editor, and you may see some duplicate highlights. - -- Instead of true it can also be a list of languages - additional_vim_regex_highlighting = false, - }, - rainbow = { - enable = true, - extended_mode = true, - }, - indent = { - enable = true, - }, - context_commentstring = { - enable = true, - enable_autocmd = true, - }, -} diff --git a/chezmoi/private_dot_config/nvim/lua/plugins/config/trouble.lua b/chezmoi/private_dot_config/nvim/lua/plugins/config/trouble.lua deleted file mode 100644 index c3c9444..0000000 --- a/chezmoi/private_dot_config/nvim/lua/plugins/config/trouble.lua +++ /dev/null @@ -1,4 +0,0 @@ -require("trouble").setup({ - -- configuration here - -- or leave it empty to use the default settings -}) diff --git a/chezmoi/private_dot_config/nvim/lua/plugins/easymotion.lua b/chezmoi/private_dot_config/nvim/lua/plugins/easymotion.lua new file mode 100644 index 0000000..5030377 --- /dev/null +++ b/chezmoi/private_dot_config/nvim/lua/plugins/easymotion.lua @@ -0,0 +1,25 @@ +return { + { + "phaazon/hop.nvim", + config = function() + local hop = require("hop") + hop.setup() + + local directions = require("hop.hint").HintDirection + local map = require("helpers.keys").map + + map("", "j", function() + hop.hint_lines({direction = directions.AFTER_CURSOR}) + end) + map("", "k", function() + hop.hint_lines({direction = directions.BEFORE_CURSOR}) + end) + map("", "l", function() + hop.hint_words({direction = directions.AFTER_CURSOR, current_line_only = true}) + end) + map("", "h", function() + hop.hint_words({direction = directions.BEFORE_CURSOR, current_line_only = true}) + end) + end, + } +} diff --git a/chezmoi/private_dot_config/nvim/lua/plugins/git.lua b/chezmoi/private_dot_config/nvim/lua/plugins/git.lua new file mode 100644 index 0000000..c742c1c --- /dev/null +++ b/chezmoi/private_dot_config/nvim/lua/plugins/git.lua @@ -0,0 +1,21 @@ +-- Git related plugins +return { + { + "lewis6991/gitsigns.nvim", + opts = { + current_line_blame = true, + current_line_blame_opts = { + virt_text = true, + delay = 0, + }, + }, + }, + { + "tpope/vim-fugitive", + config = function () + local map = require("helpers.keys").map + map("n", "ga", "Git add %", "Stage the current file") + map("n", "gb", "Git blame", "Show the blame") + end + } +} diff --git a/chezmoi/private_dot_config/nvim/lua/plugins/indent-blankline.lua b/chezmoi/private_dot_config/nvim/lua/plugins/indent-blankline.lua new file mode 100644 index 0000000..72e60f5 --- /dev/null +++ b/chezmoi/private_dot_config/nvim/lua/plugins/indent-blankline.lua @@ -0,0 +1,10 @@ +return { + { + "lukas-reineke/indent-blankline.nvim", + opts = { + show_current_context = true, + show_current_context_start = true, + use_treesitter = true, + }, + } +} diff --git a/chezmoi/private_dot_config/nvim/lua/plugins/init.lua b/chezmoi/private_dot_config/nvim/lua/plugins/init.lua deleted file mode 100644 index a4d995a..0000000 --- a/chezmoi/private_dot_config/nvim/lua/plugins/init.lua +++ /dev/null @@ -1,72 +0,0 @@ -local fn = vim.fn - -local install_path = fn.stdpath('data') .. '/site/pack/paqs/start/paq-nvim' - -if fn.empty(fn.glob(install_path)) > 0 then - fn.system({'git', 'clone', '--depth=1', 'https://github.com/savq/paq-nvim.git', install_path}) -end - -require "paq" { - "savq/paq-nvim"; -- let Paq manage itself - - "morhetz/gruvbox"; -- gruvbox theme - - "kyazdani42/nvim-web-devicons"; -- per the name, fancy icons with a Nerd Font patched font - - "lewis6991/gitsigns.nvim"; -- git gutter - "nvim-lua/plenary.nvim"; -- dependency of lewis6991/gitsigns.nvim, nvim-telescope/telescope.nvim - - "nvim-telescope/telescope.nvim"; -- nice searching - {"nvim-telescope/telescope-fzf-native.nvim", run="zsh -c make"}; -- enable fzf searching for telescope - - - "phaazon/hop.nvim"; -- easymotion navigation - - "beauwilliams/statusline.lua"; -- statusline - "akinsho/bufferline.nvim"; -- bufferline - - "echasnovski/mini.nvim"; -- bunch of good small plugins: whitespace, buffer layout, commenting, surround, etc - - "tpope/vim-fugitive"; -- __the__ git plugin - - {"nvim-treesitter/nvim-treesitter", run=TSUpdate}; -- nice and quick syntax tree - - "lukas-reineke/indent-blankline.nvim"; -- pretty visualization of line indents - - "kosayoda/nvim-lightbulb"; -- shows a light bulb like vs code for code actions - "nvim-lua/lsp-status.nvim"; -- nice statusline components for LSP servers - - "tpope/vim-sleuth"; -- automatic tab/spaces detection - - "rhysd/vim-grammarous"; -- grammar checking - - "earthly/earthly.vim"; -- Earthfile support - - -- LSP Server - "neovim/nvim-lspconfig"; - "williamboman/nvim-lsp-installer"; - "jose-elias-alvarez/null-ls.nvim"; - "nanotee/nvim-lsp-basics"; - "folke/trouble.nvim"; - - -- autocomplete with nvim-cmp - "hrsh7th/cmp-nvim-lsp"; - "hrsh7th/cmp-buffer"; - "hrsh7th/cmp-path"; - "hrsh7th/cmp-cmdline"; - "hrsh7th/nvim-cmp"; - "L3MON4D3/LuaSnip"; - "saadparwaiz1/cmp_luasnip"; -} - -require("plugins.config.bufferline") -require("plugins.config.cmp") -require("plugins.config.gitsigns") -require("plugins.config.hop") -require("plugins.config.indentblankline") -require("plugins.config.lightbulb") -require("plugins.config.lspinstall") -require("plugins.config.mini") -require("plugins.config.statusline") -require("plugins.config.telescope") -require("plugins.config.treesitter") diff --git a/chezmoi/private_dot_config/nvim/lua/plugins/lsp.lua b/chezmoi/private_dot_config/nvim/lua/plugins/lsp.lua new file mode 100644 index 0000000..3c0b854 --- /dev/null +++ b/chezmoi/private_dot_config/nvim/lua/plugins/lsp.lua @@ -0,0 +1,146 @@ +-- LSP Configuration & Plugins +return { + { + "neovim/nvim-lspconfig", + dependencies = { + "williamboman/mason.nvim", + "williamboman/mason-lspconfig.nvim", + { + "j-hui/fidget.nvim", + tag = "legacy", + }, + "folke/neodev.nvim", + "RRethy/vim-illuminate", + "nanotee/nvim-lsp-basics", + "jose-elias-alvarez/null-ls.nvim", + }, + config = function() + -- Set up Mason before anything else + require("mason").setup() + require("mason-lspconfig").setup({ + ensure_installed = { + "lua_ls", + }, + automatic_installation = true, + }) + + -- Quick access via keymap + require("helpers.keys").map("n", "M", "Mason", "Show Mason") + + -- Neodev setup before LSP config + require("neodev").setup() + + -- Turn on LSP status information + require("fidget").setup() + + -- linter and formatter configurations + local null_ls = require("null-ls") + null_ls.setup({ + sources = { + null_ls.builtins.formatting.prettier, + null_ls.builtins.formatting.gofumpt, + null_ls.builtins.formatting.goimports, + null_ls.builtins.formatting.isort, + null_ls.builtins.formatting.black.with({ + extra_args = { "-l 120" } + }), + null_ls.builtins.diagnostics.flake8.with({ + extra_args = { "--max-line-length=120" } + }), + null_ls.builtins.formatting.rubocop, + null_ls.builtins.formatting.rustfmt, + null_ls.builtins.diagnostics.shellcheck, + null_ls.builtins.formatting.stylua, + } + }) + + -- Set up cool signs for diagnostics + local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " } + for type, icon in pairs(signs) do + local hl = "DiagnosticSign" .. type + vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" }) + end + + -- Diagnostic config + local config = { + virtual_text = false, + signs = { + active = signs, + }, + update_in_insert = true, + underline = true, + severity_sort = true, + float = { + focusable = true, + style = "minimal", + border = "rounded", + source = "always", + header = "", + prefix = "", + }, + } + vim.diagnostic.config(config) + + -- This function gets run when an LSP connects to a particular buffer. + local on_attach = function(client, bufnr) + local basics = require("lsp_basics") + basics.make_lsp_commands(client, bufnr) + basics.make_lsp_mappings(client, bufnr) + + local lsp_map = require("helpers.keys").lsp_map + lsp_map("lr", vim.lsp.buf.rename, bufnr, "Rename symbol") + lsp_map("la", vim.lsp.buf.code_action, bufnr, "Code action") + lsp_map("ld", vim.lsp.buf.type_definition, bufnr, "Type definition") + lsp_map("ls", require("telescope.builtin").lsp_document_symbols, bufnr, "Document symbols") + + lsp_map("gd", vim.lsp.buf.definition, bufnr, "Goto Definition") + lsp_map("gr", require("telescope.builtin").lsp_references, bufnr, "Goto References") + lsp_map("gI", vim.lsp.buf.implementation, bufnr, "Goto Implementation") + lsp_map("K", vim.lsp.buf.hover, bufnr, "Hover Documentation") + lsp_map("gD", vim.lsp.buf.declaration, bufnr, "Goto Declaration") + + -- Create a command `:Format` local to the LSP buffer + vim.api.nvim_buf_create_user_command(bufnr, "Format", function(_) + vim.lsp.buf.format() + end, { desc = "Format current buffer with LSP" }) + + lsp_map("ff", "Format", bufnr, "Format") + + -- Attach and configure vim-illuminate + require("illuminate").on_attach(client) + end + + local lspconfig = require("lspconfig") + + require("mason-lspconfig").setup_handlers({ + function(server_name) + lspconfig[server_name].setup({ + on_attach = on_attach, + }) + end, + ["lua_ls"] = function() + lspconfig.lua_ls.setup({ + on_attach = on_attach, + -- capabilities = capabilities, + settings = { + Lua = { + completion = { + callSnippet = "Replace", + }, + diagnostics = { + globals = { "vim" }, + }, + workspace = { + library = { + [vim.fn.expand("$VIMRUNTIME/lua")] = true, + [vim.fn.stdpath("config") .. "/lua"] = true, + }, + }, + }, + }, + }) + end + }) + end, + }, +} diff --git a/chezmoi/private_dot_config/nvim/lua/plugins/mini-nvim.lua b/chezmoi/private_dot_config/nvim/lua/plugins/mini-nvim.lua new file mode 100644 index 0000000..0438756 --- /dev/null +++ b/chezmoi/private_dot_config/nvim/lua/plugins/mini-nvim.lua @@ -0,0 +1,20 @@ +return { + { + "echasnovski/mini.nvim", + config = function() + require("mini.animate").setup() + require("mini.bufremove").setup() + require("mini.comment").setup() + require("mini.completion").setup() + require("mini.cursorword").setup() + require("mini.indentscope").setup({ + symbol = "│" + }) + require("mini.surround").setup() + require("mini.trailspace").setup() + + vim.api.nvim_command(":command Bd lua MiniBufremove.delete()") + vim.api.nvim_command(":command FixWhitespace lua MiniTrailspace.trim()") + end, + } +} diff --git a/chezmoi/private_dot_config/nvim/lua/plugins/sleuth.lua b/chezmoi/private_dot_config/nvim/lua/plugins/sleuth.lua new file mode 100644 index 0000000..9f8adf3 --- /dev/null +++ b/chezmoi/private_dot_config/nvim/lua/plugins/sleuth.lua @@ -0,0 +1,4 @@ +-- tpope sleuth! +return { + "tpope/vim-sleuth", -- Detect tabstop and shiftwidth automatically +} diff --git a/chezmoi/private_dot_config/nvim/lua/plugins/statusline.lua b/chezmoi/private_dot_config/nvim/lua/plugins/statusline.lua new file mode 100644 index 0000000..89b7d73 --- /dev/null +++ b/chezmoi/private_dot_config/nvim/lua/plugins/statusline.lua @@ -0,0 +1,16 @@ +-- Fancier statusline +return { + "nvim-lualine/lualine.nvim", + config = function() + local colorscheme = require("helpers.colorscheme") + local lualine_theme = colorscheme == "default" and "auto" or colorscheme + require("lualine").setup({ + options = { + icons_enabled = true, + theme = lualine_theme, + component_separators = "|", + section_separators = "", + }, + }) + end, +} diff --git a/chezmoi/private_dot_config/nvim/lua/plugins/surround.lua b/chezmoi/private_dot_config/nvim/lua/plugins/surround.lua new file mode 100644 index 0000000..706b056 --- /dev/null +++ b/chezmoi/private_dot_config/nvim/lua/plugins/surround.lua @@ -0,0 +1,4 @@ +-- tpope surround! +return { + "tpope/vim-surround", -- Surround stuff with the ys-, cs-, ds- commands +} diff --git a/chezmoi/private_dot_config/nvim/lua/plugins/telescope.lua b/chezmoi/private_dot_config/nvim/lua/plugins/telescope.lua new file mode 100644 index 0000000..861957c --- /dev/null +++ b/chezmoi/private_dot_config/nvim/lua/plugins/telescope.lua @@ -0,0 +1,35 @@ +-- Telescope fuzzying finding all the things +return { + { + "nvim-telescope/telescope.nvim", + branch = "0.1.x", + dependencies = { + "nvim-lua/plenary.nvim", + -- Fuzzy Finder Algorithm which requires local dependencies to be built. Only load if `make` is available + { "nvim-telescope/telescope-fzf-native.nvim", build = "make", cond = vim.fn.executable("make") == 1 }, + }, + config = function() + local telescope = require("telescope") + telescope.setup({ + extensions = { + fzf = { + fuzzy = true, + override_generic_sorter = true, + override_file_sorter = true, + case_mode = "smart_case", + } + } + }) + -- Enable telescope fzf native, if installed + pcall(telescope.load_extension, "fzf") + + local telescope_builtin = require("telescope.builtin") + local keys = require("helpers.keys") + keys.map("", "", telescope_builtin.find_files) + keys.map("", "ff", telescope_builtin.find_files) + keys.map("", "fg", telescope_builtin.live_grep) + keys.map("", "fb", telescope_builtin.buffers) + keys.map("", "fh", telescope_builtin.help_tags) + end, + } +} diff --git a/chezmoi/private_dot_config/nvim/lua/plugins/theme.lua b/chezmoi/private_dot_config/nvim/lua/plugins/theme.lua new file mode 100644 index 0000000..340eaaf --- /dev/null +++ b/chezmoi/private_dot_config/nvim/lua/plugins/theme.lua @@ -0,0 +1,9 @@ +return { + { + "ellisonleao/gruvbox.nvim", + priority = 1000, + opts = { + contrast = "hard" + }, + } +} diff --git a/chezmoi/private_dot_config/nvim/lua/plugins/treesitter.lua b/chezmoi/private_dot_config/nvim/lua/plugins/treesitter.lua new file mode 100644 index 0000000..81a411d --- /dev/null +++ b/chezmoi/private_dot_config/nvim/lua/plugins/treesitter.lua @@ -0,0 +1,27 @@ +-- Highlight, edit, and navigate code +return { + { + "nvim-treesitter/nvim-treesitter", + build = function() + pcall(require("nvim-treesitter.install").update({ with_sync = true })) + end, + config = function() + require("nvim-treesitter.configs").setup({ + -- Add languages to be installed here that you want installed for treesitter + ensure_installed = { "go", "javascript", "lua", "python", "rust", "typescript", "vim" }, + auto_install = true, + + highlight = { + enable = true, + -- Setting this to true will run `:h syntax` and tree-sitter at the same time. + -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). + -- Using this option may slow down your editor, and you may see some duplicate highlights. + -- Instead of true it can also be a list of languages + additional_vim_regex_highlighting = false, + }, + indent = { enable = true }, + incremental_selection = { enable = true }, + }) + end, + }, +} diff --git a/chezmoi/private_dot_config/nvim/lua/plugins/trouble.lua b/chezmoi/private_dot_config/nvim/lua/plugins/trouble.lua new file mode 100644 index 0000000..41d4945 --- /dev/null +++ b/chezmoi/private_dot_config/nvim/lua/plugins/trouble.lua @@ -0,0 +1,10 @@ +return { + "folke/trouble.nvim", + dependencies = { "nvim-tree/nvim-web-devicons" }, + config = function() + require("trouble").setup() + + local keys = require("helpers.keys") + keys.map("", "xx", "TroubleToggle") + end +} diff --git a/chezmoi/private_dot_config/nvim/lua/plugins/which-key.lua b/chezmoi/private_dot_config/nvim/lua/plugins/which-key.lua new file mode 100644 index 0000000..27f0ad1 --- /dev/null +++ b/chezmoi/private_dot_config/nvim/lua/plugins/which-key.lua @@ -0,0 +1,15 @@ +return { + { + "folke/which-key.nvim", + event = "VeryLazy", + init = function() + vim.o.timeout = true + vim.o.timeoutlen = 300 + end, + opts = { + -- your configuration comes here + -- or leave it empty to use the default settings + -- refer to the configuration section below + } + } +} diff --git a/chezmoi/private_dot_config/nvim/lua/settings.lua b/chezmoi/private_dot_config/nvim/lua/settings.lua deleted file mode 100644 index 6aa6f5e..0000000 --- a/chezmoi/private_dot_config/nvim/lua/settings.lua +++ /dev/null @@ -1,28 +0,0 @@ -local g = vim.g -local opt = vim.opt -local cmd = vim.cmd - --- color theme --- gruvbox is used via the autocmd require -g.gruvbox_contrast_dark = "hard" -- hard contrast mode for gruvobx -opt.background = "dark" -- make sure dark mode is used - -opt.termguicolors = true -- enable 24 bit colors -opt.mouse = 'c' -- disable mouse -opt.number = true -- show line numbers --- opt.cursorline = true -- highlight the line that the cursor is on -opt.laststatus = 2 -- always show the status line -opt.autoindent = true -- turn on autoindent -opt.smarttab = true -- turn on smart tabs -opt.incsearch = true -- turn on incremental search -opt.ruler = true -- show ruler on page -opt.lazyredraw = true -- make large files bearable -opt.regexpengine = 1 -- make searching large files bearable - --- tabs look like 4 spaces -opt.expandtab = true -opt.tabstop = 4 -opt.shiftwidth = 4 -opt.softtabstop = 4 - -cmd('filetype plugin indent on')