From b78fb64bd3b1fc1f84fe7dbc27d76d1f93546feb Mon Sep 17 00:00:00 2001 From: Michael Housh Date: Fri, 20 Dec 2024 08:10:53 -0500 Subject: [PATCH] feat: Rearranges nvim configuration --- nvim/m-housh/init.lua | 10 +-- .../lua/{user/plugin => plugins}/blink.lua | 0 .../lua/{user/plugin => plugins}/cmp.lua | 0 .../lua/{user/plugin => plugins}/comment.lua | 0 .../lua/{user/plugin => plugins}/fidget.lua | 0 .../{user/plugin => plugins}/formatter.lua | 0 .../lua/{user/plugin => plugins}/go.lua | 0 .../lua/{user/plugin => plugins}/harpoon.lua | 0 .../lua/{user/plugin => plugins}/init.lua | 0 .../lua/{user/plugin => plugins}/lazygit.lua | 0 .../lua/{user/plugin => plugins}/lsp.lua | 0 .../lua/{user/plugin => plugins}/lualine.lua | 0 .../lua/{user/plugin => plugins}/luasnip.lua | 0 .../lua/{user/plugin => plugins}/noice.lua | 0 .../lua/{user/plugin => plugins}/nvim-dap.lua | 0 .../{user/plugin => plugins}/nvim-dapui.lua | 0 .../{user/plugin => plugins}/nvim-lint.lua | 0 .../lua/{user/plugin => plugins}/oil.lua | 0 .../lua/{user/plugin => plugins}/swift.lua | 0 .../{user/plugin => plugins}/telescope.lua | 0 .../lua/{user/plugin => plugins}/theme.lua | 0 .../plugin => plugins}/todo-comments.lua | 0 .../{user/plugin => plugins}/toggleterm.lua | 0 .../{user/plugin => plugins}/treesitter.lua | 0 .../lua/{user/plugin => plugins}/trouble.lua | 0 .../{user/plugin => plugins}/which-key.lua | 0 .../lua/{user/plugin => plugins}/wrapping.lua | 0 .../{user/plugin => plugins}/xcodebuild.lua | 0 nvim/m-housh/lua/user/autocmd.lua | 50 -------------- nvim/m-housh/lua/user/keymaps.lua | 52 --------------- nvim/m-housh/lua/user/plugins.lua | 47 ------------- nvim/m-housh/lua/user/settings.lua | 66 ------------------- nvim/m-housh/lua/user/theme.lua | 4 -- 33 files changed, 5 insertions(+), 224 deletions(-) rename nvim/m-housh/lua/{user/plugin => plugins}/blink.lua (100%) rename nvim/m-housh/lua/{user/plugin => plugins}/cmp.lua (100%) rename nvim/m-housh/lua/{user/plugin => plugins}/comment.lua (100%) rename nvim/m-housh/lua/{user/plugin => plugins}/fidget.lua (100%) rename nvim/m-housh/lua/{user/plugin => plugins}/formatter.lua (100%) rename nvim/m-housh/lua/{user/plugin => plugins}/go.lua (100%) rename nvim/m-housh/lua/{user/plugin => plugins}/harpoon.lua (100%) rename nvim/m-housh/lua/{user/plugin => plugins}/init.lua (100%) rename nvim/m-housh/lua/{user/plugin => plugins}/lazygit.lua (100%) rename nvim/m-housh/lua/{user/plugin => plugins}/lsp.lua (100%) rename nvim/m-housh/lua/{user/plugin => plugins}/lualine.lua (100%) rename nvim/m-housh/lua/{user/plugin => plugins}/luasnip.lua (100%) rename nvim/m-housh/lua/{user/plugin => plugins}/noice.lua (100%) rename nvim/m-housh/lua/{user/plugin => plugins}/nvim-dap.lua (100%) rename nvim/m-housh/lua/{user/plugin => plugins}/nvim-dapui.lua (100%) rename nvim/m-housh/lua/{user/plugin => plugins}/nvim-lint.lua (100%) rename nvim/m-housh/lua/{user/plugin => plugins}/oil.lua (100%) rename nvim/m-housh/lua/{user/plugin => plugins}/swift.lua (100%) rename nvim/m-housh/lua/{user/plugin => plugins}/telescope.lua (100%) rename nvim/m-housh/lua/{user/plugin => plugins}/theme.lua (100%) rename nvim/m-housh/lua/{user/plugin => plugins}/todo-comments.lua (100%) rename nvim/m-housh/lua/{user/plugin => plugins}/toggleterm.lua (100%) rename nvim/m-housh/lua/{user/plugin => plugins}/treesitter.lua (100%) rename nvim/m-housh/lua/{user/plugin => plugins}/trouble.lua (100%) rename nvim/m-housh/lua/{user/plugin => plugins}/which-key.lua (100%) rename nvim/m-housh/lua/{user/plugin => plugins}/wrapping.lua (100%) rename nvim/m-housh/lua/{user/plugin => plugins}/xcodebuild.lua (100%) delete mode 100755 nvim/m-housh/lua/user/autocmd.lua delete mode 100755 nvim/m-housh/lua/user/keymaps.lua delete mode 100755 nvim/m-housh/lua/user/plugins.lua delete mode 100755 nvim/m-housh/lua/user/settings.lua delete mode 100755 nvim/m-housh/lua/user/theme.lua diff --git a/nvim/m-housh/init.lua b/nvim/m-housh/init.lua index 06e91c3..102fd84 100755 --- a/nvim/m-housh/init.lua +++ b/nvim/m-housh/init.lua @@ -7,16 +7,16 @@ vim.g.maplocalleader = " " -- file for projects. -- Common settings -require("user.settings") +require("config.settings") -- Auto commands -require("user.autocmd") +require("config.autocmd") -- Plugins -require("user.plugins") +require("config.lazy") -- Key maps -require("user.keymaps") +require("config.keymaps") -- Theme (must stay after plugins are loaded) -require("user.theme") +require("config.theme") diff --git a/nvim/m-housh/lua/user/plugin/blink.lua b/nvim/m-housh/lua/plugins/blink.lua similarity index 100% rename from nvim/m-housh/lua/user/plugin/blink.lua rename to nvim/m-housh/lua/plugins/blink.lua diff --git a/nvim/m-housh/lua/user/plugin/cmp.lua b/nvim/m-housh/lua/plugins/cmp.lua similarity index 100% rename from nvim/m-housh/lua/user/plugin/cmp.lua rename to nvim/m-housh/lua/plugins/cmp.lua diff --git a/nvim/m-housh/lua/user/plugin/comment.lua b/nvim/m-housh/lua/plugins/comment.lua similarity index 100% rename from nvim/m-housh/lua/user/plugin/comment.lua rename to nvim/m-housh/lua/plugins/comment.lua diff --git a/nvim/m-housh/lua/user/plugin/fidget.lua b/nvim/m-housh/lua/plugins/fidget.lua similarity index 100% rename from nvim/m-housh/lua/user/plugin/fidget.lua rename to nvim/m-housh/lua/plugins/fidget.lua diff --git a/nvim/m-housh/lua/user/plugin/formatter.lua b/nvim/m-housh/lua/plugins/formatter.lua similarity index 100% rename from nvim/m-housh/lua/user/plugin/formatter.lua rename to nvim/m-housh/lua/plugins/formatter.lua diff --git a/nvim/m-housh/lua/user/plugin/go.lua b/nvim/m-housh/lua/plugins/go.lua similarity index 100% rename from nvim/m-housh/lua/user/plugin/go.lua rename to nvim/m-housh/lua/plugins/go.lua diff --git a/nvim/m-housh/lua/user/plugin/harpoon.lua b/nvim/m-housh/lua/plugins/harpoon.lua similarity index 100% rename from nvim/m-housh/lua/user/plugin/harpoon.lua rename to nvim/m-housh/lua/plugins/harpoon.lua diff --git a/nvim/m-housh/lua/user/plugin/init.lua b/nvim/m-housh/lua/plugins/init.lua similarity index 100% rename from nvim/m-housh/lua/user/plugin/init.lua rename to nvim/m-housh/lua/plugins/init.lua diff --git a/nvim/m-housh/lua/user/plugin/lazygit.lua b/nvim/m-housh/lua/plugins/lazygit.lua similarity index 100% rename from nvim/m-housh/lua/user/plugin/lazygit.lua rename to nvim/m-housh/lua/plugins/lazygit.lua diff --git a/nvim/m-housh/lua/user/plugin/lsp.lua b/nvim/m-housh/lua/plugins/lsp.lua similarity index 100% rename from nvim/m-housh/lua/user/plugin/lsp.lua rename to nvim/m-housh/lua/plugins/lsp.lua diff --git a/nvim/m-housh/lua/user/plugin/lualine.lua b/nvim/m-housh/lua/plugins/lualine.lua similarity index 100% rename from nvim/m-housh/lua/user/plugin/lualine.lua rename to nvim/m-housh/lua/plugins/lualine.lua diff --git a/nvim/m-housh/lua/user/plugin/luasnip.lua b/nvim/m-housh/lua/plugins/luasnip.lua similarity index 100% rename from nvim/m-housh/lua/user/plugin/luasnip.lua rename to nvim/m-housh/lua/plugins/luasnip.lua diff --git a/nvim/m-housh/lua/user/plugin/noice.lua b/nvim/m-housh/lua/plugins/noice.lua similarity index 100% rename from nvim/m-housh/lua/user/plugin/noice.lua rename to nvim/m-housh/lua/plugins/noice.lua diff --git a/nvim/m-housh/lua/user/plugin/nvim-dap.lua b/nvim/m-housh/lua/plugins/nvim-dap.lua similarity index 100% rename from nvim/m-housh/lua/user/plugin/nvim-dap.lua rename to nvim/m-housh/lua/plugins/nvim-dap.lua diff --git a/nvim/m-housh/lua/user/plugin/nvim-dapui.lua b/nvim/m-housh/lua/plugins/nvim-dapui.lua similarity index 100% rename from nvim/m-housh/lua/user/plugin/nvim-dapui.lua rename to nvim/m-housh/lua/plugins/nvim-dapui.lua diff --git a/nvim/m-housh/lua/user/plugin/nvim-lint.lua b/nvim/m-housh/lua/plugins/nvim-lint.lua similarity index 100% rename from nvim/m-housh/lua/user/plugin/nvim-lint.lua rename to nvim/m-housh/lua/plugins/nvim-lint.lua diff --git a/nvim/m-housh/lua/user/plugin/oil.lua b/nvim/m-housh/lua/plugins/oil.lua similarity index 100% rename from nvim/m-housh/lua/user/plugin/oil.lua rename to nvim/m-housh/lua/plugins/oil.lua diff --git a/nvim/m-housh/lua/user/plugin/swift.lua b/nvim/m-housh/lua/plugins/swift.lua similarity index 100% rename from nvim/m-housh/lua/user/plugin/swift.lua rename to nvim/m-housh/lua/plugins/swift.lua diff --git a/nvim/m-housh/lua/user/plugin/telescope.lua b/nvim/m-housh/lua/plugins/telescope.lua similarity index 100% rename from nvim/m-housh/lua/user/plugin/telescope.lua rename to nvim/m-housh/lua/plugins/telescope.lua diff --git a/nvim/m-housh/lua/user/plugin/theme.lua b/nvim/m-housh/lua/plugins/theme.lua similarity index 100% rename from nvim/m-housh/lua/user/plugin/theme.lua rename to nvim/m-housh/lua/plugins/theme.lua diff --git a/nvim/m-housh/lua/user/plugin/todo-comments.lua b/nvim/m-housh/lua/plugins/todo-comments.lua similarity index 100% rename from nvim/m-housh/lua/user/plugin/todo-comments.lua rename to nvim/m-housh/lua/plugins/todo-comments.lua diff --git a/nvim/m-housh/lua/user/plugin/toggleterm.lua b/nvim/m-housh/lua/plugins/toggleterm.lua similarity index 100% rename from nvim/m-housh/lua/user/plugin/toggleterm.lua rename to nvim/m-housh/lua/plugins/toggleterm.lua diff --git a/nvim/m-housh/lua/user/plugin/treesitter.lua b/nvim/m-housh/lua/plugins/treesitter.lua similarity index 100% rename from nvim/m-housh/lua/user/plugin/treesitter.lua rename to nvim/m-housh/lua/plugins/treesitter.lua diff --git a/nvim/m-housh/lua/user/plugin/trouble.lua b/nvim/m-housh/lua/plugins/trouble.lua similarity index 100% rename from nvim/m-housh/lua/user/plugin/trouble.lua rename to nvim/m-housh/lua/plugins/trouble.lua diff --git a/nvim/m-housh/lua/user/plugin/which-key.lua b/nvim/m-housh/lua/plugins/which-key.lua similarity index 100% rename from nvim/m-housh/lua/user/plugin/which-key.lua rename to nvim/m-housh/lua/plugins/which-key.lua diff --git a/nvim/m-housh/lua/user/plugin/wrapping.lua b/nvim/m-housh/lua/plugins/wrapping.lua similarity index 100% rename from nvim/m-housh/lua/user/plugin/wrapping.lua rename to nvim/m-housh/lua/plugins/wrapping.lua diff --git a/nvim/m-housh/lua/user/plugin/xcodebuild.lua b/nvim/m-housh/lua/plugins/xcodebuild.lua similarity index 100% rename from nvim/m-housh/lua/user/plugin/xcodebuild.lua rename to nvim/m-housh/lua/plugins/xcodebuild.lua diff --git a/nvim/m-housh/lua/user/autocmd.lua b/nvim/m-housh/lua/user/autocmd.lua deleted file mode 100755 index a9f30b3..0000000 --- a/nvim/m-housh/lua/user/autocmd.lua +++ /dev/null @@ -1,50 +0,0 @@ -local defaultGroupOptions = { clear = true } -local markdownGroup = vim.api.nvim_create_augroup("MyMarkdownGroup", defaultGroupOptions) -local spellGroup = vim.api.nvim_create_augroup("SpellGroup", defaultGroupOptions) -local createCmd = vim.api.nvim_create_autocmd - --- Spell check -createCmd("BufEnter", { - pattern = { "*.md", "*.markdown", "*.txt", "*.tex" }, - group = spellGroup, - callback = function(_) - vim.cmd.setlocal("textwidth=80") - vim.cmd.setlocal("spell spelllang=en_us") - end, -}) - --- Markdown -createCmd("BufWritePost", { - pattern = { "*.md", "*.markdown" }, - group = markdownGroup, - callback = function(_) - local cursor = vim.fn.getpos(".") - vim.cmd("FormatWrite") - vim.fn.setpos(".", cursor) - end, -}) - --- Go -createCmd("BufWritePre", { - pattern = "*.go", - callback = function() - require("go.format").goimport() - end, - group = vim.api.nvim_create_augroup("GoFormat", defaultGroupOptions), -}) - -vim.api.nvim_exec2( - [[ - autocmd BufNewFile,BufRead /private/**/gopass** setlocal noswapfile nobackup noundofile shada="" - ]], - {} -) - --- Highlight when yanking. -createCmd("TextYankPost", { - desc = "Highlight when yanking text.", - group = vim.api.nvim_create_augroup("highlight-yank", { clear = true }), - callback = function() - vim.highlight.on_yank() - end, -}) diff --git a/nvim/m-housh/lua/user/keymaps.lua b/nvim/m-housh/lua/user/keymaps.lua deleted file mode 100755 index a486023..0000000 --- a/nvim/m-housh/lua/user/keymaps.lua +++ /dev/null @@ -1,52 +0,0 @@ -vim.g.mapleader = " " -vim.g.maplocalleader = " " - -local keymap = vim.keymap.set -local default_options = { noremap = true, silent = true } -local wk = require("which-key") - -local wk_add = function(mode, keymaps) - wk.add(keymaps, { mode = mode, silent = true }) -end - --------------------------------------------------------------------------------- --- Insert Mode --------------------------------------------------------------------------------- --- easier escape key mapping -keymap("i", "jk", "", default_options) -wk_add("i", { - { "", ":writea", desc = "[S]ave" }, -}) - --------------------------------------------------------------------------------- --- Normal Mode --------------------------------------------------------------------------------- -wk_add("n", { - { "", ":vertical resize +1", desc = "Resize Pane Left" }, - { "", ":vertical resize -1", desc = "Resize Pane Right" }, - { "", "resize -1", desc = "Resize Pane Up" }, - { "", "resize +1", desc = "Resize Pane Down" }, - - { "n", ":noh", desc = "[N]o highlighting" }, - { "s", ":set spell!", desc = "[S]pell check toggle" }, - { "", ":write", desc = "[S]ave" }, - - { "J", ":move .+1==", desc = "Move line down" }, - { "K", ":move .-2==", desc = "Move line up" }, - - { "z", ":ZenMode", desc = "[Z]en Mode" }, -}) - --------------------------------------------------------------------------------- --- Visual Mode --------------------------------------------------------------------------------- - -vim.keymap.set("v", "K", ":move '<-2gv=gv", { desc = "Move selected block up.", silent = true, noremap = true }) -vim.keymap.set("v", "J", ":move '>+1gv=gv", { desc = "Move selected block up.", silent = true, noremap = true }) - --- Toggle term key maps, that get attached when terminal is opened. -function _G.set_terminal_keymaps() - local opts = { buffer = 0 } - keymap("t", "", [[]], opts) -end -vim.cmd("autocmd! TermOpen term://* lua set_terminal_keymaps()") diff --git a/nvim/m-housh/lua/user/plugins.lua b/nvim/m-housh/lua/user/plugins.lua deleted file mode 100755 index 6c4bfeb..0000000 --- a/nvim/m-housh/lua/user/plugins.lua +++ /dev/null @@ -1,47 +0,0 @@ --- Bootstrap Lazy. -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) - -require("lazy").setup({ - dev = { - path = "~/LocalProjects/plugins", - fallback = true, - }, - -- Import all the plugin configs in the 'plugin' directory - { import = "user.plugin" }, - -- Plugins that don't have a configuration file. - { - "folke/zen-mode.nvim", - opts = {}, - }, - { - "christoomey/vim-tmux-navigator", - lazy = false, - }, - { "NoahTheDuke/vim-just", ft = { "just" } }, - { - "chipsenkbeil/distant.nvim", - version = "v0.*", - event = "VeryLazy", - }, -}, { - checker = { - enabled = true, - notify = false, - }, - change_detection = { - notify = false, - }, -}) - -vim.keymap.set("n", "ll", "Lazy", { desc = "Open [L]azy" }) diff --git a/nvim/m-housh/lua/user/settings.lua b/nvim/m-housh/lua/user/settings.lua deleted file mode 100755 index 96ec45b..0000000 --- a/nvim/m-housh/lua/user/settings.lua +++ /dev/null @@ -1,66 +0,0 @@ -local o = vim.opt -local wo = vim.wo -local fn = vim.fn - -vim.cmd.set("inccommand=split") -o.filetype = "on" -o.updatetime = 500 -- faster completion -o.timeoutlen = 800 -- time to wait for a mapped sequence to complete (in milliseconds) -o.ttimeoutlen = 300 -- Time in milliseconds to wait for a key code sequence to complete -o.backup = false -- creates a backup file -o.swapfile = false -- enable/disable swap file creation -o.dir = fn.stdpath("data") .. "/swp" -- swap file directory -o.undofile = false -- enable/disable undo file creation -o.undodir = fn.stdpath("data") .. "/undodir" -- set undo directory -o.history = 500 -- Use the 'history' option to set the number of lines from command mode that are remembered. -o.hidden = true -- required to keep multiple buffers and open multiple buffers -o.clipboard = "unnamedplus" -- allows neovim to access the system clipboard -o.fileencoding = "utf-8" -- the encoding written to a file -o.conceallevel = 0 -- so that `` is visible in markdown files -o.number = true -- set numbered lines -o.relativenumber = true -- set relative numbered lines -o.cmdheight = 1 -- space for displaying messages/commands -o.showmode = false -- we don't need to see things like -- INSERT -- anymore -o.showtabline = 2 -- always show tabs -o.laststatus = 2 -- The value of this option influences when the last window will have a status line (2 always) -o.smartcase = true -- smart case -o.smartindent = true -- make indenting smarter again -o.splitbelow = true -- force all horizontal splits to go below current window -o.splitright = true -- force all vertical splits to go to the right of current window -o.autoindent = true -- turn on auto indent. -o.expandtab = true -- convert tabs to spaces -o.smarttab = true -- turn on smart tab -o.shiftwidth = 2 -- the number of spaces inserted for each indentation -o.tabstop = 2 -- how many columns a tab counts for -o.termguicolors = true -- set term gui colors (most terminals support this) -o.cursorline = true -- highlight the current line -o.scrolloff = 20 -- Minimal number of screen lines to keep above and below the cursor -o.sidescrolloff = 5 -- The minimal number of columns to scroll horizontally -o.hlsearch = false -- highlight all matches on previous search pattern -o.ignorecase = true -- ignore case in search patterns -o.foldenable = false -- disable folding; enable with zi -o.foldmethod = "expr" -o.foldexpr = "nvim_treesitter#foldexpr()" --- o.listchars = "eol:¬,tab:>·,trail:~,extends:>,precedes:<" -o.listchars = "eol:¬,tab:>·,trail:~,extends:>,precedes:<,space:␣" -o.shortmess = o.shortmess + "c" -- prevent "pattern not found" messages -wo.colorcolumn = "99999" -o.wildmode = "full" -o.lazyredraw = false -- do not redraw screen while running macros -o.grepprg = "rg --hidden --vimgrep --smart-case --" -o.completeopt = { "menu", "menuone", "noselect", "noinsert" } -- A comma separated list of options for Insert mode completion -o.wildignorecase = true -- When set case is ignored when completing file names and directories -o.wildignore = [[ -.git,.hg,.svn -*.aux,*.out,*.toc -*.o,*.obj,*.exe,*.dll,*.manifest,*.rbc,*.class -*.ai,*.bmp,*.gif,*.ico,*.jpg,*.jpeg,*.png,*.psd,*.webp -*.avi,*.divx,*.mp4,*.webm,*.mov,*.m2ts,*.mkv,*.vob,*.mpg,*.mpeg -*.mp3,*.oga,*.ogg,*.wav,*.flac -*.eot,*.otf,*.ttf,*.woff -*.doc,*.pdf,*.cbr,*.cbz -*.zip,*.tar.gz,*.tar.bz2,*.rar,*.tar.xz,*.kgb -*.swp,.lock,.DS_Store,._* -*/tmp/*,*.so,*.swp,*.zip,**/node_modules/**,**/target/**,**.terraform/**" -]] -o.viminfo = "" -- disable viminfo from copying information from current session, for security. diff --git a/nvim/m-housh/lua/user/theme.lua b/nvim/m-housh/lua/user/theme.lua deleted file mode 100755 index 79a299d..0000000 --- a/nvim/m-housh/lua/user/theme.lua +++ /dev/null @@ -1,4 +0,0 @@ --- Nightfox ---require('nightfox').load('terrafox') -vim.cmd.colorscheme "catppuccin" -